@mohamedatia/fly-design-system 2.16.0 → 2.16.2
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mohamedatia-fly-design-system.mjs","sources":["../../../projects/design-system/src/lib/fly-federation-singleton-guard.ts","../../../projects/design-system/src/lib/models/window.model.ts","../../../projects/design-system/src/lib/models/share-panel.model.ts","../../../projects/design-system/src/lib/models/audience.model.ts","../../../projects/design-system/src/lib/services/auth.service.ts","../../../projects/design-system/src/lib/i18n/baseline-locales.ts","../../../projects/design-system/src/lib/services/i18n.service.ts","../../../projects/design-system/src/lib/services/fly-theme.service.ts","../../../projects/design-system/src/lib/services/window-manager.service.ts","../../../projects/design-system/src/lib/services/fly-remote-router.types.ts","../../../projects/design-system/src/lib/services/fly-remote-router.service.ts","../../../projects/design-system/src/lib/services/fly-remote-context.service.ts","../../../projects/design-system/src/lib/services/source-app-resolver.service.ts","../../../projects/design-system/src/lib/services/fly-window-help.service.ts","../../../projects/design-system/src/lib/services/fly-remote-styles.ts","../../../projects/design-system/src/lib/components/fly-remote-router-outlet/fly-remote-router-outlet.component.ts","../../../projects/design-system/src/lib/pipes/translate.pipe.ts","../../../projects/design-system/src/lib/services/auth.service.mock.ts","../../../projects/design-system/src/lib/services/agent-input/agent-lookup-registry.service.ts","../../../projects/design-system/src/lib/components/entity-lookup/entity-lookup.component.ts","../../../projects/design-system/src/lib/components/entity-lookup/entity-lookup.component.html","../../../projects/design-system/src/lib/tiptap/flyos-link.ts","../../../projects/design-system/src/lib/components/markdown-editor/markdown-editor.types.ts","../../../projects/design-system/src/lib/components/markdown-editor/markdown-editor.component.ts","../../../projects/design-system/src/lib/components/markdown-editor/markdown-editor.component.html","../../../projects/design-system/src/lib/components/context-menu/context-menu.component.ts","../../../projects/design-system/src/lib/components/context-menu/context-menu.component.html","../../../projects/design-system/src/lib/components/message-box/message-box.service.ts","../../../projects/design-system/src/lib/components/message-box/message-box.component.ts","../../../projects/design-system/src/lib/components/message-box/message-box.component.html","../../../projects/design-system/src/lib/components/share-panel/share-panel.component.ts","../../../projects/design-system/src/lib/components/share-panel/share-panel.component.html","../../../projects/design-system/src/lib/components/audience-builder/audience-builder.component.ts","../../../projects/design-system/src/lib/components/audience-builder/audience-builder.component.html","../../../projects/design-system/src/lib/components/block-ui/block-ui.component.ts","../../../projects/design-system/src/lib/components/block-ui/block-ui.component.html","../../../projects/design-system/src/lib/components/drawer/drawer.component.ts","../../../projects/design-system/src/lib/components/drawer/drawer.component.html","../../../projects/design-system/src/lib/components/image-upload/fly-image-upload.component.ts","../../../projects/design-system/src/lib/components/file-upload/fly-file-upload.component.ts","../../../projects/design-system/src/lib/services/agent-input/agent-command-registry.service.ts","../../../projects/design-system/src/lib/services/agent-input/agent-drop-registry.service.ts","../../../projects/design-system/src/lib/models/agent-action.model.ts","../../../projects/design-system/src/lib/models/agent-input.model.ts","../../../projects/design-system/src/lib/utils/agent-payload-guards.ts","../../../projects/design-system/src/lib/services/agent-input/agent-action-bus.service.ts","../../../projects/design-system/src/lib/services/agent-input/agent-flight-animator.service.ts","../../../projects/design-system/src/lib/directives/fly-agent-draggable.directive.ts","../../../projects/design-system/src/lib/directives/fly-secure-src.directive.ts","../../../projects/design-system/src/lib/models/fly-locale-catalog.ts","../../../projects/design-system/src/public-api.ts","../../../projects/design-system/src/mohamedatia-fly-design-system.ts"],"sourcesContent":["/**\n * Federation singleton self-check (side-effecting module).\n *\n * Invariant: the design-system MUST resolve to ONE shared instance per browser\n * window. The FlyOS shell shares it from workspace SOURCE (federation.config.js\n * `sharedMappings` + `features.mappingVersion`, advertising the real version),\n * and every federated remote (Circles, …) binds to that single instance as a\n * `singleton`. If a remote instead bundles its OWN copy — `requiredVersion`\n * unsatisfied, `strictVersion: true`, or the host advertising an empty version\n * because `mappingVersion` is off — the platform silently forks. Separate\n * `providedIn: 'root'` singletons then mean:\n * - cross-app deep links break: `FlyRemoteRouter` writes the canonical\n * `?app=&route=` URL on the remote's own instance, so a reload never reaches\n * the shell's launch pipeline (see skills/cross-app-deep-linking.md);\n * - the `/lookup` + slash-command registries diverge, so entities registered\n * in the remote never reach the shell's agent input.\n *\n * Both bugs are invisible until a user trips over them. This check makes the\n * fork LOUD at load time: each DS module evaluation appends its compiled-in\n * version to a `globalThis` registry, and a second entry in the same window is\n * the fork signal. The healthy case (one shared instance) stays silent.\n *\n * Why a plain `globalThis` key and not DI: a forked DS means a *separate* module\n * graph, so any DI token / module-scoped variable is exactly what's duplicated.\n * Only a JS global is shared across module instances in one window — the same\n * reason `__FLYOS_SHELL__` and the pending-launches registry use globals.\n *\n * See skills/business-app-angular-remote.md § \"Design-system singleton across\n * the federation boundary\".\n */\n\n// Keep in sync with projects/design-system/package.json \"version\". Used only for\n// the diagnostic message — the duplicate-instance detection is version-agnostic.\nexport const FLY_DS_VERSION = '2.12.0';\n\nexport const FLY_DS_REGISTRY_KEY = '__FLY_DS_INSTANCES__';\n\nexport interface FlyDsInstanceRegistry {\n versions: string[];\n}\n\n/**\n * Records this design-system instance on the shared `scope` and returns the\n * running count of instances seen in this window. Emits a single loud\n * `console.error` the moment the count exceeds 1 (the fork signal). Pure aside\n * from the registry mutation + console — callable with a fake scope in tests.\n */\nexport function registerDesignSystemInstance(\n scope: Record<string, FlyDsInstanceRegistry | undefined>,\n version: string,\n): number {\n const registry: FlyDsInstanceRegistry = (scope[FLY_DS_REGISTRY_KEY] ??= { versions: [] });\n registry.versions.push(version);\n if (registry.versions.length > 1) {\n // eslint-disable-next-line no-console\n console.error(\n `[fly-design-system] Federation singleton FORKED: ${registry.versions.length} ` +\n `design-system instances loaded in one window (versions: ${registry.versions.join(', ')}). ` +\n `A federated remote is using its own bundled copy instead of the shell's shared ` +\n `singleton — cross-app deep links and /lookup registration WILL break. Fix: align the ` +\n `remote's federation \\`requiredVersion\\` with the host's advertised version and keep ` +\n `\\`features.mappingVersion: true\\` in the shell's federation.config.js.`,\n );\n }\n return registry.versions.length;\n}\n\n// Run once when this module is evaluated — except under the Vitest runner, which\n// re-evaluates module graphs per test file against a shared Node global and would\n// otherwise accumulate phantom \"instances\". The fork this detects only occurs in a\n// real federated browser runtime, where each bundle evaluates the module exactly once.\n// Reach `process.env.VITEST` via globalThis rather than the bare `process`\n// identifier — the latter needs @types/node, which the production library build\n// (tsconfig.lib.prod.json) deliberately doesn't include, and would fail TS2591.\nconst underTest = !!(\n globalThis as { process?: { env?: Record<string, string | undefined> } }\n).process?.env?.['VITEST'];\nif (!underTest) {\n registerDesignSystemInstance(\n globalThis as unknown as Record<string, FlyDsInstanceRegistry | undefined>,\n FLY_DS_VERSION,\n );\n}\n","import { InjectionToken, Signal, Type, WritableSignal } from '@angular/core';\n\nexport type WindowState = 'normal' | 'minimized' | 'maximized';\n\nexport interface ChildWindowData {\n childComponent: Type<unknown>;\n [key: string]: unknown;\n}\n\nexport interface WindowInstance {\n id: string;\n appId: string;\n title: string;\n icon: string;\n iconBg: string;\n state: WindowState;\n position: { x: number; y: number };\n size: { width: number; height: number };\n zIndex: number;\n isFocused: boolean;\n isClosing?: boolean;\n isMinimizing?: boolean;\n isRestoring?: boolean;\n isMaximizing?: boolean;\n isUnmaximizing?: boolean;\n parentWindowId?: string;\n childData?: ChildWindowData;\n /** Populated when remote `loadComponent()` fails (e.g. federation). */\n remoteLoadError?: string;\n /** When true, the shell draws a block overlay over `.window-content` (see `FlyBlockUiComponent`). */\n contentUiBlocked?: boolean;\n /** i18n key for block overlay label; shell defaults to `common.loading` when unset. */\n contentUiBlockMessageKey?: string;\n}\n\nexport const WINDOW_DATA = new InjectionToken<WindowInstance>('WINDOW_DATA');\n\n/**\n * Payload delivered to a window when it is launched (or re-launched) via a deep link.\n * Both fields are nullable: a normal dock click yields `route: null`, `params: null`.\n * `version` starts at 1 for the first launch and increments on every subsequent\n * re-launch of the same window so listeners can dedupe on `version` changes.\n */\nexport interface LaunchContext {\n readonly route: string | null;\n readonly params: Readonly<Record<string, unknown>> | null;\n readonly version: number;\n}\n\n/**\n * Per-window injection token carrying the active `LaunchContext` as a signal.\n *\n * **Shell-internal.** The shell uses this to track per-window deep-link state across\n * dock launches. **Federated remotes must not consume it** — Native Federation can\n * split the `InjectionToken` instance across the host and remote bundles, in which\n * case `inject(LAUNCH_CONTEXT)` in the remote returns `null` regardless of host\n * provisioning. Remotes subscribe to deep links via the federation-safe surfaces\n * instead: `FLYOS_LAUNCH_EVENT` (window CustomEvent) plus the\n * `__FLYOS_PENDING_LAUNCHES__` registry on `globalThis`. See\n * <c>skills/cross-app-deep-linking.md</c>.\n */\nexport const LAUNCH_CONTEXT = new InjectionToken<Signal<LaunchContext | null>>('LAUNCH_CONTEXT');\n\n/**\n * Detail payload of the <c>flyos:launch</c> window CustomEvent. The shell\n * dispatches one event per launch; remotes use this contract to navigate to the\n * requested route. Mirrored to <see cref=\"FlyosPendingLaunchesGlobalKey\"/> so a\n * remote that mounts AFTER the dispatch can still drain the most recent launch.\n */\nexport interface FlyLaunchEventDetail {\n /** The id used to look up the app in the shell registry (post-canonicalization). */\n readonly appId: string;\n /** The launch payload — same shape the shell stores on the per-window signal. */\n readonly ctx: LaunchContext;\n}\n\n/**\n * Name of the window CustomEvent the shell dispatches per launch.\n *\n * Listeners run on `window` and receive a <c>CustomEvent<FlyLaunchEventDetail></c>.\n * Always filter by `detail.appId` — every remote sees every launch.\n */\nexport const FLYOS_LAUNCH_EVENT = 'flyos:launch';\n\n/**\n * `globalThis` key for the pending-launches registry. Map<appId, LaunchContext>.\n *\n * The shell writes the latest launch for each app and the corresponding remote\n * **drains** the entry on first mount (i.e. reads then deletes). This covers the\n * first-launch race where the event fires before the remote's listener attaches.\n * Subsequent re-launches into the already-mounted remote arrive via the event.\n */\nexport const FlyosPendingLaunchesGlobalKey = '__FLYOS_PENDING_LAUNCHES__' as const;\n\n/** Type of the `globalThis[FlyosPendingLaunchesGlobalKey]` registry. */\nexport type FlyosPendingLaunches = Record<string, LaunchContext>;\n\n/**\n * Detail payload of the <c>flyos:remote-route</c> window CustomEvent — the\n * INVERSE of {@link FLYOS_LAUNCH_EVENT}. A federated remote dispatches this\n * whenever its OWN logical route changes (user navigation inside the remote), so\n * the shell — the single owner of the browser address bar and history — can\n * mirror the route to `…/desktop?app=&route=` and push one history entry.\n *\n * Emitted by `FlyRemoteRouter` ONLY when {@link FlyosShellOwnsHistoryGlobalKey}\n * is set (a new shell is present and listening). Older shells receive no event\n * and the remote keeps writing its own `pushState` — so this is backward\n * compatible.\n */\nexport interface FlyRemoteRouteEventDetail {\n /** The shell-registry app id (from `WINDOW_DATA`). */\n readonly appId: string;\n /** The window instance id, or null when `WINDOW_DATA` is split across bundles. */\n readonly windowId: string | null;\n /** The remote's new logical URL, e.g. `/signals/abc`. */\n readonly url: string;\n}\n\n/** Name of the window CustomEvent a remote dispatches when its route changes. */\nexport const FLYOS_REMOTE_ROUTE_EVENT = 'flyos:remote-route';\n\n/**\n * `globalThis` flag set by the shell when it owns the address bar + history for\n * ALL windows (os-core AND remotes) via `ShellHistoryService`. When set, a\n * remote's `FlyRemoteRouter` defers history to the shell (dispatching\n * {@link FLYOS_REMOTE_ROUTE_EVENT} instead of calling `history.pushState`) and\n * stops handling its own `popstate` (the shell replays routes via\n * {@link FLYOS_LAUNCH_EVENT}). Absent ⇒ legacy self-managed behaviour.\n */\nexport const FlyosShellOwnsHistoryGlobalKey = '__FLYOS_SHELL_OWNS_HISTORY__' as const;\n\n/**\n * Hint published by an app to drive the window-titlebar help-button deeplink.\n *\n * The shell renders the help button automatically on every non-chromeless\n * window, defaulting the deeplink to `params.appId = win.appId`. An app\n * customises that deeplink by injecting <see cref=\"WINDOW_HELP_HINT\"/> and\n * setting the writable signal — typically once on construct + again as the\n * active route/page changes.\n *\n * - `appId` overrides `win.appId` (rare; reserved for embedded sub-apps\n * whose help lives under a different seed-pack id).\n * - `topic` seeds the help-center search query when the deeplink fires.\n * Free-form short phrase (e.g. \"calculated measures\", \"share dialog\").\n * Updated dynamically as the user navigates within the app.\n */\nexport interface WindowHelpHint {\n /** Override for the help-center `appId` chip pre-selection. Optional. */\n readonly appId?: string;\n /** Free-form search-query seed for the help-center landing. */\n readonly topic?: string | null;\n}\n\n/**\n * Per-window injection token carrying the active <see cref=\"WindowHelpHint\"/>\n * as a writable signal. The shell creates one writable signal per window\n * (alongside <see cref=\"LAUNCH_CONTEXT\"/>); apps inject it and `.set(...)` to\n * publish or update their hint. Setting `null` clears the hint — the chrome\n * falls back to the implicit `win.appId` deeplink.\n *\n * **Federation note:** same caveat as <see cref=\"LAUNCH_CONTEXT\"/> — Native\n * Federation can split the InjectionToken across host/remote bundles, so\n * federated remotes cannot rely on DI to publish hints. Use\n * <see cref=\"FLY_WINDOW_HELP_HINT_EVENT\"/> instead.\n */\nexport const WINDOW_HELP_HINT = new InjectionToken<WritableSignal<WindowHelpHint | null>>(\n 'WINDOW_HELP_HINT',\n);\n\n/**\n * Federation-safe window CustomEvent name for publishing a help hint from a\n * federated remote that cannot see <see cref=\"WINDOW_HELP_HINT\"/> via DI.\n *\n * Detail: <see cref=\"FlyWindowHelpHintEventDetail\"/>. The shell listens at\n * `window` scope and mirrors the payload into the matching per-window signal\n * (keyed by `windowId` from <see cref=\"WINDOW_DATA\"/>). Pairs with the\n * <see cref=\"FLYOS_LAUNCH_EVENT\"/> pattern.\n */\nexport const FLY_WINDOW_HELP_HINT_EVENT = 'flyos:window-help-hint';\n\n/**\n * Detail payload of the <see cref=\"FLY_WINDOW_HELP_HINT_EVENT\"/> CustomEvent.\n * Federated remotes dispatch one event per hint change; the shell filters\n * by `windowId` (each window owns its own hint).\n */\nexport interface FlyWindowHelpHintEventDetail {\n /** Window id; remotes obtain via WINDOW_DATA at mount. */\n readonly windowId: string;\n /** Pass `null` to clear; the chrome reverts to win.appId. */\n readonly hint: WindowHelpHint | null;\n}\n","/**\n * Generic share / ACL panel models — hosts map domain DTOs to these shapes.\n *\n * v2.0.0: introduces the {@link SharePrincipal} discriminated union to replace the v1\n * \"set-which-is-set\" discriminator on {@link SharePermissionEntry} (`grantedToUserId` /\n * `grantedToOuId` / `grantedToAppId`). The new shape compiles invalid combinations away\n * (a permission row carries exactly one principal, never overlapping ids) and reserves\n * a `role` kind for the planned apps-chart role-as-principal flow.\n */\n\n/**\n * Discriminated principal that owns a share permission row. Hosts translate domain DTO\n * fields into one of these variants.\n *\n * The `role` variant is reserved for a follow-up enabling the Apps-chart role-as-principal\n * flow end-to-end (frontend looks up the role-OU UUID; backend's PermissionResolver must\n * enumerate the user's full OU set including computed-from-role memberships). Until that\n * runtime work lands, hosts SHOULD NOT emit `role` principals.\n */\nexport type SharePrincipal =\n | UserPrincipal\n | RolePrincipal\n | OuPrincipal\n | AppEveryonePrincipal;\n\nexport interface UserPrincipal {\n kind: 'user';\n /** Tenant-scoped user id. */\n userId: string;\n /** Display name resolved by the host (e.g. \"Jane Doe\"). Falls back to a Guid prefix. */\n displayName?: string;\n /** Optional email — surfaced as a secondary line on the row when set. */\n email?: string;\n}\n\nexport interface RolePrincipal {\n kind: 'role';\n /** Owning app id (e.g. `circles`). Roles are unique within an app, not globally. */\n appId: string;\n /** Stable role key within that app (e.g. `ffo`, `viewer`). */\n roleKey: string;\n displayName?: string;\n}\n\nexport interface OuPrincipal {\n kind: 'ou';\n ouId: string;\n /** Chart context for stable display labels. Null = the Default Company chart. */\n chartId?: string | null;\n displayName?: string;\n}\n\nexport interface AppEveryonePrincipal {\n kind: 'app-everyone';\n /** App id whose user population this grant targets. `*` = every tenant user. */\n appId: string;\n displayName?: string;\n}\n\n/** Principal-kind discriminator strings — re-exported for hosts that build menus dynamically. */\nexport type SharePrincipalKind = SharePrincipal['kind'];\n\n/**\n * One row of the share-panel permissions list. v2.0 carries a {@link SharePrincipal}\n * discriminated union instead of the v1 `grantedToUserId` / `grantedToOuId` / `grantedToAppId`\n * fields. See the file header for migration notes.\n */\nexport interface SharePermissionEntry {\n id: string;\n principal: SharePrincipal;\n level: string;\n isInherited?: boolean;\n /**\n * When true, this row is a deny grant — visually distinct, revokes access for the\n * principal regardless of any matching allow grant. Backed by the ACL semantic in\n * Files Manager (`FilePermission.IsDeny`) and Notes (`NoteShareLevel.Deny`).\n * Hosts that do not support deny grants may omit this field entirely.\n */\n isDeny?: boolean;\n}\n\nexport interface ShareUserResult {\n id: string;\n firstName: string;\n lastName: string;\n email: string;\n}\n\nexport interface ShareOuNode {\n id: string;\n displayName: string;\n /** 0 = root. When set, share panel indents rows for hierarchy. */\n depth?: number;\n}\n\n/** Option for OU tree source: `id` null = default/official org chart. */\nexport interface ShareOrgChartOption {\n id: string | null;\n name: string;\n /**\n * Stable system-chart key used by hosts that want to pre-select a specific platform-managed\n * chart (e.g. `'apps'`, `'default-company'`). Custom charts have no system key. Wired through\n * `defaultChartSystemKey` on share-panel / audience-builder so the host doesn't need to know\n * the tenant-specific Guid up front.\n */\n systemKey?: string | null;\n}\n\n/**\n * Stable identifiers for platform-managed system charts. Hosts that don't recognise the\n * value just fall through to the default selection — these constants are advisory.\n */\nexport const SHARE_ORG_CHART_SYSTEM_KEY_DEFAULT = 'default-company';\nexport const SHARE_ORG_CHART_SYSTEM_KEY_APPS = 'apps';\n\nexport interface SharePanelLevelOption {\n value: string;\n labelKey: string;\n}\n","/**\n * Canonical {@link AudienceFilter} TypeScript model — wire-compatible byte-for-byte with the\n * C# `Fly.Shared.Core.Audience.AudienceFilter` polymorphic record. The discriminator field is\n * `kind` and matches the values declared in `AudienceTerm.cs`'s `[JsonDerivedType]` attributes:\n * `users`, `roles`, `ou`, `app-everyone`, `chart`, `preset`.\n *\n * Resolution semantics (server-side, see `AudienceFilter.cs`):\n * 1. Each include term is expanded to a user-id set; sets are unioned.\n * 2. Each exclude term is expanded; the union of excludes is subtracted.\n * 3. Inactive users are filtered when {@link AudienceOptions.excludeInactiveUsers} is true.\n *\n * **Empty `includes` resolves to the empty set — never \"everyone\".** To target every user in a\n * tenant, emit an explicit {@link AppEveryoneTerm} or {@link ChartTerm}; this matches the\n * defensive backend default and prevents a UI bug from broadcasting tenant-wide.\n */\nexport interface AudienceFilter {\n /** At least one term required server-side; an empty array resolves to zero recipients. */\n includes: AudienceTerm[];\n /** Optional. Subtracted from the include union. */\n excludes?: AudienceTerm[];\n /** Optional resolver options. Server applies defaults when omitted. */\n options?: AudienceOptions;\n}\n\n/** Tagged union of the six supported audience term kinds. */\nexport type AudienceTerm =\n | UsersTerm\n | RolesTerm\n | OuTerm\n | AppEveryoneTerm\n | ChartTerm\n | PresetTerm;\n\nexport type AudienceTermKind = AudienceTerm['kind'];\n\n/** Discriminator string values — re-exported so hosts can build kind menus dynamically. */\nexport const AUDIENCE_TERM_KINDS = [\n 'users',\n 'roles',\n 'ou',\n 'app-everyone',\n 'chart',\n 'preset',\n] as const satisfies readonly AudienceTermKind[];\n\n/**\n * Runtime values for {@link AudiencePresetKind}. Hosts iterate this when surfacing a\n * preset picker; the type union mirrors this list 1:1.\n */\nexport const AUDIENCE_PRESETS = [\n 'self',\n 'ou-managers',\n 'direct-reports',\n] as const satisfies readonly AudiencePresetKind[];\n\n/** Explicit user ids. Capped server-side at {@link AUDIENCE_LIMITS.maxUserIdsPerTerm}. */\nexport interface UsersTerm {\n kind: 'users';\n /** Tenant-scoped user ids. */\n userIds: string[];\n}\n\n/**\n * Users holding any of the named roles in a single owning app. Roles are matched by\n * `(appId, key)` and filtered to active rows by the manifest spec — deprecated roles never\n * expand into the audience. RoleKeys are unique within an app, not globally.\n */\nexport interface RolesTerm {\n kind: 'roles';\n /** The role's owning app id (e.g. `circles`). */\n appId: string;\n /** Role keys within that app (e.g. `[\"ffo\", \"ops\"]`). */\n roleKeys: string[];\n}\n\n/**\n * Members of one or more OUs. `chartId` null = the Default Company chart; non-null targets\n * an alternative chart (including the Apps Chart). When `includeDescendants` is true, members\n * of all descendant OUs are included (resolved server-side via a recursive CTE).\n *\n * `includeDescendants` is required (not optional) so the wire round-trip is unambiguous: a\n * stored term that was previously emitted with `false` deserialises identically to one emitted\n * fresh, and the backend never has to choose between \"missing\" and \"explicit false\". Builders\n * MUST emit a definite boolean.\n */\nexport interface OuTerm {\n kind: 'ou';\n ouIds: string[];\n /**\n * Chart context for descendant traversal; null = default tree by parent id. Use `null`\n * (never `undefined`) to keep wire shape symmetric with C# `Guid?` deserialization.\n */\n chartId: string | null;\n includeDescendants: boolean;\n}\n\n/**\n * \"All users of this app in this tenant\" — semantically the Apps Chart app-root OU. Resolved\n * from `UserRole` rows joined to active roles owned by the app, never from a materialized\n * member list. `appId === '*'` means every tenant user.\n */\nexport interface AppEveryoneTerm {\n kind: 'app-everyone';\n appId: string;\n}\n\n/**\n * \"Every user placed somewhere in this chart\". For the Default Company chart this is every\n * user with at least one OU membership.\n */\nexport interface ChartTerm {\n kind: 'chart';\n chartId: string;\n}\n\n/**\n * Named platform preset evaluated against an anchor user. Anchor is typically the request\n * initiator (`Self`) or a referenced user (e.g. delegate's manager).\n */\nexport interface PresetTerm {\n kind: 'preset';\n preset: AudiencePresetKind;\n anchorUserId: string;\n}\n\n/**\n * Supported audience presets. Kept intentionally small — wire matches C# `JsonStringEnumMemberName`.\n */\nexport type AudiencePresetKind = 'self' | 'ou-managers' | 'direct-reports';\n\nexport interface AudienceOptions {\n /** When true (default), users with `IsActive=false` are filtered out. */\n excludeInactiveUsers?: boolean;\n /** Caller-supplied ceiling. Server clamps to {@link AUDIENCE_LIMITS.maxResolvedUsers}. */\n hardCap?: number;\n}\n\n/**\n * Hard caps mirrored from `AudienceLimits.cs`. Hosts use these for client-side validation\n * before submit — backend re-validates regardless. Keep these in sync with the C# constants.\n */\nexport const AUDIENCE_LIMITS = {\n maxTermsPerFilter: 64,\n maxUserIdsPerTerm: 500,\n maxRoleKeysPerTerm: 64,\n maxOuIdsPerTerm: 32,\n maxResolvedUsers: 10_000,\n} as const;\n","import { Injectable, computed, signal } from '@angular/core';\nimport { User } from '../models/user.model';\n\ninterface AuthSession {\n user: User;\n accessToken: string;\n expiresAt: number;\n}\n\n/**\n * Shared AuthService for Business Apps.\n *\n * This is a **read-only signal store** — Business Apps inject it to read the\n * current user and access token. The FlyOS shell populates it after PKCE login\n * and silent refresh. Business Apps must never call setSession() directly.\n *\n * When running as a Module Federation remote, the shell and the Business App\n * share this singleton via the `@mohamedatia/fly-design-system` shared mapping\n * in federation.config.js — so the shell's populated instance is the same\n * object the Business App reads.\n *\n * When running standalone (without the shell), call initFromToken() with a\n * JWT stored in localStorage to hydrate the user.\n */\n@Injectable({ providedIn: 'root' })\nexport class AuthService {\n private _session = signal<AuthSession | null>(null);\n\n readonly currentUser = computed(() => this._session()?.user ?? null);\n readonly accessToken = computed(() => this._session()?.accessToken ?? null);\n readonly isAuthenticated = computed(() => {\n const s = this._session();\n return s !== null && s.expiresAt > Date.now();\n });\n\n /**\n * No-op when running as a Module Federation remote — the shell has already\n * initialised the session before the remote bootstraps. Business Apps call\n * this in their APP_INITIALIZER so the same code works in both standalone\n * and embedded modes without branching.\n */\n async init(): Promise<void> {}\n\n /**\n * Called by the shell after a successful login or silent refresh.\n * Business Apps should not call this directly.\n */\n setSession(user: User, accessToken: string, expiresAt: number): void {\n this._session.set({ user, accessToken, expiresAt });\n }\n\n /** Clears the in-memory session (called by the shell on logout). */\n clearSession(): void {\n this._session.set(null);\n }\n\n /**\n * Standalone mode: parse a JWT from localStorage and hydrate the user.\n * Pass the storage key your app uses; embedded remotes typically set this in `APP_INITIALIZER`.\n */\n initFromToken(storageKey = 'circles_token'): void {\n const token = localStorage.getItem(storageKey);\n if (!token) return;\n try {\n const base64 = token.split('.')[1].replace(/-/g, '+').replace(/_/g, '/');\n const payload = JSON.parse(decodeURIComponent(\n atob(base64).split('').map(c => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)).join('')\n )) as Record<string, unknown>;\n\n const rawRole = payload['role'];\n const roles = Array.isArray(rawRole) ? rawRole as string[] : rawRole ? [rawRole as string] : [];\n const rawApps = payload['apps'];\n const apps = Array.isArray(rawApps) ? rawApps as string[] : rawApps ? [rawApps as string] : [];\n const name = (payload['name'] as string) ?? '';\n const nameParts = name.split(' ');\n\n const user: User = {\n id: (payload['sub'] as string) ?? '',\n tenantId: (payload['tenant_id'] as string) ?? (payload['tid'] as string) ?? null,\n email: (payload['email'] as string) ?? '',\n fullName: name,\n firstName: nameParts[0] ?? '',\n lastName: nameParts.slice(1).join(' '),\n preferredLocale: (payload['locale'] as string) ?? 'en',\n roles,\n apps,\n ou: payload['ou'] as string | undefined,\n };\n\n const expiresAt = ((payload['exp'] as number) ?? 0) * 1000;\n this.setSession(user, token, expiresAt);\n } catch {\n // Invalid token — stay unauthenticated\n }\n }\n}\n","/**\n * Baseline UI strings for design-system components (markdown editor, entity\n * lookup, …) in the four platform locales (`en`, `ar`, `fr`, `ur`).\n *\n * These are registered as the **lowest-priority** layer of {@link I18nService}\n * (below the shell layer and any remote bundle), so DS components render real,\n * localized labels even in a **standalone** consumer — a Business App running\n * outside the desktop shell that never called `setShellTranslations()` — which\n * would otherwise see raw keys (`common.label.bold`) as the pipe's fallback.\n *\n * Precedence: any consumer-supplied key with the same name still wins, so this\n * is a safe default that an integrator can override without coordination.\n *\n * Scope: only the keys the **shippable** DS components reference today\n * (`common.*` toolbar/link labels + `agent.lookup.*`). When a new DS component\n * starts using `| translate`, add its keys here so it stays self-sufficient.\n * Values are copied verbatim from the shell's `public/locale/*.json` — keep\n * them in sync if either side changes.\n */\nexport const DS_BASELINE_LOCALES: Readonly<Record<string, Readonly<Record<string, string>>>> = {\n en: {\n 'common.action.cancel': 'Cancel',\n 'common.label.apply': 'Apply',\n 'common.label.formatting_toolbar': 'Formatting toolbar',\n 'common.label.https': 'https://…',\n 'common.label.insert_entity_link': 'Insert in-app link',\n 'common.label.link': 'Link',\n 'common.label.blockquote': 'Quote',\n 'common.label.bold': 'Bold',\n 'common.label.bullet_list': 'Bulleted list',\n 'common.label.code_block': 'Code block',\n 'common.label.heading1': 'Heading 1',\n 'common.label.heading2': 'Heading 2',\n 'common.label.heading3': 'Heading 3',\n 'common.label.horizontal_rule': 'Divider',\n 'common.label.inline_code': 'Inline code',\n 'common.label.italic': 'Italic',\n 'common.label.numbered_list': 'Numbered list',\n 'common.label.redo': 'Redo',\n 'common.label.strikethrough': 'Strikethrough',\n 'common.label.task_list': 'Task list',\n 'common.label.underline': 'Underline',\n 'common.label.undo': 'Undo',\n 'agent.lookup.back_aria': 'Back to entity types',\n 'agent.lookup.dialog_aria': 'Entity lookup',\n 'agent.lookup.no_entities': 'No items available to reference.',\n 'agent.lookup.no_results': 'No matches found.',\n 'agent.lookup.searching': 'Searching…',\n },\n ar: {\n 'common.action.cancel': 'إلغاء',\n 'common.label.apply': 'تطبيق',\n 'common.label.formatting_toolbar': 'شريط أدوات التنسيق',\n 'common.label.https': 'https://…',\n 'common.label.insert_entity_link': 'إدراج رابط داخل التطبيق',\n 'common.label.link': 'رابط',\n 'common.label.blockquote': 'اقتباس',\n 'common.label.bold': 'غامق',\n 'common.label.bullet_list': 'قائمة نقطية',\n 'common.label.code_block': 'كتلة شيفرة',\n 'common.label.heading1': 'عنوان 1',\n 'common.label.heading2': 'عنوان 2',\n 'common.label.heading3': 'عنوان 3',\n 'common.label.horizontal_rule': 'فاصل',\n 'common.label.inline_code': 'كود مضمّن',\n 'common.label.italic': 'مائل',\n 'common.label.numbered_list': 'قائمة مرقَّمة',\n 'common.label.redo': 'إعادة',\n 'common.label.strikethrough': 'يتوسطه خط',\n 'common.label.task_list': 'قائمة مهام',\n 'common.label.underline': 'تسطير',\n 'common.label.undo': 'تراجع',\n 'agent.lookup.back_aria': 'العودة إلى أنواع العناصر',\n 'agent.lookup.dialog_aria': 'البحث عن عنصر',\n 'agent.lookup.no_entities': 'لا توجد عناصر متاحة للإشارة إليها.',\n 'agent.lookup.no_results': 'لا توجد نتائج مطابقة.',\n 'agent.lookup.searching': 'جارٍ البحث…',\n },\n fr: {\n 'common.action.cancel': 'Annuler',\n 'common.label.apply': 'Appliquer',\n 'common.label.formatting_toolbar': \"Barre d'outils de mise en forme\",\n 'common.label.https': 'https://…',\n 'common.label.insert_entity_link': 'Insérer un lien interne',\n 'common.label.link': 'Lien',\n 'common.label.blockquote': 'Citation',\n 'common.label.bold': 'Gras',\n 'common.label.bullet_list': 'Liste à puces',\n 'common.label.code_block': 'Bloc de code',\n 'common.label.heading1': 'Titre 1',\n 'common.label.heading2': 'Titre 2',\n 'common.label.heading3': 'Titre 3',\n 'common.label.horizontal_rule': 'Séparateur',\n 'common.label.inline_code': 'Code en ligne',\n 'common.label.italic': 'Italique',\n 'common.label.numbered_list': 'Liste numérotée',\n 'common.label.redo': 'Rétablir',\n 'common.label.strikethrough': 'Barré',\n 'common.label.task_list': 'Liste de tâches',\n 'common.label.underline': 'Souligner',\n 'common.label.undo': 'Annuler',\n 'agent.lookup.back_aria': \"Retour aux types d'entité\",\n 'agent.lookup.dialog_aria': \"Recherche d'entité\",\n 'agent.lookup.no_entities': 'Aucun élément disponible à référencer.',\n 'agent.lookup.no_results': 'Aucun résultat trouvé.',\n 'agent.lookup.searching': 'Recherche en cours…',\n },\n ur: {\n 'common.action.cancel': 'منسوخ کریں',\n 'common.label.apply': 'لاگو کریں',\n 'common.label.formatting_toolbar': 'فارمیٹنگ ٹول بار',\n 'common.label.https': 'https://…',\n 'common.label.insert_entity_link': 'ان-ایپ لنک داخل کریں',\n 'common.label.link': 'لنک',\n 'common.label.blockquote': 'اقتباس',\n 'common.label.bold': 'موٹا',\n 'common.label.bullet_list': 'بلٹ فہرست',\n 'common.label.code_block': 'کوڈ بلاک',\n 'common.label.heading1': 'سرخی 1',\n 'common.label.heading2': 'سرخی 2',\n 'common.label.heading3': 'سرخی 3',\n 'common.label.horizontal_rule': 'تقسیم لائن',\n 'common.label.inline_code': 'ان لائن کوڈ',\n 'common.label.italic': 'ترچھا',\n 'common.label.numbered_list': 'نمبر والی فہرست',\n 'common.label.redo': 'دوبارہ کریں',\n 'common.label.strikethrough': 'خط زدہ',\n 'common.label.task_list': 'ٹاسک فہرست',\n 'common.label.underline': 'خط کشید',\n 'common.label.undo': 'واپس کریں',\n 'agent.lookup.back_aria': 'عناصر کی اقسام پر واپس جائیں',\n 'agent.lookup.dialog_aria': 'عنصر کی تلاش',\n 'agent.lookup.no_entities': 'حوالہ دینے کے لیے کوئی آئٹم دستیاب نہیں۔',\n 'agent.lookup.no_results': 'کوئی مماثل نتیجہ نہیں ملا۔',\n 'agent.lookup.searching': 'تلاش جاری ہے…',\n },\n};\n","import { Injectable, computed, signal, inject, ErrorHandler } from '@angular/core';\nimport { DS_BASELINE_LOCALES } from '../i18n/baseline-locales';\n\n/** Locales that use RTL layout for `dir` and DS `isRtl` / `direction`. */\nexport const RTL_LOCALE_SET: ReadonlySet<string> = new Set(['ar', 'ur']);\n\nexport function isRtlLocale(lang: string): boolean {\n return RTL_LOCALE_SET.has(lang);\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/** Accepts flat or nested JSON objects; nested keys become dot paths. Rejects arrays and non-string leaves. */\nfunction normalizeLocaleJson(raw: unknown): Record<string, string> {\n if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {\n throw new Error('Locale bundle must be a JSON object');\n }\n const out: Record<string, string> = {};\n const walk = (obj: Record<string, unknown>, prefix: string): void => {\n for (const [k, v] of Object.entries(obj)) {\n const path = prefix ? `${prefix}.${k}` : k;\n if (typeof v === 'string') {\n out[path] = v;\n } else if (v !== null && typeof v === 'object' && !Array.isArray(v)) {\n walk(v as Record<string, unknown>, path);\n } else {\n throw new Error(`Locale bundle invalid value at \"${path}\" (expected string or nested object)`);\n }\n }\n };\n walk(raw as Record<string, unknown>, '');\n return out;\n}\n\n/** Options for loading a remote or standalone locale JSON bundle. */\nexport interface LoadBundleOptions {\n /** Stable id (e.g. app id from manifest); later loads replace this bundle only. */\n id: string;\n /** Base URL ending with `/`, e.g. `https://app.example.com/locale/` or `/my-remote/locale/` */\n baseUrl: string;\n lang: string;\n /** When aborted, failures are ignored (e.g. superseded language load). */\n signal?: AbortSignal;\n /**\n * When true, fetch/parse failures are not reported via Angular `ErrorHandler`.\n * Use for optional remote locale bundles (e.g. federated apps that may be offline).\n */\n silent?: boolean;\n}\n\n/**\n * Shared I18nService for the shell and Business Apps.\n *\n * **Merge order** (later keys win): DS baseline → shell layer → remote bundles\n * in registration order.\n *\n * - Baseline: {@link DS_BASELINE_LOCALES} — built-in strings for DS components\n * (markdown editor, entity lookup) so they render localized labels even in a\n * standalone consumer that never populated the shell layer. Always overridable.\n * - Shell: `setShellTranslations()` after loading `locale/{lang}.json` and API overrides.\n * - Remotes: `loadBundle()` per manifest `localeBaseUrl`.\n */\n@Injectable({ providedIn: 'root' })\nexport class I18nService {\n private readonly errorHandler = inject(ErrorHandler, { optional: true });\n\n private readonly _shell = signal<Record<string, string>>({});\n private readonly _bundles = signal<Record<string, Record<string, string>>>({});\n private readonly _bundleOrder = signal<string[]>([]);\n private readonly _locale = signal<string>('en');\n private readonly _version = signal(0);\n\n /** Built-in DS strings for the active locale (falls back to `en` for any\n * locale we don't ship). Lowest-priority layer — always overridable. */\n private readonly _baseline = computed<Record<string, string>>(\n () => DS_BASELINE_LOCALES[this._locale()] ?? DS_BASELINE_LOCALES['en'] ?? {},\n );\n\n private readonly _merged = computed(() => {\n const shell = this._shell();\n const order = this._bundleOrder();\n const bundles = this._bundles();\n let out: Record<string, string> = { ...this._baseline(), ...shell };\n for (const id of order) {\n const b = bundles[id];\n if (b) out = { ...out, ...b };\n }\n return out;\n });\n\n readonly locale = this._locale.asReadonly();\n readonly version = this._version.asReadonly();\n readonly isRtl = computed(() => isRtlLocale(this._locale()));\n readonly direction = computed(() => (isRtlLocale(this._locale()) ? 'rtl' : 'ltr'));\n\n private bump(): void {\n this._version.update((v) => v + 1);\n }\n\n /** Replace shell strings (desktop `locale/*.json` + `/api/i18n/desktop-shell/{lang}` merged by the shell). */\n setShellTranslations(data: Record<string, string>, lang: string): void {\n this._shell.set(data);\n this._locale.set(lang);\n this.bump();\n }\n\n setLanguage(lang: string): void {\n this._locale.set(lang);\n this.bump();\n }\n\n /**\n * Fetch `{baseUrl}{lang}.json` and store under `id`. New ids are appended to the merge order.\n * @returns whether the bundle was loaded successfully.\n */\n async loadBundle(opts: LoadBundleOptions): Promise<boolean> {\n const { id, baseUrl, lang, signal: abortSignal, silent } = opts;\n try {\n const base = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`;\n const url = `${base}${lang}.json`;\n const resp = await fetch(url, { signal: abortSignal });\n if (!resp.ok) throw new Error(`HTTP ${resp.status}`);\n const data = normalizeLocaleJson(await resp.json());\n if (abortSignal?.aborted) return false;\n this._bundles.update((b) => ({ ...b, [id]: data }));\n this._bundleOrder.update((order) => (order.includes(id) ? order : [...order, id]));\n this._locale.set(lang);\n this.bump();\n return true;\n } catch (e) {\n if (abortSignal?.aborted) return false;\n if (!silent) this.errorHandler?.handleError(e);\n return false;\n }\n }\n\n removeBundle(id: string): void {\n this._bundles.update((b) => {\n const next = { ...b };\n delete next[id];\n return next;\n });\n this._bundleOrder.update((order) => order.filter((x) => x !== id));\n this.bump();\n }\n\n clearRemoteBundles(): void {\n this._bundles.set({});\n this._bundleOrder.set([]);\n this.bump();\n }\n\n t(key: string, params?: Record<string, string | number>): string {\n const val = this._merged()[key] ?? key;\n if (!params) return val;\n return Object.entries(params).reduce((result, [k, v]) => {\n const safe = escapeRegExp(k);\n return result.replace(new RegExp(`{{\\\\s*${safe}\\\\s*}}`, 'g'), String(v));\n }, val);\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport { Injectable, inject, PLATFORM_ID, signal } from '@angular/core';\n\n/** Single source of truth for persisted / API theme strings. */\nexport const FLY_THEME_MODE_IDS = ['light', 'dark'] as const;\n\nexport type FlyThemeMode = (typeof FLY_THEME_MODE_IDS)[number];\n\n/** Factory default: `dark` (opaque dark / `html.dark-theme`); shell i18n `settings.theme.dark`. Keep in sync with `UserSettings` defaults. */\nexport const DEFAULT_FLY_THEME_MODE: FlyThemeMode = 'dark';\n\n/** Coerce unknown values (localStorage, API) to a valid theme mode. */\nexport function normalizeFlyTheme(value: unknown): FlyThemeMode {\n if (typeof value === 'string' && (FLY_THEME_MODE_IDS as readonly string[]).includes(value)) {\n return value as FlyThemeMode;\n }\n return DEFAULT_FLY_THEME_MODE;\n}\n\n/**\n * Applies `html.light-theme` / `html.dark-theme` for DS SCSS.\n * Shell and standalone Business Apps use the same service (federation singleton when shared).\n */\n@Injectable({ providedIn: 'root' })\nexport class FlyThemeService {\n private readonly platformId = inject(PLATFORM_ID);\n\n readonly theme = signal<FlyThemeMode>(DEFAULT_FLY_THEME_MODE);\n\n applyTheme(mode: FlyThemeMode): void {\n this.theme.set(mode);\n if (!isPlatformBrowser(this.platformId)) {\n return;\n }\n const html = document.documentElement;\n html.classList.remove('light-theme', 'dark-theme');\n if (mode === 'dark') {\n html.classList.add('dark-theme');\n } else {\n html.classList.add('light-theme');\n }\n }\n}\n","import { Injectable } from '@angular/core';\n\n/** Options for opening a child window. */\nexport interface OpenWindowOptions {\n /** Unique identifier for the window instance. */\n windowId: string;\n /** Display title shown in the window chrome. */\n title: string;\n /** Route path or URL to load inside the window. */\n route: string;\n /** Initial width in pixels. Defaults to 900. */\n width?: number;\n /** Initial height in pixels. Defaults to 600. */\n height?: number;\n /** Whether the window can be resized. Defaults to true. */\n resizable?: boolean;\n /** Whether the window can be maximised. Defaults to true. */\n maximizable?: boolean;\n /** Arbitrary data passed to the child window via WINDOW_DATA. */\n data?: unknown;\n}\n\n/**\n * Abstract interface for the WindowManager.\n * The FlyOS shell provides the concrete implementation; Business Apps\n * inject this token to open, close, and focus windows without depending\n * on the shell's internal implementation.\n */\nexport abstract class WindowManagerService {\n abstract openChildWindow(options: OpenWindowOptions): void;\n abstract closeWindow(windowId: string): void;\n abstract focusWindow(windowId: string): void;\n\n /**\n * Shell: increments per-window depth and shows content block UI.\n * Standalone / no host: no-op.\n */\n beginContentUiBlock(_windowId: string, _messageKey?: string): void {}\n\n /** Shell: decrements depth; clears block when depth reaches 0. Standalone: no-op. */\n endContentUiBlock(_windowId: string): void {}\n}\n\n/**\n * No-op fallback implementation used when running a Business App in\n * standalone mode (outside the FlyOS shell). Logs a warning instead of\n * throwing so standalone dev/test flows are not broken.\n */\n@Injectable()\nexport class StandaloneWindowManagerService extends WindowManagerService {\n openChildWindow(options: OpenWindowOptions): void {\n console.warn('[WindowManagerService] openChildWindow called in standalone mode — no shell available.', options);\n }\n\n closeWindow(windowId: string): void {\n console.warn('[WindowManagerService] closeWindow called in standalone mode — no shell available.', windowId);\n }\n\n focusWindow(windowId: string): void {\n console.warn('[WindowManagerService] focusWindow called in standalone mode — no shell available.', windowId);\n }\n}\n\n","import { InjectionToken, Type } from '@angular/core';\n\n/**\n * One row in a remote's route table. Mirrors Angular's `Route` interface but\n * pared down to what the FlyOS-embedded router actually supports — synchronous\n * component refs only (no `loadChildren`, no resolvers/guards).\n *\n * Patterns:\n * '' — matches an empty URL (\"/\")\n * 'signals' — exact static segment\n * 'signals/:id' — `:foo` captures any single segment into `params.foo`\n * 'signals/:id/edit' — mixed static + capture segments\n *\n * `data` is an opaque bag the consumer can read from `router.matchedRoute()?.data`.\n */\nexport interface FlyRemoteRoute {\n readonly path: string;\n readonly component: Type<unknown>;\n readonly data?: Readonly<Record<string, unknown>>;\n}\n\n/**\n * Result of matching the current `segments` against a remote's route table.\n * `params` contains captured `:foo` segments — empty object for paths with no\n * captures.\n */\nexport interface FlyRemoteMatch {\n readonly route: FlyRemoteRoute;\n readonly params: Readonly<Record<string, string>>;\n}\n\n/**\n * Optional injection token a remote provides at its root to declare which routes\n * `<fly-remote-router-outlet>` should resolve. Provided WITHIN the remote (not\n * the shell), e.g.:\n *\n * ```ts\n * @Component({\n * providers: [\n * FlyRemoteRouter,\n * { provide: FLY_REMOTE_ROUTES, useValue: CIRCLES_ROUTES },\n * ],\n * })\n * export class CirclesComponent { }\n * ```\n *\n * If no routes are provided, `FlyRemoteRouter.matchedRoute()` is always `null`\n * and the outlet renders nothing — useful for remotes that don't need internal\n * routing.\n */\nexport const FLY_REMOTE_ROUTES = new InjectionToken<readonly FlyRemoteRoute[]>(\n 'FLY_REMOTE_ROUTES',\n);\n\n/**\n * Optional injection token a remote provides at its root to declare the shell\n * mount path prefix (e.g. `'/desktop'`). When set, `FlyRemoteRouter.segments()`\n * strips this prefix from `window.location.pathname` before matching routes.\n *\n * **Why this is needed:** In embedded mode the remote is loaded via\n * `NgComponentOutlet` inside the shell SPA. The shell's own Angular route may\n * leave `window.location.pathname` as `/desktop` (or any shell-level path).\n * Without stripping that prefix, `segments()` returns `['desktop']` which\n * matches none of the remote's Circles-internal routes (e.g. `''`, `'signals'`,\n * `'signals/:id'`), so `<fly-remote-router-outlet>` renders nothing.\n *\n * **Default behaviour (token absent):** `FlyRemoteRouter` initialises `_url`\n * to `'/'` in embedded mode, completely ignoring `window.location.pathname`.\n * This is safe because the shell does not push the remote's logical URL into\n * browser history — only `navigate()` / `navigateByUrl()` calls do.\n *\n * **Usage in a remote root component:**\n * ```ts\n * providers: [\n * FlyRemoteRouter,\n * { provide: FLY_REMOTE_ROUTES, useValue: MY_ROUTES },\n * { provide: FLY_REMOTE_BASE_PATH, useValue: '/desktop' },\n * ]\n * ```\n *\n * With `basePath = '/desktop'` and `window.location.pathname = '/desktop'`,\n * the stripped URL is `'/'` → `segments() = []` → matches the `''` default\n * route. With pathname `'/desktop/signals/abc'`, segments become\n * `['signals', 'abc']` → matches `'signals/:id'`.\n *\n * Available since design-system **2.7.2**.\n */\nexport const FLY_REMOTE_BASE_PATH = new InjectionToken<string>(\n 'FLY_REMOTE_BASE_PATH',\n);\n\n/**\n * Match a route's path pattern against URL segments. Returns the captured params\n * map on a successful match, or `null` if the pattern can't match. Empty path\n * matches only an empty segments array.\n *\n * Exported for unit testing — most consumers should rely on\n * `FlyRemoteRouter.matchedRoute()`.\n */\nexport function matchFlyRoutePattern(\n pattern: string,\n segments: readonly string[],\n): Record<string, string> | null {\n const patternSegments = pattern.split('/').filter(Boolean);\n if (patternSegments.length !== segments.length) return null;\n\n const params: Record<string, string> = {};\n for (let i = 0; i < patternSegments.length; i++) {\n const p = patternSegments[i];\n const s = segments[i];\n if (p.startsWith(':')) {\n params[p.slice(1)] = decodeURIComponent(s);\n } else if (p !== s) {\n return null;\n }\n }\n return params;\n}\n","import { DestroyRef, Injectable, computed, inject, signal } from '@angular/core';\nimport {\n NavigationEnd,\n NavigationExtras,\n Router,\n} from '@angular/router';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n WINDOW_DATA,\n FLYOS_REMOTE_ROUTE_EVENT,\n FlyosShellOwnsHistoryGlobalKey,\n type FlyRemoteRouteEventDetail,\n} from '../models/window.model';\nimport {\n FLY_REMOTE_BASE_PATH,\n FLY_REMOTE_ROUTES,\n FlyRemoteMatch,\n matchFlyRoutePattern,\n} from './fly-remote-router.types';\n\n/**\n * FlyOS standard navigation surface for Business / Supporting App remotes.\n *\n * Problem this solves\n * -------------------\n * A federated remote ships with its own Angular `Routes` table that works\n * perfectly in **standalone** mode (e.g. `http://localhost:7202/signals/:id`).\n * Once the same remote is mounted inside the FlyOS desktop shell via\n * `*ngComponentOutlet`, `inject(Router)` resolves to the **host shell's**\n * Router — which has no knowledge of `/signals/:id`. Calls like\n * `router.navigate(['/signals', id])` then silently no-op and the click\n * \"does nothing.\"\n *\n * The fix\n * -------\n * Inject `FlyRemoteRouter` instead of `Router`. It mirrors `Router.navigate` /\n * `Router.navigateByUrl` and:\n *\n * - **Standalone** (no `WINDOW_DATA`): delegates to the real Angular Router,\n * so the URL bar, browser back button, and `RouterLink` continue to work\n * exactly as before.\n * - **Embedded** (mounted in the shell via `WINDOW_DATA`): writes the target\n * URL to an internal signal (`url`, `segments`) and does **not** touch the\n * host's Router. The remote's root component watches the signal and renders\n * the right view (typically a `@switch` on the first segment, plus an inline\n * overlay for detail pages).\n *\n * Usage in a list page\n * --------------------\n * ```ts\n * private readonly router = inject(FlyRemoteRouter);\n *\n * openDetail(item: Signal): void {\n * this.router.navigate(['/signals', item.id]); // works in both modes\n * }\n * ```\n *\n * Usage in the remote's root component (embedded dispatcher)\n * ----------------------------------------------------------\n * ```ts\n * private readonly router = inject(FlyRemoteRouter);\n *\n * readonly view = computed(() => {\n * if (!this.router.isEmbedded) return null; // standalone: <router-outlet> handles it\n * const [head, id] = this.router.segments();\n * if (head === 'signals' && id) return { kind: 'signal-detail', id };\n * if (head === 'signals') return { kind: 'signals-list' };\n * return { kind: head ?? 'home' };\n * });\n * ```\n *\n * Notes\n * -----\n * - `WINDOW_DATA` is the canonical \"I am running inside the shell\" marker; the\n * shell provides it per window, and it is `null` everywhere else.\n * - `Router` is injected as `optional`. A remote that does not register a Router\n * (e.g. a tiny chromeless utility app) still gets a working `navigate` that\n * updates the `url` signal in embedded mode.\n */\n@Injectable({ providedIn: 'root' })\nexport class FlyRemoteRouter {\n private readonly windowData = inject(WINDOW_DATA, { optional: true });\n private readonly router = inject(Router, { optional: true });\n /**\n * Optional route table — if the remote provides `FLY_REMOTE_ROUTES`,\n * `matchedRoute` / `params` resolve against it. Unset means the consumer is\n * driving its own switch/template — `matchedRoute` stays `null`.\n */\n private readonly routes = inject(FLY_REMOTE_ROUTES, { optional: true }) ?? [];\n /**\n * Shell mount path prefix to strip from `window.location.pathname` when\n * deriving the initial URL in embedded mode. See `FLY_REMOTE_BASE_PATH` docs.\n *\n * When absent (the common case), the embedded router initialises `_url` to\n * `'/'` and ignores `window.location.pathname` entirely — correct because the\n * shell SPA never encodes the remote's logical route into the browser URL.\n */\n private readonly basePath = inject(FLY_REMOTE_BASE_PATH, { optional: true }) ?? null;\n\n /**\n * True when this remote is rendered inside the FlyOS desktop shell.\n *\n * Detection order:\n * 1. `WINDOW_DATA` is provided — the canonical signal, works when the\n * design-system module is genuinely shared via Native Federation's\n * `sharedMappings` and the InjectionToken identity matches.\n * 2. `globalThis.__FLYOS_SHELL__ === true` — set by the shell's `main.ts`\n * before `initFederation`. A plain JS global is shared across all\n * module instances in the same browser context, so this works even\n * when the InjectionToken splits between host and remote bundles\n * (a known Native Federation edge case).\n */\n readonly isEmbedded: boolean =\n this.windowData != null\n || (typeof globalThis !== 'undefined'\n && (globalThis as { __FLYOS_SHELL__?: boolean }).__FLYOS_SHELL__ === true);\n\n /**\n * True when a new shell owns the browser address bar + history for every\n * window (it set {@link FlyosShellOwnsHistoryGlobalKey}). In that mode this\n * router defers history to the shell: it dispatches {@link FLYOS_REMOTE_ROUTE_EVENT}\n * instead of `pushState`, and does not handle its own `popstate` (the shell\n * replays routes via `FLYOS_LAUNCH_EVENT`). Absent ⇒ legacy self-managed mode.\n */\n private get shellOwnsHistory(): boolean {\n return (\n typeof globalThis !== 'undefined' &&\n (globalThis as { [FlyosShellOwnsHistoryGlobalKey]?: boolean })[FlyosShellOwnsHistoryGlobalKey] === true\n );\n }\n\n private readonly _url = signal<string>('/');\n\n /**\n * Current logical URL of the remote — `/signals/abc` etc.\n *\n * Standalone: mirrors `Router.url` and is updated on every `NavigationEnd`.\n * Embedded: updated by `navigate` / `navigateByUrl` only.\n */\n readonly url = this._url.asReadonly();\n\n /**\n * `url` parsed into path segments, e.g. `'/signals/abc'` → `['signals', 'abc']`.\n * Query string and hash are stripped. Empty segments removed.\n */\n readonly segments = computed<readonly string[]>(() => {\n const u = this._url();\n return u.split('?')[0].split('#')[0].split('/').filter(Boolean);\n });\n\n /**\n * First route from `FLY_REMOTE_ROUTES` whose pattern matches `segments()`,\n * paired with its captured params. `null` when no routes are registered or\n * none matches. Used by `<fly-remote-router-outlet>` to pick what to render.\n *\n * Match order: routes are tried in declaration order. Put more specific\n * patterns (e.g. `'signals/:id'`) before catch-alls.\n */\n readonly matchedRoute = computed<FlyRemoteMatch | null>(() => {\n const segs = this.segments();\n for (const route of this.routes) {\n const params = matchFlyRoutePattern(route.path, segs);\n if (params != null) return { route, params };\n }\n return null;\n });\n\n /**\n * Captured route params from the active route, e.g. `{ id: 'abc' }` for a\n * `'signals/:id'` match on `/signals/abc`. Empty object if no route matched\n * or the matched route has no captures.\n *\n * Components can read this directly:\n * ```ts\n * private readonly flyRouter = inject(FlyRemoteRouter);\n * readonly signalId = computed(() => this.flyRouter.params()['id'] ?? '');\n * ```\n */\n readonly params = computed<Readonly<Record<string, string>>>(() =>\n this.matchedRoute()?.params ?? {},\n );\n\n private readonly destroyRef = inject(DestroyRef);\n\n constructor() {\n if (!this.isEmbedded && this.router) {\n // Standalone: seed from Angular Router and track NavigationEnd events so\n // browser back/forward (which the host Router handles) keep segments() current.\n this._url.set(this.router.url);\n this.router.events\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event instanceof NavigationEnd) {\n this._url.set(event.urlAfterRedirects);\n }\n });\n } else if (this.isEmbedded) {\n // Embedded: the shell SPA keeps its own route in window.location.pathname\n // (e.g. '/desktop') which is meaningless for the remote's route table.\n // Default: initialise to '/' so the remote's empty-path default route\n // matches on first render. When FLY_REMOTE_BASE_PATH is provided, strip\n // it from pathname first — useful if the shell does push a remote-aware\n // URL (e.g. '/desktop/signals/abc' with basePath '/desktop').\n if (typeof window !== 'undefined') {\n const rawPath = window.location.pathname || '/';\n const initialUrl = this._resolveEmbeddedInitialUrl(rawPath);\n this._url.set(initialUrl);\n\n // When the shell owns history it replays our route on Back/Forward via\n // FLYOS_LAUNCH_EVENT (the remote root re-applies it), so we must NOT also\n // handle popstate — the shell's entries carry no `flyRemoteUrl` and we'd\n // clobber `_url` with the shell path. Only self-manage under a legacy shell.\n if (!this.shellOwnsHistory) {\n // Listen for browser back/forward so segments() stays in sync with\n // history entries pushed by navigate() / navigateByUrl().\n const onPopState = (event: PopStateEvent): void => {\n const state = event.state as { flyRemoteUrl?: string } | null;\n // Prefer the URL we stashed in the history state; fall back to pathname.\n const url = state?.flyRemoteUrl ?? window.location.pathname ?? '/';\n this._url.set(url.startsWith('/') ? url : '/' + url);\n };\n\n window.addEventListener('popstate', onPopState);\n\n // Defensive cleanup — the service is providedIn: 'root' so this fires\n // only when the whole Angular app is destroyed, but it keeps things tidy.\n this.destroyRef.onDestroy(() => {\n window.removeEventListener('popstate', onPopState);\n });\n }\n }\n }\n }\n\n /**\n * Navigate to a route, identified by an array of commands as you would pass\n * to Angular's `Router.navigate`. In embedded mode `extras` is ignored — the\n * shell owns history and query-param handling for the window's URL.\n */\n navigate(commands: readonly unknown[], extras?: NavigationExtras): Promise<boolean> {\n if (!this.isEmbedded && this.router) {\n // Standalone: Angular Router owns history — pushState semantics are the default.\n return this.router.navigate(commands as unknown[], extras);\n }\n const url = this.buildUrl(commands);\n this._pushEmbedded(url);\n return Promise.resolve(true);\n }\n\n /**\n * Navigate to a route given as a full URL string. Mirrors `Router.navigateByUrl`.\n */\n navigateByUrl(url: string, extras?: NavigationExtras): Promise<boolean> {\n if (!this.isEmbedded && this.router) {\n // Standalone: Angular Router owns history — pushState semantics are the default.\n return this.router.navigateByUrl(url, extras);\n }\n this._pushEmbedded(url.startsWith('/') ? url : '/' + url);\n return Promise.resolve(true);\n }\n\n /**\n * Convenience: pop the last two segments (the typical \"go back from detail\n * to list\" gesture). In standalone mode this falls through to `history.back()`\n * so the browser's back stack is respected.\n */\n back(): void {\n // Both modes: delegate to the browser's history stack. In embedded mode we\n // now push real history entries in navigate() / navigateByUrl(), so\n // history.back() triggers popstate and the listener updates segments().\n if (typeof history !== 'undefined') {\n history.back();\n }\n }\n\n /**\n * Resolve the logical URL to seed `_url` from on embedded initial load.\n *\n * - No basePath: always return `'/'`. The shell's SPA path (e.g. `/desktop`)\n * is irrelevant to the remote — `navigate()` is the only thing that should\n * move the remote's URL.\n * - basePath provided: strip it from `rawPath`. If rawPath starts with the\n * basePath, the remainder becomes the seed URL (normalised to start with\n * `'/'`). If it doesn't match (e.g. shell changed its own route), fall back\n * to `'/'` rather than surfacing shell-specific segments to the remote's\n * route table.\n */\n private _resolveEmbeddedInitialUrl(rawPath: string): string {\n if (!this.basePath) {\n // Default: ignore the shell's pathname, start at remote root.\n return '/';\n }\n const base = this.basePath.endsWith('/') ? this.basePath.slice(0, -1) : this.basePath;\n if (rawPath === base || rawPath === base + '/') {\n return '/';\n }\n if (rawPath.startsWith(base + '/')) {\n const remainder = rawPath.slice(base.length);\n return remainder.startsWith('/') ? remainder : '/' + remainder;\n }\n // Shell path doesn't begin with our basePath — fall through to root.\n return '/';\n }\n\n /**\n * In embedded mode: push a real browser history entry (so back/forward work)\n * and update the internal signal synchronously.\n *\n * The browser address bar is written as the shell's **canonical deep-link\n * form** — `<shell-path>?app=<appId>&route=<remote-url>` — NOT the bare remote\n * URL. This is what makes a hard reload work: on reload the shell's\n * `DeepLinkService` captures `?app=&route=` in its APP_INITIALIZER, re-opens\n * this app, and replays the route through the pending-launch pipeline\n * (`ShellLauncherService.launch` → `FLYOS_LAUNCH_EVENT` / pending registry →\n * the remote's root applies `ctx.route`). Writing the bare remote URL (e.g.\n * `/trends/abc`) instead would leave a host-unroutable path in the bar — on\n * reload the shell router falls through to its `**` wildcard, redirects to\n * `/desktop`, and the deep link is silently lost. See\n * skills/cross-app-deep-linking.md.\n *\n * `flyRemoteUrl` is still stashed in the history state so the popstate\n * listener restores the exact remote URL for back/forward without re-parsing\n * the query string.\n */\n private _pushEmbedded(url: string): void {\n this._url.set(url);\n\n if (this.shellOwnsHistory && typeof window !== 'undefined') {\n // Single-writer mode: hand the route to the shell, which owns the address\n // bar + browser history for every window. The shell mirrors it to the\n // canonical `…/desktop?app=&route=` form and pushes one history entry.\n const appId = this.windowData?.appId;\n if (appId) {\n const detail: FlyRemoteRouteEventDetail = {\n appId,\n windowId: this.windowData?.id ?? null,\n url,\n };\n window.dispatchEvent(new CustomEvent<FlyRemoteRouteEventDetail>(FLYOS_REMOTE_ROUTE_EVENT, { detail }));\n return;\n }\n // No appId reachable (WINDOW_DATA split across bundles) — fall through to\n // the legacy local history entry so Back/Forward still update segments().\n }\n\n // Legacy / fallback: self-managed history entry (older shell, or no appId).\n if (typeof history !== 'undefined') {\n history.pushState({ flyRemoteUrl: url }, '', this._buildEmbeddedHistoryUrl(url));\n }\n }\n\n /**\n * Build the browser-address-bar URL for an embedded navigation: the shell's\n * current path plus the canonical `?app=&route=` deep-link query (the same\n * contract `DeepLinkService.captureFromCurrentUrl` parses on cold load).\n *\n * The path is left untouched — only the query string carries the remote's\n * logical route — so the shell's own Angular Router (anchored at e.g.\n * `/desktop`) is never handed a path it cannot match.\n *\n * Fallback: when `appId` is unknown (WINDOW_DATA not injected — the Native\n * Federation token-split case where only `__FLYOS_SHELL__` proves embedding)\n * we cannot build a shareable link, so we return the shell path query-less.\n * Back/forward still work via the `flyRemoteUrl` history state; only\n * reload-restore is unavailable — no regression over leaving the bar as-is.\n */\n private _buildEmbeddedHistoryUrl(remoteUrl: string): string {\n const shellPath =\n (typeof window !== 'undefined' && window.location.pathname) || this.basePath || '/';\n const appId = this.windowData?.appId;\n if (!appId) return shellPath;\n const query = new URLSearchParams({ app: appId, route: remoteUrl });\n return `${shellPath}?${query.toString()}`;\n }\n\n private buildUrl(commands: readonly unknown[]): string {\n const parts = commands\n .map(c => (c == null ? '' : String(c)))\n .map(s => s.replace(/^\\/+|\\/+$/g, ''))\n .filter(Boolean);\n return '/' + parts.join('/');\n }\n}\n","import { Injectable, signal } from '@angular/core';\n\n/**\n * A federated remote's current navigation context, as published to the shell.\n *\n * `params` are the remote's **resolved route params** (e.g. `{ id: 'abc' }` for a\n * `trends/:id` match) — the remote owns its route table, so it resolves these and\n * the shell never has to know the remote's route patterns.\n */\nexport interface FlyRemoteContext {\n /** Owning app id — matches the shell's app registry and `AgentCommandScope.appId`. */\n readonly appId: string;\n /** Logical remote URL, e.g. `/trends/abc`. Query/hash stripped by the publisher. */\n readonly url: string;\n /** `url` split into path segments, e.g. `['trends', 'abc']`. */\n readonly segments: readonly string[];\n /** Resolved route params, e.g. `{ id: 'abc' }`. Empty when no param route matched. */\n readonly params: Readonly<Record<string, string>>;\n}\n\n/**\n * Shared cross-bundle store key + sync event. **Public contract** — a remote that\n * cannot consume a DS new enough to back {@link FlyRemoteContextService.publish} on\n * `globalThis` itself may write this slot directly (same shape, keyed by appId) and\n * dispatch {@link FLY_REMOTE_CONTEXT_EVENT} to notify the shell. Keep these literals\n * stable; they are an integration boundary, not an implementation detail.\n */\nexport const FLY_REMOTE_CONTEXT_STORE_KEY = '__flyRemoteContext__';\nexport const FLY_REMOTE_CONTEXT_EVENT = 'fly:remote-context';\n\ntype Store = Record<string, FlyRemoteContext>;\n\n/** The single cross-bundle store, lazily created on `globalThis`. */\nfunction store(): Store {\n const g = globalThis as unknown as Record<string, Store | undefined>;\n return (g[FLY_REMOTE_CONTEXT_STORE_KEY] ??= {});\n}\n\n/** Notify every federated copy of the service that the store changed. */\nfunction emitSync(): void {\n const g = globalThis as { dispatchEvent?: (e: Event) => boolean };\n try {\n g.dispatchEvent?.(new Event(FLY_REMOTE_CONTEXT_EVENT));\n } catch {\n /* non-DOM realm (SSR / unit env without Event) — readers fall back to a direct read */\n }\n}\n\nfunction toMap(s: Store): ReadonlyMap<string, FlyRemoteContext> {\n return new Map(Object.entries(s));\n}\n\n/**\n * Remote → shell route/context channel.\n *\n * Why this exists\n * ---------------\n * A federated remote (e.g. Circles) renders inside a desktop-shell window and\n * keeps its own internal Angular route (`/trends/:id`). The shell cannot see that\n * route: the remote provides {@link FlyRemoteRouter} at its **component** injector\n * (so it can read per-window `WINDOW_DATA`), which makes the route state invisible\n * to the host. Shell-side features that need \"what is the user looking at right\n * now\" — most importantly Category-B slash commands whose `contextBindings` include\n * a `lookup`/`route` entity id — had no way to resolve the current entity id, and\n * degraded to \"ask the user\".\n *\n * The channel — why `globalThis`, not the DI singleton\n * ----------------------------------------------------\n * This service is `providedIn: 'root'`, but a root instance is **NOT** reliably\n * shared across the federation boundary. The shell builds the design system from\n * workspace SOURCE while remotes consume the PUBLISHED npm package; Native\n * Federation only collapses those two physical builds into one runtime instance if\n * version negotiation succeeds perfectly (matching advertised `mappingVersion`,\n * `singleton`, compatible ranges). That negotiation has silently split before —\n * giving the shell and a remote *separate* `providedIn:'root'` instances, so a\n * value published on one was invisible to the other.\n *\n * `globalThis` is the one substrate guaranteed shared across every federated bundle\n * in the same realm (there are no iframes), so the channel stores its state there\n * (see {@link FLY_REMOTE_CONTEXT_STORE_KEY}). {@link context} / {@link param} read\n * it directly — split-proof, synchronous, no injector-token gymnastics. A per-\n * instance signal mirrors the store for reactive consumers and is re-synced from a\n * `globalThis` event whenever any copy of the service (or a remote writing the slot\n * directly) mutates it. The same pattern already backs the shell's app-launch\n * context bridge, so this is an established boundary, not a new hack.\n *\n * Contract\n * --------\n * - Remote: call {@link publish} whenever its embedded route changes, and\n * {@link clear} on teardown (window close / component destroy).\n * - Shell: call {@link context} (or {@link param}) for an app id to resolve bindings.\n *\n * Keyed by `appId` (last publisher wins) — a single live window per app is the v1\n * assumption; a windowId key is the natural extension if multi-window-per-app\n * dispatch is ever needed.\n */\n@Injectable({ providedIn: 'root' })\nexport class FlyRemoteContextService {\n private readonly _byApp = signal<ReadonlyMap<string, FlyRemoteContext>>(toMap(store()));\n\n /** All currently-published contexts, keyed by app id. Reactive. */\n readonly contexts = this._byApp.asReadonly();\n\n constructor() {\n // Keep this instance's reactive mirror current when ANOTHER federated copy of\n // the service — or a remote writing the store slot directly — mutates it.\n const g = globalThis as { addEventListener?: (t: string, l: () => void) => void };\n g.addEventListener?.(FLY_REMOTE_CONTEXT_EVENT, () => this._byApp.set(toMap(store())));\n }\n\n /** Publish (or replace) the active route context for an app. */\n publish(ctx: FlyRemoteContext): void {\n store()[ctx.appId] = ctx;\n this._byApp.set(toMap(store()));\n emitSync();\n }\n\n /** Drop an app's context (remote unmounted / window closed). No-op if absent. */\n clear(appId: string): void {\n const s = store();\n if (!(appId in s)) return;\n delete s[appId];\n this._byApp.set(toMap(s));\n emitSync();\n }\n\n /** Current context for an app, or `null` when nothing is published. */\n context(appId: string): FlyRemoteContext | null {\n return store()[appId] ?? null;\n }\n\n /**\n * Resolve a single route param for an app, e.g. `param('circles', 'id')`.\n * Returns `null` when the app has no published context or the param is absent —\n * the caller then degrades (the skill asks for the missing id).\n */\n param(appId: string, path: string): string | null {\n const value = store()[appId]?.params[path];\n return value != null && value !== '' ? value : null;\n }\n}\n","import { InjectionToken, Injectable, inject } from '@angular/core';\n\n/**\n * Minimal adapter the shell (or any host) provides so design-system services can\n * look up apps without depending on `AppRegistryService` directly. Keeps the\n * design-system decoupled from shell internals — hosts wire this once at root.\n *\n * Shell wiring example:\n * ```ts\n * { provide: APP_LOOKUP, useFactory: () => {\n * const r = inject(AppRegistryService);\n * return { getById: id => { const a = r.getById(id); return a ? { id: a.id, name: a.name } : undefined; } };\n * } }\n * ```\n */\nexport interface AppLookupEntry {\n readonly id: string;\n readonly name: string;\n}\n\nexport interface AppLookup {\n getById(id: string): AppLookupEntry | undefined;\n}\n\nexport const APP_LOOKUP = new InjectionToken<AppLookup>('APP_LOOKUP');\n\n/**\n * Canonicalizes raw source-app identifiers and resolves display names.\n *\n * Problem this solves\n * -------------------\n * Backend services emit two different identifiers for the same app:\n * - JWT `client_id` (inter-service identity), e.g. `\"circles-service\"`.\n * - AppCatalog `id` (frontend identity), e.g. `\"circles\"`.\n *\n * Task rows, audit entries, notifications, etc. may carry either form depending\n * on which service wrote them and when. Every UI surface that renders the\n * source app needs the same canonicalization rule — without it, chips display\n * `\"circles-service\"` instead of the friendly `\"Circles\"`.\n *\n * Rule: try the raw id against the registry; if it misses and the id ends in\n * `-service`, retry with the suffix stripped. The first hit wins. Returns\n * `null` from `resolveId` when nothing matches, so callers can guard CTAs.\n */\n@Injectable({ providedIn: 'root' })\nexport class SourceAppResolver {\n private readonly lookup = inject(APP_LOOKUP, { optional: true });\n\n /** Returns the registry-resolvable canonical id, or `null` when neither form is registered. */\n resolveId(rawId: string | null | undefined): string | null {\n if (!rawId || !this.lookup) return null;\n if (this.lookup.getById(rawId)) return rawId;\n const canonical = rawId.replace(/-service$/, '');\n if (canonical !== rawId && this.lookup.getById(canonical)) return canonical;\n return null;\n }\n\n /**\n * Display name for the source app. Prefers the registry's localized name when\n * the id resolves; falls back to a title-cased canonical id (e.g.\n * `\"circles-service\"` → `\"Circles\"`) so chips never expose raw `-service`\n * client_ids even for apps not yet in the registry. Empty string for null/undefined.\n */\n resolveName(rawId: string | null | undefined): string {\n if (!rawId) return '';\n const id = this.resolveId(rawId);\n if (id) return this.lookup!.getById(id)!.name;\n const canonical = rawId.replace(/-service$/, '');\n return canonical.charAt(0).toUpperCase() + canonical.slice(1);\n }\n\n /** True when an open-in-source CTA is launchable: id resolves *and* there's a route. */\n canOpen(rawId: string | null | undefined, route: string | null | undefined): boolean {\n return this.resolveId(rawId) !== null && !!route;\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n FLY_WINDOW_HELP_HINT_EVENT,\n type FlyWindowHelpHintEventDetail,\n type WindowHelpHint,\n} from '../models/window.model';\n\n/**\n * Per-window publisher handle returned by {@link FlyWindowHelpService.forWindow}.\n * Bound to a single window id; keep the handle and call {@link setHint} as the\n * active view changes.\n */\nexport interface FlyWindowHelpPublisher {\n /**\n * Set the active hint for this window (or null to clear — the shell then\n * reverts to the window's own `appId`). Safe to call repeatedly.\n */\n setHint(hint: WindowHelpHint | null): void;\n}\n\n/**\n * Publishes a {@link WindowHelpHint} for a window so the shell's titlebar Help\n * button deeplinks the help-center reader to the article most relevant to where\n * the user is. The **publisher twin** of the shell's `WindowHelpHintService`\n * (the listener): it exists in the design system so that **any app — in-shell\n * OS-Core app or federated remote — publishes hints the same way**, without\n * hand-rolling the cross-bundle CustomEvent contract.\n *\n * **Why a `window` CustomEvent and not the `WINDOW_HELP_HINT` DI token?**\n * Native Federation can split an `InjectionToken` instance across host and\n * remote bundles, so a remote that injects `WINDOW_HELP_HINT` may receive a\n * different token than the one the shell provides. The string-keyed\n * {@link FLY_WINDOW_HELP_HINT_EVENT} crosses bundles reliably; the shell mirrors\n * it into the matching per-window hint signal.\n *\n * **Why a per-window handle and not `bindWindow`/`setHint` state?**\n * This service is `providedIn: 'root'` and the design system is a shared\n * Native-Federation singleton, so a *single* instance is shared across the\n * shell and every concurrently-open window (multiple in-shell apps, multiple\n * remotes). A handle closes over its window id, so two windows never clobber a\n * shared \"current window\" — each handle targets only its own titlebar.\n */\n@Injectable({ providedIn: 'root' })\nexport class FlyWindowHelpService {\n /**\n * Returns a publisher bound to a single window. Call once per window (e.g.\n * from the app root with `WINDOW_DATA.id`) and keep the handle. A\n * null/undefined id (standalone, no shell) yields a handle whose `setHint`\n * is a no-op.\n */\n forWindow(windowId: string | null | undefined): FlyWindowHelpPublisher {\n const id = windowId ?? null;\n return {\n setHint: (hint: WindowHelpHint | null): void => {\n if (typeof window === 'undefined' || !id) return;\n const detail: FlyWindowHelpHintEventDetail = { windowId: id, hint };\n window.dispatchEvent(\n new CustomEvent<FlyWindowHelpHintEventDetail>(FLY_WINDOW_HELP_HINT_EVENT, { detail }),\n );\n },\n };\n }\n}\n","/**\n * fly-remote-styles — Shell-layer CSS loader for Native Federation remotes.\n *\n * Problem\n * -------\n * Federated remotes only ship JS chunks via Native Federation — their global\n * `styles.css` (or its hashed equivalent) never loads in the shell, so any\n * global CSS selector (e.g. `.circles-overlay`) silently breaks in embedded\n * mode.\n *\n * Solution\n * --------\n * On first mount of each remote, the shell calls `loadRemoteStyles(appId,\n * remoteBaseUrl)`. This function:\n * 1. Derives the remote's `index.html` URL from `remoteBaseUrl`.\n * 2. Fetches it (one network round-trip per remote; browser-cached thereafter).\n * 3. Parses the HTML with DOMParser to extract the first\n * `<link rel=\"stylesheet\">` — the hashed production stylesheet\n * (e.g. `styles-ABC123.css`). This is Strategy (b): index.html discovery.\n * 4. Injects the stylesheet into `document.head` using one of two approaches\n * (see Injection approach below).\n *\n * Why strategy (b)?\n * -----------------\n * (a) Unhashed `styles.css` — requires remote build config changes (out of scope).\n * (b) Parse remote `index.html` — one tiny fetch per remote; browser caches it;\n * works today without any remote changes.\n * (c) `stylesUrl` in manifest/remoteEntry.json — cleanest long-term; requires\n * protocol change to every remote's CI pipeline (out of scope for Wave A1).\n *\n * Injection approach\n * ------------------\n * Preferred (Firefox 134+, Chrome 99+, Safari 17.2+):\n * `<link rel=\"stylesheet\" href=\"…\" crossorigin=\"anonymous\" layer=\"remote\">`\n *\n * The `layer` attribute on `<link>` is feature-detected once at module init via:\n * `'layer' in HTMLLinkElement.prototype`\n * If the attribute is supported, the shell injects a non-render-blocking `<link>`\n * element. The browser gets proper preload semantics and CORS headers flow through\n * the normal stylesheet pipeline.\n *\n * Fallback (browsers without `link[layer]` support):\n * `<style>@import url(\"…\") layer(remote);</style>`\n *\n * CSS Cascade Level 5: `@import url(\"…\") layer(remote)` is the ONLY valid way to\n * place an @import inside a named cascade layer when using the `<style>` approach.\n * The block-form `@layer remote { @import url(\"…\"); }` is INVALID CSS — the spec\n * forbids `@import` inside any block at-rule. Browsers silently drop such rules.\n *\n * Both code paths attach `data-fly-app` and `data-fly-href` attributes to the\n * injected element so idempotency checks work uniformly.\n *\n * Layer order declaration\n * -----------------------\n * A one-time `<style data-fly-layers>` element is prepended to `<head>` at module\n * init. It establishes the canonical layer order:\n * reset → designsystem → shell → remote → overrides\n * This guarantees that even if individual `@layer` blocks are injected in any\n * order at runtime, the cascade priority is always deterministic.\n *\n * CSP nonce propagation\n * ---------------------\n * If a `<meta name=\"csp-nonce\">` element is present, its content is read once at\n * module init and applied to every injected `<style>` or `<link>` element. If no\n * nonce meta is present, nothing is set (graceful degradation).\n *\n * URL validation\n * --------------\n * Discovered hrefs must be `http://`-, `https://`-, or `//`-prefixed. `javascript:`,\n * `data:`, and `blob:` are rejected outright. The href's origin must also match the\n * origin of `remoteBaseUrl` (same-origin as the remote), preventing a compromised\n * `index.html` from pointing at an attacker domain.\n *\n * Unload decision\n * ---------------\n * `unloadRemoteStyles` is exported for symmetry but should NOT be called on\n * normal window close. Keeping styles loaded across remounts avoids FOUC\n * flicker when the user reopens the same app. The stylesheet is a few KB; the\n * memory cost is negligible. Only call `unloadRemoteStyles` if you are certain\n * the remote will never be opened again in this session (e.g. licence revoke).\n *\n * Caveats\n * -------\n * - CORS: the remote's dev/prod server must serve `index.html` with a permissive\n * `Access-Control-Allow-Origin` header (or be same-origin via the YARP gateway).\n * The fetch uses `credentials: 'omit'` to avoid credential-carrying preflights.\n * - Fetch timeout: the index.html fetch is capped at 5 seconds. On timeout the\n * in-flight entry is cleared so a retry is possible on the next call.\n * - Race on rapid mount/unmount: if `loadRemoteStyles` is called a second time for\n * the same appId while the first fetch is still in-flight, the second call joins\n * the same in-flight Promise.\n * - Angular hashing: Angular's production build hashes the stylesheet filename.\n * DOMParser picks the first `<link rel=\"stylesheet\">` in `<head>`, which is the\n * single global stylesheet Angular emits. If a remote emits multiple stylesheets,\n * only the first is loaded — acceptable for Wave A1.\n */\n\n/**\n * Feature detection: does the browser support the `layer` attribute on\n * `<link>` elements? Probed once at module init.\n * Firefox 134+, Chrome 99+, Safari 17.2+ all ship this.\n */\nconst _linkLayerSupported: boolean =\n typeof HTMLLinkElement !== 'undefined' && 'layer' in HTMLLinkElement.prototype;\n\n/**\n * CSP nonce, read once from `<meta name=\"csp-nonce\">` at module init.\n * Applied to every injected `<style>` / `<link>` element. Null when absent.\n */\nconst _cspNonce: string | null =\n typeof document !== 'undefined'\n ? (document.querySelector<HTMLMetaElement>('meta[name=\"csp-nonce\"]')?.content ?? null)\n : null;\n\n/** In-flight fetch promises keyed by appId — prevents duplicate fetches. */\nconst _inFlight = new Map<string, Promise<string | null>>();\n\n// ---------------------------------------------------------------------------\n// Layer order — injected immediately at module init (synchronous, runs once).\n// ---------------------------------------------------------------------------\n(function _ensureLayerOrder(): void {\n if (typeof document === 'undefined') return; // SSR guard\n if (document.head.querySelector('style[data-fly-layers]')) return;\n\n const style = document.createElement('style');\n style.setAttribute('data-fly-layers', '');\n style.textContent = '@layer reset, designsystem, shell, remote, overrides;';\n if (_cspNonce) style.nonce = _cspNonce;\n // Prepend so this always precedes any other layer-bearing <style> blocks.\n document.head.insertBefore(style, document.head.firstChild);\n})();\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Discovers the hashed stylesheet href from the remote's `index.html`.\n * Applies a 5-second AbortController timeout. Clears `_inFlight` on abort so\n * a retry is possible. Returns `null` on any failure.\n */\nasync function _discoverStylesheetHref(appId: string, remoteBaseUrl: string): Promise<string | null> {\n const indexUrl = remoteBaseUrl.replace(/\\/$/, '') + '/index.html';\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), 5000);\n\n try {\n const res = await fetch(indexUrl, {\n credentials: 'omit',\n cache: 'default',\n signal: controller.signal,\n });\n clearTimeout(timeoutId);\n\n if (!res.ok) return null;\n const html = await res.text();\n const doc = new DOMParser().parseFromString(html, 'text/html');\n // Find the first stylesheet link in <head> — Angular emits exactly one.\n const link = doc.head.querySelector<HTMLLinkElement>('link[rel=\"stylesheet\"]');\n if (!link?.href) return null;\n // `link.href` from DOMParser resolves against `about:blank`. Use raw attribute.\n const rawHref = link.getAttribute('href') ?? '';\n if (!rawHref) return null;\n\n // Early-reject dangerous schemes before any URL resolution.\n // Without this guard, `javascript:alert(1)` would be rewritten to\n // `remoteBaseUrl/javascript:alert(1)` and silently pass origin validation.\n const rawLower = rawHref.toLowerCase();\n if (\n rawLower.startsWith('javascript:') ||\n rawLower.startsWith('data:') ||\n rawLower.startsWith('blob:')\n ) {\n console.warn(`[FlyOS] loadRemoteStyles: rejected unsafe stylesheet href \"${rawHref}\"`);\n return null;\n }\n\n // Resolve to absolute URL for origin validation.\n let resolvedHref: string;\n if (rawHref.startsWith('http://') || rawHref.startsWith('https://') || rawHref.startsWith('//')) {\n resolvedHref = rawHref;\n } else {\n resolvedHref = remoteBaseUrl.replace(/\\/$/, '') + '/' + rawHref.replace(/^\\//, '');\n }\n\n return _validateHref(resolvedHref, remoteBaseUrl);\n } catch {\n clearTimeout(timeoutId);\n // On abort or network error, clear in-flight so a retry is possible.\n _inFlight.delete(appId);\n return null;\n }\n}\n\n/**\n * Validates that a discovered href is safe to inject:\n * - Must be `http://`, `https://`, or `//`-prefixed (no `javascript:`, `data:`, `blob:`).\n * - Must share the same origin as `remoteBaseUrl`.\n *\n * Returns the href on success; logs a warning and returns `null` on failure.\n */\nfunction _validateHref(href: string, remoteBaseUrl: string): string | null {\n // Block dangerous schemes.\n const lower = href.toLowerCase();\n if (\n lower.startsWith('javascript:') ||\n lower.startsWith('data:') ||\n lower.startsWith('blob:')\n ) {\n console.warn(`[FlyOS] loadRemoteStyles: rejected unsafe stylesheet href \"${href}\"`);\n return null;\n }\n\n // Must be absolute (http/https/protocol-relative).\n if (\n !lower.startsWith('http://') &&\n !lower.startsWith('https://') &&\n !lower.startsWith('//')\n ) {\n console.warn(`[FlyOS] loadRemoteStyles: rejected non-absolute stylesheet href \"${href}\"`);\n return null;\n }\n\n // Origin must match remoteBaseUrl — prevents a compromised index.html from\n // redirecting styles at an attacker-controlled domain.\n try {\n const hrefOrigin = new URL(href.startsWith('//') ? 'https:' + href : href).origin;\n const remoteOrigin = new URL(remoteBaseUrl).origin;\n if (hrefOrigin !== remoteOrigin) {\n console.warn(\n `[FlyOS] loadRemoteStyles: rejected cross-origin stylesheet href \"${href}\" ` +\n `(expected origin \"${remoteOrigin}\", got \"${hrefOrigin}\")`\n );\n return null;\n }\n } catch {\n console.warn(`[FlyOS] loadRemoteStyles: could not parse href origin for \"${href}\"`);\n return null;\n }\n\n return href;\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Injects the remote's stylesheet into `document.head`.\n *\n * @param appId - Stable identifier for the remote app (matches `DesktopApp.id`).\n * @param remoteBaseUrl - Base URL of the remote, e.g. `https://circles.example.com`\n * or `http://localhost:7202`. Must NOT include `/remoteEntry.json`.\n *\n * The call is idempotent:\n * - If an element with `data-fly-app=\"appId\"` whose `data-fly-href` matches the\n * discovered href already exists → no-op.\n * - If the href differs (hot upgrade) → existing element is replaced.\n * - If no stylesheet is found in `index.html` → no-op (logged as a warning).\n *\n * Injection shape (preferred — `link[layer]` supported):\n * <link rel=\"stylesheet\" data-fly-app=\"<appId>\" data-fly-href=\"<href>\"\n * href=\"<href>\" crossorigin=\"anonymous\" layer=\"remote\">\n *\n * Injection shape (fallback — `link[layer]` unsupported):\n * <style data-fly-app=\"<appId>\" data-fly-href=\"<href>\">\n * @import url(\"<href>\") layer(remote);\n * </style>\n *\n * The `data-fly-href` attribute stores the discovered href separately from the\n * element content so idempotency checks can compare the URL without parsing CSS.\n */\nexport async function loadRemoteStyles(appId: string, remoteBaseUrl: string): Promise<void> {\n if (typeof document === 'undefined') return; // SSR guard\n\n // Resolve relative remoteBaseUrl (e.g. '/circles-dev') against the current\n // page origin so all downstream URL operations (fetch, origin check) receive\n // an absolute URL. Absolute inputs are returned unchanged by new URL().\n const absoluteBase = new URL(remoteBaseUrl, location.href).href.replace(/\\/$/, '');\n\n // Kick off or join an in-flight fetch for this appId.\n // Note: _resolvedHref cache is intentionally absent — always re-discover so\n // the browser's HTTP cache handles cost (index.html is tiny) and hot-deploys\n // are picked up without a page reload.\n let fetchPromise = _inFlight.get(appId);\n if (!fetchPromise) {\n fetchPromise = _discoverStylesheetHref(appId, absoluteBase);\n _inFlight.set(appId, fetchPromise);\n }\n\n const href = await fetchPromise;\n _inFlight.delete(appId);\n\n if (!href) {\n console.warn(\n `[FlyOS] loadRemoteStyles: no stylesheet found in ${absoluteBase}/index.html for appId=\"${appId}\"`\n );\n return;\n }\n\n // Check both <link> and <style> selectors — handle upgrades from the old fallback path.\n const escapedId = CSS.escape(appId);\n const existing =\n document.head.querySelector<HTMLLinkElement | HTMLStyleElement>(\n `link[data-fly-app=\"${escapedId}\"], style[data-fly-app=\"${escapedId}\"]`\n );\n\n if (existing) {\n if (existing.getAttribute('data-fly-href') === href) return; // identical — no-op\n // Hot upgrade: remove old element (could be <link> or <style>) atomically.\n existing.remove();\n }\n\n if (_linkLayerSupported) {\n // Preferred path: non-render-blocking <link> with native layer= attribute.\n // Firefox 134+, Chrome 99+, Safari 17.2+ all support this.\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.setAttribute('data-fly-app', appId);\n link.setAttribute('data-fly-href', href);\n link.href = href;\n link.crossOrigin = 'anonymous';\n (link as unknown as Record<string, string>)['layer'] = 'remote';\n if (_cspNonce) link.nonce = _cspNonce;\n document.head.appendChild(link);\n } else {\n // Fallback path: <style> with @import layer(remote) for older browsers.\n // CSS Cascade Level 5: `@import url(\"…\") layer(remote)` is the only valid\n // way to place an @import inside a named cascade layer. Block-form\n // `@layer remote { @import … }` is invalid and silently dropped by browsers.\n const style = document.createElement('style');\n style.setAttribute('data-fly-app', appId);\n style.setAttribute('data-fly-href', href);\n style.textContent = `@import url(\"${href}\") layer(remote);`;\n if (_cspNonce) style.nonce = _cspNonce;\n document.head.appendChild(style);\n }\n}\n\n/**\n * Removes the injected stylesheet element (either `<link>` or `<style>`) for\n * `appId` from `document.head` and clears all internal state for this appId.\n *\n * NOTE: Prefer NOT calling this on normal window close — keeping styles loaded\n * prevents FOUC flicker when the user reopens the same app. Call only if you\n * are certain the remote will not be reopened in this session.\n */\nexport function unloadRemoteStyles(appId: string): void {\n if (typeof document === 'undefined') return; // SSR guard\n const escapedId = CSS.escape(appId);\n // Remove <link> element (preferred path) if present.\n document.head\n .querySelector(`link[data-fly-app=\"${escapedId}\"]`)\n ?.remove();\n // Remove <style> element (fallback path) if present.\n document.head\n .querySelector(`style[data-fly-app=\"${escapedId}\"]`)\n ?.remove();\n // Clear in-flight so a future call can retry.\n _inFlight.delete(appId);\n}\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { NgComponentOutlet } from '@angular/common';\nimport { FlyRemoteRouter } from '../../services/fly-remote-router.service';\n\n/**\n * Outlet for FlyOS-embedded routing. Renders the component associated with the\n * first matching route in the consumer's `FLY_REMOTE_ROUTES` table, reacting to\n * `FlyRemoteRouter.navigate(...)` calls.\n *\n * Use this **only in embedded mode**. Standalone remotes should keep their\n * `<router-outlet>` — `FlyRemoteRouter.navigate` delegates to Angular's Router\n * there, and this outlet would just shadow it.\n *\n * Recommended pattern in a remote's root component:\n * ```html\n * @if (router.isEmbedded) {\n * <fly-remote-router-outlet />\n * } @else {\n * <router-outlet />\n * }\n * ```\n *\n * Why both? Standalone keeps full Angular routing — query params, guards,\n * resolvers, lazy loading, RouterLink. Embedded gets a stripped-down\n * synchronous outlet that matches against the same route table the remote\n * declared via `FLY_REMOTE_ROUTES`. The same `router.navigate(['/foo', id])`\n * call works in both modes; only the rendering surface differs.\n *\n * Limitations vs. `<router-outlet>`:\n * - Synchronous components only (no `loadComponent` / `loadChildren`).\n * - No guards / resolvers / data resolution.\n * - No query-param / hash handling — only path segments.\n * - No `RouterLink` directive — use `(click)=\"router.navigate(...)\"`.\n *\n * Components rendered by this outlet read route params via `FlyRemoteRouter.params`:\n * ```ts\n * private readonly router = inject(FlyRemoteRouter);\n * readonly id = computed(() => this.router.params()['id'] ?? '');\n * ```\n */\n@Component({\n selector: 'fly-remote-router-outlet',\n standalone: true,\n imports: [NgComponentOutlet],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (matched(); as m) {\n <ng-container *ngComponentOutlet=\"m.route.component\" />\n }\n `,\n})\nexport class FlyRemoteRouterOutletComponent {\n private readonly router = inject(FlyRemoteRouter);\n\n /**\n * Read directly from FlyRemoteRouter so the outlet re-renders whenever the\n * URL changes (signal-based, OnPush-friendly).\n */\n readonly matched = this.router.matchedRoute;\n}\n","import { Pipe, PipeTransform, inject } from '@angular/core';\nimport { I18nService } from '../services/i18n.service';\n\n/**\n * Translates a key using the shared I18nService.\n *\n * @example\n * {{ 'myApp.section.title' | translate }}\n * {{ 'myApp.items_count' | translate:{ n: count() } }}\n */\n@Pipe({\n name: 'translate',\n standalone: true,\n pure: false,\n})\nexport class TranslatePipe implements PipeTransform {\n private readonly i18n = inject(I18nService);\n\n transform(key: string, params?: Record<string, string | number>): string {\n // Read version so template CD re-runs when bundles load (merged translations updated).\n void this.i18n.version();\n return this.i18n.t(key, params);\n }\n}\n","import { Injectable, Signal, computed, inject, signal } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { Observable, of } from 'rxjs';\nimport { User } from '../models/user.model';\n\nexport interface MockAuthConfig {\n user: User;\n token?: string;\n loginRedirect?: string[];\n logoutRedirect?: string[];\n}\n\ninterface MockSession {\n accessToken: string;\n user: User;\n expiresAt: number;\n}\n\n/**\n * Shared mock AuthService base class for Business App developers.\n *\n * Extend this class in your app's `auth.service.mock.ts` and override\n * `getConfig()` to supply app-specific mock user data and navigation paths.\n * The subclass must be decorated with `@Injectable({ providedIn: 'root' })`\n * and exported as `AuthService` so Angular's `fileReplacements` swap works.\n *\n * @example\n * ```typescript\n * // src/app/core/services/auth.service.mock.ts\n * import { Injectable } from '@angular/core';\n * import { MockAuthService, type MockAuthConfig } from '@mohamedatia/fly-design-system';\n *\n * @Injectable({ providedIn: 'root' })\n * export class AuthService extends MockAuthService {\n * protected override getConfig(): MockAuthConfig {\n * return {\n * user: { id: 'dev-001', tenantId: 'dev-tenant', email: 'dev@example.com',\n * firstName: 'Dev', lastName: 'User', fullName: 'Dev User',\n * preferredLocale: 'en', roles: ['admin'], apps: ['my-app'] },\n * token: 'my-mock-token',\n * loginRedirect: ['/app'],\n * };\n * }\n * }\n * ```\n */\n@Injectable()\nexport class MockAuthService {\n private readonly router = inject(Router);\n\n protected readonly _session: ReturnType<typeof signal<MockSession | null>>;\n\n private readonly _config: MockAuthConfig;\n\n readonly isAuthenticated: Signal<boolean>;\n readonly currentUser: Signal<User | null>;\n readonly accessToken: Signal<string | null>;\n /** Always false in mock mode — 2FA is handled entirely by the STS. */\n readonly hasPendingTwoFactor: Signal<boolean>;\n /** Always false in mock mode — auth is pre-populated synchronously. */\n readonly initializing: Signal<boolean>;\n\n /**\n * Shell and guards may read this flag; real auth uses `localStorage` `fly_had_session`.\n * Default false — override in the app’s `auth.service.mock.ts` if needed.\n */\n get hadPriorSession(): boolean {\n return false;\n }\n\n constructor() {\n // All signal/computed calls are inside the constructor body so Angular's\n // injection context and ngDevMode are fully set up before they execute.\n this._config = this.getConfig();\n\n this._session = signal<MockSession | null>({\n accessToken: this._config.token ?? 'mock-token',\n user: this._config.user,\n expiresAt: Date.now() + 24 * 60 * 60 * 1000,\n });\n\n this.isAuthenticated = computed(() => {\n const s = this._session();\n return s !== null && s.expiresAt > Date.now();\n });\n\n this.currentUser = computed(() => this._session()?.user ?? null);\n this.accessToken = computed(() => this._session()?.accessToken ?? null);\n this.hasPendingTwoFactor = computed(() => false);\n this.initializing = signal(false).asReadonly();\n }\n\n /** Override in subclass to supply app-specific mock data. */\n protected getConfig(): MockAuthConfig {\n return {\n user: {\n id: 'mock-user-001',\n tenantId: 'mock-tenant-001',\n email: 'developer@fly.local',\n firstName: 'UI',\n lastName: 'Developer',\n fullName: 'UI Developer',\n preferredLocale: 'en',\n roles: ['admin'],\n apps: [],\n },\n };\n }\n\n async init(): Promise<void> {\n // Mock mode: already authenticated, nothing to initialize.\n }\n\n startLogin(): void {\n this.router.navigate(this._config.loginRedirect ?? ['/']);\n }\n\n handleCallback(_code: string, _state?: string): Observable<User> {\n return of(this._config.user);\n }\n\n async forceRefresh(): Promise<void> {\n // No-op in mock mode — token never expires.\n }\n\n patchSessionPreferredLocale(locale: string): void {\n const session = this._session();\n if (!session?.user) return;\n this._session.set({ ...session, user: { ...session.user, preferredLocale: locale } });\n }\n\n /** Parameter order matches the real AuthService: (user, accessToken, expiresAt). */\n setSession(_user: User, _accessToken: string, _expiresAt: number): void {\n // No-op in mock mode — session is hardcoded.\n }\n\n logout(): void {\n this._session.set(null);\n this.router.navigate(this._config.logoutRedirect ?? ['/']);\n }\n}\n","import { Injectable, Signal, computed, signal } from '@angular/core';\nimport type {\n LookupHandle,\n LookupRegistration,\n} from '../../models/agent-input.model';\n\n/**\n * Singleton registry of entity lookups offered by the `/lookup` typeahead.\n *\n * Mirrors {@link AgentCommandRegistry}'s federation-singleton story\n * (`sharedMappings: ['@mohamedatia/fly-design-system']`), id-collision\n * \"latest wins\" contract, and disposable-handle ergonomics. OS-core entities\n * (note / calendar event / file) register once at shell bootstrap via\n * `CORE_APP_LOOKUPS`; federated remotes (Circles: scenario / trend / signal)\n * register at remote-component boot and dispose on window close.\n *\n * **Scope semantics diverge from commands.** Commands HIDE when their `appId`\n * isn't in `liveAppIds`. Lookups DO NOT — they're always offered, and\n * `{appId}` is just a *priority hint* that bumps that lookup to the top of\n * the entity picker when the app is live. See {@link LookupRegistration.scope}\n * for the rationale.\n *\n * Storage is a signal store keyed on {@link LookupRegistration.entity}. Because\n * `entity` is the collision key, an app re-registering the same entity replaces\n * the prior descriptor; a stale handle's `dispose()` then no-ops.\n */\n@Injectable({ providedIn: 'root' })\nexport class AgentLookupRegistry {\n private readonly _lookups = signal<readonly LookupRegistration[]>([]);\n /** All currently-registered lookups, in insertion order. */\n readonly all: Signal<readonly LookupRegistration[]> = this._lookups.asReadonly();\n\n /**\n * All registered lookups, sorted by affinity to `liveAppIds`:\n *\n * 1. Lookups whose `scope.appId` is in the live app set (in registration\n * order within that bucket).\n * 2. Then everything else — `'global'` lookups AND scoped lookups whose\n * app isn't currently live — in registration order.\n *\n * Recomputes when either the registry or `liveAppIds` changes. Pass a\n * `Signal<ReadonlySet<string>>` from the host's app-registry for reactive\n * re-sorting. **Always returns the full registry** — see the type doc on\n * {@link LookupRegistration.scope} for why this differs from\n * {@link AgentCommandRegistry.visible}.\n */\n visible(\n liveAppIds: ReadonlySet<string> | Signal<ReadonlySet<string>>,\n ): Signal<readonly LookupRegistration[]> {\n const liveSignal = isSignal<ReadonlySet<string>>(liveAppIds)\n ? liveAppIds\n : signal(liveAppIds).asReadonly();\n return computed(() => {\n const live = liveSignal();\n const all = this._lookups();\n const prioritized: LookupRegistration[] = [];\n const rest: LookupRegistration[] = [];\n for (const l of all) {\n if (l.scope !== 'global' && live.has(l.scope.appId)) {\n prioritized.push(l);\n } else {\n rest.push(l);\n }\n }\n return prioritized.length === 0 ? all : [...prioritized, ...rest];\n });\n }\n\n /**\n * Register one lookup. Returns a handle whose `dispose()` removes the row by\n * `entity`. A later re-registration of the same entity makes the original\n * handle's `dispose()` a no-op (the newer registration owns the row).\n */\n register(lookup: LookupRegistration): LookupHandle {\n const generation = ++this._generation;\n this._lookups.update((rows) => [\n ...rows.filter((r) => r.entity !== lookup.entity),\n lookup,\n ]);\n this._owners.set(lookup.entity, generation);\n return {\n dispose: () => {\n if (this._owners.get(lookup.entity) === generation) {\n this._owners.delete(lookup.entity);\n this._lookups.update((rows) =>\n rows.filter((r) => r.entity !== lookup.entity),\n );\n }\n },\n };\n }\n\n /**\n * Bulk register. Rolls back on a duplicate entity WITHIN the input batch\n * (throws before any row lands). Cross-batch duplicates against existing rows\n * follow the standard \"latest wins\" rule and do NOT trigger rollback.\n */\n registerAll(lookups: readonly LookupRegistration[]): LookupHandle {\n const seen = new Set<string>();\n for (const l of lookups) {\n if (seen.has(l.entity)) {\n throw new Error(\n `AgentLookupRegistry.registerAll: duplicate entity \"${l.entity}\" in batch`,\n );\n }\n seen.add(l.entity);\n }\n const handles = lookups.map((l) => this.register(l));\n let disposed = false;\n return {\n dispose: () => {\n if (disposed) return;\n disposed = true;\n for (const h of handles) h.dispose();\n },\n };\n }\n\n /**\n * Resolve a deep-link anchor to a concrete launch target.\n *\n * `kind` is the dotted `<appId>.<entity>` token the agents backend emits\n * inside `flyos:<kind>/<id>` chat-answer anchors — the same entity-kind\n * vocabulary as drag-payload kinds and `ref` parts. Returns\n * `{ appId, route }` when a registered lookup for that `(appId, entity)`\n * pair carries a {@link LookupDescriptor.deepLinkRoute} template; `null`\n * otherwise (unknown entity, app mismatch, or no template — e.g. the\n * owning app isn't installed) so the caller renders plain text rather than\n * a dead link.\n *\n * `appId` and `entity` are both dot-free by their own grammars, so the\n * FIRST dot is the unambiguous split point; a dotless `kind` can't carry an\n * app and never resolves. The template's single `{id}` placeholder is\n * substituted URL-encoded.\n */\n resolveDeepLink(\n kind: string,\n id: string,\n ): { readonly appId: string; readonly route: string } | null {\n if (!kind) return null;\n const dot = kind.indexOf('.');\n if (dot <= 0 || dot >= kind.length - 1) return null;\n const appId = kind.slice(0, dot);\n const entity = kind.slice(dot + 1);\n const target = this.resolveDeepLinkForEntity(entity, id);\n // App must match the one named in the anchor — a `flyos:` href carries\n // the owning app explicitly, so a stale/wrong app prefix must NOT resolve\n // even when the bare entity name happens to be registered elsewhere.\n return target && target.appId === appId ? target : null;\n }\n\n /**\n * Resolve a deep-link target from a bare `(entity, id)` pair — the shape a\n * `/lookup` ref carries (it has no `<appId>.<entity>` kind token; the owning\n * app is implicit in the registered descriptor). `entity` is the registry's\n * unique storage key, so it identifies the descriptor unambiguously without\n * an app prefix.\n *\n * Returns `{ appId, route }` (the descriptor's {@link LookupDescriptor.appId}\n * / affinity `scope.appId` as the owner, `{id}` substituted URL-encoded) when\n * a matching descriptor carries a {@link LookupDescriptor.deepLinkRoute};\n * `null` otherwise (unknown entity, no template, or the owning app has since\n * unregistered) so callers render plain text rather than a dead link — the\n * same graceful-degrade contract as {@link resolveDeepLink}.\n */\n resolveDeepLinkForEntity(\n entity: string,\n id: string,\n ): { readonly appId: string; readonly route: string } | null {\n if (!entity || !id) return null;\n const reg = this._lookups().find((r) => r.entity === entity && r.deepLinkRoute);\n const appId = reg ? ownerAppId(reg) : undefined;\n if (!reg?.deepLinkRoute || !appId) return null;\n return { appId, route: reg.deepLinkRoute.replace('{id}', encodeURIComponent(id)) };\n }\n\n /** Tear down by entity. Idempotent. */\n unregister(entity: string): void {\n if (this._owners.delete(entity)) {\n this._lookups.update((rows) => rows.filter((r) => r.entity !== entity));\n }\n }\n\n /** Monotonic counter; identifies which registration call currently owns each entity. */\n private _generation = 0;\n /** entity → generation. Lets a stale handle's `dispose()` no-op after replacement. */\n private readonly _owners = new Map<string, number>();\n}\n\n/** `isSignal` shim — narrows to either `Signal<T>` or a plain value. */\nfunction isSignal<T>(v: T | Signal<T>): v is Signal<T> {\n return typeof v === 'function';\n}\n\n/**\n * The app that owns a registration, for deep-link resolution. Prefers the\n * stamped {@link LookupDescriptor.appId} (set by `RemoteManifestService` /\n * `CORE_APP_LOOKUPS`), falling back to the affinity `scope.appId` so a raw\n * manifest descriptor still resolves even before the host stamps it.\n * Returns `undefined` for `'global'`-scoped lookups with no stamped appId.\n */\nfunction ownerAppId(reg: LookupRegistration): string | undefined {\n return reg.appId ?? (typeof reg.scope === 'object' ? reg.scope.appId : undefined);\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostListener,\n ViewChild,\n type OnDestroy,\n type OnInit,\n afterNextRender,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { HttpClient, HttpParams } from '@angular/common/http';\nimport { Subscription } from 'rxjs';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\nimport { I18nService } from '../../services/i18n.service';\nimport { AgentLookupRegistry } from '../../services/agent-input/agent-lookup-registry.service';\nimport { APP_LOOKUP } from '../../services/source-app-resolver.service';\nimport type { LookupDescriptor, LookupResult } from '../../models/agent-input.model';\nimport { type EntityLinkSelection } from './entity-lookup.types';\n\n/** Debounce (ms) applied to the typeahead between the user's last keystroke\n * and the HTTP search. Long enough that a fast typist fires one request, not\n * one per character. */\nconst SEARCH_DEBOUNCE_MS = 250;\n\n/** Hard cap on candidate rows rendered, regardless of how many the endpoint\n * returns. The descriptor's `extraParams.pageSize` is the primary bound; this\n * is a defensive client-side backstop so a misconfigured endpoint can't paint\n * a thousand-row list. */\nconst MAX_RESULTS_RENDERED = 25;\n\n/**\n * Shared floating entity typeahead — the `/lookup` picker promoted out of the\n * agent composer into the design-system so any app (agent composer, notes,\n * task comments, federated remotes) can let a user find an entity and act on\n * it. Editor-agnostic: it emits a {@link LookupResult} ({@link pick}) and,\n * when the entity resolves to a deep link, an {@link EntityLinkSelection}\n * ({@link entityLinkSelected}) — the consumer decides whether to make a ref\n * chip, insert a `flyos:` link into an editor, etc.\n *\n * Two-stage cascade:\n * - **Stage 1 — entity**: a filterable autocomplete of the offered entities.\n * Skipped when there's one entity or `initialEntity` already names one.\n * - **Stage 2 — search**: a debounced typeahead against the chosen entity's\n * search endpoint, with a breadcrumb back to stage 1.\n *\n * The HTTP call goes through the host's `HttpClient` so the gateway routing +\n * auth interceptor apply — the same path the MCP `*_list_brief` tools wrap,\n * but user-authenticated. The \"exposed by app\" badge resolves names via the\n * optional {@link LOOKUP_APP_NAME_RESOLVER} the host provides (the DS has no\n * app registry); absent it, the badge falls back to `appBadgeKey`.\n */\n@Component({\n selector: 'fly-entity-lookup',\n standalone: true,\n imports: [CommonModule, FormsModule, TranslatePipe],\n templateUrl: './entity-lookup.component.html',\n styleUrls: ['./entity-lookup.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n // `placement` drives a host class so the panel positions per anchor: `up`\n // (default) = full-width, opens upward (agent composer); `down` =\n // button-anchored dropdown opening down (top toolbar — notes); `above` =\n // button-anchored dropdown opening up (bottom composer — task comments).\n host: {\n '[class.fly-entity-lookup--down]': \"placement() === 'down'\",\n '[class.fly-entity-lookup--above]': \"placement() === 'above'\",\n },\n})\nexport class EntityLookupComponent implements OnInit, OnDestroy {\n private readonly http = inject(HttpClient);\n private readonly i18n = inject(I18nService);\n private readonly host = inject(ElementRef<HTMLElement>);\n private readonly lookupRegistry = inject(AgentLookupRegistry);\n /** Host-provided appId → {id,name} adapter for the \"exposed by app\" badge.\n * The DS has no app registry; the shell (and remotes) provide APP_LOOKUP.\n * Optional — absent, the badge falls back to a descriptor's appBadgeKey. */\n private readonly appLookup = inject(APP_LOOKUP, { optional: true });\n\n /** Entities the picker may search — already filtered to the live-app scope\n * by the caller. Empty renders a \"nothing to look up\" hint. */\n readonly descriptors = input.required<readonly LookupDescriptor[]>();\n /** Entity pre-selected (e.g. from `/lookup <entity>`). Ignored when it\n * doesn't match any descriptor (falls back to the first). */\n readonly initialEntity = input<string | undefined>(undefined);\n /** Query text pre-seeded (e.g. from `/lookup <entity> <query>`). */\n readonly initialQuery = input<string>('');\n /** Per-instance listbox id so `aria-controls` / `aria-activedescendant`\n * resolve unambiguously when multiple panels mount. */\n readonly listboxId = input<string>('fly-entity-lookup-listbox');\n /** Open direction. `'up'` (default) suits a bottom-anchored composer (the\n * agent input); `'down'` suits a top-anchored toolbar button (notes / task\n * comments) — the panel then anchors to the host's positioned parent (the\n * button wrapper) and opens below it with a fixed width. */\n readonly placement = input<'up' | 'down' | 'above'>('up');\n\n /** Raw pick — every consumer gets this (agent ref chips, etc.). */\n readonly pick = output<LookupResult>();\n /** Deep-link selection — emitted ONLY when the picked entity resolves to a\n * route via the lookup registry (so the consumer never gets a dead link).\n * Editors bind this to insert a `flyos:` anchor. */\n readonly entityLinkSelected = output<EntityLinkSelection>();\n readonly dismiss = output<void>();\n\n /** Which cascade stage is active: pick an entity, then search within it. */\n readonly stage = signal<'entity' | 'search'>('entity');\n /** entity key of the descriptor currently being searched. */\n readonly activeEntity = signal<string | null>(null);\n /** In stage 1 this filters the entity list; in stage 2 it's the search text. */\n readonly query = signal<string>('');\n readonly results = signal<readonly LookupResult[]>([]);\n readonly loading = signal<boolean>(false);\n /** i18n key for an inline error (network / bad endpoint); null when clear. */\n readonly errorKey = signal<string | null>(null);\n readonly activeIndex = signal<number>(0);\n\n /** Query stashed when no entity matched, so it can seed the search field the\n * moment the user picks an entity. One-shot. */\n private _seedQuery = '';\n\n /** The descriptor matching {@link activeEntity}, or null. */\n readonly activeDescriptor = computed<LookupDescriptor | null>(() => {\n const e = this.activeEntity();\n if (!e) return null;\n return this.descriptors().find((d) => d.entity === e) ?? null;\n });\n\n /** Stage-1 entity options, narrowed by the typed filter. Touches\n * `i18n.version()` so a locale switch re-resolves the label match. */\n readonly filteredEntities = computed<readonly LookupDescriptor[]>(() => {\n this.i18n.version();\n const q = this.query().trim().toLowerCase();\n const descs = this.descriptors();\n if (q.length === 0) return descs;\n return descs.filter(\n (d) =>\n d.entity.toLowerCase().includes(q) ||\n this.i18n.t(d.labelKey).toLowerCase().includes(q),\n );\n });\n\n /** Size of the list the keyboard currently navigates (entities vs results). */\n readonly listSize = computed<number>(() =>\n this.stage() === 'entity' ? this.filteredEntities().length : this.results().length,\n );\n\n /** Show the breadcrumb / back affordance only when there's a real choice of\n * entity to step back to. */\n readonly showBack = computed<boolean>(() => this.descriptors().length > 1);\n\n /** Placeholder reflects the active stage. */\n readonly searchPlaceholderKey = computed<string>(() =>\n this.stage() === 'entity'\n ? 'agent.lookup.entity_placeholder'\n : 'agent.lookup.search_placeholder',\n );\n\n private _debounceTimer: ReturnType<typeof setTimeout> | null = null;\n private _searchSub: Subscription | null = null;\n\n @ViewChild('searchRef') private readonly searchEl?: ElementRef<HTMLInputElement>;\n\n constructor() {\n afterNextRender(() => this._focusSearch());\n }\n\n ngOnInit(): void {\n const descs = this.descriptors();\n const initial = this.initialEntity();\n const chosen =\n (initial ? descs.find((d) => d.entity === initial) : undefined) ??\n (descs.length === 1 ? descs[0] : undefined);\n if (chosen) {\n this.activeEntity.set(chosen.entity);\n this.query.set(this.initialQuery() ?? '');\n this.stage.set('search');\n this._runSearch();\n } else {\n this._seedQuery = this.initialQuery() ?? '';\n this.activeEntity.set(null);\n this.query.set('');\n this.stage.set('entity');\n }\n }\n\n ngOnDestroy(): void {\n this._clearTimer();\n this._searchSub?.unsubscribe();\n }\n\n optionId(index: number): string {\n return `${this.listboxId()}-opt-${index}`;\n }\n\n readonly activeDescendant = computed<string>(() => {\n if (this.listSize() === 0) return '';\n return `${this.listboxId()}-opt-${this._clampedIndex()}`;\n });\n\n private _clampedIndex(): number {\n const size = this.listSize();\n if (size === 0) return 0;\n return Math.min(Math.max(0, this.activeIndex()), size - 1);\n }\n\n // ── Input + entity handlers ─────────────────────────────────────────────\n\n onQueryInput(value: string): void {\n this.query.set(value);\n this.activeIndex.set(0);\n if (this.stage() === 'search') this._scheduleSearch();\n }\n\n onSelectEntity(entity: string): void {\n this.activeEntity.set(entity);\n this.activeIndex.set(0);\n this.stage.set('search');\n this.query.set(this._seedQuery);\n this._seedQuery = '';\n this.errorKey.set(null);\n this._runSearch();\n this._focusSearch();\n }\n\n goBackToEntity(): void {\n if (!this.showBack()) return;\n this._clearTimer();\n this._searchSub?.unsubscribe();\n this.stage.set('entity');\n this.activeEntity.set(null);\n this.activeIndex.set(0);\n this.query.set('');\n this.results.set([]);\n this.loading.set(false);\n this.errorKey.set(null);\n this._focusSearch();\n }\n\n onRowClick(row: LookupResult): void {\n this._selectRow(row);\n }\n\n onRowHover(index: number): void {\n if (index !== this.activeIndex()) this.activeIndex.set(index);\n }\n\n /**\n * Single pick exit. Emits the raw {@link pick} for every consumer, AND —\n * when the entity resolves to a deep-link route via the registry — an\n * {@link entityLinkSelected} carrying the `flyos:` href. Resolution failures\n * (unknown entity / app mismatch / owning app not installed / no\n * `deepLinkRoute`) simply omit the deep-link event: editor consumers get\n * nothing to insert rather than a dead link, while the raw `pick` path\n * (agent ref chips) still fires.\n */\n private _selectRow(row: LookupResult): void {\n this.pick.emit(row);\n const target = this.lookupRegistry.resolveDeepLinkForEntity(row.entity, row.id);\n if (target) {\n this.entityLinkSelected.emit({\n label: row.label,\n kind: `${target.appId}.${row.entity}`,\n id: row.id,\n appId: target.appId,\n route: target.route,\n href: `flyos:${target.appId}.${row.entity}/${row.id}`,\n });\n }\n }\n\n onKeydown(ev: KeyboardEvent): void {\n if (ev.key === 'Escape') {\n ev.preventDefault();\n ev.stopPropagation();\n this.dismiss.emit();\n return;\n }\n if (\n ev.key === 'Backspace' &&\n this.stage() === 'search' &&\n this.query().length === 0 &&\n this.showBack()\n ) {\n ev.preventDefault();\n this.goBackToEntity();\n return;\n }\n const size = this.listSize();\n if (ev.key === 'ArrowDown') {\n ev.preventDefault();\n if (size === 0) return;\n this.activeIndex.set((this._clampedIndex() + 1) % size);\n return;\n }\n if (ev.key === 'ArrowUp') {\n ev.preventDefault();\n if (size === 0) return;\n this.activeIndex.set((this._clampedIndex() - 1 + size) % size);\n return;\n }\n if (ev.key === 'Enter') {\n ev.preventDefault();\n if (this.stage() === 'entity') {\n const desc = this.filteredEntities()[this._clampedIndex()];\n if (desc) this.onSelectEntity(desc.entity);\n } else {\n const row = this.results()[this._clampedIndex()];\n if (row) this._selectRow(row);\n }\n return;\n }\n }\n\n @HostListener('document:mousedown', ['$event'])\n onDocumentMouseDown(ev: MouseEvent): void {\n const target = ev.target as Node | null;\n if (!target) return;\n if (this.host.nativeElement.contains(target)) return;\n this.dismiss.emit();\n }\n\n @HostListener('document:keydown.escape')\n onDocumentEscape(): void {\n this.dismiss.emit();\n }\n\n // ── Search internals ────────────────────────────────────────────────────\n\n private _scheduleSearch(): void {\n this._clearTimer();\n this._debounceTimer = setTimeout(() => this._runSearch(), SEARCH_DEBOUNCE_MS);\n }\n\n private _clearTimer(): void {\n if (this._debounceTimer !== null) {\n clearTimeout(this._debounceTimer);\n this._debounceTimer = null;\n }\n }\n\n private _runSearch(): void {\n this._clearTimer();\n const desc = this.activeDescriptor();\n if (!desc) {\n this.results.set([]);\n return;\n }\n const endpoint = desc.search.endpoint;\n // SSRF / shape guard — relative path only (no scheme/host, no protocol-\n // relative `//host`).\n if (!endpoint.startsWith('/') || endpoint.startsWith('//')) {\n this.errorKey.set('agent.lookup.error');\n this.results.set([]);\n this.loading.set(false);\n return;\n }\n\n this._searchSub?.unsubscribe();\n this.loading.set(true);\n this.errorKey.set(null);\n\n let params = new HttpParams().set(desc.search.queryParam, this.query().trim());\n for (const [k, v] of Object.entries(desc.search.extraParams ?? {})) {\n params = params.set(k, v);\n }\n\n this._searchSub = this.http.get<unknown>(endpoint, { params }).subscribe({\n next: (body) => {\n this.results.set(this._mapResults(desc, body));\n this.loading.set(false);\n this.activeIndex.set(0);\n },\n error: () => {\n this.errorKey.set('agent.lookup.error');\n this.results.set([]);\n this.loading.set(false);\n },\n });\n }\n\n private _mapResults(desc: LookupDescriptor, body: unknown): readonly LookupResult[] {\n const arr = this._extractArray(body, desc.search.resultsPath);\n const idField = desc.search.idField ?? 'id';\n const dispField = desc.search.displayField;\n const secField = desc.search.secondaryField;\n const appField = desc.search.appIdField;\n const out: LookupResult[] = [];\n for (const item of arr) {\n if (!item || typeof item !== 'object') continue;\n const rec = item as Record<string, unknown>;\n const id = rec[idField];\n const label = rec[dispField];\n if (id == null || label == null) continue;\n const rowAppId =\n appField != null && rec[appField] != null && rec[appField] !== ''\n ? String(rec[appField])\n : undefined;\n out.push({\n entity: desc.entity,\n id: String(id),\n label: String(label),\n secondary:\n secField != null && rec[secField] != null\n ? String(rec[secField])\n : undefined,\n appId: rowAppId,\n });\n if (out.length >= MAX_RESULTS_RENDERED) break;\n }\n return out;\n }\n\n private _extractArray(body: unknown, path?: string): readonly unknown[] {\n if (Array.isArray(body)) return body;\n if (!path) return [];\n let cur: unknown = body;\n for (const seg of path.split('.')) {\n if (cur && typeof cur === 'object' && seg in (cur as object)) {\n cur = (cur as Record<string, unknown>)[seg];\n } else {\n return [];\n }\n }\n return Array.isArray(cur) ? cur : [];\n }\n\n private _focusSearch(): void {\n queueMicrotask(() => this.searchEl?.nativeElement.focus());\n }\n\n entityLabel(desc: LookupDescriptor): string {\n this.i18n.version();\n return this.i18n.t(desc.labelKey);\n }\n\n readonly activeEntityLabel = computed<string>(() => {\n const desc = this.activeDescriptor();\n return desc ? this.entityLabel(desc) : '';\n });\n\n /**\n * Display name of the app exposing this descriptor, for the \"exposed by …\"\n * badge. Resolution order: host-provided {@link LOOKUP_APP_NAME_RESOLVER}\n * (keyed by `descriptor.appId`) → descriptor `appBadgeKey` (literal i18n\n * key, for entities not mapped to a single shell app) → '' (no badge).\n */\n appLabel(desc: LookupDescriptor): string {\n this.i18n.version();\n if (desc.appId) {\n const resolved = this.appLookup?.getById(desc.appId)?.name;\n if (resolved) return resolved;\n }\n if (desc.appBadgeKey) return this.i18n.t(desc.appBadgeKey);\n return '';\n }\n\n readonly activeAppLabel = computed<string>(() => {\n const desc = this.activeDescriptor();\n return desc ? this.appLabel(desc) : '';\n });\n\n /** Per-row source-app label for stage-2 rows. Resolves {@link LookupResult.appId}\n * through the host resolver. '' when the row carries no `appId`, the resolver\n * is absent / doesn't know it, or it duplicates {@link activeAppLabel}. */\n rowAppLabel(row: LookupResult): string {\n this.i18n.version();\n if (!row.appId) return '';\n const resolved = this.appLookup?.getById(row.appId)?.name;\n if (!resolved) return '';\n if (resolved === this.activeAppLabel()) return '';\n return resolved;\n }\n}\n","<div class=\"fly-entity-lookup\" role=\"dialog\" [attr.aria-label]=\"'agent.lookup.dialog_aria' | translate\">\n @if (descriptors().length === 0) {\n <div class=\"fly-entity-lookup__empty\" role=\"status\">\n {{ 'agent.lookup.no_entities' | translate }}\n </div>\n } @else {\n <div class=\"fly-entity-lookup__search\" role=\"combobox\" aria-haspopup=\"listbox\" aria-expanded=\"true\"\n [attr.aria-controls]=\"listboxId()\">\n @if (stage() === 'search' && showBack()) {\n <!-- Breadcrumb back to the entity picker (also reachable via Backspace\n on an empty query). Shows the chosen entity so the user always\n knows what they're searching within. -->\n <button\n type=\"button\"\n class=\"fly-entity-lookup__crumb\"\n (click)=\"goBackToEntity()\"\n [attr.aria-label]=\"'agent.lookup.back_aria' | translate\">\n <i class=\"pi pi-angle-left fly-entity-lookup__crumb-back\" aria-hidden=\"true\"></i>\n @if (activeDescriptor()?.icon; as ic) {\n <i class=\"pi {{ ic }}\" aria-hidden=\"true\"></i>\n }\n <span>{{ activeEntityLabel() }}</span>\n </button>\n } @else {\n <i class=\"pi pi-search fly-entity-lookup__search-icon\" aria-hidden=\"true\"></i>\n }\n <input\n #searchRef\n type=\"text\"\n class=\"fly-entity-lookup__search-input\"\n [ngModel]=\"query()\"\n (ngModelChange)=\"onQueryInput($event)\"\n (keydown)=\"onKeydown($event)\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-controls]=\"listboxId()\"\n [placeholder]=\"searchPlaceholderKey() | translate\" />\n </div>\n\n <div [id]=\"listboxId()\" class=\"fly-entity-lookup__results\" role=\"listbox\"\n [attr.aria-label]=\"(stage() === 'entity' ? 'agent.lookup.entities_aria' : 'agent.lookup.results_aria') | translate\">\n @if (stage() === 'entity') {\n <!-- Stage 1: entity autocomplete. -->\n @if (filteredEntities().length === 0) {\n <div class=\"fly-entity-lookup__status\" role=\"status\">{{ 'agent.lookup.no_results' | translate }}</div>\n } @else {\n @for (desc of filteredEntities(); track desc.entity; let i = $index) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"fly-entity-lookup__opt fly-entity-lookup__opt--entity\"\n [id]=\"optionId(i)\"\n [attr.aria-selected]=\"i === activeIndex()\"\n [class.is-active]=\"i === activeIndex()\"\n (click)=\"onSelectEntity(desc.entity)\"\n (mouseenter)=\"onRowHover(i)\">\n <span class=\"fly-entity-lookup__opt-label\">\n @if (desc.icon) {\n <i class=\"pi {{ desc.icon }}\" aria-hidden=\"true\"></i>\n }\n {{ entityLabel(desc) }}\n </span>\n @if (appLabel(desc); as app) {\n <span class=\"fly-entity-lookup__opt-app-badge\" [title]=\"app\">{{ app }}</span>\n }\n <i class=\"pi pi-angle-right fly-entity-lookup__opt-chevron\" aria-hidden=\"true\"></i>\n </button>\n }\n }\n } @else {\n <!-- Stage 2: result typeahead within the chosen entity. -->\n @if (loading()) {\n <div class=\"fly-entity-lookup__status\" role=\"status\">{{ 'agent.lookup.searching' | translate }}</div>\n } @else if (errorKey(); as err) {\n <div class=\"fly-entity-lookup__status fly-entity-lookup__status--error\" role=\"alert\">{{ err | translate }}</div>\n } @else if (results().length === 0) {\n <div class=\"fly-entity-lookup__status\" role=\"status\">{{ 'agent.lookup.no_results' | translate }}</div>\n } @else {\n @for (row of results(); track row.id; let i = $index) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"fly-entity-lookup__opt\"\n [id]=\"optionId(i)\"\n [attr.aria-selected]=\"i === activeIndex()\"\n [class.is-active]=\"i === activeIndex()\"\n (click)=\"onRowClick(row)\"\n (mouseenter)=\"onRowHover(i)\">\n <span class=\"fly-entity-lookup__opt-label\" [title]=\"row.label\">{{ row.label }}</span>\n @if (row.secondary) {\n <span class=\"fly-entity-lookup__opt-secondary\">{{ row.secondary }}</span>\n }\n @if (rowAppLabel(row); as rowApp) {\n <!-- Source app of this individual row (e.g. \"Circles\" for a\n Help-Center article seeded by Circles). Rendered before the\n descriptor tag so the per-row signal sits closer to the\n title; suppressed when it would duplicate the descriptor\n label. -->\n <span class=\"fly-entity-lookup__opt-app-tag fly-entity-lookup__opt-app-tag--source\"\n [title]=\"rowApp\">{{ rowApp }}</span>\n }\n @if (activeAppLabel(); as app) {\n <span class=\"fly-entity-lookup__opt-app-tag\" [title]=\"app\">{{ app }}</span>\n }\n </button>\n }\n }\n }\n </div>\n }\n</div>\n","/**\n * Centralised registration + a non-resetting Link extension for the platform's\n * ``flyos:`` entity deep-link scheme.\n *\n * WHY THIS EXISTS — Tiptap's stock ``@tiptap/extension-link`` couples two\n * concerns onto its ``protocols`` option:\n * 1. ``isAllowedUri`` allow-listing — read directly from ``options.protocols``\n * so a ``flyos:`` href survives instead of being blanked to ``href=\"\"``.\n * 2. linkify autolink scheme registration — done by calling linkify's global\n * ``registerCustomProtocol`` inside the mark's ``onCreate``, and undone by\n * ``reset()`` inside ``onDestroy``.\n *\n * linkify is a process-wide singleton that only accepts scheme registration\n * *before* its first tokenisation. So with stock Link the SECOND editor to mount\n * after linkify has initialised re-calls ``registerCustomProtocol`` and linkify\n * logs:\n * ``linkifyjs: already initialized - will not register custom scheme \"flyos\" …``\n * and worse, every editor's ``onDestroy`` ``reset()`` wipes the scheme registry\n * for all other live editors.\n *\n * {@link FlyosLink} keeps concern (1) — ``protocols`` stays set, so hrefs and\n * ``getMarkdown()`` round-trips survive — but drops the per-editor register\n * /reset of (2). Registration is hoisted to a single {@link registerFlyosProtocol}\n * call made once, before any editor, so the scheme is registered exactly once\n * and never torn down.\n *\n * See ``skills/cross-app-deep-linking.md``.\n */\nimport { Link, type LinkOptions } from '@tiptap/extension-link';\nimport { registerCustomProtocol } from 'linkifyjs';\n\n/** The platform entity deep-link URI scheme (``flyos:<appId>.<entity>/<id>``). */\nexport const FLYOS_PROTOCOL = 'flyos';\n\nlet registered = false;\n\n/**\n * Register the ``flyos`` scheme with linkify exactly once. MUST run before any\n * Tiptap editor tokenises (i.e. at app bootstrap) because linkify rejects — and\n * warns about — scheme registration after its singleton initialises.\n *\n * Idempotent: repeat calls are no-ops, so it is safe to also call defensively\n * from an editor's constructor for consumers that don't own a shared bootstrap\n * (e.g. a federated remote that mounts {@link FlyMarkdownEditorComponent}\n * standalone).\n */\nexport function registerFlyosProtocol(): void {\n if (registered) return;\n registered = true;\n registerCustomProtocol(FLYOS_PROTOCOL);\n}\n\n/**\n * Drop-in replacement for ``@tiptap/extension-link``'s ``Link`` that keeps the\n * ``flyos`` href allow-list but does NOT register the scheme per-editor or\n * ``reset()`` linkify on teardown — see the module header for the full\n * rationale. Defaults ``openOnClick`` off because ``flyos:`` is non-routable in\n * a browser; surfaces that can launch in-shell wire their own\n * ``editorProps.handleClick`` (see ``flyosEditorHandleClick``).\n *\n * Keeps the mark name ``link`` so StarterKit's link commands (``setLink`` /\n * ``toggleLink`` / ``isActive('link')``) and markdown serialisation keep\n * working — pair it with ``StarterKit.configure({ link: false })``.\n */\nexport const FlyosLink = Link.extend({\n addOptions() {\n // `parent` (the base Link's addOptions) is always defined for Link.extend;\n // the cast restores the required LinkOptions fields the optional `?.` drops.\n return {\n ...(this.parent?.() as LinkOptions),\n openOnClick: false,\n protocols: [FLYOS_PROTOCOL],\n };\n },\n // Scheme registration is centralised in registerFlyosProtocol(); skipping the\n // stock per-editor registerCustomProtocol() is what silences linkify's\n // \"already initialized\" warning on the 2nd+ concurrent editor.\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- intentional no-op override\n onCreate() {},\n // Stock Link calls linkify reset() here, which would un-register `flyos`\n // (and every other custom scheme) for every other live editor. Registration\n // is process-wide and owned by registerFlyosProtocol() — never torn down.\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- intentional no-op override\n onDestroy() {},\n});\n","import { InjectionToken } from '@angular/core';\n\n/**\n * Host-provided handler that navigates to a resolved in-app entity deep link\n * when the user clicks a `flyos:` anchor inside a {@link FlyMarkdownEditorComponent}.\n *\n * The design-system can RESOLVE a `flyos:<appId>.<entity>/<id>` href to a\n * `{ appId, route }` (via `AgentLookupRegistry`), but it cannot LAUNCH it — the\n * launcher lives in the host (the desktop shell's `ShellLauncherService`, or a\n * remote's own router). The host provides this token; when absent, a `flyos:`\n * click is a no-op (the link is non-routable in a bare browser anyway).\n */\nexport type EntityLinkLauncher = (target: {\n readonly appId: string;\n readonly route: string;\n readonly kind: string;\n readonly id: string;\n}) => void;\n\nexport const ENTITY_LINK_LAUNCHER = new InjectionToken<EntityLinkLauncher>(\n 'ENTITY_LINK_LAUNCHER',\n);\n\n/**\n * A toolbar control id, or `'|'` for a visual divider. `toolbar` accepts a\n * preset name or an explicit ordered list of these.\n */\nexport type MarkdownToolbarItem =\n | 'undo' | 'redo'\n | 'h1' | 'h2' | 'h3'\n | 'bold' | 'italic' | 'underline' | 'strike' | 'code'\n | 'bulletList' | 'orderedList' | 'taskList'\n | 'blockquote' | 'codeBlock' | 'horizontalRule'\n | 'link' | 'entityLink'\n | '|';\n\n/** Named toolbar presets. `full` ≈ the notes editor; `compact` ≈ task comments. */\nexport type MarkdownToolbarPreset = 'full' | 'compact';\n\nexport const MARKDOWN_TOOLBAR_PRESETS: Record<MarkdownToolbarPreset, readonly MarkdownToolbarItem[]> = {\n full: [\n 'undo', 'redo', '|',\n 'h1', 'h2', 'h3', '|',\n 'bold', 'italic', 'underline', 'strike', 'code', '|',\n 'bulletList', 'orderedList', 'taskList', '|',\n 'blockquote', 'codeBlock', 'horizontalRule', '|',\n 'link', 'entityLink',\n ],\n compact: [\n 'bold', 'italic', 'code', '|',\n 'bulletList', 'orderedList', '|',\n 'link', 'entityLink',\n ],\n};\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n inject,\n input,\n output,\n signal,\n computed,\n type OnDestroy,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule, NG_VALUE_ACCESSOR, type ControlValueAccessor } from '@angular/forms';\nimport { Editor } from '@tiptap/core';\nimport StarterKit from '@tiptap/starter-kit';\nimport { Markdown } from '@tiptap/markdown';\nimport TaskList from '@tiptap/extension-task-list';\nimport TaskItem from '@tiptap/extension-task-item';\nimport { TiptapEditorDirective } from 'ngx-tiptap';\nimport { FlyosLink, registerFlyosProtocol } from '../../tiptap/flyos-link';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\nimport { AgentLookupRegistry } from '../../services/agent-input/agent-lookup-registry.service';\nimport { EntityLookupComponent } from '../entity-lookup/entity-lookup.component';\nimport type { EntityLinkSelection } from '../entity-lookup/entity-lookup.types';\nimport type { LookupDescriptor } from '../../models/agent-input.model';\nimport {\n ENTITY_LINK_LAUNCHER,\n MARKDOWN_TOOLBAR_PRESETS,\n type MarkdownToolbarItem,\n type MarkdownToolbarPreset,\n} from './markdown-editor.types';\n\n/** Parses a live `flyos:<appId>.<entity>/<id>` href into `{kind, id}`. */\nconst FLYOS_HREF_RE = /^flyos:([^/]+)\\/(.+)$/;\n\n/** Simple command buttons (everything except link / entityLink / divider).\n * `cmd` runs on the focused chain; `active` is the `isActive` probe. */\nconst TOOLBAR_BUTTONS: Record<string, { icon: string; labelKey: string; cmd: (e: Editor) => void; active?: { name: string; attrs?: Record<string, unknown> } }> = {\n undo: { icon: 'pi-undo', labelKey: 'common.label.undo', cmd: (e) => e.commands.undo() },\n redo: { icon: 'pi-refresh', labelKey: 'common.label.redo', cmd: (e) => e.commands.redo() },\n bold: { icon: '', labelKey: 'common.label.bold', cmd: (e) => e.chain().focus().toggleBold().run(), active: { name: 'bold' } },\n italic: { icon: '', labelKey: 'common.label.italic', cmd: (e) => e.chain().focus().toggleItalic().run(), active: { name: 'italic' } },\n underline: { icon: '', labelKey: 'common.label.underline', cmd: (e) => e.chain().focus().toggleUnderline().run(), active: { name: 'underline' } },\n strike: { icon: '', labelKey: 'common.label.strikethrough', cmd: (e) => e.chain().focus().toggleStrike().run(), active: { name: 'strike' } },\n code: { icon: 'pi-code', labelKey: 'common.label.inline_code', cmd: (e) => e.chain().focus().toggleCode().run(), active: { name: 'code' } },\n codeBlock: { icon: 'pi-file-edit', labelKey: 'common.label.code_block', cmd: (e) => e.chain().focus().toggleCodeBlock().run(), active: { name: 'codeBlock' } },\n blockquote: { icon: 'pi-comment', labelKey: 'common.label.blockquote', cmd: (e) => e.chain().focus().toggleBlockquote().run(), active: { name: 'blockquote' } },\n bulletList: { icon: 'pi-list', labelKey: 'common.label.bullet_list', cmd: (e) => e.chain().focus().toggleBulletList().run(), active: { name: 'bulletList' } },\n orderedList: { icon: 'pi-sort-numeric-down', labelKey: 'common.label.numbered_list', cmd: (e) => e.chain().focus().toggleOrderedList().run(), active: { name: 'orderedList' } },\n taskList: { icon: 'pi-check-square', labelKey: 'common.label.task_list', cmd: (e) => e.chain().focus().toggleTaskList().run(), active: { name: 'taskList' } },\n horizontalRule: { icon: 'pi-minus', labelKey: 'common.label.horizontal_rule', cmd: (e) => e.chain().focus().setHorizontalRule().run() },\n h1: { icon: '', labelKey: 'common.label.heading1', cmd: (e) => e.chain().focus().toggleHeading({ level: 1 }).run(), active: { name: 'heading', attrs: { level: 1 } } },\n h2: { icon: '', labelKey: 'common.label.heading2', cmd: (e) => e.chain().focus().toggleHeading({ level: 2 }).run(), active: { name: 'heading', attrs: { level: 2 } } },\n h3: { icon: '', labelKey: 'common.label.heading3', cmd: (e) => e.chain().focus().toggleHeading({ level: 3 }).run(), active: { name: 'heading', attrs: { level: 3 } } },\n};\n\n/**\n * Shared rich-text/markdown editor — the single Tiptap-backed editor for FlyOS\n * apps (notes, task comments, admin) and Business Apps (Circles). Emits a\n * Markdown string via `ControlValueAccessor`, so it slots into reactive forms\n * or `[(ngModel)]` with no orchestration.\n *\n * Bakes in the platform's `flyos:` entity-deep-link contract: the Link mark\n * whitelists the `flyos` scheme (so authored/pasted deep links aren't blanked),\n * clicks on a resolvable `flyos:` anchor launch the owning app via the\n * host-provided {@link ENTITY_LINK_LAUNCHER}, and the optional \"entity link\"\n * toolbar button opens the shared {@link EntityLookupComponent} to insert one.\n */\n@Component({\n selector: 'fly-markdown-editor',\n standalone: true,\n imports: [CommonModule, FormsModule, TiptapEditorDirective, TranslatePipe, EntityLookupComponent],\n templateUrl: './markdown-editor.component.html',\n styleUrls: ['./markdown-editor.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => FlyMarkdownEditorComponent), multi: true },\n ],\n})\nexport class FlyMarkdownEditorComponent implements ControlValueAccessor, OnDestroy {\n private readonly cdr = inject(ChangeDetectorRef);\n private readonly lookupRegistry = inject(AgentLookupRegistry);\n private readonly launcher = inject(ENTITY_LINK_LAUNCHER, { optional: true });\n\n /** Toolbar preset name or an explicit ordered item list. */\n readonly toolbar = input<MarkdownToolbarPreset | readonly MarkdownToolbarItem[]>('full');\n /** Show the \"insert in-app link\" (entity-lookup) toolbar button. */\n readonly enableEntityLink = input(true);\n /** Direction the entity-lookup dropdown opens. `down` (default) suits a\n * top toolbar (notes); `above` suits a bottom-anchored composer (task\n * comments) so the panel doesn't run off the viewport. */\n readonly entityLinkPlacement = input<'down' | 'above'>('down');\n readonly placeholder = input('');\n readonly readonly = input(false);\n readonly ariaLabel = input('');\n\n /** Fired on Ctrl/Cmd+Enter (host can submit a comment, etc.). */\n readonly submitShortcut = output<void>();\n\n // CVA plumbing.\n private onChange: (v: string) => void = () => undefined;\n private onTouched: () => void = () => undefined;\n private currentValue = '';\n\n // Toolbar reactive state.\n readonly activeStates = signal<Record<string, boolean>>({});\n readonly canUndo = signal(false);\n readonly canRedo = signal(false);\n\n // Link (URL) popover.\n readonly showLinkPopover = signal(false);\n readonly linkInputValue = signal('');\n\n // Entity-link picker.\n readonly showEntityLookup = signal(false);\n readonly entityLookupDescriptors = computed<readonly LookupDescriptor[]>(() =>\n this.lookupRegistry.all().filter((d) => !!d.deepLinkRoute),\n );\n\n /** Resolved toolbar items (preset → array), entityLink stripped when disabled. */\n readonly toolbarItems = computed<readonly MarkdownToolbarItem[]>(() => {\n const t = this.toolbar();\n const items = typeof t === 'string' ? MARKDOWN_TOOLBAR_PRESETS[t] : t;\n return this.enableEntityLink() ? items : items.filter((i) => i !== 'entityLink');\n });\n\n readonly editor: Editor;\n\n constructor() {\n // Register the `flyos` scheme once, before this editor tokenises. Idempotent\n // — covered by the shell bootstrap in the desktop host, but called here too\n // so a standalone consumer (e.g. a federated remote) is self-sufficient.\n registerFlyosProtocol();\n this.editor = new Editor({\n extensions: [\n // FlyosLink replaces StarterKit's bundled link: it keeps the `flyos:`\n // href whitelist (so the href isn't blanked) but skips the per-editor\n // linkify register/reset that triggers the \"already initialized\" warning\n // across concurrent editors. openOnClick false because flyos: is\n // non-routable — handleClick launches in-shell below.\n StarterKit.configure({ link: false }),\n FlyosLink,\n Markdown,\n TaskList,\n TaskItem.configure({ nested: true }),\n ],\n editorProps: {\n attributes: { class: 'fly-md-editor__prosemirror', spellcheck: 'true' },\n handleClick: (_view, _pos, event) => this.handleFlyosClick(event),\n handleKeyDown: (_view, event) => {\n if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {\n event.preventDefault();\n this.submitShortcut.emit();\n return true;\n }\n return false;\n },\n },\n onUpdate: () => {\n this.currentValue = this.editor.getMarkdown();\n this.onChange(this.currentValue);\n this.refreshState();\n this.cdr.markForCheck();\n },\n onSelectionUpdate: () => {\n this.refreshState();\n this.cdr.markForCheck();\n },\n onBlur: () => this.onTouched(),\n });\n }\n\n ngOnDestroy(): void {\n this.editor.destroy();\n }\n\n // ── ControlValueAccessor ────────────────────────────────────────────────\n\n writeValue(value: string | null): void {\n this.currentValue = value ?? '';\n // contentType:'markdown' parses the string as Markdown; emitUpdate:false so\n // hydrating the model doesn't echo back through onChange.\n this.editor.commands.setContent(this.currentValue, { emitUpdate: false, contentType: 'markdown' });\n this.refreshState();\n this.cdr.markForCheck();\n }\n\n registerOnChange(fn: (v: string) => void): void { this.onChange = fn; }\n registerOnTouched(fn: () => void): void { this.onTouched = fn; }\n setDisabledState(isDisabled: boolean): void { this.editor.setEditable(!isDisabled); }\n\n // ── Imperative reads (for hosts that persist a rendered HTML snapshot\n // alongside the markdown CVA value, e.g. notes' contentHtml) ───────────\n /** Current markdown (same as the CVA value). */\n getMarkdown(): string { return this.editor.getMarkdown(); }\n /** Current rendered HTML snapshot. */\n getHtml(): string { return this.editor.getHTML(); }\n /** Focus the editor surface. */\n focus(): void { this.editor.commands.focus(); }\n\n // ── Toolbar ──────────────────────────────────────────────────────────────\n\n button(id: MarkdownToolbarItem): { icon: string; labelKey: string } | null {\n const b = TOOLBAR_BUTTONS[id];\n return b ? { icon: b.icon, labelKey: b.labelKey } : null;\n }\n\n /** Short visual label for buttons rendered as text (B / I / U / S / H1…). */\n textLabel(id: MarkdownToolbarItem): string | null {\n switch (id) {\n case 'bold': return 'B';\n case 'italic': return 'I';\n case 'underline': return 'U';\n case 'strike': return 'S';\n case 'h1': return 'H1';\n case 'h2': return 'H2';\n case 'h3': return 'H3';\n default: return null;\n }\n }\n\n run(id: MarkdownToolbarItem): void {\n const b = TOOLBAR_BUTTONS[id];\n if (!b) return;\n b.cmd(this.editor);\n this.refreshState();\n this.cdr.markForCheck();\n }\n\n isActive(id: MarkdownToolbarItem): boolean {\n return this.activeStates()[id] ?? false;\n }\n\n disabled(id: MarkdownToolbarItem): boolean {\n if (id === 'undo') return !this.canUndo();\n if (id === 'redo') return !this.canRedo();\n return false;\n }\n\n private refreshState(): void {\n this.canUndo.set(this.editor.can().undo());\n this.canRedo.set(this.editor.can().redo());\n const states: Record<string, boolean> = {};\n for (const [id, b] of Object.entries(TOOLBAR_BUTTONS)) {\n if (b.active) states[id] = this.editor.isActive(b.active.name, b.active.attrs ?? {});\n }\n states['link'] = this.editor.isActive('link');\n this.activeStates.set(states);\n }\n\n // ── Link (URL) popover ─────────────────────────────────────────────────\n\n openLinkPopover(): void {\n this.showEntityLookup.set(false);\n this.linkInputValue.set((this.editor.getAttributes('link')['href'] as string | undefined) ?? '');\n this.showLinkPopover.set(true);\n }\n onLinkInput(value: string): void { this.linkInputValue.set(value); }\n commitLink(): void {\n const url = this.linkInputValue().trim();\n const chain = this.editor.chain().focus().extendMarkRange('link');\n if (url === '') chain.unsetLink().run();\n else chain.setLink({ href: url }).run();\n this.showLinkPopover.set(false);\n this.refreshState();\n this.cdr.markForCheck();\n }\n cancelLink(): void { this.showLinkPopover.set(false); }\n onLinkKeydown(event: KeyboardEvent): void {\n if (event.key === 'Enter') { event.preventDefault(); this.commitLink(); }\n if (event.key === 'Escape') { this.cancelLink(); }\n }\n\n // ── Entity-link picker ─────────────────────────────────────────────────\n\n toggleEntityLookup(): void {\n this.showLinkPopover.set(false);\n this.showEntityLookup.update((open) => !open);\n }\n closeEntityLookup(): void { this.showEntityLookup.set(false); }\n\n onEntityLinkSelected(sel: EntityLinkSelection): void {\n this.editor\n .chain()\n .focus()\n .insertContent({ type: 'text', text: sel.label, marks: [{ type: 'link', attrs: { href: sel.href } }] })\n .insertContent(' ')\n .run();\n this.showEntityLookup.set(false);\n this.refreshState();\n this.cdr.markForCheck();\n }\n\n // ── flyos: click → launch ──────────────────────────────────────────────\n\n /** True (click handled) when a resolvable `flyos:` anchor was launched. */\n private handleFlyosClick(event: MouseEvent): boolean {\n const anchor = (event.target as HTMLElement | null)?.closest('a');\n const href = anchor?.getAttribute('href');\n if (!href) return false;\n const m = FLYOS_HREF_RE.exec(href);\n if (!m) return false;\n event.preventDefault();\n const [, kind, id] = m;\n const target = this.lookupRegistry.resolveDeepLink(kind, id);\n if (!target || !this.launcher) return false;\n this.launcher({ appId: target.appId, route: target.route, kind, id });\n return true;\n }\n}\n","<div class=\"fly-md-editor\" [class.fly-md-editor--entity-above]=\"entityLinkPlacement() === 'above'\">\n <div class=\"fly-md-editor__toolbar\" role=\"toolbar\" [attr.aria-label]=\"('common.label.formatting_toolbar' | translate)\">\n @for (item of toolbarItems(); track $index) {\n @switch (item) {\n @case ('|') {\n <span class=\"fly-md-editor__divider\" aria-hidden=\"true\"></span>\n }\n @case ('link') {\n <div class=\"fly-md-editor__link-wrap\">\n <button type=\"button\" class=\"fly-md-editor__btn\" [class.is-active]=\"isActive('link')\"\n (click)=\"openLinkPopover()\"\n [title]=\"'common.label.link' | translate\" [attr.aria-label]=\"'common.label.link' | translate\">\n <i class=\"pi pi-link\" aria-hidden=\"true\"></i>\n </button>\n @if (showLinkPopover()) {\n <div class=\"fly-md-editor__link-popover\" role=\"dialog\" [attr.aria-label]=\"'common.label.link' | translate\">\n <input class=\"fly-md-editor__link-input\" type=\"url\"\n [value]=\"linkInputValue()\" (input)=\"onLinkInput($any($event.target).value)\"\n (keydown)=\"onLinkKeydown($event)\"\n [placeholder]=\"'common.label.https' | translate\"\n [attr.aria-label]=\"'common.label.link' | translate\" />\n <button type=\"button\" class=\"fly-md-editor__link-ok\" (click)=\"commitLink()\"\n [title]=\"'common.label.apply' | translate\"><i class=\"pi pi-check\" aria-hidden=\"true\"></i></button>\n <button type=\"button\" class=\"fly-md-editor__link-cancel\" (click)=\"cancelLink()\"\n [title]=\"'common.action.cancel' | translate\"><i class=\"pi pi-times\" aria-hidden=\"true\"></i></button>\n </div>\n }\n </div>\n }\n @case ('entityLink') {\n <div class=\"fly-md-editor__entity-wrap\">\n <button type=\"button\" class=\"fly-md-editor__btn\" [class.is-active]=\"showEntityLookup()\"\n (click)=\"toggleEntityLookup()\" [attr.aria-expanded]=\"showEntityLookup()\"\n [title]=\"'common.label.insert_entity_link' | translate\" [attr.aria-label]=\"'common.label.insert_entity_link' | translate\">\n <i class=\"pi pi-bookmark\" aria-hidden=\"true\"></i>\n </button>\n @if (showEntityLookup()) {\n <fly-entity-lookup\n [placement]=\"entityLinkPlacement()\"\n [descriptors]=\"entityLookupDescriptors()\"\n (entityLinkSelected)=\"onEntityLinkSelected($event)\"\n (dismiss)=\"closeEntityLookup()\" />\n }\n </div>\n }\n @default {\n <button type=\"button\" class=\"fly-md-editor__btn\"\n [class.is-active]=\"isActive(item)\" [disabled]=\"disabled(item)\"\n (click)=\"run(item)\"\n [title]=\"(button(item)?.labelKey ?? '') | translate\"\n [attr.aria-label]=\"(button(item)?.labelKey ?? '') | translate\">\n @if (textLabel(item); as txt) {\n <span class=\"fly-md-editor__btn-text\">{{ txt }}</span>\n } @else {\n <i class=\"pi {{ button(item)?.icon }}\" aria-hidden=\"true\"></i>\n }\n </button>\n }\n }\n }\n </div>\n\n <div class=\"fly-md-editor__body\" tiptap [editor]=\"editor\"\n [attr.aria-label]=\"ariaLabel()\" [attr.data-placeholder]=\"placeholder()\"></div>\n</div>\n","import {\n Component, input, output, HostListener, ViewChild, ElementRef,\n computed, signal, AfterViewInit, OnDestroy, ChangeDetectionStrategy, inject, DOCUMENT,\n} from '@angular/core';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\n\nexport interface ContextMenuItem {\n id: string;\n label: string;\n icon: string;\n}\n\nexport interface ContextMenuSection {\n label?: string;\n items: ContextMenuItem[];\n}\n\n@Component({\n selector: 'fly-context-menu',\n standalone: true,\n imports: [TranslatePipe],\n templateUrl: './context-menu.component.html',\n styleUrl: './context-menu.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ContextMenuComponent implements AfterViewInit, OnDestroy {\n @ViewChild('contextMenu') private menuEl?: ElementRef<HTMLElement>;\n\n private readonly doc = inject(DOCUMENT);\n private readonly hostEl = inject(ElementRef<HTMLElement>);\n\n x = input.required<number>();\n y = input.required<number>();\n sections = input.required<ContextMenuSection[]>();\n action = output<string>();\n closed = output<void>();\n\n private menuWidth = signal(0);\n private menuHeight = signal(0);\n\n private previouslyFocused: Element | null = null;\n\n // Resolved position: clamp to viewport so the menu never overflows an edge.\n // menuWidth/Height start at 0 so the first render places the menu at (x,y)\n // with no clamping; ngAfterViewInit measures the real size and updates the\n // signals, which re-evaluates this computed and repositions correctly.\n clampedPos = computed(() => {\n const vw = this.doc.defaultView?.innerWidth ?? 0;\n const vh = this.doc.defaultView?.innerHeight ?? 0;\n const w = this.menuWidth();\n const h = this.menuHeight();\n const x = this.x();\n const y = this.y();\n return {\n left: w > 0 ? Math.min(x, vw - w - 8) : x,\n top: h > 0 ? Math.min(y, vh - h - 8) : y,\n };\n });\n\n ngAfterViewInit(): void {\n // Portal: move host to <body> so position:fixed resolves against the true\n // viewport, not against any transformed/backdrop-filtered ancestor window.\n this.doc.body.appendChild(this.hostEl.nativeElement);\n\n // Measure after portal move so offsetWidth/Height are accurate.\n const el = this.menuEl?.nativeElement;\n if (el) {\n this.menuWidth.set(el.offsetWidth);\n this.menuHeight.set(el.offsetHeight);\n }\n\n this.previouslyFocused = document.activeElement;\n this.focusItem(0);\n }\n\n ngOnDestroy(): void {\n const el = this.hostEl.nativeElement;\n if (el.parentNode === this.doc.body) {\n this.doc.body.removeChild(el);\n }\n }\n\n onAction(id: string): void {\n this.action.emit(id);\n this.close();\n }\n\n @HostListener('document:mousedown', ['$event'])\n onClickOutside(event: MouseEvent): void {\n if (!this.menuEl?.nativeElement.contains(event.target as Node)) {\n this.close();\n }\n }\n\n @HostListener('document:keydown.escape')\n onEscape(): void {\n this.close();\n }\n\n @HostListener('document:contextmenu', ['$event'])\n onContextMenu(event: MouseEvent): void {\n if (!this.menuEl?.nativeElement.contains(event.target as Node)) {\n this.close();\n }\n }\n\n @HostListener('keydown', ['$event'])\n onKeydown(event: KeyboardEvent): void {\n const items = this.getMenuItems();\n if (!items.length) return;\n const focused = document.activeElement as HTMLElement;\n const idx = items.indexOf(focused);\n\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n this.focusItem(idx < items.length - 1 ? idx + 1 : 0);\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n this.focusItem(idx > 0 ? idx - 1 : items.length - 1);\n } else if (event.key === 'Home') {\n event.preventDefault();\n this.focusItem(0);\n } else if (event.key === 'End') {\n event.preventDefault();\n this.focusItem(items.length - 1);\n }\n }\n\n private close(): void {\n this.restoreFocus();\n this.closed.emit();\n }\n\n private getMenuItems(): HTMLElement[] {\n return Array.from(\n this.menuEl?.nativeElement.querySelectorAll<HTMLElement>('[role=\"menuitem\"]') ?? [],\n );\n }\n\n private focusItem(index: number): void {\n const items = this.getMenuItems();\n items[index]?.focus();\n }\n\n private restoreFocus(): void {\n if (this.previouslyFocused instanceof HTMLElement) {\n this.previouslyFocused.focus();\n }\n this.previouslyFocused = null;\n }\n}\n","<div\n #contextMenu\n class=\"context-menu\"\n [style.left.px]=\"clampedPos().left\"\n [style.top.px]=\"clampedPos().top\"\n role=\"menu\"\n [attr.aria-label]=\"'shell.context_menu' | translate\">\n\n @for (section of sections(); track $index) {\n @if ($index > 0) {\n <div class=\"menu-divider\"></div>\n }\n @if (section.label) {\n <div class=\"menu-section-label\">{{ section.label }}</div>\n }\n @for (item of section.items; track item.id) {\n <button\n type=\"button\"\n class=\"vos-btn sm rect menu-item\"\n role=\"menuitem\"\n (click)=\"onAction(item.id)\">\n <i [class]=\"'pi ' + item.icon\" aria-hidden=\"true\"></i>\n <span>{{ item.label }}</span>\n </button>\n }\n }\n</div>\n","import { Injectable, inject, signal } from '@angular/core';\nimport { I18nService } from '../../services/i18n.service';\n\nexport enum MessageBoxButtons {\n OK,\n OKCancel,\n YesNo,\n YesNoCancel,\n RetryCancel,\n AbortRetryIgnore,\n}\n\nexport enum MessageBoxIcon {\n None,\n Information,\n Warning,\n Error,\n Question,\n}\n\nexport enum DialogResult {\n None,\n OK,\n Cancel,\n Yes,\n No,\n Retry,\n Abort,\n Ignore,\n}\n\nexport interface MessageBoxOptions {\n title: string;\n message: string;\n buttons?: MessageBoxButtons;\n icon?: MessageBoxIcon;\n}\n\n/**\n * Configuration for the \"Don't ask again\" checkbox rendered by\n * `showAcknowledged()`. The field is intentionally NOT part of the base\n * `MessageBoxOptions` so the type system enforces the rule\n * \"checkbox ⇒ caller MUST use `showAcknowledged()`\": the classic `show()`\n * entry point cannot accept this shape, eliminating the silent-discard\n * dark-pattern path where the user's choice was thrown away.\n */\nexport interface MessageBoxDontAskAgainConfig {\n /** i18n key for the checkbox label, e.g. 'agent.command.builtin.clear.dont_ask_again'. */\n labelKey: string;\n /** Initial checked state. Default false. */\n defaultChecked?: boolean;\n}\n\n/**\n * Options narrowed to those carrying a `dontAskAgain` config — the only shape\n * accepted by `showAcknowledged()`.\n */\nexport interface MessageBoxOptionsWithAcknowledgement extends MessageBoxOptions {\n dontAskAgain: MessageBoxDontAskAgainConfig;\n}\n\nexport interface MessageBoxButton {\n label: string;\n result: DialogResult;\n variant?: 'primary' | 'danger' | 'default';\n}\n\n/** Shape returned by `showAcknowledged()` — pairs the dialog result with the checkbox state. */\nexport interface DialogResultWithAcknowledgement {\n readonly result: DialogResult;\n readonly dontAskAgain: boolean;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class MessageBoxService {\n private readonly i18n = inject(I18nService);\n\n readonly visible = signal(false);\n readonly title = signal('');\n readonly message = signal('');\n readonly icon = signal<MessageBoxIcon>(MessageBoxIcon.None);\n readonly buttons = signal<MessageBoxButton[]>([]);\n /**\n * Active \"Don't ask again\" config — populated only by `showAcknowledged()`.\n * `show()` callers cannot reach this signal because the type system rejects\n * `dontAskAgain` on the base `MessageBoxOptions`.\n */\n readonly dontAskAgain = signal<MessageBoxDontAskAgainConfig | undefined>(undefined);\n\n /**\n * Component-side checkbox state. The component (`MessageBoxComponent`) wires\n * its own signal to this one; the service explicitly re-seeds it on every\n * `_open()` so reusing a constant `options` literal across two opens does\n * NOT leak the previous user's checkbox state through signal `===` dedupe.\n * Exposed for the component to read/write; not for general callers.\n */\n readonly dontAskAgainChecked = signal(false);\n\n private resolver: ((value: DialogResultWithAcknowledgement) => void) | null = null;\n\n show(options: MessageBoxOptions): Promise<DialogResult> {\n return this._open(options).then((r) => r.result);\n }\n\n /**\n * Opens a message box with a \"Don't ask again\" checkbox and resolves to both\n * the dialog result and the checkbox state. Throws when `options.dontAskAgain`\n * is missing — the checkbox config is mandatory for this entry point. The\n * compile-time signature already guarantees presence; the runtime check is\n * defense-in-depth for callers that bypass the type system via `as never`.\n */\n showAcknowledged(\n options: MessageBoxOptionsWithAcknowledgement,\n ): Promise<DialogResultWithAcknowledgement> {\n if (!options.dontAskAgain) {\n throw new Error(\n 'MessageBoxService.showAcknowledged() requires options.dontAskAgain — use show() for plain dialogs.',\n );\n }\n return this._open(options);\n }\n\n resolve(result: DialogResult, dontAskAgain = false): void {\n this.visible.set(false);\n if (this.resolver) {\n this.resolver({ result, dontAskAgain });\n this.resolver = null;\n }\n }\n\n private _open(\n options: MessageBoxOptions | MessageBoxOptionsWithAcknowledgement,\n ): Promise<DialogResultWithAcknowledgement> {\n // Dismiss any pending dialog so its Promise resolves rather than leaking.\n if (this.resolver) {\n this.resolver({ result: DialogResult.None, dontAskAgain: false });\n this.resolver = null;\n }\n\n const daa =\n 'dontAskAgain' in options ? options.dontAskAgain : undefined;\n\n this.title.set(options.title);\n this.message.set(options.message);\n this.icon.set(options.icon ?? MessageBoxIcon.None);\n this.buttons.set(this.resolveButtons(options.buttons ?? MessageBoxButtons.OK));\n this.dontAskAgain.set(daa);\n // Explicit re-seed: signal `set` dedupes by `===`, so an `effect()` on\n // `dontAskAgain` would not re-fire when a caller passes the SAME options\n // literal twice. Set the checkbox state directly each open.\n this.dontAskAgainChecked.set(daa?.defaultChecked ?? false);\n this.visible.set(true);\n\n return new Promise<DialogResultWithAcknowledgement>((resolve) => {\n this.resolver = resolve;\n });\n }\n\n private resolveButtons(buttons: MessageBoxButtons): MessageBoxButton[] {\n const t = (key: string) => this.i18n.t(key);\n switch (buttons) {\n case MessageBoxButtons.OK:\n return [{ label: t('common.ok'), result: DialogResult.OK, variant: 'primary' }];\n\n case MessageBoxButtons.OKCancel:\n return [\n { label: t('common.cancel'), result: DialogResult.Cancel, variant: 'default' },\n { label: t('common.ok'), result: DialogResult.OK, variant: 'primary' },\n ];\n\n case MessageBoxButtons.YesNo:\n return [\n { label: t('common.no'), result: DialogResult.No, variant: 'default' },\n { label: t('common.yes'), result: DialogResult.Yes, variant: 'primary' },\n ];\n\n case MessageBoxButtons.YesNoCancel:\n return [\n { label: t('common.cancel'), result: DialogResult.Cancel, variant: 'default' },\n { label: t('common.no'), result: DialogResult.No, variant: 'default' },\n { label: t('common.yes'), result: DialogResult.Yes, variant: 'primary' },\n ];\n\n case MessageBoxButtons.RetryCancel:\n return [\n { label: t('common.cancel'), result: DialogResult.Cancel, variant: 'default' },\n { label: t('common.retry'), result: DialogResult.Retry, variant: 'primary' },\n ];\n\n case MessageBoxButtons.AbortRetryIgnore:\n return [\n { label: t('common.abort'), result: DialogResult.Abort, variant: 'danger' },\n { label: t('common.retry'), result: DialogResult.Retry, variant: 'default' },\n { label: t('common.ignore'), result: DialogResult.Ignore, variant: 'default' },\n ];\n }\n }\n}\n","import {\n Component, inject, ChangeDetectionStrategy,\n HostListener, ElementRef, AfterViewInit, computed,\n} from '@angular/core';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\nimport { MessageBoxService, MessageBoxIcon, DialogResult } from './message-box.service';\n\n@Component({\n selector: 'fly-message-box',\n standalone: true,\n imports: [TranslatePipe],\n templateUrl: './message-box.component.html',\n styleUrl: './message-box.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MessageBoxComponent implements AfterViewInit {\n service = inject(MessageBoxService);\n private elRef = inject(ElementRef);\n\n readonly MessageBoxIcon = MessageBoxIcon;\n readonly DialogResult = DialogResult;\n\n /** Mirror of the service's `dontAskAgain` config so the template can read it directly. */\n readonly dontAskAgainConfig = computed(() => this.service.dontAskAgain());\n /**\n * User-driven checkbox state, owned by the service and re-seeded on every\n * `_open()` so reusing a constant options literal cannot leak prior state.\n */\n readonly dontAskAgainChecked = this.service.dontAskAgainChecked;\n /**\n * Concatenated id list for the dialog's `aria-describedby`. Always includes\n * the message; appends the checkbox label id when the checkbox is rendered\n * so screen readers announce the checkbox as part of the description.\n */\n readonly ariaDescribedBy = computed(() =>\n this.dontAskAgainConfig() ? 'mb-message mb-dont-ask' : 'mb-message',\n );\n\n private previouslyFocused: Element | null = null;\n\n ngAfterViewInit(): void {\n // Store focus origin so we can restore it on close\n this.previouslyFocused = document.activeElement;\n this.focusPrimaryButton();\n }\n\n @HostListener('document:keydown.escape')\n onEscape(): void {\n if (this.service.visible()) {\n this.service.resolve(DialogResult.Cancel, this.dontAskAgainChecked());\n this.restoreFocus();\n }\n }\n\n onBackdropClick(): void {\n this.service.resolve(DialogResult.Cancel, this.dontAskAgainChecked());\n this.restoreFocus();\n }\n\n onButtonClick(result: DialogResult): void {\n this.service.resolve(result, this.dontAskAgainChecked());\n this.restoreFocus();\n }\n\n onDontAskAgainToggle(ev: Event): void {\n const target = ev.target as HTMLInputElement | null;\n this.dontAskAgainChecked.set(!!target?.checked);\n }\n\n iconClass(): string {\n switch (this.service.icon()) {\n case MessageBoxIcon.Information: return 'pi pi-info-circle';\n case MessageBoxIcon.Warning: return 'pi pi-exclamation-triangle';\n case MessageBoxIcon.Error: return 'pi pi-times-circle';\n case MessageBoxIcon.Question: return 'pi pi-question-circle';\n default: return '';\n }\n }\n\n private focusPrimaryButton(): void {\n // Focus the primary (last) button, which is the default action\n const buttons = this.elRef.nativeElement.querySelectorAll('.mb-btn') as NodeListOf<HTMLButtonElement>;\n const last = buttons[buttons.length - 1];\n last?.focus();\n }\n\n private restoreFocus(): void {\n if (this.previouslyFocused instanceof HTMLElement) {\n this.previouslyFocused.focus();\n }\n this.previouslyFocused = null;\n }\n}\n","@if (service.visible()) {\n <div\n class=\"mb-backdrop\"\n (click)=\"onBackdropClick()\"\n role=\"presentation\">\n <div\n class=\"mb-dialog\"\n [class.mb-info]=\"service.icon() === MessageBoxIcon.Information\"\n [class.mb-warning]=\"service.icon() === MessageBoxIcon.Warning\"\n [class.mb-danger]=\"service.icon() === MessageBoxIcon.Error\"\n [class.mb-question]=\"service.icon() === MessageBoxIcon.Question\"\n (click)=\"$event.stopPropagation()\"\n role=\"alertdialog\"\n aria-modal=\"true\"\n aria-labelledby=\"mb-title\"\n [attr.aria-describedby]=\"ariaDescribedBy()\">\n\n @if (iconClass()) {\n <div class=\"mb-icon-wrap\">\n <i [class]=\"iconClass() + ' mb-icon'\" aria-hidden=\"true\"></i>\n </div>\n }\n\n <div class=\"mb-title\" id=\"mb-title\">{{ service.title() }}</div>\n <div class=\"mb-message\" id=\"mb-message\">{{ service.message() }}</div>\n\n @if (dontAskAgainConfig(); as daa) {\n <label class=\"mb-dont-ask-again\">\n <input\n type=\"checkbox\"\n [checked]=\"dontAskAgainChecked()\"\n (change)=\"onDontAskAgainToggle($event)\" />\n <span id=\"mb-dont-ask\">{{ daa.labelKey | translate }}</span>\n </label>\n }\n\n <div class=\"mb-actions\">\n @for (btn of service.buttons(); track btn.result) {\n <button\n type=\"button\"\n class=\"vos-btn sm mb-btn\"\n [class.mb-btn--primary]=\"btn.variant === 'primary'\"\n [class.mb-btn--danger]=\"btn.variant === 'danger'\"\n (click)=\"onButtonClick(btn.result)\">\n {{ btn.label }}\n </button>\n }\n </div>\n\n </div>\n </div>\n}\n","import {\n Component,\n Input,\n Output,\n EventEmitter,\n signal,\n inject,\n OnInit,\n DestroyRef,\n ChangeDetectionStrategy,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Observable, ReplaySubject } from 'rxjs';\nimport { switchMap } from 'rxjs/operators';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\nimport { I18nService } from '../../services/i18n.service';\nimport type {\n ShareOrgChartOption,\n ShareOuNode,\n SharePanelLevelOption,\n SharePermissionEntry,\n SharePrincipal,\n ShareUserResult,\n} from '../../models/share-panel.model';\n\n/** Default permission levels (file-style ACL). Hosts can override via `permissionLevels`. */\nexport const SHARE_PANEL_DEFAULT_FILE_LEVELS: SharePanelLevelOption[] = [\n { value: 'View', labelKey: 'files.share.level_view' },\n { value: 'Download', labelKey: 'files.share.level_download' },\n { value: 'Edit', labelKey: 'files.share.level_edit' },\n { value: 'FullControl', labelKey: 'files.share.level_full' },\n];\n\n@Component({\n selector: 'fly-share-panel',\n standalone: true,\n imports: [CommonModule, FormsModule, TranslatePipe],\n templateUrl: './share-panel.component.html',\n styleUrl: './share-panel.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SharePanelComponent implements OnInit {\n /** Resource title shown in the header */\n @Input() targetName = '';\n\n /** i18n key for panel title */\n @Input() titleKey = 'files.share.title';\n\n /** Load current shares / permissions (host resolves display names when possible). */\n @Input({ required: true }) loadPermissions!: () => Observable<SharePermissionEntry[]>;\n\n @Input({ required: true }) searchUsers!: (query: string) => Observable<ShareUserResult[]>;\n\n /**\n * Load OU hierarchy for sharing. `chartId` is null for the default/official tree;\n * non-null for an alternative chart.\n */\n @Input({ required: true })\n loadOuTree!: (chartId: string | null) => Observable<ShareOuNode[]>;\n\n /** Chart selector options; first entry should be the default chart (`id: null`). */\n @Input({ required: true }) loadChartOptions!: () => Observable<ShareOrgChartOption[]>;\n\n /**\n * Initial chart selection. Resolution order:\n * <list type=\"number\">\n * <item>{@link defaultChartId} when explicitly provided (string or null).</item>\n * <item>First option matching {@link defaultChartSystemKey} (e.g. <c>'apps'</c>).</item>\n * <item>Host order — <c>options[0]?.id ?? null</c>.</item>\n * </list>\n */\n @Input() defaultChartSystemKey?: string | null;\n\n /** Hard-coded chart id to pre-select. Takes priority over {@link defaultChartSystemKey}. */\n @Input() defaultChartId?: string | null;\n\n /**\n * Labels from the default (official) OU tree for stable display names on OU grants\n * when the picker shows an alternative chart.\n */\n @Input({ required: true }) loadOuLabelMap!: () => Observable<Record<string, string>>;\n\n @Input({ required: true })\n grantToUser!: (userId: string, level: string, applyToChildren: boolean, isDeny: boolean) => Observable<void>;\n\n @Input({ required: true })\n grantToOu!: (ouId: string, level: string, applyToChildren: boolean, isDeny: boolean) => Observable<void>;\n\n @Input({ required: true }) updatePermission!: (id: string, level: string) => Observable<void>;\n\n @Input({ required: true }) revokePermission!: (id: string) => Observable<void>;\n\n /** When true, show “apply to children” (e.g. folders). */\n @Input() showApplyToChildren = false;\n\n /**\n * When true, surfaces an \"Add as deny\" toggle in the add-permission row and renders\n * existing deny grants with red styling. Hosts whose backend does not support deny\n * grants (legacy callers) leave this false and the panel hides all deny affordances.\n */\n @Input() supportsDeny = false;\n\n /** Override level dropdown options (e.g. notes: View / Edit only). */\n @Input() permissionLevels?: SharePanelLevelOption[];\n\n /** i18n key for wildcard app grant label */\n @Input() everyoneLabelKey = 'files.share.everyone';\n\n /**\n * Optional apps-chart role-OU index for the tenant. When supplied, the panel:\n * <list type=\"bullet\">\n * <item>Renders existing OU grants whose ouId matches a row as <c>RolePrincipal</c>\n * chips (\"FFO in Circles\") instead of opaque OU labels.</item>\n * <item>Surfaces an \"Add role\" picker that translates the picked role to its\n * role-OU UUID and dispatches via {@link grantToOu}. Backend stores it as a\n * plain OU grant; <see cref=\"PermissionResolver\"/> resolves at access time via\n * the user's effective OU set.</item>\n * </list>\n * Hosts that don't have access to the apps-chart (or don't want the role flow) omit\n * this input — OU grants then render as generic OU principals.\n */\n @Input() loadRoleOus?: () => Observable<RoleOuLookupRow[]>;\n\n @Output() close = new EventEmitter<void>();\n\n private destroyRef = inject(DestroyRef);\n private i18n = inject(I18nService);\n\n permissions = signal<SharePermissionEntry[]>([]);\n loading = signal(true);\n searchQuery = '';\n newLevel = '';\n applyToChildren = false;\n\n /** Apps-chart role-OU index, populated lazily when {@link loadRoleOus} is provided. */\n roleOus = signal<RoleOuLookupRow[]>([]);\n /** Map<ouId, role row> — derived from roleOus for O(1) lookup during rendering. */\n private readonly roleOusByOuId = signal<Record<string, RoleOuLookupRow>>({});\n\n /** Two-way bound to the role picker's filter input. */\n roleSearchQuery = '';\n /** True while the role picker section is expanded. */\n showRolePicker = signal(false);\n /**\n * Two-way bound to the \"Add as deny\" toggle. When true, the next user/OU pick is\n * persisted as a deny grant. Reset to false after each successful grant so the next\n * pick defaults back to allow.\n */\n addAsDeny = false;\n searchResults = signal<ShareUserResult[]>([]);\n ouTree = signal<ShareOuNode[]>([]);\n showOuPicker = signal(false);\n chartOptions = signal<ShareOrgChartOption[]>([]);\n selectedOrgChartId = signal<string | null>(null);\n /** Default-tree id → display name for permission rows (OU grants). */\n private readonly ouLabelById = signal<Record<string, string>>({});\n\n private searchTimeout: ReturnType<typeof setTimeout> | null = null;\n /** Emits after chart options load; further emissions on user chart changes (no initial null). */\n private readonly selectedChartId$ = new ReplaySubject<string | null>(1);\n\n ngOnInit(): void {\n const levels = this.levelOptions;\n this.newLevel = levels[0]?.value ?? 'View';\n this.refreshPermissions();\n\n // Load the role-OU lookup table once. Failures degrade gracefully — OU grants then\n // render as generic OU principals (the v1 behaviour) instead of Role chips.\n this.loadRoleOus?.()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (rows) => {\n this.roleOus.set(rows);\n const byId: Record<string, RoleOuLookupRow> = {};\n for (const r of rows) byId[r.ouId] = r;\n this.roleOusByOuId.set(byId);\n },\n error: () => {\n this.roleOus.set([]);\n this.roleOusByOuId.set({});\n },\n });\n\n this.loadOuLabelMap()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (m) => this.ouLabelById.set(m),\n error: () => this.ouLabelById.set({}),\n });\n\n this.selectedChartId$\n .pipe(\n switchMap((id) => this.loadOuTree(id)),\n takeUntilDestroyed(this.destroyRef),\n )\n .subscribe({\n next: (tree) => this.ouTree.set(tree),\n error: () => this.ouTree.set([]),\n });\n\n this.loadChartOptions()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (opts) => {\n this.chartOptions.set(opts);\n const initial = this.resolveInitialChartId(opts);\n this.selectedOrgChartId.set(initial);\n this.selectedChartId$.next(initial);\n },\n error: () => {\n this.chartOptions.set([]);\n this.selectedOrgChartId.set(null);\n this.selectedChartId$.next(null);\n },\n });\n }\n\n /**\n * Picks the chart id to seed the OU picker with. Honours explicit\n * {@link defaultChartId} first (null is a valid id), then {@link defaultChartSystemKey},\n * then falls back to host order.\n */\n private resolveInitialChartId(opts: ShareOrgChartOption[]): string | null {\n if (this.defaultChartId !== undefined) {\n const exists = opts.some((o) => o.id === this.defaultChartId);\n return exists ? (this.defaultChartId as string | null) : (opts[0]?.id ?? null);\n }\n const key = this.defaultChartSystemKey;\n if (key) {\n const match = opts.find((o) => o.systemKey === key);\n if (match) return match.id;\n }\n return opts[0]?.id ?? null;\n }\n\n onOrgChartSelectChange(chartId: string | null): void {\n this.selectedOrgChartId.set(chartId);\n this.selectedChartId$.next(chartId);\n }\n\n get levelOptions(): SharePanelLevelOption[] {\n const p = this.permissionLevels;\n return p && p.length > 0 ? p : SHARE_PANEL_DEFAULT_FILE_LEVELS;\n }\n\n refreshPermissions(): void {\n this.loading.set(true);\n this.loadPermissions()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (perms) => {\n this.permissions.set(perms);\n this.loading.set(false);\n },\n error: () => {\n this.permissions.set([]);\n this.loading.set(false);\n },\n });\n }\n\n onSearchInput(): void {\n if (this.searchTimeout) clearTimeout(this.searchTimeout);\n const query = this.searchQuery.trim();\n if (query.length < 2) {\n this.searchResults.set([]);\n return;\n }\n\n this.searchTimeout = setTimeout(() => {\n this.searchUsers(query)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (items) => this.searchResults.set(items),\n error: () => this.searchResults.set([]),\n });\n }, 300);\n }\n\n onGrantToUser(user: ShareUserResult): void {\n this.searchResults.set([]);\n this.searchQuery = '';\n const isDeny = this.supportsDeny && this.addAsDeny;\n this.grantToUser(user.id, this.newLevel, this.applyToChildren, isDeny)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: () => {\n // Reset deny toggle after each successful grant so allow is the default for the\n // next pick. Preserves the level dropdown which is genuinely sticky.\n this.addAsDeny = false;\n this.refreshPermissions();\n },\n });\n }\n\n onGrantToOu(ou: ShareOuNode): void {\n const isDeny = this.supportsDeny && this.addAsDeny;\n this.grantToOu(ou.id, this.newLevel, this.applyToChildren, isDeny)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: () => {\n this.addAsDeny = false;\n this.refreshPermissions();\n },\n });\n }\n\n /**\n * Add a role grant. Resolves to the role-OU UUID and dispatches via {@link grantToOu}\n * so the backend stores it as a plain OU grant; PermissionResolver matches it at access\n * time via the user's effective OU set (apps-chart computed-from-role membership).\n */\n onGrantToRole(role: RoleOuLookupRow): void {\n const isDeny = this.supportsDeny && this.addAsDeny;\n this.grantToOu(role.ouId, this.newLevel, this.applyToChildren, isDeny)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: () => {\n this.addAsDeny = false;\n this.roleSearchQuery = '';\n this.refreshPermissions();\n },\n });\n }\n\n /** Filtered role list — empty query returns all roles, otherwise case-insensitive substring match. */\n filteredRoles(): RoleOuLookupRow[] {\n const q = this.roleSearchQuery.trim().toLowerCase();\n const all = this.roleOus();\n if (!q) return all;\n return all.filter(\n (r) =>\n r.displayName.toLowerCase().includes(q)\n || r.roleKey.toLowerCase().includes(q)\n || r.appId.toLowerCase().includes(q),\n );\n }\n\n onUpdateLevel(perm: SharePermissionEntry, level: string): void {\n this.updatePermission(perm.id, level)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({ next: () => this.refreshPermissions() });\n }\n\n onRevokePermission(perm: SharePermissionEntry): void {\n this.revokePermission(perm.id)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({ next: () => this.refreshPermissions() });\n }\n\n getPermIcon(perm: SharePermissionEntry): string {\n // Deny rows take a distinct icon regardless of principal kind so the operator can\n // scan a long permission list and immediately spot revocations.\n if (perm.isDeny) return 'pi pi-ban';\n // Reverse-translate: an OuPrincipal whose ouId matches a known role-OU should render\n // as a role chip, even though the host stored it as an OU grant.\n if (perm.principal.kind === 'ou' && this.roleOusByOuId()[perm.principal.ouId]) {\n return 'pi pi-id-card';\n }\n return SharePanelComponent.principalIcon(perm.principal);\n }\n\n /** Maps a principal kind to its display icon. Static so hosts can reuse for menus. */\n static principalIcon(principal: SharePrincipal): string {\n switch (principal.kind) {\n case 'user': return 'pi pi-user';\n case 'role': return 'pi pi-id-card';\n case 'ou': return 'pi pi-sitemap';\n case 'app-everyone': return 'pi pi-globe';\n }\n }\n\n /** Logical start padding for OU hierarchy (roots align with section padding). */\n ouIndentStartPx(ou: ShareOuNode): number {\n const d = ou.depth ?? 0;\n return 12 + d * 18;\n }\n\n getPermLabel(perm: SharePermissionEntry): string {\n const p = perm.principal;\n if (p.displayName?.trim()) return p.displayName.trim();\n switch (p.kind) {\n case 'user':\n return `${p.userId.substring(0, 8)}…`;\n case 'role':\n // Hosts SHOULD pre-resolve role display names — this branch is the\n // worst-case fallback for an unresolved key.\n return `${p.appId}:${p.roleKey}`;\n case 'ou': {\n // Reverse-translate: if this OU id matches a known apps-chart role-OU, render\n // as the semantic role label instead of the opaque OU name.\n const role = this.roleOusByOuId()[p.ouId];\n if (role) return role.displayName;\n\n const fromDefault = this.ouLabelById()[p.ouId];\n if (fromDefault) return fromDefault;\n const ou = this.ouTree().find((o) => o.id === p.ouId);\n if (ou) return ou.displayName;\n return `${p.ouId.substring(0, 8)}…`;\n }\n case 'app-everyone':\n return p.appId === '*' ? this.i18n.t(this.everyoneLabelKey) : p.appId;\n }\n }\n}\n\n/**\n * One row in the role-OU lookup table the share panel uses to render OU grants as Role\n * chips and to drive the \"Add role\" picker. Hosts source this from\n * <c>OrgStructureApiService.listRoleOus()</c> in the desktop shell.\n */\nexport interface RoleOuLookupRow {\n /** Apps-chart role-OU UUID — what backend stores in `grantedToOuId` / `sharedWithOuId`. */\n ouId: string;\n appId: string;\n roleKey: string;\n /** Display name resolved by the host (e.g. \"FFO\" or \"Future Foresight Officer\"). */\n displayName: string;\n}\n","<div class=\"fac-overlay\" (click)=\"close.emit()\">\n <div class=\"fac-panel\" (click)=\"$event.stopPropagation()\">\n <div class=\"fac-header\">\n <h3>{{ titleKey | translate }}</h3>\n <span class=\"fac-target-name\">{{ targetName }}</span>\n <button\n type=\"button\"\n class=\"fac-close\"\n (click)=\"close.emit()\"\n [attr.aria-label]=\"'files.share.close' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n\n <div class=\"fac-add-section\">\n <div class=\"fac-search-row\">\n <input\n type=\"text\"\n class=\"fac-input\"\n [(ngModel)]=\"searchQuery\"\n (input)=\"onSearchInput()\"\n [placeholder]=\"'files.share.search_placeholder' | translate\"\n [attr.aria-label]=\"'files.share.search_users' | translate\"\n />\n <select class=\"fac-select\" [(ngModel)]=\"newLevel\">\n @for (opt of levelOptions; track opt.value) {\n <option [value]=\"opt.value\">{{ opt.labelKey | translate }}</option>\n }\n </select>\n </div>\n\n @if (searchResults().length > 0) {\n <div class=\"fac-search-results\">\n @for (result of searchResults(); track result.id) {\n <div class=\"fac-search-item\" (click)=\"onGrantToUser(result)\">\n <i class=\"pi pi-user\" aria-hidden=\"true\"></i>\n <span>{{ result.firstName }} {{ result.lastName }}</span>\n <span class=\"fac-email\">{{ result.email }}</span>\n </div>\n }\n </div>\n }\n\n @if (chartOptions().length > 0) {\n <div class=\"fac-chart-row\">\n <label for=\"fac-org-chart-select\" class=\"fac-section-label\">{{\n 'files.share.org_chart' | translate\n }}</label>\n <select\n id=\"fac-org-chart-select\"\n class=\"fac-select\"\n [ngModel]=\"selectedOrgChartId()\"\n (ngModelChange)=\"onOrgChartSelectChange($event)\">\n @for (opt of chartOptions(); track $index) {\n <option [ngValue]=\"opt.id\">{{ opt.name }}</option>\n }\n </select>\n </div>\n }\n\n @if (showOuPicker()) {\n <div class=\"fac-ou-section\">\n <div class=\"fac-section-label\">{{ 'files.share.share_with_ou' | translate }}</div>\n @for (ou of ouTree(); track ou.id) {\n <button\n type=\"button\"\n class=\"fac-ou-item\"\n [style.padding-inline-start.px]=\"ouIndentStartPx(ou)\"\n (click)=\"onGrantToOu(ou)\"\n [attr.aria-label]=\"('files.share.share_with_ou_named' | translate) + ' ' + ou.displayName\"\n >\n <i class=\"pi pi-sitemap\" aria-hidden=\"true\"></i>\n <span dir=\"auto\">{{ ou.displayName }}</span>\n </button>\n }\n </div>\n }\n\n @if (loadRoleOus && roleOus().length > 0) {\n <div class=\"fac-role-section\">\n <div class=\"fac-section-label\">{{ 'files.share.share_with_role' | translate }}</div>\n <input\n type=\"text\"\n class=\"fac-input\"\n [(ngModel)]=\"roleSearchQuery\"\n [placeholder]=\"'files.share.role_search_placeholder' | translate\"\n [attr.aria-label]=\"'files.share.search_roles' | translate\"\n [hidden]=\"!showRolePicker()\" />\n @if (showRolePicker()) {\n <div class=\"fac-role-list\">\n @for (role of filteredRoles(); track role.ouId) {\n <button\n type=\"button\"\n class=\"fac-role-item\"\n (click)=\"onGrantToRole(role)\"\n [attr.aria-label]=\"('files.share.share_with_role_named' | translate) + ' ' + role.displayName\">\n <i class=\"pi pi-id-card\" aria-hidden=\"true\"></i>\n <span dir=\"auto\">{{ role.displayName }}</span>\n <span class=\"fac-role-app\">{{ role.appId }}</span>\n </button>\n }\n @if (filteredRoles().length === 0) {\n <div class=\"fac-empty\">{{ 'files.share.no_roles_match' | translate }}</div>\n }\n </div>\n }\n </div>\n }\n\n <div class=\"fac-toggle-row\">\n <button type=\"button\" class=\"fac-link\" (click)=\"showOuPicker.set(!showOuPicker())\">\n {{ showOuPicker() ? ('files.share.hide_ous' | translate) : ('files.share.show_ous' | translate) }}\n </button>\n @if (loadRoleOus && roleOus().length > 0) {\n <button type=\"button\" class=\"fac-link\" (click)=\"showRolePicker.set(!showRolePicker())\">\n {{ showRolePicker() ? ('files.share.hide_roles' | translate) : ('files.share.show_roles' | translate) }}\n </button>\n }\n @if (showApplyToChildren) {\n <label class=\"fac-checkbox-label\">\n <input type=\"checkbox\" [(ngModel)]=\"applyToChildren\" />\n {{ 'files.share.apply_children' | translate }}\n </label>\n }\n @if (supportsDeny) {\n <label class=\"fac-checkbox-label fac-deny-toggle\"\n [title]=\"'files.share.deny_help' | translate\">\n <input type=\"checkbox\" [(ngModel)]=\"addAsDeny\" />\n <i class=\"pi pi-ban\" aria-hidden=\"true\"></i>\n {{ 'files.share.add_as_deny' | translate }}\n </label>\n }\n </div>\n </div>\n\n <div class=\"fac-perms-section\">\n <div class=\"fac-section-label\">{{ 'files.share.current_permissions' | translate }}</div>\n @if (loading()) {\n <div class=\"fac-loading\"><i class=\"pi pi-spin pi-spinner\" aria-hidden=\"true\"></i></div>\n } @else if (permissions().length === 0) {\n <div class=\"fac-empty\">{{ 'files.share.no_permissions' | translate }}</div>\n } @else {\n @for (perm of permissions(); track perm.id) {\n <div class=\"fac-perm-row\" [class.fac-perm-row-deny]=\"perm.isDeny\">\n <div class=\"fac-perm-info\">\n <i [class]=\"getPermIcon(perm)\" aria-hidden=\"true\"></i>\n <span class=\"fac-perm-name\" dir=\"auto\">{{ getPermLabel(perm) }}</span>\n @if (perm.isDeny) {\n <span class=\"fac-badge deny\">{{ 'files.share.denied' | translate }}</span>\n }\n @if (perm.isInherited) {\n <span class=\"fac-badge inherited\">{{ 'files.share.inherited' | translate }}</span>\n }\n </div>\n <div class=\"fac-perm-actions\">\n @if (!perm.isDeny) {\n <select\n class=\"fac-select sm\"\n [ngModel]=\"perm.level\"\n (ngModelChange)=\"onUpdateLevel(perm, $event)\"\n [disabled]=\"perm.isInherited === true\"\n >\n @for (opt of levelOptions; track opt.value) {\n <option [value]=\"opt.value\">{{ opt.labelKey | translate }}</option>\n }\n </select>\n }\n <button\n type=\"button\"\n class=\"fac-icon-btn danger\"\n (click)=\"onRevokePermission(perm)\"\n [disabled]=\"perm.isInherited === true\"\n [title]=\"'files.share.revoke' | translate\"\n >\n <i class=\"pi pi-trash\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </div>\n }\n }\n </div>\n </div>\n</div>\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n EventEmitter,\n forwardRef,\n inject,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n signal,\n SimpleChanges,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport {\n ControlValueAccessor,\n FormsModule,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n Validator,\n ValidatorFn,\n AbstractControl,\n ValidationErrors,\n} from '@angular/forms';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Observable, ReplaySubject, Subject } from 'rxjs';\nimport { debounceTime, distinctUntilChanged, filter, switchMap } from 'rxjs/operators';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\nimport { I18nService } from '../../services/i18n.service';\nimport {\n AppEveryoneTerm,\n AudienceFilter,\n AudienceTerm,\n AudienceTermKind,\n AUDIENCE_LIMITS,\n AUDIENCE_PRESETS,\n AudiencePresetKind,\n ChartTerm,\n OuTerm,\n PresetTerm,\n RolesTerm,\n UsersTerm,\n} from '../../models/audience.model';\nimport type {\n ShareOrgChartOption,\n ShareOuNode,\n ShareUserResult,\n} from '../../models/share-panel.model';\nimport type { RoleOuLookupRow } from '../share-panel/share-panel.component';\n\n/** Bucket the picker is currently editing. Exported so hosts can drive `editTarget` if needed. */\nexport type AudienceEditTarget = 'includes' | 'excludes';\n\n/**\n * Strongly-typed context for the term-card `<ng-template>`. Without an explicit interface\n * the template's `let-term` falls back to `any`, defeating the discriminated-union narrowing\n * inside `@switch (term.kind)`. The `track` expression on the parent `@for` reads\n * `target` and `index` through this same context shape.\n */\ninterface TermCardContext {\n $implicit: AudienceTerm;\n target: AudienceEditTarget;\n index: number;\n}\n\n/**\n * Generic builder for {@link AudienceFilter}. Accepts an initial value, emits both the\n * full filter and a validity flag on every change. Reuses the same callback shapes as\n * {@link SharePanelComponent} so a host already wiring the share panel can drop this in\n * with no extra plumbing.\n *\n * Compaction policy: when the operator picks the same kind multiple times, the component\n * merges into a single term where it's safe to do so:\n * <list type=\"bullet\">\n * <item><b>users</b>: dedupes user ids into one {@link UsersTerm}.</item>\n * <item><b>roles</b>: per `appId`, dedupes role keys into one {@link RolesTerm}.</item>\n * <item><b>ou</b>: per `(chartId, includeDescendants)`, dedupes OU ids into one {@link OuTerm}.</item>\n * <item><b>app-everyone / chart / preset</b>: idempotent per kind+key.</item>\n * </list>\n * This keeps the term count well below {@link AUDIENCE_LIMITS.maxTermsPerFilter} for typical\n * use, and matches how the backend resolver would have unioned them anyway.\n */\n@Component({\n selector: 'fly-audience-builder',\n standalone: true,\n imports: [CommonModule, FormsModule, TranslatePipe],\n templateUrl: './audience-builder.component.html',\n styleUrl: './audience-builder.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AudienceBuilderComponent),\n multi: true,\n },\n {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => AudienceBuilderComponent),\n multi: true,\n },\n ],\n})\nexport class AudienceBuilderComponent\n implements OnInit, OnChanges, OnDestroy, ControlValueAccessor, Validator {\n /** Initial audience filter. Two-way: changes emit via {@link audienceChange}. */\n @Input() value: AudienceFilter | null | undefined = { includes: [] };\n\n /** Hide the Excludes section entirely (e.g. for simple \"send to\" pickers). */\n @Input() showExcludes = true;\n\n /**\n * Which term kinds are selectable. Defaults to all six. Hosts that don't have a\n * concept of `chart` or `preset` should narrow this down to keep the UI focused.\n */\n @Input() supportedKinds: readonly AudienceTermKind[] = [\n 'users',\n 'roles',\n 'ou',\n 'app-everyone',\n 'chart',\n 'preset',\n ];\n\n /**\n * Anchor user id used when adding a `preset` term. Typically `auth.currentUser().id`.\n * If null and the operator picks a preset, the term is rejected with an inline error.\n */\n @Input() selfUserId: string | null = null;\n\n /** App ids the host wants to expose as `app-everyone` options. */\n @Input() appEveryoneOptions: { appId: string; displayName: string }[] = [];\n\n // ── Picker callbacks (same shapes as SharePanelComponent) ────────────────────\n\n @Input({ required: true }) searchUsers!: (query: string) => Observable<ShareUserResult[]>;\n\n @Input({ required: true })\n loadOuTree!: (chartId: string | null) => Observable<ShareOuNode[]>;\n\n @Input({ required: true }) loadChartOptions!: () => Observable<ShareOrgChartOption[]>;\n\n /**\n * Initial chart selection for the OU picker. Resolution order:\n * <list type=\"number\">\n * <item>If <see cref=\"defaultChartId\"/> is explicitly provided (string or null), use it.</item>\n * <item>Else if <see cref=\"defaultChartSystemKey\"/> is set, pick the first option whose\n * <c>systemKey</c> matches (e.g. <c>'apps'</c> → the platform Apps chart).</item>\n * <item>Else fall back to <c>options[0]?.id ?? null</c> (host-defined default order).</item>\n * </list>\n * Hosts that already know the tenant-scoped chart Guid use {@link defaultChartId};\n * hosts that only know the semantic kind (typically <c>'apps'</c>) use\n * {@link defaultChartSystemKey}.\n */\n @Input() defaultChartSystemKey?: string | null;\n\n /**\n * Hard-coded chart id to pre-select. Takes priority over {@link defaultChartSystemKey}.\n * Use <c>null</c> to force the default/official chart (id null) even when other charts\n * are listed first.\n */\n @Input() defaultChartId?: string | null;\n\n /**\n * Optional apps-chart role-OU index. When supplied, the picker exposes a \"Roles\" tab\n * surfacing role chips; without it, that tab is hidden even if `'roles'` is in\n * {@link supportedKinds}.\n */\n @Input() loadRoleOus?: () => Observable<RoleOuLookupRow[]>;\n\n // ── Outputs ──────────────────────────────────────────────────────────────────\n\n /** Fires on every successful add/remove with the current filter. */\n @Output() audienceChange = new EventEmitter<AudienceFilter>();\n\n /**\n * True when {@link AudienceFilter.includes} is non-empty and the term count is within\n * {@link AUDIENCE_LIMITS.maxTermsPerFilter}. Hosts should disable submit when false.\n */\n @Output() validityChange = new EventEmitter<boolean>();\n\n // ── Internal state (signals; computed where derived) ─────────────────────────\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly i18n = inject(I18nService);\n\n readonly includes = signal<AudienceTerm[]>([]);\n readonly excludes = signal<AudienceTerm[]>([]);\n\n readonly editTarget = signal<AudienceEditTarget>('includes');\n readonly pickerOpen = signal(false);\n readonly activeKind = signal<AudienceTermKind>('users');\n\n // User picker — signal-backed so OnPush + computed re-evaluates correctly. Keystrokes go\n // through a debounced Subject + switchMap so a slow \"fo\" result can never overwrite a\n // fresh \"foobar\" result (the previous setTimeout-based path had this race).\n readonly userSearchQuery = signal('');\n readonly userSearchResults = signal<ShareUserResult[]>([]);\n private readonly userSearch$ = new Subject<string>();\n\n // Role picker.\n readonly roleOus = signal<RoleOuLookupRow[]>([]);\n readonly roleSearchQuery = signal('');\n /**\n * Filtered role list as a `computed` so the template doesn't re-call a method on every\n * change-detection cycle.\n */\n readonly filteredRoles = computed<RoleOuLookupRow[]>(() => {\n const q = this.roleSearchQuery().trim().toLowerCase();\n const all = this.roleOus();\n if (!q) return all;\n return all.filter(\n (r) =>\n r.displayName.toLowerCase().includes(q)\n || r.roleKey.toLowerCase().includes(q)\n || r.appId.toLowerCase().includes(q),\n );\n });\n\n // OU picker.\n readonly ouTree = signal<ShareOuNode[]>([]);\n readonly chartOptions = signal<ShareOrgChartOption[]>([]);\n readonly selectedChartId = signal<string | null>(null);\n readonly ouIncludeDescendants = signal(false);\n /**\n * Chart-term picker entries — filters out the null-id default chart since `ChartTerm`\n * requires a real Guid. Avoids the UX trap where clicking \"Default Company\" surfaces\n * an inline error.\n */\n readonly chartTermOptions = computed<ShareOrgChartOption[]>(() =>\n this.chartOptions().filter((c) => c.id !== null),\n );\n private readonly selectedChartId$ = new ReplaySubject<string | null>(1);\n\n // Preset options exposed from the model so the template stays in sync with new presets.\n readonly presetOptions = AUDIENCE_PRESETS;\n\n // Validation surface (inline errors).\n readonly errorKey = signal<string | null>(null);\n\n /** True when the host disabled this control (template-driven `[disabled]` or reactive). */\n readonly disabled = signal(false);\n\n // ── ControlValueAccessor + Validator wiring ──────────────────────────────────\n // These let hosts bind the component via `formControl` / `formControlName` /\n // `[(ngModel)]` instead of plumbing `[value]` + `(audienceChange)` manually. The\n // (audienceChange) / (validityChange) outputs still fire — Angular forms infrastructure\n // is purely additive and template-driven hosts continue to work unchanged.\n private onChange: (value: AudienceFilter) => void = () => undefined;\n private onTouched: () => void = () => undefined;\n private onValidatorChange: () => void = () => undefined;\n\n // ── Lifecycle ────────────────────────────────────────────────────────────────\n\n ngOnInit(): void {\n // applyValue() seeds includes/excludes — defer the initial emit so we don't trigger\n // ExpressionChangedAfterItHasBeenChecked when a parent template binding observes\n // (audienceChange) / (validityChange) in the same change-detection cycle.\n this.applyValue(this.value, /* emitImmediate */ false);\n queueMicrotask(() => this.emitState());\n\n if (this.loadRoleOus) {\n this.loadRoleOus()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (rows) => this.roleOus.set(rows),\n error: () => this.roleOus.set([]),\n });\n }\n\n this.selectedChartId$\n .pipe(\n switchMap((id) => this.loadOuTree(id)),\n takeUntilDestroyed(this.destroyRef),\n )\n .subscribe({\n next: (tree) => this.ouTree.set(tree),\n error: () => this.ouTree.set([]),\n });\n\n // Debounced user search: 300ms idle → switchMap cancels any in-flight request when a\n // newer query arrives, killing the \"stale result overwrites fresh result\" race the old\n // setTimeout path had. `filter(q.length >= 2)` preserves the same UX gate.\n this.userSearch$\n .pipe(\n debounceTime(300),\n distinctUntilChanged(),\n filter((q) => q.length >= 2),\n switchMap((q) => this.searchUsers(q)),\n takeUntilDestroyed(this.destroyRef),\n )\n .subscribe({\n next: (items) => this.userSearchResults.set(items),\n error: () => this.userSearchResults.set([]),\n });\n\n this.loadChartOptions()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (opts) => {\n this.chartOptions.set(opts);\n const initial = this.resolveInitialChartId(opts);\n this.selectedChartId.set(initial);\n this.selectedChartId$.next(initial);\n },\n error: () => {\n this.chartOptions.set([]);\n this.selectedChartId.set(null);\n this.selectedChartId$.next(null);\n },\n });\n\n if (this.supportedKinds.length > 0 && !this.supportedKinds.includes(this.activeKind())) {\n this.activeKind.set(this.supportedKinds[0]);\n }\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n // Re-hydrate when the host swaps the filter wholesale (e.g. editing a different rule).\n // First-mount initialisation is handled by ngOnInit so we skip the initial assignment\n // here. Picker UI state is also reset so a stale search query / open picker from the\n // previous draft doesn't bleed into the new one.\n //\n // We do NOT emit (audienceChange) / onChange — the host already KNOWS the value it\n // pushed. Echoing back via the change callback can create a feedback loop with two-way\n // bindings and reactive forms. Validity, however, may genuinely change with the new\n // value — emit that signal explicitly via the form-validator hook + (validityChange).\n if (changes['value'] && !changes['value'].firstChange) {\n this.applyValue(this.value, /* emitImmediate */ false);\n this.closePicker();\n this.errorKey.set(null);\n this.emitValidityOnly();\n }\n }\n\n ngOnDestroy(): void {\n this.userSearch$.complete();\n }\n\n /**\n * Replaces the in-component state from an external value. Null-safe — if the host\n * passes <c>null</c> or <c>undefined</c> (e.g. while a parent signal is loading),\n * we treat it as an empty filter rather than crashing.\n */\n private applyValue(v: AudienceFilter | null | undefined, emitImmediate: boolean): void {\n this.includes.set([...(v?.includes ?? [])]);\n this.excludes.set([...(v?.excludes ?? [])]);\n if (emitImmediate) this.emitState();\n }\n\n // ── Picker open/close + tabs ─────────────────────────────────────────────────\n\n openPicker(target: AudienceEditTarget): void {\n if (this.disabled()) return;\n this.editTarget.set(target);\n this.pickerOpen.set(true);\n this.errorKey.set(null);\n }\n\n closePicker(): void {\n this.pickerOpen.set(false);\n this.userSearchQuery.set('');\n this.userSearchResults.set([]);\n this.roleSearchQuery.set('');\n }\n\n selectKind(kind: AudienceTermKind): void {\n this.activeKind.set(kind);\n this.errorKey.set(null);\n }\n\n // ── User picker ──────────────────────────────────────────────────────────────\n\n onUserSearchInput(): void {\n const q = this.userSearchQuery().trim();\n if (q.length < 2) {\n this.userSearchResults.set([]);\n // Push the short query into the stream so distinctUntilChanged resets when the user\n // shortens and re-lengthens the query (otherwise \"foo\" → \"f\" → \"foo\" is a no-op).\n this.userSearch$.next(q);\n return;\n }\n this.userSearch$.next(q);\n }\n\n pickUser(user: ShareUserResult): void {\n this.addToActiveBucket((existing) => this.upsertUsersTerm(existing, user.id));\n this.userSearchQuery.set('');\n this.userSearchResults.set([]);\n }\n\n // ── Role picker ──────────────────────────────────────────────────────────────\n\n pickRole(role: RoleOuLookupRow): void {\n this.addToActiveBucket((existing) => this.upsertRolesTerm(existing, role.appId, role.roleKey));\n this.roleSearchQuery.set('');\n }\n\n // ── OU picker ────────────────────────────────────────────────────────────────\n\n onChartChange(chartId: string | null): void {\n this.selectedChartId.set(chartId);\n this.selectedChartId$.next(chartId);\n }\n\n pickOu(ou: ShareOuNode): void {\n const chartId = this.selectedChartId();\n const includeDescendants = this.ouIncludeDescendants();\n this.addToActiveBucket((existing) =>\n this.upsertOuTerm(existing, ou.id, chartId, includeDescendants),\n );\n }\n\n ouIndentStartPx(ou: ShareOuNode): number {\n const d = ou.depth ?? 0;\n return 12 + d * 18;\n }\n\n /**\n * Picks the chart id to seed the OU picker with. Honours explicit {@link defaultChartId}\n * first (even when null, since null is a valid id meaning \"default chart\"), then\n * {@link defaultChartSystemKey}, then falls back to host order. Lookup uses\n * <see cref=\"hasOwnProperty\"/> on the input keys to distinguish \"host did not set this\n * input\" from \"host set it to null\" — Angular reflects an unset input as <c>undefined</c>.\n */\n private resolveInitialChartId(opts: ShareOrgChartOption[]): string | null {\n if (this.defaultChartId !== undefined) {\n const exists = opts.some((o) => o.id === this.defaultChartId);\n return exists ? (this.defaultChartId as string | null) : (opts[0]?.id ?? null);\n }\n const key = this.defaultChartSystemKey;\n if (key) {\n const match = opts.find((o) => o.systemKey === key);\n if (match) return match.id;\n }\n return opts[0]?.id ?? null;\n }\n\n // ── App-everyone picker ──────────────────────────────────────────────────────\n\n pickAppEveryone(appId: string): void {\n this.addToActiveBucket((existing) => this.upsertAppEveryoneTerm(existing, appId));\n }\n\n // ── Chart picker ─────────────────────────────────────────────────────────────\n\n pickChart(chartId: string | null): void {\n if (!chartId) {\n this.errorKey.set('audience.error.chart_id_required');\n return;\n }\n this.addToActiveBucket((existing) => this.upsertChartTerm(existing, chartId));\n }\n\n // ── Preset picker ────────────────────────────────────────────────────────────\n\n pickPreset(preset: AudiencePresetKind): void {\n if (!this.selfUserId) {\n this.errorKey.set('audience.error.self_user_required');\n return;\n }\n const anchor = this.selfUserId;\n this.addToActiveBucket((existing) => this.upsertPresetTerm(existing, preset, anchor));\n }\n\n // ── Term removal ─────────────────────────────────────────────────────────────\n\n removeTerm(target: AudienceEditTarget, index: number): void {\n if (this.disabled()) return;\n const list = target === 'includes' ? this.includes() : this.excludes();\n const next = list.filter((_, i) => i !== index);\n if (target === 'includes') this.includes.set(next);\n else this.excludes.set(next);\n this.emitState();\n }\n\n removeUserId(target: AudienceEditTarget, termIndex: number, userId: string): void {\n this.editTermAt(target, termIndex, (term) => {\n if (term.kind !== 'users') return term;\n const next = term.userIds.filter((id) => id !== userId);\n return next.length === 0 ? null : { ...term, userIds: next };\n });\n }\n\n removeRoleKey(target: AudienceEditTarget, termIndex: number, roleKey: string): void {\n this.editTermAt(target, termIndex, (term) => {\n if (term.kind !== 'roles') return term;\n const next = term.roleKeys.filter((k) => k !== roleKey);\n return next.length === 0 ? null : { ...term, roleKeys: next };\n });\n }\n\n removeOuId(target: AudienceEditTarget, termIndex: number, ouId: string): void {\n this.editTermAt(target, termIndex, (term) => {\n if (term.kind !== 'ou') return term;\n const next = term.ouIds.filter((id) => id !== ouId);\n return next.length === 0 ? null : { ...term, ouIds: next };\n });\n }\n\n // ── Public read API ──────────────────────────────────────────────────────────\n\n /** Returns the current filter snapshot — useful for hosts that want to peek without subscribing. */\n snapshot(): AudienceFilter {\n return this.buildFilter();\n }\n\n // ── ControlValueAccessor implementation ──────────────────────────────────────\n\n /**\n * Called by the forms infrastructure to push a new value into the control. Mirrors the\n * `[value]` setter path — re-uses `applyValue` so template-driven and reactive callers\n * converge on the same hydration code.\n */\n writeValue(value: AudienceFilter | null | undefined): void {\n this.applyValue(value, /* emitImmediate */ false);\n }\n\n registerOnChange(fn: (value: AudienceFilter) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled.set(isDisabled);\n if (isDisabled) this.closePicker();\n }\n\n // ── Validator implementation ─────────────────────────────────────────────────\n\n /**\n * Aligns Angular's reactive-forms validity with the component's own `validityChange`\n * output. Returns `audienceRequired` when includes is empty (the canonical \"zero\n * recipients\" guard) and `audienceTooManyTerms` when over the per-filter cap.\n * <br>\n * The output-event path (<see cref=\"emitState\"/>) reuses this method so there is ONE\n * definition of \"valid\" — the classic \"two almost-identical validators drifted\" bug\n * cannot recur here.\n */\n validate(_: AbstractControl): ValidationErrors | null {\n return this.validateFilter(this.buildFilter());\n }\n\n private validateFilter(candidate: AudienceFilter): ValidationErrors | null {\n if (candidate.includes.length === 0) return { audienceRequired: true };\n const total = candidate.includes.length + (candidate.excludes?.length ?? 0);\n if (total > AUDIENCE_LIMITS.maxTermsPerFilter) {\n return { audienceTooManyTerms: { actual: total, max: AUDIENCE_LIMITS.maxTermsPerFilter } };\n }\n return null;\n }\n\n registerOnValidatorChange(fn: () => void): void {\n this.onValidatorChange = fn;\n }\n\n // ── Term display helpers ─────────────────────────────────────────────────────\n\n ouLabel(ouId: string): string {\n const match = this.ouTree().find((o) => o.id === ouId);\n return match?.displayName ?? `${ouId.substring(0, 8)}…`;\n }\n\n roleLabel(appId: string, roleKey: string): string {\n const match = this.roleOus().find((r) => r.appId === appId && r.roleKey === roleKey);\n return match?.displayName ?? `${appId}:${roleKey}`;\n }\n\n appLabel(appId: string): string {\n if (appId === '*') return this.i18n.t('audience.app_everyone_wildcard');\n const match = this.appEveryoneOptions.find((a) => a.appId === appId);\n return match?.displayName ?? appId;\n }\n\n chartLabel(chartId: string): string {\n const match = this.chartOptions().find((c) => c.id === chartId);\n return match?.name ?? `${chartId.substring(0, 8)}…`;\n }\n\n /**\n * Locale key for a term kind. Replaces hyphens with underscores so the JSON file uses\n * one consistent naming convention (`audience.kind_app_everyone`, not the hyphen variant).\n */\n kindLocaleKey(kind: AudienceTermKind): string {\n return `audience.kind_${kind.replace(/-/g, '_')}`;\n }\n\n /** Same convention as {@link kindLocaleKey} but for preset names. */\n presetLocaleKey(preset: AudiencePresetKind): string {\n return `audience.preset_${preset.replace(/-/g, '_')}`;\n }\n\n /** Picon icon CSS class for a term kind tab — kept here so the template stays declarative. */\n kindIconClass(kind: AudienceTermKind): string {\n switch (kind) {\n case 'users': return 'pi pi-user';\n case 'roles': return 'pi pi-id-card';\n case 'ou': return 'pi pi-sitemap';\n case 'app-everyone': return 'pi pi-globe';\n case 'chart': return 'pi pi-share-alt';\n case 'preset': return 'pi pi-star';\n }\n }\n\n // ── Internal helpers — upsert + state emission ───────────────────────────────\n\n private addToActiveBucket(upsert: (existing: AudienceTerm[]) => AudienceTerm[]): void {\n if (this.disabled()) return;\n const target = this.editTarget();\n const current = target === 'includes' ? this.includes() : this.excludes();\n const next = upsert(current);\n if (this.totalTermCount(next, target) > AUDIENCE_LIMITS.maxTermsPerFilter) {\n this.errorKey.set('audience.error.too_many_terms');\n return;\n }\n if (target === 'includes') this.includes.set(next);\n else this.excludes.set(next);\n this.errorKey.set(null);\n this.emitState();\n }\n\n private editTermAt(\n target: AudienceEditTarget,\n index: number,\n fn: (term: AudienceTerm) => AudienceTerm | null,\n ): void {\n if (this.disabled()) return;\n const list = target === 'includes' ? this.includes() : this.excludes();\n const term = list[index];\n if (!term) return;\n const replaced = fn(term);\n const next = replaced === null\n ? list.filter((_, i) => i !== index)\n : list.map((t, i) => (i === index ? replaced : t));\n if (target === 'includes') this.includes.set(next);\n else this.excludes.set(next);\n this.emitState();\n }\n\n private totalTermCount(replacement: AudienceTerm[], target: AudienceEditTarget): number {\n const inc = target === 'includes' ? replacement : this.includes();\n const exc = target === 'excludes' ? replacement : this.excludes();\n return inc.length + exc.length;\n }\n\n private upsertUsersTerm(existing: AudienceTerm[], userId: string): AudienceTerm[] {\n const idx = existing.findIndex((t) => t.kind === 'users');\n if (idx < 0) {\n const term: UsersTerm = { kind: 'users', userIds: [userId] };\n return [...existing, term];\n }\n const term = existing[idx] as UsersTerm;\n if (term.userIds.includes(userId)) return existing; // idempotent\n if (term.userIds.length >= AUDIENCE_LIMITS.maxUserIdsPerTerm) {\n this.errorKey.set('audience.error.too_many_users_per_term');\n return existing;\n }\n return existing.map((t, i) =>\n i === idx ? { ...term, userIds: [...term.userIds, userId] } : t,\n );\n }\n\n private upsertRolesTerm(\n existing: AudienceTerm[],\n appId: string,\n roleKey: string,\n ): AudienceTerm[] {\n const idx = existing.findIndex((t) => t.kind === 'roles' && t.appId === appId);\n if (idx < 0) {\n const term: RolesTerm = { kind: 'roles', appId, roleKeys: [roleKey] };\n return [...existing, term];\n }\n const term = existing[idx] as RolesTerm;\n if (term.roleKeys.includes(roleKey)) return existing;\n if (term.roleKeys.length >= AUDIENCE_LIMITS.maxRoleKeysPerTerm) {\n this.errorKey.set('audience.error.too_many_roles_per_term');\n return existing;\n }\n return existing.map((t, i) =>\n i === idx ? { ...term, roleKeys: [...term.roleKeys, roleKey] } : t,\n );\n }\n\n private upsertOuTerm(\n existing: AudienceTerm[],\n ouId: string,\n chartId: string | null,\n includeDescendants: boolean,\n ): AudienceTerm[] {\n const idx = existing.findIndex(\n (t) =>\n t.kind === 'ou'\n && t.chartId === chartId\n && t.includeDescendants === includeDescendants,\n );\n if (idx < 0) {\n const term: OuTerm = {\n kind: 'ou',\n ouIds: [ouId],\n chartId,\n includeDescendants,\n };\n return [...existing, term];\n }\n const term = existing[idx] as OuTerm;\n if (term.ouIds.includes(ouId)) return existing;\n if (term.ouIds.length >= AUDIENCE_LIMITS.maxOuIdsPerTerm) {\n this.errorKey.set('audience.error.too_many_ous_per_term');\n return existing;\n }\n return existing.map((t, i) =>\n i === idx ? { ...term, ouIds: [...term.ouIds, ouId] } : t,\n );\n }\n\n private upsertAppEveryoneTerm(existing: AudienceTerm[], appId: string): AudienceTerm[] {\n const exists = existing.some((t) => t.kind === 'app-everyone' && t.appId === appId);\n if (exists) return existing;\n const term: AppEveryoneTerm = { kind: 'app-everyone', appId };\n return [...existing, term];\n }\n\n private upsertChartTerm(existing: AudienceTerm[], chartId: string): AudienceTerm[] {\n const exists = existing.some((t) => t.kind === 'chart' && t.chartId === chartId);\n if (exists) return existing;\n const term: ChartTerm = { kind: 'chart', chartId };\n return [...existing, term];\n }\n\n private upsertPresetTerm(\n existing: AudienceTerm[],\n preset: AudiencePresetKind,\n anchorUserId: string,\n ): AudienceTerm[] {\n const exists = existing.some(\n (t) => t.kind === 'preset' && t.preset === preset && t.anchorUserId === anchorUserId,\n );\n if (exists) return existing;\n const term: PresetTerm = { kind: 'preset', preset, anchorUserId };\n return [...existing, term];\n }\n\n private buildFilter(): AudienceFilter {\n const inc = this.includes();\n const exc = this.excludes();\n return {\n includes: inc,\n ...(exc.length > 0 ? { excludes: exc } : {}),\n ...(this.value?.options ? { options: this.value.options } : {}),\n };\n }\n\n private emitState(): void {\n const filter = this.buildFilter();\n this.audienceChange.emit(filter);\n this.validityChange.emit(this.computeValidity(filter));\n // Forward to the forms infrastructure so reactive forms see the change.\n this.onChange(filter);\n this.onTouched();\n this.onValidatorChange();\n }\n\n /**\n * Emits ONLY the validity signal (component output + forms-validator hook). Used by\n * <see cref=\"ngOnChanges\"/> when the host pushes a new value: the host already knows the\n * value it sent, so re-firing onChange / audienceChange is redundant and risks feedback\n * loops with two-way bindings; but the validity flag may genuinely have flipped and the\n * host needs that to enable / disable submit.\n */\n private emitValidityOnly(): void {\n const filter = this.buildFilter();\n this.validityChange.emit(this.computeValidity(filter));\n this.onValidatorChange();\n }\n\n private computeValidity(candidate: AudienceFilter): boolean {\n // Single-source: delegate to validateFilter so the output flag and the form-validator\n // result agree by construction.\n return this.validateFilter(candidate) === null;\n }\n}\n\n/**\n * Re-export the typed template context so test code (and very advanced hosts that build\n * their own term cards) can refer to it without reaching into the component module.\n */\nexport type AudienceTermCardContext = TermCardContext;\n","<div class=\"fab-root\">\n\n <!-- Includes section -->\n <div class=\"fab-bucket\">\n <div class=\"fab-bucket-header\">\n <div class=\"fab-section-label\" id=\"fab-includes-label\">{{ 'audience.includes' | translate }}</div>\n <button\n type=\"button\"\n class=\"fab-add-btn\"\n (click)=\"openPicker('includes')\"\n [attr.aria-expanded]=\"pickerOpen() && editTarget() === 'includes'\"\n [attr.aria-controls]=\"pickerOpen() && editTarget() === 'includes' ? 'fab-picker-region' : null\"\n >\n <i class=\"pi pi-plus\" aria-hidden=\"true\"></i>\n {{ 'audience.add_term' | translate }}\n </button>\n </div>\n\n @if (includes().length === 0) {\n <div class=\"fab-empty\">{{ 'audience.includes_empty' | translate }}</div>\n } @else {\n <ul class=\"fab-term-list\" aria-labelledby=\"fab-includes-label\">\n @for (term of includes(); track term) {\n <li class=\"fab-term\">\n <ng-container\n *ngTemplateOutlet=\"termCard; context: { $implicit: term, target: 'includes', index: $index }\">\n </ng-container>\n </li>\n }\n </ul>\n }\n </div>\n\n <!-- Excludes section -->\n @if (showExcludes) {\n <div class=\"fab-bucket fab-bucket-exclude\">\n <div class=\"fab-bucket-header\">\n <div class=\"fab-section-label\" id=\"fab-excludes-label\">{{ 'audience.excludes' | translate }}</div>\n <button\n type=\"button\"\n class=\"fab-add-btn\"\n (click)=\"openPicker('excludes')\"\n [attr.aria-expanded]=\"pickerOpen() && editTarget() === 'excludes'\"\n [attr.aria-controls]=\"pickerOpen() && editTarget() === 'excludes' ? 'fab-picker-region' : null\"\n >\n <i class=\"pi pi-plus\" aria-hidden=\"true\"></i>\n {{ 'audience.add_term' | translate }}\n </button>\n </div>\n\n @if (excludes().length === 0) {\n <div class=\"fab-empty\">{{ 'audience.excludes_empty' | translate }}</div>\n } @else {\n <ul class=\"fab-term-list\" aria-labelledby=\"fab-excludes-label\">\n @for (term of excludes(); track term) {\n <li class=\"fab-term\">\n <ng-container\n *ngTemplateOutlet=\"termCard; context: { $implicit: term, target: 'excludes', index: $index }\">\n </ng-container>\n </li>\n }\n </ul>\n }\n </div>\n }\n\n <!-- Inline picker (shared across includes/excludes; gated by pickerOpen) -->\n @if (pickerOpen()) {\n <div\n id=\"fab-picker-region\"\n class=\"fab-picker\"\n role=\"region\"\n [attr.aria-label]=\"(editTarget() === 'includes'\n ? ('audience.adding_to_includes' | translate)\n : ('audience.adding_to_excludes' | translate))\"\n >\n <div class=\"fab-picker-header\">\n <span class=\"fab-picker-target\">\n {{\n editTarget() === 'includes'\n ? ('audience.adding_to_includes' | translate)\n : ('audience.adding_to_excludes' | translate)\n }}\n </span>\n <button type=\"button\" class=\"fab-close\" (click)=\"closePicker()\" [attr.aria-label]=\"'audience.close' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n\n <!-- Kind tabs -->\n <div class=\"fab-kind-tabs\" role=\"tablist\">\n @for (kind of supportedKinds; track kind) {\n <button\n type=\"button\"\n role=\"tab\"\n class=\"fab-kind-tab\"\n [id]=\"'fab-tab-' + kind\"\n [class.active]=\"activeKind() === kind\"\n [attr.aria-selected]=\"activeKind() === kind\"\n [attr.aria-controls]=\"'fab-tabpanel-' + kind\"\n (click)=\"selectKind(kind)\"\n >\n <i [class]=\"kindIconClass(kind)\" aria-hidden=\"true\"></i>\n <span>{{ kindLocaleKey(kind) | translate }}</span>\n </button>\n }\n </div>\n\n @if (errorKey()) {\n <div class=\"fab-inline-error\" role=\"alert\">\n <i class=\"pi pi-exclamation-triangle\" aria-hidden=\"true\"></i>\n {{ errorKey()! | translate }}\n </div>\n }\n\n <!-- Per-kind picker bodies -->\n <div\n class=\"fab-picker-body\"\n role=\"tabpanel\"\n [id]=\"'fab-tabpanel-' + activeKind()\"\n [attr.aria-labelledby]=\"'fab-tab-' + activeKind()\"\n >\n @switch (activeKind()) {\n\n @case ('users') {\n <input\n type=\"text\"\n class=\"fab-input\"\n [ngModel]=\"userSearchQuery()\"\n (ngModelChange)=\"userSearchQuery.set($event); onUserSearchInput()\"\n [placeholder]=\"'audience.search_users_placeholder' | translate\"\n [attr.aria-label]=\"'audience.search_users_placeholder' | translate\"\n />\n @if (userSearchResults().length > 0) {\n <div class=\"fab-result-list\" role=\"list\">\n @for (u of userSearchResults(); track u.id) {\n <button type=\"button\" role=\"listitem\" class=\"fab-result-item\" (click)=\"pickUser(u)\">\n <i class=\"pi pi-user\" aria-hidden=\"true\"></i>\n <span>{{ u.firstName }} {{ u.lastName }}</span>\n <span class=\"fab-result-secondary\">{{ u.email }}</span>\n </button>\n }\n </div>\n } @else if (userSearchQuery().length >= 2) {\n <div class=\"fab-empty\">{{ 'audience.no_users_match' | translate }}</div>\n }\n }\n\n @case ('roles') {\n @if (loadRoleOus && roleOus().length > 0) {\n <input\n type=\"text\"\n class=\"fab-input\"\n [ngModel]=\"roleSearchQuery()\"\n (ngModelChange)=\"roleSearchQuery.set($event)\"\n [placeholder]=\"'audience.search_roles_placeholder' | translate\"\n [attr.aria-label]=\"'audience.search_roles_placeholder' | translate\"\n />\n <div class=\"fab-result-list\" role=\"list\">\n @for (role of filteredRoles(); track role.ouId) {\n <button type=\"button\" role=\"listitem\" class=\"fab-result-item\" (click)=\"pickRole(role)\">\n <i class=\"pi pi-id-card\" aria-hidden=\"true\"></i>\n <span>{{ role.displayName }}</span>\n <span class=\"fab-result-secondary\">{{ role.appId }}</span>\n </button>\n }\n @if (filteredRoles().length === 0) {\n <div class=\"fab-empty\">{{ 'audience.no_roles_match' | translate }}</div>\n }\n </div>\n } @else {\n <div class=\"fab-empty\">{{ 'audience.roles_unavailable' | translate }}</div>\n }\n }\n\n @case ('ou') {\n @if (chartOptions().length > 0) {\n <label for=\"fab-chart-select\" class=\"fab-mini-label\">\n {{ 'audience.org_chart' | translate }}\n </label>\n <select\n id=\"fab-chart-select\"\n class=\"fab-select\"\n [ngModel]=\"selectedChartId()\"\n (ngModelChange)=\"onChartChange($event)\"\n >\n @for (opt of chartOptions(); track $index) {\n <option [ngValue]=\"opt.id\">{{ opt.name }}</option>\n }\n </select>\n }\n <label class=\"fab-checkbox-label\">\n <input\n type=\"checkbox\"\n [ngModel]=\"ouIncludeDescendants()\"\n (ngModelChange)=\"ouIncludeDescendants.set($event)\"\n />\n {{ 'audience.include_descendants' | translate }}\n </label>\n @if (ouTree().length === 0) {\n <div class=\"fab-empty\">{{ 'audience.ou_tree_empty' | translate }}</div>\n } @else {\n <div class=\"fab-result-list fab-ou-tree\" role=\"list\">\n @for (ou of ouTree(); track ou.id) {\n <button\n type=\"button\"\n role=\"listitem\"\n class=\"fab-result-item\"\n [style.padding-inline-start.px]=\"ouIndentStartPx(ou)\"\n (click)=\"pickOu(ou)\"\n >\n <i class=\"pi pi-sitemap\" aria-hidden=\"true\"></i>\n <span>{{ ou.displayName }}</span>\n </button>\n }\n </div>\n }\n }\n\n @case ('app-everyone') {\n @if (appEveryoneOptions.length === 0) {\n <div class=\"fab-empty\">{{ 'audience.app_everyone_empty' | translate }}</div>\n } @else {\n <div class=\"fab-result-list\" role=\"list\">\n @for (app of appEveryoneOptions; track app.appId) {\n <button type=\"button\" role=\"listitem\" class=\"fab-result-item\" (click)=\"pickAppEveryone(app.appId)\">\n <i class=\"pi pi-globe\" aria-hidden=\"true\"></i>\n <span>{{ app.displayName }}</span>\n <span class=\"fab-result-secondary\">{{ app.appId }}</span>\n </button>\n }\n </div>\n }\n }\n\n @case ('chart') {\n @if (chartTermOptions().length === 0) {\n <div class=\"fab-empty\">{{ 'audience.chart_options_empty' | translate }}</div>\n } @else {\n <div class=\"fab-result-list\" role=\"list\">\n @for (opt of chartTermOptions(); track opt.id) {\n <button type=\"button\" role=\"listitem\" class=\"fab-result-item\" (click)=\"pickChart(opt.id)\">\n <i class=\"pi pi-share-alt\" aria-hidden=\"true\"></i>\n <span>{{ opt.name }}</span>\n </button>\n }\n </div>\n }\n }\n\n @case ('preset') {\n <div class=\"fab-result-list\" role=\"list\">\n @for (p of presetOptions; track p) {\n <button type=\"button\" role=\"listitem\" class=\"fab-result-item\" (click)=\"pickPreset(p)\">\n <i class=\"pi pi-star\" aria-hidden=\"true\"></i>\n <span>{{ presetLocaleKey(p) | translate }}</span>\n </button>\n }\n </div>\n }\n }\n </div>\n </div>\n }\n\n</div>\n\n<!-- Reusable term card template, parameterised by target bucket + index for removal callbacks -->\n<ng-template #termCard let-term let-target=\"target\" let-index=\"index\">\n <div class=\"fab-term-card\" [class.fab-term-exclude]=\"target === 'excludes'\">\n\n @switch (term.kind) {\n @case ('users') {\n <div class=\"fab-term-head\">\n <i class=\"pi pi-user\" aria-hidden=\"true\"></i>\n <span class=\"fab-term-title\">\n {{ 'audience.term_users' | translate: { count: term.userIds.length } }}\n </span>\n <button type=\"button\" class=\"fab-icon-btn danger\" (click)=\"removeTerm(target, index)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"fab-term-chips\">\n @for (id of term.userIds; track id) {\n <span class=\"fab-chip\">\n <i class=\"pi pi-user\" aria-hidden=\"true\"></i>\n <span>{{ id.substring(0, 8) }}…</span>\n <button type=\"button\" class=\"fab-chip-x\" (click)=\"removeUserId(target, index, id)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </span>\n }\n </div>\n }\n\n @case ('roles') {\n <div class=\"fab-term-head\">\n <i class=\"pi pi-id-card\" aria-hidden=\"true\"></i>\n <span class=\"fab-term-title\">\n {{ 'audience.term_roles' | translate: { app: appLabel(term.appId), count: term.roleKeys.length } }}\n </span>\n <button type=\"button\" class=\"fab-icon-btn danger\" (click)=\"removeTerm(target, index)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"fab-term-chips\">\n @for (k of term.roleKeys; track k) {\n <span class=\"fab-chip\">\n <i class=\"pi pi-id-card\" aria-hidden=\"true\"></i>\n <span>{{ roleLabel(term.appId, k) }}</span>\n <button type=\"button\" class=\"fab-chip-x\" (click)=\"removeRoleKey(target, index, k)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </span>\n }\n </div>\n }\n\n @case ('ou') {\n <div class=\"fab-term-head\">\n <i class=\"pi pi-sitemap\" aria-hidden=\"true\"></i>\n <span class=\"fab-term-title\">\n {{ 'audience.term_ous' | translate: { count: term.ouIds.length } }}\n @if (term.includeDescendants) {\n <span class=\"fab-badge\">{{ 'audience.descendants_badge' | translate }}</span>\n }\n </span>\n <button type=\"button\" class=\"fab-icon-btn danger\" (click)=\"removeTerm(target, index)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"fab-term-chips\">\n @for (id of term.ouIds; track id) {\n <span class=\"fab-chip\">\n <i class=\"pi pi-sitemap\" aria-hidden=\"true\"></i>\n <span>{{ ouLabel(id) }}</span>\n <button type=\"button\" class=\"fab-chip-x\" (click)=\"removeOuId(target, index, id)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </span>\n }\n </div>\n }\n\n @case ('app-everyone') {\n <div class=\"fab-term-head\">\n <i class=\"pi pi-globe\" aria-hidden=\"true\"></i>\n <span class=\"fab-term-title\">\n {{ 'audience.term_app_everyone' | translate: { app: appLabel(term.appId) } }}\n </span>\n <button type=\"button\" class=\"fab-icon-btn danger\" (click)=\"removeTerm(target, index)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n\n @case ('chart') {\n <div class=\"fab-term-head\">\n <i class=\"pi pi-share-alt\" aria-hidden=\"true\"></i>\n <span class=\"fab-term-title\">\n {{ 'audience.term_chart' | translate: { chart: chartLabel(term.chartId) } }}\n </span>\n <button type=\"button\" class=\"fab-icon-btn danger\" (click)=\"removeTerm(target, index)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n\n @case ('preset') {\n <div class=\"fab-term-head\">\n <i class=\"pi pi-star\" aria-hidden=\"true\"></i>\n <span class=\"fab-term-title\">\n {{ presetLocaleKey(term.preset) | translate }}\n </span>\n <button type=\"button\" class=\"fab-icon-btn danger\" (click)=\"removeTerm(target, index)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n }\n </div>\n</ng-template>\n","import { Component, ChangeDetectionStrategy, computed, input } from '@angular/core';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\n\n/** Full-bleed loading overlay for window content (shell) or embedded hosts. */\n@Component({\n selector: 'fly-block-ui',\n standalone: true,\n imports: [TranslatePipe],\n templateUrl: './block-ui.component.html',\n styleUrl: './block-ui.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FlyBlockUiComponent {\n /** When false, the overlay is not rendered (host may use @if instead). */\n active = input.required<boolean>();\n\n /** i18n key for status text; empty uses `common.loading`. */\n messageKey = input('');\n\n readonly resolvedMessageKey = computed(() => {\n const k = this.messageKey()?.trim();\n return k && k.length > 0 ? k : 'common.loading';\n });\n}\n","@if (active()) {\n <div\n class=\"fly-block-ui\"\n role=\"status\"\n aria-live=\"polite\"\n aria-busy=\"true\"\n [attr.aria-label]=\"resolvedMessageKey() | translate\">\n <div class=\"fly-block-ui__card\">\n <i class=\"pi pi-spin pi-spinner fly-block-ui__spinner\" aria-hidden=\"true\"></i>\n <span class=\"fly-block-ui__text\">{{ resolvedMessageKey() | translate }}</span>\n </div>\n </div>\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n HostListener,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { A11yModule } from '@angular/cdk/a11y';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\n\n/** Drawer width tier. Maps to a logical inline-size (see SCSS). */\nexport type FlyDrawerSize = 'sm' | 'md' | 'lg' | 'xl';\n\n/** Edge the drawer is pinned to. Logical → RTL flips automatically. */\nexport type FlyDrawerSide = 'end' | 'start';\n\n/**\n * `fly-drawer` — the ONE overlay-drawer primitive for FlyOS apps.\n *\n * Replaces every hand-rolled centered modal / `*-backdrop` + `modal-panel`\n * scaffold. A slide-in panel pinned to the window's inline-end edge over a\n * scrim, dismissing away — drops onto ANY app layout (sidebar+main, editor,\n * list) with no restructuring.\n *\n * ## Windowed rendering (important)\n * Desktop apps are windowed, so the drawer renders **in-place** — the scrim is\n * `position: absolute; inset: 0` and overlays the nearest positioned ancestor,\n * NOT a body/CDK portal (a body-level overlay would escape the app window and\n * break the shell's window stacking). **The consuming app's root container must\n * be `position: relative`** (add it where missing) so the scrim is clipped to\n * the window.\n *\n * ## Controlled\n * `open` is a controlled input — bind it to a signal and flip it in the\n * `(closed)` / `(openChange)` handlers. The drawer never closes itself; it only\n * requests closure (scrim / Escape / ✕) by emitting.\n *\n * ## Owns (so apps stop reimplementing it)\n * slide in/out (honours `prefers-reduced-motion`), focus trap + focus restore,\n * Escape + scrim dismiss (both gated), scroll-lock of the host content, ARIA\n * (`role=dialog` + `aria-modal` + labelledby/label), logical CSS (RTL-safe),\n * dark theme.\n *\n * ## Slots\n * - `[flyDrawerHeader]` — optional custom header (else `heading` + close ✕).\n * - default — body (scrolls).\n * - `[flyDrawerFooter]` — optional sticky footer (action bar).\n */\n@Component({\n selector: 'fly-drawer',\n standalone: true,\n imports: [CommonModule, A11yModule, TranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './drawer.component.html',\n styleUrl: './drawer.component.scss',\n})\nexport class FlyDrawerComponent {\n private host = inject(ElementRef<HTMLElement>);\n private destroyRef = inject(DestroyRef);\n\n /** Drives mount + slide. Controlled by the parent. */\n readonly open = input(false);\n /** Width tier → inline-size (sm 360 / md 480 / lg 640 / xl min(960px, 94%)). */\n readonly size = input<FlyDrawerSize>('md');\n /** Convenience title shown in the default header (ignored if `[flyDrawerHeader]` is projected). Treated as an i18n key. */\n readonly heading = input<string | null>(null);\n /** Edge to pin to. `end` (default) slides from inline-end; RTL flips it. */\n readonly side = input<FlyDrawerSide>('end');\n /** Close when the scrim is clicked. */\n readonly dismissOnScrim = input(true);\n /** Close on Escape. */\n readonly dismissOnEscape = input(true);\n /** Accessible label when no `heading` / projected header title is available. Treated as an i18n key. */\n readonly ariaLabel = input<string | null>(null);\n /** Hide the built-in close ✕ in the default header (e.g. a mandatory step). */\n readonly hideCloseButton = input(false);\n\n /** Emitted when the user requests dismissal (scrim / Escape / ✕). */\n readonly closed = output<void>();\n /** Two-way friendly: emits `false` on a dismissal request. */\n readonly openChange = output<boolean>();\n\n /** Whether the panel is mounted (true while open AND during the slide-out). */\n readonly rendered = signal(false);\n /** Whether the panel is in its entered (slid-in) state. */\n readonly entered = signal(false);\n\n readonly headingId = 'fly-drawer-heading';\n readonly labelledBy = computed(() => (this.heading() ? this.headingId : null));\n\n /** Element focused before the drawer opened, restored on close. */\n private previouslyFocused: HTMLElement | null = null;\n /** Parent element whose overflow we lock while open. */\n private scrollLockTarget: HTMLElement | null = null;\n private prevOverflow = '';\n\n constructor() {\n effect(() => {\n if (this.open()) this.onOpen();\n else this.onClose();\n });\n this.destroyRef.onDestroy(() => this.releaseScrollLock());\n }\n\n private onOpen(): void {\n if (this.rendered()) return;\n this.previouslyFocused =\n document.activeElement instanceof HTMLElement ? document.activeElement : null;\n this.lockScroll();\n this.rendered.set(true);\n // Next frame → flip to entered so the CSS transition runs.\n requestAnimationFrame(() => requestAnimationFrame(() => this.entered.set(true)));\n }\n\n private onClose(): void {\n if (!this.rendered()) return;\n this.entered.set(false);\n this.releaseScrollLock();\n this.restoreFocus();\n // Unmount on transitionend; fallback timer covers reduced-motion / a missed\n // event so the (still pointer-grabbing) scrim can never linger.\n setTimeout(() => {\n if (!this.open()) this.rendered.set(false);\n }, 320);\n }\n\n /** Remove the panel from the DOM once the slide-out transition completes. */\n onPanelTransitionEnd(): void {\n if (!this.entered() && !this.open()) this.rendered.set(false);\n }\n\n @HostListener('document:keydown.escape')\n onEscape(): void {\n if (this.open() && this.dismissOnEscape()) this.requestClose();\n }\n\n onScrimClick(): void {\n if (this.dismissOnScrim()) this.requestClose();\n }\n\n requestClose(): void {\n this.openChange.emit(false);\n this.closed.emit();\n }\n\n private lockScroll(): void {\n // Lock the nearest positioned ancestor (the app window root) — the same box\n // the absolutely-positioned scrim clips to — not the immediate DOM parent\n // (which may be a `display:contents` dialog wrapper).\n const target =\n (this.host.nativeElement.offsetParent as HTMLElement | null) ??\n this.host.nativeElement.parentElement;\n if (!target) return;\n this.scrollLockTarget = target;\n this.prevOverflow = target.style.overflow;\n target.style.overflow = 'hidden';\n }\n\n private releaseScrollLock(): void {\n if (!this.scrollLockTarget) return;\n this.scrollLockTarget.style.overflow = this.prevOverflow;\n this.scrollLockTarget = null;\n this.prevOverflow = '';\n }\n\n private restoreFocus(): void {\n const el = this.previouslyFocused;\n this.previouslyFocused = null;\n if (el && document.contains(el)) {\n // Defer so focus lands after the panel is removed from the a11y tree.\n requestAnimationFrame(() => el.focus());\n }\n }\n}\n","<!--\n Windowed overlay drawer. Renders only while mounted (open or sliding out).\n Scrim + panel are absolutely positioned within the nearest positioned\n ancestor (the consuming app root must be position:relative).\n-->\n@if (rendered()) {\n <div\n class=\"fly-drawer__scrim\"\n [class.fly-drawer__scrim--in]=\"entered()\"\n (click)=\"onScrimClick()\"\n aria-hidden=\"true\"\n ></div>\n\n <div\n class=\"fly-drawer__panel\"\n [class.fly-drawer__panel--in]=\"entered()\"\n [class]=\"'fly-drawer__panel--' + size() + ' fly-drawer__panel--side-' + side()\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-label]=\"!labelledBy() && ariaLabel() ? (ariaLabel()! | translate) : null\"\n cdkTrapFocus\n [cdkTrapFocusAutoCapture]=\"true\"\n (transitionend)=\"onPanelTransitionEnd()\"\n >\n <!-- Header: custom slot, else heading + close ✕. -->\n <ng-content select=\"[flyDrawerHeader]\">\n @if (heading()) {\n <header class=\"fly-drawer__header\">\n <h2 class=\"fly-drawer__title\" [id]=\"headingId\">{{ heading()! | translate }}</h2>\n @if (!hideCloseButton()) {\n <button\n type=\"button\"\n class=\"fly-drawer__close\"\n (click)=\"requestClose()\"\n [attr.aria-label]=\"'common.action.close' | translate\"\n >\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n }\n </header>\n }\n </ng-content>\n\n <div class=\"fly-drawer__body\">\n <ng-content></ng-content>\n </div>\n\n <ng-content select=\"[flyDrawerFooter]\"></ng-content>\n </div>\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Injector,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\nimport type { FlyFileInfo } from '../../models/file.model';\nimport Cropper from 'cropperjs';\n\n/**\n * Image upload component with built-in cropperjs cropping modal.\n *\n * Usage:\n * ```html\n * <fly-image-upload\n * [aspectRatio]=\"16/9\"\n * [currentImageId]=\"trend.coverImageId\"\n * sourceApp=\"circles\"\n * sourceEntityType=\"trend\"\n * (uploaded)=\"onImageUploaded($event)\"\n * (removed)=\"onImageRemoved()\"\n * />\n * ```\n */\n@Component({\n selector: 'fly-image-upload',\n standalone: true,\n imports: [TranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n template: `\n <div class=\"fly-image-upload\">\n @if (previewUrl()) {\n <div class=\"fly-image-upload__preview\">\n <img [src]=\"previewUrl()\" alt=\"\" class=\"fly-image-upload__img\" />\n <div class=\"fly-image-upload__overlay\">\n <button type=\"button\" class=\"fly-image-upload__action-btn\" (click)=\"triggerFileInput()\" [title]=\"'files.imageUpload.change' | translate\">\n <span class=\"pi pi-pencil\" aria-hidden=\"true\"></span>\n </button>\n <button type=\"button\" class=\"fly-image-upload__action-btn fly-image-upload__action-btn--danger\" (click)=\"removeImage()\" [title]=\"'files.imageUpload.remove' | translate\">\n <span class=\"pi pi-trash\" aria-hidden=\"true\"></span>\n </button>\n </div>\n </div>\n } @else {\n <button type=\"button\" class=\"fly-image-upload__dropzone\" (click)=\"triggerFileInput()\" (dragover)=\"onDragOver($event)\" (drop)=\"onDrop($event)\">\n @if (uploading()) {\n <span class=\"pi pi-spin pi-spinner fly-image-upload__icon\" aria-hidden=\"true\"></span>\n <span class=\"fly-image-upload__label\">{{ 'files.imageUpload.uploading' | translate }}</span>\n } @else {\n <span class=\"pi pi-image fly-image-upload__icon\" aria-hidden=\"true\"></span>\n <span class=\"fly-image-upload__label\">{{ 'files.imageUpload.placeholder' | translate }}</span>\n <span class=\"fly-image-upload__hint\">{{ sizeHint() }}</span>\n }\n </button>\n }\n\n @if (error()) {\n <div class=\"fly-image-upload__error\">{{ error() }}</div>\n }\n\n <input #fileInput type=\"file\" accept=\"image/*\" class=\"fly-image-upload__hidden\" (change)=\"onFileSelected($event)\" />\n\n @if (showCropper()) {\n <div class=\"fly-image-upload__crop-backdrop\" (click)=\"cancelCrop()\">\n <div class=\"fly-image-upload__crop-modal\" (click)=\"$event.stopPropagation()\">\n <div class=\"fly-image-upload__crop-header\">\n <h3>{{ 'files.imageUpload.crop' | translate }}</h3>\n </div>\n <div class=\"fly-image-upload__crop-body\">\n <img #cropImage [src]=\"rawImageUrl()\" alt=\"\" />\n </div>\n <div class=\"fly-image-upload__crop-footer\">\n <button type=\"button\" class=\"vos-btn sm platter\" (click)=\"cancelCrop()\">{{ 'common.cancel' | translate }}</button>\n <button type=\"button\" class=\"vos-btn sm primary\" (click)=\"applyCrop()\">{{ 'files.imageUpload.apply' | translate }}</button>\n </div>\n </div>\n </div>\n }\n </div>\n `,\n styles: [\n /* cropperjs v1 styles (MIT — Chen Fengyuan) */\n `.cropper-container{-webkit-touch-callout:none;direction:ltr;font-size:0;line-height:0;position:relative;touch-action:none;user-select:none}.cropper-container img{backface-visibility:hidden;display:block;height:100%;image-orientation:0deg;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{bottom:0;left:0;position:absolute;right:0;top:0}.cropper-canvas,.cropper-wrap-box{overflow:hidden}.cropper-drag-box{background-color:#fff;opacity:0}.cropper-modal{background-color:#000;opacity:.5}.cropper-view-box{display:block;height:100%;outline:1px solid #39f;outline-color:rgba(51,153,255,.75);overflow:hidden;width:100%}.cropper-dashed{border:0 dashed #eee;display:block;opacity:.5;position:absolute}.cropper-dashed.dashed-h{border-bottom-width:1px;border-top-width:1px;height:33.33333%;left:0;top:33.33333%;width:100%}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;height:100%;left:33.33333%;top:0;width:33.33333%}.cropper-center{display:block;height:0;left:50%;opacity:.75;position:absolute;top:50%;width:0}.cropper-center:after,.cropper-center:before{background-color:#eee;content:\" \";display:block;position:absolute}.cropper-center:before{height:1px;left:-3px;top:0;width:7px}.cropper-center:after{height:7px;left:0;top:-3px;width:1px}.cropper-face,.cropper-line,.cropper-point{display:block;height:100%;opacity:.1;position:absolute;width:100%}.cropper-face{background-color:#fff;left:0;top:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;right:-3px;top:0;width:5px}.cropper-line.line-n{cursor:ns-resize;height:5px;left:0;top:-3px}.cropper-line.line-w{cursor:ew-resize;left:-3px;top:0;width:5px}.cropper-line.line-s{bottom:-3px;cursor:ns-resize;height:5px;left:0}.cropper-point{background-color:#39f;height:5px;opacity:.75;width:5px}.cropper-point.point-e{cursor:ew-resize;margin-top:-3px;right:-3px;top:50%}.cropper-point.point-n{cursor:ns-resize;left:50%;margin-left:-3px;top:-3px}.cropper-point.point-w{cursor:ew-resize;left:-3px;margin-top:-3px;top:50%}.cropper-point.point-s{bottom:-3px;cursor:s-resize;left:50%;margin-left:-3px}.cropper-point.point-ne{cursor:nesw-resize;right:-3px;top:-3px}.cropper-point.point-nw{cursor:nwse-resize;left:-3px;top:-3px}.cropper-point.point-sw{bottom:-3px;cursor:nesw-resize;left:-3px}.cropper-point.point-se{bottom:-3px;cursor:nwse-resize;height:20px;opacity:1;right:-3px;width:20px}.cropper-invisible{opacity:0}.cropper-bg{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC\")}.cropper-hide{display:block;height:0;position:absolute;width:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}`,\n `\n .fly-image-upload { display: flex; flex-direction: column; gap: 6px; }\n .fly-image-upload__hidden { display: none; }\n\n .fly-image-upload__dropzone {\n display: flex; flex-direction: column; align-items: center; justify-content: center;\n gap: 8px; padding: 24px; border: 2px dashed var(--separator-primary, #e5e7eb);\n border-radius: 12px; background: var(--fill-quaternary, #f9fafb); cursor: pointer;\n transition: border-color 0.15s, background 0.15s; min-height: 120px;\n }\n .fly-image-upload__dropzone:hover { border-color: var(--accent-primary, #0071e3); background: var(--fill-tertiary, #f3f4f6); }\n .fly-image-upload__icon { font-size: 28px; color: var(--label-tertiary, #9ca3af); }\n .fly-image-upload__label { font-size: 13px; color: var(--label-secondary, #6b7280); }\n .fly-image-upload__hint { font-size: 11px; color: var(--label-tertiary, #9ca3af); }\n\n .fly-image-upload__preview { position: relative; border-radius: 12px; overflow: hidden; }\n .fly-image-upload__img { display: block; width: 100%; max-height: 280px; object-fit: cover; border-radius: 12px; }\n .fly-image-upload__overlay {\n position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;\n gap: 12px; background: rgba(0,0,0,0.35); opacity: 0; transition: opacity 0.15s;\n }\n .fly-image-upload__preview:hover .fly-image-upload__overlay { opacity: 1; }\n .fly-image-upload__action-btn {\n width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;\n display: flex; align-items: center; justify-content: center;\n background: rgba(255,255,255,0.9); color: var(--label-primary, #1f2937); font-size: 14px;\n transition: background 0.15s;\n }\n .fly-image-upload__action-btn:hover { background: #fff; }\n .fly-image-upload__action-btn--danger:hover { background: #fee2e2; color: #dc2626; }\n\n .fly-image-upload__error { font-size: 12px; color: var(--system-red, #ef4444); }\n\n .fly-image-upload__crop-backdrop {\n position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center;\n background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);\n }\n .fly-image-upload__crop-modal {\n background: var(--bg-primary, #fff); color: var(--label-primary, #1f2937);\n border-radius: 16px; overflow: hidden;\n max-width: 700px; width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.4);\n border: 1px solid var(--separator-primary, rgba(0,0,0,0.1));\n }\n .fly-image-upload__crop-header {\n padding: 16px 20px; border-bottom: 1px solid var(--separator-primary, #e5e7eb);\n background: var(--fill-quaternary, transparent);\n }\n .fly-image-upload__crop-header h3 {\n margin: 0; font-size: 16px; font-weight: 600; color: var(--label-primary, #1f2937);\n }\n .fly-image-upload__crop-body {\n max-height: 60vh; overflow: hidden; background: var(--fill-tertiary, #f3f4f6);\n }\n .fly-image-upload__crop-body img { display: block; max-width: 100%; }\n .fly-image-upload__crop-footer {\n display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px;\n border-top: 1px solid var(--separator-primary, #e5e7eb);\n background: var(--fill-quaternary, transparent);\n }\n\n /* Dark theme */\n html.dark-theme .fly-image-upload__crop-modal {\n background: var(--bg-primary, #1c1c1e);\n border: 1px solid var(--separator-primary, rgba(255,255,255,0.1));\n }\n html.dark-theme .fly-image-upload__crop-body { background: var(--fill-tertiary, #2c2c2e); }\n `],\n})\nexport class FlyImageUploadComponent {\n private http = inject(HttpClient);\n private injector = inject(Injector);\n\n // ── Inputs ──\n aspectRatio = input(16 / 9);\n maxSizeBytes = input(5 * 1024 * 1024);\n currentImageId = input<string | null>(null);\n sourceApp = input('unknown');\n sourceEntityType = input<string | null>(null);\n sourceEntityId = input<string | null>(null);\n\n // ── Outputs ──\n uploaded = output<FlyFileInfo>();\n removed = output<void>();\n\n // ── State ──\n uploading = signal(false);\n error = signal<string | null>(null);\n showCropper = signal(false);\n rawImageUrl = signal<string>('');\n localBlob = signal<string | null>(null);\n\n fileInput = viewChild<ElementRef<HTMLInputElement>>('fileInput');\n cropImage = viewChild<ElementRef<HTMLImageElement>>('cropImage');\n\n private cropper: Cropper | null = null;\n private selectedFile: File | null = null;\n\n /** Resolved preview URL — uses blob for local uploads, fetches authenticated for existing images */\n previewUrl = signal<string | null>(null);\n\n constructor() {\n // React to currentImageId changes — fetch authenticated blob\n effect((onCleanup) => {\n const local = this.localBlob();\n if (local) { this.previewUrl.set(local); return; }\n\n const id = this.currentImageId();\n if (!id) { this.previewUrl.set(null); return; }\n\n const sub = this.http.get(`/api/files/${id}/download`, { responseType: 'blob' }).subscribe({\n next: (blob) => this.previewUrl.set(URL.createObjectURL(blob)),\n error: () => this.previewUrl.set(null),\n });\n onCleanup(() => sub.unsubscribe());\n });\n }\n\n sizeHint = computed(() => {\n const mb = this.maxSizeBytes() / (1024 * 1024);\n return `Max ${mb}MB`;\n });\n\n triggerFileInput(): void {\n this.fileInput()?.nativeElement.click();\n }\n\n onDragOver(e: DragEvent): void {\n e.preventDefault();\n e.stopPropagation();\n }\n\n onDrop(e: DragEvent): void {\n e.preventDefault();\n e.stopPropagation();\n const file = e.dataTransfer?.files?.[0];\n if (file) this.processFile(file);\n }\n\n onFileSelected(e: Event): void {\n const input = e.target as HTMLInputElement;\n const file = input.files?.[0];\n if (file) this.processFile(file);\n input.value = '';\n }\n\n removeImage(): void {\n this.localBlob.set(null);\n this.previewUrl.set(null);\n this.error.set(null);\n this.removed.emit();\n }\n\n cancelCrop(): void {\n this.showCropper.set(false);\n this.destroyCropper();\n if (this.rawImageUrl()) URL.revokeObjectURL(this.rawImageUrl());\n this.rawImageUrl.set('');\n }\n\n applyCrop(): void {\n if (!this.cropper) return;\n const canvas = this.cropper.getCroppedCanvas({ maxWidth: 1920, maxHeight: 1080 });\n this.showCropper.set(false);\n this.destroyCropper();\n if (this.rawImageUrl()) URL.revokeObjectURL(this.rawImageUrl());\n this.rawImageUrl.set('');\n\n canvas.toBlob((blob) => {\n if (!blob) return;\n const fileName = this.selectedFile?.name ?? 'cropped-image.jpg';\n const file = new File([blob], fileName, { type: blob.type || 'image/jpeg' });\n this.uploadFile(file);\n }, 'image/jpeg', 0.9);\n }\n\n private processFile(file: File): void {\n this.error.set(null);\n\n if (!file.type.startsWith('image/')) {\n this.error.set('Only image files are allowed');\n return;\n }\n if (file.size > this.maxSizeBytes()) {\n const mb = this.maxSizeBytes() / (1024 * 1024);\n this.error.set(`File exceeds ${mb}MB limit`);\n return;\n }\n\n this.selectedFile = file;\n const url = URL.createObjectURL(file);\n this.rawImageUrl.set(url);\n this.showCropper.set(true);\n\n // Init cropperjs after the @if (showCropper()) block has rendered and\n // the #cropImage signal viewQuery is populated. setTimeout(0) used to\n // race here under Native Federation when fewer host CD passes happen\n // before the macrotask fires (cropImage() returned undefined and\n // initCropper bailed). afterNextRender is deterministic.\n afterNextRender(() => this.initCropper(), { injector: this.injector });\n }\n\n private initCropper(): void {\n this.destroyCropper();\n const imgEl = this.cropImage()?.nativeElement;\n if (!imgEl) return;\n this.cropper = new Cropper(imgEl, {\n aspectRatio: this.aspectRatio(),\n viewMode: 1,\n autoCropArea: 0.9,\n responsive: true,\n background: false,\n });\n }\n\n private destroyCropper(): void {\n this.cropper?.destroy();\n this.cropper = null;\n }\n\n private uploadFile(file: File): void {\n this.uploading.set(true);\n this.error.set(null);\n\n const formData = new FormData();\n formData.append('file', file, file.name);\n formData.append('sourceApp', this.sourceApp());\n if (this.sourceEntityType()) formData.append('sourceEntityType', this.sourceEntityType()!);\n if (this.sourceEntityId()) formData.append('sourceEntityId', this.sourceEntityId()!);\n\n this.http.post<{ data: FlyFileInfo }>('/api/files/upload', formData).subscribe({\n next: (res) => {\n this.uploading.set(false);\n const info = res.data ?? (res as any);\n this.localBlob.set(URL.createObjectURL(file));\n this.uploaded.emit(info);\n },\n error: (err) => {\n this.uploading.set(false);\n this.error.set(err?.error?.message ?? 'Upload failed');\n },\n });\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { HttpClient, HttpEventType } from '@angular/common/http';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\nimport type { FlyFileInfo } from '../../models/file.model';\n\ninterface UploadSlot {\n file: File;\n progress: number; // 0–100\n status: 'uploading' | 'done' | 'error';\n info?: FlyFileInfo;\n error?: string;\n}\n\nconst FILE_ICONS: Record<string, string> = {\n 'application/pdf': 'pi-file-pdf',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'pi-file-word',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'pi-file-excel',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'pi-file',\n 'image/': 'pi-image',\n 'video/': 'pi-video',\n 'audio/': 'pi-volume-up',\n};\n\nfunction iconForType(contentType: string): string {\n for (const [prefix, icon] of Object.entries(FILE_ICONS)) {\n if (contentType.startsWith(prefix)) return icon;\n }\n return 'pi-file';\n}\n\nfunction formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/**\n * Multi-file upload with drag-drop, progress, and validation.\n *\n * Usage:\n * ```html\n * <fly-file-upload\n * [maxFiles]=\"5\"\n * [maxFileSizeBytes]=\"5242880\"\n * accept=\".pdf,.docx,.xlsx\"\n * [(files)]=\"trend.attachments\"\n * sourceApp=\"circles\"\n * sourceEntityType=\"trend\"\n * (filesChanged)=\"onAttachmentsChanged($event)\"\n * />\n * ```\n */\n@Component({\n selector: 'fly-file-upload',\n standalone: true,\n imports: [TranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <div class=\"fly-file-upload\">\n @if (canAddMore()) {\n <div class=\"fly-file-upload__dropzone\"\n [class.fly-file-upload__dropzone--drag]=\"dragging()\"\n (click)=\"triggerFileInput()\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (drop)=\"onDrop($event)\">\n <span class=\"pi pi-cloud-upload fly-file-upload__icon\" aria-hidden=\"true\"></span>\n <span class=\"fly-file-upload__label\">{{ 'files.fileUpload.dropOrClick' | translate }}</span>\n <span class=\"fly-file-upload__hint\">{{ limitHint() }}</span>\n </div>\n }\n\n @if (error()) {\n <div class=\"fly-file-upload__error\">{{ error() }}</div>\n }\n\n @if (allSlots().length) {\n <ul class=\"fly-file-upload__list\">\n @for (slot of allSlots(); track slot.file.name + slot.file.size) {\n <li class=\"fly-file-upload__item\">\n <span class=\"pi {{ iconFor(slot) }} fly-file-upload__file-icon\" aria-hidden=\"true\"></span>\n <div class=\"fly-file-upload__file-info\">\n <span class=\"fly-file-upload__file-name\">{{ slot.file.name }}</span>\n <span class=\"fly-file-upload__file-size\">{{ formatFileSize(slot.file.size) }}</span>\n </div>\n @if (slot.status === 'uploading') {\n <div class=\"fly-file-upload__progress-track\">\n <div class=\"fly-file-upload__progress-fill\" [style.width.%]=\"slot.progress\"></div>\n </div>\n }\n @if (slot.status === 'error') {\n <span class=\"fly-file-upload__file-error\" [title]=\"slot.error ?? ''\">\n <span class=\"pi pi-exclamation-triangle\" aria-hidden=\"true\"></span>\n </span>\n }\n @if (slot.status === 'done') {\n <span class=\"pi pi-check-circle fly-file-upload__file-ok\" aria-hidden=\"true\"></span>\n }\n <button type=\"button\" class=\"fly-file-upload__remove-btn\" (click)=\"removeSlot(slot)\" [title]=\"'common.remove' | translate\">\n <span class=\"pi pi-times\" aria-hidden=\"true\"></span>\n </button>\n </li>\n }\n </ul>\n }\n\n @if (existingFiles().length && !allSlots().length) {\n <ul class=\"fly-file-upload__list\">\n @for (f of existingFiles(); track f.id) {\n <li class=\"fly-file-upload__item\">\n <span class=\"pi {{ iconForInfo(f) }} fly-file-upload__file-icon\" aria-hidden=\"true\"></span>\n <div class=\"fly-file-upload__file-info\">\n <span class=\"fly-file-upload__file-name\">{{ f.fileName }}</span>\n <span class=\"fly-file-upload__file-size\">{{ formatFileSize(f.sizeBytes) }}</span>\n </div>\n <span class=\"pi pi-check-circle fly-file-upload__file-ok\" aria-hidden=\"true\"></span>\n <button type=\"button\" class=\"fly-file-upload__remove-btn\" (click)=\"removeExisting(f)\" [title]=\"'common.remove' | translate\">\n <span class=\"pi pi-times\" aria-hidden=\"true\"></span>\n </button>\n </li>\n }\n </ul>\n }\n\n <input #fileInput type=\"file\" [accept]=\"accept()\" multiple class=\"fly-file-upload__hidden\" (change)=\"onFilesSelected($event)\" />\n </div>\n `,\n styles: [`\n .fly-file-upload { display: flex; flex-direction: column; gap: 8px; }\n .fly-file-upload__hidden { display: none; }\n\n .fly-file-upload__dropzone {\n display: flex; flex-direction: column; align-items: center; justify-content: center;\n gap: 6px; padding: 20px; border: 2px dashed var(--separator-primary, #e5e7eb);\n border-radius: 10px; background: var(--fill-quaternary, #f9fafb); cursor: pointer;\n transition: border-color 0.15s, background 0.15s;\n }\n .fly-file-upload__dropzone:hover,\n .fly-file-upload__dropzone--drag { border-color: var(--accent-primary, #0071e3); background: var(--fill-tertiary, #f3f4f6); }\n .fly-file-upload__icon { font-size: 24px; color: var(--label-tertiary, #9ca3af); }\n .fly-file-upload__label { font-size: 13px; color: var(--label-secondary, #6b7280); }\n .fly-file-upload__hint { font-size: 11px; color: var(--label-tertiary, #9ca3af); }\n\n .fly-file-upload__error { font-size: 12px; color: var(--system-red, #ef4444); padding: 4px 0; }\n\n .fly-file-upload__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }\n .fly-file-upload__item {\n display: flex; align-items: center; gap: 10px; padding: 8px 12px;\n border: 1px solid var(--separator-primary, #e5e7eb); border-radius: 8px;\n background: var(--fill-quaternary, #f9fafb); font-size: 13px;\n }\n .fly-file-upload__file-icon { font-size: 18px; color: var(--label-tertiary, #9ca3af); flex-shrink: 0; }\n .fly-file-upload__file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }\n .fly-file-upload__file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--label-primary, #1f2937); }\n .fly-file-upload__file-size { font-size: 11px; color: var(--label-tertiary, #9ca3af); }\n\n .fly-file-upload__progress-track { width: 60px; height: 4px; border-radius: 2px; background: var(--fill-tertiary, #e5e7eb); overflow: hidden; }\n .fly-file-upload__progress-fill { height: 100%; background: var(--accent-primary, #0071e3); border-radius: 2px; transition: width 0.2s; }\n\n .fly-file-upload__file-ok { color: var(--system-green, #22c55e); font-size: 14px; }\n .fly-file-upload__file-error { color: var(--system-red, #ef4444); font-size: 14px; }\n\n .fly-file-upload__remove-btn {\n background: none; border: none; cursor: pointer; color: var(--label-tertiary, #9ca3af);\n width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;\n border-radius: 4px; transition: color 0.15s, background 0.15s; flex-shrink: 0;\n }\n .fly-file-upload__remove-btn:hover { color: var(--system-red, #ef4444); background: var(--fill-tertiary, #f3f4f6); }\n `],\n})\nexport class FlyFileUploadComponent {\n private http = inject(HttpClient);\n\n // ── Inputs ──\n maxFiles = input(5);\n maxFileSizeBytes = input(5 * 1024 * 1024);\n accept = input('');\n sourceApp = input('unknown');\n sourceEntityType = input<string | null>(null);\n sourceEntityId = input<string | null>(null);\n\n /** Optional: provide file IDs to auto-fetch metadata for pre-existing files (edit mode). */\n existingFileIds = input<string[] | null>(null);\n\n /** Two-way model for completed file metadata. */\n files = model<FlyFileInfo[]>([]);\n\n // ── Outputs ──\n filesChanged = output<FlyFileInfo[]>();\n\n // ── State ──\n error = signal<string | null>(null);\n dragging = signal(false);\n slots = signal<UploadSlot[]>([]);\n\n /** Pre-existing files loaded from the entity (before any new uploads this session). */\n existingFiles = signal<FlyFileInfo[]>([]);\n\n fileInput = viewChild<ElementRef<HTMLInputElement>>('fileInput');\n\n constructor() {\n // Auto-fetch metadata for existing file IDs (edit mode)\n effect((onCleanup) => {\n const ids = this.existingFileIds();\n if (!ids?.length) return;\n\n const subs = ids.map(id =>\n this.http.get<{ data: FlyFileInfo }>(`/api/files/${id}`).subscribe({\n next: (res) => {\n const info = res.data ?? (res as any);\n if (info?.id) {\n this.existingFiles.update(list =>\n list.some(f => f.id === info.id) ? list : [...list, info]\n );\n this.files.update(list =>\n list.some(f => f.id === info.id) ? list : [...list, info]\n );\n }\n },\n })\n );\n onCleanup(() => subs.forEach(s => s.unsubscribe()));\n });\n }\n\n allSlots = computed(() => this.slots());\n\n canAddMore = computed(() => {\n const current = this.files().length + this.slots().filter(s => s.status === 'uploading').length;\n return current < this.maxFiles();\n });\n\n limitHint = computed(() => {\n const mb = this.maxFileSizeBytes() / (1024 * 1024);\n return `Max ${this.maxFiles()} files, ${mb}MB each`;\n });\n\n triggerFileInput(): void {\n this.fileInput()?.nativeElement.click();\n }\n\n onDragOver(e: DragEvent): void {\n e.preventDefault();\n e.stopPropagation();\n this.dragging.set(true);\n }\n\n onDragLeave(e: DragEvent): void {\n e.preventDefault();\n this.dragging.set(false);\n }\n\n onDrop(e: DragEvent): void {\n e.preventDefault();\n e.stopPropagation();\n this.dragging.set(false);\n const fileList = e.dataTransfer?.files;\n if (fileList) this.processFiles(Array.from(fileList));\n }\n\n onFilesSelected(e: Event): void {\n const input = e.target as HTMLInputElement;\n if (input.files) this.processFiles(Array.from(input.files));\n input.value = '';\n }\n\n removeSlot(slot: UploadSlot): void {\n this.slots.update(s => s.filter(x => x !== slot));\n if (slot.info) {\n this.files.update(f => f.filter(x => x.id !== slot.info!.id));\n this.filesChanged.emit(this.files());\n }\n }\n\n removeExisting(f: FlyFileInfo): void {\n this.existingFiles.update(list => list.filter(x => x.id !== f.id));\n this.files.update(list => list.filter(x => x.id !== f.id));\n this.filesChanged.emit(this.files());\n }\n\n iconFor(slot: UploadSlot): string { return iconForType(slot.file.type); }\n iconForInfo(f: FlyFileInfo): string { return iconForType(f.contentType); }\n formatFileSize(bytes: number): string { return formatSize(bytes); }\n\n private processFiles(newFiles: File[]): void {\n this.error.set(null);\n const currentCount = this.files().length + this.slots().filter(s => s.status === 'uploading').length;\n const remaining = this.maxFiles() - currentCount;\n\n if (remaining <= 0) {\n this.error.set(`Maximum ${this.maxFiles()} files allowed`);\n return;\n }\n\n const toUpload = newFiles.slice(0, remaining);\n if (newFiles.length > remaining) {\n this.error.set(`Only ${remaining} more file(s) can be added`);\n }\n\n for (const file of toUpload) {\n if (file.size > this.maxFileSizeBytes()) {\n const mb = this.maxFileSizeBytes() / (1024 * 1024);\n this.error.set(`\"${file.name}\" exceeds ${mb}MB limit`);\n continue;\n }\n this.uploadFile(file);\n }\n }\n\n private uploadFile(file: File): void {\n const slot: UploadSlot = { file, progress: 0, status: 'uploading' };\n this.slots.update(s => [...s, slot]);\n\n const formData = new FormData();\n formData.append('file', file, file.name);\n formData.append('sourceApp', this.sourceApp());\n if (this.sourceEntityType()) formData.append('sourceEntityType', this.sourceEntityType()!);\n if (this.sourceEntityId()) formData.append('sourceEntityId', this.sourceEntityId()!);\n\n this.http.post<{ data: FlyFileInfo }>('/api/files/upload', formData, {\n reportProgress: true,\n observe: 'events',\n }).subscribe({\n next: (event) => {\n if (event.type === HttpEventType.UploadProgress && event.total) {\n slot.progress = Math.round((event.loaded / event.total) * 100);\n this.slots.update(s => [...s]); // trigger signal change\n } else if (event.type === HttpEventType.Response) {\n const info = (event.body as any)?.data ?? event.body;\n slot.status = 'done';\n slot.progress = 100;\n slot.info = info;\n this.slots.update(s => [...s]);\n this.files.update(f => [...f, info]);\n this.filesChanged.emit(this.files());\n }\n },\n error: (err) => {\n slot.status = 'error';\n slot.error = err?.error?.message ?? 'Upload failed';\n this.slots.update(s => [...s]);\n },\n });\n }\n}\n","import { Injectable, Signal, computed, signal } from '@angular/core';\nimport type {\n AgentCommandHandle,\n AgentCommandRegistration,\n} from '../../models/agent-input.model';\n\n/**\n * Singleton registry of slash commands offered by the agent input palette.\n *\n * Lives in the DS so it crosses the federation boundary as a single instance via\n * `sharedMappings: ['@mohamedatia/fly-design-system']`. Federated remotes register\n * their commands at boot (and dispose on window close) without forking the shell.\n *\n * Storage is a signal store. `register` is O(1) for the unique-id case and O(n) when\n * replacing an existing id (filter then push). The append-then-replace strategy is\n * deliberate: registrations are rare (each one corresponds to a remote's app-init\n * effect), and the tradeoff buys us a stable id-collision contract — the *latest*\n * registration wins, and the previous handle's `dispose()` becomes a no-op rather\n * than removing the new entry.\n */\n@Injectable({ providedIn: 'root' })\nexport class AgentCommandRegistry {\n private readonly _commands = signal<readonly AgentCommandRegistration[]>([]);\n /** All currently-registered commands, in insertion order. */\n readonly all: Signal<readonly AgentCommandRegistration[]> = this._commands.asReadonly();\n\n /**\n * Returns a signal of commands whose scope is `'global'` OR whose `scope.appId` is in\n * the live app set. The signal recomputes when either the registry or `liveAppIds`\n * changes — pass a `Signal<ReadonlySet<string>>` from the host's app-registry service\n * for reactive filtering.\n */\n visible(liveAppIds: ReadonlySet<string> | Signal<ReadonlySet<string>>): Signal<readonly AgentCommandRegistration[]> {\n const liveSignal = isSignal<ReadonlySet<string>>(liveAppIds) ? liveAppIds : signal(liveAppIds).asReadonly();\n return computed(() => {\n const live = liveSignal();\n return this._commands().filter((cmd) => {\n if (cmd.scope === 'global') return true;\n return live.has(cmd.scope.appId);\n });\n });\n }\n\n /**\n * Register a single command. Returns a handle whose `dispose()` removes the row by\n * id. If the same id is later re-registered, the original handle's `dispose()`\n * becomes a no-op (the newer registration owns the row). Idempotent disposal.\n */\n register(cmd: AgentCommandRegistration): AgentCommandHandle {\n const generation = ++this._generation;\n this._commands.update((rows) => [...rows.filter((r) => r.id !== cmd.id), cmd]);\n this._owners.set(cmd.id, generation);\n return {\n dispose: () => {\n if (this._owners.get(cmd.id) === generation) {\n this._owners.delete(cmd.id);\n this._commands.update((rows) => rows.filter((r) => r.id !== cmd.id));\n }\n },\n };\n }\n\n /**\n * Bulk register. Rolls back on duplicate id within the input batch (throws before any\n * row lands). Cross-batch duplicates against existing rows follow the standard\n * \"latest wins\" rule and do NOT trigger rollback.\n *\n * Returns a handle whose `dispose()` tears down every row registered by this call.\n */\n registerAll(cmds: readonly AgentCommandRegistration[]): AgentCommandHandle {\n const seen = new Set<string>();\n for (const c of cmds) {\n if (seen.has(c.id)) {\n throw new Error(`AgentCommandRegistry.registerAll: duplicate id \"${c.id}\" in batch`);\n }\n seen.add(c.id);\n }\n const handles = cmds.map((c) => this.register(c));\n let disposed = false;\n return {\n dispose: () => {\n if (disposed) return;\n disposed = true;\n for (const h of handles) h.dispose();\n },\n };\n }\n\n /** Tear down by id. Idempotent. */\n unregister(id: string): void {\n if (this._owners.delete(id)) {\n this._commands.update((rows) => rows.filter((r) => r.id !== id));\n }\n }\n\n /** Monotonic counter; identifies which registration call currently owns each id. */\n private _generation = 0;\n /** id → generation. Used so a stale handle's `dispose()` is a no-op after replacement. */\n private readonly _owners = new Map<string, number>();\n}\n\n/** `isSignal` shim — narrows to either `Signal<T>` or a plain value. */\nfunction isSignal<T>(v: T | Signal<T>): v is Signal<T> {\n return typeof v === 'function';\n}\n","import { Injectable, Signal, Type, signal, type WritableSignal } from '@angular/core';\nimport type {\n AgentChipHostInputs,\n AgentCommandHandle,\n AgentDraggableItem,\n AgentDropRendererRegistration,\n} from '../../models/agent-input.model';\n\n/**\n * Singleton registry of chip-renderer components and keyboard-alternative draggable\n * items, keyed by `kind` and `appId`.\n *\n * Like {@link AgentCommandRegistry}, this lives in the DS so it crosses the federation\n * boundary as a single instance. Hosts (the shell `<fly-agent-input>`) lookup\n * renderers; remotes register them.\n *\n * Renderer lookup is `O(n)` over the registered list — the registry is small (one or\n * two entries per app) and lookups happen on drop, not per frame.\n *\n * Draggable storage is per-`appId` writable signal cached in a Map, so each `appId`\n * gets a stable {@link Signal} reference across reads (callers can `===`-compare).\n */\n@Injectable({ providedIn: 'root' })\nexport class AgentDropRegistry {\n private readonly _renderers = signal<readonly AgentDropRendererRegistration[]>([]);\n /** Per-appId writable store for draggables. Read-only mirror returned to callers. */\n private readonly _draggablesByApp = new Map<string, WritableSignal<readonly AgentDraggableItem[]>>();\n\n /**\n * Look up the chip-renderer component class for a `kind`. The newest registration for\n * a given `kind` wins, regardless of `appId` — we scan the list in reverse so a later\n * `register` call shadows an earlier one for the same `kind`.\n *\n * Returns `null` when no renderer is registered; the host falls back to a generic\n * `plainTextFallback` chip.\n */\n rendererFor(kind: string): Type<AgentChipHostInputs> | null {\n const list = this._renderers();\n for (let i = list.length - 1; i >= 0; i--) {\n if (list[i].kind === kind) return list[i].component as Type<AgentChipHostInputs>;\n }\n return null;\n }\n\n /**\n * Register a renderer for a `(kind, appId)` pair. Re-registering the same pair\n * replaces the prior entry; the disposal handle for the prior registration becomes\n * a no-op.\n *\n * Returns a {@link AgentCommandHandle} (re-used to keep the disposable shape uniform\n * across registries) whose `dispose()` removes this exact registration.\n */\n register<T = unknown>(reg: AgentDropRendererRegistration<T>): AgentCommandHandle {\n const generation = ++this._generation;\n const key = compositeKey(reg.kind, reg.appId);\n this._renderers.update((rows) => [\n ...rows.filter((r) => compositeKey(r.kind, r.appId) !== key),\n reg as AgentDropRendererRegistration,\n ]);\n this._owners.set(key, generation);\n return {\n dispose: () => {\n if (this._owners.get(key) === generation) {\n this._owners.delete(key);\n this._renderers.update((rows) => rows.filter((r) => compositeKey(r.kind, r.appId) !== key));\n }\n },\n };\n }\n\n /**\n * Apps publish their live \"draggable from focused window\" set so the keyboard\n * \"Attach from app…\" menu can offer them. Hosts call this each time the user-visible\n * draggable list changes; passing an empty array clears the entry for this `appId`.\n */\n publishDraggables(appId: string, items: readonly AgentDraggableItem[]): void {\n if (items.length === 0) {\n const existing = this._draggablesByApp.get(appId);\n if (existing) existing.set([]);\n return;\n }\n this.bucketFor(appId).set(items);\n }\n\n /**\n * Reactive read of the draggable set published for `appId`. Empty when none. The\n * returned signal is stable across calls (cached by `appId`), so consumers can use\n * it as a stable input to `computed()`.\n */\n draggablesFor(appId: string): Signal<readonly AgentDraggableItem[]> {\n return this.bucketFor(appId).asReadonly();\n }\n\n /** Lazy-init the per-appId writable bucket. Returns the writable handle for internal use. */\n private bucketFor(appId: string): WritableSignal<readonly AgentDraggableItem[]> {\n let bucket = this._draggablesByApp.get(appId);\n if (!bucket) {\n bucket = signal<readonly AgentDraggableItem[]>([]);\n this._draggablesByApp.set(appId, bucket);\n }\n return bucket;\n }\n\n private _generation = 0;\n private readonly _owners = new Map<string, number>();\n}\n\nfunction compositeKey(kind: string, appId: string): string {\n return `${kind}::${appId}`;\n}\n","import type { AgentDragPayload } from './agent-input.model';\n\n/**\n * Imperative action published by an app, consumed by the agent panel.\n *\n * Re-uses {@link AgentDragPayload} as the wire envelope so a dragged item\n * and a programmatic \"Explain\" click are byte-for-byte the same shape —\n * renderers, validators, and serialisation paths never fork on transport.\n *\n * Adding a verb is a minor DS bump (consumers ignore unknown verbs in\n * their `switch`). Removing one is a major DS bump.\n */\nexport type AgentActionVerb =\n | 'explain' // narrate what the payload shows in plain language\n | 'why-empty' // payload is an empty-result envelope; explain the gap\n | 'compose-query' // payload is a dataset schema; emit a DatasetQuery JSON\n | 'compare' // payload is { a, b }; compare them\n | 'forecast' // payload is a time series; project forward\n | 'summarize'; // payload is multiple envelopes; one-paragraph synthesis\n\n/**\n * Whether the agent panel sends the staged payload immediately or stages\n * the chip for the user to edit and send manually.\n *\n * Phase 1 (DS v2.6.0) supports `'stage'` only. Dispatching with `'auto'`\n * throws {@link AgentActionUnsupportedDispatchError} so callers don't\n * silently fail. `'auto'` lands once `AgentInputComponent.programmaticSubmit`\n * is exposed and reviewed against the input's state machine.\n */\nexport type AgentActionDispatch = 'auto' | 'stage';\n\nexport interface AgentAction<T = unknown> {\n /** Intent the agent should apply to {@link payload}. */\n readonly verb: AgentActionVerb;\n /** The wire envelope. Validated against {@link validateAgentPayload}'s\n * size caps before the bus fans it out. */\n readonly payload: AgentDragPayload<T>;\n /** Optional slash command id to bind before send (e.g. `'explain-report'`).\n * Phase 1 captures this for telemetry only — actual binding lands when\n * the input's programmatic-send API ships. An unknown id is dropped\n * silently with a console warning, the chip still arrives. */\n readonly autoCommandId?: string;\n /** Phase 1 supports `'stage'` only. See {@link AgentActionDispatch}. */\n readonly dispatch: AgentActionDispatch;\n /** Source DOM rect for the FLIP entry animation. Omit to skip the\n * animation (e.g. dispatching from a keyboard shortcut with no anchor). */\n readonly originRect?: DOMRect;\n /** Optional HTML snippet rendered inside the flight ghost. Callers are\n * responsible for escaping untrusted text — the bus does not sanitise.\n * Defaults (when omitted) to a strong-wrapped escape of the payload's\n * `plainTextFallback` rendered by the panel host. */\n readonly originPreviewHtml?: string;\n}\n\n/**\n * Thrown synchronously by {@link AgentActionBus.dispatch} when a caller\n * supplies a dispatch mode this DS version doesn't implement yet. Catching\n * by class name lets a forward-compatible caller fall back to `'stage'`\n * without depending on instanceof across federation boundaries.\n */\nexport class AgentActionUnsupportedDispatchError extends Error {\n constructor(public readonly dispatch: AgentActionDispatch) {\n super(`AgentActionBus: dispatch=\"${dispatch}\" not supported in this DS version`);\n this.name = 'AgentActionUnsupportedDispatchError';\n }\n}\n","import type { Type } from '@angular/core';\n\n/**\n * Agent input contracts.\n *\n * These types define the wire and DI surface for the new `<fly-agent-input>` orchestrator\n * (Phase 2+). Phase 1 ships only the contracts: payload envelope, command/drop registry\n * shapes, and chip-host inputs. The concrete components consume them later.\n *\n * Design rules:\n * - All fields are `readonly` — the registries store these in signal stores and we never\n * want a host mutating after registration. Hosts construct fresh objects to update.\n * - The discriminated kinds (`scope`, `mode`, `kind`) carry the entire variance — no\n * boolean flags. New variants extend the union without breaking existing consumers.\n * - The `Type<AgentChipHostInputs<T>>` shape is intentional: chip components declare\n * `payload`, `mode`, optional `onRemove` as Angular `input()` signals; the registry\n * wires them via `NgComponentOutlet` inputs in the consumer. The component reference\n * itself never leaks across the federation boundary by value — only by class identity.\n */\n\n/** Frozen MIME used by `flyAgentDraggable` and the drop-zone reader. Never change without a DS major. */\nexport const AGENT_DRAG_MIME = 'application/x-fly-agent-payload+json' as const;\n\n/**\n * Frozen payload envelope version.\n *\n * v1 — minimal drag payload: kind / appId / version / payload / plainTextFallback /\n * suggestedCommandIds. Still used by the drag/drop surface.\n *\n * v2 — bus envelope ({@link AgentMessageEnvelope}). Adds optional `userMessage`,\n * `systemContext`, `attachments`, `mcpScope` so a dispatcher can give the agent\n * rich context without polluting the user-visible message bubble. v2 is a\n * superset of v1 — every v1 payload is a valid v2 payload — so the version\n * number ratchets forward without breaking existing callers.\n */\nexport const AGENT_PAYLOAD_VERSION = 2 as const;\n\n/**\n * Versions accepted by the validator. v1 payloads (the drag/drop surface) remain valid;\n * v2 adds the optional bus-envelope fields. Renderers narrow on `version` when they need\n * to.\n */\nexport const SUPPORTED_AGENT_PAYLOAD_VERSIONS: readonly number[] = Object.freeze([1, 2]);\n\n// ─── Commands ───────────────────────────────────────────────────────────────\n\n/**\n * Where a command surfaces. `'global'` = always offered. `{ appId }` = offered only when\n * the host's live `liveAppIds` set (passed to {@link AgentCommandRegistry.visible}) contains\n * that id. This lets a remote register its slash command at boot but only have it appear\n * in the palette while at least one of the remote's windows is open.\n */\nexport type AgentCommandScope = 'global' | { readonly appId: string };\n\n/**\n * A slash command offered by the agent input palette. Commands are deliberately shallow\n * descriptors — the host (shell) decides what happens on Send. The descriptor's role is\n * to make the palette row renderable (icon, label, kbd hint, app badge) and matchable\n * (id, aliases, drop-kind suggestions) without coupling DS to any business logic.\n */\nexport interface AgentCommand {\n /** Stable id, kebab-case. Becomes the slash text after `/`, e.g. `/analyze-trend`. */\n readonly id: string;\n /** i18n key for the visible label, e.g. `agent.command.analyze_trend.label`. */\n readonly labelKey: string;\n /** i18n key for an optional sublabel / description shown beneath the label. */\n readonly descriptionKey?: string;\n /** PrimeIcons class, e.g. `pi-chart-line`. */\n readonly icon?: string;\n /** App badge label key — appears as a small tag, e.g. `agent.command.app_badge.circles`. */\n readonly appBadgeKey?: string;\n /** Optional kbd hint i18n key. */\n readonly kbdHintKey?: string;\n /** When the command is keyword-matched against drop payload kinds, list those kinds here. */\n readonly suggestForDropKinds?: readonly string[];\n /** Extra match terms beyond id + label, used by the fuzzy filter. */\n readonly aliases?: readonly string[];\n /** When `'send'`, the command is inserted as a bound prefix and executed on Send. */\n readonly executeOn: 'send';\n /** Optional client-side gate. Return false to hide the command in this scope. */\n readonly isVisible?: () => boolean;\n /**\n * Category B (PR3): when present, selecting this command invokes a\n * manifest-declared app skill instead of sending the composed text as a plain\n * message. The host dispatches a Twin message carrying\n * `system_context.slash_command_key = slashCommand.key` plus resolved context.\n * See {@link AgentCommandSlashSpec}.\n */\n readonly slashCommand?: AgentCommandSlashSpec;\n}\n\n/**\n * A context binding that resolves one `system_context` value for a Category B\n * command at dispatch. Pure data so it travels app-agnostically in the\n * Controller's app federation metadata (no callbacks). Discriminated by `from`:\n *\n * - `route` — value from the owning app's current route param `path`. The\n * shell cannot read a federated remote's internal route, so route\n * bindings **degrade** in v1 (the skill asks for the missing id);\n * resolved only once a remote→shell route channel exists.\n * - `lookup` — the host opens the `/lookup` entity picker for `entity` and\n * writes the picked id into `system_context[key]` (picker-during-\n * dispatch is a v1 follow-up — degrades to \"ask\" until then).\n * - `constant` — a literal value written into `system_context[key]`.\n */\nexport type AgentCommandContextBinding =\n | { readonly key: string; readonly from: 'route'; readonly path: string }\n | {\n readonly key: string;\n readonly from: 'lookup';\n readonly entity: string;\n readonly exclude?: readonly string[];\n readonly promptKey?: string;\n }\n | { readonly key: string; readonly from: 'constant'; readonly value: string };\n\n/**\n * Category B slash-command dispatch metadata (PR3). Travels app-agnostically in\n * the Controller's app federation metadata and is registered by the shell's\n * `RemoteManifestService` (the same path that registers `/lookup` descriptors) —\n * remotes do NOT self-register. When an {@link AgentCommand} carries this,\n * selecting it dispatches a Twin message with `system_context.slash_command_key\n * = key`, merged with the resolved `contextBindings`.\n */\nexport interface AgentCommandSlashSpec {\n /** Dispatched as `system_context.slash_command_key`; matches the agents-side\n * skill's `slash_command_key` (= its manifest_key). */\n readonly key: string;\n /** Reserved: a future confirm step before dispatch (manifest `requiresConfirmation`). */\n readonly requiresConfirmation?: boolean;\n /** Parameter sources resolved into `system_context` at dispatch. */\n readonly contextBindings?: readonly AgentCommandContextBinding[];\n}\n\n/** What hosts pass to {@link AgentCommandRegistry.register}. Adds the scope to {@link AgentCommand}. */\nexport interface AgentCommandRegistration extends AgentCommand {\n readonly scope: AgentCommandScope;\n}\n\n/** Disposable handle returned by {@link AgentCommandRegistry.register}. Idempotent `dispose()`. */\nexport interface AgentCommandHandle {\n dispose(): void;\n}\n\n// ─── Entity lookups (the `/lookup` typeahead) ─────────────────────────────────\n\n/**\n * How a lookup fetches candidate entities. The picker calls the app's existing\n * authenticated REST search endpoint (the same one the agent's MCP `*_list_brief`\n * tool wraps) through the shell's HttpClient — gateway routing + auth\n * interceptor apply. We deliberately do NOT route typeahead through MCP (agent-\n * shaped, agent-auth) or the dataset executor (aggregation-shaped, no fulltext).\n *\n * Field mapping is declarative because entities differ: Circles trends/signals\n * expose `/brief` endpoints returning `{ id, title, status }`, while scenarios\n * have no brief variant and return full objects with `titleEn` / `titleAr`. The\n * `displayField` / `secondaryField` indirection absorbs that per-entity skew so\n * one picker component serves them all.\n */\nexport interface LookupSearch {\n /**\n * Relative REST path the picker GETs, e.g. `/api/circles/trends/brief`. Must\n * be a relative path (no scheme/host) — the SSRF guard at onboard time (when\n * the descriptor is manifest-backed) and the picker both reject absolute URLs.\n */\n readonly endpoint: string;\n /** Query param carrying the typed text, e.g. `search`. */\n readonly queryParam: string;\n /** Static query params merged into every request, e.g. `{ pageSize: '10' }`. */\n readonly extraParams?: Readonly<Record<string, string>>;\n /** Response-item field holding the entity id. Default `id`. */\n readonly idField?: string;\n /** Response-item field holding the display label, e.g. `title` / `titleEn`. */\n readonly displayField: string;\n /** Optional response-item field for the chip's secondary line (status, category). */\n readonly secondaryField?: string;\n /**\n * Optional response-item field whose value is a *row-level* app id — i.e. the\n * app that owns this individual entity, distinct from the descriptor's\n * {@link LookupDescriptor.appId} (which only names the app exposing the\n * lookup endpoint). Help articles are the motivating case: every article is\n * exposed by `help-center`, but each one was seeded by a *source* app's\n * manifest (Circles, Trends, …). Surfacing that per-row appId lets the\n * picker render a second source-app tag so the user can tell two\n * similarly-titled rows from different source apps apart at a glance.\n *\n * Resolved through {@link LookupResult.appId} and the shell's app registry\n * with the same fallback chain used for {@link LookupDescriptor.appId}.\n */\n readonly appIdField?: string;\n /**\n * Dotted path to the results array within the response body when it is\n * wrapped, e.g. `items` for `{ items: [...], total }`. Omit when the response\n * body IS the array.\n */\n readonly resultsPath?: string;\n}\n\n/**\n * A lookupable entity offered by the `/lookup` palette. Registered by the owning\n * app (a federation remote self-registers at boot, mirroring {@link AgentCommand})\n * or, once manifest-backed, projected from the app's `lookups[]` manifest section.\n *\n * The descriptor is a shallow, business-logic-free descriptor: it tells the\n * picker WHAT to search, WHERE it is offered, and HOW to map the response — the\n * picker owns the typeahead UX, the shell owns the HTTP call.\n */\nexport interface LookupDescriptor {\n /**\n * Stable entity key, kebab/lower, e.g. `scenario`. Doubles as the `/lookup\n * <entity>` sub-token and the group key the picked ref is grouped under when\n * serialized for the agent.\n */\n readonly entity: string;\n /** i18n key for the entity's display name in the picker / palette. */\n readonly labelKey: string;\n /** Optional PrimeIcons class for the picker row + chip. */\n readonly icon?: string;\n /**\n * Stable id of the app that exposes this lookup, e.g. `notes`, `calendar`,\n * `circles`. The picker resolves it to the app's display name via the shell's\n * app registry and renders an \"exposed by …\" badge so the user can see which\n * app owns the entity they're browsing (helps disambiguate when two apps\n * register a similar-sounding entity, e.g. both Tasks and Notes one day).\n *\n * Populated automatically by the shell's registration paths:\n * - `CORE_APP_LOOKUPS` stamps it per descriptor at hand-edit time.\n * - `RemoteManifestService` stamps it from the manifest entry's `id` so\n * federation remotes don't have to repeat the id in every descriptor.\n *\n * Falls back to {@link appBadgeKey} (a locale-resolved literal) when an\n * entity has no first-class home in the shell's app registry — e.g. `user`,\n * `app-agent`, `robot`. When neither is set the picker omits the badge.\n */\n readonly appId?: string;\n /**\n * Optional i18n key the picker uses for the \"exposed by …\" badge **when\n * {@link appId} is absent or unknown to the shell's app registry**. Lets\n * entities that don't map to a single app (Users, Robots, App Agents) still\n * surface a meaningful badge instead of silently omitting it. The picker\n * resolves the key via the shared i18n service so the badge follows the\n * user's locale.\n */\n readonly appBadgeKey?: string;\n /**\n * Advisory MCP tool-key prefixes the agent should prefer when the user\n * references this entity via `/lookup` (e.g. `['dashboard.reports']`). The\n * shell folds these into the turn's `mcp_scope` so the Twin self-serves the\n * owning app's tools — fetching and analysing the referenced entity itself —\n * instead of defaulting to a specialist-Robot consult for \"tell me more\"\n * style prompts. Same dot-namespaced prefix vocabulary as\n * {@link AgentMcpScope.apis}. Omit for entities with no first-class MCP tool\n * family (e.g. `user`, `robot`).\n */\n readonly mcpApis?: readonly string[];\n /**\n * Optional in-app deep-link route TEMPLATE for this entity's detail page,\n * e.g. `'/signals/{id}'`. When present, the desktop shell turns an agent's\n * inline reference to this entity — the `flyos:<appId>.<entity>/<id>`\n * anchors the agents backend emits in chat answers — into a launchable\n * link: the single `{id}` placeholder is substituted with the referenced\n * entity's id (URL-encoded) and the owning {@link appId} is launched on\n * that route via the shell launcher.\n *\n * Omit for entities with no standalone detail page — their references then\n * render as plain text (graceful degrade; never a dead link). The owning\n * app declares this once in its `lookups[]` manifest entry, so a remote\n * becomes agent-deep-linkable without any shell or design-system change.\n * Only `{id}` is substituted here — richer parameterisation rides the\n * deep-link `params` channel, not this template.\n */\n readonly deepLinkRoute?: string;\n /** How to fetch + map candidates. */\n readonly search: LookupSearch;\n}\n\n/** What hosts pass to the lookup registry. Adds the scope to {@link LookupDescriptor}. */\nexport interface LookupRegistration extends LookupDescriptor {\n /**\n * Affinity hint, NOT a visibility gate.\n *\n * Unlike {@link AgentCommandScope} — where `{appId}` HIDES a command unless the\n * app is live — lookup scope is a *priority hint*. Every registered lookup is\n * always offered in `/lookup`; when the app named by `{appId}` is in the host's\n * live app set, that lookup sorts to the **top** of the entity picker so the\n * \"what am I working on right now?\" entities surface first. `'global'` lookups\n * have no affinity and sort after app-affinity matches.\n *\n * Rationale: OS-core entities (note, calendar event, file) are always\n * referenceable — there's no \"open the app first\" condition the way there is\n * for federated remotes — so a visibility gate would just produce a confusing\n * empty state. Affinity-as-sort preserves the \"Circles is open → prefer\n * scenarios/trends/signals\" intuition without hiding the rest.\n */\n readonly scope: AgentCommandScope;\n}\n\n/** One resolved row the picker returns once the user selects a candidate. */\nexport interface LookupResult {\n /** The entity kind (echoes {@link LookupDescriptor.entity}). */\n readonly entity: string;\n /** Selected entity id. */\n readonly id: string;\n /** Selected entity's display label. */\n readonly label: string;\n /** Optional secondary detail (status / category). */\n readonly secondary?: string;\n /**\n * Row-level source app id (e.g. `circles` for an article seeded by Circles'\n * manifest). Populated when the descriptor sets {@link LookupSearch.appIdField}\n * and the response item carries a non-empty value. The picker renders it as\n * a second app tag alongside the descriptor-level badge so the user can see\n * \"this Help-Center article was contributed by Circles\" without opening it.\n */\n readonly appId?: string;\n}\n\n/** Disposable handle returned by the lookup registry. Idempotent `dispose()`. */\nexport interface LookupHandle {\n dispose(): void;\n}\n\n// ─── Drag payloads ──────────────────────────────────────────────────────────\n\n/**\n * The wire envelope used by both the drag/drop surface and the imperative\n * {@link AgentActionBus}. Renderers narrow on `kind`; mismatches fall back to\n * `plainTextFallback`.\n *\n * The base fields (v1) describe **what** is being handed to the agent panel.\n * The v2 fields describe **how the agent should treat it** — `userMessage`\n * scopes the user-visible bubble, `systemContext` extends the system prompt,\n * `attachments` decorate the message with typed chips, and `mcpScope` hints\n * the agent toward a tool family. All v2 fields are optional so existing\n * v1 (drag/drop) payloads remain valid envelopes.\n *\n * Caps (see {@link AgentPayloadLimits}):\n * - JSON total 32 KB\n * - plainTextFallback 8 KB\n * - per-string field 4 KB\n * - userMessage 280 chars\n * - systemContext 32 entries × 4 KB per value, 8 KB total serialized\n * - attachments 4 entries, kind-dependent inner caps\n * - mcpScope.apis 5 prefixes × 128 chars\n *\n * The cap math is split per-section so an oversize attachment fails fast at the\n * attachment site instead of the whole envelope; field paths are dotted (see\n * {@link AgentPayloadValidationResult}).\n */\nexport interface AgentDragPayload<T = unknown> {\n /** Domain-stable kind, e.g. `circles.trend`. */\n readonly kind: string;\n /** Originating appId. Must match an entry in the host's app registry. */\n readonly appId: string;\n /** Frozen format version. Accepted: 1 or {@link AGENT_PAYLOAD_VERSION} (2). */\n readonly version: number;\n /** Domain object. Renderers narrow on `kind`. */\n readonly payload: T;\n /** Plain-text fallback written to the dataTransfer alongside the typed MIME. */\n readonly plainTextFallback: string;\n /** Optional command ids to highlight when this payload is dropped. */\n readonly suggestedCommandIds?: readonly string[];\n\n // ── v2 — bus envelope fields (all optional; ignored by drag/drop) ──────────\n\n /**\n * Short, locale-resolved string the dispatcher wants shown in the user's\n * chat bubble. The agent panel uses it as the visible message text; when\n * absent, the panel falls back to a generic per-verb default\n * (e.g. \"Tell me more about this\"). Cap 280 chars — chip-sized, not essay.\n *\n * This is the ONLY field that should ever surface to the user verbatim.\n * Everything else (systemContext, attachment bodies, mcpScope) is wire-only.\n */\n readonly userMessage?: string;\n\n /**\n * Flat key→string facts the dispatcher wants injected into the agent's\n * system prompt for this turn. Keys are dot-namespaced (e.g.\n * `chart.name`, `chart.type`, `chart.dimension`) to keep the model's\n * mental schema flat and grep-friendly. Values are strings — booleans,\n * numbers, and dates must be pre-serialized at the call site so the\n * dispatcher owns the formatting (timezone, locale, number style).\n *\n * Cap: 32 entries, 4 KB per value, 8 KB total when serialized.\n *\n * NOT user-visible. The agent panel may transiently embed this as an\n * `[Internal context]` block in the wire content while the backend\n * learns to consume the dedicated field, but never renders it in the\n * user bubble.\n */\n readonly systemContext?: Readonly<Record<string, string>>;\n\n /**\n * Typed attachments rendered as a chip strip under the user's outgoing\n * message bubble. Each entry has a `kind` discriminator and a `label`\n * (locale-resolved by the dispatcher). v2 ships `json` + `text`;\n * `image` and `file` are reserved — their interfaces are stable so\n * future callers don't need a contract bump, but the panel may render\n * a generic chip for them until per-kind renderers land.\n *\n * Cap: 4 entries per envelope. Per-kind body caps:\n * - json: 16 KB serialized\n * - text: 8 KB UTF-8\n * - image / file: dataUrl ≤ 32 KB (small previews; large media stays in\n * the files-manager and is referenced by id)\n */\n readonly attachments?: readonly AgentEnvelopeAttachment[];\n\n /**\n * Advisory MCP scope. The agent service injects these prefixes into the\n * system prompt as a tool-selection hint (\"prefer tools matching\n * `dashboard.reports.*` for this turn\") — NOT a hard filter. The agent\n * remains free to pick any tool; this just biases the first guess so a\n * dashboard explain doesn't waste a tool-call probing Notes APIs first.\n *\n * Cap: 5 prefixes × 128 chars. Prefixes should match gateway-aggregated\n * OpenAPI tag/path roots so they line up with the names the MCP server\n * exposes — see `src/backend/gateway` Swagger aggregation + the dynamic\n * loader in `src/backend/mcp-server`.\n */\n readonly mcpScope?: AgentMcpScope;\n\n /**\n * Optional deep-link route the originating app can use to re-open the\n * source object. When set, payload chips (and any other renderer that\n * surfaces the envelope to the user) become clickable — clicking calls\n * `ShellLauncherService.launch({ appId, route: deepLinkRoute })` so the\n * target app opens / focuses and navigates to the originating object.\n *\n * Shape constraints (mirror `DeepLinkService.isValidRoute`):\n * - starts with `/`\n * - ≤ {@link AgentPayloadLimits.maxDeepLinkRouteBytes} bytes (default\n * 1024) — matches the route limit on the wider shell deep-link\n * contract so this field can be handed straight to the launcher.\n * - no `..` segments\n * - no `//` runs\n * - no scheme-like prefixes (`/javascript:`, `/data:`, `/http:`, `/https:`)\n *\n * The DS validator enforces only the byte cap — full route syntax\n * validation is owned by the shell side (`DeepLinkService`) because the\n * DS package is shell-agnostic and shouldn't grow a second copy of the\n * URL grammar. Apps building envelopes are expected to stamp routes that\n * match their own internal route schema (e.g. dashboard publishes\n * `/reports/{id}` and `/custom/{id}`); see `skills/cross-app-deep-linking.md`.\n *\n * Backwards-compat: absent on v1 payloads and on v2 payloads built\n * before this field was added. Persisted JSONB chips without the field\n * remain non-clickable; new chips light up automatically.\n */\n readonly deepLinkRoute?: string;\n}\n\n/**\n * Canonical name for the bus-side envelope. v2 callers should reference this\n * over {@link AgentDragPayload} for clarity — the underlying shape is\n * identical, but the name signals \"this is going to the agent, not to a\n * drop zone.\" The alias is intentional: one wire shape, two semantic uses.\n */\nexport type AgentMessageEnvelope<T = unknown> = AgentDragPayload<T>;\n\n/**\n * Typed attachment discriminator for {@link AgentDragPayload.attachments}.\n *\n * - `json` — structured data the panel renders as a \"code-ish\" chip the\n * user can expand. Used for chart snapshots, query results, etc.\n * - `text` — short utterance / excerpt with optional MIME. Used when the\n * dispatcher wants the chip to preview a note paragraph, log line,\n * code snippet, etc.\n * - `image` / `file` — reserved. Stable interface; renderers added per\n * downstream caller (the panel may fall back to a generic icon-chip).\n *\n * Every kind carries `label` — that's what shows on the chip face and what\n * a11y trees announce.\n */\nexport type AgentEnvelopeAttachment =\n | {\n readonly kind: 'json';\n readonly label: string;\n readonly json: unknown;\n }\n | {\n readonly kind: 'text';\n readonly label: string;\n readonly text: string;\n readonly mimeType?: string;\n }\n | {\n readonly kind: 'image';\n readonly label: string;\n /** `data:` URL — small previews only. Large media stays in files-manager. */\n readonly dataUrl: string;\n readonly mimeType: string;\n }\n | {\n readonly kind: 'file';\n readonly label: string;\n readonly dataUrl: string;\n readonly mimeType: string;\n readonly bytes: number;\n };\n\n/** Advisory tool-selection hint for {@link AgentDragPayload.mcpScope}. */\nexport interface AgentMcpScope {\n /**\n * Prefixes of gateway-aggregated OpenAPI tags / path roots — e.g.\n * `dashboard.reports`, `notes.documents`. The agent service treats these\n * as a soft preference, not a hard filter.\n */\n readonly apis: readonly string[];\n}\n\n/**\n * Where a chip is being rendered. `inline` = inside the input chip tray (removable);\n * `message` = embedded in a sent message bubble (not removable).\n */\nexport type AgentDropChipMode = 'inline' | 'message';\n\n/**\n * Public input shape for chip-renderer components. Components declare matching\n * `input()` signals; the registry wires them via `NgComponentOutlet`.\n */\nexport interface AgentChipHostInputs<T = unknown> {\n payload: AgentDragPayload<T>;\n mode: AgentDropChipMode;\n /** Called when the user clicks the chip's remove control (only in inline mode). */\n onRemove?: () => void;\n}\n\n/**\n * Keyboard-alternative draggable item. Hosts publish these via\n * {@link AgentDropRegistry.publishDraggables} so the \"Attach from app…\" menu can offer\n * them when pointer drag isn't available.\n */\nexport interface AgentDraggableItem<T = unknown> {\n /** Stable id within its app. Used as a list key in the kbd menu. */\n readonly id: string;\n readonly labelKey: string;\n readonly icon?: string;\n /** Builds the payload the moment the user picks the item. */\n build(): AgentDragPayload<T>;\n}\n\n/** Registry input shape for binding a chip-renderer component to a kind+appId pair. */\nexport interface AgentDropRendererRegistration<T = unknown> {\n readonly kind: string;\n readonly appId: string;\n readonly component: Type<AgentChipHostInputs<T>>;\n}\n\n// ─── Payload guards ─────────────────────────────────────────────────────────\n\n/**\n * Caps applied by {@link validateAgentPayload} / {@link trimAgentPayload}. The defaults\n * trade off \"fits comfortably in a single MQ frame\" against \"covers a richly-populated\n * trend or note card\". Hosts may pass a partial override.\n */\nexport interface AgentPayloadLimits {\n /** Cap on the JSON.stringify(envelope) byte length. Default 32 KB. */\n readonly maxJsonBytes: number;\n /** Cap on the plainTextFallback byte length. Default 8 KB. */\n readonly maxPlainTextFallbackBytes: number;\n /** Cap on any single string field inside payload (recursive). Default 4 KB. */\n readonly maxStringFieldBytes: number;\n\n // ── v2 — bus envelope caps ────────────────────────────────────────────────\n\n /** Cap on `userMessage` UTF-8 byte length. Default 280 chars (~1.1 KB). */\n readonly maxUserMessageBytes: number;\n /** Max entries in `systemContext`. Default 32. */\n readonly maxSystemContextEntries: number;\n /** Cap on any single systemContext value's UTF-8 byte length. Default 4 KB. */\n readonly maxSystemContextValueBytes: number;\n /** Cap on the full JSON.stringify(systemContext). Default 8 KB. */\n readonly maxSystemContextJsonBytes: number;\n /** Max attachments per envelope. Default 4. */\n readonly maxAttachments: number;\n /** Cap on a `json` attachment's serialized body. Default 16 KB. */\n readonly maxAttachmentJsonBytes: number;\n /** Cap on a `text` attachment's body bytes. Default 8 KB. */\n readonly maxAttachmentTextBytes: number;\n /** Cap on an `image` / `file` attachment's dataUrl bytes. Default 32 KB. */\n readonly maxAttachmentDataUrlBytes: number;\n /** Max prefixes in `mcpScope.apis`. Default 5. */\n readonly maxMcpScopeApis: number;\n /** Cap on any single mcpScope prefix string. Default 128 chars. */\n readonly maxMcpScopeApiBytes: number;\n /**\n * Cap on `deepLinkRoute` UTF-8 byte length. Default 1024 bytes — matches\n * the route limit on `DeepLinkService.isValidRoute` so this field can be\n * handed straight to the shell launcher without a second resize.\n */\n readonly maxDeepLinkRouteBytes: number;\n}\n\nexport const DEFAULT_AGENT_PAYLOAD_LIMITS: AgentPayloadLimits = Object.freeze({\n maxJsonBytes: 32 * 1024,\n maxPlainTextFallbackBytes: 8 * 1024,\n maxStringFieldBytes: 4 * 1024,\n maxUserMessageBytes: 280 * 4, // 280 chars × 4 bytes/char worst-case UTF-8\n maxSystemContextEntries: 32,\n maxSystemContextValueBytes: 4 * 1024,\n maxSystemContextJsonBytes: 8 * 1024,\n maxAttachments: 4,\n maxAttachmentJsonBytes: 16 * 1024,\n maxAttachmentTextBytes: 8 * 1024,\n maxAttachmentDataUrlBytes: 32 * 1024,\n maxMcpScopeApis: 5,\n maxMcpScopeApiBytes: 128,\n maxDeepLinkRouteBytes: 1024,\n});\n\n/**\n * Stable failure reasons emitted by {@link validateAgentPayload}.\n * - `invalid_version` — `version` !== {@link AGENT_PAYLOAD_VERSION}.\n * - `invalid_kind` — `kind` is empty / not a string.\n * - `field_too_large` — a string field inside `payload` exceeds `maxStringFieldBytes`.\n * - `fallback_too_large` — `plainTextFallback` exceeds `maxPlainTextFallbackBytes`.\n * - `json_too_large` — the full JSON.stringify(envelope) exceeds `maxJsonBytes`.\n */\nexport type AgentPayloadValidationResult =\n | { readonly ok: true }\n | {\n readonly ok: false;\n readonly reason:\n | 'json_too_large'\n | 'fallback_too_large'\n | 'field_too_large'\n | 'invalid_version'\n | 'invalid_kind'\n // v2:\n | 'user_message_too_large'\n | 'system_context_too_many_entries'\n | 'system_context_value_too_large'\n | 'system_context_json_too_large'\n | 'too_many_attachments'\n | 'attachment_invalid_kind'\n | 'attachment_json_too_large'\n | 'attachment_text_too_large'\n | 'attachment_data_url_too_large'\n | 'mcp_scope_too_many_apis'\n | 'mcp_scope_api_too_large'\n | 'deep_link_route_too_large'\n | 'deep_link_route_invalid_shape';\n /** Dotted property-access path to the offending field, e.g. `payload.title` or `payload.tags[2]`. NOT RFC 6901 JSON Pointer. */\n readonly fieldPath?: string;\n readonly actualBytes?: number;\n readonly limitBytes?: number;\n };\n","import {\n DEFAULT_AGENT_PAYLOAD_LIMITS,\n SUPPORTED_AGENT_PAYLOAD_VERSIONS,\n type AgentDragPayload,\n type AgentEnvelopeAttachment,\n type AgentPayloadLimits,\n type AgentPayloadValidationResult,\n} from '../models/agent-input.model';\n\n/**\n * Pure utility helpers for agent drag payload size guarding.\n *\n * Used by `flyAgentDraggable` at `dragstart` (Phase 2) and by app pre-flight code that\n * wants a clean payload before constructing the directive input. No Angular DI, no\n * runtime side effects — safe to import from anywhere.\n *\n * Performance notes:\n * - The `TextEncoder` is lazily allocated and cached. The constructor runs once per\n * module instance even under federation (singleton DS).\n * - String trimming uses `Intl.Segmenter` when available (all evergreen browsers\n * including Safari 14.1+) so we cut on grapheme boundaries — emoji ZWJ sequences,\n * combining marks, regional indicator pairs all stay intact. Fallback is\n * UTF-16 code-unit slice, which is a graceful degradation: it can split a\n * surrogate pair, but the resulting JSON is still syntactically valid and\n * downstream renderers handle the replacement char.\n */\n\n/**\n * Thrown by {@link trimAgentPayload} when even a fully string-trimmed envelope still\n * exceeds `maxJsonBytes` (e.g. an envelope with thousands of nested empty objects /\n * array entries / property keys). Subclasses `RangeError` so callers using the standard\n * `instanceof RangeError` check still match, while exposing the structured fields\n * (`actualBytes`, `limitBytes`, `reason: 'json_too_large'`) needed for telemetry and\n * symmetric handling with {@link AgentPayloadValidationResult} failures.\n */\nexport class AgentPayloadOversizeError extends RangeError {\n readonly reason = 'json_too_large' as const;\n constructor(\n message: string,\n readonly actualBytes: number,\n readonly limitBytes: number,\n ) {\n super(message);\n this.name = 'AgentPayloadOversizeError';\n }\n}\n\n/** Cap on the dotted `fieldPath` string so a 10 MB property-key payload can't lock dev tools when `console.warn`d. */\nconst FIELD_PATH_MAX_CHARS = 256;\n\n/** Append a path segment, capping the result at {@link FIELD_PATH_MAX_CHARS} chars (with `…` marker). */\nfunction appendPath(base: string, segment: string): string {\n const next = base + segment;\n if (next.length <= FIELD_PATH_MAX_CHARS) return next;\n return next.slice(0, FIELD_PATH_MAX_CHARS - 1) + '…';\n}\n\nlet _cachedEncoder: TextEncoder | null = null;\nfunction getEncoder(): TextEncoder {\n return (_cachedEncoder ??= new TextEncoder());\n}\n\n/** UTF-8 byte length of `s`. Cheap; cached encoder. */\nexport function utf8ByteLength(s: string): number {\n return getEncoder().encode(s).length;\n}\n\n/**\n * Trim `input` so the UTF-8 byte length of the result is `<= maxBytes`. When trimming\n * occurs, append `ellipsis` (default `…`, U+2026) — its bytes are included in the cap.\n *\n * Idempotent: `trimAgentString(trimAgentString(s, n), n)` equals `trimAgentString(s, n)`.\n *\n * Edge cases:\n * - `maxBytes` shorter than the ellipsis itself returns an empty string.\n * - `Intl.Segmenter` (when present) ensures we never split a grapheme cluster.\n * - When the encoded length is already within the cap, returns `input` unchanged.\n */\nexport function trimAgentString(input: string, maxBytes: number, ellipsis = '…'): string {\n if (maxBytes <= 0) return '';\n const enc = getEncoder();\n const inputLen = enc.encode(input).length;\n if (inputLen <= maxBytes) return input;\n\n const ellipsisLen = enc.encode(ellipsis).length;\n if (maxBytes < ellipsisLen) return '';\n const budget = maxBytes - ellipsisLen;\n\n // Segmenter path: walk graphemes, accumulate until next would overflow.\n const segmenterCtor =\n typeof Intl !== 'undefined' && (Intl as unknown as { Segmenter?: typeof Intl.Segmenter }).Segmenter;\n if (segmenterCtor) {\n const segmenter = new segmenterCtor(undefined, { granularity: 'grapheme' });\n let used = 0;\n let acc = '';\n for (const seg of segmenter.segment(input)) {\n const segLen = enc.encode(seg.segment).length;\n if (used + segLen > budget) break;\n acc += seg.segment;\n used += segLen;\n }\n return acc + ellipsis;\n }\n\n // Fallback: code-unit slice; verify byte length and shrink until under budget.\n let cut = input.length;\n while (cut > 0 && enc.encode(input.slice(0, cut)).length > budget) {\n cut--;\n }\n return input.slice(0, cut) + ellipsis;\n}\n\n/**\n * Validate an {@link AgentDragPayload} against the supplied limits (or\n * {@link DEFAULT_AGENT_PAYLOAD_LIMITS} when omitted). Returns `{ ok: true }` or a\n * structured failure with the offending field path and byte counts.\n *\n * Order of checks (cheap → expensive):\n * 1. `version` is in {@link SUPPORTED_AGENT_PAYLOAD_VERSIONS}.\n * 2. `kind` is a non-empty string.\n * 3. `plainTextFallback` fits its cap.\n * 4. Every string in `payload` (recursively) fits the per-field cap.\n * 5. v2 sections — `userMessage`, `systemContext`, `attachments`, `mcpScope` —\n * each fits their independent caps. Skipped when absent so v1 payloads pass\n * unchanged.\n * 6. The full `JSON.stringify(envelope)` fits the JSON cap.\n *\n * The walker stops on the first oversize string field — the intent is to surface\n * actionable feedback, not enumerate every offender.\n */\nexport function validateAgentPayload(\n payload: AgentDragPayload<unknown>,\n limits?: Partial<AgentPayloadLimits>,\n): AgentPayloadValidationResult {\n const eff: AgentPayloadLimits = { ...DEFAULT_AGENT_PAYLOAD_LIMITS, ...(limits ?? {}) };\n\n if (!SUPPORTED_AGENT_PAYLOAD_VERSIONS.includes(payload.version)) {\n return { ok: false, reason: 'invalid_version' };\n }\n if (typeof payload.kind !== 'string' || payload.kind.length === 0) {\n return { ok: false, reason: 'invalid_kind' };\n }\n\n const fbBytes = utf8ByteLength(payload.plainTextFallback ?? '');\n if (fbBytes > eff.maxPlainTextFallbackBytes) {\n return {\n ok: false,\n reason: 'fallback_too_large',\n fieldPath: 'plainTextFallback',\n actualBytes: fbBytes,\n limitBytes: eff.maxPlainTextFallbackBytes,\n };\n }\n\n const fieldFailure = walkStringsForOverage(payload.payload, 'payload', eff.maxStringFieldBytes);\n if (fieldFailure) return fieldFailure;\n\n // v2 — per-section caps. Each helper is a no-op when its section is absent\n // so a v1 payload (no userMessage / systemContext / attachments / mcpScope /\n // deepLinkRoute) sails through unchanged.\n const v2Failure =\n checkUserMessage(payload, eff) ??\n checkSystemContext(payload, eff) ??\n checkAttachments(payload, eff) ??\n checkMcpScope(payload, eff) ??\n checkDeepLinkRoute(payload, eff);\n if (v2Failure) return v2Failure;\n\n const json = safeStringify(payload);\n const jsonBytes = utf8ByteLength(json);\n if (jsonBytes > eff.maxJsonBytes) {\n return {\n ok: false,\n reason: 'json_too_large',\n actualBytes: jsonBytes,\n limitBytes: eff.maxJsonBytes,\n };\n }\n\n return { ok: true };\n}\n\n// ─── v2 section validators ──────────────────────────────────────────────────\n\nfunction checkUserMessage(\n payload: AgentDragPayload<unknown>,\n eff: AgentPayloadLimits,\n): AgentPayloadValidationResult | null {\n if (payload.userMessage === undefined) return null;\n if (typeof payload.userMessage !== 'string') return null; // structural; ts catches at the call site\n const bytes = utf8ByteLength(payload.userMessage);\n if (bytes > eff.maxUserMessageBytes) {\n return {\n ok: false,\n reason: 'user_message_too_large',\n fieldPath: 'userMessage',\n actualBytes: bytes,\n limitBytes: eff.maxUserMessageBytes,\n };\n }\n return null;\n}\n\nfunction checkSystemContext(\n payload: AgentDragPayload<unknown>,\n eff: AgentPayloadLimits,\n): AgentPayloadValidationResult | null {\n const ctx = payload.systemContext;\n if (!ctx) return null;\n const keys = Object.keys(ctx);\n if (keys.length > eff.maxSystemContextEntries) {\n return {\n ok: false,\n reason: 'system_context_too_many_entries',\n fieldPath: 'systemContext',\n actualBytes: keys.length,\n limitBytes: eff.maxSystemContextEntries,\n };\n }\n for (const k of keys) {\n const v = ctx[k];\n if (typeof v !== 'string') continue;\n const bytes = utf8ByteLength(v);\n if (bytes > eff.maxSystemContextValueBytes) {\n return {\n ok: false,\n reason: 'system_context_value_too_large',\n fieldPath: `systemContext.${k}`,\n actualBytes: bytes,\n limitBytes: eff.maxSystemContextValueBytes,\n };\n }\n }\n const ctxJsonBytes = utf8ByteLength(safeStringify(ctx));\n if (ctxJsonBytes > eff.maxSystemContextJsonBytes) {\n return {\n ok: false,\n reason: 'system_context_json_too_large',\n fieldPath: 'systemContext',\n actualBytes: ctxJsonBytes,\n limitBytes: eff.maxSystemContextJsonBytes,\n };\n }\n return null;\n}\n\nfunction checkAttachments(\n payload: AgentDragPayload<unknown>,\n eff: AgentPayloadLimits,\n): AgentPayloadValidationResult | null {\n const atts = payload.attachments;\n if (!atts) return null;\n if (atts.length > eff.maxAttachments) {\n return {\n ok: false,\n reason: 'too_many_attachments',\n fieldPath: 'attachments',\n actualBytes: atts.length,\n limitBytes: eff.maxAttachments,\n };\n }\n for (let i = 0; i < atts.length; i++) {\n const a = atts[i] as AgentEnvelopeAttachment;\n const path = `attachments[${i}]`;\n switch (a.kind) {\n case 'json': {\n const bytes = utf8ByteLength(safeStringify(a.json));\n if (bytes > eff.maxAttachmentJsonBytes) {\n return {\n ok: false,\n reason: 'attachment_json_too_large',\n fieldPath: `${path}.json`,\n actualBytes: bytes,\n limitBytes: eff.maxAttachmentJsonBytes,\n };\n }\n break;\n }\n case 'text': {\n const bytes = utf8ByteLength(a.text ?? '');\n if (bytes > eff.maxAttachmentTextBytes) {\n return {\n ok: false,\n reason: 'attachment_text_too_large',\n fieldPath: `${path}.text`,\n actualBytes: bytes,\n limitBytes: eff.maxAttachmentTextBytes,\n };\n }\n break;\n }\n case 'image':\n case 'file': {\n const bytes = utf8ByteLength(a.dataUrl ?? '');\n if (bytes > eff.maxAttachmentDataUrlBytes) {\n return {\n ok: false,\n reason: 'attachment_data_url_too_large',\n fieldPath: `${path}.dataUrl`,\n actualBytes: bytes,\n limitBytes: eff.maxAttachmentDataUrlBytes,\n };\n }\n break;\n }\n default:\n return {\n ok: false,\n reason: 'attachment_invalid_kind',\n fieldPath: `${path}.kind`,\n };\n }\n }\n return null;\n}\n\n/**\n * Validate `deepLinkRoute` — byte cap + minimal shape sanity check.\n *\n * The DS package is shell-agnostic, so full route grammar validation\n * (scheme prefixes, `..` segments, `//` runs) lives in the shell's\n * `DeepLinkService.isValidRoute` — the launcher is the authoritative\n * gate. Here we just enforce:\n * - byte cap so a malicious payload can't bloat the JSON\n * - must start with `/` so the value matches the launcher's contract\n * and a renderer can safely concatenate / display it.\n *\n * Anything more would force the DS to grow a second copy of the route\n * grammar; the launcher rejects malformed routes at click time so the\n * worst-case impact of a bad route landing here is a no-op click.\n */\nfunction checkDeepLinkRoute(\n payload: AgentDragPayload<unknown>,\n eff: AgentPayloadLimits,\n): AgentPayloadValidationResult | null {\n const route = payload.deepLinkRoute;\n if (route === undefined) return null;\n if (typeof route !== 'string') return null; // structural; ts catches at the call site\n if (!route.startsWith('/')) {\n return {\n ok: false,\n reason: 'deep_link_route_invalid_shape',\n fieldPath: 'deepLinkRoute',\n };\n }\n const bytes = utf8ByteLength(route);\n if (bytes > eff.maxDeepLinkRouteBytes) {\n return {\n ok: false,\n reason: 'deep_link_route_too_large',\n fieldPath: 'deepLinkRoute',\n actualBytes: bytes,\n limitBytes: eff.maxDeepLinkRouteBytes,\n };\n }\n return null;\n}\n\nfunction checkMcpScope(\n payload: AgentDragPayload<unknown>,\n eff: AgentPayloadLimits,\n): AgentPayloadValidationResult | null {\n const scope = payload.mcpScope;\n if (!scope) return null;\n const apis = scope.apis ?? [];\n if (apis.length > eff.maxMcpScopeApis) {\n return {\n ok: false,\n reason: 'mcp_scope_too_many_apis',\n fieldPath: 'mcpScope.apis',\n actualBytes: apis.length,\n limitBytes: eff.maxMcpScopeApis,\n };\n }\n for (let i = 0; i < apis.length; i++) {\n const bytes = utf8ByteLength(apis[i]);\n if (bytes > eff.maxMcpScopeApiBytes) {\n return {\n ok: false,\n reason: 'mcp_scope_api_too_large',\n fieldPath: `mcpScope.apis[${i}]`,\n actualBytes: bytes,\n limitBytes: eff.maxMcpScopeApiBytes,\n };\n }\n }\n return null;\n}\n\n/**\n * Returns a NEW payload with all string fields trimmed to fit the per-field cap, the\n * `plainTextFallback` trimmed to its cap, and the full envelope re-checked against the\n * JSON cap. Idempotent — a second call against the trimmed result yields equal output.\n *\n * Throws {@link AgentPayloadOversizeError} only if even an empty trim couldn't shrink it\n * under the cap (e.g. an envelope with 1000+ nested empty objects). The error subclasses\n * `RangeError`, so legacy `instanceof RangeError` checks still match. Apps that hit this\n * should re-shape `payload` rather than call again.\n */\nexport function trimAgentPayload<T>(\n payload: AgentDragPayload<T>,\n limits?: Partial<AgentPayloadLimits>,\n): AgentDragPayload<T> {\n const eff: AgentPayloadLimits = { ...DEFAULT_AGENT_PAYLOAD_LIMITS, ...(limits ?? {}) };\n\n const trimmedFallback = trimAgentString(payload.plainTextFallback ?? '', eff.maxPlainTextFallbackBytes);\n const trimmedPayload = mapStrings(payload.payload, (s) => trimAgentString(s, eff.maxStringFieldBytes)) as T;\n\n const next: AgentDragPayload<T> = {\n ...payload,\n plainTextFallback: trimmedFallback,\n payload: trimmedPayload,\n };\n\n const jsonBytes = utf8ByteLength(safeStringify(next));\n if (jsonBytes > eff.maxJsonBytes) {\n throw new AgentPayloadOversizeError(\n `AgentDragPayload exceeds maxJsonBytes (${jsonBytes} > ${eff.maxJsonBytes}) after string trimming. Re-shape the payload.`,\n jsonBytes,\n eff.maxJsonBytes,\n );\n }\n return next;\n}\n\n// ─── Internal helpers ───────────────────────────────────────────────────────\n\n/**\n * Recursively walks `value`, returning the first string field that exceeds `maxBytes`\n * (as a structured failure). Returns `null` when every string fits.\n *\n * Path uses dotted property-access notation: `payload.body`, `payload.tags[2]`. Cycles\n * are detected via a WeakSet so attacker-crafted self-references don't loop forever.\n * Path strings are capped at {@link FIELD_PATH_MAX_CHARS} characters via {@link appendPath}\n * to prevent a malicious payload with multi-MB property keys from producing a multi-MB\n * `fieldPath` that locks up dev tools when logged.\n */\nfunction walkStringsForOverage(\n value: unknown,\n path: string,\n maxBytes: number,\n seen: WeakSet<object> = new WeakSet(),\n): AgentPayloadValidationResult | null {\n if (typeof value === 'string') {\n const bytes = utf8ByteLength(value);\n if (bytes > maxBytes) {\n return {\n ok: false,\n reason: 'field_too_large',\n fieldPath: path,\n actualBytes: bytes,\n limitBytes: maxBytes,\n };\n }\n return null;\n }\n if (value === null || typeof value !== 'object') return null;\n if (seen.has(value as object)) return null;\n seen.add(value as object);\n\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const r = walkStringsForOverage(value[i], appendPath(path, `[${i}]`), maxBytes, seen);\n if (r) return r;\n }\n return null;\n }\n for (const [k, v] of Object.entries(value as Record<string, unknown>)) {\n const r = walkStringsForOverage(v, appendPath(path, `.${k}`), maxBytes, seen);\n if (r) return r;\n }\n return null;\n}\n\n/**\n * Recursively maps every string leaf via `fn`, preserving object/array structure.\n * Cycles are short-circuited to `null` rather than throwing — the caller already\n * has a JSON.stringify cap that will catch any pathological input.\n */\nfunction mapStrings(value: unknown, fn: (s: string) => string, seen: WeakSet<object> = new WeakSet()): unknown {\n if (typeof value === 'string') return fn(value);\n if (value === null || typeof value !== 'object') return value;\n if (seen.has(value as object)) return null;\n seen.add(value as object);\n\n if (Array.isArray(value)) {\n return value.map((v) => mapStrings(v, fn, seen));\n }\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(value as Record<string, unknown>)) {\n out[k] = mapStrings(v, fn, seen);\n }\n return out;\n}\n\n/** `JSON.stringify` with a cycle-safe replacer — defends against attacker-crafted graphs. */\nfunction safeStringify(value: unknown): string {\n const seen = new WeakSet<object>();\n return JSON.stringify(value, (_k, v) => {\n if (v !== null && typeof v === 'object') {\n if (seen.has(v as object)) return '[Circular]';\n seen.add(v as object);\n }\n return v;\n });\n}\n","import { Injectable, signal } from '@angular/core';\nimport { Observable, Subject } from 'rxjs';\nimport type { AgentAction } from '../../models/agent-action.model';\nimport { AgentActionUnsupportedDispatchError } from '../../models/agent-action.model';\nimport { validateAgentPayload } from '../../utils/agent-payload-guards';\n\n/**\n * Imperative sibling to {@link AgentCommandRegistry} / {@link AgentDropRegistry}.\n *\n * Apps call {@link dispatch} to push a typed {@link AgentAction} onto the bus;\n * the agent panel subscribes once at construct and routes by verb. The bus\n * itself is a thin pass-through — it does NOT decide UI behaviour. The\n * subscriber (agent-panel) owns: showing the panel, staging the chip,\n * triggering the flight animation, and binding the command. This keeps the\n * DS free of host policy.\n *\n * Federation-safe: `providedIn: 'root'` + `sharedMappings: ['@mohamedatia/fly-design-system']`\n * give every federated remote the same singleton, so a remote's \"Explain\"\n * button reaches the host's panel without any cross-bundle wiring.\n *\n * Validation runs synchronously inside `dispatch` so a caller that sends an\n * oversize payload sees the throw at their site, not on the subscriber. The\n * subscriber therefore never has to defend against malformed envelopes.\n */\n@Injectable({ providedIn: 'root' })\nexport class AgentActionBus {\n private readonly _actions$ = new Subject<AgentAction>();\n /** Hot stream of actions in dispatch order. Subscribers receive only\n * actions dispatched AFTER they subscribe — late subscribers see nothing\n * retroactively. Use {@link lastAction} for the latest snapshot. */\n readonly actions$: Observable<AgentAction> = this._actions$.asObservable();\n\n /** Most recent action — for DevTools, smoke tests, and late-subscriber\n * catch-up. Null until the first successful dispatch. */\n readonly lastAction = signal<AgentAction | null>(null);\n\n /**\n * The action currently being processed by the subscriber, or null when\n * none. Set by {@link dispatch} immediately before emitting on\n * {@link actions$}; cleared by the subscriber via {@link settle} once\n * it finishes its handler (success or fail). Lets the dispatcher render\n * a busy state on the originating control — e.g. a card swapping its\n * sparkle icon for a spinner while the agent panel mints the optimistic\n * thread and starts the request. Identity check (`bus.inFlight() === act`)\n * is the panel-side contract; dispatchers usually project to a stable id\n * inside the payload (e.g. <c>reportId</c>) to scope busy-state visually.\n *\n * If multiple dispatches race, the latest wins — the prior in-flight\n * action is dropped on the floor here (the panel may still handle it,\n * but the dispatcher's busy indicator follows the newer action). Apps\n * that need stricter single-flight semantics should guard at the call\n * site (the agent-panel's <c>_pendingTempThreadId</c> already does so\n * for the explain verb).\n */\n readonly inFlight = signal<AgentAction | null>(null);\n\n /**\n * Push an action onto the bus.\n *\n * Throws synchronously when:\n * - `dispatch === 'auto'` (not implemented in this DS version) — see\n * {@link AgentActionUnsupportedDispatchError}.\n * - the payload fails {@link validateAgentPayload} (oversize, invalid\n * version, invalid kind). The error message carries the field path\n * so the caller can fix the offending field.\n *\n * Subscribers see the action via {@link actions$} on the next tick of\n * the Subject; the {@link lastAction} signal updates synchronously\n * before the Subject emits so an effect reading both stays consistent.\n */\n dispatch<T>(action: AgentAction<T>): void {\n if (action.dispatch === 'auto') {\n throw new AgentActionUnsupportedDispatchError(action.dispatch);\n }\n const v = validateAgentPayload(action.payload);\n if (!v.ok) {\n const where = v.fieldPath ? ` at ${v.fieldPath}` : '';\n throw new Error(\n `AgentActionBus.dispatch: invalid payload — ${v.reason}${where}`,\n );\n }\n const a = action as AgentAction;\n this.lastAction.set(a);\n this.inFlight.set(a);\n this._actions$.next(a);\n }\n\n /**\n * Subscriber contract: call after the handler for {@link inFlight}\n * completes (success or fail). Only clears {@link inFlight} if it still\n * points at the passed action — a no-op when a later dispatch already\n * superseded it. Pass the same action reference the subscriber received\n * from {@link actions$}; identity is the gate.\n */\n settle(action: AgentAction): void {\n if (this.inFlight() === action) {\n this.inFlight.set(null);\n }\n }\n\n /**\n * Semantic alias of {@link settle} for explicit user-driven cancellation —\n * e.g. a future \"Stop\" button in the agent input tray, or a dispatcher\n * teardown that wants to abandon its own in-flight action. Identical\n * runtime behaviour (identity check + clear), but the two-method surface\n * lets the UI distinguish \"handler finished\" from \"user said no\" in\n * telemetry / logs without sniffing a \"reason\" parameter.\n *\n * Pass the same action reference returned from {@link inFlight} or held\n * by the dispatcher; identity is the gate.\n */\n cancel(action: AgentAction): void {\n if (this.inFlight() === action) {\n this.inFlight.set(null);\n }\n }\n}\n","import { Injectable } from '@angular/core';\n\n/**\n * FLIP-style entry animation for payloads landing in the agent panel.\n *\n * Pure DOM + Web Animations API — no Chart.js, no Angular animations module,\n * no CSS transitions racing layout. Honours `prefers-reduced-motion`: the\n * ghost is appended then removed without animating when the user asked for\n * less motion (so DOM side-effects stay consistent).\n *\n * Lifecycle:\n * 1. The agent panel calls {@link registerTarget} in `ngAfterViewInit`\n * with its header element.\n * 2. A source app dispatches an `AgentAction` carrying an `originRect`\n * from `getBoundingClientRect()` on the click target.\n * 3. The bus subscriber calls {@link flyInto} with that rect.\n * 4. The animator creates a fixed-position ghost at the origin, animates\n * transform + opacity toward the registered target's rect, then\n * removes itself on `onfinish` / `oncancel`.\n *\n * Uses `getBoundingClientRect()` (physical viewport coords) so the animation\n * is RTL-correct without inset-inline math — the rect already encodes the\n * physical position regardless of `dir`.\n *\n * The 900 ms duration and easing curve are deliberately hardcoded — making\n * them configurable surfaces an API the host can't usefully tune without\n * understanding motion design as a whole.\n */\n@Injectable({ providedIn: 'root' })\nexport class AgentFlightAnimator {\n /** Hardcoded — see class doc. */\n private static readonly DURATION_MS = 900;\n private static readonly EASING = 'cubic-bezier(.2,.7,.2,1)';\n /** Floor the target/source scale ratio so a tiny target rect doesn't\n * collapse the ghost to invisibility before the animation finishes. */\n private static readonly MIN_SCALE = 0.05;\n\n private targetEl: HTMLElement | null = null;\n\n /** Called by the panel host to publish where flights should land. Pass\n * `null` on destroy so a re-mounted panel doesn't leave the animator\n * pointing at a detached node. */\n registerTarget(el: HTMLElement | null): void {\n this.targetEl = el;\n }\n\n /**\n * Animate a ghost element from {@link from} to the registered target's\n * rect. No-ops when:\n * - no target is registered (silent — panel may not be mounted yet)\n * - running outside a browser (SSR safety)\n * - the user has `prefers-reduced-motion: reduce` set (DOM is still\n * touched so callers see consistent side-effects, but no animation\n * runs)\n *\n * The ghost is appended to `document.body` (not the panel) so a parent\n * `overflow: hidden` on the panel can't clip the flight path.\n */\n flyInto(from: DOMRect, opts: { previewHtml?: string } = {}): void {\n if (!this.targetEl) return;\n if (typeof document === 'undefined') return;\n\n const reduced =\n typeof window !== 'undefined' && typeof window.matchMedia === 'function'\n ? window.matchMedia('(prefers-reduced-motion: reduce)').matches\n : false;\n\n const to = this.targetEl.getBoundingClientRect();\n const ghost = document.createElement('div');\n ghost.className = 'fly-agent-flight-ghost';\n // The ghost is purely decorative — it duplicates the source content\n // (chart title + snapshot) that the user just clicked and screen-reader\n // users have already heard via the sparkle button's aria-label. Re-\n // announcing the same content during the flight would be noisy at best\n // and confusing at worst. aria-hidden hides the subtree from assistive\n // tech while leaving it visible for sighted users.\n ghost.setAttribute('aria-hidden', 'true');\n // role=\"presentation\" is belt-and-braces — even if a future renderer\n // walks the tree looking for semantic landmarks, the ghost has none.\n ghost.setAttribute('role', 'presentation');\n if (opts.previewHtml) {\n // Caller is responsible for safe HTML — the bus subscriber escapes\n // plainTextFallback before passing it here.\n ghost.innerHTML = opts.previewHtml;\n }\n Object.assign(ghost.style, {\n position: 'fixed',\n left: `${from.left}px`,\n top: `${from.top}px`,\n width: `${from.width}px`,\n height: `${from.height}px`,\n pointerEvents: 'none',\n zIndex: '99999',\n transformOrigin: 'top left',\n willChange: 'transform, opacity',\n } as Partial<CSSStyleDeclaration>);\n document.body.appendChild(ghost);\n\n if (reduced) {\n ghost.remove();\n return;\n }\n\n const dx = to.left - from.left;\n const dy = to.top - from.top;\n const sx = Math.max(to.width / from.width, AgentFlightAnimator.MIN_SCALE);\n const sy = Math.max(to.height / from.height, AgentFlightAnimator.MIN_SCALE);\n\n const anim = ghost.animate(\n [\n { transform: 'translate(0,0) scale(1,1)', opacity: 1 },\n { transform: `translate(${dx}px,${dy}px) scale(${sx},${sy})`, opacity: 0.15 },\n ],\n {\n duration: AgentFlightAnimator.DURATION_MS,\n easing: AgentFlightAnimator.EASING,\n fill: 'forwards',\n },\n );\n const cleanup = (): void => ghost.remove();\n anim.onfinish = cleanup;\n anim.oncancel = cleanup;\n }\n}\n","import { Directive, HostListener, inject, input } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport {\n AGENT_DRAG_MIME,\n type AgentDragPayload,\n} from '../models/agent-input.model';\nimport { validateAgentPayload } from '../utils/agent-payload-guards';\n\n/**\n * Strict whitelist for the ghost element id. Letter-led ASCII, allows word/hyphen/colon/dot,\n * capped at 128 chars. Anything else is rejected before reaching `getElementById` so a\n * future maintainer can't swap to `querySelector` and quietly reintroduce a CSS-injection\n * vector. (`getElementById` itself is string-equality-safe; the whitelist is defence-in-depth.)\n */\nconst GHOST_ID_PATTERN = /^[A-Za-z][\\w\\-:.]{0,127}$/;\n\n/**\n * Single canonical way to declare a drag source for the agent input.\n *\n * Apply on any element a remote wants to make draggable into the `<fly-agent-input>`:\n *\n * ```html\n * <article [flyAgentDraggable]=\"() => buildPayload(trend)\" flyAgentDraggableGhostId=\"trend-ghost\">…</article>\n * ```\n *\n * On `dragstart` the directive:\n * 1. Resolves the payload (calls the builder fn if supplied; otherwise reads the\n * static value).\n * 2. Validates against {@link DEFAULT_AGENT_PAYLOAD_LIMITS} via\n * {@link validateAgentPayload}. On failure it `console.warn`s with the structured\n * reason and writes ONLY the `text/plain` fallback — the receiver still sees a\n * legible drop, but the typed envelope is skipped so a misconfigured app can't\n * corrupt downstream consumers with an oversize payload.\n * 3. Writes the typed MIME (`application/x-fly-agent-payload+json`) plus the\n * `text/plain` fallback so non-Fly drop targets still get useful text.\n * 4. Sets `effectAllowed = 'copy'` (we never *move* domain objects across windows).\n * 5. When `flyAgentDraggableGhostId` resolves to an element in the DOM, calls\n * `setDragImage` to use that element as the drag preview; otherwise the browser\n * default applies.\n *\n * Notes:\n * - Builder form is preferred over static — it captures fresh state at `dragstart`,\n * not at directive init. A static `AgentDragPayload` is fine for items whose\n * domain object never changes after the row mounts.\n * - The directive sets `[attr.draggable]=\"true\"` so callers don't have to.\n */\n@Directive({\n selector: '[flyAgentDraggable]',\n standalone: true,\n host: {\n '[attr.draggable]': '\"true\"',\n },\n})\nexport class FlyAgentDraggableDirective<T = unknown> {\n /**\n * Either a static payload or a builder evaluated at `dragstart` (preferred — captures\n * fresh state). `input.required` so misuse fails at template compile time.\n */\n readonly flyAgentDraggable = input.required<AgentDragPayload<T> | (() => AgentDragPayload<T>)>();\n\n /**\n * Optional ghost element id (an existing element in the DOM whose snapshot becomes\n * the drag image). Falls back to the default browser drag image when absent or the\n * element can't be resolved.\n *\n * Must be a valid HTML id (ASCII, letter-led). `getElementById` is intentional —\n * do NOT swap to `querySelector` without re-introducing this whitelist.\n */\n readonly flyAgentDraggableGhostId = input<string | undefined>(undefined);\n\n private readonly doc = inject(DOCUMENT);\n\n @HostListener('dragstart', ['$event'])\n onDragStart(ev: DragEvent): void {\n const dt = ev.dataTransfer;\n if (!dt) return;\n\n const payload = this.resolvePayload();\n const validation = validateAgentPayload(payload);\n\n if (!validation.ok) {\n // eslint-disable-next-line no-console\n console.warn('[flyAgentDraggable] payload validation failed; degrading to text/plain', validation);\n dt.setData('text/plain', payload.plainTextFallback ?? '');\n dt.effectAllowed = 'copy';\n return;\n }\n\n dt.setData(AGENT_DRAG_MIME, JSON.stringify(payload));\n dt.setData('text/plain', payload.plainTextFallback ?? '');\n dt.effectAllowed = 'copy';\n\n const ghostId = this.flyAgentDraggableGhostId();\n if (ghostId) {\n if (!GHOST_ID_PATTERN.test(ghostId)) {\n // Don't echo the rejected id (caller-controlled, could be huge).\n // eslint-disable-next-line no-console\n console.warn('[flyAgentDraggable] ignoring ghost id', { reason: 'invalid_ghost_id' });\n } else {\n const ghost = this.doc.getElementById(ghostId);\n if (ghost) {\n // Center the drag image; ResizeObserver-aware sizing is left to the host element.\n dt.setDragImage(ghost, ghost.clientWidth / 2, ghost.clientHeight / 2);\n }\n }\n }\n }\n\n private resolvePayload(): AgentDragPayload<T> {\n const raw = this.flyAgentDraggable();\n return typeof raw === 'function' ? (raw as () => AgentDragPayload<T>)() : raw;\n }\n}\n","import {\n Directive,\n ElementRef,\n Renderer2,\n OnDestroy,\n effect,\n inject,\n input,\n} from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\n\n/**\n * Renders an authenticated image into a host `<img>` element by fetching the\n * resource as a blob through Angular's `HttpClient` and binding the resulting\n * object URL to the host's `src` attribute.\n *\n * Why this exists: every Business / Supporting app stores files in the Files\n * Manager service, which authenticates with a Bearer JWT. A raw `<img src>`\n * request bypasses the Angular HTTP interceptor — the browser issues the GET\n * without the Authorization header, so the response is 401 and the image is\n * broken. The standard workaround is roughly fifteen lines of `effect` +\n * `URL.createObjectURL` + `URL.revokeObjectURL` per call site (see prior\n * inline copies in `FlyImageUploadComponent` and the Circles trend-detail\n * cover). This directive centralizes that pattern so:\n *\n * * Memory hygiene is automatic — the previous object URL is revoked\n * whenever the input changes and on destroy. Easy to forget inline.\n * * Error handling is uniform — a fetch failure clears the host `src`\n * so the browser shows its broken-image affordance once, not the prior\n * image stuck on screen.\n * * A future protocol change (per-request signed URLs, CDN tokens, etc.)\n * lands in one place rather than across every app's image bindings.\n *\n * Usage:\n *\n * ```html\n * <img [flySecureSrc]=\"trend.coverImageId\" alt=\"\" class=\"cover-img\" />\n * ```\n *\n * Pass a full URL when the resource lives somewhere other than the default\n * Files Manager download endpoint:\n *\n * ```html\n * <img [flySecureSrc]=\"'/api/avatars/' + user.id\" alt=\"\" />\n * ```\n *\n * A bare file id (no `/` prefix) is resolved against\n * `/api/files/{id}/download`, which matches the Files Manager convention\n * used everywhere in the platform. Anything that starts with `/` is treated\n * as a literal URL and passed through unchanged — apps with bespoke download\n * routes (signed Excel exports, attachment thumbnails, …) keep working\n * without a wrapper.\n */\n@Directive({\n selector: 'img[flySecureSrc]',\n standalone: true,\n})\nexport class FlySecureSrcDirective implements OnDestroy {\n /**\n * File id or absolute path. Passing `null` / `undefined` / `''` clears the\n * `src` attribute and revokes the previous blob. Useful when binding to a\n * signal whose value can become empty (e.g. after a file is detached).\n */\n readonly flySecureSrc = input<string | null | undefined>();\n\n private readonly http = inject(HttpClient);\n private readonly host = inject(ElementRef<HTMLImageElement>);\n private readonly renderer = inject(Renderer2);\n\n /**\n * The object URL currently bound to the host's `src` attribute. Tracked so\n * we can revoke it before binding a new one (avoids leaking blob memory\n * across rapid input changes — e.g. carousel scrubbing) and on destroy.\n */\n private currentUrl: string | null = null;\n\n constructor() {\n effect((onCleanup) => {\n const raw = this.flySecureSrc();\n this.releaseCurrent();\n this.renderer.removeAttribute(this.host.nativeElement, 'src');\n\n if (!raw) return;\n\n const url = raw.startsWith('/') ? raw : `/api/files/${raw}/download`;\n const sub = this.http\n .get(url, { responseType: 'blob' })\n .subscribe({\n next: (blob) => {\n const objectUrl = URL.createObjectURL(blob);\n this.currentUrl = objectUrl;\n this.renderer.setAttribute(this.host.nativeElement, 'src', objectUrl);\n },\n // A 401 / 403 / 404 here means the image is unavailable for this user.\n // Don't loop or retry — clear the src and let the host page render its\n // own placeholder. Logging is intentionally silent: it's expected on\n // permission boundaries (e.g. shared-evidence on a trend you can read\n // but whose file you can't), and stack-traces would be noise.\n error: () => {\n this.releaseCurrent();\n this.renderer.removeAttribute(this.host.nativeElement, 'src');\n },\n });\n\n onCleanup(() => sub.unsubscribe());\n });\n }\n\n ngOnDestroy(): void {\n this.releaseCurrent();\n }\n\n private releaseCurrent(): void {\n if (this.currentUrl) {\n URL.revokeObjectURL(this.currentUrl);\n this.currentUrl = null;\n }\n }\n}\n","import type { FlyLocaleEntry } from './fly-locale-catalog.model';\n\n/**\n * Verbatim TypeScript port of the C# `LanguageDTO[] _AllLanguages` array supplied by\n * product. **31 entries**, in the canonical order. Three RTL flagged: `he-IL`, `ur-IN`,\n * `ar-AE`. Includes `cmn-Hant-TW` for Chinese and `ka-GE` for Georgian.\n *\n * The order matches the C# source byte-for-byte — do not re-sort. Downstream tests\n * (`fly-locale-catalog.spec.ts`) pin the count, the unique-key constraints, and the\n * RTL set; if you reorder or add an entry, those tests will guide the fix.\n *\n * The strings carry Cyrillic, Hebrew, Vietnamese, Thai, Indonesian, Bengali, Devanagari,\n * Urdu, Catalan, Polish, Korean, Russian, Japanese, Han, Turkish, Romanian, Norwegian,\n * Hungarian, Greek, Finnish, Danish, Dutch, Swedish, Portuguese, Italian, German,\n * Spanish, French, English, Arabic, and Georgian. The file is saved as UTF-8 without\n * BOM (matches every other locale file in the repo). The `…` (U+2026) ellipsis is\n * preserved verbatim.\n */\nexport const FLY_LOCALE_CATALOG: readonly FlyLocaleEntry[] = Object.freeze([\n {\n prefix: 'UK',\n dialect: 'uk-UA',\n englishName: 'Ukrainian',\n arabicName: 'الأوكرانية',\n nativeName: 'Українська',\n detected: 'Виявлена мова',\n searching: 'Шукаючи',\n elevating: 'Підняття до',\n translating: 'Переклад на',\n generatingAnswersForYou: 'Створення відповідей для вас...',\n learnMore: 'Дізнайтеся більше',\n waitingForResponseMsg: 'Будь ласка, наберіться терпіння, ми ще думаємо',\n isRtl: false,\n },\n {\n prefix: 'HE',\n dialect: 'he-IL',\n englishName: 'Hebrew',\n arabicName: 'العبرية',\n nativeName: 'עברית',\n detected: 'שפה מזוהה',\n searching: 'מחפש אחר',\n elevating: 'מרומם ל',\n translating: 'תרגום ל',\n generatingAnswersForYou: 'מייצר עבורך תשובות...',\n learnMore: 'למידע נוסף',\n waitingForResponseMsg: 'אנא התאזרו בסבלנות, אנחנו עדיין חושבים',\n isRtl: true,\n },\n {\n prefix: 'VI',\n dialect: 'vi-VN',\n englishName: 'Vietnamese',\n arabicName: 'الفيتنامية',\n nativeName: 'Tiếng Việt',\n detected: 'Ngôn ngữ được phát hiện',\n searching: 'Tìm kiếm',\n elevating: 'Nâng lên',\n translating: 'Dịch sang',\n generatingAnswersForYou: 'Đang tạo câu trả lời cho bạn...',\n learnMore: 'Tìm hiểu thêm',\n waitingForResponseMsg: 'Vui lòng kiên nhẫn, chúng tôi vẫn đang suy nghĩ',\n isRtl: false,\n },\n {\n prefix: 'TH',\n dialect: 'th-TH',\n englishName: 'Thai',\n arabicName: 'التايلاندية',\n nativeName: 'ไทย',\n detected: 'ภาษาที่ตรวจพบ',\n searching: 'ค้นหา',\n elevating: 'ยกระดับเป็น',\n translating: 'การแปล',\n generatingAnswersForYou: 'กำลังสร้างคำตอบให้กับคุณ...',\n learnMore: 'เรียนรู้เพิ่มเติม',\n waitingForResponseMsg: 'โปรดอดใจรอ, พวกเรายังคงกำลังคิดอยู่',\n isRtl: false,\n },\n {\n prefix: 'ID',\n dialect: 'id-ID',\n englishName: 'Indonesian',\n arabicName: 'الإندونيسية',\n nativeName: 'Bahasa Indonesia',\n detected: 'Bahasa yang terdeteksi',\n searching: 'Mencari',\n elevating: 'Meninggalkan ke',\n translating: 'Menerjemahkan ke',\n generatingAnswersForYou: 'Menghasilkan jawaban untuk Anda...',\n learnMore: 'Cari tahu lebih lanjut',\n waitingForResponseMsg: 'Harap bersabar, kami masih sedang berpikir',\n isRtl: false,\n },\n {\n prefix: 'BN',\n dialect: 'bn-BD',\n englishName: 'Bengali',\n arabicName: 'البنغالية',\n nativeName: 'বাংলা',\n detected: 'সনাক্ত করা ভাষা',\n searching: 'খুঁজছি',\n elevating: 'উন্নত',\n translating: 'অনুবাদ',\n generatingAnswersForYou: 'আপনার জন্য উত্তর তৈরি করা হচ্ছে...',\n learnMore: 'আরো জানুন',\n waitingForResponseMsg: 'অনুগ্রহ করে ধৈর্য ধরুন, আমরা এখনও চিন্তা করছি',\n isRtl: false,\n },\n {\n prefix: 'HI',\n dialect: 'hi-IN',\n englishName: 'Hindi',\n arabicName: 'الهندية',\n nativeName: 'हिन्दी',\n detected: 'पता चला भाषा',\n searching: 'के लिए खोज रहे हैं',\n elevating: 'के लिए ऊंचा',\n translating: 'अनुवाद करना',\n generatingAnswersForYou: 'आपके लिए उत्तर तैयार किया जा रहा है...',\n learnMore: 'और जानें',\n waitingForResponseMsg: 'कृपया धैर्य रखें, हम अभी सोच रहे हैं',\n isRtl: false,\n },\n {\n prefix: 'UR',\n dialect: 'ur-IN',\n englishName: 'Urdu',\n arabicName: 'الأردية',\n nativeName: 'اردو',\n detected: 'پتہ چلا زبان',\n searching: 'کے لیے تلاش',\n elevating: 'بلند کرنا',\n translating: 'ترجمہ کرنا',\n generatingAnswersForYou: 'آپ کے لیے جوابات تیار کیے جا رہے ہیں...',\n learnMore: 'مزید جانیں',\n waitingForResponseMsg: 'براہ کرم صبر کریں، ہم ابھی سوچ رہے ہیں۔',\n isRtl: true,\n },\n {\n prefix: 'CA',\n dialect: 'ca-ES',\n englishName: 'Catalan',\n arabicName: 'الكتالانية',\n nativeName: 'Català',\n detected: 'Idioma detectat',\n searching: 'Buscant',\n elevating: 'Elevant a',\n translating: 'Traduir a',\n generatingAnswersForYou: 'Generant respostes per a tu...',\n learnMore: 'Aprèn més',\n waitingForResponseMsg: 'Si us plau, tingueu paciència, encara estem pensant',\n isRtl: false,\n },\n {\n prefix: 'PL',\n dialect: 'pl-PL',\n englishName: 'Polish',\n arabicName: 'البولندية',\n nativeName: 'Polski',\n detected: 'Wykryty język',\n searching: 'Szukać',\n elevating: 'Podniesienie do',\n translating: 'Tłumaczenie na',\n generatingAnswersForYou: 'Generowanie odpowiedzi dla Ciebie...',\n learnMore: 'Dowiedz się więcej',\n waitingForResponseMsg: 'Proszę o cierpliwość, nadal myślimy',\n isRtl: false,\n },\n {\n prefix: 'KO',\n dialect: 'ko-KR',\n englishName: 'Korean',\n arabicName: 'الكورية',\n nativeName: '한국어',\n detected: '탐지 언어',\n searching: '검색',\n elevating: '상승',\n translating: '번역',\n generatingAnswersForYou: '답변을 생성하는 중...',\n learnMore: '더 알아보기',\n waitingForResponseMsg: '잠시만 기다려 주세요, 저희는 아직 생각 중입니다',\n isRtl: false,\n },\n {\n prefix: 'RU',\n dialect: 'ru-RU',\n englishName: 'Russian',\n arabicName: 'الروسية',\n nativeName: 'Русский',\n detected: 'Обнаруженный язык',\n searching: 'В поисках',\n elevating: 'Поднимаясь до',\n translating: 'Перевод',\n generatingAnswersForYou: 'Генерация ответов для вас...',\n learnMore: 'Узнать больше',\n waitingForResponseMsg: 'Пожалуйста, подождите, мы всё ещё думаем',\n isRtl: false,\n },\n {\n prefix: 'JA',\n dialect: 'ja-JP',\n englishName: 'Japanese',\n arabicName: 'اليابانية',\n nativeName: '日本語',\n detected: '検出言語',\n searching: '探している',\n elevating: '昇格',\n translating: '翻訳',\n generatingAnswersForYou: 'あなたのための答えを生成中...',\n learnMore: 'もっと詳しく',\n waitingForResponseMsg: '少々お待ちください、ただいま考え中です',\n isRtl: false,\n },\n {\n prefix: 'ZH',\n dialect: 'cmn-Hant-TW',\n englishName: 'Chinese',\n arabicName: 'الصينية',\n nativeName: '中文',\n detected: '检测语言',\n searching: '搜索',\n elevating: '提升到',\n translating: '翻译成',\n generatingAnswersForYou: '为您生成答案...',\n learnMore: '了解更多',\n waitingForResponseMsg: '请耐心等待,我们还在思考',\n isRtl: false,\n },\n {\n prefix: 'TR',\n dialect: 'tr-TR',\n englishName: 'Turkish',\n arabicName: 'التركية',\n nativeName: 'Türkçe',\n detected: 'Tespit edilen dil',\n searching: 'Arama',\n elevating: 'Yükseltme',\n translating: 'Çevirme',\n generatingAnswersForYou: 'Sizin için yanıtlar üretiliyor...',\n learnMore: 'Daha fazla bilgi edin',\n waitingForResponseMsg: 'Lütfen sabırlı olun, hâlâ düşünüyoruz',\n isRtl: false,\n },\n {\n prefix: 'RO',\n dialect: 'ro-RO',\n englishName: 'Romanian',\n arabicName: 'الرومانية',\n nativeName: 'Română',\n detected: 'Limba detectată',\n searching: 'Căutare de',\n elevating: 'Elevator la',\n translating: 'Traducerea în',\n generatingAnswersForYou: 'Generarea de răspunsuri pentru tine...',\n learnMore: 'Află mai multe',\n waitingForResponseMsg: 'Vă rugăm să aveți răbdare, încă ne gândim',\n isRtl: false,\n },\n {\n prefix: 'NO',\n dialect: 'nb-NO',\n englishName: 'Norwegian',\n arabicName: 'النرويجية',\n nativeName: 'Norsk',\n detected: 'Oppdaget språk',\n searching: 'Leter etter',\n elevating: 'Løfter til',\n translating: 'Oversette til',\n generatingAnswersForYou: 'Genererer svar for deg...',\n learnMore: 'Lær mer',\n waitingForResponseMsg: 'Vennligst vær tålmodig, vi tenker fortsatt',\n isRtl: false,\n },\n {\n prefix: 'HU',\n dialect: 'hu-HU',\n englishName: 'Hungarian',\n arabicName: 'الهنغارية',\n nativeName: 'Magyar',\n detected: 'Detektált nyelv',\n searching: 'Keresés-ra,-re',\n elevating: 'Felemelve',\n translating: 'Fordítás',\n generatingAnswersForYou: 'Válaszok generálása az Ön számára...',\n learnMore: 'Tudj meg többet',\n waitingForResponseMsg: 'Kérjük, legyen türelemmel, még gondolkodunk',\n isRtl: false,\n },\n {\n prefix: 'EL',\n dialect: 'el-GR',\n englishName: 'Greek',\n arabicName: 'اليونانية',\n nativeName: 'Ελληνικά',\n detected: 'Εντοπισμένη γλώσσα',\n searching: 'Ψάχνοντας για',\n elevating: 'Ανυψώ',\n translating: 'Μεταφράζοντας σε',\n generatingAnswersForYou: 'Δημιουργία απαντήσεων για εσάς...',\n learnMore: 'Μάθε περισσότερα',\n waitingForResponseMsg: 'Παρακαλώ περιμένετε με υπομονή, σκεφτόμαστε ακόμα',\n isRtl: false,\n },\n {\n prefix: 'FI',\n dialect: 'fi-FI',\n englishName: 'Finnish',\n arabicName: 'الفنلندية',\n nativeName: 'Suomi',\n detected: 'Havaittu kieli',\n searching: 'Etsimässä',\n elevating: 'Nousee jhk',\n translating: 'Kääntäen',\n generatingAnswersForYou: 'Luodaan vastauksia sinulle...',\n learnMore: 'Lue lisää',\n waitingForResponseMsg: 'Ole hyvä ja ole kärsivällinen, ajattelemme yhä',\n isRtl: false,\n },\n {\n prefix: 'DA',\n dialect: 'da-DK',\n englishName: 'Danish',\n arabicName: 'الدانماركية',\n nativeName: 'Dansk',\n detected: 'Opdaget sprog',\n searching: 'Leder efter',\n elevating: 'Hæve til',\n translating: 'Oversættelse til',\n generatingAnswersForYou: 'Generer svar til dig...',\n learnMore: 'Lær mere',\n waitingForResponseMsg: 'Vent venligst tålmodigt, vi tænker stadig',\n isRtl: false,\n },\n {\n prefix: 'NL',\n dialect: 'nl-NL',\n englishName: 'Dutch',\n arabicName: 'الهولندية',\n nativeName: 'Nederlands',\n detected: 'Gedetecteerde taal',\n searching: 'Op zoek naar',\n elevating: 'Verheffen tot',\n translating: 'Vertalen naar',\n generatingAnswersForYou: 'Antwoorden voor u genereren...',\n learnMore: 'Lees meer',\n waitingForResponseMsg: 'Gelieve geduld te hebben, we zijn nog aan het nadenken',\n isRtl: false,\n },\n {\n prefix: 'SV',\n dialect: 'sv-SE',\n englishName: 'Swedish',\n arabicName: 'السويدية',\n nativeName: 'Svenska',\n detected: 'Upptäckt språk',\n searching: 'Söker efter',\n elevating: 'Upphöjande till',\n translating: 'Översätta till',\n generatingAnswersForYou: 'Genererar svar åt dig...',\n learnMore: 'Läs mer',\n waitingForResponseMsg: 'Vänligen ha tålamod, vi tänker fortfarande',\n isRtl: false,\n },\n {\n prefix: 'PT',\n dialect: 'pt-PT',\n englishName: 'Portuguese',\n arabicName: 'البرتغالية',\n nativeName: 'Português',\n detected: 'Idioma detectado',\n searching: 'Procurando por',\n elevating: 'Elevando para',\n translating: 'Traduzindo para',\n generatingAnswersForYou: 'Gerando respostas para você...',\n learnMore: 'Saiba mais',\n waitingForResponseMsg: 'Por favor, tenha paciência, ainda estamos a pensar',\n isRtl: false,\n },\n {\n prefix: 'IT',\n dialect: 'it-IT',\n englishName: 'Italian',\n arabicName: 'الإيطالية',\n nativeName: 'Italiano',\n detected: 'Lingua rilevata',\n searching: 'Alla ricerca di',\n elevating: 'Elevare a',\n translating: 'Tradurre in',\n generatingAnswersForYou: 'Generazione di risposte per te...',\n learnMore: 'Scopri di più',\n waitingForResponseMsg: 'Per favore, abbi pazienza, stiamo ancora pensando',\n isRtl: false,\n },\n {\n prefix: 'DE',\n dialect: 'de-DE',\n englishName: 'German',\n arabicName: 'الألمانية',\n nativeName: 'Deutsch',\n detected: 'Erkannte Sprache',\n searching: 'Auf der Suche nach',\n elevating: 'Erhöhung zu',\n translating: 'Übersetzung auf',\n generatingAnswersForYou: 'Wir generieren Antworten für Sie...',\n learnMore: 'Erfahre mehr',\n waitingForResponseMsg: 'Bitte haben Sie Geduld, wir denken noch nach',\n isRtl: false,\n },\n {\n prefix: 'ES',\n dialect: 'es-AR',\n englishName: 'Spanish',\n arabicName: 'الأسبانية',\n nativeName: 'Español',\n detected: 'Idioma detectado',\n searching: 'Buscando',\n elevating: 'Elevando a',\n translating: 'Traduciendo a',\n generatingAnswersForYou: 'Generando respuestas para ti...',\n learnMore: 'Aprende más',\n waitingForResponseMsg: 'Por favor, ten paciencia, todavía estamos pensando',\n isRtl: false,\n },\n {\n prefix: 'FR',\n dialect: 'fr-FR',\n englishName: 'French',\n arabicName: 'الفرنسية',\n nativeName: 'Français',\n detected: 'Langue détectée',\n searching: 'À la recherche de',\n elevating: 'Élever à',\n translating: 'Traduire par',\n generatingAnswersForYou: 'Générer des réponses pour vous...',\n learnMore: 'En savoir plus',\n waitingForResponseMsg: 'Veuillez patienter, nous réfléchissons encore',\n isRtl: false,\n },\n {\n prefix: 'EN',\n dialect: 'en-US',\n englishName: 'English',\n arabicName: 'الإنجليزية',\n nativeName: 'English',\n detected: 'Detected language',\n searching: 'Searching for',\n elevating: 'Elevating to',\n translating: 'Translating to',\n generatingAnswersForYou: 'Generating answers for you...',\n learnMore: 'Learn more',\n waitingForResponseMsg: 'Please bear with us, we are still thinking',\n isRtl: false,\n },\n {\n prefix: 'AR',\n dialect: 'ar-AE',\n englishName: 'Arabic',\n arabicName: 'العربية',\n nativeName: 'العربية',\n detected: 'اللغة المكتشفة',\n searching: 'البحث عن',\n elevating: 'رفع إلى',\n translating: 'ترجمة إلى',\n generatingAnswersForYou: 'جارٍ إنشاء إجابات لك...',\n learnMore: 'تعرف على المزيد',\n waitingForResponseMsg: 'نرجو منك التحلّي بالصبر، نحن ما زلنا نفكر',\n isRtl: true,\n },\n {\n prefix: 'KA',\n dialect: 'ka-GE',\n englishName: 'Georgian',\n arabicName: 'الجورجية',\n nativeName: 'ქართული',\n detected: 'გამოვლენილი ენა',\n searching: 'ძიება',\n elevating: 'ამაღლება',\n translating: 'თარგმნა',\n generatingAnswersForYou: 'პასუხების გენერირება თქვენთვის...',\n learnMore: 'გაიგე მეტი',\n waitingForResponseMsg: 'გთხოვთ მოითმინოთ, ჯერ კიდევ ვფიქრობთ',\n isRtl: false,\n },\n]) as readonly FlyLocaleEntry[];\n\n/**\n * Lookup by BCP-47 dialect (e.g. `'ar-AE'`). Case-insensitive per BCP-47 §2.1.1\n * (subtags are case-insensitive on the wire) — accepts `'en-US'`, `'en-us'`,\n * `'EN-US'`, etc. all as the canonical EN entry. The catalog itself keeps its\n * canonical casing for display.\n *\n * Returns `undefined` when not found; callers decide whether to fall back to `'en-US'`.\n */\nexport function findLocaleByDialect(dialect: string): FlyLocaleEntry | undefined {\n if (typeof dialect !== 'string' || dialect.length === 0) return undefined;\n const lower = dialect.toLowerCase();\n return FLY_LOCALE_CATALOG.find((e) => e.dialect.toLowerCase() === lower);\n}\n\n/**\n * Lookup by short prefix (e.g. `'AR'`). Prefixes are unique in the catalog (asserted by tests).\n * Case-insensitive — accepts `'AR'`, `'ar'`, `'Ar'`. Catalog stores prefixes uppercase\n * for display.\n */\nexport function findLocaleByPrefix(prefix: string): FlyLocaleEntry | undefined {\n if (typeof prefix !== 'string' || prefix.length === 0) return undefined;\n const lower = prefix.toLowerCase();\n return FLY_LOCALE_CATALOG.find((e) => e.prefix.toLowerCase() === lower);\n}\n\n/**\n * Type-narrowing helper for entries flagged RTL.\n *\n * Named with the `Entry` suffix to avoid colliding with the existing\n * `isRtlLocale(lang: string)` from `i18n.service.ts`, which answers a different\n * question (is the *UI* locale code RTL?). Both helpers coexist in `public-api`.\n */\nexport function isRtlLocaleEntry(\n entry: FlyLocaleEntry,\n): entry is FlyLocaleEntry & { isRtl: true } {\n return entry.isRtl === true;\n}\n","/*\n * @mohamedatia/fly-design-system — Public API\n * https://www.npmjs.com/package/@mohamedatia/fly-design-system\n *\n * This is the single entry point for Business / Supporting App developers.\n * Import everything from '@mohamedatia/fly-design-system' — never from relative shell paths.\n *\n * NOTE: This package is published under @mohamedatia/fly-design-system until the @fly\n * npm org is created. It will be republished as @fly/design-system once available.\n *\n * v1.3.0: FlyThemeService (html theme classes), hardened I18nService (AbortSignal, ErrorHandler, RTL helpers).\n * v1.3.1: loadBundle normalizes locale JSON (flat or nested objects; rejects invalid leaves).\n * v1.3.2: loadBundle returns boolean; LoadBundleOptions.silent skips ErrorHandler on failure.\n * v1.3.7: MockAuthService base class + MockAuthConfig for Business App mock auth via fileReplacements.\n * User model extended with optional avatar, source, twoFactorEnabled, createdAt fields.\n * v1.3.8: AuthService.init() no-op added so Business Apps can call init() in APP_INITIALIZER\n * without branching between standalone and embedded modes.\n * v1.3.9: MockAuthService field initializers moved into constructor to fix ngDevMode ReferenceError\n * when the package is loaded in a production-mode bundle (no ngDevMode global defined).\n * v1.4.0: ContextMenuComponent (positioned menu, keyboard nav, focus management) moved from desktop\n * shell to design system. MessageBoxService + MessageBoxComponent added (Windows Forms-style\n * modal dialogs with localized button labels, focus management, and Escape key support).\n * MessageBoxButtons, MessageBoxIcon, DialogResult, MessageBoxOptions, MessageBoxButton exported.\n * v1.5.0: SharePanelComponent — generic share/ACL overlay; host supplies API callbacks and optional\n * permission level options (file ACL vs note-style View/Edit).\n * v1.6.0: SharePanelComponent — `loadOuTree(chartId: string | null)`; optional `loadChartOptions` for\n * default vs alternative org charts (OU grants still use real OU ids). `ShareOrgChartOption` exported.\n * v1.7.0: SharePanelComponent — `loadChartOptions` and `loadOuLabelMap` are required; chart tree loads after\n * options resolve (no spurious null fetch). `loadOuLabelMap` supplies default-tree labels for OU rows.\n * v1.8.0: `WindowInstance` optional `contentUiBlocked` / `contentUiBlockMessageKey`; `WindowManagerService`\n * `beginContentUiBlock` / `endContentUiBlock` default no-ops; `FlyBlockUiComponent` for shell window overlay.\n * v1.10.0: SharePanelComponent — `supportsDeny` input + `isDeny?` on `SharePermissionEntry`. Surfaces an\n * \"Add as deny\" toggle in the add-permission row and renders existing deny grants with red\n * accent + ban icon. `grantToUser` / `grantToOu` callbacks gain a fourth `isDeny: boolean`\n * parameter (additive — existing 3-arg callers won't compile until updated). New locale keys\n * `files.share.add_as_deny`, `files.share.deny_help`, `files.share.denied` (en/ar/fr/ur).\n * Backed by Files Manager `FilePermission.IsDeny` and Notes `NoteShareLevel.Deny`.\n * v2.0.0: BREAKING — `SharePermissionEntry` adopts the `SharePrincipal` discriminated union\n * (`{ kind: 'user' | 'role' | 'ou' | 'app-everyone', ... }`) instead of the v1\n * `grantedToUserId` / `grantedToOuId` / `grantedToAppId` set-which-is-set fields.\n * Hosts must translate domain DTOs to/from the new shape (see\n * `file-access-control.component.ts` and `notes.component.ts` for migration patterns).\n * The `role` kind is reserved for the planned apps-chart role-as-principal flow;\n * hosts should not emit it until the backend's `PermissionResolver` enumerates a\n * user's full OU set (direct + computed-from-role memberships).\n * v2.1.0: AudienceBuilderComponent — generic <fly-audience-builder> form-control for composing\n * a `Fly.Shared.Core.Audience.AudienceFilter`. TypeScript model (`AudienceFilter`,\n * `AudienceTerm` discriminated union, `AUDIENCE_LIMITS`) mirrors the C# polymorphic\n * shape byte-for-byte (`kind` discriminator: users/roles/ou/app-everyone/chart/preset).\n * Reuses share-panel callback shapes (searchUsers, loadOuTree, loadChartOptions,\n * loadRoleOus). Distinct from share-panel: emits `(audienceChange)` + `(validityChange)`\n * instead of auto-persisting; hosts save on submit. New `audience.*` locale namespace.\n * v2.3.0: Deep-link launch contract — `LAUNCH_CONTEXT` injection token + `LaunchContext`\n * type for federated remotes to receive a route + params payload when the host\n * opens (or re-opens) their window via a `?app=&route=¶ms=` URL on the shell.\n * Token resolves to `Signal<LaunchContext | null>`; `null` when no host provider.\n * Backed by `Fly.Shared.Core.Apps.IDeepLinkBuilder` for outbound URL generation.\n * v2.2.0: AudienceBuilderComponent now implements `ControlValueAccessor` + `Validator` so\n * hosts can bind via `formControl` / `formControlName` / `[(ngModel)]`. Existing\n * `[value]` + `(audienceChange)` + `(validityChange)` API still works (forms wiring\n * is purely additive). `AUDIENCE_PRESETS` const exported for hosts that build their\n * own preset pickers. `OuTerm.chartId` and `OuTerm.includeDescendants` are now\n * REQUIRED (no longer optional) so wire round-trips are deterministic — emit explicit\n * `null` / `boolean` rather than `undefined`. New `AudienceErrorCodes` mirror added.\n * v2.4.0: SharePanelComponent + AudienceBuilderComponent — `defaultChartSystemKey` and\n * `defaultChartId` inputs let hosts pre-select a specific chart in the OU picker\n * without knowing the tenant-scoped Guid. `ShareOrgChartOption` gains an optional\n * `systemKey` field so platform-managed charts (`'apps'`, `'default-company'`) are\n * identifiable across tenants. New `SHARE_ORG_CHART_SYSTEM_KEY_APPS` /\n * `SHARE_ORG_CHART_SYSTEM_KEY_DEFAULT` constants exported.\n * v2.5.0: Agent input contracts (Phase 1 of the `<fly-agent-input>` plan) — additive only.\n * `AgentCommandRegistry` + `AgentDropRegistry` (singletons via `providedIn: 'root'`,\n * shared across federation), `flyAgentDraggable` directive, payload-guard helpers\n * (`validateAgentPayload`, `trimAgentPayload`, `trimAgentString`, `utf8ByteLength`),\n * and the cross-cutting `FLY_LOCALE_CATALOG` (31 entries, frozen — verbatim port of\n * `Fly.Shared.Core.LanguageDTO[]`). Three RTL flagged: `he-IL`, `ur-IN`, `ar-AE`.\n * The catalog's RTL helper is exported as `isRtlLocaleEntry` to avoid colliding with\n * the existing `isRtlLocale(lang: string)` from `i18n.service.ts`.\n * No UI consumers yet — Phase 2 wires the registries into the shell input component.\n * v2.9.0: Federation-safe cross-app deep-linking contract. The shell publishes\n * every launch onto a `FLYOS_LAUNCH_EVENT` (`'flyos:launch'`) window\n * CustomEvent AND a `globalThis[FlyosPendingLaunchesGlobalKey]` registry,\n * both keyed by `appId`. New exports: `FLYOS_LAUNCH_EVENT`,\n * `FlyosPendingLaunchesGlobalKey`, `FlyLaunchEventDetail`,\n * `FlyosPendingLaunches`. `LAUNCH_CONTEXT` is now documented as\n * shell-internal — Native Federation can split the InjectionToken across\n * host/remote bundles, so federated remotes must consume the\n * event + registry surfaces. See `skills/cross-app-deep-linking.md`.\n * Also: new `SourceAppResolver` service + `APP_LOOKUP` adapter token,\n * centralising the canonicalization rule that strips `-service` from\n * JWT client_ids (`circles-service` → `circles`) so chips, banners,\n * and launchers stay consistent across the shell.\n * v2.6.0: Agent action bus + flight animator. New imperative sibling to\n * `AgentCommandRegistry` / `AgentDropRegistry`: `AgentActionBus` lets\n * any app push a typed `AgentAction { verb, payload, dispatch, originRect }`\n * to the agent panel without going through drag-drop. `AgentFlightAnimator`\n * plays a FLIP-style transform animation from the source DOM rect to the\n * registered panel-header rect (hardcoded 420 ms / cubic-bezier; honours\n * prefers-reduced-motion). Phase 1 supports `dispatch: 'stage'` only —\n * `'auto'` throws `AgentActionUnsupportedDispatchError` until\n * `AgentInputComponent.programmaticSubmit` ships. Re-uses\n * `AgentDragPayload<T>` as the wire envelope so drag and programmatic\n * transports never fork. New verbs: `explain`, `why-empty`,\n * `compose-query`, `compare`, `forecast`, `summarize`.\n * v2.10.0: Per-window help-deeplink contract. The shell renders a help-icon\n * button in every non-chromeless `<fly-window>` titlebar. By default\n * the deeplink uses `win.appId`; apps override or augment via the\n * new `WINDOW_HELP_HINT` InjectionToken (a `WritableSignal<WindowHelpHint | null>`)\n * provided per-window. `WindowHelpHint` is `{ appId?, topic? }` —\n * `topic` is a free-form search-query seed updated dynamically as the\n * user navigates within the app. New federation-safe channel\n * `FLY_WINDOW_HELP_HINT_EVENT` mirrors the DI surface for federated\n * remotes. New exports: `WindowHelpHint`, `WINDOW_HELP_HINT`,\n * `FLY_WINDOW_HELP_HINT_EVENT`, `FlyWindowHelpHintEventDetail`.\n * Backed by the help-center reader's new `params.topic` launch payload\n * and \"no help for this app yet\" empty-state. See\n * `skills/help-center.md` and `skills/desktop-shell-angular.md`.\n * v2.5.1: New `MessageBoxService.showAcknowledged()` entry point returning\n * `DialogResultWithAcknowledgement` for \"Don't ask again\"-style flows.\n * The `dontAskAgain` config (`MessageBoxDontAskAgainConfig`) lives ONLY on\n * `MessageBoxOptionsWithAcknowledgement` — the base `MessageBoxOptions`\n * no longer carries it, so the type system enforces \"checkbox ⇒ caller\n * MUST use `showAcknowledged()`\" and eliminates the silent-discard path\n * on `show()`. Existing `show()` callers are unaffected. Case-insensitive\n * `findLocaleByDialect` / `findLocaleByPrefix` (BCP-47 §2.1.1). See\n * `.workflow/plans/agent-input-component.md` Phase 2b-1.\n * See docs/ExternalAppsGuide/03-frontend-app.md.\n */\n\n// ─── Federation singleton self-check (side effect; must run first) ───────────\n// Loud console.error if a federated remote forks its own DS copy instead of\n// binding to the shell's shared singleton. See the module doc.\nimport './lib/fly-federation-singleton-guard';\n\n// ─── Models ──────────────────────────────────────────────────────────────────\nexport type { DesktopApp, DesktopAppKind } from './lib/models/app.model';\nexport type {\n WindowInstance,\n WindowState,\n ChildWindowData,\n LaunchContext,\n FlyLaunchEventDetail,\n FlyosPendingLaunches,\n FlyRemoteRouteEventDetail,\n WindowHelpHint,\n FlyWindowHelpHintEventDetail,\n} from './lib/models/window.model';\nexport {\n WINDOW_DATA,\n LAUNCH_CONTEXT,\n FLYOS_LAUNCH_EVENT,\n FlyosPendingLaunchesGlobalKey,\n FLYOS_REMOTE_ROUTE_EVENT,\n FlyosShellOwnsHistoryGlobalKey,\n WINDOW_HELP_HINT,\n FLY_WINDOW_HELP_HINT_EVENT,\n} from './lib/models/window.model';\nexport type { User } from './lib/models/user.model';\n\nexport type {\n SharePermissionEntry,\n SharePrincipal,\n SharePrincipalKind,\n UserPrincipal,\n RolePrincipal,\n OuPrincipal,\n AppEveryonePrincipal,\n ShareUserResult,\n ShareOuNode,\n ShareOrgChartOption,\n SharePanelLevelOption,\n} from './lib/models/share-panel.model';\nexport {\n SHARE_ORG_CHART_SYSTEM_KEY_DEFAULT,\n SHARE_ORG_CHART_SYSTEM_KEY_APPS,\n} from './lib/models/share-panel.model';\n\n// ─── Audience Targeting ──────────────────────────────────────────────────────\nexport type {\n AudienceFilter,\n AudienceTerm,\n AudienceTermKind,\n UsersTerm,\n RolesTerm,\n OuTerm,\n AppEveryoneTerm,\n ChartTerm,\n PresetTerm,\n AudiencePresetKind,\n AudienceOptions,\n} from './lib/models/audience.model';\nexport {\n AUDIENCE_LIMITS,\n AUDIENCE_TERM_KINDS,\n AUDIENCE_PRESETS,\n} from './lib/models/audience.model';\n\n/**\n * Stable error codes returned by audience-aware backend endpoints. Mirror of\n * `Fly.Shared.Core.Audience.AudienceErrorCodes`. Compare on these strings, not on HTTP\n * status, so localized messages can change without breaking integrations.\n */\nexport const AUDIENCE_ERROR_CODES = {\n invalidFilter: 'INVALID_AUDIENCE_FILTER',\n audienceTooLarge: 'AUDIENCE_TOO_LARGE',\n resolverUnavailable: 'AUDIENCE_RESOLVER_UNAVAILABLE',\n invalidAudienceKind: 'INVALID_AUDIENCE_KIND',\n} as const;\nexport type AudienceErrorCode =\n (typeof AUDIENCE_ERROR_CODES)[keyof typeof AUDIENCE_ERROR_CODES];\n\nexport type { AudienceEditTarget } from './lib/components/audience-builder/audience-builder.component';\n\n// ─── Remote App Registration ─────────────────────────────────────────────────\nexport type { RemoteAppDef } from './lib/models/remote-app.model';\n\n// ─── Services ────────────────────────────────────────────────────────────────\nexport { AuthService } from './lib/services/auth.service';\nexport type { LoadBundleOptions } from './lib/services/i18n.service';\nexport { I18nService, RTL_LOCALE_SET, isRtlLocale } from './lib/services/i18n.service';\n// Built-in DS component strings (lowest-priority I18nService layer). Exported so a\n// standalone consumer can introspect/extend the keys DS components rely on.\nexport { DS_BASELINE_LOCALES } from './lib/i18n/baseline-locales';\nexport {\n FlyThemeService,\n type FlyThemeMode,\n DEFAULT_FLY_THEME_MODE,\n FLY_THEME_MODE_IDS,\n normalizeFlyTheme,\n} from './lib/services/fly-theme.service';\nexport {\n WindowManagerService,\n StandaloneWindowManagerService,\n type OpenWindowOptions,\n} from './lib/services/window-manager.service';\nexport { FlyRemoteRouter } from './lib/services/fly-remote-router.service';\nexport {\n FlyRemoteContextService,\n type FlyRemoteContext,\n FLY_REMOTE_CONTEXT_STORE_KEY,\n FLY_REMOTE_CONTEXT_EVENT,\n} from './lib/services/fly-remote-context.service';\nexport {\n SourceAppResolver,\n APP_LOOKUP,\n type AppLookup,\n type AppLookupEntry,\n} from './lib/services/source-app-resolver.service';\nexport { FlyWindowHelpService, type FlyWindowHelpPublisher } from './lib/services/fly-window-help.service';\nexport {\n loadRemoteStyles,\n unloadRemoteStyles,\n} from './lib/services/fly-remote-styles';\nexport {\n FLY_REMOTE_ROUTES,\n FLY_REMOTE_BASE_PATH,\n type FlyRemoteRoute,\n type FlyRemoteMatch,\n matchFlyRoutePattern,\n} from './lib/services/fly-remote-router.types';\nexport { FlyRemoteRouterOutletComponent } from './lib/components/fly-remote-router-outlet/fly-remote-router-outlet.component';\n\n// ─── Pipes ───────────────────────────────────────────────────────────────────\nexport { TranslatePipe } from './lib/pipes/translate.pipe';\n\n// ─── Mock Auth (for fileReplacements in dev/mock builds) ─────────────────────\nexport { MockAuthService, type MockAuthConfig } from './lib/services/auth.service.mock';\n\n// ─── Components ──────────────────────────────────────────────────────────────\nexport { EntityLookupComponent } from './lib/components/entity-lookup/entity-lookup.component';\nexport { type EntityLinkSelection } from './lib/components/entity-lookup/entity-lookup.types';\n\nexport { FlyMarkdownEditorComponent } from './lib/components/markdown-editor/markdown-editor.component';\nexport { FlyosLink, registerFlyosProtocol, FLYOS_PROTOCOL } from './lib/tiptap/flyos-link';\nexport {\n ENTITY_LINK_LAUNCHER,\n MARKDOWN_TOOLBAR_PRESETS,\n type EntityLinkLauncher,\n type MarkdownToolbarItem,\n type MarkdownToolbarPreset,\n} from './lib/components/markdown-editor/markdown-editor.types';\n\nexport {\n ContextMenuComponent,\n type ContextMenuItem,\n type ContextMenuSection,\n} from './lib/components/context-menu/context-menu.component';\n\nexport {\n MessageBoxComponent,\n} from './lib/components/message-box/message-box.component';\n\nexport {\n MessageBoxService,\n MessageBoxButtons,\n MessageBoxIcon,\n DialogResult,\n type MessageBoxOptions,\n type MessageBoxOptionsWithAcknowledgement,\n type MessageBoxDontAskAgainConfig,\n type MessageBoxButton,\n type DialogResultWithAcknowledgement,\n} from './lib/components/message-box/message-box.service';\n\nexport {\n SharePanelComponent,\n SHARE_PANEL_DEFAULT_FILE_LEVELS,\n type RoleOuLookupRow,\n} from './lib/components/share-panel/share-panel.component';\n\nexport {\n AudienceBuilderComponent,\n} from './lib/components/audience-builder/audience-builder.component';\n\nexport { FlyBlockUiComponent } from './lib/components/block-ui/block-ui.component';\n\nexport {\n FlyDrawerComponent,\n type FlyDrawerSize,\n type FlyDrawerSide,\n} from './lib/components/drawer/drawer.component';\n\n// ─── File Upload Components ─────────────────────────────────────────────────\nexport type { FlyFileInfo } from './lib/models/file.model';\n\nexport { FlyImageUploadComponent } from './lib/components/image-upload/fly-image-upload.component';\n\nexport { FlyFileUploadComponent } from './lib/components/file-upload/fly-file-upload.component';\n\n// ─── Agent input — registries, directives, types (Phase 1) ──────────────────\nexport {\n AgentCommandRegistry,\n AgentLookupRegistry,\n AgentDropRegistry,\n AgentActionBus,\n AgentFlightAnimator,\n} from './lib/services/agent-input';\n\nexport type {\n AgentAction,\n AgentActionVerb,\n AgentActionDispatch,\n} from './lib/models/agent-action.model';\n\nexport { AgentActionUnsupportedDispatchError } from './lib/models/agent-action.model';\n\nexport { FlyAgentDraggableDirective } from './lib/directives/fly-agent-draggable.directive';\nexport { FlySecureSrcDirective } from './lib/directives/fly-secure-src.directive';\n\nexport {\n AGENT_DRAG_MIME,\n AGENT_PAYLOAD_VERSION,\n SUPPORTED_AGENT_PAYLOAD_VERSIONS,\n DEFAULT_AGENT_PAYLOAD_LIMITS,\n} from './lib/models/agent-input.model';\n\nexport type {\n AgentCommand,\n AgentCommandScope,\n AgentCommandHandle,\n AgentCommandRegistration,\n AgentCommandSlashSpec,\n AgentCommandContextBinding,\n LookupSearch,\n LookupDescriptor,\n LookupRegistration,\n LookupResult,\n LookupHandle,\n AgentDragPayload,\n AgentMessageEnvelope,\n AgentEnvelopeAttachment,\n AgentMcpScope,\n AgentDropChipMode,\n AgentChipHostInputs,\n AgentDraggableItem,\n AgentDropRendererRegistration,\n AgentPayloadLimits,\n AgentPayloadValidationResult,\n} from './lib/models/agent-input.model';\n\nexport {\n utf8ByteLength,\n trimAgentString,\n trimAgentPayload,\n validateAgentPayload,\n AgentPayloadOversizeError,\n} from './lib/utils/agent-payload-guards';\n\n// ─── Cross-cutting locale catalog (dictation today, future translation feature) ──\nexport type { FlyLocaleEntry } from './lib/models/fly-locale-catalog.model';\nexport {\n FLY_LOCALE_CATALOG,\n findLocaleByDialect,\n findLocaleByPrefix,\n isRtlLocaleEntry,\n} from './lib/models/fly-locale-catalog';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["isSignal","i1","DOCUMENT"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BG;AAEH;AACA;AACO,MAAM,cAAc,GAAG,QAAQ;AAE/B,MAAM,mBAAmB,GAAG,sBAAsB;AAMzD;;;;;AAKG;AACG,SAAU,4BAA4B,CAC1C,KAAwD,EACxD,OAAe,EAAA;AAEf,IAAA,MAAM,QAAQ,IAA2B,KAAK,CAAC,mBAAmB,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;AACzF,IAAA,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC;IAC/B,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;;QAEhC,OAAO,CAAC,KAAK,CACX,CAAA,iDAAA,EAAoD,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAA,CAAA,CA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/design-system/src/lib/fly-federation-singleton-guard.ts","../../../projects/design-system/src/lib/models/window.model.ts","../../../projects/design-system/src/lib/models/share-panel.model.ts","../../../projects/design-system/src/lib/models/audience.model.ts","../../../projects/design-system/src/lib/services/auth.service.ts","../../../projects/design-system/src/lib/i18n/baseline-locales.ts","../../../projects/design-system/src/lib/services/i18n.service.ts","../../../projects/design-system/src/lib/services/fly-theme.service.ts","../../../projects/design-system/src/lib/services/window-manager.service.ts","../../../projects/design-system/src/lib/services/fly-remote-router.types.ts","../../../projects/design-system/src/lib/services/fly-remote-router.service.ts","../../../projects/design-system/src/lib/services/fly-remote-context.service.ts","../../../projects/design-system/src/lib/services/source-app-resolver.service.ts","../../../projects/design-system/src/lib/services/fly-window-help.service.ts","../../../projects/design-system/src/lib/services/fly-remote-styles.ts","../../../projects/design-system/src/lib/components/fly-remote-router-outlet/fly-remote-router-outlet.component.ts","../../../projects/design-system/src/lib/pipes/translate.pipe.ts","../../../projects/design-system/src/lib/services/auth.service.mock.ts","../../../projects/design-system/src/lib/services/agent-input/agent-lookup-registry.service.ts","../../../projects/design-system/src/lib/components/entity-lookup/entity-lookup.component.ts","../../../projects/design-system/src/lib/components/entity-lookup/entity-lookup.component.html","../../../projects/design-system/src/lib/tiptap/flyos-link.ts","../../../projects/design-system/src/lib/components/markdown-editor/markdown-editor.types.ts","../../../projects/design-system/src/lib/components/markdown-editor/markdown-editor.component.ts","../../../projects/design-system/src/lib/components/markdown-editor/markdown-editor.component.html","../../../projects/design-system/src/lib/components/context-menu/context-menu.component.ts","../../../projects/design-system/src/lib/components/context-menu/context-menu.component.html","../../../projects/design-system/src/lib/components/message-box/message-box.service.ts","../../../projects/design-system/src/lib/components/message-box/message-box.component.ts","../../../projects/design-system/src/lib/components/message-box/message-box.component.html","../../../projects/design-system/src/lib/components/share-panel/share-panel.component.ts","../../../projects/design-system/src/lib/components/share-panel/share-panel.component.html","../../../projects/design-system/src/lib/components/audience-builder/audience-builder.component.ts","../../../projects/design-system/src/lib/components/audience-builder/audience-builder.component.html","../../../projects/design-system/src/lib/components/block-ui/block-ui.component.ts","../../../projects/design-system/src/lib/components/block-ui/block-ui.component.html","../../../projects/design-system/src/lib/components/drawer/drawer.component.ts","../../../projects/design-system/src/lib/components/drawer/drawer.component.html","../../../projects/design-system/src/lib/components/image-upload/fly-image-upload.component.ts","../../../projects/design-system/src/lib/components/file-upload/fly-file-upload.component.ts","../../../projects/design-system/src/lib/services/agent-input/agent-command-registry.service.ts","../../../projects/design-system/src/lib/services/agent-input/agent-drop-registry.service.ts","../../../projects/design-system/src/lib/models/agent-action.model.ts","../../../projects/design-system/src/lib/models/agent-input.model.ts","../../../projects/design-system/src/lib/utils/agent-payload-guards.ts","../../../projects/design-system/src/lib/services/agent-input/agent-action-bus.service.ts","../../../projects/design-system/src/lib/services/agent-input/agent-flight-animator.service.ts","../../../projects/design-system/src/lib/directives/fly-agent-draggable.directive.ts","../../../projects/design-system/src/lib/directives/fly-secure-src.directive.ts","../../../projects/design-system/src/lib/models/fly-locale-catalog.ts","../../../projects/design-system/src/public-api.ts","../../../projects/design-system/src/mohamedatia-fly-design-system.ts"],"sourcesContent":["/**\n * Federation singleton self-check (side-effecting module).\n *\n * Invariant: the design-system MUST resolve to ONE shared instance per browser\n * window. The FlyOS shell shares it from workspace SOURCE (federation.config.js\n * `sharedMappings` + `features.mappingVersion`, advertising the real version),\n * and every federated remote (Circles, …) binds to that single instance as a\n * `singleton`. If a remote instead bundles its OWN copy — `requiredVersion`\n * unsatisfied, `strictVersion: true`, or the host advertising an empty version\n * because `mappingVersion` is off — the platform silently forks. Separate\n * `providedIn: 'root'` singletons then mean:\n * - cross-app deep links break: `FlyRemoteRouter` writes the canonical\n * `?app=&route=` URL on the remote's own instance, so a reload never reaches\n * the shell's launch pipeline (see skills/cross-app-deep-linking.md);\n * - the `/lookup` + slash-command registries diverge, so entities registered\n * in the remote never reach the shell's agent input.\n *\n * Both bugs are invisible until a user trips over them. This check makes the\n * fork LOUD at load time: each DS module evaluation appends its compiled-in\n * version to a `globalThis` registry, and a second entry in the same window is\n * the fork signal. The healthy case (one shared instance) stays silent.\n *\n * Why a plain `globalThis` key and not DI: a forked DS means a *separate* module\n * graph, so any DI token / module-scoped variable is exactly what's duplicated.\n * Only a JS global is shared across module instances in one window — the same\n * reason `__FLYOS_SHELL__` and the pending-launches registry use globals.\n *\n * See skills/business-app-angular-remote.md § \"Design-system singleton across\n * the federation boundary\".\n */\n\n// Keep in sync with projects/design-system/package.json \"version\". Used only for\n// the diagnostic message — the duplicate-instance detection is version-agnostic.\nexport const FLY_DS_VERSION = '2.12.0';\n\nexport const FLY_DS_REGISTRY_KEY = '__FLY_DS_INSTANCES__';\n\nexport interface FlyDsInstanceRegistry {\n versions: string[];\n}\n\n/**\n * Records this design-system instance on the shared `scope` and returns the\n * running count of instances seen in this window. Emits a single loud\n * `console.error` the moment the count exceeds 1 (the fork signal). Pure aside\n * from the registry mutation + console — callable with a fake scope in tests.\n */\nexport function registerDesignSystemInstance(\n scope: Record<string, FlyDsInstanceRegistry | undefined>,\n version: string,\n): number {\n const registry: FlyDsInstanceRegistry = (scope[FLY_DS_REGISTRY_KEY] ??= { versions: [] });\n registry.versions.push(version);\n if (registry.versions.length > 1) {\n // eslint-disable-next-line no-console\n console.error(\n `[fly-design-system] Federation singleton FORKED: ${registry.versions.length} ` +\n `design-system instances loaded in one window (versions: ${registry.versions.join(', ')}). ` +\n `A federated remote is using its own bundled copy instead of the shell's shared ` +\n `singleton — cross-app deep links and /lookup registration WILL break. Fix: align the ` +\n `remote's federation \\`requiredVersion\\` with the host's advertised version and keep ` +\n `\\`features.mappingVersion: true\\` in the shell's federation.config.js.`,\n );\n }\n return registry.versions.length;\n}\n\n// Run once when this module is evaluated — except under the Vitest runner, which\n// re-evaluates module graphs per test file against a shared Node global and would\n// otherwise accumulate phantom \"instances\". The fork this detects only occurs in a\n// real federated browser runtime, where each bundle evaluates the module exactly once.\n// Reach `process.env.VITEST` via globalThis rather than the bare `process`\n// identifier — the latter needs @types/node, which the production library build\n// (tsconfig.lib.prod.json) deliberately doesn't include, and would fail TS2591.\nconst underTest = !!(\n globalThis as { process?: { env?: Record<string, string | undefined> } }\n).process?.env?.['VITEST'];\nif (!underTest) {\n registerDesignSystemInstance(\n globalThis as unknown as Record<string, FlyDsInstanceRegistry | undefined>,\n FLY_DS_VERSION,\n );\n}\n","import { InjectionToken, Signal, Type, WritableSignal } from '@angular/core';\n\nexport type WindowState = 'normal' | 'minimized' | 'maximized';\n\nexport interface ChildWindowData {\n childComponent: Type<unknown>;\n [key: string]: unknown;\n}\n\nexport interface WindowInstance {\n id: string;\n appId: string;\n title: string;\n icon: string;\n iconBg: string;\n state: WindowState;\n position: { x: number; y: number };\n size: { width: number; height: number };\n zIndex: number;\n isFocused: boolean;\n isClosing?: boolean;\n isMinimizing?: boolean;\n isRestoring?: boolean;\n isMaximizing?: boolean;\n isUnmaximizing?: boolean;\n parentWindowId?: string;\n childData?: ChildWindowData;\n /** Populated when remote `loadComponent()` fails (e.g. federation). */\n remoteLoadError?: string;\n /** When true, the shell draws a block overlay over `.window-content` (see `FlyBlockUiComponent`). */\n contentUiBlocked?: boolean;\n /** i18n key for block overlay label; shell defaults to `common.loading` when unset. */\n contentUiBlockMessageKey?: string;\n}\n\nexport const WINDOW_DATA = new InjectionToken<WindowInstance>('WINDOW_DATA');\n\n/**\n * Payload delivered to a window when it is launched (or re-launched) via a deep link.\n * Both fields are nullable: a normal dock click yields `route: null`, `params: null`.\n * `version` starts at 1 for the first launch and increments on every subsequent\n * re-launch of the same window so listeners can dedupe on `version` changes.\n */\nexport interface LaunchContext {\n readonly route: string | null;\n readonly params: Readonly<Record<string, unknown>> | null;\n readonly version: number;\n}\n\n/**\n * Per-window injection token carrying the active `LaunchContext` as a signal.\n *\n * **Shell-internal.** The shell uses this to track per-window deep-link state across\n * dock launches. **Federated remotes must not consume it** — Native Federation can\n * split the `InjectionToken` instance across the host and remote bundles, in which\n * case `inject(LAUNCH_CONTEXT)` in the remote returns `null` regardless of host\n * provisioning. Remotes subscribe to deep links via the federation-safe surfaces\n * instead: `FLYOS_LAUNCH_EVENT` (window CustomEvent) plus the\n * `__FLYOS_PENDING_LAUNCHES__` registry on `globalThis`. See\n * <c>skills/cross-app-deep-linking.md</c>.\n */\nexport const LAUNCH_CONTEXT = new InjectionToken<Signal<LaunchContext | null>>('LAUNCH_CONTEXT');\n\n/**\n * Detail payload of the <c>flyos:launch</c> window CustomEvent. The shell\n * dispatches one event per launch; remotes use this contract to navigate to the\n * requested route. Mirrored to <see cref=\"FlyosPendingLaunchesGlobalKey\"/> so a\n * remote that mounts AFTER the dispatch can still drain the most recent launch.\n */\nexport interface FlyLaunchEventDetail {\n /** The id used to look up the app in the shell registry (post-canonicalization). */\n readonly appId: string;\n /** The launch payload — same shape the shell stores on the per-window signal. */\n readonly ctx: LaunchContext;\n}\n\n/**\n * Name of the window CustomEvent the shell dispatches per launch.\n *\n * Listeners run on `window` and receive a <c>CustomEvent<FlyLaunchEventDetail></c>.\n * Always filter by `detail.appId` — every remote sees every launch.\n */\nexport const FLYOS_LAUNCH_EVENT = 'flyos:launch';\n\n/**\n * `globalThis` key for the pending-launches registry. Map<appId, LaunchContext>.\n *\n * The shell writes the latest launch for each app and the corresponding remote\n * **drains** the entry on first mount (i.e. reads then deletes). This covers the\n * first-launch race where the event fires before the remote's listener attaches.\n * Subsequent re-launches into the already-mounted remote arrive via the event.\n */\nexport const FlyosPendingLaunchesGlobalKey = '__FLYOS_PENDING_LAUNCHES__' as const;\n\n/** Type of the `globalThis[FlyosPendingLaunchesGlobalKey]` registry. */\nexport type FlyosPendingLaunches = Record<string, LaunchContext>;\n\n/**\n * Detail payload of the <c>flyos:remote-route</c> window CustomEvent — the\n * INVERSE of {@link FLYOS_LAUNCH_EVENT}. A federated remote dispatches this\n * whenever its OWN logical route changes (user navigation inside the remote), so\n * the shell — the single owner of the browser address bar and history — can\n * mirror the route to `…/desktop?app=&route=` and push one history entry.\n *\n * Emitted by `FlyRemoteRouter` ONLY when {@link FlyosShellOwnsHistoryGlobalKey}\n * is set (a new shell is present and listening). Older shells receive no event\n * and the remote keeps writing its own `pushState` — so this is backward\n * compatible.\n */\nexport interface FlyRemoteRouteEventDetail {\n /** The shell-registry app id (from `WINDOW_DATA`). */\n readonly appId: string;\n /** The window instance id, or null when `WINDOW_DATA` is split across bundles. */\n readonly windowId: string | null;\n /** The remote's new logical URL, e.g. `/signals/abc`. */\n readonly url: string;\n}\n\n/** Name of the window CustomEvent a remote dispatches when its route changes. */\nexport const FLYOS_REMOTE_ROUTE_EVENT = 'flyos:remote-route';\n\n/**\n * `globalThis` flag set by the shell when it owns the address bar + history for\n * ALL windows (os-core AND remotes) via `ShellHistoryService`. When set, a\n * remote's `FlyRemoteRouter` defers history to the shell (dispatching\n * {@link FLYOS_REMOTE_ROUTE_EVENT} instead of calling `history.pushState`) and\n * stops handling its own `popstate` (the shell replays routes via\n * {@link FLYOS_LAUNCH_EVENT}). Absent ⇒ legacy self-managed behaviour.\n */\nexport const FlyosShellOwnsHistoryGlobalKey = '__FLYOS_SHELL_OWNS_HISTORY__' as const;\n\n/**\n * Hint published by an app to drive the window-titlebar help-button deeplink.\n *\n * The shell renders the help button automatically on every non-chromeless\n * window, defaulting the deeplink to `params.appId = win.appId`. An app\n * customises that deeplink by injecting <see cref=\"WINDOW_HELP_HINT\"/> and\n * setting the writable signal — typically once on construct + again as the\n * active route/page changes.\n *\n * - `appId` overrides `win.appId` (rare; reserved for embedded sub-apps\n * whose help lives under a different seed-pack id).\n * - `topic` seeds the help-center search query when the deeplink fires.\n * Free-form short phrase (e.g. \"calculated measures\", \"share dialog\").\n * Updated dynamically as the user navigates within the app.\n */\nexport interface WindowHelpHint {\n /** Override for the help-center `appId` chip pre-selection. Optional. */\n readonly appId?: string;\n /** Free-form search-query seed for the help-center landing. */\n readonly topic?: string | null;\n}\n\n/**\n * Per-window injection token carrying the active <see cref=\"WindowHelpHint\"/>\n * as a writable signal. The shell creates one writable signal per window\n * (alongside <see cref=\"LAUNCH_CONTEXT\"/>); apps inject it and `.set(...)` to\n * publish or update their hint. Setting `null` clears the hint — the chrome\n * falls back to the implicit `win.appId` deeplink.\n *\n * **Federation note:** same caveat as <see cref=\"LAUNCH_CONTEXT\"/> — Native\n * Federation can split the InjectionToken across host/remote bundles, so\n * federated remotes cannot rely on DI to publish hints. Use\n * <see cref=\"FLY_WINDOW_HELP_HINT_EVENT\"/> instead.\n */\nexport const WINDOW_HELP_HINT = new InjectionToken<WritableSignal<WindowHelpHint | null>>(\n 'WINDOW_HELP_HINT',\n);\n\n/**\n * Federation-safe window CustomEvent name for publishing a help hint from a\n * federated remote that cannot see <see cref=\"WINDOW_HELP_HINT\"/> via DI.\n *\n * Detail: <see cref=\"FlyWindowHelpHintEventDetail\"/>. The shell listens at\n * `window` scope and mirrors the payload into the matching per-window signal\n * (keyed by `windowId` from <see cref=\"WINDOW_DATA\"/>). Pairs with the\n * <see cref=\"FLYOS_LAUNCH_EVENT\"/> pattern.\n */\nexport const FLY_WINDOW_HELP_HINT_EVENT = 'flyos:window-help-hint';\n\n/**\n * Detail payload of the <see cref=\"FLY_WINDOW_HELP_HINT_EVENT\"/> CustomEvent.\n * Federated remotes dispatch one event per hint change; the shell filters\n * by `windowId` (each window owns its own hint).\n */\nexport interface FlyWindowHelpHintEventDetail {\n /** Window id; remotes obtain via WINDOW_DATA at mount. */\n readonly windowId: string;\n /** Pass `null` to clear; the chrome reverts to win.appId. */\n readonly hint: WindowHelpHint | null;\n}\n","/**\n * Generic share / ACL panel models — hosts map domain DTOs to these shapes.\n *\n * v2.0.0: introduces the {@link SharePrincipal} discriminated union to replace the v1\n * \"set-which-is-set\" discriminator on {@link SharePermissionEntry} (`grantedToUserId` /\n * `grantedToOuId` / `grantedToAppId`). The new shape compiles invalid combinations away\n * (a permission row carries exactly one principal, never overlapping ids) and reserves\n * a `role` kind for the planned apps-chart role-as-principal flow.\n */\n\n/**\n * Discriminated principal that owns a share permission row. Hosts translate domain DTO\n * fields into one of these variants.\n *\n * The `role` variant is reserved for a follow-up enabling the Apps-chart role-as-principal\n * flow end-to-end (frontend looks up the role-OU UUID; backend's PermissionResolver must\n * enumerate the user's full OU set including computed-from-role memberships). Until that\n * runtime work lands, hosts SHOULD NOT emit `role` principals.\n */\nexport type SharePrincipal =\n | UserPrincipal\n | RolePrincipal\n | OuPrincipal\n | AppEveryonePrincipal;\n\nexport interface UserPrincipal {\n kind: 'user';\n /** Tenant-scoped user id. */\n userId: string;\n /** Display name resolved by the host (e.g. \"Jane Doe\"). Falls back to a Guid prefix. */\n displayName?: string;\n /** Optional email — surfaced as a secondary line on the row when set. */\n email?: string;\n}\n\nexport interface RolePrincipal {\n kind: 'role';\n /** Owning app id (e.g. `circles`). Roles are unique within an app, not globally. */\n appId: string;\n /** Stable role key within that app (e.g. `ffo`, `viewer`). */\n roleKey: string;\n displayName?: string;\n}\n\nexport interface OuPrincipal {\n kind: 'ou';\n ouId: string;\n /** Chart context for stable display labels. Null = the Default Company chart. */\n chartId?: string | null;\n displayName?: string;\n}\n\nexport interface AppEveryonePrincipal {\n kind: 'app-everyone';\n /** App id whose user population this grant targets. `*` = every tenant user. */\n appId: string;\n displayName?: string;\n}\n\n/** Principal-kind discriminator strings — re-exported for hosts that build menus dynamically. */\nexport type SharePrincipalKind = SharePrincipal['kind'];\n\n/**\n * One row of the share-panel permissions list. v2.0 carries a {@link SharePrincipal}\n * discriminated union instead of the v1 `grantedToUserId` / `grantedToOuId` / `grantedToAppId`\n * fields. See the file header for migration notes.\n */\nexport interface SharePermissionEntry {\n id: string;\n principal: SharePrincipal;\n level: string;\n isInherited?: boolean;\n /**\n * When true, this row is a deny grant — visually distinct, revokes access for the\n * principal regardless of any matching allow grant. Backed by the ACL semantic in\n * Files Manager (`FilePermission.IsDeny`) and Notes (`NoteShareLevel.Deny`).\n * Hosts that do not support deny grants may omit this field entirely.\n */\n isDeny?: boolean;\n}\n\nexport interface ShareUserResult {\n id: string;\n firstName: string;\n lastName: string;\n email: string;\n}\n\nexport interface ShareOuNode {\n id: string;\n displayName: string;\n /** 0 = root. When set, share panel indents rows for hierarchy. */\n depth?: number;\n}\n\n/** Option for OU tree source: `id` null = default/official org chart. */\nexport interface ShareOrgChartOption {\n id: string | null;\n name: string;\n /**\n * Stable system-chart key used by hosts that want to pre-select a specific platform-managed\n * chart (e.g. `'apps'`, `'default-company'`). Custom charts have no system key. Wired through\n * `defaultChartSystemKey` on share-panel / audience-builder so the host doesn't need to know\n * the tenant-specific Guid up front.\n */\n systemKey?: string | null;\n}\n\n/**\n * Stable identifiers for platform-managed system charts. Hosts that don't recognise the\n * value just fall through to the default selection — these constants are advisory.\n */\nexport const SHARE_ORG_CHART_SYSTEM_KEY_DEFAULT = 'default-company';\nexport const SHARE_ORG_CHART_SYSTEM_KEY_APPS = 'apps';\n\nexport interface SharePanelLevelOption {\n value: string;\n labelKey: string;\n}\n","/**\n * Canonical {@link AudienceFilter} TypeScript model — wire-compatible byte-for-byte with the\n * C# `Fly.Shared.Core.Audience.AudienceFilter` polymorphic record. The discriminator field is\n * `kind` and matches the values declared in `AudienceTerm.cs`'s `[JsonDerivedType]` attributes:\n * `users`, `roles`, `ou`, `app-everyone`, `chart`, `preset`.\n *\n * Resolution semantics (server-side, see `AudienceFilter.cs`):\n * 1. Each include term is expanded to a user-id set; sets are unioned.\n * 2. Each exclude term is expanded; the union of excludes is subtracted.\n * 3. Inactive users are filtered when {@link AudienceOptions.excludeInactiveUsers} is true.\n *\n * **Empty `includes` resolves to the empty set — never \"everyone\".** To target every user in a\n * tenant, emit an explicit {@link AppEveryoneTerm} or {@link ChartTerm}; this matches the\n * defensive backend default and prevents a UI bug from broadcasting tenant-wide.\n */\nexport interface AudienceFilter {\n /** At least one term required server-side; an empty array resolves to zero recipients. */\n includes: AudienceTerm[];\n /** Optional. Subtracted from the include union. */\n excludes?: AudienceTerm[];\n /** Optional resolver options. Server applies defaults when omitted. */\n options?: AudienceOptions;\n}\n\n/** Tagged union of the six supported audience term kinds. */\nexport type AudienceTerm =\n | UsersTerm\n | RolesTerm\n | OuTerm\n | AppEveryoneTerm\n | ChartTerm\n | PresetTerm;\n\nexport type AudienceTermKind = AudienceTerm['kind'];\n\n/** Discriminator string values — re-exported so hosts can build kind menus dynamically. */\nexport const AUDIENCE_TERM_KINDS = [\n 'users',\n 'roles',\n 'ou',\n 'app-everyone',\n 'chart',\n 'preset',\n] as const satisfies readonly AudienceTermKind[];\n\n/**\n * Runtime values for {@link AudiencePresetKind}. Hosts iterate this when surfacing a\n * preset picker; the type union mirrors this list 1:1.\n */\nexport const AUDIENCE_PRESETS = [\n 'self',\n 'ou-managers',\n 'direct-reports',\n] as const satisfies readonly AudiencePresetKind[];\n\n/** Explicit user ids. Capped server-side at {@link AUDIENCE_LIMITS.maxUserIdsPerTerm}. */\nexport interface UsersTerm {\n kind: 'users';\n /** Tenant-scoped user ids. */\n userIds: string[];\n}\n\n/**\n * Users holding any of the named roles in a single owning app. Roles are matched by\n * `(appId, key)` and filtered to active rows by the manifest spec — deprecated roles never\n * expand into the audience. RoleKeys are unique within an app, not globally.\n */\nexport interface RolesTerm {\n kind: 'roles';\n /** The role's owning app id (e.g. `circles`). */\n appId: string;\n /** Role keys within that app (e.g. `[\"ffo\", \"ops\"]`). */\n roleKeys: string[];\n}\n\n/**\n * Members of one or more OUs. `chartId` null = the Default Company chart; non-null targets\n * an alternative chart (including the Apps Chart). When `includeDescendants` is true, members\n * of all descendant OUs are included (resolved server-side via a recursive CTE).\n *\n * `includeDescendants` is required (not optional) so the wire round-trip is unambiguous: a\n * stored term that was previously emitted with `false` deserialises identically to one emitted\n * fresh, and the backend never has to choose between \"missing\" and \"explicit false\". Builders\n * MUST emit a definite boolean.\n */\nexport interface OuTerm {\n kind: 'ou';\n ouIds: string[];\n /**\n * Chart context for descendant traversal; null = default tree by parent id. Use `null`\n * (never `undefined`) to keep wire shape symmetric with C# `Guid?` deserialization.\n */\n chartId: string | null;\n includeDescendants: boolean;\n}\n\n/**\n * \"All users of this app in this tenant\" — semantically the Apps Chart app-root OU. Resolved\n * from `UserRole` rows joined to active roles owned by the app, never from a materialized\n * member list. `appId === '*'` means every tenant user.\n */\nexport interface AppEveryoneTerm {\n kind: 'app-everyone';\n appId: string;\n}\n\n/**\n * \"Every user placed somewhere in this chart\". For the Default Company chart this is every\n * user with at least one OU membership.\n */\nexport interface ChartTerm {\n kind: 'chart';\n chartId: string;\n}\n\n/**\n * Named platform preset evaluated against an anchor user. Anchor is typically the request\n * initiator (`Self`) or a referenced user (e.g. delegate's manager).\n */\nexport interface PresetTerm {\n kind: 'preset';\n preset: AudiencePresetKind;\n anchorUserId: string;\n}\n\n/**\n * Supported audience presets. Kept intentionally small — wire matches C# `JsonStringEnumMemberName`.\n */\nexport type AudiencePresetKind = 'self' | 'ou-managers' | 'direct-reports';\n\nexport interface AudienceOptions {\n /** When true (default), users with `IsActive=false` are filtered out. */\n excludeInactiveUsers?: boolean;\n /** Caller-supplied ceiling. Server clamps to {@link AUDIENCE_LIMITS.maxResolvedUsers}. */\n hardCap?: number;\n}\n\n/**\n * Hard caps mirrored from `AudienceLimits.cs`. Hosts use these for client-side validation\n * before submit — backend re-validates regardless. Keep these in sync with the C# constants.\n */\nexport const AUDIENCE_LIMITS = {\n maxTermsPerFilter: 64,\n maxUserIdsPerTerm: 500,\n maxRoleKeysPerTerm: 64,\n maxOuIdsPerTerm: 32,\n maxResolvedUsers: 10_000,\n} as const;\n","import { Injectable, computed, signal } from '@angular/core';\nimport { User } from '../models/user.model';\n\ninterface AuthSession {\n user: User;\n accessToken: string;\n expiresAt: number;\n}\n\n/**\n * Shared AuthService for Business Apps.\n *\n * This is a **read-only signal store** — Business Apps inject it to read the\n * current user and access token. The FlyOS shell populates it after PKCE login\n * and silent refresh. Business Apps must never call setSession() directly.\n *\n * When running as a Module Federation remote, the shell and the Business App\n * share this singleton via the `@mohamedatia/fly-design-system` shared mapping\n * in federation.config.js — so the shell's populated instance is the same\n * object the Business App reads.\n *\n * When running standalone (without the shell), call initFromToken() with a\n * JWT stored in localStorage to hydrate the user.\n */\n@Injectable({ providedIn: 'root' })\nexport class AuthService {\n private _session = signal<AuthSession | null>(null);\n\n readonly currentUser = computed(() => this._session()?.user ?? null);\n readonly accessToken = computed(() => this._session()?.accessToken ?? null);\n readonly isAuthenticated = computed(() => {\n const s = this._session();\n return s !== null && s.expiresAt > Date.now();\n });\n\n /**\n * No-op when running as a Module Federation remote — the shell has already\n * initialised the session before the remote bootstraps. Business Apps call\n * this in their APP_INITIALIZER so the same code works in both standalone\n * and embedded modes without branching.\n */\n async init(): Promise<void> {}\n\n /**\n * Called by the shell after a successful login or silent refresh.\n * Business Apps should not call this directly.\n */\n setSession(user: User, accessToken: string, expiresAt: number): void {\n this._session.set({ user, accessToken, expiresAt });\n }\n\n /** Clears the in-memory session (called by the shell on logout). */\n clearSession(): void {\n this._session.set(null);\n }\n\n /**\n * Standalone mode: parse a JWT from localStorage and hydrate the user.\n * Pass the storage key your app uses; embedded remotes typically set this in `APP_INITIALIZER`.\n */\n initFromToken(storageKey = 'circles_token'): void {\n const token = localStorage.getItem(storageKey);\n if (!token) return;\n try {\n const base64 = token.split('.')[1].replace(/-/g, '+').replace(/_/g, '/');\n const payload = JSON.parse(decodeURIComponent(\n atob(base64).split('').map(c => '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)).join('')\n )) as Record<string, unknown>;\n\n const rawRole = payload['role'];\n const roles = Array.isArray(rawRole) ? rawRole as string[] : rawRole ? [rawRole as string] : [];\n const rawApps = payload['apps'];\n const apps = Array.isArray(rawApps) ? rawApps as string[] : rawApps ? [rawApps as string] : [];\n const name = (payload['name'] as string) ?? '';\n const nameParts = name.split(' ');\n\n const user: User = {\n id: (payload['sub'] as string) ?? '',\n tenantId: (payload['tenant_id'] as string) ?? (payload['tid'] as string) ?? null,\n email: (payload['email'] as string) ?? '',\n fullName: name,\n firstName: nameParts[0] ?? '',\n lastName: nameParts.slice(1).join(' '),\n preferredLocale: (payload['locale'] as string) ?? 'en',\n roles,\n apps,\n ou: payload['ou'] as string | undefined,\n };\n\n const expiresAt = ((payload['exp'] as number) ?? 0) * 1000;\n this.setSession(user, token, expiresAt);\n } catch {\n // Invalid token — stay unauthenticated\n }\n }\n}\n","/**\n * Baseline UI strings for design-system components (markdown editor, entity\n * lookup, …) in the four platform locales (`en`, `ar`, `fr`, `ur`).\n *\n * These are registered as the **lowest-priority** layer of {@link I18nService}\n * (below the shell layer and any remote bundle), so DS components render real,\n * localized labels even in a **standalone** consumer — a Business App running\n * outside the desktop shell that never called `setShellTranslations()` — which\n * would otherwise see raw keys (`common.label.bold`) as the pipe's fallback.\n *\n * Precedence: any consumer-supplied key with the same name still wins, so this\n * is a safe default that an integrator can override without coordination.\n *\n * Scope: only the keys the **shippable** DS components reference today\n * (`common.*` toolbar/link labels + `agent.lookup.*`). When a new DS component\n * starts using `| translate`, add its keys here so it stays self-sufficient.\n * Values are copied verbatim from the shell's `public/locale/*.json` — keep\n * them in sync if either side changes.\n */\nexport const DS_BASELINE_LOCALES: Readonly<Record<string, Readonly<Record<string, string>>>> = {\n en: {\n 'common.action.cancel': 'Cancel',\n 'common.label.apply': 'Apply',\n 'common.label.formatting_toolbar': 'Formatting toolbar',\n 'common.label.https': 'https://…',\n 'common.label.insert_entity_link': 'Insert in-app link',\n 'common.label.link': 'Link',\n 'common.label.blockquote': 'Quote',\n 'common.label.bold': 'Bold',\n 'common.label.bullet_list': 'Bulleted list',\n 'common.label.code_block': 'Code block',\n 'common.label.heading1': 'Heading 1',\n 'common.label.heading2': 'Heading 2',\n 'common.label.heading3': 'Heading 3',\n 'common.label.horizontal_rule': 'Divider',\n 'common.label.inline_code': 'Inline code',\n 'common.label.italic': 'Italic',\n 'common.label.numbered_list': 'Numbered list',\n 'common.label.redo': 'Redo',\n 'common.label.strikethrough': 'Strikethrough',\n 'common.label.task_list': 'Task list',\n 'common.label.underline': 'Underline',\n 'common.label.undo': 'Undo',\n 'agent.lookup.back_aria': 'Back to entity types',\n 'agent.lookup.dialog_aria': 'Entity lookup',\n 'agent.lookup.no_entities': 'No items available to reference.',\n 'agent.lookup.no_results': 'No matches found.',\n 'agent.lookup.searching': 'Searching…',\n },\n ar: {\n 'common.action.cancel': 'إلغاء',\n 'common.label.apply': 'تطبيق',\n 'common.label.formatting_toolbar': 'شريط أدوات التنسيق',\n 'common.label.https': 'https://…',\n 'common.label.insert_entity_link': 'إدراج رابط داخل التطبيق',\n 'common.label.link': 'رابط',\n 'common.label.blockquote': 'اقتباس',\n 'common.label.bold': 'غامق',\n 'common.label.bullet_list': 'قائمة نقطية',\n 'common.label.code_block': 'كتلة شيفرة',\n 'common.label.heading1': 'عنوان 1',\n 'common.label.heading2': 'عنوان 2',\n 'common.label.heading3': 'عنوان 3',\n 'common.label.horizontal_rule': 'فاصل',\n 'common.label.inline_code': 'كود مضمّن',\n 'common.label.italic': 'مائل',\n 'common.label.numbered_list': 'قائمة مرقَّمة',\n 'common.label.redo': 'إعادة',\n 'common.label.strikethrough': 'يتوسطه خط',\n 'common.label.task_list': 'قائمة مهام',\n 'common.label.underline': 'تسطير',\n 'common.label.undo': 'تراجع',\n 'agent.lookup.back_aria': 'العودة إلى أنواع العناصر',\n 'agent.lookup.dialog_aria': 'البحث عن عنصر',\n 'agent.lookup.no_entities': 'لا توجد عناصر متاحة للإشارة إليها.',\n 'agent.lookup.no_results': 'لا توجد نتائج مطابقة.',\n 'agent.lookup.searching': 'جارٍ البحث…',\n },\n fr: {\n 'common.action.cancel': 'Annuler',\n 'common.label.apply': 'Appliquer',\n 'common.label.formatting_toolbar': \"Barre d'outils de mise en forme\",\n 'common.label.https': 'https://…',\n 'common.label.insert_entity_link': 'Insérer un lien interne',\n 'common.label.link': 'Lien',\n 'common.label.blockquote': 'Citation',\n 'common.label.bold': 'Gras',\n 'common.label.bullet_list': 'Liste à puces',\n 'common.label.code_block': 'Bloc de code',\n 'common.label.heading1': 'Titre 1',\n 'common.label.heading2': 'Titre 2',\n 'common.label.heading3': 'Titre 3',\n 'common.label.horizontal_rule': 'Séparateur',\n 'common.label.inline_code': 'Code en ligne',\n 'common.label.italic': 'Italique',\n 'common.label.numbered_list': 'Liste numérotée',\n 'common.label.redo': 'Rétablir',\n 'common.label.strikethrough': 'Barré',\n 'common.label.task_list': 'Liste de tâches',\n 'common.label.underline': 'Souligner',\n 'common.label.undo': 'Annuler',\n 'agent.lookup.back_aria': \"Retour aux types d'entité\",\n 'agent.lookup.dialog_aria': \"Recherche d'entité\",\n 'agent.lookup.no_entities': 'Aucun élément disponible à référencer.',\n 'agent.lookup.no_results': 'Aucun résultat trouvé.',\n 'agent.lookup.searching': 'Recherche en cours…',\n },\n ur: {\n 'common.action.cancel': 'منسوخ کریں',\n 'common.label.apply': 'لاگو کریں',\n 'common.label.formatting_toolbar': 'فارمیٹنگ ٹول بار',\n 'common.label.https': 'https://…',\n 'common.label.insert_entity_link': 'ان-ایپ لنک داخل کریں',\n 'common.label.link': 'لنک',\n 'common.label.blockquote': 'اقتباس',\n 'common.label.bold': 'موٹا',\n 'common.label.bullet_list': 'بلٹ فہرست',\n 'common.label.code_block': 'کوڈ بلاک',\n 'common.label.heading1': 'سرخی 1',\n 'common.label.heading2': 'سرخی 2',\n 'common.label.heading3': 'سرخی 3',\n 'common.label.horizontal_rule': 'تقسیم لائن',\n 'common.label.inline_code': 'ان لائن کوڈ',\n 'common.label.italic': 'ترچھا',\n 'common.label.numbered_list': 'نمبر والی فہرست',\n 'common.label.redo': 'دوبارہ کریں',\n 'common.label.strikethrough': 'خط زدہ',\n 'common.label.task_list': 'ٹاسک فہرست',\n 'common.label.underline': 'خط کشید',\n 'common.label.undo': 'واپس کریں',\n 'agent.lookup.back_aria': 'عناصر کی اقسام پر واپس جائیں',\n 'agent.lookup.dialog_aria': 'عنصر کی تلاش',\n 'agent.lookup.no_entities': 'حوالہ دینے کے لیے کوئی آئٹم دستیاب نہیں۔',\n 'agent.lookup.no_results': 'کوئی مماثل نتیجہ نہیں ملا۔',\n 'agent.lookup.searching': 'تلاش جاری ہے…',\n },\n};\n","import { Injectable, computed, signal, inject, ErrorHandler } from '@angular/core';\nimport { DS_BASELINE_LOCALES } from '../i18n/baseline-locales';\n\n/** Locales that use RTL layout for `dir` and DS `isRtl` / `direction`. */\nexport const RTL_LOCALE_SET: ReadonlySet<string> = new Set(['ar', 'ur']);\n\nexport function isRtlLocale(lang: string): boolean {\n return RTL_LOCALE_SET.has(lang);\n}\n\nfunction escapeRegExp(s: string): string {\n return s.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n}\n\n/** Accepts flat or nested JSON objects; nested keys become dot paths. Rejects arrays and non-string leaves. */\nfunction normalizeLocaleJson(raw: unknown): Record<string, string> {\n if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {\n throw new Error('Locale bundle must be a JSON object');\n }\n const out: Record<string, string> = {};\n const walk = (obj: Record<string, unknown>, prefix: string): void => {\n for (const [k, v] of Object.entries(obj)) {\n const path = prefix ? `${prefix}.${k}` : k;\n if (typeof v === 'string') {\n out[path] = v;\n } else if (v !== null && typeof v === 'object' && !Array.isArray(v)) {\n walk(v as Record<string, unknown>, path);\n } else {\n throw new Error(`Locale bundle invalid value at \"${path}\" (expected string or nested object)`);\n }\n }\n };\n walk(raw as Record<string, unknown>, '');\n return out;\n}\n\n/** Options for loading a remote or standalone locale JSON bundle. */\nexport interface LoadBundleOptions {\n /** Stable id (e.g. app id from manifest); later loads replace this bundle only. */\n id: string;\n /** Base URL ending with `/`, e.g. `https://app.example.com/locale/` or `/my-remote/locale/` */\n baseUrl: string;\n lang: string;\n /** When aborted, failures are ignored (e.g. superseded language load). */\n signal?: AbortSignal;\n /**\n * When true, fetch/parse failures are not reported via Angular `ErrorHandler`.\n * Use for optional remote locale bundles (e.g. federated apps that may be offline).\n */\n silent?: boolean;\n}\n\n/**\n * Shared I18nService for the shell and Business Apps.\n *\n * **Merge order** (later keys win): DS baseline → shell layer → remote bundles\n * in registration order.\n *\n * - Baseline: {@link DS_BASELINE_LOCALES} — built-in strings for DS components\n * (markdown editor, entity lookup) so they render localized labels even in a\n * standalone consumer that never populated the shell layer. Always overridable.\n * - Shell: `setShellTranslations()` after loading `locale/{lang}.json` and API overrides.\n * - Remotes: `loadBundle()` per manifest `localeBaseUrl`.\n */\n@Injectable({ providedIn: 'root' })\nexport class I18nService {\n private readonly errorHandler = inject(ErrorHandler, { optional: true });\n\n private readonly _shell = signal<Record<string, string>>({});\n private readonly _bundles = signal<Record<string, Record<string, string>>>({});\n private readonly _bundleOrder = signal<string[]>([]);\n private readonly _locale = signal<string>('en');\n private readonly _version = signal(0);\n\n /** Built-in DS strings for the active locale (falls back to `en` for any\n * locale we don't ship). Lowest-priority layer — always overridable. */\n private readonly _baseline = computed<Record<string, string>>(\n () => DS_BASELINE_LOCALES[this._locale()] ?? DS_BASELINE_LOCALES['en'] ?? {},\n );\n\n private readonly _merged = computed(() => {\n const shell = this._shell();\n const order = this._bundleOrder();\n const bundles = this._bundles();\n let out: Record<string, string> = { ...this._baseline(), ...shell };\n for (const id of order) {\n const b = bundles[id];\n if (b) out = { ...out, ...b };\n }\n return out;\n });\n\n readonly locale = this._locale.asReadonly();\n readonly version = this._version.asReadonly();\n readonly isRtl = computed(() => isRtlLocale(this._locale()));\n readonly direction = computed(() => (isRtlLocale(this._locale()) ? 'rtl' : 'ltr'));\n\n private bump(): void {\n this._version.update((v) => v + 1);\n }\n\n /** Replace shell strings (desktop `locale/*.json` + `/api/i18n/desktop-shell/{lang}` merged by the shell). */\n setShellTranslations(data: Record<string, string>, lang: string): void {\n this._shell.set(data);\n this._locale.set(lang);\n this.bump();\n }\n\n setLanguage(lang: string): void {\n this._locale.set(lang);\n this.bump();\n }\n\n /**\n * Fetch `{baseUrl}{lang}.json` and store under `id`. New ids are appended to the merge order.\n * @returns whether the bundle was loaded successfully.\n */\n async loadBundle(opts: LoadBundleOptions): Promise<boolean> {\n const { id, baseUrl, lang, signal: abortSignal, silent } = opts;\n try {\n const base = baseUrl.endsWith('/') ? baseUrl : `${baseUrl}/`;\n const url = `${base}${lang}.json`;\n const resp = await fetch(url, { signal: abortSignal });\n if (!resp.ok) throw new Error(`HTTP ${resp.status}`);\n const data = normalizeLocaleJson(await resp.json());\n if (abortSignal?.aborted) return false;\n this._bundles.update((b) => ({ ...b, [id]: data }));\n this._bundleOrder.update((order) => (order.includes(id) ? order : [...order, id]));\n this._locale.set(lang);\n this.bump();\n return true;\n } catch (e) {\n if (abortSignal?.aborted) return false;\n if (!silent) this.errorHandler?.handleError(e);\n return false;\n }\n }\n\n removeBundle(id: string): void {\n this._bundles.update((b) => {\n const next = { ...b };\n delete next[id];\n return next;\n });\n this._bundleOrder.update((order) => order.filter((x) => x !== id));\n this.bump();\n }\n\n clearRemoteBundles(): void {\n this._bundles.set({});\n this._bundleOrder.set([]);\n this.bump();\n }\n\n t(key: string, params?: Record<string, string | number>): string {\n const val = this._merged()[key] ?? key;\n if (!params) return val;\n return Object.entries(params).reduce((result, [k, v]) => {\n const safe = escapeRegExp(k);\n return result.replace(new RegExp(`{{\\\\s*${safe}\\\\s*}}`, 'g'), String(v));\n }, val);\n }\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport { Injectable, inject, PLATFORM_ID, signal } from '@angular/core';\n\n/** Single source of truth for persisted / API theme strings. */\nexport const FLY_THEME_MODE_IDS = ['light', 'dark'] as const;\n\nexport type FlyThemeMode = (typeof FLY_THEME_MODE_IDS)[number];\n\n/** Factory default: `dark` (opaque dark / `html.dark-theme`); shell i18n `settings.theme.dark`. Keep in sync with `UserSettings` defaults. */\nexport const DEFAULT_FLY_THEME_MODE: FlyThemeMode = 'dark';\n\n/** Coerce unknown values (localStorage, API) to a valid theme mode. */\nexport function normalizeFlyTheme(value: unknown): FlyThemeMode {\n if (typeof value === 'string' && (FLY_THEME_MODE_IDS as readonly string[]).includes(value)) {\n return value as FlyThemeMode;\n }\n return DEFAULT_FLY_THEME_MODE;\n}\n\n/**\n * Applies `html.light-theme` / `html.dark-theme` for DS SCSS.\n * Shell and standalone Business Apps use the same service (federation singleton when shared).\n */\n@Injectable({ providedIn: 'root' })\nexport class FlyThemeService {\n private readonly platformId = inject(PLATFORM_ID);\n\n readonly theme = signal<FlyThemeMode>(DEFAULT_FLY_THEME_MODE);\n\n applyTheme(mode: FlyThemeMode): void {\n this.theme.set(mode);\n if (!isPlatformBrowser(this.platformId)) {\n return;\n }\n const html = document.documentElement;\n html.classList.remove('light-theme', 'dark-theme');\n if (mode === 'dark') {\n html.classList.add('dark-theme');\n } else {\n html.classList.add('light-theme');\n }\n }\n}\n","import { Injectable } from '@angular/core';\n\n/** Options for opening a child window. */\nexport interface OpenWindowOptions {\n /** Unique identifier for the window instance. */\n windowId: string;\n /** Display title shown in the window chrome. */\n title: string;\n /** Route path or URL to load inside the window. */\n route: string;\n /** Initial width in pixels. Defaults to 900. */\n width?: number;\n /** Initial height in pixels. Defaults to 600. */\n height?: number;\n /** Whether the window can be resized. Defaults to true. */\n resizable?: boolean;\n /** Whether the window can be maximised. Defaults to true. */\n maximizable?: boolean;\n /** Arbitrary data passed to the child window via WINDOW_DATA. */\n data?: unknown;\n}\n\n/**\n * Abstract interface for the WindowManager.\n * The FlyOS shell provides the concrete implementation; Business Apps\n * inject this token to open, close, and focus windows without depending\n * on the shell's internal implementation.\n */\nexport abstract class WindowManagerService {\n abstract openChildWindow(options: OpenWindowOptions): void;\n abstract closeWindow(windowId: string): void;\n abstract focusWindow(windowId: string): void;\n\n /**\n * Shell: increments per-window depth and shows content block UI.\n * Standalone / no host: no-op.\n */\n beginContentUiBlock(_windowId: string, _messageKey?: string): void {}\n\n /** Shell: decrements depth; clears block when depth reaches 0. Standalone: no-op. */\n endContentUiBlock(_windowId: string): void {}\n}\n\n/**\n * No-op fallback implementation used when running a Business App in\n * standalone mode (outside the FlyOS shell). Logs a warning instead of\n * throwing so standalone dev/test flows are not broken.\n */\n@Injectable()\nexport class StandaloneWindowManagerService extends WindowManagerService {\n openChildWindow(options: OpenWindowOptions): void {\n console.warn('[WindowManagerService] openChildWindow called in standalone mode — no shell available.', options);\n }\n\n closeWindow(windowId: string): void {\n console.warn('[WindowManagerService] closeWindow called in standalone mode — no shell available.', windowId);\n }\n\n focusWindow(windowId: string): void {\n console.warn('[WindowManagerService] focusWindow called in standalone mode — no shell available.', windowId);\n }\n}\n\n","import { InjectionToken, Type } from '@angular/core';\n\n/**\n * One row in a remote's route table. Mirrors Angular's `Route` interface but\n * pared down to what the FlyOS-embedded router actually supports — synchronous\n * component refs only (no `loadChildren`, no resolvers/guards).\n *\n * Patterns:\n * '' — matches an empty URL (\"/\")\n * 'signals' — exact static segment\n * 'signals/:id' — `:foo` captures any single segment into `params.foo`\n * 'signals/:id/edit' — mixed static + capture segments\n *\n * `data` is an opaque bag the consumer can read from `router.matchedRoute()?.data`.\n */\nexport interface FlyRemoteRoute {\n readonly path: string;\n readonly component: Type<unknown>;\n readonly data?: Readonly<Record<string, unknown>>;\n}\n\n/**\n * Result of matching the current `segments` against a remote's route table.\n * `params` contains captured `:foo` segments — empty object for paths with no\n * captures.\n */\nexport interface FlyRemoteMatch {\n readonly route: FlyRemoteRoute;\n readonly params: Readonly<Record<string, string>>;\n}\n\n/**\n * Optional injection token a remote provides at its root to declare which routes\n * `<fly-remote-router-outlet>` should resolve. Provided WITHIN the remote (not\n * the shell), e.g.:\n *\n * ```ts\n * @Component({\n * providers: [\n * FlyRemoteRouter,\n * { provide: FLY_REMOTE_ROUTES, useValue: CIRCLES_ROUTES },\n * ],\n * })\n * export class CirclesComponent { }\n * ```\n *\n * If no routes are provided, `FlyRemoteRouter.matchedRoute()` is always `null`\n * and the outlet renders nothing — useful for remotes that don't need internal\n * routing.\n */\nexport const FLY_REMOTE_ROUTES = new InjectionToken<readonly FlyRemoteRoute[]>(\n 'FLY_REMOTE_ROUTES',\n);\n\n/**\n * Optional injection token a remote provides at its root to declare the shell\n * mount path prefix (e.g. `'/desktop'`). When set, `FlyRemoteRouter.segments()`\n * strips this prefix from `window.location.pathname` before matching routes.\n *\n * **Why this is needed:** In embedded mode the remote is loaded via\n * `NgComponentOutlet` inside the shell SPA. The shell's own Angular route may\n * leave `window.location.pathname` as `/desktop` (or any shell-level path).\n * Without stripping that prefix, `segments()` returns `['desktop']` which\n * matches none of the remote's Circles-internal routes (e.g. `''`, `'signals'`,\n * `'signals/:id'`), so `<fly-remote-router-outlet>` renders nothing.\n *\n * **Default behaviour (token absent):** `FlyRemoteRouter` initialises `_url`\n * to `'/'` in embedded mode, completely ignoring `window.location.pathname`.\n * This is safe because the shell does not push the remote's logical URL into\n * browser history — only `navigate()` / `navigateByUrl()` calls do.\n *\n * **Usage in a remote root component:**\n * ```ts\n * providers: [\n * FlyRemoteRouter,\n * { provide: FLY_REMOTE_ROUTES, useValue: MY_ROUTES },\n * { provide: FLY_REMOTE_BASE_PATH, useValue: '/desktop' },\n * ]\n * ```\n *\n * With `basePath = '/desktop'` and `window.location.pathname = '/desktop'`,\n * the stripped URL is `'/'` → `segments() = []` → matches the `''` default\n * route. With pathname `'/desktop/signals/abc'`, segments become\n * `['signals', 'abc']` → matches `'signals/:id'`.\n *\n * Available since design-system **2.7.2**.\n */\nexport const FLY_REMOTE_BASE_PATH = new InjectionToken<string>(\n 'FLY_REMOTE_BASE_PATH',\n);\n\n/**\n * Match a route's path pattern against URL segments. Returns the captured params\n * map on a successful match, or `null` if the pattern can't match. Empty path\n * matches only an empty segments array.\n *\n * Exported for unit testing — most consumers should rely on\n * `FlyRemoteRouter.matchedRoute()`.\n */\nexport function matchFlyRoutePattern(\n pattern: string,\n segments: readonly string[],\n): Record<string, string> | null {\n const patternSegments = pattern.split('/').filter(Boolean);\n if (patternSegments.length !== segments.length) return null;\n\n const params: Record<string, string> = {};\n for (let i = 0; i < patternSegments.length; i++) {\n const p = patternSegments[i];\n const s = segments[i];\n if (p.startsWith(':')) {\n params[p.slice(1)] = decodeURIComponent(s);\n } else if (p !== s) {\n return null;\n }\n }\n return params;\n}\n","import { DestroyRef, Injectable, computed, inject, signal } from '@angular/core';\nimport {\n NavigationEnd,\n NavigationExtras,\n Router,\n} from '@angular/router';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport {\n WINDOW_DATA,\n FLYOS_REMOTE_ROUTE_EVENT,\n FlyosShellOwnsHistoryGlobalKey,\n type FlyRemoteRouteEventDetail,\n} from '../models/window.model';\nimport {\n FLY_REMOTE_BASE_PATH,\n FLY_REMOTE_ROUTES,\n FlyRemoteMatch,\n matchFlyRoutePattern,\n} from './fly-remote-router.types';\n\n/**\n * FlyOS standard navigation surface for Business / Supporting App remotes.\n *\n * Problem this solves\n * -------------------\n * A federated remote ships with its own Angular `Routes` table that works\n * perfectly in **standalone** mode (e.g. `http://localhost:7202/signals/:id`).\n * Once the same remote is mounted inside the FlyOS desktop shell via\n * `*ngComponentOutlet`, `inject(Router)` resolves to the **host shell's**\n * Router — which has no knowledge of `/signals/:id`. Calls like\n * `router.navigate(['/signals', id])` then silently no-op and the click\n * \"does nothing.\"\n *\n * The fix\n * -------\n * Inject `FlyRemoteRouter` instead of `Router`. It mirrors `Router.navigate` /\n * `Router.navigateByUrl` and:\n *\n * - **Standalone** (no `WINDOW_DATA`): delegates to the real Angular Router,\n * so the URL bar, browser back button, and `RouterLink` continue to work\n * exactly as before.\n * - **Embedded** (mounted in the shell via `WINDOW_DATA`): writes the target\n * URL to an internal signal (`url`, `segments`) and does **not** touch the\n * host's Router. The remote's root component watches the signal and renders\n * the right view (typically a `@switch` on the first segment, plus an inline\n * overlay for detail pages).\n *\n * Usage in a list page\n * --------------------\n * ```ts\n * private readonly router = inject(FlyRemoteRouter);\n *\n * openDetail(item: Signal): void {\n * this.router.navigate(['/signals', item.id]); // works in both modes\n * }\n * ```\n *\n * Usage in the remote's root component (embedded dispatcher)\n * ----------------------------------------------------------\n * ```ts\n * private readonly router = inject(FlyRemoteRouter);\n *\n * readonly view = computed(() => {\n * if (!this.router.isEmbedded) return null; // standalone: <router-outlet> handles it\n * const [head, id] = this.router.segments();\n * if (head === 'signals' && id) return { kind: 'signal-detail', id };\n * if (head === 'signals') return { kind: 'signals-list' };\n * return { kind: head ?? 'home' };\n * });\n * ```\n *\n * Notes\n * -----\n * - `WINDOW_DATA` is the canonical \"I am running inside the shell\" marker; the\n * shell provides it per window, and it is `null` everywhere else.\n * - `Router` is injected as `optional`. A remote that does not register a Router\n * (e.g. a tiny chromeless utility app) still gets a working `navigate` that\n * updates the `url` signal in embedded mode.\n */\n@Injectable({ providedIn: 'root' })\nexport class FlyRemoteRouter {\n private readonly windowData = inject(WINDOW_DATA, { optional: true });\n private readonly router = inject(Router, { optional: true });\n /**\n * Optional route table — if the remote provides `FLY_REMOTE_ROUTES`,\n * `matchedRoute` / `params` resolve against it. Unset means the consumer is\n * driving its own switch/template — `matchedRoute` stays `null`.\n */\n private readonly routes = inject(FLY_REMOTE_ROUTES, { optional: true }) ?? [];\n /**\n * Shell mount path prefix to strip from `window.location.pathname` when\n * deriving the initial URL in embedded mode. See `FLY_REMOTE_BASE_PATH` docs.\n *\n * When absent (the common case), the embedded router initialises `_url` to\n * `'/'` and ignores `window.location.pathname` entirely — correct because the\n * shell SPA never encodes the remote's logical route into the browser URL.\n */\n private readonly basePath = inject(FLY_REMOTE_BASE_PATH, { optional: true }) ?? null;\n\n /**\n * True when this remote is rendered inside the FlyOS desktop shell.\n *\n * Detection order:\n * 1. `WINDOW_DATA` is provided — the canonical signal, works when the\n * design-system module is genuinely shared via Native Federation's\n * `sharedMappings` and the InjectionToken identity matches.\n * 2. `globalThis.__FLYOS_SHELL__ === true` — set by the shell's `main.ts`\n * before `initFederation`. A plain JS global is shared across all\n * module instances in the same browser context, so this works even\n * when the InjectionToken splits between host and remote bundles\n * (a known Native Federation edge case).\n */\n readonly isEmbedded: boolean =\n this.windowData != null\n || (typeof globalThis !== 'undefined'\n && (globalThis as { __FLYOS_SHELL__?: boolean }).__FLYOS_SHELL__ === true);\n\n /**\n * True when a new shell owns the browser address bar + history for every\n * window (it set {@link FlyosShellOwnsHistoryGlobalKey}). In that mode this\n * router defers history to the shell: it dispatches {@link FLYOS_REMOTE_ROUTE_EVENT}\n * instead of `pushState`, and does not handle its own `popstate` (the shell\n * replays routes via `FLYOS_LAUNCH_EVENT`). Absent ⇒ legacy self-managed mode.\n */\n private get shellOwnsHistory(): boolean {\n return (\n typeof globalThis !== 'undefined' &&\n (globalThis as { [FlyosShellOwnsHistoryGlobalKey]?: boolean })[FlyosShellOwnsHistoryGlobalKey] === true\n );\n }\n\n private readonly _url = signal<string>('/');\n\n /**\n * Current logical URL of the remote — `/signals/abc` etc.\n *\n * Standalone: mirrors `Router.url` and is updated on every `NavigationEnd`.\n * Embedded: updated by `navigate` / `navigateByUrl` only.\n */\n readonly url = this._url.asReadonly();\n\n /**\n * `url` parsed into path segments, e.g. `'/signals/abc'` → `['signals', 'abc']`.\n * Query string and hash are stripped. Empty segments removed.\n */\n readonly segments = computed<readonly string[]>(() => {\n const u = this._url();\n return u.split('?')[0].split('#')[0].split('/').filter(Boolean);\n });\n\n /**\n * First route from `FLY_REMOTE_ROUTES` whose pattern matches `segments()`,\n * paired with its captured params. `null` when no routes are registered or\n * none matches. Used by `<fly-remote-router-outlet>` to pick what to render.\n *\n * Match order: routes are tried in declaration order. Put more specific\n * patterns (e.g. `'signals/:id'`) before catch-alls.\n */\n readonly matchedRoute = computed<FlyRemoteMatch | null>(() => {\n const segs = this.segments();\n for (const route of this.routes) {\n const params = matchFlyRoutePattern(route.path, segs);\n if (params != null) return { route, params };\n }\n return null;\n });\n\n /**\n * Captured route params from the active route, e.g. `{ id: 'abc' }` for a\n * `'signals/:id'` match on `/signals/abc`. Empty object if no route matched\n * or the matched route has no captures.\n *\n * Components can read this directly:\n * ```ts\n * private readonly flyRouter = inject(FlyRemoteRouter);\n * readonly signalId = computed(() => this.flyRouter.params()['id'] ?? '');\n * ```\n */\n readonly params = computed<Readonly<Record<string, string>>>(() =>\n this.matchedRoute()?.params ?? {},\n );\n\n private readonly destroyRef = inject(DestroyRef);\n\n constructor() {\n if (!this.isEmbedded && this.router) {\n // Standalone: seed from Angular Router and track NavigationEnd events so\n // browser back/forward (which the host Router handles) keep segments() current.\n this._url.set(this.router.url);\n this.router.events\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe(event => {\n if (event instanceof NavigationEnd) {\n this._url.set(event.urlAfterRedirects);\n }\n });\n } else if (this.isEmbedded) {\n // Embedded: the shell SPA keeps its own route in window.location.pathname\n // (e.g. '/desktop') which is meaningless for the remote's route table.\n // Default: initialise to '/' so the remote's empty-path default route\n // matches on first render. When FLY_REMOTE_BASE_PATH is provided, strip\n // it from pathname first — useful if the shell does push a remote-aware\n // URL (e.g. '/desktop/signals/abc' with basePath '/desktop').\n if (typeof window !== 'undefined') {\n const rawPath = window.location.pathname || '/';\n const initialUrl = this._resolveEmbeddedInitialUrl(rawPath);\n this._url.set(initialUrl);\n\n // When the shell owns history it replays our route on Back/Forward via\n // FLYOS_LAUNCH_EVENT (the remote root re-applies it), so we must NOT also\n // handle popstate — the shell's entries carry no `flyRemoteUrl` and we'd\n // clobber `_url` with the shell path. Only self-manage under a legacy shell.\n if (!this.shellOwnsHistory) {\n // Listen for browser back/forward so segments() stays in sync with\n // history entries pushed by navigate() / navigateByUrl().\n const onPopState = (event: PopStateEvent): void => {\n const state = event.state as { flyRemoteUrl?: string } | null;\n // Prefer the URL we stashed in the history state; fall back to pathname.\n const url = state?.flyRemoteUrl ?? window.location.pathname ?? '/';\n this._url.set(url.startsWith('/') ? url : '/' + url);\n };\n\n window.addEventListener('popstate', onPopState);\n\n // Defensive cleanup — the service is providedIn: 'root' so this fires\n // only when the whole Angular app is destroyed, but it keeps things tidy.\n this.destroyRef.onDestroy(() => {\n window.removeEventListener('popstate', onPopState);\n });\n }\n }\n }\n }\n\n /**\n * Navigate to a route, identified by an array of commands as you would pass\n * to Angular's `Router.navigate`. In embedded mode `extras` is ignored — the\n * shell owns history and query-param handling for the window's URL.\n */\n navigate(commands: readonly unknown[], extras?: NavigationExtras): Promise<boolean> {\n if (!this.isEmbedded && this.router) {\n // Standalone: Angular Router owns history — pushState semantics are the default.\n return this.router.navigate(commands as unknown[], extras);\n }\n const url = this.buildUrl(commands);\n this._pushEmbedded(url);\n return Promise.resolve(true);\n }\n\n /**\n * Navigate to a route given as a full URL string. Mirrors `Router.navigateByUrl`.\n */\n navigateByUrl(url: string, extras?: NavigationExtras): Promise<boolean> {\n if (!this.isEmbedded && this.router) {\n // Standalone: Angular Router owns history — pushState semantics are the default.\n return this.router.navigateByUrl(url, extras);\n }\n this._pushEmbedded(url.startsWith('/') ? url : '/' + url);\n return Promise.resolve(true);\n }\n\n /**\n * Convenience: pop the last two segments (the typical \"go back from detail\n * to list\" gesture). In standalone mode this falls through to `history.back()`\n * so the browser's back stack is respected.\n */\n back(): void {\n // Both modes: delegate to the browser's history stack. In embedded mode we\n // now push real history entries in navigate() / navigateByUrl(), so\n // history.back() triggers popstate and the listener updates segments().\n if (typeof history !== 'undefined') {\n history.back();\n }\n }\n\n /**\n * Resolve the logical URL to seed `_url` from on embedded initial load.\n *\n * - No basePath: always return `'/'`. The shell's SPA path (e.g. `/desktop`)\n * is irrelevant to the remote — `navigate()` is the only thing that should\n * move the remote's URL.\n * - basePath provided: strip it from `rawPath`. If rawPath starts with the\n * basePath, the remainder becomes the seed URL (normalised to start with\n * `'/'`). If it doesn't match (e.g. shell changed its own route), fall back\n * to `'/'` rather than surfacing shell-specific segments to the remote's\n * route table.\n */\n private _resolveEmbeddedInitialUrl(rawPath: string): string {\n if (!this.basePath) {\n // Default: ignore the shell's pathname, start at remote root.\n return '/';\n }\n const base = this.basePath.endsWith('/') ? this.basePath.slice(0, -1) : this.basePath;\n if (rawPath === base || rawPath === base + '/') {\n return '/';\n }\n if (rawPath.startsWith(base + '/')) {\n const remainder = rawPath.slice(base.length);\n return remainder.startsWith('/') ? remainder : '/' + remainder;\n }\n // Shell path doesn't begin with our basePath — fall through to root.\n return '/';\n }\n\n /**\n * In embedded mode: push a real browser history entry (so back/forward work)\n * and update the internal signal synchronously.\n *\n * The browser address bar is written as the shell's **canonical deep-link\n * form** — `<shell-path>?app=<appId>&route=<remote-url>` — NOT the bare remote\n * URL. This is what makes a hard reload work: on reload the shell's\n * `DeepLinkService` captures `?app=&route=` in its APP_INITIALIZER, re-opens\n * this app, and replays the route through the pending-launch pipeline\n * (`ShellLauncherService.launch` → `FLYOS_LAUNCH_EVENT` / pending registry →\n * the remote's root applies `ctx.route`). Writing the bare remote URL (e.g.\n * `/trends/abc`) instead would leave a host-unroutable path in the bar — on\n * reload the shell router falls through to its `**` wildcard, redirects to\n * `/desktop`, and the deep link is silently lost. See\n * skills/cross-app-deep-linking.md.\n *\n * `flyRemoteUrl` is still stashed in the history state so the popstate\n * listener restores the exact remote URL for back/forward without re-parsing\n * the query string.\n */\n private _pushEmbedded(url: string): void {\n this._url.set(url);\n\n if (this.shellOwnsHistory && typeof window !== 'undefined') {\n // Single-writer mode: hand the route to the shell, which owns the address\n // bar + browser history for every window. The shell mirrors it to the\n // canonical `…/desktop?app=&route=` form and pushes one history entry.\n const appId = this.windowData?.appId;\n if (appId) {\n const detail: FlyRemoteRouteEventDetail = {\n appId,\n windowId: this.windowData?.id ?? null,\n url,\n };\n window.dispatchEvent(new CustomEvent<FlyRemoteRouteEventDetail>(FLYOS_REMOTE_ROUTE_EVENT, { detail }));\n return;\n }\n // No appId reachable (WINDOW_DATA split across bundles) — fall through to\n // the legacy local history entry so Back/Forward still update segments().\n }\n\n // Legacy / fallback: self-managed history entry (older shell, or no appId).\n if (typeof history !== 'undefined') {\n history.pushState({ flyRemoteUrl: url }, '', this._buildEmbeddedHistoryUrl(url));\n }\n }\n\n /**\n * Build the browser-address-bar URL for an embedded navigation: the shell's\n * current path plus the canonical `?app=&route=` deep-link query (the same\n * contract `DeepLinkService.captureFromCurrentUrl` parses on cold load).\n *\n * The path is left untouched — only the query string carries the remote's\n * logical route — so the shell's own Angular Router (anchored at e.g.\n * `/desktop`) is never handed a path it cannot match.\n *\n * Fallback: when `appId` is unknown (WINDOW_DATA not injected — the Native\n * Federation token-split case where only `__FLYOS_SHELL__` proves embedding)\n * we cannot build a shareable link, so we return the shell path query-less.\n * Back/forward still work via the `flyRemoteUrl` history state; only\n * reload-restore is unavailable — no regression over leaving the bar as-is.\n */\n private _buildEmbeddedHistoryUrl(remoteUrl: string): string {\n const shellPath =\n (typeof window !== 'undefined' && window.location.pathname) || this.basePath || '/';\n const appId = this.windowData?.appId;\n if (!appId) return shellPath;\n const query = new URLSearchParams({ app: appId, route: remoteUrl });\n return `${shellPath}?${query.toString()}`;\n }\n\n private buildUrl(commands: readonly unknown[]): string {\n const parts = commands\n .map(c => (c == null ? '' : String(c)))\n .map(s => s.replace(/^\\/+|\\/+$/g, ''))\n .filter(Boolean);\n return '/' + parts.join('/');\n }\n}\n","import { Injectable, signal } from '@angular/core';\n\n/**\n * A federated remote's current navigation context, as published to the shell.\n *\n * `params` are the remote's **resolved route params** (e.g. `{ id: 'abc' }` for a\n * `trends/:id` match) — the remote owns its route table, so it resolves these and\n * the shell never has to know the remote's route patterns.\n */\nexport interface FlyRemoteContext {\n /** Owning app id — matches the shell's app registry and `AgentCommandScope.appId`. */\n readonly appId: string;\n /** Logical remote URL, e.g. `/trends/abc`. Query/hash stripped by the publisher. */\n readonly url: string;\n /** `url` split into path segments, e.g. `['trends', 'abc']`. */\n readonly segments: readonly string[];\n /** Resolved route params, e.g. `{ id: 'abc' }`. Empty when no param route matched. */\n readonly params: Readonly<Record<string, string>>;\n}\n\n/**\n * Shared cross-bundle store key + sync event. **Public contract** — a remote that\n * cannot consume a DS new enough to back {@link FlyRemoteContextService.publish} on\n * `globalThis` itself may write this slot directly (same shape, keyed by appId) and\n * dispatch {@link FLY_REMOTE_CONTEXT_EVENT} to notify the shell. Keep these literals\n * stable; they are an integration boundary, not an implementation detail.\n */\nexport const FLY_REMOTE_CONTEXT_STORE_KEY = '__flyRemoteContext__';\nexport const FLY_REMOTE_CONTEXT_EVENT = 'fly:remote-context';\n\ntype Store = Record<string, FlyRemoteContext>;\n\n/** The single cross-bundle store, lazily created on `globalThis`. */\nfunction store(): Store {\n const g = globalThis as unknown as Record<string, Store | undefined>;\n return (g[FLY_REMOTE_CONTEXT_STORE_KEY] ??= {});\n}\n\n/** Notify every federated copy of the service that the store changed. */\nfunction emitSync(): void {\n const g = globalThis as { dispatchEvent?: (e: Event) => boolean };\n try {\n g.dispatchEvent?.(new Event(FLY_REMOTE_CONTEXT_EVENT));\n } catch {\n /* non-DOM realm (SSR / unit env without Event) — readers fall back to a direct read */\n }\n}\n\nfunction toMap(s: Store): ReadonlyMap<string, FlyRemoteContext> {\n return new Map(Object.entries(s));\n}\n\n/**\n * Remote → shell route/context channel.\n *\n * Why this exists\n * ---------------\n * A federated remote (e.g. Circles) renders inside a desktop-shell window and\n * keeps its own internal Angular route (`/trends/:id`). The shell cannot see that\n * route: the remote provides {@link FlyRemoteRouter} at its **component** injector\n * (so it can read per-window `WINDOW_DATA`), which makes the route state invisible\n * to the host. Shell-side features that need \"what is the user looking at right\n * now\" — most importantly Category-B slash commands whose `contextBindings` include\n * a `lookup`/`route` entity id — had no way to resolve the current entity id, and\n * degraded to \"ask the user\".\n *\n * The channel — why `globalThis`, not the DI singleton\n * ----------------------------------------------------\n * This service is `providedIn: 'root'`, but a root instance is **NOT** reliably\n * shared across the federation boundary. The shell builds the design system from\n * workspace SOURCE while remotes consume the PUBLISHED npm package; Native\n * Federation only collapses those two physical builds into one runtime instance if\n * version negotiation succeeds perfectly (matching advertised `mappingVersion`,\n * `singleton`, compatible ranges). That negotiation has silently split before —\n * giving the shell and a remote *separate* `providedIn:'root'` instances, so a\n * value published on one was invisible to the other.\n *\n * `globalThis` is the one substrate guaranteed shared across every federated bundle\n * in the same realm (there are no iframes), so the channel stores its state there\n * (see {@link FLY_REMOTE_CONTEXT_STORE_KEY}). {@link context} / {@link param} read\n * it directly — split-proof, synchronous, no injector-token gymnastics. A per-\n * instance signal mirrors the store for reactive consumers and is re-synced from a\n * `globalThis` event whenever any copy of the service (or a remote writing the slot\n * directly) mutates it. The same pattern already backs the shell's app-launch\n * context bridge, so this is an established boundary, not a new hack.\n *\n * Contract\n * --------\n * - Remote: call {@link publish} whenever its embedded route changes, and\n * {@link clear} on teardown (window close / component destroy).\n * - Shell: call {@link context} (or {@link param}) for an app id to resolve bindings.\n *\n * Keyed by `appId` (last publisher wins) — a single live window per app is the v1\n * assumption; a windowId key is the natural extension if multi-window-per-app\n * dispatch is ever needed.\n */\n@Injectable({ providedIn: 'root' })\nexport class FlyRemoteContextService {\n private readonly _byApp = signal<ReadonlyMap<string, FlyRemoteContext>>(toMap(store()));\n\n /** All currently-published contexts, keyed by app id. Reactive. */\n readonly contexts = this._byApp.asReadonly();\n\n constructor() {\n // Keep this instance's reactive mirror current when ANOTHER federated copy of\n // the service — or a remote writing the store slot directly — mutates it.\n const g = globalThis as { addEventListener?: (t: string, l: () => void) => void };\n g.addEventListener?.(FLY_REMOTE_CONTEXT_EVENT, () => this._byApp.set(toMap(store())));\n }\n\n /** Publish (or replace) the active route context for an app. */\n publish(ctx: FlyRemoteContext): void {\n store()[ctx.appId] = ctx;\n this._byApp.set(toMap(store()));\n emitSync();\n }\n\n /** Drop an app's context (remote unmounted / window closed). No-op if absent. */\n clear(appId: string): void {\n const s = store();\n if (!(appId in s)) return;\n delete s[appId];\n this._byApp.set(toMap(s));\n emitSync();\n }\n\n /** Current context for an app, or `null` when nothing is published. */\n context(appId: string): FlyRemoteContext | null {\n return store()[appId] ?? null;\n }\n\n /**\n * Resolve a single route param for an app, e.g. `param('circles', 'id')`.\n * Returns `null` when the app has no published context or the param is absent —\n * the caller then degrades (the skill asks for the missing id).\n */\n param(appId: string, path: string): string | null {\n const value = store()[appId]?.params[path];\n return value != null && value !== '' ? value : null;\n }\n}\n","import { InjectionToken, Injectable, inject } from '@angular/core';\n\n/**\n * Minimal adapter the shell (or any host) provides so design-system services can\n * look up apps without depending on `AppRegistryService` directly. Keeps the\n * design-system decoupled from shell internals — hosts wire this once at root.\n *\n * Shell wiring example:\n * ```ts\n * { provide: APP_LOOKUP, useFactory: () => {\n * const r = inject(AppRegistryService);\n * return { getById: id => { const a = r.getById(id); return a ? { id: a.id, name: a.name } : undefined; } };\n * } }\n * ```\n */\nexport interface AppLookupEntry {\n readonly id: string;\n readonly name: string;\n}\n\nexport interface AppLookup {\n getById(id: string): AppLookupEntry | undefined;\n}\n\nexport const APP_LOOKUP = new InjectionToken<AppLookup>('APP_LOOKUP');\n\n/**\n * Canonicalizes raw source-app identifiers and resolves display names.\n *\n * Problem this solves\n * -------------------\n * Backend services emit two different identifiers for the same app:\n * - JWT `client_id` (inter-service identity), e.g. `\"circles-service\"`.\n * - AppCatalog `id` (frontend identity), e.g. `\"circles\"`.\n *\n * Task rows, audit entries, notifications, etc. may carry either form depending\n * on which service wrote them and when. Every UI surface that renders the\n * source app needs the same canonicalization rule — without it, chips display\n * `\"circles-service\"` instead of the friendly `\"Circles\"`.\n *\n * Rule: try the raw id against the registry; if it misses and the id ends in\n * `-service`, retry with the suffix stripped. The first hit wins. Returns\n * `null` from `resolveId` when nothing matches, so callers can guard CTAs.\n */\n@Injectable({ providedIn: 'root' })\nexport class SourceAppResolver {\n private readonly lookup = inject(APP_LOOKUP, { optional: true });\n\n /** Returns the registry-resolvable canonical id, or `null` when neither form is registered. */\n resolveId(rawId: string | null | undefined): string | null {\n if (!rawId || !this.lookup) return null;\n if (this.lookup.getById(rawId)) return rawId;\n const canonical = rawId.replace(/-service$/, '');\n if (canonical !== rawId && this.lookup.getById(canonical)) return canonical;\n return null;\n }\n\n /**\n * Display name for the source app. Prefers the registry's localized name when\n * the id resolves; falls back to a title-cased canonical id (e.g.\n * `\"circles-service\"` → `\"Circles\"`) so chips never expose raw `-service`\n * client_ids even for apps not yet in the registry. Empty string for null/undefined.\n */\n resolveName(rawId: string | null | undefined): string {\n if (!rawId) return '';\n const id = this.resolveId(rawId);\n if (id) return this.lookup!.getById(id)!.name;\n const canonical = rawId.replace(/-service$/, '');\n return canonical.charAt(0).toUpperCase() + canonical.slice(1);\n }\n\n /** True when an open-in-source CTA is launchable: id resolves *and* there's a route. */\n canOpen(rawId: string | null | undefined, route: string | null | undefined): boolean {\n return this.resolveId(rawId) !== null && !!route;\n }\n}\n","import { Injectable } from '@angular/core';\nimport {\n FLY_WINDOW_HELP_HINT_EVENT,\n type FlyWindowHelpHintEventDetail,\n type WindowHelpHint,\n} from '../models/window.model';\n\n/**\n * Per-window publisher handle returned by {@link FlyWindowHelpService.forWindow}.\n * Bound to a single window id; keep the handle and call {@link setHint} as the\n * active view changes.\n */\nexport interface FlyWindowHelpPublisher {\n /**\n * Set the active hint for this window (or null to clear — the shell then\n * reverts to the window's own `appId`). Safe to call repeatedly.\n */\n setHint(hint: WindowHelpHint | null): void;\n}\n\n/**\n * Publishes a {@link WindowHelpHint} for a window so the shell's titlebar Help\n * button deeplinks the help-center reader to the article most relevant to where\n * the user is. The **publisher twin** of the shell's `WindowHelpHintService`\n * (the listener): it exists in the design system so that **any app — in-shell\n * OS-Core app or federated remote — publishes hints the same way**, without\n * hand-rolling the cross-bundle CustomEvent contract.\n *\n * **Why a `window` CustomEvent and not the `WINDOW_HELP_HINT` DI token?**\n * Native Federation can split an `InjectionToken` instance across host and\n * remote bundles, so a remote that injects `WINDOW_HELP_HINT` may receive a\n * different token than the one the shell provides. The string-keyed\n * {@link FLY_WINDOW_HELP_HINT_EVENT} crosses bundles reliably; the shell mirrors\n * it into the matching per-window hint signal.\n *\n * **Why a per-window handle and not `bindWindow`/`setHint` state?**\n * This service is `providedIn: 'root'` and the design system is a shared\n * Native-Federation singleton, so a *single* instance is shared across the\n * shell and every concurrently-open window (multiple in-shell apps, multiple\n * remotes). A handle closes over its window id, so two windows never clobber a\n * shared \"current window\" — each handle targets only its own titlebar.\n */\n@Injectable({ providedIn: 'root' })\nexport class FlyWindowHelpService {\n /**\n * Returns a publisher bound to a single window. Call once per window (e.g.\n * from the app root with `WINDOW_DATA.id`) and keep the handle. A\n * null/undefined id (standalone, no shell) yields a handle whose `setHint`\n * is a no-op.\n */\n forWindow(windowId: string | null | undefined): FlyWindowHelpPublisher {\n const id = windowId ?? null;\n return {\n setHint: (hint: WindowHelpHint | null): void => {\n if (typeof window === 'undefined' || !id) return;\n const detail: FlyWindowHelpHintEventDetail = { windowId: id, hint };\n window.dispatchEvent(\n new CustomEvent<FlyWindowHelpHintEventDetail>(FLY_WINDOW_HELP_HINT_EVENT, { detail }),\n );\n },\n };\n }\n}\n","/**\n * fly-remote-styles — Shell-layer CSS loader for Native Federation remotes.\n *\n * Problem\n * -------\n * Federated remotes only ship JS chunks via Native Federation — their global\n * `styles.css` (or its hashed equivalent) never loads in the shell, so any\n * global CSS selector (e.g. `.circles-overlay`) silently breaks in embedded\n * mode.\n *\n * Solution\n * --------\n * On first mount of each remote, the shell calls `loadRemoteStyles(appId,\n * remoteBaseUrl)`. This function:\n * 1. Derives the remote's `index.html` URL from `remoteBaseUrl`.\n * 2. Fetches it (one network round-trip per remote; browser-cached thereafter).\n * 3. Parses the HTML with DOMParser to extract the first\n * `<link rel=\"stylesheet\">` — the hashed production stylesheet\n * (e.g. `styles-ABC123.css`). This is Strategy (b): index.html discovery.\n * 4. Injects the stylesheet into `document.head` using one of two approaches\n * (see Injection approach below).\n *\n * Why strategy (b)?\n * -----------------\n * (a) Unhashed `styles.css` — requires remote build config changes (out of scope).\n * (b) Parse remote `index.html` — one tiny fetch per remote; browser caches it;\n * works today without any remote changes.\n * (c) `stylesUrl` in manifest/remoteEntry.json — cleanest long-term; requires\n * protocol change to every remote's CI pipeline (out of scope for Wave A1).\n *\n * Injection approach\n * ------------------\n * Preferred (Firefox 134+, Chrome 99+, Safari 17.2+):\n * `<link rel=\"stylesheet\" href=\"…\" crossorigin=\"anonymous\" layer=\"remote\">`\n *\n * The `layer` attribute on `<link>` is feature-detected once at module init via:\n * `'layer' in HTMLLinkElement.prototype`\n * If the attribute is supported, the shell injects a non-render-blocking `<link>`\n * element. The browser gets proper preload semantics and CORS headers flow through\n * the normal stylesheet pipeline.\n *\n * Fallback (browsers without `link[layer]` support):\n * `<style>@import url(\"…\") layer(remote);</style>`\n *\n * CSS Cascade Level 5: `@import url(\"…\") layer(remote)` is the ONLY valid way to\n * place an @import inside a named cascade layer when using the `<style>` approach.\n * The block-form `@layer remote { @import url(\"…\"); }` is INVALID CSS — the spec\n * forbids `@import` inside any block at-rule. Browsers silently drop such rules.\n *\n * Both code paths attach `data-fly-app` and `data-fly-href` attributes to the\n * injected element so idempotency checks work uniformly.\n *\n * Layer order declaration\n * -----------------------\n * A one-time `<style data-fly-layers>` element is prepended to `<head>` at module\n * init. It establishes the canonical layer order:\n * reset → designsystem → shell → remote → overrides\n * This guarantees that even if individual `@layer` blocks are injected in any\n * order at runtime, the cascade priority is always deterministic.\n *\n * CSP nonce propagation\n * ---------------------\n * If a `<meta name=\"csp-nonce\">` element is present, its content is read once at\n * module init and applied to every injected `<style>` or `<link>` element. If no\n * nonce meta is present, nothing is set (graceful degradation).\n *\n * URL validation\n * --------------\n * Discovered hrefs must be `http://`-, `https://`-, or `//`-prefixed. `javascript:`,\n * `data:`, and `blob:` are rejected outright. The href's origin must also match the\n * origin of `remoteBaseUrl` (same-origin as the remote), preventing a compromised\n * `index.html` from pointing at an attacker domain.\n *\n * Unload decision\n * ---------------\n * `unloadRemoteStyles` is exported for symmetry but should NOT be called on\n * normal window close. Keeping styles loaded across remounts avoids FOUC\n * flicker when the user reopens the same app. The stylesheet is a few KB; the\n * memory cost is negligible. Only call `unloadRemoteStyles` if you are certain\n * the remote will never be opened again in this session (e.g. licence revoke).\n *\n * Caveats\n * -------\n * - CORS: the remote's dev/prod server must serve `index.html` with a permissive\n * `Access-Control-Allow-Origin` header (or be same-origin via the YARP gateway).\n * The fetch uses `credentials: 'omit'` to avoid credential-carrying preflights.\n * - Fetch timeout: the index.html fetch is capped at 5 seconds. On timeout the\n * in-flight entry is cleared so a retry is possible on the next call.\n * - Race on rapid mount/unmount: if `loadRemoteStyles` is called a second time for\n * the same appId while the first fetch is still in-flight, the second call joins\n * the same in-flight Promise.\n * - Angular hashing: Angular's production build hashes the stylesheet filename.\n * DOMParser picks the first `<link rel=\"stylesheet\">` in `<head>`, which is the\n * single global stylesheet Angular emits. If a remote emits multiple stylesheets,\n * only the first is loaded — acceptable for Wave A1.\n */\n\n/**\n * Feature detection: does the browser support the `layer` attribute on\n * `<link>` elements? Probed once at module init.\n * Firefox 134+, Chrome 99+, Safari 17.2+ all ship this.\n */\nconst _linkLayerSupported: boolean =\n typeof HTMLLinkElement !== 'undefined' && 'layer' in HTMLLinkElement.prototype;\n\n/**\n * CSP nonce, read once from `<meta name=\"csp-nonce\">` at module init.\n * Applied to every injected `<style>` / `<link>` element. Null when absent.\n */\nconst _cspNonce: string | null =\n typeof document !== 'undefined'\n ? (document.querySelector<HTMLMetaElement>('meta[name=\"csp-nonce\"]')?.content ?? null)\n : null;\n\n/** In-flight fetch promises keyed by appId — prevents duplicate fetches. */\nconst _inFlight = new Map<string, Promise<string | null>>();\n\n// ---------------------------------------------------------------------------\n// Layer order — injected immediately at module init (synchronous, runs once).\n// ---------------------------------------------------------------------------\n(function _ensureLayerOrder(): void {\n if (typeof document === 'undefined') return; // SSR guard\n if (document.head.querySelector('style[data-fly-layers]')) return;\n\n const style = document.createElement('style');\n style.setAttribute('data-fly-layers', '');\n style.textContent = '@layer reset, designsystem, shell, remote, overrides;';\n if (_cspNonce) style.nonce = _cspNonce;\n // Prepend so this always precedes any other layer-bearing <style> blocks.\n document.head.insertBefore(style, document.head.firstChild);\n})();\n\n// ---------------------------------------------------------------------------\n// Internal helpers\n// ---------------------------------------------------------------------------\n\n/**\n * Discovers the hashed stylesheet href from the remote's `index.html`.\n * Applies a 5-second AbortController timeout. Clears `_inFlight` on abort so\n * a retry is possible. Returns `null` on any failure.\n */\nasync function _discoverStylesheetHref(appId: string, remoteBaseUrl: string): Promise<string | null> {\n const indexUrl = remoteBaseUrl.replace(/\\/$/, '') + '/index.html';\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), 5000);\n\n try {\n const res = await fetch(indexUrl, {\n credentials: 'omit',\n cache: 'default',\n signal: controller.signal,\n });\n clearTimeout(timeoutId);\n\n if (!res.ok) return null;\n const html = await res.text();\n const doc = new DOMParser().parseFromString(html, 'text/html');\n // Find the first stylesheet link in <head> — Angular emits exactly one.\n const link = doc.head.querySelector<HTMLLinkElement>('link[rel=\"stylesheet\"]');\n if (!link?.href) return null;\n // `link.href` from DOMParser resolves against `about:blank`. Use raw attribute.\n const rawHref = link.getAttribute('href') ?? '';\n if (!rawHref) return null;\n\n // Early-reject dangerous schemes before any URL resolution.\n // Without this guard, `javascript:alert(1)` would be rewritten to\n // `remoteBaseUrl/javascript:alert(1)` and silently pass origin validation.\n const rawLower = rawHref.toLowerCase();\n if (\n rawLower.startsWith('javascript:') ||\n rawLower.startsWith('data:') ||\n rawLower.startsWith('blob:')\n ) {\n console.warn(`[FlyOS] loadRemoteStyles: rejected unsafe stylesheet href \"${rawHref}\"`);\n return null;\n }\n\n // Resolve to absolute URL for origin validation.\n let resolvedHref: string;\n if (rawHref.startsWith('http://') || rawHref.startsWith('https://') || rawHref.startsWith('//')) {\n resolvedHref = rawHref;\n } else {\n resolvedHref = remoteBaseUrl.replace(/\\/$/, '') + '/' + rawHref.replace(/^\\//, '');\n }\n\n return _validateHref(resolvedHref, remoteBaseUrl);\n } catch {\n clearTimeout(timeoutId);\n // On abort or network error, clear in-flight so a retry is possible.\n _inFlight.delete(appId);\n return null;\n }\n}\n\n/**\n * Validates that a discovered href is safe to inject:\n * - Must be `http://`, `https://`, or `//`-prefixed (no `javascript:`, `data:`, `blob:`).\n * - Must share the same origin as `remoteBaseUrl`.\n *\n * Returns the href on success; logs a warning and returns `null` on failure.\n */\nfunction _validateHref(href: string, remoteBaseUrl: string): string | null {\n // Block dangerous schemes.\n const lower = href.toLowerCase();\n if (\n lower.startsWith('javascript:') ||\n lower.startsWith('data:') ||\n lower.startsWith('blob:')\n ) {\n console.warn(`[FlyOS] loadRemoteStyles: rejected unsafe stylesheet href \"${href}\"`);\n return null;\n }\n\n // Must be absolute (http/https/protocol-relative).\n if (\n !lower.startsWith('http://') &&\n !lower.startsWith('https://') &&\n !lower.startsWith('//')\n ) {\n console.warn(`[FlyOS] loadRemoteStyles: rejected non-absolute stylesheet href \"${href}\"`);\n return null;\n }\n\n // Origin must match remoteBaseUrl — prevents a compromised index.html from\n // redirecting styles at an attacker-controlled domain.\n try {\n const hrefOrigin = new URL(href.startsWith('//') ? 'https:' + href : href).origin;\n const remoteOrigin = new URL(remoteBaseUrl).origin;\n if (hrefOrigin !== remoteOrigin) {\n console.warn(\n `[FlyOS] loadRemoteStyles: rejected cross-origin stylesheet href \"${href}\" ` +\n `(expected origin \"${remoteOrigin}\", got \"${hrefOrigin}\")`\n );\n return null;\n }\n } catch {\n console.warn(`[FlyOS] loadRemoteStyles: could not parse href origin for \"${href}\"`);\n return null;\n }\n\n return href;\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Injects the remote's stylesheet into `document.head`.\n *\n * @param appId - Stable identifier for the remote app (matches `DesktopApp.id`).\n * @param remoteBaseUrl - Base URL of the remote, e.g. `https://circles.example.com`\n * or `http://localhost:7202`. Must NOT include `/remoteEntry.json`.\n *\n * The call is idempotent:\n * - If an element with `data-fly-app=\"appId\"` whose `data-fly-href` matches the\n * discovered href already exists → no-op.\n * - If the href differs (hot upgrade) → existing element is replaced.\n * - If no stylesheet is found in `index.html` → no-op (logged as a warning).\n *\n * Injection shape (preferred — `link[layer]` supported):\n * <link rel=\"stylesheet\" data-fly-app=\"<appId>\" data-fly-href=\"<href>\"\n * href=\"<href>\" crossorigin=\"anonymous\" layer=\"remote\">\n *\n * Injection shape (fallback — `link[layer]` unsupported):\n * <style data-fly-app=\"<appId>\" data-fly-href=\"<href>\">\n * @import url(\"<href>\") layer(remote);\n * </style>\n *\n * The `data-fly-href` attribute stores the discovered href separately from the\n * element content so idempotency checks can compare the URL without parsing CSS.\n */\nexport async function loadRemoteStyles(appId: string, remoteBaseUrl: string): Promise<void> {\n if (typeof document === 'undefined') return; // SSR guard\n\n // Resolve relative remoteBaseUrl (e.g. '/circles-dev') against the current\n // page origin so all downstream URL operations (fetch, origin check) receive\n // an absolute URL. Absolute inputs are returned unchanged by new URL().\n const absoluteBase = new URL(remoteBaseUrl, location.href).href.replace(/\\/$/, '');\n\n // Kick off or join an in-flight fetch for this appId.\n // Note: _resolvedHref cache is intentionally absent — always re-discover so\n // the browser's HTTP cache handles cost (index.html is tiny) and hot-deploys\n // are picked up without a page reload.\n let fetchPromise = _inFlight.get(appId);\n if (!fetchPromise) {\n fetchPromise = _discoverStylesheetHref(appId, absoluteBase);\n _inFlight.set(appId, fetchPromise);\n }\n\n const href = await fetchPromise;\n _inFlight.delete(appId);\n\n if (!href) {\n console.warn(\n `[FlyOS] loadRemoteStyles: no stylesheet found in ${absoluteBase}/index.html for appId=\"${appId}\"`\n );\n return;\n }\n\n // Check both <link> and <style> selectors — handle upgrades from the old fallback path.\n const escapedId = CSS.escape(appId);\n const existing =\n document.head.querySelector<HTMLLinkElement | HTMLStyleElement>(\n `link[data-fly-app=\"${escapedId}\"], style[data-fly-app=\"${escapedId}\"]`\n );\n\n if (existing) {\n if (existing.getAttribute('data-fly-href') === href) return; // identical — no-op\n // Hot upgrade: remove old element (could be <link> or <style>) atomically.\n existing.remove();\n }\n\n if (_linkLayerSupported) {\n // Preferred path: non-render-blocking <link> with native layer= attribute.\n // Firefox 134+, Chrome 99+, Safari 17.2+ all support this.\n const link = document.createElement('link');\n link.rel = 'stylesheet';\n link.setAttribute('data-fly-app', appId);\n link.setAttribute('data-fly-href', href);\n link.href = href;\n link.crossOrigin = 'anonymous';\n (link as unknown as Record<string, string>)['layer'] = 'remote';\n if (_cspNonce) link.nonce = _cspNonce;\n document.head.appendChild(link);\n } else {\n // Fallback path: <style> with @import layer(remote) for older browsers.\n // CSS Cascade Level 5: `@import url(\"…\") layer(remote)` is the only valid\n // way to place an @import inside a named cascade layer. Block-form\n // `@layer remote { @import … }` is invalid and silently dropped by browsers.\n const style = document.createElement('style');\n style.setAttribute('data-fly-app', appId);\n style.setAttribute('data-fly-href', href);\n style.textContent = `@import url(\"${href}\") layer(remote);`;\n if (_cspNonce) style.nonce = _cspNonce;\n document.head.appendChild(style);\n }\n}\n\n/**\n * Removes the injected stylesheet element (either `<link>` or `<style>`) for\n * `appId` from `document.head` and clears all internal state for this appId.\n *\n * NOTE: Prefer NOT calling this on normal window close — keeping styles loaded\n * prevents FOUC flicker when the user reopens the same app. Call only if you\n * are certain the remote will not be reopened in this session.\n */\nexport function unloadRemoteStyles(appId: string): void {\n if (typeof document === 'undefined') return; // SSR guard\n const escapedId = CSS.escape(appId);\n // Remove <link> element (preferred path) if present.\n document.head\n .querySelector(`link[data-fly-app=\"${escapedId}\"]`)\n ?.remove();\n // Remove <style> element (fallback path) if present.\n document.head\n .querySelector(`style[data-fly-app=\"${escapedId}\"]`)\n ?.remove();\n // Clear in-flight so a future call can retry.\n _inFlight.delete(appId);\n}\n","import { ChangeDetectionStrategy, Component, inject } from '@angular/core';\nimport { NgComponentOutlet } from '@angular/common';\nimport { FlyRemoteRouter } from '../../services/fly-remote-router.service';\n\n/**\n * Outlet for FlyOS-embedded routing. Renders the component associated with the\n * first matching route in the consumer's `FLY_REMOTE_ROUTES` table, reacting to\n * `FlyRemoteRouter.navigate(...)` calls.\n *\n * Use this **only in embedded mode**. Standalone remotes should keep their\n * `<router-outlet>` — `FlyRemoteRouter.navigate` delegates to Angular's Router\n * there, and this outlet would just shadow it.\n *\n * Recommended pattern in a remote's root component:\n * ```html\n * @if (router.isEmbedded) {\n * <fly-remote-router-outlet />\n * } @else {\n * <router-outlet />\n * }\n * ```\n *\n * Why both? Standalone keeps full Angular routing — query params, guards,\n * resolvers, lazy loading, RouterLink. Embedded gets a stripped-down\n * synchronous outlet that matches against the same route table the remote\n * declared via `FLY_REMOTE_ROUTES`. The same `router.navigate(['/foo', id])`\n * call works in both modes; only the rendering surface differs.\n *\n * Limitations vs. `<router-outlet>`:\n * - Synchronous components only (no `loadComponent` / `loadChildren`).\n * - No guards / resolvers / data resolution.\n * - No query-param / hash handling — only path segments.\n * - No `RouterLink` directive — use `(click)=\"router.navigate(...)\"`.\n *\n * Components rendered by this outlet read route params via `FlyRemoteRouter.params`:\n * ```ts\n * private readonly router = inject(FlyRemoteRouter);\n * readonly id = computed(() => this.router.params()['id'] ?? '');\n * ```\n */\n@Component({\n selector: 'fly-remote-router-outlet',\n standalone: true,\n imports: [NgComponentOutlet],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n @if (matched(); as m) {\n <ng-container *ngComponentOutlet=\"m.route.component\" />\n }\n `,\n})\nexport class FlyRemoteRouterOutletComponent {\n private readonly router = inject(FlyRemoteRouter);\n\n /**\n * Read directly from FlyRemoteRouter so the outlet re-renders whenever the\n * URL changes (signal-based, OnPush-friendly).\n */\n readonly matched = this.router.matchedRoute;\n}\n","import { Pipe, PipeTransform, inject } from '@angular/core';\nimport { I18nService } from '../services/i18n.service';\n\n/**\n * Translates a key using the shared I18nService.\n *\n * @example\n * {{ 'myApp.section.title' | translate }}\n * {{ 'myApp.items_count' | translate:{ n: count() } }}\n */\n@Pipe({\n name: 'translate',\n standalone: true,\n pure: false,\n})\nexport class TranslatePipe implements PipeTransform {\n private readonly i18n = inject(I18nService);\n\n transform(key: string, params?: Record<string, string | number>): string {\n // Read version so template CD re-runs when bundles load (merged translations updated).\n void this.i18n.version();\n return this.i18n.t(key, params);\n }\n}\n","import { Injectable, Signal, computed, inject, signal } from '@angular/core';\nimport { Router } from '@angular/router';\nimport { Observable, of } from 'rxjs';\nimport { User } from '../models/user.model';\n\nexport interface MockAuthConfig {\n user: User;\n token?: string;\n loginRedirect?: string[];\n logoutRedirect?: string[];\n}\n\ninterface MockSession {\n accessToken: string;\n user: User;\n expiresAt: number;\n}\n\n/**\n * Shared mock AuthService base class for Business App developers.\n *\n * Extend this class in your app's `auth.service.mock.ts` and override\n * `getConfig()` to supply app-specific mock user data and navigation paths.\n * The subclass must be decorated with `@Injectable({ providedIn: 'root' })`\n * and exported as `AuthService` so Angular's `fileReplacements` swap works.\n *\n * @example\n * ```typescript\n * // src/app/core/services/auth.service.mock.ts\n * import { Injectable } from '@angular/core';\n * import { MockAuthService, type MockAuthConfig } from '@mohamedatia/fly-design-system';\n *\n * @Injectable({ providedIn: 'root' })\n * export class AuthService extends MockAuthService {\n * protected override getConfig(): MockAuthConfig {\n * return {\n * user: { id: 'dev-001', tenantId: 'dev-tenant', email: 'dev@example.com',\n * firstName: 'Dev', lastName: 'User', fullName: 'Dev User',\n * preferredLocale: 'en', roles: ['admin'], apps: ['my-app'] },\n * token: 'my-mock-token',\n * loginRedirect: ['/app'],\n * };\n * }\n * }\n * ```\n */\n@Injectable()\nexport class MockAuthService {\n private readonly router = inject(Router);\n\n protected readonly _session: ReturnType<typeof signal<MockSession | null>>;\n\n private readonly _config: MockAuthConfig;\n\n readonly isAuthenticated: Signal<boolean>;\n readonly currentUser: Signal<User | null>;\n readonly accessToken: Signal<string | null>;\n /** Always false in mock mode — 2FA is handled entirely by the STS. */\n readonly hasPendingTwoFactor: Signal<boolean>;\n /** Always false in mock mode — auth is pre-populated synchronously. */\n readonly initializing: Signal<boolean>;\n\n /**\n * Shell and guards may read this flag; real auth uses `localStorage` `fly_had_session`.\n * Default false — override in the app’s `auth.service.mock.ts` if needed.\n */\n get hadPriorSession(): boolean {\n return false;\n }\n\n constructor() {\n // All signal/computed calls are inside the constructor body so Angular's\n // injection context and ngDevMode are fully set up before they execute.\n this._config = this.getConfig();\n\n this._session = signal<MockSession | null>({\n accessToken: this._config.token ?? 'mock-token',\n user: this._config.user,\n expiresAt: Date.now() + 24 * 60 * 60 * 1000,\n });\n\n this.isAuthenticated = computed(() => {\n const s = this._session();\n return s !== null && s.expiresAt > Date.now();\n });\n\n this.currentUser = computed(() => this._session()?.user ?? null);\n this.accessToken = computed(() => this._session()?.accessToken ?? null);\n this.hasPendingTwoFactor = computed(() => false);\n this.initializing = signal(false).asReadonly();\n }\n\n /** Override in subclass to supply app-specific mock data. */\n protected getConfig(): MockAuthConfig {\n return {\n user: {\n id: 'mock-user-001',\n tenantId: 'mock-tenant-001',\n email: 'developer@fly.local',\n firstName: 'UI',\n lastName: 'Developer',\n fullName: 'UI Developer',\n preferredLocale: 'en',\n roles: ['admin'],\n apps: [],\n },\n };\n }\n\n async init(): Promise<void> {\n // Mock mode: already authenticated, nothing to initialize.\n }\n\n startLogin(): void {\n this.router.navigate(this._config.loginRedirect ?? ['/']);\n }\n\n handleCallback(_code: string, _state?: string): Observable<User> {\n return of(this._config.user);\n }\n\n async forceRefresh(): Promise<void> {\n // No-op in mock mode — token never expires.\n }\n\n patchSessionPreferredLocale(locale: string): void {\n const session = this._session();\n if (!session?.user) return;\n this._session.set({ ...session, user: { ...session.user, preferredLocale: locale } });\n }\n\n /** Parameter order matches the real AuthService: (user, accessToken, expiresAt). */\n setSession(_user: User, _accessToken: string, _expiresAt: number): void {\n // No-op in mock mode — session is hardcoded.\n }\n\n logout(): void {\n this._session.set(null);\n this.router.navigate(this._config.logoutRedirect ?? ['/']);\n }\n}\n","import { Injectable, Signal, computed, signal } from '@angular/core';\nimport type {\n LookupHandle,\n LookupRegistration,\n} from '../../models/agent-input.model';\n\n/**\n * Singleton registry of entity lookups offered by the `/lookup` typeahead.\n *\n * Mirrors {@link AgentCommandRegistry}'s federation-singleton story\n * (`sharedMappings: ['@mohamedatia/fly-design-system']`), id-collision\n * \"latest wins\" contract, and disposable-handle ergonomics. OS-core entities\n * (note / calendar event / file) register once at shell bootstrap via\n * `CORE_APP_LOOKUPS`; federated remotes (Circles: scenario / trend / signal)\n * register at remote-component boot and dispose on window close.\n *\n * **Scope semantics diverge from commands.** Commands HIDE when their `appId`\n * isn't in `liveAppIds`. Lookups DO NOT — they're always offered, and\n * `{appId}` is just a *priority hint* that bumps that lookup to the top of\n * the entity picker when the app is live. See {@link LookupRegistration.scope}\n * for the rationale.\n *\n * Storage is a signal store keyed on {@link LookupRegistration.entity}. Because\n * `entity` is the collision key, an app re-registering the same entity replaces\n * the prior descriptor; a stale handle's `dispose()` then no-ops.\n */\n@Injectable({ providedIn: 'root' })\nexport class AgentLookupRegistry {\n private readonly _lookups = signal<readonly LookupRegistration[]>([]);\n /** All currently-registered lookups, in insertion order. */\n readonly all: Signal<readonly LookupRegistration[]> = this._lookups.asReadonly();\n\n /**\n * All registered lookups, sorted by affinity to `liveAppIds`:\n *\n * 1. Lookups whose `scope.appId` is in the live app set (in registration\n * order within that bucket).\n * 2. Then everything else — `'global'` lookups AND scoped lookups whose\n * app isn't currently live — in registration order.\n *\n * Recomputes when either the registry or `liveAppIds` changes. Pass a\n * `Signal<ReadonlySet<string>>` from the host's app-registry for reactive\n * re-sorting. **Always returns the full registry** — see the type doc on\n * {@link LookupRegistration.scope} for why this differs from\n * {@link AgentCommandRegistry.visible}.\n */\n visible(\n liveAppIds: ReadonlySet<string> | Signal<ReadonlySet<string>>,\n ): Signal<readonly LookupRegistration[]> {\n const liveSignal = isSignal<ReadonlySet<string>>(liveAppIds)\n ? liveAppIds\n : signal(liveAppIds).asReadonly();\n return computed(() => {\n const live = liveSignal();\n const all = this._lookups();\n const prioritized: LookupRegistration[] = [];\n const rest: LookupRegistration[] = [];\n for (const l of all) {\n if (l.scope !== 'global' && live.has(l.scope.appId)) {\n prioritized.push(l);\n } else {\n rest.push(l);\n }\n }\n return prioritized.length === 0 ? all : [...prioritized, ...rest];\n });\n }\n\n /**\n * Register one lookup. Returns a handle whose `dispose()` removes the row by\n * `entity`. A later re-registration of the same entity makes the original\n * handle's `dispose()` a no-op (the newer registration owns the row).\n */\n register(lookup: LookupRegistration): LookupHandle {\n const generation = ++this._generation;\n this._lookups.update((rows) => [\n ...rows.filter((r) => r.entity !== lookup.entity),\n lookup,\n ]);\n this._owners.set(lookup.entity, generation);\n return {\n dispose: () => {\n if (this._owners.get(lookup.entity) === generation) {\n this._owners.delete(lookup.entity);\n this._lookups.update((rows) =>\n rows.filter((r) => r.entity !== lookup.entity),\n );\n }\n },\n };\n }\n\n /**\n * Bulk register. Rolls back on a duplicate entity WITHIN the input batch\n * (throws before any row lands). Cross-batch duplicates against existing rows\n * follow the standard \"latest wins\" rule and do NOT trigger rollback.\n */\n registerAll(lookups: readonly LookupRegistration[]): LookupHandle {\n const seen = new Set<string>();\n for (const l of lookups) {\n if (seen.has(l.entity)) {\n throw new Error(\n `AgentLookupRegistry.registerAll: duplicate entity \"${l.entity}\" in batch`,\n );\n }\n seen.add(l.entity);\n }\n const handles = lookups.map((l) => this.register(l));\n let disposed = false;\n return {\n dispose: () => {\n if (disposed) return;\n disposed = true;\n for (const h of handles) h.dispose();\n },\n };\n }\n\n /**\n * Resolve a deep-link anchor to a concrete launch target.\n *\n * `kind` is the dotted `<appId>.<entity>` token the agents backend emits\n * inside `flyos:<kind>/<id>` chat-answer anchors — the same entity-kind\n * vocabulary as drag-payload kinds and `ref` parts. Returns\n * `{ appId, route }` when a registered lookup for that `(appId, entity)`\n * pair carries a {@link LookupDescriptor.deepLinkRoute} template; `null`\n * otherwise (unknown entity, app mismatch, or no template — e.g. the\n * owning app isn't installed) so the caller renders plain text rather than\n * a dead link.\n *\n * `appId` and `entity` are both dot-free by their own grammars, so the\n * FIRST dot is the unambiguous split point; a dotless `kind` can't carry an\n * app and never resolves. The template's single `{id}` placeholder is\n * substituted URL-encoded.\n */\n resolveDeepLink(\n kind: string,\n id: string,\n ): { readonly appId: string; readonly route: string } | null {\n if (!kind) return null;\n const dot = kind.indexOf('.');\n if (dot <= 0 || dot >= kind.length - 1) return null;\n const appId = kind.slice(0, dot);\n const entity = kind.slice(dot + 1);\n const target = this.resolveDeepLinkForEntity(entity, id);\n // App must match the one named in the anchor — a `flyos:` href carries\n // the owning app explicitly, so a stale/wrong app prefix must NOT resolve\n // even when the bare entity name happens to be registered elsewhere.\n return target && target.appId === appId ? target : null;\n }\n\n /**\n * Resolve a deep-link target from a bare `(entity, id)` pair — the shape a\n * `/lookup` ref carries (it has no `<appId>.<entity>` kind token; the owning\n * app is implicit in the registered descriptor). `entity` is the registry's\n * unique storage key, so it identifies the descriptor unambiguously without\n * an app prefix.\n *\n * Returns `{ appId, route }` (the descriptor's {@link LookupDescriptor.appId}\n * / affinity `scope.appId` as the owner, `{id}` substituted URL-encoded) when\n * a matching descriptor carries a {@link LookupDescriptor.deepLinkRoute};\n * `null` otherwise (unknown entity, no template, or the owning app has since\n * unregistered) so callers render plain text rather than a dead link — the\n * same graceful-degrade contract as {@link resolveDeepLink}.\n */\n resolveDeepLinkForEntity(\n entity: string,\n id: string,\n ): { readonly appId: string; readonly route: string } | null {\n if (!entity || !id) return null;\n const reg = this._lookups().find((r) => r.entity === entity && r.deepLinkRoute);\n const appId = reg ? ownerAppId(reg) : undefined;\n if (!reg?.deepLinkRoute || !appId) return null;\n return { appId, route: reg.deepLinkRoute.replace('{id}', encodeURIComponent(id)) };\n }\n\n /** Tear down by entity. Idempotent. */\n unregister(entity: string): void {\n if (this._owners.delete(entity)) {\n this._lookups.update((rows) => rows.filter((r) => r.entity !== entity));\n }\n }\n\n /** Monotonic counter; identifies which registration call currently owns each entity. */\n private _generation = 0;\n /** entity → generation. Lets a stale handle's `dispose()` no-op after replacement. */\n private readonly _owners = new Map<string, number>();\n}\n\n/** `isSignal` shim — narrows to either `Signal<T>` or a plain value. */\nfunction isSignal<T>(v: T | Signal<T>): v is Signal<T> {\n return typeof v === 'function';\n}\n\n/**\n * The app that owns a registration, for deep-link resolution. Prefers the\n * stamped {@link LookupDescriptor.appId} (set by `RemoteManifestService` /\n * `CORE_APP_LOOKUPS`), falling back to the affinity `scope.appId` so a raw\n * manifest descriptor still resolves even before the host stamps it.\n * Returns `undefined` for `'global'`-scoped lookups with no stamped appId.\n */\nfunction ownerAppId(reg: LookupRegistration): string | undefined {\n return reg.appId ?? (typeof reg.scope === 'object' ? reg.scope.appId : undefined);\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n HostListener,\n ViewChild,\n type OnDestroy,\n type OnInit,\n afterNextRender,\n computed,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { HttpClient, HttpParams } from '@angular/common/http';\nimport { Subscription } from 'rxjs';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\nimport { I18nService } from '../../services/i18n.service';\nimport { AgentLookupRegistry } from '../../services/agent-input/agent-lookup-registry.service';\nimport { APP_LOOKUP } from '../../services/source-app-resolver.service';\nimport type { LookupDescriptor, LookupResult } from '../../models/agent-input.model';\nimport { type EntityLinkSelection } from './entity-lookup.types';\n\n/** Debounce (ms) applied to the typeahead between the user's last keystroke\n * and the HTTP search. Long enough that a fast typist fires one request, not\n * one per character. */\nconst SEARCH_DEBOUNCE_MS = 250;\n\n/** Hard cap on candidate rows rendered, regardless of how many the endpoint\n * returns. The descriptor's `extraParams.pageSize` is the primary bound; this\n * is a defensive client-side backstop so a misconfigured endpoint can't paint\n * a thousand-row list. */\nconst MAX_RESULTS_RENDERED = 25;\n\n/**\n * Shared floating entity typeahead — the `/lookup` picker promoted out of the\n * agent composer into the design-system so any app (agent composer, notes,\n * task comments, federated remotes) can let a user find an entity and act on\n * it. Editor-agnostic: it emits a {@link LookupResult} ({@link pick}) and,\n * when the entity resolves to a deep link, an {@link EntityLinkSelection}\n * ({@link entityLinkSelected}) — the consumer decides whether to make a ref\n * chip, insert a `flyos:` link into an editor, etc.\n *\n * Two-stage cascade:\n * - **Stage 1 — entity**: a filterable autocomplete of the offered entities.\n * Skipped when there's one entity or `initialEntity` already names one.\n * - **Stage 2 — search**: a debounced typeahead against the chosen entity's\n * search endpoint, with a breadcrumb back to stage 1.\n *\n * The HTTP call goes through the host's `HttpClient` so the gateway routing +\n * auth interceptor apply — the same path the MCP `*_list_brief` tools wrap,\n * but user-authenticated. The \"exposed by app\" badge resolves names via the\n * optional {@link LOOKUP_APP_NAME_RESOLVER} the host provides (the DS has no\n * app registry); absent it, the badge falls back to `appBadgeKey`.\n */\n@Component({\n selector: 'fly-entity-lookup',\n standalone: true,\n imports: [CommonModule, FormsModule, TranslatePipe],\n templateUrl: './entity-lookup.component.html',\n styleUrls: ['./entity-lookup.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n // `placement` drives a host class so the panel positions per anchor: `up`\n // (default) = full-width, opens upward (agent composer); `down` =\n // button-anchored dropdown opening down (top toolbar — notes); `above` =\n // button-anchored dropdown opening up (bottom composer — task comments).\n host: {\n '[class.fly-entity-lookup--down]': \"placement() === 'down'\",\n '[class.fly-entity-lookup--above]': \"placement() === 'above'\",\n },\n})\nexport class EntityLookupComponent implements OnInit, OnDestroy {\n private readonly http = inject(HttpClient);\n private readonly i18n = inject(I18nService);\n private readonly host = inject(ElementRef<HTMLElement>);\n private readonly lookupRegistry = inject(AgentLookupRegistry);\n /** Host-provided appId → {id,name} adapter for the \"exposed by app\" badge.\n * The DS has no app registry; the shell (and remotes) provide APP_LOOKUP.\n * Optional — absent, the badge falls back to a descriptor's appBadgeKey. */\n private readonly appLookup = inject(APP_LOOKUP, { optional: true });\n\n /** Entities the picker may search — already filtered to the live-app scope\n * by the caller. Empty renders a \"nothing to look up\" hint. */\n readonly descriptors = input.required<readonly LookupDescriptor[]>();\n /** Entity pre-selected (e.g. from `/lookup <entity>`). Ignored when it\n * doesn't match any descriptor (falls back to the first). */\n readonly initialEntity = input<string | undefined>(undefined);\n /** Query text pre-seeded (e.g. from `/lookup <entity> <query>`). */\n readonly initialQuery = input<string>('');\n /** Per-instance listbox id so `aria-controls` / `aria-activedescendant`\n * resolve unambiguously when multiple panels mount. */\n readonly listboxId = input<string>('fly-entity-lookup-listbox');\n /** Open direction. `'up'` (default) suits a bottom-anchored composer (the\n * agent input); `'down'` suits a top-anchored toolbar button (notes / task\n * comments) — the panel then anchors to the host's positioned parent (the\n * button wrapper) and opens below it with a fixed width. */\n readonly placement = input<'up' | 'down' | 'above'>('up');\n\n /** Raw pick — every consumer gets this (agent ref chips, etc.). */\n readonly pick = output<LookupResult>();\n /** Deep-link selection — emitted ONLY when the picked entity resolves to a\n * route via the lookup registry (so the consumer never gets a dead link).\n * Editors bind this to insert a `flyos:` anchor. */\n readonly entityLinkSelected = output<EntityLinkSelection>();\n readonly dismiss = output<void>();\n\n /** Which cascade stage is active: pick an entity, then search within it. */\n readonly stage = signal<'entity' | 'search'>('entity');\n /** entity key of the descriptor currently being searched. */\n readonly activeEntity = signal<string | null>(null);\n /** In stage 1 this filters the entity list; in stage 2 it's the search text. */\n readonly query = signal<string>('');\n readonly results = signal<readonly LookupResult[]>([]);\n readonly loading = signal<boolean>(false);\n /** i18n key for an inline error (network / bad endpoint); null when clear. */\n readonly errorKey = signal<string | null>(null);\n readonly activeIndex = signal<number>(0);\n\n /** Query stashed when no entity matched, so it can seed the search field the\n * moment the user picks an entity. One-shot. */\n private _seedQuery = '';\n\n /** The descriptor matching {@link activeEntity}, or null. */\n readonly activeDescriptor = computed<LookupDescriptor | null>(() => {\n const e = this.activeEntity();\n if (!e) return null;\n return this.descriptors().find((d) => d.entity === e) ?? null;\n });\n\n /** Stage-1 entity options, narrowed by the typed filter. Touches\n * `i18n.version()` so a locale switch re-resolves the label match. */\n readonly filteredEntities = computed<readonly LookupDescriptor[]>(() => {\n this.i18n.version();\n const q = this.query().trim().toLowerCase();\n const descs = this.descriptors();\n if (q.length === 0) return descs;\n return descs.filter(\n (d) =>\n d.entity.toLowerCase().includes(q) ||\n this.i18n.t(d.labelKey).toLowerCase().includes(q),\n );\n });\n\n /** Size of the list the keyboard currently navigates (entities vs results). */\n readonly listSize = computed<number>(() =>\n this.stage() === 'entity' ? this.filteredEntities().length : this.results().length,\n );\n\n /** Show the breadcrumb / back affordance only when there's a real choice of\n * entity to step back to. */\n readonly showBack = computed<boolean>(() => this.descriptors().length > 1);\n\n /** Placeholder reflects the active stage. */\n readonly searchPlaceholderKey = computed<string>(() =>\n this.stage() === 'entity'\n ? 'agent.lookup.entity_placeholder'\n : 'agent.lookup.search_placeholder',\n );\n\n private _debounceTimer: ReturnType<typeof setTimeout> | null = null;\n private _searchSub: Subscription | null = null;\n\n @ViewChild('searchRef') private readonly searchEl?: ElementRef<HTMLInputElement>;\n\n constructor() {\n afterNextRender(() => this._focusSearch());\n }\n\n ngOnInit(): void {\n const descs = this.descriptors();\n const initial = this.initialEntity();\n const chosen =\n (initial ? descs.find((d) => d.entity === initial) : undefined) ??\n (descs.length === 1 ? descs[0] : undefined);\n if (chosen) {\n this.activeEntity.set(chosen.entity);\n this.query.set(this.initialQuery() ?? '');\n this.stage.set('search');\n this._runSearch();\n } else {\n this._seedQuery = this.initialQuery() ?? '';\n this.activeEntity.set(null);\n this.query.set('');\n this.stage.set('entity');\n }\n }\n\n ngOnDestroy(): void {\n this._clearTimer();\n this._searchSub?.unsubscribe();\n }\n\n optionId(index: number): string {\n return `${this.listboxId()}-opt-${index}`;\n }\n\n readonly activeDescendant = computed<string>(() => {\n if (this.listSize() === 0) return '';\n return `${this.listboxId()}-opt-${this._clampedIndex()}`;\n });\n\n private _clampedIndex(): number {\n const size = this.listSize();\n if (size === 0) return 0;\n return Math.min(Math.max(0, this.activeIndex()), size - 1);\n }\n\n // ── Input + entity handlers ─────────────────────────────────────────────\n\n onQueryInput(value: string): void {\n this.query.set(value);\n this.activeIndex.set(0);\n if (this.stage() === 'search') this._scheduleSearch();\n }\n\n onSelectEntity(entity: string): void {\n this.activeEntity.set(entity);\n this.activeIndex.set(0);\n this.stage.set('search');\n this.query.set(this._seedQuery);\n this._seedQuery = '';\n this.errorKey.set(null);\n this._runSearch();\n this._focusSearch();\n }\n\n goBackToEntity(): void {\n if (!this.showBack()) return;\n this._clearTimer();\n this._searchSub?.unsubscribe();\n this.stage.set('entity');\n this.activeEntity.set(null);\n this.activeIndex.set(0);\n this.query.set('');\n this.results.set([]);\n this.loading.set(false);\n this.errorKey.set(null);\n this._focusSearch();\n }\n\n onRowClick(row: LookupResult): void {\n this._selectRow(row);\n }\n\n onRowHover(index: number): void {\n if (index !== this.activeIndex()) this.activeIndex.set(index);\n }\n\n /**\n * Single pick exit. Emits the raw {@link pick} for every consumer, AND —\n * when the entity resolves to a deep-link route via the registry — an\n * {@link entityLinkSelected} carrying the `flyos:` href. Resolution failures\n * (unknown entity / app mismatch / owning app not installed / no\n * `deepLinkRoute`) simply omit the deep-link event: editor consumers get\n * nothing to insert rather than a dead link, while the raw `pick` path\n * (agent ref chips) still fires.\n */\n private _selectRow(row: LookupResult): void {\n this.pick.emit(row);\n const target = this.lookupRegistry.resolveDeepLinkForEntity(row.entity, row.id);\n if (target) {\n this.entityLinkSelected.emit({\n label: row.label,\n kind: `${target.appId}.${row.entity}`,\n id: row.id,\n appId: target.appId,\n route: target.route,\n href: `flyos:${target.appId}.${row.entity}/${row.id}`,\n });\n }\n }\n\n onKeydown(ev: KeyboardEvent): void {\n if (ev.key === 'Escape') {\n ev.preventDefault();\n ev.stopPropagation();\n this.dismiss.emit();\n return;\n }\n if (\n ev.key === 'Backspace' &&\n this.stage() === 'search' &&\n this.query().length === 0 &&\n this.showBack()\n ) {\n ev.preventDefault();\n this.goBackToEntity();\n return;\n }\n const size = this.listSize();\n if (ev.key === 'ArrowDown') {\n ev.preventDefault();\n if (size === 0) return;\n this.activeIndex.set((this._clampedIndex() + 1) % size);\n return;\n }\n if (ev.key === 'ArrowUp') {\n ev.preventDefault();\n if (size === 0) return;\n this.activeIndex.set((this._clampedIndex() - 1 + size) % size);\n return;\n }\n if (ev.key === 'Enter') {\n ev.preventDefault();\n if (this.stage() === 'entity') {\n const desc = this.filteredEntities()[this._clampedIndex()];\n if (desc) this.onSelectEntity(desc.entity);\n } else {\n const row = this.results()[this._clampedIndex()];\n if (row) this._selectRow(row);\n }\n return;\n }\n }\n\n @HostListener('document:mousedown', ['$event'])\n onDocumentMouseDown(ev: MouseEvent): void {\n const target = ev.target as Node | null;\n if (!target) return;\n if (this.host.nativeElement.contains(target)) return;\n this.dismiss.emit();\n }\n\n @HostListener('document:keydown.escape')\n onDocumentEscape(): void {\n this.dismiss.emit();\n }\n\n // ── Search internals ────────────────────────────────────────────────────\n\n private _scheduleSearch(): void {\n this._clearTimer();\n this._debounceTimer = setTimeout(() => this._runSearch(), SEARCH_DEBOUNCE_MS);\n }\n\n private _clearTimer(): void {\n if (this._debounceTimer !== null) {\n clearTimeout(this._debounceTimer);\n this._debounceTimer = null;\n }\n }\n\n private _runSearch(): void {\n this._clearTimer();\n const desc = this.activeDescriptor();\n if (!desc) {\n this.results.set([]);\n return;\n }\n const endpoint = desc.search.endpoint;\n // SSRF / shape guard — relative path only (no scheme/host, no protocol-\n // relative `//host`).\n if (!endpoint.startsWith('/') || endpoint.startsWith('//')) {\n this.errorKey.set('agent.lookup.error');\n this.results.set([]);\n this.loading.set(false);\n return;\n }\n\n this._searchSub?.unsubscribe();\n this.loading.set(true);\n this.errorKey.set(null);\n\n let params = new HttpParams().set(desc.search.queryParam, this.query().trim());\n for (const [k, v] of Object.entries(desc.search.extraParams ?? {})) {\n params = params.set(k, v);\n }\n\n this._searchSub = this.http.get<unknown>(endpoint, { params }).subscribe({\n next: (body) => {\n this.results.set(this._mapResults(desc, body));\n this.loading.set(false);\n this.activeIndex.set(0);\n },\n error: () => {\n this.errorKey.set('agent.lookup.error');\n this.results.set([]);\n this.loading.set(false);\n },\n });\n }\n\n private _mapResults(desc: LookupDescriptor, body: unknown): readonly LookupResult[] {\n const arr = this._extractArray(body, desc.search.resultsPath);\n const idField = desc.search.idField ?? 'id';\n const dispField = desc.search.displayField;\n const secField = desc.search.secondaryField;\n const appField = desc.search.appIdField;\n const out: LookupResult[] = [];\n for (const item of arr) {\n if (!item || typeof item !== 'object') continue;\n const rec = item as Record<string, unknown>;\n const id = rec[idField];\n const label = rec[dispField];\n if (id == null || label == null) continue;\n const rowAppId =\n appField != null && rec[appField] != null && rec[appField] !== ''\n ? String(rec[appField])\n : undefined;\n out.push({\n entity: desc.entity,\n id: String(id),\n label: String(label),\n secondary:\n secField != null && rec[secField] != null\n ? String(rec[secField])\n : undefined,\n appId: rowAppId,\n });\n if (out.length >= MAX_RESULTS_RENDERED) break;\n }\n return out;\n }\n\n private _extractArray(body: unknown, path?: string): readonly unknown[] {\n if (Array.isArray(body)) return body;\n if (!path) return [];\n let cur: unknown = body;\n for (const seg of path.split('.')) {\n if (cur && typeof cur === 'object' && seg in (cur as object)) {\n cur = (cur as Record<string, unknown>)[seg];\n } else {\n return [];\n }\n }\n return Array.isArray(cur) ? cur : [];\n }\n\n private _focusSearch(): void {\n queueMicrotask(() => this.searchEl?.nativeElement.focus());\n }\n\n entityLabel(desc: LookupDescriptor): string {\n this.i18n.version();\n return this.i18n.t(desc.labelKey);\n }\n\n readonly activeEntityLabel = computed<string>(() => {\n const desc = this.activeDescriptor();\n return desc ? this.entityLabel(desc) : '';\n });\n\n /**\n * Display name of the app exposing this descriptor, for the \"exposed by …\"\n * badge. Resolution order: host-provided {@link LOOKUP_APP_NAME_RESOLVER}\n * (keyed by `descriptor.appId`) → descriptor `appBadgeKey` (literal i18n\n * key, for entities not mapped to a single shell app) → '' (no badge).\n */\n appLabel(desc: LookupDescriptor): string {\n this.i18n.version();\n if (desc.appId) {\n const resolved = this.appLookup?.getById(desc.appId)?.name;\n if (resolved) return resolved;\n }\n if (desc.appBadgeKey) return this.i18n.t(desc.appBadgeKey);\n return '';\n }\n\n readonly activeAppLabel = computed<string>(() => {\n const desc = this.activeDescriptor();\n return desc ? this.appLabel(desc) : '';\n });\n\n /** Per-row source-app label for stage-2 rows. Resolves {@link LookupResult.appId}\n * through the host resolver. '' when the row carries no `appId`, the resolver\n * is absent / doesn't know it, or it duplicates {@link activeAppLabel}. */\n rowAppLabel(row: LookupResult): string {\n this.i18n.version();\n if (!row.appId) return '';\n const resolved = this.appLookup?.getById(row.appId)?.name;\n if (!resolved) return '';\n if (resolved === this.activeAppLabel()) return '';\n return resolved;\n }\n}\n","<div class=\"fly-entity-lookup\" role=\"dialog\" [attr.aria-label]=\"'agent.lookup.dialog_aria' | translate\">\n @if (descriptors().length === 0) {\n <div class=\"fly-entity-lookup__empty\" role=\"status\">\n {{ 'agent.lookup.no_entities' | translate }}\n </div>\n } @else {\n <div class=\"fly-entity-lookup__search\" role=\"combobox\" aria-haspopup=\"listbox\" aria-expanded=\"true\"\n [attr.aria-controls]=\"listboxId()\">\n @if (stage() === 'search' && showBack()) {\n <!-- Breadcrumb back to the entity picker (also reachable via Backspace\n on an empty query). Shows the chosen entity so the user always\n knows what they're searching within. -->\n <button\n type=\"button\"\n class=\"fly-entity-lookup__crumb\"\n (click)=\"goBackToEntity()\"\n [attr.aria-label]=\"'agent.lookup.back_aria' | translate\">\n <i class=\"pi pi-angle-left fly-entity-lookup__crumb-back\" aria-hidden=\"true\"></i>\n @if (activeDescriptor()?.icon; as ic) {\n <i class=\"pi {{ ic }}\" aria-hidden=\"true\"></i>\n }\n <span>{{ activeEntityLabel() }}</span>\n </button>\n } @else {\n <i class=\"pi pi-search fly-entity-lookup__search-icon\" aria-hidden=\"true\"></i>\n }\n <input\n #searchRef\n type=\"text\"\n class=\"fly-entity-lookup__search-input\"\n [ngModel]=\"query()\"\n (ngModelChange)=\"onQueryInput($event)\"\n (keydown)=\"onKeydown($event)\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-controls]=\"listboxId()\"\n [placeholder]=\"searchPlaceholderKey() | translate\" />\n </div>\n\n <div [id]=\"listboxId()\" class=\"fly-entity-lookup__results\" role=\"listbox\"\n [attr.aria-label]=\"(stage() === 'entity' ? 'agent.lookup.entities_aria' : 'agent.lookup.results_aria') | translate\">\n @if (stage() === 'entity') {\n <!-- Stage 1: entity autocomplete. -->\n @if (filteredEntities().length === 0) {\n <div class=\"fly-entity-lookup__status\" role=\"status\">{{ 'agent.lookup.no_results' | translate }}</div>\n } @else {\n @for (desc of filteredEntities(); track desc.entity; let i = $index) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"fly-entity-lookup__opt fly-entity-lookup__opt--entity\"\n [id]=\"optionId(i)\"\n [attr.aria-selected]=\"i === activeIndex()\"\n [class.is-active]=\"i === activeIndex()\"\n (click)=\"onSelectEntity(desc.entity)\"\n (mouseenter)=\"onRowHover(i)\">\n <span class=\"fly-entity-lookup__opt-label\">\n @if (desc.icon) {\n <i class=\"pi {{ desc.icon }}\" aria-hidden=\"true\"></i>\n }\n {{ entityLabel(desc) }}\n </span>\n @if (appLabel(desc); as app) {\n <span class=\"fly-entity-lookup__opt-app-badge\" [title]=\"app\">{{ app }}</span>\n }\n <i class=\"pi pi-angle-right fly-entity-lookup__opt-chevron\" aria-hidden=\"true\"></i>\n </button>\n }\n }\n } @else {\n <!-- Stage 2: result typeahead within the chosen entity. -->\n @if (loading()) {\n <div class=\"fly-entity-lookup__status\" role=\"status\">{{ 'agent.lookup.searching' | translate }}</div>\n } @else if (errorKey(); as err) {\n <div class=\"fly-entity-lookup__status fly-entity-lookup__status--error\" role=\"alert\">{{ err | translate }}</div>\n } @else if (results().length === 0) {\n <div class=\"fly-entity-lookup__status\" role=\"status\">{{ 'agent.lookup.no_results' | translate }}</div>\n } @else {\n @for (row of results(); track row.id; let i = $index) {\n <button\n type=\"button\"\n role=\"option\"\n class=\"fly-entity-lookup__opt\"\n [id]=\"optionId(i)\"\n [attr.aria-selected]=\"i === activeIndex()\"\n [class.is-active]=\"i === activeIndex()\"\n (click)=\"onRowClick(row)\"\n (mouseenter)=\"onRowHover(i)\">\n <span class=\"fly-entity-lookup__opt-label\" [title]=\"row.label\">{{ row.label }}</span>\n @if (row.secondary) {\n <span class=\"fly-entity-lookup__opt-secondary\">{{ row.secondary }}</span>\n }\n @if (rowAppLabel(row); as rowApp) {\n <!-- Source app of this individual row (e.g. \"Circles\" for a\n Help-Center article seeded by Circles). Rendered before the\n descriptor tag so the per-row signal sits closer to the\n title; suppressed when it would duplicate the descriptor\n label. -->\n <span class=\"fly-entity-lookup__opt-app-tag fly-entity-lookup__opt-app-tag--source\"\n [title]=\"rowApp\">{{ rowApp }}</span>\n }\n @if (activeAppLabel(); as app) {\n <span class=\"fly-entity-lookup__opt-app-tag\" [title]=\"app\">{{ app }}</span>\n }\n </button>\n }\n }\n }\n </div>\n }\n</div>\n","/**\n * Centralised registration + a non-resetting Link extension for the platform's\n * ``flyos:`` entity deep-link scheme.\n *\n * WHY THIS EXISTS — Tiptap's stock ``@tiptap/extension-link`` couples two\n * concerns onto its ``protocols`` option:\n * 1. ``isAllowedUri`` allow-listing — read directly from ``options.protocols``\n * so a ``flyos:`` href survives instead of being blanked to ``href=\"\"``.\n * 2. linkify autolink scheme registration — done by calling linkify's global\n * ``registerCustomProtocol`` inside the mark's ``onCreate``, and undone by\n * ``reset()`` inside ``onDestroy``.\n *\n * linkify is a process-wide singleton that only accepts scheme registration\n * *before* its first tokenisation. So with stock Link the SECOND editor to mount\n * after linkify has initialised re-calls ``registerCustomProtocol`` and linkify\n * logs:\n * ``linkifyjs: already initialized - will not register custom scheme \"flyos\" …``\n * and worse, every editor's ``onDestroy`` ``reset()`` wipes the scheme registry\n * for all other live editors.\n *\n * {@link FlyosLink} keeps concern (1) — ``protocols`` stays set, so hrefs and\n * ``getMarkdown()`` round-trips survive — but drops the per-editor register\n * /reset of (2). Registration is hoisted to a single {@link registerFlyosProtocol}\n * call made once, before any editor, so the scheme is registered exactly once\n * and never torn down.\n *\n * See ``skills/cross-app-deep-linking.md``.\n */\nimport { Link, type LinkOptions } from '@tiptap/extension-link';\nimport { registerCustomProtocol } from 'linkifyjs';\n\n/** The platform entity deep-link URI scheme (``flyos:<appId>.<entity>/<id>``). */\nexport const FLYOS_PROTOCOL = 'flyos';\n\nlet registered = false;\n\n/**\n * Register the ``flyos`` scheme with linkify exactly once. MUST run before any\n * Tiptap editor tokenises (i.e. at app bootstrap) because linkify rejects — and\n * warns about — scheme registration after its singleton initialises.\n *\n * Idempotent: repeat calls are no-ops, so it is safe to also call defensively\n * from an editor's constructor for consumers that don't own a shared bootstrap\n * (e.g. a federated remote that mounts {@link FlyMarkdownEditorComponent}\n * standalone).\n */\nexport function registerFlyosProtocol(): void {\n if (registered) return;\n registered = true;\n registerCustomProtocol(FLYOS_PROTOCOL);\n}\n\n/**\n * Drop-in replacement for ``@tiptap/extension-link``'s ``Link`` that keeps the\n * ``flyos`` href allow-list but does NOT register the scheme per-editor or\n * ``reset()`` linkify on teardown — see the module header for the full\n * rationale. Defaults ``openOnClick`` off because ``flyos:`` is non-routable in\n * a browser; surfaces that can launch in-shell wire their own\n * ``editorProps.handleClick`` (see ``flyosEditorHandleClick``).\n *\n * Keeps the mark name ``link`` so StarterKit's link commands (``setLink`` /\n * ``toggleLink`` / ``isActive('link')``) and markdown serialisation keep\n * working — pair it with ``StarterKit.configure({ link: false })``.\n */\nexport const FlyosLink = Link.extend({\n addOptions() {\n // `parent` (the base Link's addOptions) is always defined for Link.extend;\n // the cast restores the required LinkOptions fields the optional `?.` drops.\n return {\n ...(this.parent?.() as LinkOptions),\n openOnClick: false,\n protocols: [FLYOS_PROTOCOL],\n };\n },\n // Scheme registration is centralised in registerFlyosProtocol(); skipping the\n // stock per-editor registerCustomProtocol() is what silences linkify's\n // \"already initialized\" warning on the 2nd+ concurrent editor.\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- intentional no-op override\n onCreate() {},\n // Stock Link calls linkify reset() here, which would un-register `flyos`\n // (and every other custom scheme) for every other live editor. Registration\n // is process-wide and owned by registerFlyosProtocol() — never torn down.\n // eslint-disable-next-line @typescript-eslint/no-empty-function -- intentional no-op override\n onDestroy() {},\n});\n","import { InjectionToken } from '@angular/core';\n\n/**\n * Host-provided handler that navigates to a resolved in-app entity deep link\n * when the user clicks a `flyos:` anchor inside a {@link FlyMarkdownEditorComponent}.\n *\n * The design-system can RESOLVE a `flyos:<appId>.<entity>/<id>` href to a\n * `{ appId, route }` (via `AgentLookupRegistry`), but it cannot LAUNCH it — the\n * launcher lives in the host (the desktop shell's `ShellLauncherService`, or a\n * remote's own router). The host provides this token; when absent, a `flyos:`\n * click is a no-op (the link is non-routable in a bare browser anyway).\n */\nexport type EntityLinkLauncher = (target: {\n readonly appId: string;\n readonly route: string;\n readonly kind: string;\n readonly id: string;\n}) => void;\n\nexport const ENTITY_LINK_LAUNCHER = new InjectionToken<EntityLinkLauncher>(\n 'ENTITY_LINK_LAUNCHER',\n);\n\n/**\n * A toolbar control id, or `'|'` for a visual divider. `toolbar` accepts a\n * preset name or an explicit ordered list of these.\n */\nexport type MarkdownToolbarItem =\n | 'undo' | 'redo'\n | 'h1' | 'h2' | 'h3'\n | 'bold' | 'italic' | 'underline' | 'strike' | 'code'\n | 'bulletList' | 'orderedList' | 'taskList'\n | 'blockquote' | 'codeBlock' | 'horizontalRule'\n | 'link' | 'entityLink'\n | '|';\n\n/** Named toolbar presets. `full` ≈ the notes editor; `compact` ≈ task comments. */\nexport type MarkdownToolbarPreset = 'full' | 'compact';\n\nexport const MARKDOWN_TOOLBAR_PRESETS: Record<MarkdownToolbarPreset, readonly MarkdownToolbarItem[]> = {\n full: [\n 'undo', 'redo', '|',\n 'h1', 'h2', 'h3', '|',\n 'bold', 'italic', 'underline', 'strike', 'code', '|',\n 'bulletList', 'orderedList', 'taskList', '|',\n 'blockquote', 'codeBlock', 'horizontalRule', '|',\n 'link', 'entityLink',\n ],\n compact: [\n 'bold', 'italic', 'code', '|',\n 'bulletList', 'orderedList', '|',\n 'link', 'entityLink',\n ],\n};\n","import {\n ChangeDetectionStrategy,\n ChangeDetectorRef,\n Component,\n forwardRef,\n inject,\n input,\n output,\n signal,\n computed,\n type OnDestroy,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule, NG_VALUE_ACCESSOR, type ControlValueAccessor } from '@angular/forms';\nimport { Editor } from '@tiptap/core';\nimport StarterKit from '@tiptap/starter-kit';\nimport { Markdown } from '@tiptap/markdown';\nimport TaskList from '@tiptap/extension-task-list';\nimport TaskItem from '@tiptap/extension-task-item';\nimport { TiptapEditorDirective } from 'ngx-tiptap';\nimport { FlyosLink, registerFlyosProtocol } from '../../tiptap/flyos-link';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\nimport { AgentLookupRegistry } from '../../services/agent-input/agent-lookup-registry.service';\nimport { EntityLookupComponent } from '../entity-lookup/entity-lookup.component';\nimport type { EntityLinkSelection } from '../entity-lookup/entity-lookup.types';\nimport type { LookupDescriptor } from '../../models/agent-input.model';\nimport {\n ENTITY_LINK_LAUNCHER,\n MARKDOWN_TOOLBAR_PRESETS,\n type MarkdownToolbarItem,\n type MarkdownToolbarPreset,\n} from './markdown-editor.types';\n\n/** Parses a live `flyos:<appId>.<entity>/<id>` href into `{kind, id}`. */\nconst FLYOS_HREF_RE = /^flyos:([^/]+)\\/(.+)$/;\n\n/** Simple command buttons (everything except link / entityLink / divider).\n * `cmd` runs on the focused chain; `active` is the `isActive` probe. */\nconst TOOLBAR_BUTTONS: Record<string, { icon: string; labelKey: string; cmd: (e: Editor) => void; active?: { name: string; attrs?: Record<string, unknown> } }> = {\n undo: { icon: 'pi-undo', labelKey: 'common.label.undo', cmd: (e) => e.commands.undo() },\n redo: { icon: 'pi-refresh', labelKey: 'common.label.redo', cmd: (e) => e.commands.redo() },\n bold: { icon: '', labelKey: 'common.label.bold', cmd: (e) => e.chain().focus().toggleBold().run(), active: { name: 'bold' } },\n italic: { icon: '', labelKey: 'common.label.italic', cmd: (e) => e.chain().focus().toggleItalic().run(), active: { name: 'italic' } },\n underline: { icon: '', labelKey: 'common.label.underline', cmd: (e) => e.chain().focus().toggleUnderline().run(), active: { name: 'underline' } },\n strike: { icon: '', labelKey: 'common.label.strikethrough', cmd: (e) => e.chain().focus().toggleStrike().run(), active: { name: 'strike' } },\n code: { icon: 'pi-code', labelKey: 'common.label.inline_code', cmd: (e) => e.chain().focus().toggleCode().run(), active: { name: 'code' } },\n codeBlock: { icon: 'pi-file-edit', labelKey: 'common.label.code_block', cmd: (e) => e.chain().focus().toggleCodeBlock().run(), active: { name: 'codeBlock' } },\n blockquote: { icon: 'pi-comment', labelKey: 'common.label.blockquote', cmd: (e) => e.chain().focus().toggleBlockquote().run(), active: { name: 'blockquote' } },\n bulletList: { icon: 'pi-list', labelKey: 'common.label.bullet_list', cmd: (e) => e.chain().focus().toggleBulletList().run(), active: { name: 'bulletList' } },\n orderedList: { icon: 'pi-sort-numeric-down', labelKey: 'common.label.numbered_list', cmd: (e) => e.chain().focus().toggleOrderedList().run(), active: { name: 'orderedList' } },\n taskList: { icon: 'pi-check-square', labelKey: 'common.label.task_list', cmd: (e) => e.chain().focus().toggleTaskList().run(), active: { name: 'taskList' } },\n horizontalRule: { icon: 'pi-minus', labelKey: 'common.label.horizontal_rule', cmd: (e) => e.chain().focus().setHorizontalRule().run() },\n h1: { icon: '', labelKey: 'common.label.heading1', cmd: (e) => e.chain().focus().toggleHeading({ level: 1 }).run(), active: { name: 'heading', attrs: { level: 1 } } },\n h2: { icon: '', labelKey: 'common.label.heading2', cmd: (e) => e.chain().focus().toggleHeading({ level: 2 }).run(), active: { name: 'heading', attrs: { level: 2 } } },\n h3: { icon: '', labelKey: 'common.label.heading3', cmd: (e) => e.chain().focus().toggleHeading({ level: 3 }).run(), active: { name: 'heading', attrs: { level: 3 } } },\n};\n\n/**\n * Shared rich-text/markdown editor — the single Tiptap-backed editor for FlyOS\n * apps (notes, task comments, admin) and Business Apps (Circles). Emits a\n * Markdown string via `ControlValueAccessor`, so it slots into reactive forms\n * or `[(ngModel)]` with no orchestration.\n *\n * Bakes in the platform's `flyos:` entity-deep-link contract: the Link mark\n * whitelists the `flyos` scheme (so authored/pasted deep links aren't blanked),\n * clicks on a resolvable `flyos:` anchor launch the owning app via the\n * host-provided {@link ENTITY_LINK_LAUNCHER}, and the optional \"entity link\"\n * toolbar button opens the shared {@link EntityLookupComponent} to insert one.\n */\n@Component({\n selector: 'fly-markdown-editor',\n standalone: true,\n imports: [CommonModule, FormsModule, TiptapEditorDirective, TranslatePipe, EntityLookupComponent],\n templateUrl: './markdown-editor.component.html',\n styleUrls: ['./markdown-editor.component.scss'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n { provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => FlyMarkdownEditorComponent), multi: true },\n ],\n})\nexport class FlyMarkdownEditorComponent implements ControlValueAccessor, OnDestroy {\n private readonly cdr = inject(ChangeDetectorRef);\n private readonly lookupRegistry = inject(AgentLookupRegistry);\n private readonly launcher = inject(ENTITY_LINK_LAUNCHER, { optional: true });\n\n /** Toolbar preset name or an explicit ordered item list. */\n readonly toolbar = input<MarkdownToolbarPreset | readonly MarkdownToolbarItem[]>('full');\n /** Show the \"insert in-app link\" (entity-lookup) toolbar button. */\n readonly enableEntityLink = input(true);\n /** Direction the entity-lookup dropdown opens. `down` (default) suits a\n * top toolbar (notes); `above` suits a bottom-anchored composer (task\n * comments) so the panel doesn't run off the viewport. */\n readonly entityLinkPlacement = input<'down' | 'above'>('down');\n readonly placeholder = input('');\n readonly readonly = input(false);\n readonly ariaLabel = input('');\n\n /** Fired on Ctrl/Cmd+Enter (host can submit a comment, etc.). */\n readonly submitShortcut = output<void>();\n\n // CVA plumbing.\n private onChange: (v: string) => void = () => undefined;\n private onTouched: () => void = () => undefined;\n private currentValue = '';\n\n // Toolbar reactive state.\n readonly activeStates = signal<Record<string, boolean>>({});\n readonly canUndo = signal(false);\n readonly canRedo = signal(false);\n\n // Link (URL) popover.\n readonly showLinkPopover = signal(false);\n readonly linkInputValue = signal('');\n\n // Entity-link picker.\n readonly showEntityLookup = signal(false);\n readonly entityLookupDescriptors = computed<readonly LookupDescriptor[]>(() =>\n this.lookupRegistry.all().filter((d) => !!d.deepLinkRoute),\n );\n\n /** Resolved toolbar items (preset → array), entityLink stripped when disabled. */\n readonly toolbarItems = computed<readonly MarkdownToolbarItem[]>(() => {\n const t = this.toolbar();\n const items = typeof t === 'string' ? MARKDOWN_TOOLBAR_PRESETS[t] : t;\n return this.enableEntityLink() ? items : items.filter((i) => i !== 'entityLink');\n });\n\n readonly editor: Editor;\n\n constructor() {\n // Register the `flyos` scheme once, before this editor tokenises. Idempotent\n // — covered by the shell bootstrap in the desktop host, but called here too\n // so a standalone consumer (e.g. a federated remote) is self-sufficient.\n registerFlyosProtocol();\n this.editor = new Editor({\n extensions: [\n // FlyosLink replaces StarterKit's bundled link: it keeps the `flyos:`\n // href whitelist (so the href isn't blanked) but skips the per-editor\n // linkify register/reset that triggers the \"already initialized\" warning\n // across concurrent editors. openOnClick false because flyos: is\n // non-routable — handleClick launches in-shell below.\n StarterKit.configure({ link: false }),\n FlyosLink,\n Markdown,\n TaskList,\n TaskItem.configure({ nested: true }),\n ],\n editorProps: {\n attributes: { class: 'fly-md-editor__prosemirror', spellcheck: 'true' },\n handleClick: (_view, _pos, event) => this.handleFlyosClick(event),\n handleKeyDown: (_view, event) => {\n if ((event.metaKey || event.ctrlKey) && event.key === 'Enter') {\n event.preventDefault();\n this.submitShortcut.emit();\n return true;\n }\n return false;\n },\n },\n onUpdate: () => {\n this.currentValue = this.editor.getMarkdown();\n this.onChange(this.currentValue);\n this.refreshState();\n this.cdr.markForCheck();\n },\n onSelectionUpdate: () => {\n this.refreshState();\n this.cdr.markForCheck();\n },\n onBlur: () => this.onTouched(),\n });\n }\n\n ngOnDestroy(): void {\n this.editor.destroy();\n }\n\n // ── ControlValueAccessor ────────────────────────────────────────────────\n\n writeValue(value: string | null): void {\n this.currentValue = value ?? '';\n // contentType:'markdown' parses the string as Markdown; emitUpdate:false so\n // hydrating the model doesn't echo back through onChange.\n this.editor.commands.setContent(this.currentValue, { emitUpdate: false, contentType: 'markdown' });\n this.refreshState();\n this.cdr.markForCheck();\n }\n\n registerOnChange(fn: (v: string) => void): void { this.onChange = fn; }\n registerOnTouched(fn: () => void): void { this.onTouched = fn; }\n setDisabledState(isDisabled: boolean): void { this.editor.setEditable(!isDisabled); }\n\n // ── Imperative reads (for hosts that persist a rendered HTML snapshot\n // alongside the markdown CVA value, e.g. notes' contentHtml) ───────────\n /** Current markdown (same as the CVA value). */\n getMarkdown(): string { return this.editor.getMarkdown(); }\n /** Current rendered HTML snapshot. */\n getHtml(): string { return this.editor.getHTML(); }\n /** Focus the editor surface. */\n focus(): void { this.editor.commands.focus(); }\n\n // ── Toolbar ──────────────────────────────────────────────────────────────\n\n button(id: MarkdownToolbarItem): { icon: string; labelKey: string } | null {\n const b = TOOLBAR_BUTTONS[id];\n return b ? { icon: b.icon, labelKey: b.labelKey } : null;\n }\n\n /** Short visual label for buttons rendered as text (B / I / U / S / H1…). */\n textLabel(id: MarkdownToolbarItem): string | null {\n switch (id) {\n case 'bold': return 'B';\n case 'italic': return 'I';\n case 'underline': return 'U';\n case 'strike': return 'S';\n case 'h1': return 'H1';\n case 'h2': return 'H2';\n case 'h3': return 'H3';\n default: return null;\n }\n }\n\n run(id: MarkdownToolbarItem): void {\n const b = TOOLBAR_BUTTONS[id];\n if (!b) return;\n b.cmd(this.editor);\n this.refreshState();\n this.cdr.markForCheck();\n }\n\n isActive(id: MarkdownToolbarItem): boolean {\n return this.activeStates()[id] ?? false;\n }\n\n disabled(id: MarkdownToolbarItem): boolean {\n if (id === 'undo') return !this.canUndo();\n if (id === 'redo') return !this.canRedo();\n return false;\n }\n\n private refreshState(): void {\n this.canUndo.set(this.editor.can().undo());\n this.canRedo.set(this.editor.can().redo());\n const states: Record<string, boolean> = {};\n for (const [id, b] of Object.entries(TOOLBAR_BUTTONS)) {\n if (b.active) states[id] = this.editor.isActive(b.active.name, b.active.attrs ?? {});\n }\n states['link'] = this.editor.isActive('link');\n this.activeStates.set(states);\n }\n\n // ── Link (URL) popover ─────────────────────────────────────────────────\n\n openLinkPopover(): void {\n this.showEntityLookup.set(false);\n this.linkInputValue.set((this.editor.getAttributes('link')['href'] as string | undefined) ?? '');\n this.showLinkPopover.set(true);\n }\n onLinkInput(value: string): void { this.linkInputValue.set(value); }\n commitLink(): void {\n const url = this.linkInputValue().trim();\n const chain = this.editor.chain().focus().extendMarkRange('link');\n if (url === '') chain.unsetLink().run();\n else chain.setLink({ href: url }).run();\n this.showLinkPopover.set(false);\n this.refreshState();\n this.cdr.markForCheck();\n }\n cancelLink(): void { this.showLinkPopover.set(false); }\n onLinkKeydown(event: KeyboardEvent): void {\n if (event.key === 'Enter') { event.preventDefault(); this.commitLink(); }\n if (event.key === 'Escape') { this.cancelLink(); }\n }\n\n // ── Entity-link picker ─────────────────────────────────────────────────\n\n toggleEntityLookup(): void {\n this.showLinkPopover.set(false);\n this.showEntityLookup.update((open) => !open);\n }\n closeEntityLookup(): void { this.showEntityLookup.set(false); }\n\n onEntityLinkSelected(sel: EntityLinkSelection): void {\n this.editor\n .chain()\n .focus()\n .insertContent({ type: 'text', text: sel.label, marks: [{ type: 'link', attrs: { href: sel.href } }] })\n .insertContent(' ')\n .run();\n this.showEntityLookup.set(false);\n this.refreshState();\n this.cdr.markForCheck();\n }\n\n // ── flyos: click → launch ──────────────────────────────────────────────\n\n /** True (click handled) when a resolvable `flyos:` anchor was launched. */\n private handleFlyosClick(event: MouseEvent): boolean {\n const anchor = (event.target as HTMLElement | null)?.closest('a');\n const href = anchor?.getAttribute('href');\n if (!href) return false;\n const m = FLYOS_HREF_RE.exec(href);\n if (!m) return false;\n event.preventDefault();\n const [, kind, id] = m;\n const target = this.lookupRegistry.resolveDeepLink(kind, id);\n if (!target || !this.launcher) return false;\n this.launcher({ appId: target.appId, route: target.route, kind, id });\n return true;\n }\n}\n","<div class=\"fly-md-editor\" [class.fly-md-editor--entity-above]=\"entityLinkPlacement() === 'above'\">\n <div class=\"fly-md-editor__toolbar\" role=\"toolbar\" [attr.aria-label]=\"('common.label.formatting_toolbar' | translate)\">\n @for (item of toolbarItems(); track $index) {\n @switch (item) {\n @case ('|') {\n <span class=\"fly-md-editor__divider\" aria-hidden=\"true\"></span>\n }\n @case ('link') {\n <div class=\"fly-md-editor__link-wrap\">\n <button type=\"button\" class=\"fly-md-editor__btn\" [class.is-active]=\"isActive('link')\"\n (click)=\"openLinkPopover()\"\n [title]=\"'common.label.link' | translate\" [attr.aria-label]=\"'common.label.link' | translate\">\n <i class=\"pi pi-link\" aria-hidden=\"true\"></i>\n </button>\n @if (showLinkPopover()) {\n <div class=\"fly-md-editor__link-popover\" role=\"dialog\" [attr.aria-label]=\"'common.label.link' | translate\">\n <input class=\"fly-md-editor__link-input\" type=\"url\"\n [value]=\"linkInputValue()\" (input)=\"onLinkInput($any($event.target).value)\"\n (keydown)=\"onLinkKeydown($event)\"\n [placeholder]=\"'common.label.https' | translate\"\n [attr.aria-label]=\"'common.label.link' | translate\" />\n <button type=\"button\" class=\"fly-md-editor__link-ok\" (click)=\"commitLink()\"\n [title]=\"'common.label.apply' | translate\"><i class=\"pi pi-check\" aria-hidden=\"true\"></i></button>\n <button type=\"button\" class=\"fly-md-editor__link-cancel\" (click)=\"cancelLink()\"\n [title]=\"'common.action.cancel' | translate\"><i class=\"pi pi-times\" aria-hidden=\"true\"></i></button>\n </div>\n }\n </div>\n }\n @case ('entityLink') {\n <div class=\"fly-md-editor__entity-wrap\">\n <button type=\"button\" class=\"fly-md-editor__btn\" [class.is-active]=\"showEntityLookup()\"\n (click)=\"toggleEntityLookup()\" [attr.aria-expanded]=\"showEntityLookup()\"\n [title]=\"'common.label.insert_entity_link' | translate\" [attr.aria-label]=\"'common.label.insert_entity_link' | translate\">\n <i class=\"pi pi-bookmark\" aria-hidden=\"true\"></i>\n </button>\n @if (showEntityLookup()) {\n <fly-entity-lookup\n [placement]=\"entityLinkPlacement()\"\n [descriptors]=\"entityLookupDescriptors()\"\n (entityLinkSelected)=\"onEntityLinkSelected($event)\"\n (dismiss)=\"closeEntityLookup()\" />\n }\n </div>\n }\n @default {\n <button type=\"button\" class=\"fly-md-editor__btn\"\n [class.is-active]=\"isActive(item)\" [disabled]=\"disabled(item)\"\n (click)=\"run(item)\"\n [title]=\"(button(item)?.labelKey ?? '') | translate\"\n [attr.aria-label]=\"(button(item)?.labelKey ?? '') | translate\">\n @if (textLabel(item); as txt) {\n <span class=\"fly-md-editor__btn-text\">{{ txt }}</span>\n } @else {\n <i class=\"pi {{ button(item)?.icon }}\" aria-hidden=\"true\"></i>\n }\n </button>\n }\n }\n }\n </div>\n\n <div class=\"fly-md-editor__body\" tiptap [editor]=\"editor\"\n [attr.aria-label]=\"ariaLabel()\" [attr.data-placeholder]=\"placeholder()\"></div>\n</div>\n","import {\n Component, input, output, HostListener, ViewChild, ElementRef,\n computed, signal, AfterViewInit, OnDestroy, ChangeDetectionStrategy, inject, DOCUMENT,\n} from '@angular/core';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\n\nexport interface ContextMenuItem {\n id: string;\n label: string;\n icon: string;\n}\n\nexport interface ContextMenuSection {\n label?: string;\n items: ContextMenuItem[];\n}\n\n@Component({\n selector: 'fly-context-menu',\n standalone: true,\n imports: [TranslatePipe],\n templateUrl: './context-menu.component.html',\n styleUrl: './context-menu.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class ContextMenuComponent implements AfterViewInit, OnDestroy {\n @ViewChild('contextMenu') private menuEl?: ElementRef<HTMLElement>;\n\n private readonly doc = inject(DOCUMENT);\n private readonly hostEl = inject(ElementRef<HTMLElement>);\n\n x = input.required<number>();\n y = input.required<number>();\n sections = input.required<ContextMenuSection[]>();\n action = output<string>();\n closed = output<void>();\n\n private menuWidth = signal(0);\n private menuHeight = signal(0);\n\n private previouslyFocused: Element | null = null;\n\n // Resolved position: clamp to viewport so the menu never overflows an edge.\n // menuWidth/Height start at 0 so the first render places the menu at (x,y)\n // with no clamping; ngAfterViewInit measures the real size and updates the\n // signals, which re-evaluates this computed and repositions correctly.\n clampedPos = computed(() => {\n const vw = this.doc.defaultView?.innerWidth ?? 0;\n const vh = this.doc.defaultView?.innerHeight ?? 0;\n const w = this.menuWidth();\n const h = this.menuHeight();\n const x = this.x();\n const y = this.y();\n return {\n left: w > 0 ? Math.min(x, vw - w - 8) : x,\n top: h > 0 ? Math.min(y, vh - h - 8) : y,\n };\n });\n\n ngAfterViewInit(): void {\n // Portal: move host to <body> so position:fixed resolves against the true\n // viewport, not against any transformed/backdrop-filtered ancestor window.\n this.doc.body.appendChild(this.hostEl.nativeElement);\n\n // Measure after portal move so offsetWidth/Height are accurate.\n const el = this.menuEl?.nativeElement;\n if (el) {\n this.menuWidth.set(el.offsetWidth);\n this.menuHeight.set(el.offsetHeight);\n }\n\n this.previouslyFocused = document.activeElement;\n this.focusItem(0);\n }\n\n ngOnDestroy(): void {\n const el = this.hostEl.nativeElement;\n if (el.parentNode === this.doc.body) {\n this.doc.body.removeChild(el);\n }\n }\n\n onAction(id: string): void {\n this.action.emit(id);\n this.close();\n }\n\n @HostListener('document:mousedown', ['$event'])\n onClickOutside(event: MouseEvent): void {\n if (!this.menuEl?.nativeElement.contains(event.target as Node)) {\n this.close();\n }\n }\n\n @HostListener('document:keydown.escape')\n onEscape(): void {\n this.close();\n }\n\n @HostListener('document:contextmenu', ['$event'])\n onContextMenu(event: MouseEvent): void {\n if (!this.menuEl?.nativeElement.contains(event.target as Node)) {\n this.close();\n }\n }\n\n @HostListener('keydown', ['$event'])\n onKeydown(event: KeyboardEvent): void {\n const items = this.getMenuItems();\n if (!items.length) return;\n const focused = document.activeElement as HTMLElement;\n const idx = items.indexOf(focused);\n\n if (event.key === 'ArrowDown') {\n event.preventDefault();\n this.focusItem(idx < items.length - 1 ? idx + 1 : 0);\n } else if (event.key === 'ArrowUp') {\n event.preventDefault();\n this.focusItem(idx > 0 ? idx - 1 : items.length - 1);\n } else if (event.key === 'Home') {\n event.preventDefault();\n this.focusItem(0);\n } else if (event.key === 'End') {\n event.preventDefault();\n this.focusItem(items.length - 1);\n }\n }\n\n private close(): void {\n this.restoreFocus();\n this.closed.emit();\n }\n\n private getMenuItems(): HTMLElement[] {\n return Array.from(\n this.menuEl?.nativeElement.querySelectorAll<HTMLElement>('[role=\"menuitem\"]') ?? [],\n );\n }\n\n private focusItem(index: number): void {\n const items = this.getMenuItems();\n items[index]?.focus();\n }\n\n private restoreFocus(): void {\n if (this.previouslyFocused instanceof HTMLElement) {\n this.previouslyFocused.focus();\n }\n this.previouslyFocused = null;\n }\n}\n","<div\n #contextMenu\n class=\"context-menu\"\n [style.left.px]=\"clampedPos().left\"\n [style.top.px]=\"clampedPos().top\"\n role=\"menu\"\n [attr.aria-label]=\"'shell.context_menu' | translate\">\n\n @for (section of sections(); track $index) {\n @if ($index > 0) {\n <div class=\"menu-divider\"></div>\n }\n @if (section.label) {\n <div class=\"menu-section-label\">{{ section.label }}</div>\n }\n @for (item of section.items; track item.id) {\n <button\n type=\"button\"\n class=\"vos-btn sm rect menu-item\"\n role=\"menuitem\"\n (click)=\"onAction(item.id)\">\n <i [class]=\"'pi ' + item.icon\" aria-hidden=\"true\"></i>\n <span>{{ item.label }}</span>\n </button>\n }\n }\n</div>\n","import { Injectable, inject, signal } from '@angular/core';\nimport { I18nService } from '../../services/i18n.service';\n\nexport enum MessageBoxButtons {\n OK,\n OKCancel,\n YesNo,\n YesNoCancel,\n RetryCancel,\n AbortRetryIgnore,\n}\n\nexport enum MessageBoxIcon {\n None,\n Information,\n Warning,\n Error,\n Question,\n}\n\nexport enum DialogResult {\n None,\n OK,\n Cancel,\n Yes,\n No,\n Retry,\n Abort,\n Ignore,\n}\n\nexport interface MessageBoxOptions {\n title: string;\n message: string;\n buttons?: MessageBoxButtons;\n icon?: MessageBoxIcon;\n}\n\n/**\n * Configuration for the \"Don't ask again\" checkbox rendered by\n * `showAcknowledged()`. The field is intentionally NOT part of the base\n * `MessageBoxOptions` so the type system enforces the rule\n * \"checkbox ⇒ caller MUST use `showAcknowledged()`\": the classic `show()`\n * entry point cannot accept this shape, eliminating the silent-discard\n * dark-pattern path where the user's choice was thrown away.\n */\nexport interface MessageBoxDontAskAgainConfig {\n /** i18n key for the checkbox label, e.g. 'agent.command.builtin.clear.dont_ask_again'. */\n labelKey: string;\n /** Initial checked state. Default false. */\n defaultChecked?: boolean;\n}\n\n/**\n * Options narrowed to those carrying a `dontAskAgain` config — the only shape\n * accepted by `showAcknowledged()`.\n */\nexport interface MessageBoxOptionsWithAcknowledgement extends MessageBoxOptions {\n dontAskAgain: MessageBoxDontAskAgainConfig;\n}\n\nexport interface MessageBoxButton {\n label: string;\n result: DialogResult;\n variant?: 'primary' | 'danger' | 'default';\n}\n\n/** Shape returned by `showAcknowledged()` — pairs the dialog result with the checkbox state. */\nexport interface DialogResultWithAcknowledgement {\n readonly result: DialogResult;\n readonly dontAskAgain: boolean;\n}\n\n@Injectable({ providedIn: 'root' })\nexport class MessageBoxService {\n private readonly i18n = inject(I18nService);\n\n readonly visible = signal(false);\n readonly title = signal('');\n readonly message = signal('');\n readonly icon = signal<MessageBoxIcon>(MessageBoxIcon.None);\n readonly buttons = signal<MessageBoxButton[]>([]);\n /**\n * Active \"Don't ask again\" config — populated only by `showAcknowledged()`.\n * `show()` callers cannot reach this signal because the type system rejects\n * `dontAskAgain` on the base `MessageBoxOptions`.\n */\n readonly dontAskAgain = signal<MessageBoxDontAskAgainConfig | undefined>(undefined);\n\n /**\n * Component-side checkbox state. The component (`MessageBoxComponent`) wires\n * its own signal to this one; the service explicitly re-seeds it on every\n * `_open()` so reusing a constant `options` literal across two opens does\n * NOT leak the previous user's checkbox state through signal `===` dedupe.\n * Exposed for the component to read/write; not for general callers.\n */\n readonly dontAskAgainChecked = signal(false);\n\n private resolver: ((value: DialogResultWithAcknowledgement) => void) | null = null;\n\n show(options: MessageBoxOptions): Promise<DialogResult> {\n return this._open(options).then((r) => r.result);\n }\n\n /**\n * Opens a message box with a \"Don't ask again\" checkbox and resolves to both\n * the dialog result and the checkbox state. Throws when `options.dontAskAgain`\n * is missing — the checkbox config is mandatory for this entry point. The\n * compile-time signature already guarantees presence; the runtime check is\n * defense-in-depth for callers that bypass the type system via `as never`.\n */\n showAcknowledged(\n options: MessageBoxOptionsWithAcknowledgement,\n ): Promise<DialogResultWithAcknowledgement> {\n if (!options.dontAskAgain) {\n throw new Error(\n 'MessageBoxService.showAcknowledged() requires options.dontAskAgain — use show() for plain dialogs.',\n );\n }\n return this._open(options);\n }\n\n resolve(result: DialogResult, dontAskAgain = false): void {\n this.visible.set(false);\n if (this.resolver) {\n this.resolver({ result, dontAskAgain });\n this.resolver = null;\n }\n }\n\n private _open(\n options: MessageBoxOptions | MessageBoxOptionsWithAcknowledgement,\n ): Promise<DialogResultWithAcknowledgement> {\n // Dismiss any pending dialog so its Promise resolves rather than leaking.\n if (this.resolver) {\n this.resolver({ result: DialogResult.None, dontAskAgain: false });\n this.resolver = null;\n }\n\n const daa =\n 'dontAskAgain' in options ? options.dontAskAgain : undefined;\n\n this.title.set(options.title);\n this.message.set(options.message);\n this.icon.set(options.icon ?? MessageBoxIcon.None);\n this.buttons.set(this.resolveButtons(options.buttons ?? MessageBoxButtons.OK));\n this.dontAskAgain.set(daa);\n // Explicit re-seed: signal `set` dedupes by `===`, so an `effect()` on\n // `dontAskAgain` would not re-fire when a caller passes the SAME options\n // literal twice. Set the checkbox state directly each open.\n this.dontAskAgainChecked.set(daa?.defaultChecked ?? false);\n this.visible.set(true);\n\n return new Promise<DialogResultWithAcknowledgement>((resolve) => {\n this.resolver = resolve;\n });\n }\n\n private resolveButtons(buttons: MessageBoxButtons): MessageBoxButton[] {\n const t = (key: string) => this.i18n.t(key);\n switch (buttons) {\n case MessageBoxButtons.OK:\n return [{ label: t('common.ok'), result: DialogResult.OK, variant: 'primary' }];\n\n case MessageBoxButtons.OKCancel:\n return [\n { label: t('common.cancel'), result: DialogResult.Cancel, variant: 'default' },\n { label: t('common.ok'), result: DialogResult.OK, variant: 'primary' },\n ];\n\n case MessageBoxButtons.YesNo:\n return [\n { label: t('common.no'), result: DialogResult.No, variant: 'default' },\n { label: t('common.yes'), result: DialogResult.Yes, variant: 'primary' },\n ];\n\n case MessageBoxButtons.YesNoCancel:\n return [\n { label: t('common.cancel'), result: DialogResult.Cancel, variant: 'default' },\n { label: t('common.no'), result: DialogResult.No, variant: 'default' },\n { label: t('common.yes'), result: DialogResult.Yes, variant: 'primary' },\n ];\n\n case MessageBoxButtons.RetryCancel:\n return [\n { label: t('common.cancel'), result: DialogResult.Cancel, variant: 'default' },\n { label: t('common.retry'), result: DialogResult.Retry, variant: 'primary' },\n ];\n\n case MessageBoxButtons.AbortRetryIgnore:\n return [\n { label: t('common.abort'), result: DialogResult.Abort, variant: 'danger' },\n { label: t('common.retry'), result: DialogResult.Retry, variant: 'default' },\n { label: t('common.ignore'), result: DialogResult.Ignore, variant: 'default' },\n ];\n }\n }\n}\n","import {\n Component, inject, ChangeDetectionStrategy,\n HostListener, ElementRef, AfterViewInit, computed,\n} from '@angular/core';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\nimport { MessageBoxService, MessageBoxIcon, DialogResult } from './message-box.service';\n\n@Component({\n selector: 'fly-message-box',\n standalone: true,\n imports: [TranslatePipe],\n templateUrl: './message-box.component.html',\n styleUrl: './message-box.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class MessageBoxComponent implements AfterViewInit {\n service = inject(MessageBoxService);\n private elRef = inject(ElementRef);\n\n readonly MessageBoxIcon = MessageBoxIcon;\n readonly DialogResult = DialogResult;\n\n /** Mirror of the service's `dontAskAgain` config so the template can read it directly. */\n readonly dontAskAgainConfig = computed(() => this.service.dontAskAgain());\n /**\n * User-driven checkbox state, owned by the service and re-seeded on every\n * `_open()` so reusing a constant options literal cannot leak prior state.\n */\n readonly dontAskAgainChecked = this.service.dontAskAgainChecked;\n /**\n * Concatenated id list for the dialog's `aria-describedby`. Always includes\n * the message; appends the checkbox label id when the checkbox is rendered\n * so screen readers announce the checkbox as part of the description.\n */\n readonly ariaDescribedBy = computed(() =>\n this.dontAskAgainConfig() ? 'mb-message mb-dont-ask' : 'mb-message',\n );\n\n private previouslyFocused: Element | null = null;\n\n ngAfterViewInit(): void {\n // Store focus origin so we can restore it on close\n this.previouslyFocused = document.activeElement;\n this.focusPrimaryButton();\n }\n\n @HostListener('document:keydown.escape')\n onEscape(): void {\n if (this.service.visible()) {\n this.service.resolve(DialogResult.Cancel, this.dontAskAgainChecked());\n this.restoreFocus();\n }\n }\n\n onBackdropClick(): void {\n this.service.resolve(DialogResult.Cancel, this.dontAskAgainChecked());\n this.restoreFocus();\n }\n\n onButtonClick(result: DialogResult): void {\n this.service.resolve(result, this.dontAskAgainChecked());\n this.restoreFocus();\n }\n\n onDontAskAgainToggle(ev: Event): void {\n const target = ev.target as HTMLInputElement | null;\n this.dontAskAgainChecked.set(!!target?.checked);\n }\n\n iconClass(): string {\n switch (this.service.icon()) {\n case MessageBoxIcon.Information: return 'pi pi-info-circle';\n case MessageBoxIcon.Warning: return 'pi pi-exclamation-triangle';\n case MessageBoxIcon.Error: return 'pi pi-times-circle';\n case MessageBoxIcon.Question: return 'pi pi-question-circle';\n default: return '';\n }\n }\n\n private focusPrimaryButton(): void {\n // Focus the primary (last) button, which is the default action\n const buttons = this.elRef.nativeElement.querySelectorAll('.mb-btn') as NodeListOf<HTMLButtonElement>;\n const last = buttons[buttons.length - 1];\n last?.focus();\n }\n\n private restoreFocus(): void {\n if (this.previouslyFocused instanceof HTMLElement) {\n this.previouslyFocused.focus();\n }\n this.previouslyFocused = null;\n }\n}\n","@if (service.visible()) {\n <div\n class=\"mb-backdrop\"\n (click)=\"onBackdropClick()\"\n role=\"presentation\">\n <div\n class=\"mb-dialog\"\n [class.mb-info]=\"service.icon() === MessageBoxIcon.Information\"\n [class.mb-warning]=\"service.icon() === MessageBoxIcon.Warning\"\n [class.mb-danger]=\"service.icon() === MessageBoxIcon.Error\"\n [class.mb-question]=\"service.icon() === MessageBoxIcon.Question\"\n (click)=\"$event.stopPropagation()\"\n role=\"alertdialog\"\n aria-modal=\"true\"\n aria-labelledby=\"mb-title\"\n [attr.aria-describedby]=\"ariaDescribedBy()\">\n\n @if (iconClass()) {\n <div class=\"mb-icon-wrap\">\n <i [class]=\"iconClass() + ' mb-icon'\" aria-hidden=\"true\"></i>\n </div>\n }\n\n <div class=\"mb-title\" id=\"mb-title\">{{ service.title() }}</div>\n <div class=\"mb-message\" id=\"mb-message\">{{ service.message() }}</div>\n\n @if (dontAskAgainConfig(); as daa) {\n <label class=\"mb-dont-ask-again\">\n <input\n type=\"checkbox\"\n [checked]=\"dontAskAgainChecked()\"\n (change)=\"onDontAskAgainToggle($event)\" />\n <span id=\"mb-dont-ask\">{{ daa.labelKey | translate }}</span>\n </label>\n }\n\n <div class=\"mb-actions\">\n @for (btn of service.buttons(); track btn.result) {\n <button\n type=\"button\"\n class=\"vos-btn sm mb-btn\"\n [class.mb-btn--primary]=\"btn.variant === 'primary'\"\n [class.mb-btn--danger]=\"btn.variant === 'danger'\"\n (click)=\"onButtonClick(btn.result)\">\n {{ btn.label }}\n </button>\n }\n </div>\n\n </div>\n </div>\n}\n","import {\n Component,\n Input,\n Output,\n EventEmitter,\n signal,\n inject,\n OnInit,\n DestroyRef,\n ChangeDetectionStrategy,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { FormsModule } from '@angular/forms';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Observable, ReplaySubject } from 'rxjs';\nimport { switchMap } from 'rxjs/operators';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\nimport { I18nService } from '../../services/i18n.service';\nimport type {\n ShareOrgChartOption,\n ShareOuNode,\n SharePanelLevelOption,\n SharePermissionEntry,\n SharePrincipal,\n ShareUserResult,\n} from '../../models/share-panel.model';\n\n/** Default permission levels (file-style ACL). Hosts can override via `permissionLevels`. */\nexport const SHARE_PANEL_DEFAULT_FILE_LEVELS: SharePanelLevelOption[] = [\n { value: 'View', labelKey: 'files.share.level_view' },\n { value: 'Download', labelKey: 'files.share.level_download' },\n { value: 'Edit', labelKey: 'files.share.level_edit' },\n { value: 'FullControl', labelKey: 'files.share.level_full' },\n];\n\n@Component({\n selector: 'fly-share-panel',\n standalone: true,\n imports: [CommonModule, FormsModule, TranslatePipe],\n templateUrl: './share-panel.component.html',\n styleUrl: './share-panel.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class SharePanelComponent implements OnInit {\n /** Resource title shown in the header */\n @Input() targetName = '';\n\n /** i18n key for panel title */\n @Input() titleKey = 'files.share.title';\n\n /** Load current shares / permissions (host resolves display names when possible). */\n @Input({ required: true }) loadPermissions!: () => Observable<SharePermissionEntry[]>;\n\n @Input({ required: true }) searchUsers!: (query: string) => Observable<ShareUserResult[]>;\n\n /**\n * Load OU hierarchy for sharing. `chartId` is null for the default/official tree;\n * non-null for an alternative chart.\n */\n @Input({ required: true })\n loadOuTree!: (chartId: string | null) => Observable<ShareOuNode[]>;\n\n /** Chart selector options; first entry should be the default chart (`id: null`). */\n @Input({ required: true }) loadChartOptions!: () => Observable<ShareOrgChartOption[]>;\n\n /**\n * Initial chart selection. Resolution order:\n * <list type=\"number\">\n * <item>{@link defaultChartId} when explicitly provided (string or null).</item>\n * <item>First option matching {@link defaultChartSystemKey} (e.g. <c>'apps'</c>).</item>\n * <item>Host order — <c>options[0]?.id ?? null</c>.</item>\n * </list>\n */\n @Input() defaultChartSystemKey?: string | null;\n\n /** Hard-coded chart id to pre-select. Takes priority over {@link defaultChartSystemKey}. */\n @Input() defaultChartId?: string | null;\n\n /**\n * Labels from the default (official) OU tree for stable display names on OU grants\n * when the picker shows an alternative chart.\n */\n @Input({ required: true }) loadOuLabelMap!: () => Observable<Record<string, string>>;\n\n @Input({ required: true })\n grantToUser!: (userId: string, level: string, applyToChildren: boolean, isDeny: boolean) => Observable<void>;\n\n @Input({ required: true })\n grantToOu!: (ouId: string, level: string, applyToChildren: boolean, isDeny: boolean) => Observable<void>;\n\n @Input({ required: true }) updatePermission!: (id: string, level: string) => Observable<void>;\n\n @Input({ required: true }) revokePermission!: (id: string) => Observable<void>;\n\n /** When true, show “apply to children” (e.g. folders). */\n @Input() showApplyToChildren = false;\n\n /**\n * When true, surfaces an \"Add as deny\" toggle in the add-permission row and renders\n * existing deny grants with red styling. Hosts whose backend does not support deny\n * grants (legacy callers) leave this false and the panel hides all deny affordances.\n */\n @Input() supportsDeny = false;\n\n /** Override level dropdown options (e.g. notes: View / Edit only). */\n @Input() permissionLevels?: SharePanelLevelOption[];\n\n /** i18n key for wildcard app grant label */\n @Input() everyoneLabelKey = 'files.share.everyone';\n\n /**\n * Optional apps-chart role-OU index for the tenant. When supplied, the panel:\n * <list type=\"bullet\">\n * <item>Renders existing OU grants whose ouId matches a row as <c>RolePrincipal</c>\n * chips (\"FFO in Circles\") instead of opaque OU labels.</item>\n * <item>Surfaces an \"Add role\" picker that translates the picked role to its\n * role-OU UUID and dispatches via {@link grantToOu}. Backend stores it as a\n * plain OU grant; <see cref=\"PermissionResolver\"/> resolves at access time via\n * the user's effective OU set.</item>\n * </list>\n * Hosts that don't have access to the apps-chart (or don't want the role flow) omit\n * this input — OU grants then render as generic OU principals.\n */\n @Input() loadRoleOus?: () => Observable<RoleOuLookupRow[]>;\n\n @Output() close = new EventEmitter<void>();\n\n private destroyRef = inject(DestroyRef);\n private i18n = inject(I18nService);\n\n permissions = signal<SharePermissionEntry[]>([]);\n loading = signal(true);\n searchQuery = '';\n newLevel = '';\n applyToChildren = false;\n\n /** Apps-chart role-OU index, populated lazily when {@link loadRoleOus} is provided. */\n roleOus = signal<RoleOuLookupRow[]>([]);\n /** Map<ouId, role row> — derived from roleOus for O(1) lookup during rendering. */\n private readonly roleOusByOuId = signal<Record<string, RoleOuLookupRow>>({});\n\n /** Two-way bound to the role picker's filter input. */\n roleSearchQuery = '';\n /** True while the role picker section is expanded. */\n showRolePicker = signal(false);\n /**\n * Two-way bound to the \"Add as deny\" toggle. When true, the next user/OU pick is\n * persisted as a deny grant. Reset to false after each successful grant so the next\n * pick defaults back to allow.\n */\n addAsDeny = false;\n searchResults = signal<ShareUserResult[]>([]);\n ouTree = signal<ShareOuNode[]>([]);\n showOuPicker = signal(false);\n chartOptions = signal<ShareOrgChartOption[]>([]);\n selectedOrgChartId = signal<string | null>(null);\n /** Default-tree id → display name for permission rows (OU grants). */\n private readonly ouLabelById = signal<Record<string, string>>({});\n\n private searchTimeout: ReturnType<typeof setTimeout> | null = null;\n /** Emits after chart options load; further emissions on user chart changes (no initial null). */\n private readonly selectedChartId$ = new ReplaySubject<string | null>(1);\n\n ngOnInit(): void {\n const levels = this.levelOptions;\n this.newLevel = levels[0]?.value ?? 'View';\n this.refreshPermissions();\n\n // Load the role-OU lookup table once. Failures degrade gracefully — OU grants then\n // render as generic OU principals (the v1 behaviour) instead of Role chips.\n this.loadRoleOus?.()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (rows) => {\n this.roleOus.set(rows);\n const byId: Record<string, RoleOuLookupRow> = {};\n for (const r of rows) byId[r.ouId] = r;\n this.roleOusByOuId.set(byId);\n },\n error: () => {\n this.roleOus.set([]);\n this.roleOusByOuId.set({});\n },\n });\n\n this.loadOuLabelMap()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (m) => this.ouLabelById.set(m),\n error: () => this.ouLabelById.set({}),\n });\n\n this.selectedChartId$\n .pipe(\n switchMap((id) => this.loadOuTree(id)),\n takeUntilDestroyed(this.destroyRef),\n )\n .subscribe({\n next: (tree) => this.ouTree.set(tree),\n error: () => this.ouTree.set([]),\n });\n\n this.loadChartOptions()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (opts) => {\n this.chartOptions.set(opts);\n const initial = this.resolveInitialChartId(opts);\n this.selectedOrgChartId.set(initial);\n this.selectedChartId$.next(initial);\n },\n error: () => {\n this.chartOptions.set([]);\n this.selectedOrgChartId.set(null);\n this.selectedChartId$.next(null);\n },\n });\n }\n\n /**\n * Picks the chart id to seed the OU picker with. Honours explicit\n * {@link defaultChartId} first (null is a valid id), then {@link defaultChartSystemKey},\n * then falls back to host order.\n */\n private resolveInitialChartId(opts: ShareOrgChartOption[]): string | null {\n if (this.defaultChartId !== undefined) {\n const exists = opts.some((o) => o.id === this.defaultChartId);\n return exists ? (this.defaultChartId as string | null) : (opts[0]?.id ?? null);\n }\n const key = this.defaultChartSystemKey;\n if (key) {\n const match = opts.find((o) => o.systemKey === key);\n if (match) return match.id;\n }\n return opts[0]?.id ?? null;\n }\n\n onOrgChartSelectChange(chartId: string | null): void {\n this.selectedOrgChartId.set(chartId);\n this.selectedChartId$.next(chartId);\n }\n\n get levelOptions(): SharePanelLevelOption[] {\n const p = this.permissionLevels;\n return p && p.length > 0 ? p : SHARE_PANEL_DEFAULT_FILE_LEVELS;\n }\n\n refreshPermissions(): void {\n this.loading.set(true);\n this.loadPermissions()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (perms) => {\n this.permissions.set(perms);\n this.loading.set(false);\n },\n error: () => {\n this.permissions.set([]);\n this.loading.set(false);\n },\n });\n }\n\n onSearchInput(): void {\n if (this.searchTimeout) clearTimeout(this.searchTimeout);\n const query = this.searchQuery.trim();\n if (query.length < 2) {\n this.searchResults.set([]);\n return;\n }\n\n this.searchTimeout = setTimeout(() => {\n this.searchUsers(query)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (items) => this.searchResults.set(items),\n error: () => this.searchResults.set([]),\n });\n }, 300);\n }\n\n onGrantToUser(user: ShareUserResult): void {\n this.searchResults.set([]);\n this.searchQuery = '';\n const isDeny = this.supportsDeny && this.addAsDeny;\n this.grantToUser(user.id, this.newLevel, this.applyToChildren, isDeny)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: () => {\n // Reset deny toggle after each successful grant so allow is the default for the\n // next pick. Preserves the level dropdown which is genuinely sticky.\n this.addAsDeny = false;\n this.refreshPermissions();\n },\n });\n }\n\n onGrantToOu(ou: ShareOuNode): void {\n const isDeny = this.supportsDeny && this.addAsDeny;\n this.grantToOu(ou.id, this.newLevel, this.applyToChildren, isDeny)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: () => {\n this.addAsDeny = false;\n this.refreshPermissions();\n },\n });\n }\n\n /**\n * Add a role grant. Resolves to the role-OU UUID and dispatches via {@link grantToOu}\n * so the backend stores it as a plain OU grant; PermissionResolver matches it at access\n * time via the user's effective OU set (apps-chart computed-from-role membership).\n */\n onGrantToRole(role: RoleOuLookupRow): void {\n const isDeny = this.supportsDeny && this.addAsDeny;\n this.grantToOu(role.ouId, this.newLevel, this.applyToChildren, isDeny)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: () => {\n this.addAsDeny = false;\n this.roleSearchQuery = '';\n this.refreshPermissions();\n },\n });\n }\n\n /** Filtered role list — empty query returns all roles, otherwise case-insensitive substring match. */\n filteredRoles(): RoleOuLookupRow[] {\n const q = this.roleSearchQuery.trim().toLowerCase();\n const all = this.roleOus();\n if (!q) return all;\n return all.filter(\n (r) =>\n r.displayName.toLowerCase().includes(q)\n || r.roleKey.toLowerCase().includes(q)\n || r.appId.toLowerCase().includes(q),\n );\n }\n\n onUpdateLevel(perm: SharePermissionEntry, level: string): void {\n this.updatePermission(perm.id, level)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({ next: () => this.refreshPermissions() });\n }\n\n onRevokePermission(perm: SharePermissionEntry): void {\n this.revokePermission(perm.id)\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({ next: () => this.refreshPermissions() });\n }\n\n getPermIcon(perm: SharePermissionEntry): string {\n // Deny rows take a distinct icon regardless of principal kind so the operator can\n // scan a long permission list and immediately spot revocations.\n if (perm.isDeny) return 'pi pi-ban';\n // Reverse-translate: an OuPrincipal whose ouId matches a known role-OU should render\n // as a role chip, even though the host stored it as an OU grant.\n if (perm.principal.kind === 'ou' && this.roleOusByOuId()[perm.principal.ouId]) {\n return 'pi pi-id-card';\n }\n return SharePanelComponent.principalIcon(perm.principal);\n }\n\n /** Maps a principal kind to its display icon. Static so hosts can reuse for menus. */\n static principalIcon(principal: SharePrincipal): string {\n switch (principal.kind) {\n case 'user': return 'pi pi-user';\n case 'role': return 'pi pi-id-card';\n case 'ou': return 'pi pi-sitemap';\n case 'app-everyone': return 'pi pi-globe';\n }\n }\n\n /** Logical start padding for OU hierarchy (roots align with section padding). */\n ouIndentStartPx(ou: ShareOuNode): number {\n const d = ou.depth ?? 0;\n return 12 + d * 18;\n }\n\n getPermLabel(perm: SharePermissionEntry): string {\n const p = perm.principal;\n if (p.displayName?.trim()) return p.displayName.trim();\n switch (p.kind) {\n case 'user':\n return `${p.userId.substring(0, 8)}…`;\n case 'role':\n // Hosts SHOULD pre-resolve role display names — this branch is the\n // worst-case fallback for an unresolved key.\n return `${p.appId}:${p.roleKey}`;\n case 'ou': {\n // Reverse-translate: if this OU id matches a known apps-chart role-OU, render\n // as the semantic role label instead of the opaque OU name.\n const role = this.roleOusByOuId()[p.ouId];\n if (role) return role.displayName;\n\n const fromDefault = this.ouLabelById()[p.ouId];\n if (fromDefault) return fromDefault;\n const ou = this.ouTree().find((o) => o.id === p.ouId);\n if (ou) return ou.displayName;\n return `${p.ouId.substring(0, 8)}…`;\n }\n case 'app-everyone':\n return p.appId === '*' ? this.i18n.t(this.everyoneLabelKey) : p.appId;\n }\n }\n}\n\n/**\n * One row in the role-OU lookup table the share panel uses to render OU grants as Role\n * chips and to drive the \"Add role\" picker. Hosts source this from\n * <c>OrgStructureApiService.listRoleOus()</c> in the desktop shell.\n */\nexport interface RoleOuLookupRow {\n /** Apps-chart role-OU UUID — what backend stores in `grantedToOuId` / `sharedWithOuId`. */\n ouId: string;\n appId: string;\n roleKey: string;\n /** Display name resolved by the host (e.g. \"FFO\" or \"Future Foresight Officer\"). */\n displayName: string;\n}\n","<div class=\"fac-overlay\" (click)=\"close.emit()\">\n <div class=\"fac-panel\" (click)=\"$event.stopPropagation()\">\n <div class=\"fac-header\">\n <h3>{{ titleKey | translate }}</h3>\n <span class=\"fac-target-name\">{{ targetName }}</span>\n <button\n type=\"button\"\n class=\"fac-close\"\n (click)=\"close.emit()\"\n [attr.aria-label]=\"'files.share.close' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n\n <div class=\"fac-add-section\">\n <div class=\"fac-search-row\">\n <input\n type=\"text\"\n class=\"fac-input\"\n [(ngModel)]=\"searchQuery\"\n (input)=\"onSearchInput()\"\n [placeholder]=\"'files.share.search_placeholder' | translate\"\n [attr.aria-label]=\"'files.share.search_users' | translate\"\n />\n <select class=\"fac-select\" [(ngModel)]=\"newLevel\">\n @for (opt of levelOptions; track opt.value) {\n <option [value]=\"opt.value\">{{ opt.labelKey | translate }}</option>\n }\n </select>\n </div>\n\n @if (searchResults().length > 0) {\n <div class=\"fac-search-results\">\n @for (result of searchResults(); track result.id) {\n <div class=\"fac-search-item\" (click)=\"onGrantToUser(result)\">\n <i class=\"pi pi-user\" aria-hidden=\"true\"></i>\n <span>{{ result.firstName }} {{ result.lastName }}</span>\n <span class=\"fac-email\">{{ result.email }}</span>\n </div>\n }\n </div>\n }\n\n @if (chartOptions().length > 0) {\n <div class=\"fac-chart-row\">\n <label for=\"fac-org-chart-select\" class=\"fac-section-label\">{{\n 'files.share.org_chart' | translate\n }}</label>\n <select\n id=\"fac-org-chart-select\"\n class=\"fac-select\"\n [ngModel]=\"selectedOrgChartId()\"\n (ngModelChange)=\"onOrgChartSelectChange($event)\">\n @for (opt of chartOptions(); track $index) {\n <option [ngValue]=\"opt.id\">{{ opt.name }}</option>\n }\n </select>\n </div>\n }\n\n @if (showOuPicker()) {\n <div class=\"fac-ou-section\">\n <div class=\"fac-section-label\">{{ 'files.share.share_with_ou' | translate }}</div>\n @for (ou of ouTree(); track ou.id) {\n <button\n type=\"button\"\n class=\"fac-ou-item\"\n [style.padding-inline-start.px]=\"ouIndentStartPx(ou)\"\n (click)=\"onGrantToOu(ou)\"\n [attr.aria-label]=\"('files.share.share_with_ou_named' | translate) + ' ' + ou.displayName\"\n >\n <i class=\"pi pi-sitemap\" aria-hidden=\"true\"></i>\n <span dir=\"auto\">{{ ou.displayName }}</span>\n </button>\n }\n </div>\n }\n\n @if (loadRoleOus && roleOus().length > 0) {\n <div class=\"fac-role-section\">\n <div class=\"fac-section-label\">{{ 'files.share.share_with_role' | translate }}</div>\n <input\n type=\"text\"\n class=\"fac-input\"\n [(ngModel)]=\"roleSearchQuery\"\n [placeholder]=\"'files.share.role_search_placeholder' | translate\"\n [attr.aria-label]=\"'files.share.search_roles' | translate\"\n [hidden]=\"!showRolePicker()\" />\n @if (showRolePicker()) {\n <div class=\"fac-role-list\">\n @for (role of filteredRoles(); track role.ouId) {\n <button\n type=\"button\"\n class=\"fac-role-item\"\n (click)=\"onGrantToRole(role)\"\n [attr.aria-label]=\"('files.share.share_with_role_named' | translate) + ' ' + role.displayName\">\n <i class=\"pi pi-id-card\" aria-hidden=\"true\"></i>\n <span dir=\"auto\">{{ role.displayName }}</span>\n <span class=\"fac-role-app\">{{ role.appId }}</span>\n </button>\n }\n @if (filteredRoles().length === 0) {\n <div class=\"fac-empty\">{{ 'files.share.no_roles_match' | translate }}</div>\n }\n </div>\n }\n </div>\n }\n\n <div class=\"fac-toggle-row\">\n <button type=\"button\" class=\"fac-link\" (click)=\"showOuPicker.set(!showOuPicker())\">\n {{ showOuPicker() ? ('files.share.hide_ous' | translate) : ('files.share.show_ous' | translate) }}\n </button>\n @if (loadRoleOus && roleOus().length > 0) {\n <button type=\"button\" class=\"fac-link\" (click)=\"showRolePicker.set(!showRolePicker())\">\n {{ showRolePicker() ? ('files.share.hide_roles' | translate) : ('files.share.show_roles' | translate) }}\n </button>\n }\n @if (showApplyToChildren) {\n <label class=\"fac-checkbox-label\">\n <input type=\"checkbox\" [(ngModel)]=\"applyToChildren\" />\n {{ 'files.share.apply_children' | translate }}\n </label>\n }\n @if (supportsDeny) {\n <label class=\"fac-checkbox-label fac-deny-toggle\"\n [title]=\"'files.share.deny_help' | translate\">\n <input type=\"checkbox\" [(ngModel)]=\"addAsDeny\" />\n <i class=\"pi pi-ban\" aria-hidden=\"true\"></i>\n {{ 'files.share.add_as_deny' | translate }}\n </label>\n }\n </div>\n </div>\n\n <div class=\"fac-perms-section\">\n <div class=\"fac-section-label\">{{ 'files.share.current_permissions' | translate }}</div>\n @if (loading()) {\n <div class=\"fac-loading\"><i class=\"pi pi-spin pi-spinner\" aria-hidden=\"true\"></i></div>\n } @else if (permissions().length === 0) {\n <div class=\"fac-empty\">{{ 'files.share.no_permissions' | translate }}</div>\n } @else {\n @for (perm of permissions(); track perm.id) {\n <div class=\"fac-perm-row\" [class.fac-perm-row-deny]=\"perm.isDeny\">\n <div class=\"fac-perm-info\">\n <i [class]=\"getPermIcon(perm)\" aria-hidden=\"true\"></i>\n <span class=\"fac-perm-name\" dir=\"auto\">{{ getPermLabel(perm) }}</span>\n @if (perm.isDeny) {\n <span class=\"fac-badge deny\">{{ 'files.share.denied' | translate }}</span>\n }\n @if (perm.isInherited) {\n <span class=\"fac-badge inherited\">{{ 'files.share.inherited' | translate }}</span>\n }\n </div>\n <div class=\"fac-perm-actions\">\n @if (!perm.isDeny) {\n <select\n class=\"fac-select sm\"\n [ngModel]=\"perm.level\"\n (ngModelChange)=\"onUpdateLevel(perm, $event)\"\n [disabled]=\"perm.isInherited === true\"\n >\n @for (opt of levelOptions; track opt.value) {\n <option [value]=\"opt.value\">{{ opt.labelKey | translate }}</option>\n }\n </select>\n }\n <button\n type=\"button\"\n class=\"fac-icon-btn danger\"\n (click)=\"onRevokePermission(perm)\"\n [disabled]=\"perm.isInherited === true\"\n [title]=\"'files.share.revoke' | translate\"\n >\n <i class=\"pi pi-trash\" aria-hidden=\"true\"></i>\n </button>\n </div>\n </div>\n }\n }\n </div>\n </div>\n</div>\n","import {\n ChangeDetectionStrategy,\n Component,\n computed,\n DestroyRef,\n EventEmitter,\n forwardRef,\n inject,\n Input,\n OnChanges,\n OnDestroy,\n OnInit,\n Output,\n signal,\n SimpleChanges,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport {\n ControlValueAccessor,\n FormsModule,\n NG_VALIDATORS,\n NG_VALUE_ACCESSOR,\n Validator,\n ValidatorFn,\n AbstractControl,\n ValidationErrors,\n} from '@angular/forms';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { Observable, ReplaySubject, Subject } from 'rxjs';\nimport { debounceTime, distinctUntilChanged, filter, switchMap } from 'rxjs/operators';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\nimport { I18nService } from '../../services/i18n.service';\nimport {\n AppEveryoneTerm,\n AudienceFilter,\n AudienceTerm,\n AudienceTermKind,\n AUDIENCE_LIMITS,\n AUDIENCE_PRESETS,\n AudiencePresetKind,\n ChartTerm,\n OuTerm,\n PresetTerm,\n RolesTerm,\n UsersTerm,\n} from '../../models/audience.model';\nimport type {\n ShareOrgChartOption,\n ShareOuNode,\n ShareUserResult,\n} from '../../models/share-panel.model';\nimport type { RoleOuLookupRow } from '../share-panel/share-panel.component';\n\n/** Bucket the picker is currently editing. Exported so hosts can drive `editTarget` if needed. */\nexport type AudienceEditTarget = 'includes' | 'excludes';\n\n/**\n * Strongly-typed context for the term-card `<ng-template>`. Without an explicit interface\n * the template's `let-term` falls back to `any`, defeating the discriminated-union narrowing\n * inside `@switch (term.kind)`. The `track` expression on the parent `@for` reads\n * `target` and `index` through this same context shape.\n */\ninterface TermCardContext {\n $implicit: AudienceTerm;\n target: AudienceEditTarget;\n index: number;\n}\n\n/**\n * Generic builder for {@link AudienceFilter}. Accepts an initial value, emits both the\n * full filter and a validity flag on every change. Reuses the same callback shapes as\n * {@link SharePanelComponent} so a host already wiring the share panel can drop this in\n * with no extra plumbing.\n *\n * Compaction policy: when the operator picks the same kind multiple times, the component\n * merges into a single term where it's safe to do so:\n * <list type=\"bullet\">\n * <item><b>users</b>: dedupes user ids into one {@link UsersTerm}.</item>\n * <item><b>roles</b>: per `appId`, dedupes role keys into one {@link RolesTerm}.</item>\n * <item><b>ou</b>: per `(chartId, includeDescendants)`, dedupes OU ids into one {@link OuTerm}.</item>\n * <item><b>app-everyone / chart / preset</b>: idempotent per kind+key.</item>\n * </list>\n * This keeps the term count well below {@link AUDIENCE_LIMITS.maxTermsPerFilter} for typical\n * use, and matches how the backend resolver would have unioned them anyway.\n */\n@Component({\n selector: 'fly-audience-builder',\n standalone: true,\n imports: [CommonModule, FormsModule, TranslatePipe],\n templateUrl: './audience-builder.component.html',\n styleUrl: './audience-builder.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n {\n provide: NG_VALUE_ACCESSOR,\n useExisting: forwardRef(() => AudienceBuilderComponent),\n multi: true,\n },\n {\n provide: NG_VALIDATORS,\n useExisting: forwardRef(() => AudienceBuilderComponent),\n multi: true,\n },\n ],\n})\nexport class AudienceBuilderComponent\n implements OnInit, OnChanges, OnDestroy, ControlValueAccessor, Validator {\n /** Initial audience filter. Two-way: changes emit via {@link audienceChange}. */\n @Input() value: AudienceFilter | null | undefined = { includes: [] };\n\n /** Hide the Excludes section entirely (e.g. for simple \"send to\" pickers). */\n @Input() showExcludes = true;\n\n /**\n * Which term kinds are selectable. Defaults to all six. Hosts that don't have a\n * concept of `chart` or `preset` should narrow this down to keep the UI focused.\n */\n @Input() supportedKinds: readonly AudienceTermKind[] = [\n 'users',\n 'roles',\n 'ou',\n 'app-everyone',\n 'chart',\n 'preset',\n ];\n\n /**\n * Anchor user id used when adding a `preset` term. Typically `auth.currentUser().id`.\n * If null and the operator picks a preset, the term is rejected with an inline error.\n */\n @Input() selfUserId: string | null = null;\n\n /** App ids the host wants to expose as `app-everyone` options. */\n @Input() appEveryoneOptions: { appId: string; displayName: string }[] = [];\n\n // ── Picker callbacks (same shapes as SharePanelComponent) ────────────────────\n\n @Input({ required: true }) searchUsers!: (query: string) => Observable<ShareUserResult[]>;\n\n @Input({ required: true })\n loadOuTree!: (chartId: string | null) => Observable<ShareOuNode[]>;\n\n @Input({ required: true }) loadChartOptions!: () => Observable<ShareOrgChartOption[]>;\n\n /**\n * Initial chart selection for the OU picker. Resolution order:\n * <list type=\"number\">\n * <item>If <see cref=\"defaultChartId\"/> is explicitly provided (string or null), use it.</item>\n * <item>Else if <see cref=\"defaultChartSystemKey\"/> is set, pick the first option whose\n * <c>systemKey</c> matches (e.g. <c>'apps'</c> → the platform Apps chart).</item>\n * <item>Else fall back to <c>options[0]?.id ?? null</c> (host-defined default order).</item>\n * </list>\n * Hosts that already know the tenant-scoped chart Guid use {@link defaultChartId};\n * hosts that only know the semantic kind (typically <c>'apps'</c>) use\n * {@link defaultChartSystemKey}.\n */\n @Input() defaultChartSystemKey?: string | null;\n\n /**\n * Hard-coded chart id to pre-select. Takes priority over {@link defaultChartSystemKey}.\n * Use <c>null</c> to force the default/official chart (id null) even when other charts\n * are listed first.\n */\n @Input() defaultChartId?: string | null;\n\n /**\n * Optional apps-chart role-OU index. When supplied, the picker exposes a \"Roles\" tab\n * surfacing role chips; without it, that tab is hidden even if `'roles'` is in\n * {@link supportedKinds}.\n */\n @Input() loadRoleOus?: () => Observable<RoleOuLookupRow[]>;\n\n // ── Outputs ──────────────────────────────────────────────────────────────────\n\n /** Fires on every successful add/remove with the current filter. */\n @Output() audienceChange = new EventEmitter<AudienceFilter>();\n\n /**\n * True when {@link AudienceFilter.includes} is non-empty and the term count is within\n * {@link AUDIENCE_LIMITS.maxTermsPerFilter}. Hosts should disable submit when false.\n */\n @Output() validityChange = new EventEmitter<boolean>();\n\n // ── Internal state (signals; computed where derived) ─────────────────────────\n\n private readonly destroyRef = inject(DestroyRef);\n private readonly i18n = inject(I18nService);\n\n readonly includes = signal<AudienceTerm[]>([]);\n readonly excludes = signal<AudienceTerm[]>([]);\n\n readonly editTarget = signal<AudienceEditTarget>('includes');\n readonly pickerOpen = signal(false);\n readonly activeKind = signal<AudienceTermKind>('users');\n\n // User picker — signal-backed so OnPush + computed re-evaluates correctly. Keystrokes go\n // through a debounced Subject + switchMap so a slow \"fo\" result can never overwrite a\n // fresh \"foobar\" result (the previous setTimeout-based path had this race).\n readonly userSearchQuery = signal('');\n readonly userSearchResults = signal<ShareUserResult[]>([]);\n private readonly userSearch$ = new Subject<string>();\n\n // Role picker.\n readonly roleOus = signal<RoleOuLookupRow[]>([]);\n readonly roleSearchQuery = signal('');\n /**\n * Filtered role list as a `computed` so the template doesn't re-call a method on every\n * change-detection cycle.\n */\n readonly filteredRoles = computed<RoleOuLookupRow[]>(() => {\n const q = this.roleSearchQuery().trim().toLowerCase();\n const all = this.roleOus();\n if (!q) return all;\n return all.filter(\n (r) =>\n r.displayName.toLowerCase().includes(q)\n || r.roleKey.toLowerCase().includes(q)\n || r.appId.toLowerCase().includes(q),\n );\n });\n\n // OU picker.\n readonly ouTree = signal<ShareOuNode[]>([]);\n readonly chartOptions = signal<ShareOrgChartOption[]>([]);\n readonly selectedChartId = signal<string | null>(null);\n readonly ouIncludeDescendants = signal(false);\n /**\n * Chart-term picker entries — filters out the null-id default chart since `ChartTerm`\n * requires a real Guid. Avoids the UX trap where clicking \"Default Company\" surfaces\n * an inline error.\n */\n readonly chartTermOptions = computed<ShareOrgChartOption[]>(() =>\n this.chartOptions().filter((c) => c.id !== null),\n );\n private readonly selectedChartId$ = new ReplaySubject<string | null>(1);\n\n // Preset options exposed from the model so the template stays in sync with new presets.\n readonly presetOptions = AUDIENCE_PRESETS;\n\n // Validation surface (inline errors).\n readonly errorKey = signal<string | null>(null);\n\n /** True when the host disabled this control (template-driven `[disabled]` or reactive). */\n readonly disabled = signal(false);\n\n // ── ControlValueAccessor + Validator wiring ──────────────────────────────────\n // These let hosts bind the component via `formControl` / `formControlName` /\n // `[(ngModel)]` instead of plumbing `[value]` + `(audienceChange)` manually. The\n // (audienceChange) / (validityChange) outputs still fire — Angular forms infrastructure\n // is purely additive and template-driven hosts continue to work unchanged.\n private onChange: (value: AudienceFilter) => void = () => undefined;\n private onTouched: () => void = () => undefined;\n private onValidatorChange: () => void = () => undefined;\n\n // ── Lifecycle ────────────────────────────────────────────────────────────────\n\n ngOnInit(): void {\n // applyValue() seeds includes/excludes — defer the initial emit so we don't trigger\n // ExpressionChangedAfterItHasBeenChecked when a parent template binding observes\n // (audienceChange) / (validityChange) in the same change-detection cycle.\n this.applyValue(this.value, /* emitImmediate */ false);\n queueMicrotask(() => this.emitState());\n\n if (this.loadRoleOus) {\n this.loadRoleOus()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (rows) => this.roleOus.set(rows),\n error: () => this.roleOus.set([]),\n });\n }\n\n this.selectedChartId$\n .pipe(\n switchMap((id) => this.loadOuTree(id)),\n takeUntilDestroyed(this.destroyRef),\n )\n .subscribe({\n next: (tree) => this.ouTree.set(tree),\n error: () => this.ouTree.set([]),\n });\n\n // Debounced user search: 300ms idle → switchMap cancels any in-flight request when a\n // newer query arrives, killing the \"stale result overwrites fresh result\" race the old\n // setTimeout path had. `filter(q.length >= 2)` preserves the same UX gate.\n this.userSearch$\n .pipe(\n debounceTime(300),\n distinctUntilChanged(),\n filter((q) => q.length >= 2),\n switchMap((q) => this.searchUsers(q)),\n takeUntilDestroyed(this.destroyRef),\n )\n .subscribe({\n next: (items) => this.userSearchResults.set(items),\n error: () => this.userSearchResults.set([]),\n });\n\n this.loadChartOptions()\n .pipe(takeUntilDestroyed(this.destroyRef))\n .subscribe({\n next: (opts) => {\n this.chartOptions.set(opts);\n const initial = this.resolveInitialChartId(opts);\n this.selectedChartId.set(initial);\n this.selectedChartId$.next(initial);\n },\n error: () => {\n this.chartOptions.set([]);\n this.selectedChartId.set(null);\n this.selectedChartId$.next(null);\n },\n });\n\n if (this.supportedKinds.length > 0 && !this.supportedKinds.includes(this.activeKind())) {\n this.activeKind.set(this.supportedKinds[0]);\n }\n }\n\n ngOnChanges(changes: SimpleChanges): void {\n // Re-hydrate when the host swaps the filter wholesale (e.g. editing a different rule).\n // First-mount initialisation is handled by ngOnInit so we skip the initial assignment\n // here. Picker UI state is also reset so a stale search query / open picker from the\n // previous draft doesn't bleed into the new one.\n //\n // We do NOT emit (audienceChange) / onChange — the host already KNOWS the value it\n // pushed. Echoing back via the change callback can create a feedback loop with two-way\n // bindings and reactive forms. Validity, however, may genuinely change with the new\n // value — emit that signal explicitly via the form-validator hook + (validityChange).\n if (changes['value'] && !changes['value'].firstChange) {\n this.applyValue(this.value, /* emitImmediate */ false);\n this.closePicker();\n this.errorKey.set(null);\n this.emitValidityOnly();\n }\n }\n\n ngOnDestroy(): void {\n this.userSearch$.complete();\n }\n\n /**\n * Replaces the in-component state from an external value. Null-safe — if the host\n * passes <c>null</c> or <c>undefined</c> (e.g. while a parent signal is loading),\n * we treat it as an empty filter rather than crashing.\n */\n private applyValue(v: AudienceFilter | null | undefined, emitImmediate: boolean): void {\n this.includes.set([...(v?.includes ?? [])]);\n this.excludes.set([...(v?.excludes ?? [])]);\n if (emitImmediate) this.emitState();\n }\n\n // ── Picker open/close + tabs ─────────────────────────────────────────────────\n\n openPicker(target: AudienceEditTarget): void {\n if (this.disabled()) return;\n this.editTarget.set(target);\n this.pickerOpen.set(true);\n this.errorKey.set(null);\n }\n\n closePicker(): void {\n this.pickerOpen.set(false);\n this.userSearchQuery.set('');\n this.userSearchResults.set([]);\n this.roleSearchQuery.set('');\n }\n\n selectKind(kind: AudienceTermKind): void {\n this.activeKind.set(kind);\n this.errorKey.set(null);\n }\n\n // ── User picker ──────────────────────────────────────────────────────────────\n\n onUserSearchInput(): void {\n const q = this.userSearchQuery().trim();\n if (q.length < 2) {\n this.userSearchResults.set([]);\n // Push the short query into the stream so distinctUntilChanged resets when the user\n // shortens and re-lengthens the query (otherwise \"foo\" → \"f\" → \"foo\" is a no-op).\n this.userSearch$.next(q);\n return;\n }\n this.userSearch$.next(q);\n }\n\n pickUser(user: ShareUserResult): void {\n this.addToActiveBucket((existing) => this.upsertUsersTerm(existing, user.id));\n this.userSearchQuery.set('');\n this.userSearchResults.set([]);\n }\n\n // ── Role picker ──────────────────────────────────────────────────────────────\n\n pickRole(role: RoleOuLookupRow): void {\n this.addToActiveBucket((existing) => this.upsertRolesTerm(existing, role.appId, role.roleKey));\n this.roleSearchQuery.set('');\n }\n\n // ── OU picker ────────────────────────────────────────────────────────────────\n\n onChartChange(chartId: string | null): void {\n this.selectedChartId.set(chartId);\n this.selectedChartId$.next(chartId);\n }\n\n pickOu(ou: ShareOuNode): void {\n const chartId = this.selectedChartId();\n const includeDescendants = this.ouIncludeDescendants();\n this.addToActiveBucket((existing) =>\n this.upsertOuTerm(existing, ou.id, chartId, includeDescendants),\n );\n }\n\n ouIndentStartPx(ou: ShareOuNode): number {\n const d = ou.depth ?? 0;\n return 12 + d * 18;\n }\n\n /**\n * Picks the chart id to seed the OU picker with. Honours explicit {@link defaultChartId}\n * first (even when null, since null is a valid id meaning \"default chart\"), then\n * {@link defaultChartSystemKey}, then falls back to host order. Lookup uses\n * <see cref=\"hasOwnProperty\"/> on the input keys to distinguish \"host did not set this\n * input\" from \"host set it to null\" — Angular reflects an unset input as <c>undefined</c>.\n */\n private resolveInitialChartId(opts: ShareOrgChartOption[]): string | null {\n if (this.defaultChartId !== undefined) {\n const exists = opts.some((o) => o.id === this.defaultChartId);\n return exists ? (this.defaultChartId as string | null) : (opts[0]?.id ?? null);\n }\n const key = this.defaultChartSystemKey;\n if (key) {\n const match = opts.find((o) => o.systemKey === key);\n if (match) return match.id;\n }\n return opts[0]?.id ?? null;\n }\n\n // ── App-everyone picker ──────────────────────────────────────────────────────\n\n pickAppEveryone(appId: string): void {\n this.addToActiveBucket((existing) => this.upsertAppEveryoneTerm(existing, appId));\n }\n\n // ── Chart picker ─────────────────────────────────────────────────────────────\n\n pickChart(chartId: string | null): void {\n if (!chartId) {\n this.errorKey.set('audience.error.chart_id_required');\n return;\n }\n this.addToActiveBucket((existing) => this.upsertChartTerm(existing, chartId));\n }\n\n // ── Preset picker ────────────────────────────────────────────────────────────\n\n pickPreset(preset: AudiencePresetKind): void {\n if (!this.selfUserId) {\n this.errorKey.set('audience.error.self_user_required');\n return;\n }\n const anchor = this.selfUserId;\n this.addToActiveBucket((existing) => this.upsertPresetTerm(existing, preset, anchor));\n }\n\n // ── Term removal ─────────────────────────────────────────────────────────────\n\n removeTerm(target: AudienceEditTarget, index: number): void {\n if (this.disabled()) return;\n const list = target === 'includes' ? this.includes() : this.excludes();\n const next = list.filter((_, i) => i !== index);\n if (target === 'includes') this.includes.set(next);\n else this.excludes.set(next);\n this.emitState();\n }\n\n removeUserId(target: AudienceEditTarget, termIndex: number, userId: string): void {\n this.editTermAt(target, termIndex, (term) => {\n if (term.kind !== 'users') return term;\n const next = term.userIds.filter((id) => id !== userId);\n return next.length === 0 ? null : { ...term, userIds: next };\n });\n }\n\n removeRoleKey(target: AudienceEditTarget, termIndex: number, roleKey: string): void {\n this.editTermAt(target, termIndex, (term) => {\n if (term.kind !== 'roles') return term;\n const next = term.roleKeys.filter((k) => k !== roleKey);\n return next.length === 0 ? null : { ...term, roleKeys: next };\n });\n }\n\n removeOuId(target: AudienceEditTarget, termIndex: number, ouId: string): void {\n this.editTermAt(target, termIndex, (term) => {\n if (term.kind !== 'ou') return term;\n const next = term.ouIds.filter((id) => id !== ouId);\n return next.length === 0 ? null : { ...term, ouIds: next };\n });\n }\n\n // ── Public read API ──────────────────────────────────────────────────────────\n\n /** Returns the current filter snapshot — useful for hosts that want to peek without subscribing. */\n snapshot(): AudienceFilter {\n return this.buildFilter();\n }\n\n // ── ControlValueAccessor implementation ──────────────────────────────────────\n\n /**\n * Called by the forms infrastructure to push a new value into the control. Mirrors the\n * `[value]` setter path — re-uses `applyValue` so template-driven and reactive callers\n * converge on the same hydration code.\n */\n writeValue(value: AudienceFilter | null | undefined): void {\n this.applyValue(value, /* emitImmediate */ false);\n }\n\n registerOnChange(fn: (value: AudienceFilter) => void): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: () => void): void {\n this.onTouched = fn;\n }\n\n setDisabledState(isDisabled: boolean): void {\n this.disabled.set(isDisabled);\n if (isDisabled) this.closePicker();\n }\n\n // ── Validator implementation ─────────────────────────────────────────────────\n\n /**\n * Aligns Angular's reactive-forms validity with the component's own `validityChange`\n * output. Returns `audienceRequired` when includes is empty (the canonical \"zero\n * recipients\" guard) and `audienceTooManyTerms` when over the per-filter cap.\n * <br>\n * The output-event path (<see cref=\"emitState\"/>) reuses this method so there is ONE\n * definition of \"valid\" — the classic \"two almost-identical validators drifted\" bug\n * cannot recur here.\n */\n validate(_: AbstractControl): ValidationErrors | null {\n return this.validateFilter(this.buildFilter());\n }\n\n private validateFilter(candidate: AudienceFilter): ValidationErrors | null {\n if (candidate.includes.length === 0) return { audienceRequired: true };\n const total = candidate.includes.length + (candidate.excludes?.length ?? 0);\n if (total > AUDIENCE_LIMITS.maxTermsPerFilter) {\n return { audienceTooManyTerms: { actual: total, max: AUDIENCE_LIMITS.maxTermsPerFilter } };\n }\n return null;\n }\n\n registerOnValidatorChange(fn: () => void): void {\n this.onValidatorChange = fn;\n }\n\n // ── Term display helpers ─────────────────────────────────────────────────────\n\n ouLabel(ouId: string): string {\n const match = this.ouTree().find((o) => o.id === ouId);\n return match?.displayName ?? `${ouId.substring(0, 8)}…`;\n }\n\n roleLabel(appId: string, roleKey: string): string {\n const match = this.roleOus().find((r) => r.appId === appId && r.roleKey === roleKey);\n return match?.displayName ?? `${appId}:${roleKey}`;\n }\n\n appLabel(appId: string): string {\n if (appId === '*') return this.i18n.t('audience.app_everyone_wildcard');\n const match = this.appEveryoneOptions.find((a) => a.appId === appId);\n return match?.displayName ?? appId;\n }\n\n chartLabel(chartId: string): string {\n const match = this.chartOptions().find((c) => c.id === chartId);\n return match?.name ?? `${chartId.substring(0, 8)}…`;\n }\n\n /**\n * Locale key for a term kind. Replaces hyphens with underscores so the JSON file uses\n * one consistent naming convention (`audience.kind_app_everyone`, not the hyphen variant).\n */\n kindLocaleKey(kind: AudienceTermKind): string {\n return `audience.kind_${kind.replace(/-/g, '_')}`;\n }\n\n /** Same convention as {@link kindLocaleKey} but for preset names. */\n presetLocaleKey(preset: AudiencePresetKind): string {\n return `audience.preset_${preset.replace(/-/g, '_')}`;\n }\n\n /** Picon icon CSS class for a term kind tab — kept here so the template stays declarative. */\n kindIconClass(kind: AudienceTermKind): string {\n switch (kind) {\n case 'users': return 'pi pi-user';\n case 'roles': return 'pi pi-id-card';\n case 'ou': return 'pi pi-sitemap';\n case 'app-everyone': return 'pi pi-globe';\n case 'chart': return 'pi pi-share-alt';\n case 'preset': return 'pi pi-star';\n }\n }\n\n // ── Internal helpers — upsert + state emission ───────────────────────────────\n\n private addToActiveBucket(upsert: (existing: AudienceTerm[]) => AudienceTerm[]): void {\n if (this.disabled()) return;\n const target = this.editTarget();\n const current = target === 'includes' ? this.includes() : this.excludes();\n const next = upsert(current);\n if (this.totalTermCount(next, target) > AUDIENCE_LIMITS.maxTermsPerFilter) {\n this.errorKey.set('audience.error.too_many_terms');\n return;\n }\n if (target === 'includes') this.includes.set(next);\n else this.excludes.set(next);\n this.errorKey.set(null);\n this.emitState();\n }\n\n private editTermAt(\n target: AudienceEditTarget,\n index: number,\n fn: (term: AudienceTerm) => AudienceTerm | null,\n ): void {\n if (this.disabled()) return;\n const list = target === 'includes' ? this.includes() : this.excludes();\n const term = list[index];\n if (!term) return;\n const replaced = fn(term);\n const next = replaced === null\n ? list.filter((_, i) => i !== index)\n : list.map((t, i) => (i === index ? replaced : t));\n if (target === 'includes') this.includes.set(next);\n else this.excludes.set(next);\n this.emitState();\n }\n\n private totalTermCount(replacement: AudienceTerm[], target: AudienceEditTarget): number {\n const inc = target === 'includes' ? replacement : this.includes();\n const exc = target === 'excludes' ? replacement : this.excludes();\n return inc.length + exc.length;\n }\n\n private upsertUsersTerm(existing: AudienceTerm[], userId: string): AudienceTerm[] {\n const idx = existing.findIndex((t) => t.kind === 'users');\n if (idx < 0) {\n const term: UsersTerm = { kind: 'users', userIds: [userId] };\n return [...existing, term];\n }\n const term = existing[idx] as UsersTerm;\n if (term.userIds.includes(userId)) return existing; // idempotent\n if (term.userIds.length >= AUDIENCE_LIMITS.maxUserIdsPerTerm) {\n this.errorKey.set('audience.error.too_many_users_per_term');\n return existing;\n }\n return existing.map((t, i) =>\n i === idx ? { ...term, userIds: [...term.userIds, userId] } : t,\n );\n }\n\n private upsertRolesTerm(\n existing: AudienceTerm[],\n appId: string,\n roleKey: string,\n ): AudienceTerm[] {\n const idx = existing.findIndex((t) => t.kind === 'roles' && t.appId === appId);\n if (idx < 0) {\n const term: RolesTerm = { kind: 'roles', appId, roleKeys: [roleKey] };\n return [...existing, term];\n }\n const term = existing[idx] as RolesTerm;\n if (term.roleKeys.includes(roleKey)) return existing;\n if (term.roleKeys.length >= AUDIENCE_LIMITS.maxRoleKeysPerTerm) {\n this.errorKey.set('audience.error.too_many_roles_per_term');\n return existing;\n }\n return existing.map((t, i) =>\n i === idx ? { ...term, roleKeys: [...term.roleKeys, roleKey] } : t,\n );\n }\n\n private upsertOuTerm(\n existing: AudienceTerm[],\n ouId: string,\n chartId: string | null,\n includeDescendants: boolean,\n ): AudienceTerm[] {\n const idx = existing.findIndex(\n (t) =>\n t.kind === 'ou'\n && t.chartId === chartId\n && t.includeDescendants === includeDescendants,\n );\n if (idx < 0) {\n const term: OuTerm = {\n kind: 'ou',\n ouIds: [ouId],\n chartId,\n includeDescendants,\n };\n return [...existing, term];\n }\n const term = existing[idx] as OuTerm;\n if (term.ouIds.includes(ouId)) return existing;\n if (term.ouIds.length >= AUDIENCE_LIMITS.maxOuIdsPerTerm) {\n this.errorKey.set('audience.error.too_many_ous_per_term');\n return existing;\n }\n return existing.map((t, i) =>\n i === idx ? { ...term, ouIds: [...term.ouIds, ouId] } : t,\n );\n }\n\n private upsertAppEveryoneTerm(existing: AudienceTerm[], appId: string): AudienceTerm[] {\n const exists = existing.some((t) => t.kind === 'app-everyone' && t.appId === appId);\n if (exists) return existing;\n const term: AppEveryoneTerm = { kind: 'app-everyone', appId };\n return [...existing, term];\n }\n\n private upsertChartTerm(existing: AudienceTerm[], chartId: string): AudienceTerm[] {\n const exists = existing.some((t) => t.kind === 'chart' && t.chartId === chartId);\n if (exists) return existing;\n const term: ChartTerm = { kind: 'chart', chartId };\n return [...existing, term];\n }\n\n private upsertPresetTerm(\n existing: AudienceTerm[],\n preset: AudiencePresetKind,\n anchorUserId: string,\n ): AudienceTerm[] {\n const exists = existing.some(\n (t) => t.kind === 'preset' && t.preset === preset && t.anchorUserId === anchorUserId,\n );\n if (exists) return existing;\n const term: PresetTerm = { kind: 'preset', preset, anchorUserId };\n return [...existing, term];\n }\n\n private buildFilter(): AudienceFilter {\n const inc = this.includes();\n const exc = this.excludes();\n return {\n includes: inc,\n ...(exc.length > 0 ? { excludes: exc } : {}),\n ...(this.value?.options ? { options: this.value.options } : {}),\n };\n }\n\n private emitState(): void {\n const filter = this.buildFilter();\n this.audienceChange.emit(filter);\n this.validityChange.emit(this.computeValidity(filter));\n // Forward to the forms infrastructure so reactive forms see the change.\n this.onChange(filter);\n this.onTouched();\n this.onValidatorChange();\n }\n\n /**\n * Emits ONLY the validity signal (component output + forms-validator hook). Used by\n * <see cref=\"ngOnChanges\"/> when the host pushes a new value: the host already knows the\n * value it sent, so re-firing onChange / audienceChange is redundant and risks feedback\n * loops with two-way bindings; but the validity flag may genuinely have flipped and the\n * host needs that to enable / disable submit.\n */\n private emitValidityOnly(): void {\n const filter = this.buildFilter();\n this.validityChange.emit(this.computeValidity(filter));\n this.onValidatorChange();\n }\n\n private computeValidity(candidate: AudienceFilter): boolean {\n // Single-source: delegate to validateFilter so the output flag and the form-validator\n // result agree by construction.\n return this.validateFilter(candidate) === null;\n }\n}\n\n/**\n * Re-export the typed template context so test code (and very advanced hosts that build\n * their own term cards) can refer to it without reaching into the component module.\n */\nexport type AudienceTermCardContext = TermCardContext;\n","<div class=\"fab-root\">\n\n <!-- Includes section -->\n <div class=\"fab-bucket\">\n <div class=\"fab-bucket-header\">\n <div class=\"fab-section-label\" id=\"fab-includes-label\">{{ 'audience.includes' | translate }}</div>\n <button\n type=\"button\"\n class=\"fab-add-btn\"\n (click)=\"openPicker('includes')\"\n [attr.aria-expanded]=\"pickerOpen() && editTarget() === 'includes'\"\n [attr.aria-controls]=\"pickerOpen() && editTarget() === 'includes' ? 'fab-picker-region' : null\"\n >\n <i class=\"pi pi-plus\" aria-hidden=\"true\"></i>\n {{ 'audience.add_term' | translate }}\n </button>\n </div>\n\n @if (includes().length === 0) {\n <div class=\"fab-empty\">{{ 'audience.includes_empty' | translate }}</div>\n } @else {\n <ul class=\"fab-term-list\" aria-labelledby=\"fab-includes-label\">\n @for (term of includes(); track term) {\n <li class=\"fab-term\">\n <ng-container\n *ngTemplateOutlet=\"termCard; context: { $implicit: term, target: 'includes', index: $index }\">\n </ng-container>\n </li>\n }\n </ul>\n }\n </div>\n\n <!-- Excludes section -->\n @if (showExcludes) {\n <div class=\"fab-bucket fab-bucket-exclude\">\n <div class=\"fab-bucket-header\">\n <div class=\"fab-section-label\" id=\"fab-excludes-label\">{{ 'audience.excludes' | translate }}</div>\n <button\n type=\"button\"\n class=\"fab-add-btn\"\n (click)=\"openPicker('excludes')\"\n [attr.aria-expanded]=\"pickerOpen() && editTarget() === 'excludes'\"\n [attr.aria-controls]=\"pickerOpen() && editTarget() === 'excludes' ? 'fab-picker-region' : null\"\n >\n <i class=\"pi pi-plus\" aria-hidden=\"true\"></i>\n {{ 'audience.add_term' | translate }}\n </button>\n </div>\n\n @if (excludes().length === 0) {\n <div class=\"fab-empty\">{{ 'audience.excludes_empty' | translate }}</div>\n } @else {\n <ul class=\"fab-term-list\" aria-labelledby=\"fab-excludes-label\">\n @for (term of excludes(); track term) {\n <li class=\"fab-term\">\n <ng-container\n *ngTemplateOutlet=\"termCard; context: { $implicit: term, target: 'excludes', index: $index }\">\n </ng-container>\n </li>\n }\n </ul>\n }\n </div>\n }\n\n <!-- Inline picker (shared across includes/excludes; gated by pickerOpen) -->\n @if (pickerOpen()) {\n <div\n id=\"fab-picker-region\"\n class=\"fab-picker\"\n role=\"region\"\n [attr.aria-label]=\"(editTarget() === 'includes'\n ? ('audience.adding_to_includes' | translate)\n : ('audience.adding_to_excludes' | translate))\"\n >\n <div class=\"fab-picker-header\">\n <span class=\"fab-picker-target\">\n {{\n editTarget() === 'includes'\n ? ('audience.adding_to_includes' | translate)\n : ('audience.adding_to_excludes' | translate)\n }}\n </span>\n <button type=\"button\" class=\"fab-close\" (click)=\"closePicker()\" [attr.aria-label]=\"'audience.close' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n\n <!-- Kind tabs -->\n <div class=\"fab-kind-tabs\" role=\"tablist\">\n @for (kind of supportedKinds; track kind) {\n <button\n type=\"button\"\n role=\"tab\"\n class=\"fab-kind-tab\"\n [id]=\"'fab-tab-' + kind\"\n [class.active]=\"activeKind() === kind\"\n [attr.aria-selected]=\"activeKind() === kind\"\n [attr.aria-controls]=\"'fab-tabpanel-' + kind\"\n (click)=\"selectKind(kind)\"\n >\n <i [class]=\"kindIconClass(kind)\" aria-hidden=\"true\"></i>\n <span>{{ kindLocaleKey(kind) | translate }}</span>\n </button>\n }\n </div>\n\n @if (errorKey()) {\n <div class=\"fab-inline-error\" role=\"alert\">\n <i class=\"pi pi-exclamation-triangle\" aria-hidden=\"true\"></i>\n {{ errorKey()! | translate }}\n </div>\n }\n\n <!-- Per-kind picker bodies -->\n <div\n class=\"fab-picker-body\"\n role=\"tabpanel\"\n [id]=\"'fab-tabpanel-' + activeKind()\"\n [attr.aria-labelledby]=\"'fab-tab-' + activeKind()\"\n >\n @switch (activeKind()) {\n\n @case ('users') {\n <input\n type=\"text\"\n class=\"fab-input\"\n [ngModel]=\"userSearchQuery()\"\n (ngModelChange)=\"userSearchQuery.set($event); onUserSearchInput()\"\n [placeholder]=\"'audience.search_users_placeholder' | translate\"\n [attr.aria-label]=\"'audience.search_users_placeholder' | translate\"\n />\n @if (userSearchResults().length > 0) {\n <div class=\"fab-result-list\" role=\"list\">\n @for (u of userSearchResults(); track u.id) {\n <button type=\"button\" role=\"listitem\" class=\"fab-result-item\" (click)=\"pickUser(u)\">\n <i class=\"pi pi-user\" aria-hidden=\"true\"></i>\n <span>{{ u.firstName }} {{ u.lastName }}</span>\n <span class=\"fab-result-secondary\">{{ u.email }}</span>\n </button>\n }\n </div>\n } @else if (userSearchQuery().length >= 2) {\n <div class=\"fab-empty\">{{ 'audience.no_users_match' | translate }}</div>\n }\n }\n\n @case ('roles') {\n @if (loadRoleOus && roleOus().length > 0) {\n <input\n type=\"text\"\n class=\"fab-input\"\n [ngModel]=\"roleSearchQuery()\"\n (ngModelChange)=\"roleSearchQuery.set($event)\"\n [placeholder]=\"'audience.search_roles_placeholder' | translate\"\n [attr.aria-label]=\"'audience.search_roles_placeholder' | translate\"\n />\n <div class=\"fab-result-list\" role=\"list\">\n @for (role of filteredRoles(); track role.ouId) {\n <button type=\"button\" role=\"listitem\" class=\"fab-result-item\" (click)=\"pickRole(role)\">\n <i class=\"pi pi-id-card\" aria-hidden=\"true\"></i>\n <span>{{ role.displayName }}</span>\n <span class=\"fab-result-secondary\">{{ role.appId }}</span>\n </button>\n }\n @if (filteredRoles().length === 0) {\n <div class=\"fab-empty\">{{ 'audience.no_roles_match' | translate }}</div>\n }\n </div>\n } @else {\n <div class=\"fab-empty\">{{ 'audience.roles_unavailable' | translate }}</div>\n }\n }\n\n @case ('ou') {\n @if (chartOptions().length > 0) {\n <label for=\"fab-chart-select\" class=\"fab-mini-label\">\n {{ 'audience.org_chart' | translate }}\n </label>\n <select\n id=\"fab-chart-select\"\n class=\"fab-select\"\n [ngModel]=\"selectedChartId()\"\n (ngModelChange)=\"onChartChange($event)\"\n >\n @for (opt of chartOptions(); track $index) {\n <option [ngValue]=\"opt.id\">{{ opt.name }}</option>\n }\n </select>\n }\n <label class=\"fab-checkbox-label\">\n <input\n type=\"checkbox\"\n [ngModel]=\"ouIncludeDescendants()\"\n (ngModelChange)=\"ouIncludeDescendants.set($event)\"\n />\n {{ 'audience.include_descendants' | translate }}\n </label>\n @if (ouTree().length === 0) {\n <div class=\"fab-empty\">{{ 'audience.ou_tree_empty' | translate }}</div>\n } @else {\n <div class=\"fab-result-list fab-ou-tree\" role=\"list\">\n @for (ou of ouTree(); track ou.id) {\n <button\n type=\"button\"\n role=\"listitem\"\n class=\"fab-result-item\"\n [style.padding-inline-start.px]=\"ouIndentStartPx(ou)\"\n (click)=\"pickOu(ou)\"\n >\n <i class=\"pi pi-sitemap\" aria-hidden=\"true\"></i>\n <span>{{ ou.displayName }}</span>\n </button>\n }\n </div>\n }\n }\n\n @case ('app-everyone') {\n @if (appEveryoneOptions.length === 0) {\n <div class=\"fab-empty\">{{ 'audience.app_everyone_empty' | translate }}</div>\n } @else {\n <div class=\"fab-result-list\" role=\"list\">\n @for (app of appEveryoneOptions; track app.appId) {\n <button type=\"button\" role=\"listitem\" class=\"fab-result-item\" (click)=\"pickAppEveryone(app.appId)\">\n <i class=\"pi pi-globe\" aria-hidden=\"true\"></i>\n <span>{{ app.displayName }}</span>\n <span class=\"fab-result-secondary\">{{ app.appId }}</span>\n </button>\n }\n </div>\n }\n }\n\n @case ('chart') {\n @if (chartTermOptions().length === 0) {\n <div class=\"fab-empty\">{{ 'audience.chart_options_empty' | translate }}</div>\n } @else {\n <div class=\"fab-result-list\" role=\"list\">\n @for (opt of chartTermOptions(); track opt.id) {\n <button type=\"button\" role=\"listitem\" class=\"fab-result-item\" (click)=\"pickChart(opt.id)\">\n <i class=\"pi pi-share-alt\" aria-hidden=\"true\"></i>\n <span>{{ opt.name }}</span>\n </button>\n }\n </div>\n }\n }\n\n @case ('preset') {\n <div class=\"fab-result-list\" role=\"list\">\n @for (p of presetOptions; track p) {\n <button type=\"button\" role=\"listitem\" class=\"fab-result-item\" (click)=\"pickPreset(p)\">\n <i class=\"pi pi-star\" aria-hidden=\"true\"></i>\n <span>{{ presetLocaleKey(p) | translate }}</span>\n </button>\n }\n </div>\n }\n }\n </div>\n </div>\n }\n\n</div>\n\n<!-- Reusable term card template, parameterised by target bucket + index for removal callbacks -->\n<ng-template #termCard let-term let-target=\"target\" let-index=\"index\">\n <div class=\"fab-term-card\" [class.fab-term-exclude]=\"target === 'excludes'\">\n\n @switch (term.kind) {\n @case ('users') {\n <div class=\"fab-term-head\">\n <i class=\"pi pi-user\" aria-hidden=\"true\"></i>\n <span class=\"fab-term-title\">\n {{ 'audience.term_users' | translate: { count: term.userIds.length } }}\n </span>\n <button type=\"button\" class=\"fab-icon-btn danger\" (click)=\"removeTerm(target, index)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"fab-term-chips\">\n @for (id of term.userIds; track id) {\n <span class=\"fab-chip\">\n <i class=\"pi pi-user\" aria-hidden=\"true\"></i>\n <span>{{ id.substring(0, 8) }}…</span>\n <button type=\"button\" class=\"fab-chip-x\" (click)=\"removeUserId(target, index, id)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </span>\n }\n </div>\n }\n\n @case ('roles') {\n <div class=\"fab-term-head\">\n <i class=\"pi pi-id-card\" aria-hidden=\"true\"></i>\n <span class=\"fab-term-title\">\n {{ 'audience.term_roles' | translate: { app: appLabel(term.appId), count: term.roleKeys.length } }}\n </span>\n <button type=\"button\" class=\"fab-icon-btn danger\" (click)=\"removeTerm(target, index)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"fab-term-chips\">\n @for (k of term.roleKeys; track k) {\n <span class=\"fab-chip\">\n <i class=\"pi pi-id-card\" aria-hidden=\"true\"></i>\n <span>{{ roleLabel(term.appId, k) }}</span>\n <button type=\"button\" class=\"fab-chip-x\" (click)=\"removeRoleKey(target, index, k)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </span>\n }\n </div>\n }\n\n @case ('ou') {\n <div class=\"fab-term-head\">\n <i class=\"pi pi-sitemap\" aria-hidden=\"true\"></i>\n <span class=\"fab-term-title\">\n {{ 'audience.term_ous' | translate: { count: term.ouIds.length } }}\n @if (term.includeDescendants) {\n <span class=\"fab-badge\">{{ 'audience.descendants_badge' | translate }}</span>\n }\n </span>\n <button type=\"button\" class=\"fab-icon-btn danger\" (click)=\"removeTerm(target, index)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n <div class=\"fab-term-chips\">\n @for (id of term.ouIds; track id) {\n <span class=\"fab-chip\">\n <i class=\"pi pi-sitemap\" aria-hidden=\"true\"></i>\n <span>{{ ouLabel(id) }}</span>\n <button type=\"button\" class=\"fab-chip-x\" (click)=\"removeOuId(target, index, id)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </span>\n }\n </div>\n }\n\n @case ('app-everyone') {\n <div class=\"fab-term-head\">\n <i class=\"pi pi-globe\" aria-hidden=\"true\"></i>\n <span class=\"fab-term-title\">\n {{ 'audience.term_app_everyone' | translate: { app: appLabel(term.appId) } }}\n </span>\n <button type=\"button\" class=\"fab-icon-btn danger\" (click)=\"removeTerm(target, index)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n\n @case ('chart') {\n <div class=\"fab-term-head\">\n <i class=\"pi pi-share-alt\" aria-hidden=\"true\"></i>\n <span class=\"fab-term-title\">\n {{ 'audience.term_chart' | translate: { chart: chartLabel(term.chartId) } }}\n </span>\n <button type=\"button\" class=\"fab-icon-btn danger\" (click)=\"removeTerm(target, index)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n\n @case ('preset') {\n <div class=\"fab-term-head\">\n <i class=\"pi pi-star\" aria-hidden=\"true\"></i>\n <span class=\"fab-term-title\">\n {{ presetLocaleKey(term.preset) | translate }}\n </span>\n <button type=\"button\" class=\"fab-icon-btn danger\" (click)=\"removeTerm(target, index)\"\n [attr.aria-label]=\"'audience.remove_term' | translate\">\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n </div>\n }\n }\n </div>\n</ng-template>\n","import { Component, ChangeDetectionStrategy, computed, input } from '@angular/core';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\n\n/** Full-bleed loading overlay for window content (shell) or embedded hosts. */\n@Component({\n selector: 'fly-block-ui',\n standalone: true,\n imports: [TranslatePipe],\n templateUrl: './block-ui.component.html',\n styleUrl: './block-ui.component.scss',\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FlyBlockUiComponent {\n /** When false, the overlay is not rendered (host may use @if instead). */\n active = input.required<boolean>();\n\n /** i18n key for status text; empty uses `common.loading`. */\n messageKey = input('');\n\n readonly resolvedMessageKey = computed(() => {\n const k = this.messageKey()?.trim();\n return k && k.length > 0 ? k : 'common.loading';\n });\n}\n","@if (active()) {\n <div\n class=\"fly-block-ui\"\n role=\"status\"\n aria-live=\"polite\"\n aria-busy=\"true\"\n [attr.aria-label]=\"resolvedMessageKey() | translate\">\n <div class=\"fly-block-ui__card\">\n <i class=\"pi pi-spin pi-spinner fly-block-ui__spinner\" aria-hidden=\"true\"></i>\n <span class=\"fly-block-ui__text\">{{ resolvedMessageKey() | translate }}</span>\n </div>\n </div>\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n HostListener,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n} from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { A11yModule } from '@angular/cdk/a11y';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\n\n/** Drawer width tier. Maps to a logical inline-size (see SCSS). */\nexport type FlyDrawerSize = 'sm' | 'md' | 'lg' | 'xl';\n\n/** Edge the drawer is pinned to. Logical → RTL flips automatically. */\nexport type FlyDrawerSide = 'end' | 'start';\n\n/**\n * `fly-drawer` — the ONE overlay-drawer primitive for FlyOS apps.\n *\n * Replaces every hand-rolled centered modal / `*-backdrop` + `modal-panel`\n * scaffold. A slide-in panel pinned to the window's inline-end edge over a\n * scrim, dismissing away — drops onto ANY app layout (sidebar+main, editor,\n * list) with no restructuring.\n *\n * ## Windowed rendering (important)\n * Desktop apps are windowed, so the drawer renders **in-place** — the scrim is\n * `position: absolute; inset: 0` and overlays the nearest positioned ancestor,\n * NOT a body/CDK portal (a body-level overlay would escape the app window and\n * break the shell's window stacking). **The consuming app's root container must\n * be `position: relative`** (add it where missing) so the scrim is clipped to\n * the window.\n *\n * ## Controlled\n * `open` is a controlled input — bind it to a signal and flip it in the\n * `(closed)` / `(openChange)` handlers. The drawer never closes itself; it only\n * requests closure (scrim / Escape / ✕) by emitting.\n *\n * ## Owns (so apps stop reimplementing it)\n * slide in/out (honours `prefers-reduced-motion`), focus trap + focus restore,\n * Escape + scrim dismiss (both gated), scroll-lock of the host content, ARIA\n * (`role=dialog` + `aria-modal` + labelledby/label), logical CSS (RTL-safe),\n * dark theme.\n *\n * ## Slots\n * - `[flyDrawerHeader]` — optional custom header (else `heading` + close ✕).\n * - default — body (scrolls).\n * - `[flyDrawerFooter]` — optional sticky footer (action bar).\n */\n@Component({\n selector: 'fly-drawer',\n standalone: true,\n imports: [CommonModule, A11yModule, TranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n templateUrl: './drawer.component.html',\n styleUrl: './drawer.component.scss',\n})\nexport class FlyDrawerComponent {\n private host = inject(ElementRef<HTMLElement>);\n private destroyRef = inject(DestroyRef);\n\n /** Drives mount + slide. Controlled by the parent. */\n readonly open = input(false);\n /** Width tier → inline-size (sm 360 / md 480 / lg 640 / xl min(960px, 94%)). */\n readonly size = input<FlyDrawerSize>('md');\n /** Convenience title shown in the default header (ignored if `[flyDrawerHeader]` is projected). Treated as an i18n key. */\n readonly heading = input<string | null>(null);\n /** Edge to pin to. `end` (default) slides from inline-end; RTL flips it. */\n readonly side = input<FlyDrawerSide>('end');\n /** Close when the scrim is clicked. */\n readonly dismissOnScrim = input(true);\n /** Close on Escape. */\n readonly dismissOnEscape = input(true);\n /** Accessible label when no `heading` / projected header title is available. Treated as an i18n key. */\n readonly ariaLabel = input<string | null>(null);\n /** Hide the built-in close ✕ in the default header (e.g. a mandatory step). */\n readonly hideCloseButton = input(false);\n\n /** Emitted when the user requests dismissal (scrim / Escape / ✕). */\n readonly closed = output<void>();\n /** Two-way friendly: emits `false` on a dismissal request. */\n readonly openChange = output<boolean>();\n\n /** Whether the panel is mounted (true while open AND during the slide-out). */\n readonly rendered = signal(false);\n /** True only while the slide-out animation is playing (drives the exit keyframe). */\n readonly leaving = signal(false);\n\n readonly headingId = 'fly-drawer-heading';\n readonly labelledBy = computed(() => (this.heading() ? this.headingId : null));\n\n /** Size/side classes as an ngClass map (kept off the `[class]` string binding,\n * which can race the leaving toggle and stutter the animation). */\n readonly panelClass = computed(() => ({\n ['fly-drawer__panel--' + this.size()]: true,\n ['fly-drawer__panel--side-' + this.side()]: true,\n }));\n\n /** Name of the exit keyframe — used to ignore bubbled child animationend events. */\n private static readonly EXIT_ANIM = 'fly-drawer-out';\n\n /** Element focused before the drawer opened, restored on close. */\n private previouslyFocused: HTMLElement | null = null;\n /** Parent element whose overflow we lock while open. */\n private scrollLockTarget: HTMLElement | null = null;\n private prevOverflow = '';\n\n constructor() {\n effect(() => {\n if (this.open()) this.onOpen();\n else this.onClose();\n });\n this.destroyRef.onDestroy(() => this.releaseScrollLock());\n }\n\n private onOpen(): void {\n if (this.rendered() && !this.leaving()) return;\n this.previouslyFocused =\n document.activeElement instanceof HTMLElement ? document.activeElement : null;\n this.lockScroll();\n // Mount the panel — the enter keyframe plays automatically on insertion, so\n // there's no rAF/forced-reflow dance to mis-time (the old source of the\n // open glitch). A re-open mid-close just clears `leaving`.\n this.leaving.set(false);\n this.rendered.set(true);\n // Focus the first field AFTER paint and WITHOUT scrolling — focusing an\n // off-screen, sliding-in panel otherwise yanks the app root's scroll\n // position and stutters the animation.\n requestAnimationFrame(() => this.focusFirstField());\n }\n\n private onClose(): void {\n if (!this.rendered() || this.leaving()) return;\n this.leaving.set(true);\n this.releaseScrollLock();\n this.restoreFocus();\n // Unmount on the exit animation's end; fallback timer covers reduced-motion\n // (no animation → no event) so the pointer-grabbing scrim can't linger.\n setTimeout(() => this.unmount(), 360);\n }\n\n /** Unmount once the slide-out keyframe finishes (filtered to our exit anim). */\n onPanelAnimationEnd(animationName: string): void {\n if (animationName === FlyDrawerComponent.EXIT_ANIM) this.unmount();\n }\n\n private unmount(): void {\n if (this.open()) return; // re-opened during the slide-out — keep it mounted\n this.rendered.set(false);\n this.leaving.set(false);\n }\n\n /** Focus the first form control in the body (or the panel) without scrolling. */\n private focusFirstField(): void {\n const root = this.host.nativeElement as HTMLElement;\n const panel = root.querySelector('.fly-drawer__panel') as HTMLElement | null;\n if (!panel) return;\n const selector =\n '[autofocus],input:not([type=hidden]),select,textarea,button,[tabindex]:not([tabindex=\"-1\"]),a[href]';\n const body = panel.querySelector('.fly-drawer__body');\n const target =\n (body?.querySelector(selector) as HTMLElement | null) ??\n (panel.querySelector(selector) as HTMLElement | null) ??\n panel;\n target.focus({ preventScroll: true });\n }\n\n @HostListener('document:keydown.escape')\n onEscape(): void {\n if (this.open() && this.dismissOnEscape()) this.requestClose();\n }\n\n onScrimClick(): void {\n if (this.dismissOnScrim()) this.requestClose();\n }\n\n requestClose(): void {\n this.openChange.emit(false);\n this.closed.emit();\n }\n\n private lockScroll(): void {\n // Lock the nearest positioned ancestor (the app window root) — the same box\n // the absolutely-positioned scrim clips to — not the immediate DOM parent\n // (which may be a `display:contents` dialog wrapper).\n const target =\n (this.host.nativeElement.offsetParent as HTMLElement | null) ??\n this.host.nativeElement.parentElement;\n if (!target) return;\n this.scrollLockTarget = target;\n this.prevOverflow = target.style.overflow;\n target.style.overflow = 'hidden';\n }\n\n private releaseScrollLock(): void {\n if (!this.scrollLockTarget) return;\n this.scrollLockTarget.style.overflow = this.prevOverflow;\n this.scrollLockTarget = null;\n this.prevOverflow = '';\n }\n\n private restoreFocus(): void {\n const el = this.previouslyFocused;\n this.previouslyFocused = null;\n if (el && document.contains(el)) {\n // Defer so focus lands after the panel is removed from the a11y tree.\n requestAnimationFrame(() => el.focus());\n }\n }\n}\n","<!--\n Windowed overlay drawer. Renders only while mounted (open or sliding out).\n Scrim + panel are absolutely positioned within the nearest positioned\n ancestor (the consuming app root must be position:relative).\n-->\n@if (rendered()) {\n <div\n class=\"fly-drawer__scrim\"\n [class.fly-drawer__scrim--leaving]=\"leaving()\"\n (click)=\"onScrimClick()\"\n aria-hidden=\"true\"\n ></div>\n\n <div\n class=\"fly-drawer__panel\"\n [ngClass]=\"panelClass()\"\n [class.fly-drawer__panel--leaving]=\"leaving()\"\n role=\"dialog\"\n aria-modal=\"true\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-label]=\"!labelledBy() && ariaLabel() ? (ariaLabel()! | translate) : null\"\n cdkTrapFocus\n (animationend)=\"onPanelAnimationEnd($event.animationName)\"\n >\n <!-- Header: custom slot, else heading + close ✕. -->\n <ng-content select=\"[flyDrawerHeader]\">\n @if (heading()) {\n <header class=\"fly-drawer__header\">\n <h2 class=\"fly-drawer__title\" [id]=\"headingId\">{{ heading()! | translate }}</h2>\n @if (!hideCloseButton()) {\n <button\n type=\"button\"\n class=\"fly-drawer__close\"\n (click)=\"requestClose()\"\n [attr.aria-label]=\"'common.action.close' | translate\"\n >\n <i class=\"pi pi-times\" aria-hidden=\"true\"></i>\n </button>\n }\n </header>\n }\n </ng-content>\n\n <div class=\"fly-drawer__body\">\n <ng-content></ng-content>\n </div>\n\n <ng-content select=\"[flyDrawerFooter]\"></ng-content>\n </div>\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n Injector,\n ViewEncapsulation,\n afterNextRender,\n computed,\n effect,\n inject,\n input,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\nimport type { FlyFileInfo } from '../../models/file.model';\nimport Cropper from 'cropperjs';\n\n/**\n * Image upload component with built-in cropperjs cropping modal.\n *\n * Usage:\n * ```html\n * <fly-image-upload\n * [aspectRatio]=\"16/9\"\n * [currentImageId]=\"trend.coverImageId\"\n * sourceApp=\"circles\"\n * sourceEntityType=\"trend\"\n * (uploaded)=\"onImageUploaded($event)\"\n * (removed)=\"onImageRemoved()\"\n * />\n * ```\n */\n@Component({\n selector: 'fly-image-upload',\n standalone: true,\n imports: [TranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n template: `\n <div class=\"fly-image-upload\">\n @if (previewUrl()) {\n <div class=\"fly-image-upload__preview\">\n <img [src]=\"previewUrl()\" alt=\"\" class=\"fly-image-upload__img\" />\n <div class=\"fly-image-upload__overlay\">\n <button type=\"button\" class=\"fly-image-upload__action-btn\" (click)=\"triggerFileInput()\" [title]=\"'files.imageUpload.change' | translate\">\n <span class=\"pi pi-pencil\" aria-hidden=\"true\"></span>\n </button>\n <button type=\"button\" class=\"fly-image-upload__action-btn fly-image-upload__action-btn--danger\" (click)=\"removeImage()\" [title]=\"'files.imageUpload.remove' | translate\">\n <span class=\"pi pi-trash\" aria-hidden=\"true\"></span>\n </button>\n </div>\n </div>\n } @else {\n <button type=\"button\" class=\"fly-image-upload__dropzone\" (click)=\"triggerFileInput()\" (dragover)=\"onDragOver($event)\" (drop)=\"onDrop($event)\">\n @if (uploading()) {\n <span class=\"pi pi-spin pi-spinner fly-image-upload__icon\" aria-hidden=\"true\"></span>\n <span class=\"fly-image-upload__label\">{{ 'files.imageUpload.uploading' | translate }}</span>\n } @else {\n <span class=\"pi pi-image fly-image-upload__icon\" aria-hidden=\"true\"></span>\n <span class=\"fly-image-upload__label\">{{ 'files.imageUpload.placeholder' | translate }}</span>\n <span class=\"fly-image-upload__hint\">{{ sizeHint() }}</span>\n }\n </button>\n }\n\n @if (error()) {\n <div class=\"fly-image-upload__error\">{{ error() }}</div>\n }\n\n <input #fileInput type=\"file\" accept=\"image/*\" class=\"fly-image-upload__hidden\" (change)=\"onFileSelected($event)\" />\n\n @if (showCropper()) {\n <div class=\"fly-image-upload__crop-backdrop\" (click)=\"cancelCrop()\">\n <div class=\"fly-image-upload__crop-modal\" (click)=\"$event.stopPropagation()\">\n <div class=\"fly-image-upload__crop-header\">\n <h3>{{ 'files.imageUpload.crop' | translate }}</h3>\n </div>\n <div class=\"fly-image-upload__crop-body\">\n <img #cropImage [src]=\"rawImageUrl()\" alt=\"\" />\n </div>\n <div class=\"fly-image-upload__crop-footer\">\n <button type=\"button\" class=\"vos-btn sm platter\" (click)=\"cancelCrop()\">{{ 'common.cancel' | translate }}</button>\n <button type=\"button\" class=\"vos-btn sm primary\" (click)=\"applyCrop()\">{{ 'files.imageUpload.apply' | translate }}</button>\n </div>\n </div>\n </div>\n }\n </div>\n `,\n styles: [\n /* cropperjs v1 styles (MIT — Chen Fengyuan) */\n `.cropper-container{-webkit-touch-callout:none;direction:ltr;font-size:0;line-height:0;position:relative;touch-action:none;user-select:none}.cropper-container img{backface-visibility:hidden;display:block;height:100%;image-orientation:0deg;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;width:100%}.cropper-canvas,.cropper-crop-box,.cropper-drag-box,.cropper-modal,.cropper-wrap-box{bottom:0;left:0;position:absolute;right:0;top:0}.cropper-canvas,.cropper-wrap-box{overflow:hidden}.cropper-drag-box{background-color:#fff;opacity:0}.cropper-modal{background-color:#000;opacity:.5}.cropper-view-box{display:block;height:100%;outline:1px solid #39f;outline-color:rgba(51,153,255,.75);overflow:hidden;width:100%}.cropper-dashed{border:0 dashed #eee;display:block;opacity:.5;position:absolute}.cropper-dashed.dashed-h{border-bottom-width:1px;border-top-width:1px;height:33.33333%;left:0;top:33.33333%;width:100%}.cropper-dashed.dashed-v{border-left-width:1px;border-right-width:1px;height:100%;left:33.33333%;top:0;width:33.33333%}.cropper-center{display:block;height:0;left:50%;opacity:.75;position:absolute;top:50%;width:0}.cropper-center:after,.cropper-center:before{background-color:#eee;content:\" \";display:block;position:absolute}.cropper-center:before{height:1px;left:-3px;top:0;width:7px}.cropper-center:after{height:7px;left:0;top:-3px;width:1px}.cropper-face,.cropper-line,.cropper-point{display:block;height:100%;opacity:.1;position:absolute;width:100%}.cropper-face{background-color:#fff;left:0;top:0}.cropper-line{background-color:#39f}.cropper-line.line-e{cursor:ew-resize;right:-3px;top:0;width:5px}.cropper-line.line-n{cursor:ns-resize;height:5px;left:0;top:-3px}.cropper-line.line-w{cursor:ew-resize;left:-3px;top:0;width:5px}.cropper-line.line-s{bottom:-3px;cursor:ns-resize;height:5px;left:0}.cropper-point{background-color:#39f;height:5px;opacity:.75;width:5px}.cropper-point.point-e{cursor:ew-resize;margin-top:-3px;right:-3px;top:50%}.cropper-point.point-n{cursor:ns-resize;left:50%;margin-left:-3px;top:-3px}.cropper-point.point-w{cursor:ew-resize;left:-3px;margin-top:-3px;top:50%}.cropper-point.point-s{bottom:-3px;cursor:s-resize;left:50%;margin-left:-3px}.cropper-point.point-ne{cursor:nesw-resize;right:-3px;top:-3px}.cropper-point.point-nw{cursor:nwse-resize;left:-3px;top:-3px}.cropper-point.point-sw{bottom:-3px;cursor:nesw-resize;left:-3px}.cropper-point.point-se{bottom:-3px;cursor:nwse-resize;height:20px;opacity:1;right:-3px;width:20px}.cropper-invisible{opacity:0}.cropper-bg{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC\")}.cropper-hide{display:block;height:0;position:absolute;width:0}.cropper-hidden{display:none!important}.cropper-move{cursor:move}.cropper-crop{cursor:crosshair}.cropper-disabled .cropper-drag-box,.cropper-disabled .cropper-face,.cropper-disabled .cropper-line,.cropper-disabled .cropper-point{cursor:not-allowed}`,\n `\n .fly-image-upload { display: flex; flex-direction: column; gap: 6px; }\n .fly-image-upload__hidden { display: none; }\n\n .fly-image-upload__dropzone {\n display: flex; flex-direction: column; align-items: center; justify-content: center;\n gap: 8px; padding: 24px; border: 2px dashed var(--separator-primary, #e5e7eb);\n border-radius: 12px; background: var(--fill-quaternary, #f9fafb); cursor: pointer;\n transition: border-color 0.15s, background 0.15s; min-height: 120px;\n }\n .fly-image-upload__dropzone:hover { border-color: var(--accent-primary, #0071e3); background: var(--fill-tertiary, #f3f4f6); }\n .fly-image-upload__icon { font-size: 28px; color: var(--label-tertiary, #9ca3af); }\n .fly-image-upload__label { font-size: 13px; color: var(--label-secondary, #6b7280); }\n .fly-image-upload__hint { font-size: 11px; color: var(--label-tertiary, #9ca3af); }\n\n .fly-image-upload__preview { position: relative; border-radius: 12px; overflow: hidden; }\n .fly-image-upload__img { display: block; width: 100%; max-height: 280px; object-fit: cover; border-radius: 12px; }\n .fly-image-upload__overlay {\n position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;\n gap: 12px; background: rgba(0,0,0,0.35); opacity: 0; transition: opacity 0.15s;\n }\n .fly-image-upload__preview:hover .fly-image-upload__overlay { opacity: 1; }\n .fly-image-upload__action-btn {\n width: 36px; height: 36px; border-radius: 50%; border: none; cursor: pointer;\n display: flex; align-items: center; justify-content: center;\n background: rgba(255,255,255,0.9); color: var(--label-primary, #1f2937); font-size: 14px;\n transition: background 0.15s;\n }\n .fly-image-upload__action-btn:hover { background: #fff; }\n .fly-image-upload__action-btn--danger:hover { background: #fee2e2; color: #dc2626; }\n\n .fly-image-upload__error { font-size: 12px; color: var(--system-red, #ef4444); }\n\n .fly-image-upload__crop-backdrop {\n position: fixed; inset: 0; z-index: 10000; display: flex; align-items: center; justify-content: center;\n background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);\n }\n .fly-image-upload__crop-modal {\n background: var(--bg-primary, #fff); color: var(--label-primary, #1f2937);\n border-radius: 16px; overflow: hidden;\n max-width: 700px; width: 90vw; box-shadow: 0 20px 60px rgba(0,0,0,0.4);\n border: 1px solid var(--separator-primary, rgba(0,0,0,0.1));\n }\n .fly-image-upload__crop-header {\n padding: 16px 20px; border-bottom: 1px solid var(--separator-primary, #e5e7eb);\n background: var(--fill-quaternary, transparent);\n }\n .fly-image-upload__crop-header h3 {\n margin: 0; font-size: 16px; font-weight: 600; color: var(--label-primary, #1f2937);\n }\n .fly-image-upload__crop-body {\n max-height: 60vh; overflow: hidden; background: var(--fill-tertiary, #f3f4f6);\n }\n .fly-image-upload__crop-body img { display: block; max-width: 100%; }\n .fly-image-upload__crop-footer {\n display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px;\n border-top: 1px solid var(--separator-primary, #e5e7eb);\n background: var(--fill-quaternary, transparent);\n }\n\n /* Dark theme */\n html.dark-theme .fly-image-upload__crop-modal {\n background: var(--bg-primary, #1c1c1e);\n border: 1px solid var(--separator-primary, rgba(255,255,255,0.1));\n }\n html.dark-theme .fly-image-upload__crop-body { background: var(--fill-tertiary, #2c2c2e); }\n `],\n})\nexport class FlyImageUploadComponent {\n private http = inject(HttpClient);\n private injector = inject(Injector);\n\n // ── Inputs ──\n aspectRatio = input(16 / 9);\n maxSizeBytes = input(5 * 1024 * 1024);\n currentImageId = input<string | null>(null);\n sourceApp = input('unknown');\n sourceEntityType = input<string | null>(null);\n sourceEntityId = input<string | null>(null);\n\n // ── Outputs ──\n uploaded = output<FlyFileInfo>();\n removed = output<void>();\n\n // ── State ──\n uploading = signal(false);\n error = signal<string | null>(null);\n showCropper = signal(false);\n rawImageUrl = signal<string>('');\n localBlob = signal<string | null>(null);\n\n fileInput = viewChild<ElementRef<HTMLInputElement>>('fileInput');\n cropImage = viewChild<ElementRef<HTMLImageElement>>('cropImage');\n\n private cropper: Cropper | null = null;\n private selectedFile: File | null = null;\n\n /** Resolved preview URL — uses blob for local uploads, fetches authenticated for existing images */\n previewUrl = signal<string | null>(null);\n\n constructor() {\n // React to currentImageId changes — fetch authenticated blob\n effect((onCleanup) => {\n const local = this.localBlob();\n if (local) { this.previewUrl.set(local); return; }\n\n const id = this.currentImageId();\n if (!id) { this.previewUrl.set(null); return; }\n\n const sub = this.http.get(`/api/files/${id}/download`, { responseType: 'blob' }).subscribe({\n next: (blob) => this.previewUrl.set(URL.createObjectURL(blob)),\n error: () => this.previewUrl.set(null),\n });\n onCleanup(() => sub.unsubscribe());\n });\n }\n\n sizeHint = computed(() => {\n const mb = this.maxSizeBytes() / (1024 * 1024);\n return `Max ${mb}MB`;\n });\n\n triggerFileInput(): void {\n this.fileInput()?.nativeElement.click();\n }\n\n onDragOver(e: DragEvent): void {\n e.preventDefault();\n e.stopPropagation();\n }\n\n onDrop(e: DragEvent): void {\n e.preventDefault();\n e.stopPropagation();\n const file = e.dataTransfer?.files?.[0];\n if (file) this.processFile(file);\n }\n\n onFileSelected(e: Event): void {\n const input = e.target as HTMLInputElement;\n const file = input.files?.[0];\n if (file) this.processFile(file);\n input.value = '';\n }\n\n removeImage(): void {\n this.localBlob.set(null);\n this.previewUrl.set(null);\n this.error.set(null);\n this.removed.emit();\n }\n\n cancelCrop(): void {\n this.showCropper.set(false);\n this.destroyCropper();\n if (this.rawImageUrl()) URL.revokeObjectURL(this.rawImageUrl());\n this.rawImageUrl.set('');\n }\n\n applyCrop(): void {\n if (!this.cropper) return;\n const canvas = this.cropper.getCroppedCanvas({ maxWidth: 1920, maxHeight: 1080 });\n this.showCropper.set(false);\n this.destroyCropper();\n if (this.rawImageUrl()) URL.revokeObjectURL(this.rawImageUrl());\n this.rawImageUrl.set('');\n\n canvas.toBlob((blob) => {\n if (!blob) return;\n const fileName = this.selectedFile?.name ?? 'cropped-image.jpg';\n const file = new File([blob], fileName, { type: blob.type || 'image/jpeg' });\n this.uploadFile(file);\n }, 'image/jpeg', 0.9);\n }\n\n private processFile(file: File): void {\n this.error.set(null);\n\n if (!file.type.startsWith('image/')) {\n this.error.set('Only image files are allowed');\n return;\n }\n if (file.size > this.maxSizeBytes()) {\n const mb = this.maxSizeBytes() / (1024 * 1024);\n this.error.set(`File exceeds ${mb}MB limit`);\n return;\n }\n\n this.selectedFile = file;\n const url = URL.createObjectURL(file);\n this.rawImageUrl.set(url);\n this.showCropper.set(true);\n\n // Init cropperjs after the @if (showCropper()) block has rendered and\n // the #cropImage signal viewQuery is populated. setTimeout(0) used to\n // race here under Native Federation when fewer host CD passes happen\n // before the macrotask fires (cropImage() returned undefined and\n // initCropper bailed). afterNextRender is deterministic.\n afterNextRender(() => this.initCropper(), { injector: this.injector });\n }\n\n private initCropper(): void {\n this.destroyCropper();\n const imgEl = this.cropImage()?.nativeElement;\n if (!imgEl) return;\n this.cropper = new Cropper(imgEl, {\n aspectRatio: this.aspectRatio(),\n viewMode: 1,\n autoCropArea: 0.9,\n responsive: true,\n background: false,\n });\n }\n\n private destroyCropper(): void {\n this.cropper?.destroy();\n this.cropper = null;\n }\n\n private uploadFile(file: File): void {\n this.uploading.set(true);\n this.error.set(null);\n\n const formData = new FormData();\n formData.append('file', file, file.name);\n formData.append('sourceApp', this.sourceApp());\n if (this.sourceEntityType()) formData.append('sourceEntityType', this.sourceEntityType()!);\n if (this.sourceEntityId()) formData.append('sourceEntityId', this.sourceEntityId()!);\n\n this.http.post<{ data: FlyFileInfo }>('/api/files/upload', formData).subscribe({\n next: (res) => {\n this.uploading.set(false);\n const info = res.data ?? (res as any);\n this.localBlob.set(URL.createObjectURL(file));\n this.uploaded.emit(info);\n },\n error: (err) => {\n this.uploading.set(false);\n this.error.set(err?.error?.message ?? 'Upload failed');\n },\n });\n }\n}\n","import {\n ChangeDetectionStrategy,\n Component,\n ElementRef,\n computed,\n effect,\n inject,\n input,\n model,\n output,\n signal,\n viewChild,\n} from '@angular/core';\nimport { HttpClient, HttpEventType } from '@angular/common/http';\nimport { TranslatePipe } from '../../pipes/translate.pipe';\nimport type { FlyFileInfo } from '../../models/file.model';\n\ninterface UploadSlot {\n file: File;\n progress: number; // 0–100\n status: 'uploading' | 'done' | 'error';\n info?: FlyFileInfo;\n error?: string;\n}\n\nconst FILE_ICONS: Record<string, string> = {\n 'application/pdf': 'pi-file-pdf',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'pi-file-word',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'pi-file-excel',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'pi-file',\n 'image/': 'pi-image',\n 'video/': 'pi-video',\n 'audio/': 'pi-volume-up',\n};\n\nfunction iconForType(contentType: string): string {\n for (const [prefix, icon] of Object.entries(FILE_ICONS)) {\n if (contentType.startsWith(prefix)) return icon;\n }\n return 'pi-file';\n}\n\nfunction formatSize(bytes: number): string {\n if (bytes < 1024) return `${bytes} B`;\n if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;\n return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;\n}\n\n/**\n * Multi-file upload with drag-drop, progress, and validation.\n *\n * Usage:\n * ```html\n * <fly-file-upload\n * [maxFiles]=\"5\"\n * [maxFileSizeBytes]=\"5242880\"\n * accept=\".pdf,.docx,.xlsx\"\n * [(files)]=\"trend.attachments\"\n * sourceApp=\"circles\"\n * sourceEntityType=\"trend\"\n * (filesChanged)=\"onAttachmentsChanged($event)\"\n * />\n * ```\n */\n@Component({\n selector: 'fly-file-upload',\n standalone: true,\n imports: [TranslatePipe],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <div class=\"fly-file-upload\">\n @if (canAddMore()) {\n <div class=\"fly-file-upload__dropzone\"\n [class.fly-file-upload__dropzone--drag]=\"dragging()\"\n (click)=\"triggerFileInput()\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave($event)\"\n (drop)=\"onDrop($event)\">\n <span class=\"pi pi-cloud-upload fly-file-upload__icon\" aria-hidden=\"true\"></span>\n <span class=\"fly-file-upload__label\">{{ 'files.fileUpload.dropOrClick' | translate }}</span>\n <span class=\"fly-file-upload__hint\">{{ limitHint() }}</span>\n </div>\n }\n\n @if (error()) {\n <div class=\"fly-file-upload__error\">{{ error() }}</div>\n }\n\n @if (allSlots().length) {\n <ul class=\"fly-file-upload__list\">\n @for (slot of allSlots(); track slot.file.name + slot.file.size) {\n <li class=\"fly-file-upload__item\">\n <span class=\"pi {{ iconFor(slot) }} fly-file-upload__file-icon\" aria-hidden=\"true\"></span>\n <div class=\"fly-file-upload__file-info\">\n <span class=\"fly-file-upload__file-name\">{{ slot.file.name }}</span>\n <span class=\"fly-file-upload__file-size\">{{ formatFileSize(slot.file.size) }}</span>\n </div>\n @if (slot.status === 'uploading') {\n <div class=\"fly-file-upload__progress-track\">\n <div class=\"fly-file-upload__progress-fill\" [style.width.%]=\"slot.progress\"></div>\n </div>\n }\n @if (slot.status === 'error') {\n <span class=\"fly-file-upload__file-error\" [title]=\"slot.error ?? ''\">\n <span class=\"pi pi-exclamation-triangle\" aria-hidden=\"true\"></span>\n </span>\n }\n @if (slot.status === 'done') {\n <span class=\"pi pi-check-circle fly-file-upload__file-ok\" aria-hidden=\"true\"></span>\n }\n <button type=\"button\" class=\"fly-file-upload__remove-btn\" (click)=\"removeSlot(slot)\" [title]=\"'common.remove' | translate\">\n <span class=\"pi pi-times\" aria-hidden=\"true\"></span>\n </button>\n </li>\n }\n </ul>\n }\n\n @if (existingFiles().length && !allSlots().length) {\n <ul class=\"fly-file-upload__list\">\n @for (f of existingFiles(); track f.id) {\n <li class=\"fly-file-upload__item\">\n <span class=\"pi {{ iconForInfo(f) }} fly-file-upload__file-icon\" aria-hidden=\"true\"></span>\n <div class=\"fly-file-upload__file-info\">\n <span class=\"fly-file-upload__file-name\">{{ f.fileName }}</span>\n <span class=\"fly-file-upload__file-size\">{{ formatFileSize(f.sizeBytes) }}</span>\n </div>\n <span class=\"pi pi-check-circle fly-file-upload__file-ok\" aria-hidden=\"true\"></span>\n <button type=\"button\" class=\"fly-file-upload__remove-btn\" (click)=\"removeExisting(f)\" [title]=\"'common.remove' | translate\">\n <span class=\"pi pi-times\" aria-hidden=\"true\"></span>\n </button>\n </li>\n }\n </ul>\n }\n\n <input #fileInput type=\"file\" [accept]=\"accept()\" multiple class=\"fly-file-upload__hidden\" (change)=\"onFilesSelected($event)\" />\n </div>\n `,\n styles: [`\n .fly-file-upload { display: flex; flex-direction: column; gap: 8px; }\n .fly-file-upload__hidden { display: none; }\n\n .fly-file-upload__dropzone {\n display: flex; flex-direction: column; align-items: center; justify-content: center;\n gap: 6px; padding: 20px; border: 2px dashed var(--separator-primary, #e5e7eb);\n border-radius: 10px; background: var(--fill-quaternary, #f9fafb); cursor: pointer;\n transition: border-color 0.15s, background 0.15s;\n }\n .fly-file-upload__dropzone:hover,\n .fly-file-upload__dropzone--drag { border-color: var(--accent-primary, #0071e3); background: var(--fill-tertiary, #f3f4f6); }\n .fly-file-upload__icon { font-size: 24px; color: var(--label-tertiary, #9ca3af); }\n .fly-file-upload__label { font-size: 13px; color: var(--label-secondary, #6b7280); }\n .fly-file-upload__hint { font-size: 11px; color: var(--label-tertiary, #9ca3af); }\n\n .fly-file-upload__error { font-size: 12px; color: var(--system-red, #ef4444); padding: 4px 0; }\n\n .fly-file-upload__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }\n .fly-file-upload__item {\n display: flex; align-items: center; gap: 10px; padding: 8px 12px;\n border: 1px solid var(--separator-primary, #e5e7eb); border-radius: 8px;\n background: var(--fill-quaternary, #f9fafb); font-size: 13px;\n }\n .fly-file-upload__file-icon { font-size: 18px; color: var(--label-tertiary, #9ca3af); flex-shrink: 0; }\n .fly-file-upload__file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }\n .fly-file-upload__file-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--label-primary, #1f2937); }\n .fly-file-upload__file-size { font-size: 11px; color: var(--label-tertiary, #9ca3af); }\n\n .fly-file-upload__progress-track { width: 60px; height: 4px; border-radius: 2px; background: var(--fill-tertiary, #e5e7eb); overflow: hidden; }\n .fly-file-upload__progress-fill { height: 100%; background: var(--accent-primary, #0071e3); border-radius: 2px; transition: width 0.2s; }\n\n .fly-file-upload__file-ok { color: var(--system-green, #22c55e); font-size: 14px; }\n .fly-file-upload__file-error { color: var(--system-red, #ef4444); font-size: 14px; }\n\n .fly-file-upload__remove-btn {\n background: none; border: none; cursor: pointer; color: var(--label-tertiary, #9ca3af);\n width: 24px; height: 24px; display: flex; align-items: center; justify-content: center;\n border-radius: 4px; transition: color 0.15s, background 0.15s; flex-shrink: 0;\n }\n .fly-file-upload__remove-btn:hover { color: var(--system-red, #ef4444); background: var(--fill-tertiary, #f3f4f6); }\n `],\n})\nexport class FlyFileUploadComponent {\n private http = inject(HttpClient);\n\n // ── Inputs ──\n maxFiles = input(5);\n maxFileSizeBytes = input(5 * 1024 * 1024);\n accept = input('');\n sourceApp = input('unknown');\n sourceEntityType = input<string | null>(null);\n sourceEntityId = input<string | null>(null);\n\n /** Optional: provide file IDs to auto-fetch metadata for pre-existing files (edit mode). */\n existingFileIds = input<string[] | null>(null);\n\n /** Two-way model for completed file metadata. */\n files = model<FlyFileInfo[]>([]);\n\n // ── Outputs ──\n filesChanged = output<FlyFileInfo[]>();\n\n // ── State ──\n error = signal<string | null>(null);\n dragging = signal(false);\n slots = signal<UploadSlot[]>([]);\n\n /** Pre-existing files loaded from the entity (before any new uploads this session). */\n existingFiles = signal<FlyFileInfo[]>([]);\n\n fileInput = viewChild<ElementRef<HTMLInputElement>>('fileInput');\n\n constructor() {\n // Auto-fetch metadata for existing file IDs (edit mode)\n effect((onCleanup) => {\n const ids = this.existingFileIds();\n if (!ids?.length) return;\n\n const subs = ids.map(id =>\n this.http.get<{ data: FlyFileInfo }>(`/api/files/${id}`).subscribe({\n next: (res) => {\n const info = res.data ?? (res as any);\n if (info?.id) {\n this.existingFiles.update(list =>\n list.some(f => f.id === info.id) ? list : [...list, info]\n );\n this.files.update(list =>\n list.some(f => f.id === info.id) ? list : [...list, info]\n );\n }\n },\n })\n );\n onCleanup(() => subs.forEach(s => s.unsubscribe()));\n });\n }\n\n allSlots = computed(() => this.slots());\n\n canAddMore = computed(() => {\n const current = this.files().length + this.slots().filter(s => s.status === 'uploading').length;\n return current < this.maxFiles();\n });\n\n limitHint = computed(() => {\n const mb = this.maxFileSizeBytes() / (1024 * 1024);\n return `Max ${this.maxFiles()} files, ${mb}MB each`;\n });\n\n triggerFileInput(): void {\n this.fileInput()?.nativeElement.click();\n }\n\n onDragOver(e: DragEvent): void {\n e.preventDefault();\n e.stopPropagation();\n this.dragging.set(true);\n }\n\n onDragLeave(e: DragEvent): void {\n e.preventDefault();\n this.dragging.set(false);\n }\n\n onDrop(e: DragEvent): void {\n e.preventDefault();\n e.stopPropagation();\n this.dragging.set(false);\n const fileList = e.dataTransfer?.files;\n if (fileList) this.processFiles(Array.from(fileList));\n }\n\n onFilesSelected(e: Event): void {\n const input = e.target as HTMLInputElement;\n if (input.files) this.processFiles(Array.from(input.files));\n input.value = '';\n }\n\n removeSlot(slot: UploadSlot): void {\n this.slots.update(s => s.filter(x => x !== slot));\n if (slot.info) {\n this.files.update(f => f.filter(x => x.id !== slot.info!.id));\n this.filesChanged.emit(this.files());\n }\n }\n\n removeExisting(f: FlyFileInfo): void {\n this.existingFiles.update(list => list.filter(x => x.id !== f.id));\n this.files.update(list => list.filter(x => x.id !== f.id));\n this.filesChanged.emit(this.files());\n }\n\n iconFor(slot: UploadSlot): string { return iconForType(slot.file.type); }\n iconForInfo(f: FlyFileInfo): string { return iconForType(f.contentType); }\n formatFileSize(bytes: number): string { return formatSize(bytes); }\n\n private processFiles(newFiles: File[]): void {\n this.error.set(null);\n const currentCount = this.files().length + this.slots().filter(s => s.status === 'uploading').length;\n const remaining = this.maxFiles() - currentCount;\n\n if (remaining <= 0) {\n this.error.set(`Maximum ${this.maxFiles()} files allowed`);\n return;\n }\n\n const toUpload = newFiles.slice(0, remaining);\n if (newFiles.length > remaining) {\n this.error.set(`Only ${remaining} more file(s) can be added`);\n }\n\n for (const file of toUpload) {\n if (file.size > this.maxFileSizeBytes()) {\n const mb = this.maxFileSizeBytes() / (1024 * 1024);\n this.error.set(`\"${file.name}\" exceeds ${mb}MB limit`);\n continue;\n }\n this.uploadFile(file);\n }\n }\n\n private uploadFile(file: File): void {\n const slot: UploadSlot = { file, progress: 0, status: 'uploading' };\n this.slots.update(s => [...s, slot]);\n\n const formData = new FormData();\n formData.append('file', file, file.name);\n formData.append('sourceApp', this.sourceApp());\n if (this.sourceEntityType()) formData.append('sourceEntityType', this.sourceEntityType()!);\n if (this.sourceEntityId()) formData.append('sourceEntityId', this.sourceEntityId()!);\n\n this.http.post<{ data: FlyFileInfo }>('/api/files/upload', formData, {\n reportProgress: true,\n observe: 'events',\n }).subscribe({\n next: (event) => {\n if (event.type === HttpEventType.UploadProgress && event.total) {\n slot.progress = Math.round((event.loaded / event.total) * 100);\n this.slots.update(s => [...s]); // trigger signal change\n } else if (event.type === HttpEventType.Response) {\n const info = (event.body as any)?.data ?? event.body;\n slot.status = 'done';\n slot.progress = 100;\n slot.info = info;\n this.slots.update(s => [...s]);\n this.files.update(f => [...f, info]);\n this.filesChanged.emit(this.files());\n }\n },\n error: (err) => {\n slot.status = 'error';\n slot.error = err?.error?.message ?? 'Upload failed';\n this.slots.update(s => [...s]);\n },\n });\n }\n}\n","import { Injectable, Signal, computed, signal } from '@angular/core';\nimport type {\n AgentCommandHandle,\n AgentCommandRegistration,\n} from '../../models/agent-input.model';\n\n/**\n * Singleton registry of slash commands offered by the agent input palette.\n *\n * Lives in the DS so it crosses the federation boundary as a single instance via\n * `sharedMappings: ['@mohamedatia/fly-design-system']`. Federated remotes register\n * their commands at boot (and dispose on window close) without forking the shell.\n *\n * Storage is a signal store. `register` is O(1) for the unique-id case and O(n) when\n * replacing an existing id (filter then push). The append-then-replace strategy is\n * deliberate: registrations are rare (each one corresponds to a remote's app-init\n * effect), and the tradeoff buys us a stable id-collision contract — the *latest*\n * registration wins, and the previous handle's `dispose()` becomes a no-op rather\n * than removing the new entry.\n */\n@Injectable({ providedIn: 'root' })\nexport class AgentCommandRegistry {\n private readonly _commands = signal<readonly AgentCommandRegistration[]>([]);\n /** All currently-registered commands, in insertion order. */\n readonly all: Signal<readonly AgentCommandRegistration[]> = this._commands.asReadonly();\n\n /**\n * Returns a signal of commands whose scope is `'global'` OR whose `scope.appId` is in\n * the live app set. The signal recomputes when either the registry or `liveAppIds`\n * changes — pass a `Signal<ReadonlySet<string>>` from the host's app-registry service\n * for reactive filtering.\n */\n visible(liveAppIds: ReadonlySet<string> | Signal<ReadonlySet<string>>): Signal<readonly AgentCommandRegistration[]> {\n const liveSignal = isSignal<ReadonlySet<string>>(liveAppIds) ? liveAppIds : signal(liveAppIds).asReadonly();\n return computed(() => {\n const live = liveSignal();\n return this._commands().filter((cmd) => {\n if (cmd.scope === 'global') return true;\n return live.has(cmd.scope.appId);\n });\n });\n }\n\n /**\n * Register a single command. Returns a handle whose `dispose()` removes the row by\n * id. If the same id is later re-registered, the original handle's `dispose()`\n * becomes a no-op (the newer registration owns the row). Idempotent disposal.\n */\n register(cmd: AgentCommandRegistration): AgentCommandHandle {\n const generation = ++this._generation;\n this._commands.update((rows) => [...rows.filter((r) => r.id !== cmd.id), cmd]);\n this._owners.set(cmd.id, generation);\n return {\n dispose: () => {\n if (this._owners.get(cmd.id) === generation) {\n this._owners.delete(cmd.id);\n this._commands.update((rows) => rows.filter((r) => r.id !== cmd.id));\n }\n },\n };\n }\n\n /**\n * Bulk register. Rolls back on duplicate id within the input batch (throws before any\n * row lands). Cross-batch duplicates against existing rows follow the standard\n * \"latest wins\" rule and do NOT trigger rollback.\n *\n * Returns a handle whose `dispose()` tears down every row registered by this call.\n */\n registerAll(cmds: readonly AgentCommandRegistration[]): AgentCommandHandle {\n const seen = new Set<string>();\n for (const c of cmds) {\n if (seen.has(c.id)) {\n throw new Error(`AgentCommandRegistry.registerAll: duplicate id \"${c.id}\" in batch`);\n }\n seen.add(c.id);\n }\n const handles = cmds.map((c) => this.register(c));\n let disposed = false;\n return {\n dispose: () => {\n if (disposed) return;\n disposed = true;\n for (const h of handles) h.dispose();\n },\n };\n }\n\n /** Tear down by id. Idempotent. */\n unregister(id: string): void {\n if (this._owners.delete(id)) {\n this._commands.update((rows) => rows.filter((r) => r.id !== id));\n }\n }\n\n /** Monotonic counter; identifies which registration call currently owns each id. */\n private _generation = 0;\n /** id → generation. Used so a stale handle's `dispose()` is a no-op after replacement. */\n private readonly _owners = new Map<string, number>();\n}\n\n/** `isSignal` shim — narrows to either `Signal<T>` or a plain value. */\nfunction isSignal<T>(v: T | Signal<T>): v is Signal<T> {\n return typeof v === 'function';\n}\n","import { Injectable, Signal, Type, signal, type WritableSignal } from '@angular/core';\nimport type {\n AgentChipHostInputs,\n AgentCommandHandle,\n AgentDraggableItem,\n AgentDropRendererRegistration,\n} from '../../models/agent-input.model';\n\n/**\n * Singleton registry of chip-renderer components and keyboard-alternative draggable\n * items, keyed by `kind` and `appId`.\n *\n * Like {@link AgentCommandRegistry}, this lives in the DS so it crosses the federation\n * boundary as a single instance. Hosts (the shell `<fly-agent-input>`) lookup\n * renderers; remotes register them.\n *\n * Renderer lookup is `O(n)` over the registered list — the registry is small (one or\n * two entries per app) and lookups happen on drop, not per frame.\n *\n * Draggable storage is per-`appId` writable signal cached in a Map, so each `appId`\n * gets a stable {@link Signal} reference across reads (callers can `===`-compare).\n */\n@Injectable({ providedIn: 'root' })\nexport class AgentDropRegistry {\n private readonly _renderers = signal<readonly AgentDropRendererRegistration[]>([]);\n /** Per-appId writable store for draggables. Read-only mirror returned to callers. */\n private readonly _draggablesByApp = new Map<string, WritableSignal<readonly AgentDraggableItem[]>>();\n\n /**\n * Look up the chip-renderer component class for a `kind`. The newest registration for\n * a given `kind` wins, regardless of `appId` — we scan the list in reverse so a later\n * `register` call shadows an earlier one for the same `kind`.\n *\n * Returns `null` when no renderer is registered; the host falls back to a generic\n * `plainTextFallback` chip.\n */\n rendererFor(kind: string): Type<AgentChipHostInputs> | null {\n const list = this._renderers();\n for (let i = list.length - 1; i >= 0; i--) {\n if (list[i].kind === kind) return list[i].component as Type<AgentChipHostInputs>;\n }\n return null;\n }\n\n /**\n * Register a renderer for a `(kind, appId)` pair. Re-registering the same pair\n * replaces the prior entry; the disposal handle for the prior registration becomes\n * a no-op.\n *\n * Returns a {@link AgentCommandHandle} (re-used to keep the disposable shape uniform\n * across registries) whose `dispose()` removes this exact registration.\n */\n register<T = unknown>(reg: AgentDropRendererRegistration<T>): AgentCommandHandle {\n const generation = ++this._generation;\n const key = compositeKey(reg.kind, reg.appId);\n this._renderers.update((rows) => [\n ...rows.filter((r) => compositeKey(r.kind, r.appId) !== key),\n reg as AgentDropRendererRegistration,\n ]);\n this._owners.set(key, generation);\n return {\n dispose: () => {\n if (this._owners.get(key) === generation) {\n this._owners.delete(key);\n this._renderers.update((rows) => rows.filter((r) => compositeKey(r.kind, r.appId) !== key));\n }\n },\n };\n }\n\n /**\n * Apps publish their live \"draggable from focused window\" set so the keyboard\n * \"Attach from app…\" menu can offer them. Hosts call this each time the user-visible\n * draggable list changes; passing an empty array clears the entry for this `appId`.\n */\n publishDraggables(appId: string, items: readonly AgentDraggableItem[]): void {\n if (items.length === 0) {\n const existing = this._draggablesByApp.get(appId);\n if (existing) existing.set([]);\n return;\n }\n this.bucketFor(appId).set(items);\n }\n\n /**\n * Reactive read of the draggable set published for `appId`. Empty when none. The\n * returned signal is stable across calls (cached by `appId`), so consumers can use\n * it as a stable input to `computed()`.\n */\n draggablesFor(appId: string): Signal<readonly AgentDraggableItem[]> {\n return this.bucketFor(appId).asReadonly();\n }\n\n /** Lazy-init the per-appId writable bucket. Returns the writable handle for internal use. */\n private bucketFor(appId: string): WritableSignal<readonly AgentDraggableItem[]> {\n let bucket = this._draggablesByApp.get(appId);\n if (!bucket) {\n bucket = signal<readonly AgentDraggableItem[]>([]);\n this._draggablesByApp.set(appId, bucket);\n }\n return bucket;\n }\n\n private _generation = 0;\n private readonly _owners = new Map<string, number>();\n}\n\nfunction compositeKey(kind: string, appId: string): string {\n return `${kind}::${appId}`;\n}\n","import type { AgentDragPayload } from './agent-input.model';\n\n/**\n * Imperative action published by an app, consumed by the agent panel.\n *\n * Re-uses {@link AgentDragPayload} as the wire envelope so a dragged item\n * and a programmatic \"Explain\" click are byte-for-byte the same shape —\n * renderers, validators, and serialisation paths never fork on transport.\n *\n * Adding a verb is a minor DS bump (consumers ignore unknown verbs in\n * their `switch`). Removing one is a major DS bump.\n */\nexport type AgentActionVerb =\n | 'explain' // narrate what the payload shows in plain language\n | 'why-empty' // payload is an empty-result envelope; explain the gap\n | 'compose-query' // payload is a dataset schema; emit a DatasetQuery JSON\n | 'compare' // payload is { a, b }; compare them\n | 'forecast' // payload is a time series; project forward\n | 'summarize'; // payload is multiple envelopes; one-paragraph synthesis\n\n/**\n * Whether the agent panel sends the staged payload immediately or stages\n * the chip for the user to edit and send manually.\n *\n * Phase 1 (DS v2.6.0) supports `'stage'` only. Dispatching with `'auto'`\n * throws {@link AgentActionUnsupportedDispatchError} so callers don't\n * silently fail. `'auto'` lands once `AgentInputComponent.programmaticSubmit`\n * is exposed and reviewed against the input's state machine.\n */\nexport type AgentActionDispatch = 'auto' | 'stage';\n\nexport interface AgentAction<T = unknown> {\n /** Intent the agent should apply to {@link payload}. */\n readonly verb: AgentActionVerb;\n /** The wire envelope. Validated against {@link validateAgentPayload}'s\n * size caps before the bus fans it out. */\n readonly payload: AgentDragPayload<T>;\n /** Optional slash command id to bind before send (e.g. `'explain-report'`).\n * Phase 1 captures this for telemetry only — actual binding lands when\n * the input's programmatic-send API ships. An unknown id is dropped\n * silently with a console warning, the chip still arrives. */\n readonly autoCommandId?: string;\n /** Phase 1 supports `'stage'` only. See {@link AgentActionDispatch}. */\n readonly dispatch: AgentActionDispatch;\n /** Source DOM rect for the FLIP entry animation. Omit to skip the\n * animation (e.g. dispatching from a keyboard shortcut with no anchor). */\n readonly originRect?: DOMRect;\n /** Optional HTML snippet rendered inside the flight ghost. Callers are\n * responsible for escaping untrusted text — the bus does not sanitise.\n * Defaults (when omitted) to a strong-wrapped escape of the payload's\n * `plainTextFallback` rendered by the panel host. */\n readonly originPreviewHtml?: string;\n}\n\n/**\n * Thrown synchronously by {@link AgentActionBus.dispatch} when a caller\n * supplies a dispatch mode this DS version doesn't implement yet. Catching\n * by class name lets a forward-compatible caller fall back to `'stage'`\n * without depending on instanceof across federation boundaries.\n */\nexport class AgentActionUnsupportedDispatchError extends Error {\n constructor(public readonly dispatch: AgentActionDispatch) {\n super(`AgentActionBus: dispatch=\"${dispatch}\" not supported in this DS version`);\n this.name = 'AgentActionUnsupportedDispatchError';\n }\n}\n","import type { Type } from '@angular/core';\n\n/**\n * Agent input contracts.\n *\n * These types define the wire and DI surface for the new `<fly-agent-input>` orchestrator\n * (Phase 2+). Phase 1 ships only the contracts: payload envelope, command/drop registry\n * shapes, and chip-host inputs. The concrete components consume them later.\n *\n * Design rules:\n * - All fields are `readonly` — the registries store these in signal stores and we never\n * want a host mutating after registration. Hosts construct fresh objects to update.\n * - The discriminated kinds (`scope`, `mode`, `kind`) carry the entire variance — no\n * boolean flags. New variants extend the union without breaking existing consumers.\n * - The `Type<AgentChipHostInputs<T>>` shape is intentional: chip components declare\n * `payload`, `mode`, optional `onRemove` as Angular `input()` signals; the registry\n * wires them via `NgComponentOutlet` inputs in the consumer. The component reference\n * itself never leaks across the federation boundary by value — only by class identity.\n */\n\n/** Frozen MIME used by `flyAgentDraggable` and the drop-zone reader. Never change without a DS major. */\nexport const AGENT_DRAG_MIME = 'application/x-fly-agent-payload+json' as const;\n\n/**\n * Frozen payload envelope version.\n *\n * v1 — minimal drag payload: kind / appId / version / payload / plainTextFallback /\n * suggestedCommandIds. Still used by the drag/drop surface.\n *\n * v2 — bus envelope ({@link AgentMessageEnvelope}). Adds optional `userMessage`,\n * `systemContext`, `attachments`, `mcpScope` so a dispatcher can give the agent\n * rich context without polluting the user-visible message bubble. v2 is a\n * superset of v1 — every v1 payload is a valid v2 payload — so the version\n * number ratchets forward without breaking existing callers.\n */\nexport const AGENT_PAYLOAD_VERSION = 2 as const;\n\n/**\n * Versions accepted by the validator. v1 payloads (the drag/drop surface) remain valid;\n * v2 adds the optional bus-envelope fields. Renderers narrow on `version` when they need\n * to.\n */\nexport const SUPPORTED_AGENT_PAYLOAD_VERSIONS: readonly number[] = Object.freeze([1, 2]);\n\n// ─── Commands ───────────────────────────────────────────────────────────────\n\n/**\n * Where a command surfaces. `'global'` = always offered. `{ appId }` = offered only when\n * the host's live `liveAppIds` set (passed to {@link AgentCommandRegistry.visible}) contains\n * that id. This lets a remote register its slash command at boot but only have it appear\n * in the palette while at least one of the remote's windows is open.\n */\nexport type AgentCommandScope = 'global' | { readonly appId: string };\n\n/**\n * A slash command offered by the agent input palette. Commands are deliberately shallow\n * descriptors — the host (shell) decides what happens on Send. The descriptor's role is\n * to make the palette row renderable (icon, label, kbd hint, app badge) and matchable\n * (id, aliases, drop-kind suggestions) without coupling DS to any business logic.\n */\nexport interface AgentCommand {\n /** Stable id, kebab-case. Becomes the slash text after `/`, e.g. `/analyze-trend`. */\n readonly id: string;\n /** i18n key for the visible label, e.g. `agent.command.analyze_trend.label`. */\n readonly labelKey: string;\n /** i18n key for an optional sublabel / description shown beneath the label. */\n readonly descriptionKey?: string;\n /** PrimeIcons class, e.g. `pi-chart-line`. */\n readonly icon?: string;\n /** App badge label key — appears as a small tag, e.g. `agent.command.app_badge.circles`. */\n readonly appBadgeKey?: string;\n /** Optional kbd hint i18n key. */\n readonly kbdHintKey?: string;\n /** When the command is keyword-matched against drop payload kinds, list those kinds here. */\n readonly suggestForDropKinds?: readonly string[];\n /** Extra match terms beyond id + label, used by the fuzzy filter. */\n readonly aliases?: readonly string[];\n /** When `'send'`, the command is inserted as a bound prefix and executed on Send. */\n readonly executeOn: 'send';\n /** Optional client-side gate. Return false to hide the command in this scope. */\n readonly isVisible?: () => boolean;\n /**\n * Category B (PR3): when present, selecting this command invokes a\n * manifest-declared app skill instead of sending the composed text as a plain\n * message. The host dispatches a Twin message carrying\n * `system_context.slash_command_key = slashCommand.key` plus resolved context.\n * See {@link AgentCommandSlashSpec}.\n */\n readonly slashCommand?: AgentCommandSlashSpec;\n}\n\n/**\n * A context binding that resolves one `system_context` value for a Category B\n * command at dispatch. Pure data so it travels app-agnostically in the\n * Controller's app federation metadata (no callbacks). Discriminated by `from`:\n *\n * - `route` — value from the owning app's current route param `path`. The\n * shell cannot read a federated remote's internal route, so route\n * bindings **degrade** in v1 (the skill asks for the missing id);\n * resolved only once a remote→shell route channel exists.\n * - `lookup` — the host opens the `/lookup` entity picker for `entity` and\n * writes the picked id into `system_context[key]` (picker-during-\n * dispatch is a v1 follow-up — degrades to \"ask\" until then).\n * - `constant` — a literal value written into `system_context[key]`.\n */\nexport type AgentCommandContextBinding =\n | { readonly key: string; readonly from: 'route'; readonly path: string }\n | {\n readonly key: string;\n readonly from: 'lookup';\n readonly entity: string;\n readonly exclude?: readonly string[];\n readonly promptKey?: string;\n }\n | { readonly key: string; readonly from: 'constant'; readonly value: string };\n\n/**\n * Category B slash-command dispatch metadata (PR3). Travels app-agnostically in\n * the Controller's app federation metadata and is registered by the shell's\n * `RemoteManifestService` (the same path that registers `/lookup` descriptors) —\n * remotes do NOT self-register. When an {@link AgentCommand} carries this,\n * selecting it dispatches a Twin message with `system_context.slash_command_key\n * = key`, merged with the resolved `contextBindings`.\n */\nexport interface AgentCommandSlashSpec {\n /** Dispatched as `system_context.slash_command_key`; matches the agents-side\n * skill's `slash_command_key` (= its manifest_key). */\n readonly key: string;\n /** Reserved: a future confirm step before dispatch (manifest `requiresConfirmation`). */\n readonly requiresConfirmation?: boolean;\n /** Parameter sources resolved into `system_context` at dispatch. */\n readonly contextBindings?: readonly AgentCommandContextBinding[];\n}\n\n/** What hosts pass to {@link AgentCommandRegistry.register}. Adds the scope to {@link AgentCommand}. */\nexport interface AgentCommandRegistration extends AgentCommand {\n readonly scope: AgentCommandScope;\n}\n\n/** Disposable handle returned by {@link AgentCommandRegistry.register}. Idempotent `dispose()`. */\nexport interface AgentCommandHandle {\n dispose(): void;\n}\n\n// ─── Entity lookups (the `/lookup` typeahead) ─────────────────────────────────\n\n/**\n * How a lookup fetches candidate entities. The picker calls the app's existing\n * authenticated REST search endpoint (the same one the agent's MCP `*_list_brief`\n * tool wraps) through the shell's HttpClient — gateway routing + auth\n * interceptor apply. We deliberately do NOT route typeahead through MCP (agent-\n * shaped, agent-auth) or the dataset executor (aggregation-shaped, no fulltext).\n *\n * Field mapping is declarative because entities differ: Circles trends/signals\n * expose `/brief` endpoints returning `{ id, title, status }`, while scenarios\n * have no brief variant and return full objects with `titleEn` / `titleAr`. The\n * `displayField` / `secondaryField` indirection absorbs that per-entity skew so\n * one picker component serves them all.\n */\nexport interface LookupSearch {\n /**\n * Relative REST path the picker GETs, e.g. `/api/circles/trends/brief`. Must\n * be a relative path (no scheme/host) — the SSRF guard at onboard time (when\n * the descriptor is manifest-backed) and the picker both reject absolute URLs.\n */\n readonly endpoint: string;\n /** Query param carrying the typed text, e.g. `search`. */\n readonly queryParam: string;\n /** Static query params merged into every request, e.g. `{ pageSize: '10' }`. */\n readonly extraParams?: Readonly<Record<string, string>>;\n /** Response-item field holding the entity id. Default `id`. */\n readonly idField?: string;\n /** Response-item field holding the display label, e.g. `title` / `titleEn`. */\n readonly displayField: string;\n /** Optional response-item field for the chip's secondary line (status, category). */\n readonly secondaryField?: string;\n /**\n * Optional response-item field whose value is a *row-level* app id — i.e. the\n * app that owns this individual entity, distinct from the descriptor's\n * {@link LookupDescriptor.appId} (which only names the app exposing the\n * lookup endpoint). Help articles are the motivating case: every article is\n * exposed by `help-center`, but each one was seeded by a *source* app's\n * manifest (Circles, Trends, …). Surfacing that per-row appId lets the\n * picker render a second source-app tag so the user can tell two\n * similarly-titled rows from different source apps apart at a glance.\n *\n * Resolved through {@link LookupResult.appId} and the shell's app registry\n * with the same fallback chain used for {@link LookupDescriptor.appId}.\n */\n readonly appIdField?: string;\n /**\n * Dotted path to the results array within the response body when it is\n * wrapped, e.g. `items` for `{ items: [...], total }`. Omit when the response\n * body IS the array.\n */\n readonly resultsPath?: string;\n}\n\n/**\n * A lookupable entity offered by the `/lookup` palette. Registered by the owning\n * app (a federation remote self-registers at boot, mirroring {@link AgentCommand})\n * or, once manifest-backed, projected from the app's `lookups[]` manifest section.\n *\n * The descriptor is a shallow, business-logic-free descriptor: it tells the\n * picker WHAT to search, WHERE it is offered, and HOW to map the response — the\n * picker owns the typeahead UX, the shell owns the HTTP call.\n */\nexport interface LookupDescriptor {\n /**\n * Stable entity key, kebab/lower, e.g. `scenario`. Doubles as the `/lookup\n * <entity>` sub-token and the group key the picked ref is grouped under when\n * serialized for the agent.\n */\n readonly entity: string;\n /** i18n key for the entity's display name in the picker / palette. */\n readonly labelKey: string;\n /** Optional PrimeIcons class for the picker row + chip. */\n readonly icon?: string;\n /**\n * Stable id of the app that exposes this lookup, e.g. `notes`, `calendar`,\n * `circles`. The picker resolves it to the app's display name via the shell's\n * app registry and renders an \"exposed by …\" badge so the user can see which\n * app owns the entity they're browsing (helps disambiguate when two apps\n * register a similar-sounding entity, e.g. both Tasks and Notes one day).\n *\n * Populated automatically by the shell's registration paths:\n * - `CORE_APP_LOOKUPS` stamps it per descriptor at hand-edit time.\n * - `RemoteManifestService` stamps it from the manifest entry's `id` so\n * federation remotes don't have to repeat the id in every descriptor.\n *\n * Falls back to {@link appBadgeKey} (a locale-resolved literal) when an\n * entity has no first-class home in the shell's app registry — e.g. `user`,\n * `app-agent`, `robot`. When neither is set the picker omits the badge.\n */\n readonly appId?: string;\n /**\n * Optional i18n key the picker uses for the \"exposed by …\" badge **when\n * {@link appId} is absent or unknown to the shell's app registry**. Lets\n * entities that don't map to a single app (Users, Robots, App Agents) still\n * surface a meaningful badge instead of silently omitting it. The picker\n * resolves the key via the shared i18n service so the badge follows the\n * user's locale.\n */\n readonly appBadgeKey?: string;\n /**\n * Advisory MCP tool-key prefixes the agent should prefer when the user\n * references this entity via `/lookup` (e.g. `['dashboard.reports']`). The\n * shell folds these into the turn's `mcp_scope` so the Twin self-serves the\n * owning app's tools — fetching and analysing the referenced entity itself —\n * instead of defaulting to a specialist-Robot consult for \"tell me more\"\n * style prompts. Same dot-namespaced prefix vocabulary as\n * {@link AgentMcpScope.apis}. Omit for entities with no first-class MCP tool\n * family (e.g. `user`, `robot`).\n */\n readonly mcpApis?: readonly string[];\n /**\n * Optional in-app deep-link route TEMPLATE for this entity's detail page,\n * e.g. `'/signals/{id}'`. When present, the desktop shell turns an agent's\n * inline reference to this entity — the `flyos:<appId>.<entity>/<id>`\n * anchors the agents backend emits in chat answers — into a launchable\n * link: the single `{id}` placeholder is substituted with the referenced\n * entity's id (URL-encoded) and the owning {@link appId} is launched on\n * that route via the shell launcher.\n *\n * Omit for entities with no standalone detail page — their references then\n * render as plain text (graceful degrade; never a dead link). The owning\n * app declares this once in its `lookups[]` manifest entry, so a remote\n * becomes agent-deep-linkable without any shell or design-system change.\n * Only `{id}` is substituted here — richer parameterisation rides the\n * deep-link `params` channel, not this template.\n */\n readonly deepLinkRoute?: string;\n /** How to fetch + map candidates. */\n readonly search: LookupSearch;\n}\n\n/** What hosts pass to the lookup registry. Adds the scope to {@link LookupDescriptor}. */\nexport interface LookupRegistration extends LookupDescriptor {\n /**\n * Affinity hint, NOT a visibility gate.\n *\n * Unlike {@link AgentCommandScope} — where `{appId}` HIDES a command unless the\n * app is live — lookup scope is a *priority hint*. Every registered lookup is\n * always offered in `/lookup`; when the app named by `{appId}` is in the host's\n * live app set, that lookup sorts to the **top** of the entity picker so the\n * \"what am I working on right now?\" entities surface first. `'global'` lookups\n * have no affinity and sort after app-affinity matches.\n *\n * Rationale: OS-core entities (note, calendar event, file) are always\n * referenceable — there's no \"open the app first\" condition the way there is\n * for federated remotes — so a visibility gate would just produce a confusing\n * empty state. Affinity-as-sort preserves the \"Circles is open → prefer\n * scenarios/trends/signals\" intuition without hiding the rest.\n */\n readonly scope: AgentCommandScope;\n}\n\n/** One resolved row the picker returns once the user selects a candidate. */\nexport interface LookupResult {\n /** The entity kind (echoes {@link LookupDescriptor.entity}). */\n readonly entity: string;\n /** Selected entity id. */\n readonly id: string;\n /** Selected entity's display label. */\n readonly label: string;\n /** Optional secondary detail (status / category). */\n readonly secondary?: string;\n /**\n * Row-level source app id (e.g. `circles` for an article seeded by Circles'\n * manifest). Populated when the descriptor sets {@link LookupSearch.appIdField}\n * and the response item carries a non-empty value. The picker renders it as\n * a second app tag alongside the descriptor-level badge so the user can see\n * \"this Help-Center article was contributed by Circles\" without opening it.\n */\n readonly appId?: string;\n}\n\n/** Disposable handle returned by the lookup registry. Idempotent `dispose()`. */\nexport interface LookupHandle {\n dispose(): void;\n}\n\n// ─── Drag payloads ──────────────────────────────────────────────────────────\n\n/**\n * The wire envelope used by both the drag/drop surface and the imperative\n * {@link AgentActionBus}. Renderers narrow on `kind`; mismatches fall back to\n * `plainTextFallback`.\n *\n * The base fields (v1) describe **what** is being handed to the agent panel.\n * The v2 fields describe **how the agent should treat it** — `userMessage`\n * scopes the user-visible bubble, `systemContext` extends the system prompt,\n * `attachments` decorate the message with typed chips, and `mcpScope` hints\n * the agent toward a tool family. All v2 fields are optional so existing\n * v1 (drag/drop) payloads remain valid envelopes.\n *\n * Caps (see {@link AgentPayloadLimits}):\n * - JSON total 32 KB\n * - plainTextFallback 8 KB\n * - per-string field 4 KB\n * - userMessage 280 chars\n * - systemContext 32 entries × 4 KB per value, 8 KB total serialized\n * - attachments 4 entries, kind-dependent inner caps\n * - mcpScope.apis 5 prefixes × 128 chars\n *\n * The cap math is split per-section so an oversize attachment fails fast at the\n * attachment site instead of the whole envelope; field paths are dotted (see\n * {@link AgentPayloadValidationResult}).\n */\nexport interface AgentDragPayload<T = unknown> {\n /** Domain-stable kind, e.g. `circles.trend`. */\n readonly kind: string;\n /** Originating appId. Must match an entry in the host's app registry. */\n readonly appId: string;\n /** Frozen format version. Accepted: 1 or {@link AGENT_PAYLOAD_VERSION} (2). */\n readonly version: number;\n /** Domain object. Renderers narrow on `kind`. */\n readonly payload: T;\n /** Plain-text fallback written to the dataTransfer alongside the typed MIME. */\n readonly plainTextFallback: string;\n /** Optional command ids to highlight when this payload is dropped. */\n readonly suggestedCommandIds?: readonly string[];\n\n // ── v2 — bus envelope fields (all optional; ignored by drag/drop) ──────────\n\n /**\n * Short, locale-resolved string the dispatcher wants shown in the user's\n * chat bubble. The agent panel uses it as the visible message text; when\n * absent, the panel falls back to a generic per-verb default\n * (e.g. \"Tell me more about this\"). Cap 280 chars — chip-sized, not essay.\n *\n * This is the ONLY field that should ever surface to the user verbatim.\n * Everything else (systemContext, attachment bodies, mcpScope) is wire-only.\n */\n readonly userMessage?: string;\n\n /**\n * Flat key→string facts the dispatcher wants injected into the agent's\n * system prompt for this turn. Keys are dot-namespaced (e.g.\n * `chart.name`, `chart.type`, `chart.dimension`) to keep the model's\n * mental schema flat and grep-friendly. Values are strings — booleans,\n * numbers, and dates must be pre-serialized at the call site so the\n * dispatcher owns the formatting (timezone, locale, number style).\n *\n * Cap: 32 entries, 4 KB per value, 8 KB total when serialized.\n *\n * NOT user-visible. The agent panel may transiently embed this as an\n * `[Internal context]` block in the wire content while the backend\n * learns to consume the dedicated field, but never renders it in the\n * user bubble.\n */\n readonly systemContext?: Readonly<Record<string, string>>;\n\n /**\n * Typed attachments rendered as a chip strip under the user's outgoing\n * message bubble. Each entry has a `kind` discriminator and a `label`\n * (locale-resolved by the dispatcher). v2 ships `json` + `text`;\n * `image` and `file` are reserved — their interfaces are stable so\n * future callers don't need a contract bump, but the panel may render\n * a generic chip for them until per-kind renderers land.\n *\n * Cap: 4 entries per envelope. Per-kind body caps:\n * - json: 16 KB serialized\n * - text: 8 KB UTF-8\n * - image / file: dataUrl ≤ 32 KB (small previews; large media stays in\n * the files-manager and is referenced by id)\n */\n readonly attachments?: readonly AgentEnvelopeAttachment[];\n\n /**\n * Advisory MCP scope. The agent service injects these prefixes into the\n * system prompt as a tool-selection hint (\"prefer tools matching\n * `dashboard.reports.*` for this turn\") — NOT a hard filter. The agent\n * remains free to pick any tool; this just biases the first guess so a\n * dashboard explain doesn't waste a tool-call probing Notes APIs first.\n *\n * Cap: 5 prefixes × 128 chars. Prefixes should match gateway-aggregated\n * OpenAPI tag/path roots so they line up with the names the MCP server\n * exposes — see `src/backend/gateway` Swagger aggregation + the dynamic\n * loader in `src/backend/mcp-server`.\n */\n readonly mcpScope?: AgentMcpScope;\n\n /**\n * Optional deep-link route the originating app can use to re-open the\n * source object. When set, payload chips (and any other renderer that\n * surfaces the envelope to the user) become clickable — clicking calls\n * `ShellLauncherService.launch({ appId, route: deepLinkRoute })` so the\n * target app opens / focuses and navigates to the originating object.\n *\n * Shape constraints (mirror `DeepLinkService.isValidRoute`):\n * - starts with `/`\n * - ≤ {@link AgentPayloadLimits.maxDeepLinkRouteBytes} bytes (default\n * 1024) — matches the route limit on the wider shell deep-link\n * contract so this field can be handed straight to the launcher.\n * - no `..` segments\n * - no `//` runs\n * - no scheme-like prefixes (`/javascript:`, `/data:`, `/http:`, `/https:`)\n *\n * The DS validator enforces only the byte cap — full route syntax\n * validation is owned by the shell side (`DeepLinkService`) because the\n * DS package is shell-agnostic and shouldn't grow a second copy of the\n * URL grammar. Apps building envelopes are expected to stamp routes that\n * match their own internal route schema (e.g. dashboard publishes\n * `/reports/{id}` and `/custom/{id}`); see `skills/cross-app-deep-linking.md`.\n *\n * Backwards-compat: absent on v1 payloads and on v2 payloads built\n * before this field was added. Persisted JSONB chips without the field\n * remain non-clickable; new chips light up automatically.\n */\n readonly deepLinkRoute?: string;\n}\n\n/**\n * Canonical name for the bus-side envelope. v2 callers should reference this\n * over {@link AgentDragPayload} for clarity — the underlying shape is\n * identical, but the name signals \"this is going to the agent, not to a\n * drop zone.\" The alias is intentional: one wire shape, two semantic uses.\n */\nexport type AgentMessageEnvelope<T = unknown> = AgentDragPayload<T>;\n\n/**\n * Typed attachment discriminator for {@link AgentDragPayload.attachments}.\n *\n * - `json` — structured data the panel renders as a \"code-ish\" chip the\n * user can expand. Used for chart snapshots, query results, etc.\n * - `text` — short utterance / excerpt with optional MIME. Used when the\n * dispatcher wants the chip to preview a note paragraph, log line,\n * code snippet, etc.\n * - `image` / `file` — reserved. Stable interface; renderers added per\n * downstream caller (the panel may fall back to a generic icon-chip).\n *\n * Every kind carries `label` — that's what shows on the chip face and what\n * a11y trees announce.\n */\nexport type AgentEnvelopeAttachment =\n | {\n readonly kind: 'json';\n readonly label: string;\n readonly json: unknown;\n }\n | {\n readonly kind: 'text';\n readonly label: string;\n readonly text: string;\n readonly mimeType?: string;\n }\n | {\n readonly kind: 'image';\n readonly label: string;\n /** `data:` URL — small previews only. Large media stays in files-manager. */\n readonly dataUrl: string;\n readonly mimeType: string;\n }\n | {\n readonly kind: 'file';\n readonly label: string;\n readonly dataUrl: string;\n readonly mimeType: string;\n readonly bytes: number;\n };\n\n/** Advisory tool-selection hint for {@link AgentDragPayload.mcpScope}. */\nexport interface AgentMcpScope {\n /**\n * Prefixes of gateway-aggregated OpenAPI tags / path roots — e.g.\n * `dashboard.reports`, `notes.documents`. The agent service treats these\n * as a soft preference, not a hard filter.\n */\n readonly apis: readonly string[];\n}\n\n/**\n * Where a chip is being rendered. `inline` = inside the input chip tray (removable);\n * `message` = embedded in a sent message bubble (not removable).\n */\nexport type AgentDropChipMode = 'inline' | 'message';\n\n/**\n * Public input shape for chip-renderer components. Components declare matching\n * `input()` signals; the registry wires them via `NgComponentOutlet`.\n */\nexport interface AgentChipHostInputs<T = unknown> {\n payload: AgentDragPayload<T>;\n mode: AgentDropChipMode;\n /** Called when the user clicks the chip's remove control (only in inline mode). */\n onRemove?: () => void;\n}\n\n/**\n * Keyboard-alternative draggable item. Hosts publish these via\n * {@link AgentDropRegistry.publishDraggables} so the \"Attach from app…\" menu can offer\n * them when pointer drag isn't available.\n */\nexport interface AgentDraggableItem<T = unknown> {\n /** Stable id within its app. Used as a list key in the kbd menu. */\n readonly id: string;\n readonly labelKey: string;\n readonly icon?: string;\n /** Builds the payload the moment the user picks the item. */\n build(): AgentDragPayload<T>;\n}\n\n/** Registry input shape for binding a chip-renderer component to a kind+appId pair. */\nexport interface AgentDropRendererRegistration<T = unknown> {\n readonly kind: string;\n readonly appId: string;\n readonly component: Type<AgentChipHostInputs<T>>;\n}\n\n// ─── Payload guards ─────────────────────────────────────────────────────────\n\n/**\n * Caps applied by {@link validateAgentPayload} / {@link trimAgentPayload}. The defaults\n * trade off \"fits comfortably in a single MQ frame\" against \"covers a richly-populated\n * trend or note card\". Hosts may pass a partial override.\n */\nexport interface AgentPayloadLimits {\n /** Cap on the JSON.stringify(envelope) byte length. Default 32 KB. */\n readonly maxJsonBytes: number;\n /** Cap on the plainTextFallback byte length. Default 8 KB. */\n readonly maxPlainTextFallbackBytes: number;\n /** Cap on any single string field inside payload (recursive). Default 4 KB. */\n readonly maxStringFieldBytes: number;\n\n // ── v2 — bus envelope caps ────────────────────────────────────────────────\n\n /** Cap on `userMessage` UTF-8 byte length. Default 280 chars (~1.1 KB). */\n readonly maxUserMessageBytes: number;\n /** Max entries in `systemContext`. Default 32. */\n readonly maxSystemContextEntries: number;\n /** Cap on any single systemContext value's UTF-8 byte length. Default 4 KB. */\n readonly maxSystemContextValueBytes: number;\n /** Cap on the full JSON.stringify(systemContext). Default 8 KB. */\n readonly maxSystemContextJsonBytes: number;\n /** Max attachments per envelope. Default 4. */\n readonly maxAttachments: number;\n /** Cap on a `json` attachment's serialized body. Default 16 KB. */\n readonly maxAttachmentJsonBytes: number;\n /** Cap on a `text` attachment's body bytes. Default 8 KB. */\n readonly maxAttachmentTextBytes: number;\n /** Cap on an `image` / `file` attachment's dataUrl bytes. Default 32 KB. */\n readonly maxAttachmentDataUrlBytes: number;\n /** Max prefixes in `mcpScope.apis`. Default 5. */\n readonly maxMcpScopeApis: number;\n /** Cap on any single mcpScope prefix string. Default 128 chars. */\n readonly maxMcpScopeApiBytes: number;\n /**\n * Cap on `deepLinkRoute` UTF-8 byte length. Default 1024 bytes — matches\n * the route limit on `DeepLinkService.isValidRoute` so this field can be\n * handed straight to the shell launcher without a second resize.\n */\n readonly maxDeepLinkRouteBytes: number;\n}\n\nexport const DEFAULT_AGENT_PAYLOAD_LIMITS: AgentPayloadLimits = Object.freeze({\n maxJsonBytes: 32 * 1024,\n maxPlainTextFallbackBytes: 8 * 1024,\n maxStringFieldBytes: 4 * 1024,\n maxUserMessageBytes: 280 * 4, // 280 chars × 4 bytes/char worst-case UTF-8\n maxSystemContextEntries: 32,\n maxSystemContextValueBytes: 4 * 1024,\n maxSystemContextJsonBytes: 8 * 1024,\n maxAttachments: 4,\n maxAttachmentJsonBytes: 16 * 1024,\n maxAttachmentTextBytes: 8 * 1024,\n maxAttachmentDataUrlBytes: 32 * 1024,\n maxMcpScopeApis: 5,\n maxMcpScopeApiBytes: 128,\n maxDeepLinkRouteBytes: 1024,\n});\n\n/**\n * Stable failure reasons emitted by {@link validateAgentPayload}.\n * - `invalid_version` — `version` !== {@link AGENT_PAYLOAD_VERSION}.\n * - `invalid_kind` — `kind` is empty / not a string.\n * - `field_too_large` — a string field inside `payload` exceeds `maxStringFieldBytes`.\n * - `fallback_too_large` — `plainTextFallback` exceeds `maxPlainTextFallbackBytes`.\n * - `json_too_large` — the full JSON.stringify(envelope) exceeds `maxJsonBytes`.\n */\nexport type AgentPayloadValidationResult =\n | { readonly ok: true }\n | {\n readonly ok: false;\n readonly reason:\n | 'json_too_large'\n | 'fallback_too_large'\n | 'field_too_large'\n | 'invalid_version'\n | 'invalid_kind'\n // v2:\n | 'user_message_too_large'\n | 'system_context_too_many_entries'\n | 'system_context_value_too_large'\n | 'system_context_json_too_large'\n | 'too_many_attachments'\n | 'attachment_invalid_kind'\n | 'attachment_json_too_large'\n | 'attachment_text_too_large'\n | 'attachment_data_url_too_large'\n | 'mcp_scope_too_many_apis'\n | 'mcp_scope_api_too_large'\n | 'deep_link_route_too_large'\n | 'deep_link_route_invalid_shape';\n /** Dotted property-access path to the offending field, e.g. `payload.title` or `payload.tags[2]`. NOT RFC 6901 JSON Pointer. */\n readonly fieldPath?: string;\n readonly actualBytes?: number;\n readonly limitBytes?: number;\n };\n","import {\n DEFAULT_AGENT_PAYLOAD_LIMITS,\n SUPPORTED_AGENT_PAYLOAD_VERSIONS,\n type AgentDragPayload,\n type AgentEnvelopeAttachment,\n type AgentPayloadLimits,\n type AgentPayloadValidationResult,\n} from '../models/agent-input.model';\n\n/**\n * Pure utility helpers for agent drag payload size guarding.\n *\n * Used by `flyAgentDraggable` at `dragstart` (Phase 2) and by app pre-flight code that\n * wants a clean payload before constructing the directive input. No Angular DI, no\n * runtime side effects — safe to import from anywhere.\n *\n * Performance notes:\n * - The `TextEncoder` is lazily allocated and cached. The constructor runs once per\n * module instance even under federation (singleton DS).\n * - String trimming uses `Intl.Segmenter` when available (all evergreen browsers\n * including Safari 14.1+) so we cut on grapheme boundaries — emoji ZWJ sequences,\n * combining marks, regional indicator pairs all stay intact. Fallback is\n * UTF-16 code-unit slice, which is a graceful degradation: it can split a\n * surrogate pair, but the resulting JSON is still syntactically valid and\n * downstream renderers handle the replacement char.\n */\n\n/**\n * Thrown by {@link trimAgentPayload} when even a fully string-trimmed envelope still\n * exceeds `maxJsonBytes` (e.g. an envelope with thousands of nested empty objects /\n * array entries / property keys). Subclasses `RangeError` so callers using the standard\n * `instanceof RangeError` check still match, while exposing the structured fields\n * (`actualBytes`, `limitBytes`, `reason: 'json_too_large'`) needed for telemetry and\n * symmetric handling with {@link AgentPayloadValidationResult} failures.\n */\nexport class AgentPayloadOversizeError extends RangeError {\n readonly reason = 'json_too_large' as const;\n constructor(\n message: string,\n readonly actualBytes: number,\n readonly limitBytes: number,\n ) {\n super(message);\n this.name = 'AgentPayloadOversizeError';\n }\n}\n\n/** Cap on the dotted `fieldPath` string so a 10 MB property-key payload can't lock dev tools when `console.warn`d. */\nconst FIELD_PATH_MAX_CHARS = 256;\n\n/** Append a path segment, capping the result at {@link FIELD_PATH_MAX_CHARS} chars (with `…` marker). */\nfunction appendPath(base: string, segment: string): string {\n const next = base + segment;\n if (next.length <= FIELD_PATH_MAX_CHARS) return next;\n return next.slice(0, FIELD_PATH_MAX_CHARS - 1) + '…';\n}\n\nlet _cachedEncoder: TextEncoder | null = null;\nfunction getEncoder(): TextEncoder {\n return (_cachedEncoder ??= new TextEncoder());\n}\n\n/** UTF-8 byte length of `s`. Cheap; cached encoder. */\nexport function utf8ByteLength(s: string): number {\n return getEncoder().encode(s).length;\n}\n\n/**\n * Trim `input` so the UTF-8 byte length of the result is `<= maxBytes`. When trimming\n * occurs, append `ellipsis` (default `…`, U+2026) — its bytes are included in the cap.\n *\n * Idempotent: `trimAgentString(trimAgentString(s, n), n)` equals `trimAgentString(s, n)`.\n *\n * Edge cases:\n * - `maxBytes` shorter than the ellipsis itself returns an empty string.\n * - `Intl.Segmenter` (when present) ensures we never split a grapheme cluster.\n * - When the encoded length is already within the cap, returns `input` unchanged.\n */\nexport function trimAgentString(input: string, maxBytes: number, ellipsis = '…'): string {\n if (maxBytes <= 0) return '';\n const enc = getEncoder();\n const inputLen = enc.encode(input).length;\n if (inputLen <= maxBytes) return input;\n\n const ellipsisLen = enc.encode(ellipsis).length;\n if (maxBytes < ellipsisLen) return '';\n const budget = maxBytes - ellipsisLen;\n\n // Segmenter path: walk graphemes, accumulate until next would overflow.\n const segmenterCtor =\n typeof Intl !== 'undefined' && (Intl as unknown as { Segmenter?: typeof Intl.Segmenter }).Segmenter;\n if (segmenterCtor) {\n const segmenter = new segmenterCtor(undefined, { granularity: 'grapheme' });\n let used = 0;\n let acc = '';\n for (const seg of segmenter.segment(input)) {\n const segLen = enc.encode(seg.segment).length;\n if (used + segLen > budget) break;\n acc += seg.segment;\n used += segLen;\n }\n return acc + ellipsis;\n }\n\n // Fallback: code-unit slice; verify byte length and shrink until under budget.\n let cut = input.length;\n while (cut > 0 && enc.encode(input.slice(0, cut)).length > budget) {\n cut--;\n }\n return input.slice(0, cut) + ellipsis;\n}\n\n/**\n * Validate an {@link AgentDragPayload} against the supplied limits (or\n * {@link DEFAULT_AGENT_PAYLOAD_LIMITS} when omitted). Returns `{ ok: true }` or a\n * structured failure with the offending field path and byte counts.\n *\n * Order of checks (cheap → expensive):\n * 1. `version` is in {@link SUPPORTED_AGENT_PAYLOAD_VERSIONS}.\n * 2. `kind` is a non-empty string.\n * 3. `plainTextFallback` fits its cap.\n * 4. Every string in `payload` (recursively) fits the per-field cap.\n * 5. v2 sections — `userMessage`, `systemContext`, `attachments`, `mcpScope` —\n * each fits their independent caps. Skipped when absent so v1 payloads pass\n * unchanged.\n * 6. The full `JSON.stringify(envelope)` fits the JSON cap.\n *\n * The walker stops on the first oversize string field — the intent is to surface\n * actionable feedback, not enumerate every offender.\n */\nexport function validateAgentPayload(\n payload: AgentDragPayload<unknown>,\n limits?: Partial<AgentPayloadLimits>,\n): AgentPayloadValidationResult {\n const eff: AgentPayloadLimits = { ...DEFAULT_AGENT_PAYLOAD_LIMITS, ...(limits ?? {}) };\n\n if (!SUPPORTED_AGENT_PAYLOAD_VERSIONS.includes(payload.version)) {\n return { ok: false, reason: 'invalid_version' };\n }\n if (typeof payload.kind !== 'string' || payload.kind.length === 0) {\n return { ok: false, reason: 'invalid_kind' };\n }\n\n const fbBytes = utf8ByteLength(payload.plainTextFallback ?? '');\n if (fbBytes > eff.maxPlainTextFallbackBytes) {\n return {\n ok: false,\n reason: 'fallback_too_large',\n fieldPath: 'plainTextFallback',\n actualBytes: fbBytes,\n limitBytes: eff.maxPlainTextFallbackBytes,\n };\n }\n\n const fieldFailure = walkStringsForOverage(payload.payload, 'payload', eff.maxStringFieldBytes);\n if (fieldFailure) return fieldFailure;\n\n // v2 — per-section caps. Each helper is a no-op when its section is absent\n // so a v1 payload (no userMessage / systemContext / attachments / mcpScope /\n // deepLinkRoute) sails through unchanged.\n const v2Failure =\n checkUserMessage(payload, eff) ??\n checkSystemContext(payload, eff) ??\n checkAttachments(payload, eff) ??\n checkMcpScope(payload, eff) ??\n checkDeepLinkRoute(payload, eff);\n if (v2Failure) return v2Failure;\n\n const json = safeStringify(payload);\n const jsonBytes = utf8ByteLength(json);\n if (jsonBytes > eff.maxJsonBytes) {\n return {\n ok: false,\n reason: 'json_too_large',\n actualBytes: jsonBytes,\n limitBytes: eff.maxJsonBytes,\n };\n }\n\n return { ok: true };\n}\n\n// ─── v2 section validators ──────────────────────────────────────────────────\n\nfunction checkUserMessage(\n payload: AgentDragPayload<unknown>,\n eff: AgentPayloadLimits,\n): AgentPayloadValidationResult | null {\n if (payload.userMessage === undefined) return null;\n if (typeof payload.userMessage !== 'string') return null; // structural; ts catches at the call site\n const bytes = utf8ByteLength(payload.userMessage);\n if (bytes > eff.maxUserMessageBytes) {\n return {\n ok: false,\n reason: 'user_message_too_large',\n fieldPath: 'userMessage',\n actualBytes: bytes,\n limitBytes: eff.maxUserMessageBytes,\n };\n }\n return null;\n}\n\nfunction checkSystemContext(\n payload: AgentDragPayload<unknown>,\n eff: AgentPayloadLimits,\n): AgentPayloadValidationResult | null {\n const ctx = payload.systemContext;\n if (!ctx) return null;\n const keys = Object.keys(ctx);\n if (keys.length > eff.maxSystemContextEntries) {\n return {\n ok: false,\n reason: 'system_context_too_many_entries',\n fieldPath: 'systemContext',\n actualBytes: keys.length,\n limitBytes: eff.maxSystemContextEntries,\n };\n }\n for (const k of keys) {\n const v = ctx[k];\n if (typeof v !== 'string') continue;\n const bytes = utf8ByteLength(v);\n if (bytes > eff.maxSystemContextValueBytes) {\n return {\n ok: false,\n reason: 'system_context_value_too_large',\n fieldPath: `systemContext.${k}`,\n actualBytes: bytes,\n limitBytes: eff.maxSystemContextValueBytes,\n };\n }\n }\n const ctxJsonBytes = utf8ByteLength(safeStringify(ctx));\n if (ctxJsonBytes > eff.maxSystemContextJsonBytes) {\n return {\n ok: false,\n reason: 'system_context_json_too_large',\n fieldPath: 'systemContext',\n actualBytes: ctxJsonBytes,\n limitBytes: eff.maxSystemContextJsonBytes,\n };\n }\n return null;\n}\n\nfunction checkAttachments(\n payload: AgentDragPayload<unknown>,\n eff: AgentPayloadLimits,\n): AgentPayloadValidationResult | null {\n const atts = payload.attachments;\n if (!atts) return null;\n if (atts.length > eff.maxAttachments) {\n return {\n ok: false,\n reason: 'too_many_attachments',\n fieldPath: 'attachments',\n actualBytes: atts.length,\n limitBytes: eff.maxAttachments,\n };\n }\n for (let i = 0; i < atts.length; i++) {\n const a = atts[i] as AgentEnvelopeAttachment;\n const path = `attachments[${i}]`;\n switch (a.kind) {\n case 'json': {\n const bytes = utf8ByteLength(safeStringify(a.json));\n if (bytes > eff.maxAttachmentJsonBytes) {\n return {\n ok: false,\n reason: 'attachment_json_too_large',\n fieldPath: `${path}.json`,\n actualBytes: bytes,\n limitBytes: eff.maxAttachmentJsonBytes,\n };\n }\n break;\n }\n case 'text': {\n const bytes = utf8ByteLength(a.text ?? '');\n if (bytes > eff.maxAttachmentTextBytes) {\n return {\n ok: false,\n reason: 'attachment_text_too_large',\n fieldPath: `${path}.text`,\n actualBytes: bytes,\n limitBytes: eff.maxAttachmentTextBytes,\n };\n }\n break;\n }\n case 'image':\n case 'file': {\n const bytes = utf8ByteLength(a.dataUrl ?? '');\n if (bytes > eff.maxAttachmentDataUrlBytes) {\n return {\n ok: false,\n reason: 'attachment_data_url_too_large',\n fieldPath: `${path}.dataUrl`,\n actualBytes: bytes,\n limitBytes: eff.maxAttachmentDataUrlBytes,\n };\n }\n break;\n }\n default:\n return {\n ok: false,\n reason: 'attachment_invalid_kind',\n fieldPath: `${path}.kind`,\n };\n }\n }\n return null;\n}\n\n/**\n * Validate `deepLinkRoute` — byte cap + minimal shape sanity check.\n *\n * The DS package is shell-agnostic, so full route grammar validation\n * (scheme prefixes, `..` segments, `//` runs) lives in the shell's\n * `DeepLinkService.isValidRoute` — the launcher is the authoritative\n * gate. Here we just enforce:\n * - byte cap so a malicious payload can't bloat the JSON\n * - must start with `/` so the value matches the launcher's contract\n * and a renderer can safely concatenate / display it.\n *\n * Anything more would force the DS to grow a second copy of the route\n * grammar; the launcher rejects malformed routes at click time so the\n * worst-case impact of a bad route landing here is a no-op click.\n */\nfunction checkDeepLinkRoute(\n payload: AgentDragPayload<unknown>,\n eff: AgentPayloadLimits,\n): AgentPayloadValidationResult | null {\n const route = payload.deepLinkRoute;\n if (route === undefined) return null;\n if (typeof route !== 'string') return null; // structural; ts catches at the call site\n if (!route.startsWith('/')) {\n return {\n ok: false,\n reason: 'deep_link_route_invalid_shape',\n fieldPath: 'deepLinkRoute',\n };\n }\n const bytes = utf8ByteLength(route);\n if (bytes > eff.maxDeepLinkRouteBytes) {\n return {\n ok: false,\n reason: 'deep_link_route_too_large',\n fieldPath: 'deepLinkRoute',\n actualBytes: bytes,\n limitBytes: eff.maxDeepLinkRouteBytes,\n };\n }\n return null;\n}\n\nfunction checkMcpScope(\n payload: AgentDragPayload<unknown>,\n eff: AgentPayloadLimits,\n): AgentPayloadValidationResult | null {\n const scope = payload.mcpScope;\n if (!scope) return null;\n const apis = scope.apis ?? [];\n if (apis.length > eff.maxMcpScopeApis) {\n return {\n ok: false,\n reason: 'mcp_scope_too_many_apis',\n fieldPath: 'mcpScope.apis',\n actualBytes: apis.length,\n limitBytes: eff.maxMcpScopeApis,\n };\n }\n for (let i = 0; i < apis.length; i++) {\n const bytes = utf8ByteLength(apis[i]);\n if (bytes > eff.maxMcpScopeApiBytes) {\n return {\n ok: false,\n reason: 'mcp_scope_api_too_large',\n fieldPath: `mcpScope.apis[${i}]`,\n actualBytes: bytes,\n limitBytes: eff.maxMcpScopeApiBytes,\n };\n }\n }\n return null;\n}\n\n/**\n * Returns a NEW payload with all string fields trimmed to fit the per-field cap, the\n * `plainTextFallback` trimmed to its cap, and the full envelope re-checked against the\n * JSON cap. Idempotent — a second call against the trimmed result yields equal output.\n *\n * Throws {@link AgentPayloadOversizeError} only if even an empty trim couldn't shrink it\n * under the cap (e.g. an envelope with 1000+ nested empty objects). The error subclasses\n * `RangeError`, so legacy `instanceof RangeError` checks still match. Apps that hit this\n * should re-shape `payload` rather than call again.\n */\nexport function trimAgentPayload<T>(\n payload: AgentDragPayload<T>,\n limits?: Partial<AgentPayloadLimits>,\n): AgentDragPayload<T> {\n const eff: AgentPayloadLimits = { ...DEFAULT_AGENT_PAYLOAD_LIMITS, ...(limits ?? {}) };\n\n const trimmedFallback = trimAgentString(payload.plainTextFallback ?? '', eff.maxPlainTextFallbackBytes);\n const trimmedPayload = mapStrings(payload.payload, (s) => trimAgentString(s, eff.maxStringFieldBytes)) as T;\n\n const next: AgentDragPayload<T> = {\n ...payload,\n plainTextFallback: trimmedFallback,\n payload: trimmedPayload,\n };\n\n const jsonBytes = utf8ByteLength(safeStringify(next));\n if (jsonBytes > eff.maxJsonBytes) {\n throw new AgentPayloadOversizeError(\n `AgentDragPayload exceeds maxJsonBytes (${jsonBytes} > ${eff.maxJsonBytes}) after string trimming. Re-shape the payload.`,\n jsonBytes,\n eff.maxJsonBytes,\n );\n }\n return next;\n}\n\n// ─── Internal helpers ───────────────────────────────────────────────────────\n\n/**\n * Recursively walks `value`, returning the first string field that exceeds `maxBytes`\n * (as a structured failure). Returns `null` when every string fits.\n *\n * Path uses dotted property-access notation: `payload.body`, `payload.tags[2]`. Cycles\n * are detected via a WeakSet so attacker-crafted self-references don't loop forever.\n * Path strings are capped at {@link FIELD_PATH_MAX_CHARS} characters via {@link appendPath}\n * to prevent a malicious payload with multi-MB property keys from producing a multi-MB\n * `fieldPath` that locks up dev tools when logged.\n */\nfunction walkStringsForOverage(\n value: unknown,\n path: string,\n maxBytes: number,\n seen: WeakSet<object> = new WeakSet(),\n): AgentPayloadValidationResult | null {\n if (typeof value === 'string') {\n const bytes = utf8ByteLength(value);\n if (bytes > maxBytes) {\n return {\n ok: false,\n reason: 'field_too_large',\n fieldPath: path,\n actualBytes: bytes,\n limitBytes: maxBytes,\n };\n }\n return null;\n }\n if (value === null || typeof value !== 'object') return null;\n if (seen.has(value as object)) return null;\n seen.add(value as object);\n\n if (Array.isArray(value)) {\n for (let i = 0; i < value.length; i++) {\n const r = walkStringsForOverage(value[i], appendPath(path, `[${i}]`), maxBytes, seen);\n if (r) return r;\n }\n return null;\n }\n for (const [k, v] of Object.entries(value as Record<string, unknown>)) {\n const r = walkStringsForOverage(v, appendPath(path, `.${k}`), maxBytes, seen);\n if (r) return r;\n }\n return null;\n}\n\n/**\n * Recursively maps every string leaf via `fn`, preserving object/array structure.\n * Cycles are short-circuited to `null` rather than throwing — the caller already\n * has a JSON.stringify cap that will catch any pathological input.\n */\nfunction mapStrings(value: unknown, fn: (s: string) => string, seen: WeakSet<object> = new WeakSet()): unknown {\n if (typeof value === 'string') return fn(value);\n if (value === null || typeof value !== 'object') return value;\n if (seen.has(value as object)) return null;\n seen.add(value as object);\n\n if (Array.isArray(value)) {\n return value.map((v) => mapStrings(v, fn, seen));\n }\n const out: Record<string, unknown> = {};\n for (const [k, v] of Object.entries(value as Record<string, unknown>)) {\n out[k] = mapStrings(v, fn, seen);\n }\n return out;\n}\n\n/** `JSON.stringify` with a cycle-safe replacer — defends against attacker-crafted graphs. */\nfunction safeStringify(value: unknown): string {\n const seen = new WeakSet<object>();\n return JSON.stringify(value, (_k, v) => {\n if (v !== null && typeof v === 'object') {\n if (seen.has(v as object)) return '[Circular]';\n seen.add(v as object);\n }\n return v;\n });\n}\n","import { Injectable, signal } from '@angular/core';\nimport { Observable, Subject } from 'rxjs';\nimport type { AgentAction } from '../../models/agent-action.model';\nimport { AgentActionUnsupportedDispatchError } from '../../models/agent-action.model';\nimport { validateAgentPayload } from '../../utils/agent-payload-guards';\n\n/**\n * Imperative sibling to {@link AgentCommandRegistry} / {@link AgentDropRegistry}.\n *\n * Apps call {@link dispatch} to push a typed {@link AgentAction} onto the bus;\n * the agent panel subscribes once at construct and routes by verb. The bus\n * itself is a thin pass-through — it does NOT decide UI behaviour. The\n * subscriber (agent-panel) owns: showing the panel, staging the chip,\n * triggering the flight animation, and binding the command. This keeps the\n * DS free of host policy.\n *\n * Federation-safe: `providedIn: 'root'` + `sharedMappings: ['@mohamedatia/fly-design-system']`\n * give every federated remote the same singleton, so a remote's \"Explain\"\n * button reaches the host's panel without any cross-bundle wiring.\n *\n * Validation runs synchronously inside `dispatch` so a caller that sends an\n * oversize payload sees the throw at their site, not on the subscriber. The\n * subscriber therefore never has to defend against malformed envelopes.\n */\n@Injectable({ providedIn: 'root' })\nexport class AgentActionBus {\n private readonly _actions$ = new Subject<AgentAction>();\n /** Hot stream of actions in dispatch order. Subscribers receive only\n * actions dispatched AFTER they subscribe — late subscribers see nothing\n * retroactively. Use {@link lastAction} for the latest snapshot. */\n readonly actions$: Observable<AgentAction> = this._actions$.asObservable();\n\n /** Most recent action — for DevTools, smoke tests, and late-subscriber\n * catch-up. Null until the first successful dispatch. */\n readonly lastAction = signal<AgentAction | null>(null);\n\n /**\n * The action currently being processed by the subscriber, or null when\n * none. Set by {@link dispatch} immediately before emitting on\n * {@link actions$}; cleared by the subscriber via {@link settle} once\n * it finishes its handler (success or fail). Lets the dispatcher render\n * a busy state on the originating control — e.g. a card swapping its\n * sparkle icon for a spinner while the agent panel mints the optimistic\n * thread and starts the request. Identity check (`bus.inFlight() === act`)\n * is the panel-side contract; dispatchers usually project to a stable id\n * inside the payload (e.g. <c>reportId</c>) to scope busy-state visually.\n *\n * If multiple dispatches race, the latest wins — the prior in-flight\n * action is dropped on the floor here (the panel may still handle it,\n * but the dispatcher's busy indicator follows the newer action). Apps\n * that need stricter single-flight semantics should guard at the call\n * site (the agent-panel's <c>_pendingTempThreadId</c> already does so\n * for the explain verb).\n */\n readonly inFlight = signal<AgentAction | null>(null);\n\n /**\n * Push an action onto the bus.\n *\n * Throws synchronously when:\n * - `dispatch === 'auto'` (not implemented in this DS version) — see\n * {@link AgentActionUnsupportedDispatchError}.\n * - the payload fails {@link validateAgentPayload} (oversize, invalid\n * version, invalid kind). The error message carries the field path\n * so the caller can fix the offending field.\n *\n * Subscribers see the action via {@link actions$} on the next tick of\n * the Subject; the {@link lastAction} signal updates synchronously\n * before the Subject emits so an effect reading both stays consistent.\n */\n dispatch<T>(action: AgentAction<T>): void {\n if (action.dispatch === 'auto') {\n throw new AgentActionUnsupportedDispatchError(action.dispatch);\n }\n const v = validateAgentPayload(action.payload);\n if (!v.ok) {\n const where = v.fieldPath ? ` at ${v.fieldPath}` : '';\n throw new Error(\n `AgentActionBus.dispatch: invalid payload — ${v.reason}${where}`,\n );\n }\n const a = action as AgentAction;\n this.lastAction.set(a);\n this.inFlight.set(a);\n this._actions$.next(a);\n }\n\n /**\n * Subscriber contract: call after the handler for {@link inFlight}\n * completes (success or fail). Only clears {@link inFlight} if it still\n * points at the passed action — a no-op when a later dispatch already\n * superseded it. Pass the same action reference the subscriber received\n * from {@link actions$}; identity is the gate.\n */\n settle(action: AgentAction): void {\n if (this.inFlight() === action) {\n this.inFlight.set(null);\n }\n }\n\n /**\n * Semantic alias of {@link settle} for explicit user-driven cancellation —\n * e.g. a future \"Stop\" button in the agent input tray, or a dispatcher\n * teardown that wants to abandon its own in-flight action. Identical\n * runtime behaviour (identity check + clear), but the two-method surface\n * lets the UI distinguish \"handler finished\" from \"user said no\" in\n * telemetry / logs without sniffing a \"reason\" parameter.\n *\n * Pass the same action reference returned from {@link inFlight} or held\n * by the dispatcher; identity is the gate.\n */\n cancel(action: AgentAction): void {\n if (this.inFlight() === action) {\n this.inFlight.set(null);\n }\n }\n}\n","import { Injectable } from '@angular/core';\n\n/**\n * FLIP-style entry animation for payloads landing in the agent panel.\n *\n * Pure DOM + Web Animations API — no Chart.js, no Angular animations module,\n * no CSS transitions racing layout. Honours `prefers-reduced-motion`: the\n * ghost is appended then removed without animating when the user asked for\n * less motion (so DOM side-effects stay consistent).\n *\n * Lifecycle:\n * 1. The agent panel calls {@link registerTarget} in `ngAfterViewInit`\n * with its header element.\n * 2. A source app dispatches an `AgentAction` carrying an `originRect`\n * from `getBoundingClientRect()` on the click target.\n * 3. The bus subscriber calls {@link flyInto} with that rect.\n * 4. The animator creates a fixed-position ghost at the origin, animates\n * transform + opacity toward the registered target's rect, then\n * removes itself on `onfinish` / `oncancel`.\n *\n * Uses `getBoundingClientRect()` (physical viewport coords) so the animation\n * is RTL-correct without inset-inline math — the rect already encodes the\n * physical position regardless of `dir`.\n *\n * The 900 ms duration and easing curve are deliberately hardcoded — making\n * them configurable surfaces an API the host can't usefully tune without\n * understanding motion design as a whole.\n */\n@Injectable({ providedIn: 'root' })\nexport class AgentFlightAnimator {\n /** Hardcoded — see class doc. */\n private static readonly DURATION_MS = 900;\n private static readonly EASING = 'cubic-bezier(.2,.7,.2,1)';\n /** Floor the target/source scale ratio so a tiny target rect doesn't\n * collapse the ghost to invisibility before the animation finishes. */\n private static readonly MIN_SCALE = 0.05;\n\n private targetEl: HTMLElement | null = null;\n\n /** Called by the panel host to publish where flights should land. Pass\n * `null` on destroy so a re-mounted panel doesn't leave the animator\n * pointing at a detached node. */\n registerTarget(el: HTMLElement | null): void {\n this.targetEl = el;\n }\n\n /**\n * Animate a ghost element from {@link from} to the registered target's\n * rect. No-ops when:\n * - no target is registered (silent — panel may not be mounted yet)\n * - running outside a browser (SSR safety)\n * - the user has `prefers-reduced-motion: reduce` set (DOM is still\n * touched so callers see consistent side-effects, but no animation\n * runs)\n *\n * The ghost is appended to `document.body` (not the panel) so a parent\n * `overflow: hidden` on the panel can't clip the flight path.\n */\n flyInto(from: DOMRect, opts: { previewHtml?: string } = {}): void {\n if (!this.targetEl) return;\n if (typeof document === 'undefined') return;\n\n const reduced =\n typeof window !== 'undefined' && typeof window.matchMedia === 'function'\n ? window.matchMedia('(prefers-reduced-motion: reduce)').matches\n : false;\n\n const to = this.targetEl.getBoundingClientRect();\n const ghost = document.createElement('div');\n ghost.className = 'fly-agent-flight-ghost';\n // The ghost is purely decorative — it duplicates the source content\n // (chart title + snapshot) that the user just clicked and screen-reader\n // users have already heard via the sparkle button's aria-label. Re-\n // announcing the same content during the flight would be noisy at best\n // and confusing at worst. aria-hidden hides the subtree from assistive\n // tech while leaving it visible for sighted users.\n ghost.setAttribute('aria-hidden', 'true');\n // role=\"presentation\" is belt-and-braces — even if a future renderer\n // walks the tree looking for semantic landmarks, the ghost has none.\n ghost.setAttribute('role', 'presentation');\n if (opts.previewHtml) {\n // Caller is responsible for safe HTML — the bus subscriber escapes\n // plainTextFallback before passing it here.\n ghost.innerHTML = opts.previewHtml;\n }\n Object.assign(ghost.style, {\n position: 'fixed',\n left: `${from.left}px`,\n top: `${from.top}px`,\n width: `${from.width}px`,\n height: `${from.height}px`,\n pointerEvents: 'none',\n zIndex: '99999',\n transformOrigin: 'top left',\n willChange: 'transform, opacity',\n } as Partial<CSSStyleDeclaration>);\n document.body.appendChild(ghost);\n\n if (reduced) {\n ghost.remove();\n return;\n }\n\n const dx = to.left - from.left;\n const dy = to.top - from.top;\n const sx = Math.max(to.width / from.width, AgentFlightAnimator.MIN_SCALE);\n const sy = Math.max(to.height / from.height, AgentFlightAnimator.MIN_SCALE);\n\n const anim = ghost.animate(\n [\n { transform: 'translate(0,0) scale(1,1)', opacity: 1 },\n { transform: `translate(${dx}px,${dy}px) scale(${sx},${sy})`, opacity: 0.15 },\n ],\n {\n duration: AgentFlightAnimator.DURATION_MS,\n easing: AgentFlightAnimator.EASING,\n fill: 'forwards',\n },\n );\n const cleanup = (): void => ghost.remove();\n anim.onfinish = cleanup;\n anim.oncancel = cleanup;\n }\n}\n","import { Directive, HostListener, inject, input } from '@angular/core';\nimport { DOCUMENT } from '@angular/common';\nimport {\n AGENT_DRAG_MIME,\n type AgentDragPayload,\n} from '../models/agent-input.model';\nimport { validateAgentPayload } from '../utils/agent-payload-guards';\n\n/**\n * Strict whitelist for the ghost element id. Letter-led ASCII, allows word/hyphen/colon/dot,\n * capped at 128 chars. Anything else is rejected before reaching `getElementById` so a\n * future maintainer can't swap to `querySelector` and quietly reintroduce a CSS-injection\n * vector. (`getElementById` itself is string-equality-safe; the whitelist is defence-in-depth.)\n */\nconst GHOST_ID_PATTERN = /^[A-Za-z][\\w\\-:.]{0,127}$/;\n\n/**\n * Single canonical way to declare a drag source for the agent input.\n *\n * Apply on any element a remote wants to make draggable into the `<fly-agent-input>`:\n *\n * ```html\n * <article [flyAgentDraggable]=\"() => buildPayload(trend)\" flyAgentDraggableGhostId=\"trend-ghost\">…</article>\n * ```\n *\n * On `dragstart` the directive:\n * 1. Resolves the payload (calls the builder fn if supplied; otherwise reads the\n * static value).\n * 2. Validates against {@link DEFAULT_AGENT_PAYLOAD_LIMITS} via\n * {@link validateAgentPayload}. On failure it `console.warn`s with the structured\n * reason and writes ONLY the `text/plain` fallback — the receiver still sees a\n * legible drop, but the typed envelope is skipped so a misconfigured app can't\n * corrupt downstream consumers with an oversize payload.\n * 3. Writes the typed MIME (`application/x-fly-agent-payload+json`) plus the\n * `text/plain` fallback so non-Fly drop targets still get useful text.\n * 4. Sets `effectAllowed = 'copy'` (we never *move* domain objects across windows).\n * 5. When `flyAgentDraggableGhostId` resolves to an element in the DOM, calls\n * `setDragImage` to use that element as the drag preview; otherwise the browser\n * default applies.\n *\n * Notes:\n * - Builder form is preferred over static — it captures fresh state at `dragstart`,\n * not at directive init. A static `AgentDragPayload` is fine for items whose\n * domain object never changes after the row mounts.\n * - The directive sets `[attr.draggable]=\"true\"` so callers don't have to.\n */\n@Directive({\n selector: '[flyAgentDraggable]',\n standalone: true,\n host: {\n '[attr.draggable]': '\"true\"',\n },\n})\nexport class FlyAgentDraggableDirective<T = unknown> {\n /**\n * Either a static payload or a builder evaluated at `dragstart` (preferred — captures\n * fresh state). `input.required` so misuse fails at template compile time.\n */\n readonly flyAgentDraggable = input.required<AgentDragPayload<T> | (() => AgentDragPayload<T>)>();\n\n /**\n * Optional ghost element id (an existing element in the DOM whose snapshot becomes\n * the drag image). Falls back to the default browser drag image when absent or the\n * element can't be resolved.\n *\n * Must be a valid HTML id (ASCII, letter-led). `getElementById` is intentional —\n * do NOT swap to `querySelector` without re-introducing this whitelist.\n */\n readonly flyAgentDraggableGhostId = input<string | undefined>(undefined);\n\n private readonly doc = inject(DOCUMENT);\n\n @HostListener('dragstart', ['$event'])\n onDragStart(ev: DragEvent): void {\n const dt = ev.dataTransfer;\n if (!dt) return;\n\n const payload = this.resolvePayload();\n const validation = validateAgentPayload(payload);\n\n if (!validation.ok) {\n // eslint-disable-next-line no-console\n console.warn('[flyAgentDraggable] payload validation failed; degrading to text/plain', validation);\n dt.setData('text/plain', payload.plainTextFallback ?? '');\n dt.effectAllowed = 'copy';\n return;\n }\n\n dt.setData(AGENT_DRAG_MIME, JSON.stringify(payload));\n dt.setData('text/plain', payload.plainTextFallback ?? '');\n dt.effectAllowed = 'copy';\n\n const ghostId = this.flyAgentDraggableGhostId();\n if (ghostId) {\n if (!GHOST_ID_PATTERN.test(ghostId)) {\n // Don't echo the rejected id (caller-controlled, could be huge).\n // eslint-disable-next-line no-console\n console.warn('[flyAgentDraggable] ignoring ghost id', { reason: 'invalid_ghost_id' });\n } else {\n const ghost = this.doc.getElementById(ghostId);\n if (ghost) {\n // Center the drag image; ResizeObserver-aware sizing is left to the host element.\n dt.setDragImage(ghost, ghost.clientWidth / 2, ghost.clientHeight / 2);\n }\n }\n }\n }\n\n private resolvePayload(): AgentDragPayload<T> {\n const raw = this.flyAgentDraggable();\n return typeof raw === 'function' ? (raw as () => AgentDragPayload<T>)() : raw;\n }\n}\n","import {\n Directive,\n ElementRef,\n Renderer2,\n OnDestroy,\n effect,\n inject,\n input,\n} from '@angular/core';\nimport { HttpClient } from '@angular/common/http';\n\n/**\n * Renders an authenticated image into a host `<img>` element by fetching the\n * resource as a blob through Angular's `HttpClient` and binding the resulting\n * object URL to the host's `src` attribute.\n *\n * Why this exists: every Business / Supporting app stores files in the Files\n * Manager service, which authenticates with a Bearer JWT. A raw `<img src>`\n * request bypasses the Angular HTTP interceptor — the browser issues the GET\n * without the Authorization header, so the response is 401 and the image is\n * broken. The standard workaround is roughly fifteen lines of `effect` +\n * `URL.createObjectURL` + `URL.revokeObjectURL` per call site (see prior\n * inline copies in `FlyImageUploadComponent` and the Circles trend-detail\n * cover). This directive centralizes that pattern so:\n *\n * * Memory hygiene is automatic — the previous object URL is revoked\n * whenever the input changes and on destroy. Easy to forget inline.\n * * Error handling is uniform — a fetch failure clears the host `src`\n * so the browser shows its broken-image affordance once, not the prior\n * image stuck on screen.\n * * A future protocol change (per-request signed URLs, CDN tokens, etc.)\n * lands in one place rather than across every app's image bindings.\n *\n * Usage:\n *\n * ```html\n * <img [flySecureSrc]=\"trend.coverImageId\" alt=\"\" class=\"cover-img\" />\n * ```\n *\n * Pass a full URL when the resource lives somewhere other than the default\n * Files Manager download endpoint:\n *\n * ```html\n * <img [flySecureSrc]=\"'/api/avatars/' + user.id\" alt=\"\" />\n * ```\n *\n * A bare file id (no `/` prefix) is resolved against\n * `/api/files/{id}/download`, which matches the Files Manager convention\n * used everywhere in the platform. Anything that starts with `/` is treated\n * as a literal URL and passed through unchanged — apps with bespoke download\n * routes (signed Excel exports, attachment thumbnails, …) keep working\n * without a wrapper.\n */\n@Directive({\n selector: 'img[flySecureSrc]',\n standalone: true,\n})\nexport class FlySecureSrcDirective implements OnDestroy {\n /**\n * File id or absolute path. Passing `null` / `undefined` / `''` clears the\n * `src` attribute and revokes the previous blob. Useful when binding to a\n * signal whose value can become empty (e.g. after a file is detached).\n */\n readonly flySecureSrc = input<string | null | undefined>();\n\n private readonly http = inject(HttpClient);\n private readonly host = inject(ElementRef<HTMLImageElement>);\n private readonly renderer = inject(Renderer2);\n\n /**\n * The object URL currently bound to the host's `src` attribute. Tracked so\n * we can revoke it before binding a new one (avoids leaking blob memory\n * across rapid input changes — e.g. carousel scrubbing) and on destroy.\n */\n private currentUrl: string | null = null;\n\n constructor() {\n effect((onCleanup) => {\n const raw = this.flySecureSrc();\n this.releaseCurrent();\n this.renderer.removeAttribute(this.host.nativeElement, 'src');\n\n if (!raw) return;\n\n const url = raw.startsWith('/') ? raw : `/api/files/${raw}/download`;\n const sub = this.http\n .get(url, { responseType: 'blob' })\n .subscribe({\n next: (blob) => {\n const objectUrl = URL.createObjectURL(blob);\n this.currentUrl = objectUrl;\n this.renderer.setAttribute(this.host.nativeElement, 'src', objectUrl);\n },\n // A 401 / 403 / 404 here means the image is unavailable for this user.\n // Don't loop or retry — clear the src and let the host page render its\n // own placeholder. Logging is intentionally silent: it's expected on\n // permission boundaries (e.g. shared-evidence on a trend you can read\n // but whose file you can't), and stack-traces would be noise.\n error: () => {\n this.releaseCurrent();\n this.renderer.removeAttribute(this.host.nativeElement, 'src');\n },\n });\n\n onCleanup(() => sub.unsubscribe());\n });\n }\n\n ngOnDestroy(): void {\n this.releaseCurrent();\n }\n\n private releaseCurrent(): void {\n if (this.currentUrl) {\n URL.revokeObjectURL(this.currentUrl);\n this.currentUrl = null;\n }\n }\n}\n","import type { FlyLocaleEntry } from './fly-locale-catalog.model';\n\n/**\n * Verbatim TypeScript port of the C# `LanguageDTO[] _AllLanguages` array supplied by\n * product. **31 entries**, in the canonical order. Three RTL flagged: `he-IL`, `ur-IN`,\n * `ar-AE`. Includes `cmn-Hant-TW` for Chinese and `ka-GE` for Georgian.\n *\n * The order matches the C# source byte-for-byte — do not re-sort. Downstream tests\n * (`fly-locale-catalog.spec.ts`) pin the count, the unique-key constraints, and the\n * RTL set; if you reorder or add an entry, those tests will guide the fix.\n *\n * The strings carry Cyrillic, Hebrew, Vietnamese, Thai, Indonesian, Bengali, Devanagari,\n * Urdu, Catalan, Polish, Korean, Russian, Japanese, Han, Turkish, Romanian, Norwegian,\n * Hungarian, Greek, Finnish, Danish, Dutch, Swedish, Portuguese, Italian, German,\n * Spanish, French, English, Arabic, and Georgian. The file is saved as UTF-8 without\n * BOM (matches every other locale file in the repo). The `…` (U+2026) ellipsis is\n * preserved verbatim.\n */\nexport const FLY_LOCALE_CATALOG: readonly FlyLocaleEntry[] = Object.freeze([\n {\n prefix: 'UK',\n dialect: 'uk-UA',\n englishName: 'Ukrainian',\n arabicName: 'الأوكرانية',\n nativeName: 'Українська',\n detected: 'Виявлена мова',\n searching: 'Шукаючи',\n elevating: 'Підняття до',\n translating: 'Переклад на',\n generatingAnswersForYou: 'Створення відповідей для вас...',\n learnMore: 'Дізнайтеся більше',\n waitingForResponseMsg: 'Будь ласка, наберіться терпіння, ми ще думаємо',\n isRtl: false,\n },\n {\n prefix: 'HE',\n dialect: 'he-IL',\n englishName: 'Hebrew',\n arabicName: 'العبرية',\n nativeName: 'עברית',\n detected: 'שפה מזוהה',\n searching: 'מחפש אחר',\n elevating: 'מרומם ל',\n translating: 'תרגום ל',\n generatingAnswersForYou: 'מייצר עבורך תשובות...',\n learnMore: 'למידע נוסף',\n waitingForResponseMsg: 'אנא התאזרו בסבלנות, אנחנו עדיין חושבים',\n isRtl: true,\n },\n {\n prefix: 'VI',\n dialect: 'vi-VN',\n englishName: 'Vietnamese',\n arabicName: 'الفيتنامية',\n nativeName: 'Tiếng Việt',\n detected: 'Ngôn ngữ được phát hiện',\n searching: 'Tìm kiếm',\n elevating: 'Nâng lên',\n translating: 'Dịch sang',\n generatingAnswersForYou: 'Đang tạo câu trả lời cho bạn...',\n learnMore: 'Tìm hiểu thêm',\n waitingForResponseMsg: 'Vui lòng kiên nhẫn, chúng tôi vẫn đang suy nghĩ',\n isRtl: false,\n },\n {\n prefix: 'TH',\n dialect: 'th-TH',\n englishName: 'Thai',\n arabicName: 'التايلاندية',\n nativeName: 'ไทย',\n detected: 'ภาษาที่ตรวจพบ',\n searching: 'ค้นหา',\n elevating: 'ยกระดับเป็น',\n translating: 'การแปล',\n generatingAnswersForYou: 'กำลังสร้างคำตอบให้กับคุณ...',\n learnMore: 'เรียนรู้เพิ่มเติม',\n waitingForResponseMsg: 'โปรดอดใจรอ, พวกเรายังคงกำลังคิดอยู่',\n isRtl: false,\n },\n {\n prefix: 'ID',\n dialect: 'id-ID',\n englishName: 'Indonesian',\n arabicName: 'الإندونيسية',\n nativeName: 'Bahasa Indonesia',\n detected: 'Bahasa yang terdeteksi',\n searching: 'Mencari',\n elevating: 'Meninggalkan ke',\n translating: 'Menerjemahkan ke',\n generatingAnswersForYou: 'Menghasilkan jawaban untuk Anda...',\n learnMore: 'Cari tahu lebih lanjut',\n waitingForResponseMsg: 'Harap bersabar, kami masih sedang berpikir',\n isRtl: false,\n },\n {\n prefix: 'BN',\n dialect: 'bn-BD',\n englishName: 'Bengali',\n arabicName: 'البنغالية',\n nativeName: 'বাংলা',\n detected: 'সনাক্ত করা ভাষা',\n searching: 'খুঁজছি',\n elevating: 'উন্নত',\n translating: 'অনুবাদ',\n generatingAnswersForYou: 'আপনার জন্য উত্তর তৈরি করা হচ্ছে...',\n learnMore: 'আরো জানুন',\n waitingForResponseMsg: 'অনুগ্রহ করে ধৈর্য ধরুন, আমরা এখনও চিন্তা করছি',\n isRtl: false,\n },\n {\n prefix: 'HI',\n dialect: 'hi-IN',\n englishName: 'Hindi',\n arabicName: 'الهندية',\n nativeName: 'हिन्दी',\n detected: 'पता चला भाषा',\n searching: 'के लिए खोज रहे हैं',\n elevating: 'के लिए ऊंचा',\n translating: 'अनुवाद करना',\n generatingAnswersForYou: 'आपके लिए उत्तर तैयार किया जा रहा है...',\n learnMore: 'और जानें',\n waitingForResponseMsg: 'कृपया धैर्य रखें, हम अभी सोच रहे हैं',\n isRtl: false,\n },\n {\n prefix: 'UR',\n dialect: 'ur-IN',\n englishName: 'Urdu',\n arabicName: 'الأردية',\n nativeName: 'اردو',\n detected: 'پتہ چلا زبان',\n searching: 'کے لیے تلاش',\n elevating: 'بلند کرنا',\n translating: 'ترجمہ کرنا',\n generatingAnswersForYou: 'آپ کے لیے جوابات تیار کیے جا رہے ہیں...',\n learnMore: 'مزید جانیں',\n waitingForResponseMsg: 'براہ کرم صبر کریں، ہم ابھی سوچ رہے ہیں۔',\n isRtl: true,\n },\n {\n prefix: 'CA',\n dialect: 'ca-ES',\n englishName: 'Catalan',\n arabicName: 'الكتالانية',\n nativeName: 'Català',\n detected: 'Idioma detectat',\n searching: 'Buscant',\n elevating: 'Elevant a',\n translating: 'Traduir a',\n generatingAnswersForYou: 'Generant respostes per a tu...',\n learnMore: 'Aprèn més',\n waitingForResponseMsg: 'Si us plau, tingueu paciència, encara estem pensant',\n isRtl: false,\n },\n {\n prefix: 'PL',\n dialect: 'pl-PL',\n englishName: 'Polish',\n arabicName: 'البولندية',\n nativeName: 'Polski',\n detected: 'Wykryty język',\n searching: 'Szukać',\n elevating: 'Podniesienie do',\n translating: 'Tłumaczenie na',\n generatingAnswersForYou: 'Generowanie odpowiedzi dla Ciebie...',\n learnMore: 'Dowiedz się więcej',\n waitingForResponseMsg: 'Proszę o cierpliwość, nadal myślimy',\n isRtl: false,\n },\n {\n prefix: 'KO',\n dialect: 'ko-KR',\n englishName: 'Korean',\n arabicName: 'الكورية',\n nativeName: '한국어',\n detected: '탐지 언어',\n searching: '검색',\n elevating: '상승',\n translating: '번역',\n generatingAnswersForYou: '답변을 생성하는 중...',\n learnMore: '더 알아보기',\n waitingForResponseMsg: '잠시만 기다려 주세요, 저희는 아직 생각 중입니다',\n isRtl: false,\n },\n {\n prefix: 'RU',\n dialect: 'ru-RU',\n englishName: 'Russian',\n arabicName: 'الروسية',\n nativeName: 'Русский',\n detected: 'Обнаруженный язык',\n searching: 'В поисках',\n elevating: 'Поднимаясь до',\n translating: 'Перевод',\n generatingAnswersForYou: 'Генерация ответов для вас...',\n learnMore: 'Узнать больше',\n waitingForResponseMsg: 'Пожалуйста, подождите, мы всё ещё думаем',\n isRtl: false,\n },\n {\n prefix: 'JA',\n dialect: 'ja-JP',\n englishName: 'Japanese',\n arabicName: 'اليابانية',\n nativeName: '日本語',\n detected: '検出言語',\n searching: '探している',\n elevating: '昇格',\n translating: '翻訳',\n generatingAnswersForYou: 'あなたのための答えを生成中...',\n learnMore: 'もっと詳しく',\n waitingForResponseMsg: '少々お待ちください、ただいま考え中です',\n isRtl: false,\n },\n {\n prefix: 'ZH',\n dialect: 'cmn-Hant-TW',\n englishName: 'Chinese',\n arabicName: 'الصينية',\n nativeName: '中文',\n detected: '检测语言',\n searching: '搜索',\n elevating: '提升到',\n translating: '翻译成',\n generatingAnswersForYou: '为您生成答案...',\n learnMore: '了解更多',\n waitingForResponseMsg: '请耐心等待,我们还在思考',\n isRtl: false,\n },\n {\n prefix: 'TR',\n dialect: 'tr-TR',\n englishName: 'Turkish',\n arabicName: 'التركية',\n nativeName: 'Türkçe',\n detected: 'Tespit edilen dil',\n searching: 'Arama',\n elevating: 'Yükseltme',\n translating: 'Çevirme',\n generatingAnswersForYou: 'Sizin için yanıtlar üretiliyor...',\n learnMore: 'Daha fazla bilgi edin',\n waitingForResponseMsg: 'Lütfen sabırlı olun, hâlâ düşünüyoruz',\n isRtl: false,\n },\n {\n prefix: 'RO',\n dialect: 'ro-RO',\n englishName: 'Romanian',\n arabicName: 'الرومانية',\n nativeName: 'Română',\n detected: 'Limba detectată',\n searching: 'Căutare de',\n elevating: 'Elevator la',\n translating: 'Traducerea în',\n generatingAnswersForYou: 'Generarea de răspunsuri pentru tine...',\n learnMore: 'Află mai multe',\n waitingForResponseMsg: 'Vă rugăm să aveți răbdare, încă ne gândim',\n isRtl: false,\n },\n {\n prefix: 'NO',\n dialect: 'nb-NO',\n englishName: 'Norwegian',\n arabicName: 'النرويجية',\n nativeName: 'Norsk',\n detected: 'Oppdaget språk',\n searching: 'Leter etter',\n elevating: 'Løfter til',\n translating: 'Oversette til',\n generatingAnswersForYou: 'Genererer svar for deg...',\n learnMore: 'Lær mer',\n waitingForResponseMsg: 'Vennligst vær tålmodig, vi tenker fortsatt',\n isRtl: false,\n },\n {\n prefix: 'HU',\n dialect: 'hu-HU',\n englishName: 'Hungarian',\n arabicName: 'الهنغارية',\n nativeName: 'Magyar',\n detected: 'Detektált nyelv',\n searching: 'Keresés-ra,-re',\n elevating: 'Felemelve',\n translating: 'Fordítás',\n generatingAnswersForYou: 'Válaszok generálása az Ön számára...',\n learnMore: 'Tudj meg többet',\n waitingForResponseMsg: 'Kérjük, legyen türelemmel, még gondolkodunk',\n isRtl: false,\n },\n {\n prefix: 'EL',\n dialect: 'el-GR',\n englishName: 'Greek',\n arabicName: 'اليونانية',\n nativeName: 'Ελληνικά',\n detected: 'Εντοπισμένη γλώσσα',\n searching: 'Ψάχνοντας για',\n elevating: 'Ανυψώ',\n translating: 'Μεταφράζοντας σε',\n generatingAnswersForYou: 'Δημιουργία απαντήσεων για εσάς...',\n learnMore: 'Μάθε περισσότερα',\n waitingForResponseMsg: 'Παρακαλώ περιμένετε με υπομονή, σκεφτόμαστε ακόμα',\n isRtl: false,\n },\n {\n prefix: 'FI',\n dialect: 'fi-FI',\n englishName: 'Finnish',\n arabicName: 'الفنلندية',\n nativeName: 'Suomi',\n detected: 'Havaittu kieli',\n searching: 'Etsimässä',\n elevating: 'Nousee jhk',\n translating: 'Kääntäen',\n generatingAnswersForYou: 'Luodaan vastauksia sinulle...',\n learnMore: 'Lue lisää',\n waitingForResponseMsg: 'Ole hyvä ja ole kärsivällinen, ajattelemme yhä',\n isRtl: false,\n },\n {\n prefix: 'DA',\n dialect: 'da-DK',\n englishName: 'Danish',\n arabicName: 'الدانماركية',\n nativeName: 'Dansk',\n detected: 'Opdaget sprog',\n searching: 'Leder efter',\n elevating: 'Hæve til',\n translating: 'Oversættelse til',\n generatingAnswersForYou: 'Generer svar til dig...',\n learnMore: 'Lær mere',\n waitingForResponseMsg: 'Vent venligst tålmodigt, vi tænker stadig',\n isRtl: false,\n },\n {\n prefix: 'NL',\n dialect: 'nl-NL',\n englishName: 'Dutch',\n arabicName: 'الهولندية',\n nativeName: 'Nederlands',\n detected: 'Gedetecteerde taal',\n searching: 'Op zoek naar',\n elevating: 'Verheffen tot',\n translating: 'Vertalen naar',\n generatingAnswersForYou: 'Antwoorden voor u genereren...',\n learnMore: 'Lees meer',\n waitingForResponseMsg: 'Gelieve geduld te hebben, we zijn nog aan het nadenken',\n isRtl: false,\n },\n {\n prefix: 'SV',\n dialect: 'sv-SE',\n englishName: 'Swedish',\n arabicName: 'السويدية',\n nativeName: 'Svenska',\n detected: 'Upptäckt språk',\n searching: 'Söker efter',\n elevating: 'Upphöjande till',\n translating: 'Översätta till',\n generatingAnswersForYou: 'Genererar svar åt dig...',\n learnMore: 'Läs mer',\n waitingForResponseMsg: 'Vänligen ha tålamod, vi tänker fortfarande',\n isRtl: false,\n },\n {\n prefix: 'PT',\n dialect: 'pt-PT',\n englishName: 'Portuguese',\n arabicName: 'البرتغالية',\n nativeName: 'Português',\n detected: 'Idioma detectado',\n searching: 'Procurando por',\n elevating: 'Elevando para',\n translating: 'Traduzindo para',\n generatingAnswersForYou: 'Gerando respostas para você...',\n learnMore: 'Saiba mais',\n waitingForResponseMsg: 'Por favor, tenha paciência, ainda estamos a pensar',\n isRtl: false,\n },\n {\n prefix: 'IT',\n dialect: 'it-IT',\n englishName: 'Italian',\n arabicName: 'الإيطالية',\n nativeName: 'Italiano',\n detected: 'Lingua rilevata',\n searching: 'Alla ricerca di',\n elevating: 'Elevare a',\n translating: 'Tradurre in',\n generatingAnswersForYou: 'Generazione di risposte per te...',\n learnMore: 'Scopri di più',\n waitingForResponseMsg: 'Per favore, abbi pazienza, stiamo ancora pensando',\n isRtl: false,\n },\n {\n prefix: 'DE',\n dialect: 'de-DE',\n englishName: 'German',\n arabicName: 'الألمانية',\n nativeName: 'Deutsch',\n detected: 'Erkannte Sprache',\n searching: 'Auf der Suche nach',\n elevating: 'Erhöhung zu',\n translating: 'Übersetzung auf',\n generatingAnswersForYou: 'Wir generieren Antworten für Sie...',\n learnMore: 'Erfahre mehr',\n waitingForResponseMsg: 'Bitte haben Sie Geduld, wir denken noch nach',\n isRtl: false,\n },\n {\n prefix: 'ES',\n dialect: 'es-AR',\n englishName: 'Spanish',\n arabicName: 'الأسبانية',\n nativeName: 'Español',\n detected: 'Idioma detectado',\n searching: 'Buscando',\n elevating: 'Elevando a',\n translating: 'Traduciendo a',\n generatingAnswersForYou: 'Generando respuestas para ti...',\n learnMore: 'Aprende más',\n waitingForResponseMsg: 'Por favor, ten paciencia, todavía estamos pensando',\n isRtl: false,\n },\n {\n prefix: 'FR',\n dialect: 'fr-FR',\n englishName: 'French',\n arabicName: 'الفرنسية',\n nativeName: 'Français',\n detected: 'Langue détectée',\n searching: 'À la recherche de',\n elevating: 'Élever à',\n translating: 'Traduire par',\n generatingAnswersForYou: 'Générer des réponses pour vous...',\n learnMore: 'En savoir plus',\n waitingForResponseMsg: 'Veuillez patienter, nous réfléchissons encore',\n isRtl: false,\n },\n {\n prefix: 'EN',\n dialect: 'en-US',\n englishName: 'English',\n arabicName: 'الإنجليزية',\n nativeName: 'English',\n detected: 'Detected language',\n searching: 'Searching for',\n elevating: 'Elevating to',\n translating: 'Translating to',\n generatingAnswersForYou: 'Generating answers for you...',\n learnMore: 'Learn more',\n waitingForResponseMsg: 'Please bear with us, we are still thinking',\n isRtl: false,\n },\n {\n prefix: 'AR',\n dialect: 'ar-AE',\n englishName: 'Arabic',\n arabicName: 'العربية',\n nativeName: 'العربية',\n detected: 'اللغة المكتشفة',\n searching: 'البحث عن',\n elevating: 'رفع إلى',\n translating: 'ترجمة إلى',\n generatingAnswersForYou: 'جارٍ إنشاء إجابات لك...',\n learnMore: 'تعرف على المزيد',\n waitingForResponseMsg: 'نرجو منك التحلّي بالصبر، نحن ما زلنا نفكر',\n isRtl: true,\n },\n {\n prefix: 'KA',\n dialect: 'ka-GE',\n englishName: 'Georgian',\n arabicName: 'الجورجية',\n nativeName: 'ქართული',\n detected: 'გამოვლენილი ენა',\n searching: 'ძიება',\n elevating: 'ამაღლება',\n translating: 'თარგმნა',\n generatingAnswersForYou: 'პასუხების გენერირება თქვენთვის...',\n learnMore: 'გაიგე მეტი',\n waitingForResponseMsg: 'გთხოვთ მოითმინოთ, ჯერ კიდევ ვფიქრობთ',\n isRtl: false,\n },\n]) as readonly FlyLocaleEntry[];\n\n/**\n * Lookup by BCP-47 dialect (e.g. `'ar-AE'`). Case-insensitive per BCP-47 §2.1.1\n * (subtags are case-insensitive on the wire) — accepts `'en-US'`, `'en-us'`,\n * `'EN-US'`, etc. all as the canonical EN entry. The catalog itself keeps its\n * canonical casing for display.\n *\n * Returns `undefined` when not found; callers decide whether to fall back to `'en-US'`.\n */\nexport function findLocaleByDialect(dialect: string): FlyLocaleEntry | undefined {\n if (typeof dialect !== 'string' || dialect.length === 0) return undefined;\n const lower = dialect.toLowerCase();\n return FLY_LOCALE_CATALOG.find((e) => e.dialect.toLowerCase() === lower);\n}\n\n/**\n * Lookup by short prefix (e.g. `'AR'`). Prefixes are unique in the catalog (asserted by tests).\n * Case-insensitive — accepts `'AR'`, `'ar'`, `'Ar'`. Catalog stores prefixes uppercase\n * for display.\n */\nexport function findLocaleByPrefix(prefix: string): FlyLocaleEntry | undefined {\n if (typeof prefix !== 'string' || prefix.length === 0) return undefined;\n const lower = prefix.toLowerCase();\n return FLY_LOCALE_CATALOG.find((e) => e.prefix.toLowerCase() === lower);\n}\n\n/**\n * Type-narrowing helper for entries flagged RTL.\n *\n * Named with the `Entry` suffix to avoid colliding with the existing\n * `isRtlLocale(lang: string)` from `i18n.service.ts`, which answers a different\n * question (is the *UI* locale code RTL?). Both helpers coexist in `public-api`.\n */\nexport function isRtlLocaleEntry(\n entry: FlyLocaleEntry,\n): entry is FlyLocaleEntry & { isRtl: true } {\n return entry.isRtl === true;\n}\n","/*\n * @mohamedatia/fly-design-system — Public API\n * https://www.npmjs.com/package/@mohamedatia/fly-design-system\n *\n * This is the single entry point for Business / Supporting App developers.\n * Import everything from '@mohamedatia/fly-design-system' — never from relative shell paths.\n *\n * NOTE: This package is published under @mohamedatia/fly-design-system until the @fly\n * npm org is created. It will be republished as @fly/design-system once available.\n *\n * v1.3.0: FlyThemeService (html theme classes), hardened I18nService (AbortSignal, ErrorHandler, RTL helpers).\n * v1.3.1: loadBundle normalizes locale JSON (flat or nested objects; rejects invalid leaves).\n * v1.3.2: loadBundle returns boolean; LoadBundleOptions.silent skips ErrorHandler on failure.\n * v1.3.7: MockAuthService base class + MockAuthConfig for Business App mock auth via fileReplacements.\n * User model extended with optional avatar, source, twoFactorEnabled, createdAt fields.\n * v1.3.8: AuthService.init() no-op added so Business Apps can call init() in APP_INITIALIZER\n * without branching between standalone and embedded modes.\n * v1.3.9: MockAuthService field initializers moved into constructor to fix ngDevMode ReferenceError\n * when the package is loaded in a production-mode bundle (no ngDevMode global defined).\n * v1.4.0: ContextMenuComponent (positioned menu, keyboard nav, focus management) moved from desktop\n * shell to design system. MessageBoxService + MessageBoxComponent added (Windows Forms-style\n * modal dialogs with localized button labels, focus management, and Escape key support).\n * MessageBoxButtons, MessageBoxIcon, DialogResult, MessageBoxOptions, MessageBoxButton exported.\n * v1.5.0: SharePanelComponent — generic share/ACL overlay; host supplies API callbacks and optional\n * permission level options (file ACL vs note-style View/Edit).\n * v1.6.0: SharePanelComponent — `loadOuTree(chartId: string | null)`; optional `loadChartOptions` for\n * default vs alternative org charts (OU grants still use real OU ids). `ShareOrgChartOption` exported.\n * v1.7.0: SharePanelComponent — `loadChartOptions` and `loadOuLabelMap` are required; chart tree loads after\n * options resolve (no spurious null fetch). `loadOuLabelMap` supplies default-tree labels for OU rows.\n * v1.8.0: `WindowInstance` optional `contentUiBlocked` / `contentUiBlockMessageKey`; `WindowManagerService`\n * `beginContentUiBlock` / `endContentUiBlock` default no-ops; `FlyBlockUiComponent` for shell window overlay.\n * v1.10.0: SharePanelComponent — `supportsDeny` input + `isDeny?` on `SharePermissionEntry`. Surfaces an\n * \"Add as deny\" toggle in the add-permission row and renders existing deny grants with red\n * accent + ban icon. `grantToUser` / `grantToOu` callbacks gain a fourth `isDeny: boolean`\n * parameter (additive — existing 3-arg callers won't compile until updated). New locale keys\n * `files.share.add_as_deny`, `files.share.deny_help`, `files.share.denied` (en/ar/fr/ur).\n * Backed by Files Manager `FilePermission.IsDeny` and Notes `NoteShareLevel.Deny`.\n * v2.0.0: BREAKING — `SharePermissionEntry` adopts the `SharePrincipal` discriminated union\n * (`{ kind: 'user' | 'role' | 'ou' | 'app-everyone', ... }`) instead of the v1\n * `grantedToUserId` / `grantedToOuId` / `grantedToAppId` set-which-is-set fields.\n * Hosts must translate domain DTOs to/from the new shape (see\n * `file-access-control.component.ts` and `notes.component.ts` for migration patterns).\n * The `role` kind is reserved for the planned apps-chart role-as-principal flow;\n * hosts should not emit it until the backend's `PermissionResolver` enumerates a\n * user's full OU set (direct + computed-from-role memberships).\n * v2.1.0: AudienceBuilderComponent — generic <fly-audience-builder> form-control for composing\n * a `Fly.Shared.Core.Audience.AudienceFilter`. TypeScript model (`AudienceFilter`,\n * `AudienceTerm` discriminated union, `AUDIENCE_LIMITS`) mirrors the C# polymorphic\n * shape byte-for-byte (`kind` discriminator: users/roles/ou/app-everyone/chart/preset).\n * Reuses share-panel callback shapes (searchUsers, loadOuTree, loadChartOptions,\n * loadRoleOus). Distinct from share-panel: emits `(audienceChange)` + `(validityChange)`\n * instead of auto-persisting; hosts save on submit. New `audience.*` locale namespace.\n * v2.3.0: Deep-link launch contract — `LAUNCH_CONTEXT` injection token + `LaunchContext`\n * type for federated remotes to receive a route + params payload when the host\n * opens (or re-opens) their window via a `?app=&route=¶ms=` URL on the shell.\n * Token resolves to `Signal<LaunchContext | null>`; `null` when no host provider.\n * Backed by `Fly.Shared.Core.Apps.IDeepLinkBuilder` for outbound URL generation.\n * v2.2.0: AudienceBuilderComponent now implements `ControlValueAccessor` + `Validator` so\n * hosts can bind via `formControl` / `formControlName` / `[(ngModel)]`. Existing\n * `[value]` + `(audienceChange)` + `(validityChange)` API still works (forms wiring\n * is purely additive). `AUDIENCE_PRESETS` const exported for hosts that build their\n * own preset pickers. `OuTerm.chartId` and `OuTerm.includeDescendants` are now\n * REQUIRED (no longer optional) so wire round-trips are deterministic — emit explicit\n * `null` / `boolean` rather than `undefined`. New `AudienceErrorCodes` mirror added.\n * v2.4.0: SharePanelComponent + AudienceBuilderComponent — `defaultChartSystemKey` and\n * `defaultChartId` inputs let hosts pre-select a specific chart in the OU picker\n * without knowing the tenant-scoped Guid. `ShareOrgChartOption` gains an optional\n * `systemKey` field so platform-managed charts (`'apps'`, `'default-company'`) are\n * identifiable across tenants. New `SHARE_ORG_CHART_SYSTEM_KEY_APPS` /\n * `SHARE_ORG_CHART_SYSTEM_KEY_DEFAULT` constants exported.\n * v2.5.0: Agent input contracts (Phase 1 of the `<fly-agent-input>` plan) — additive only.\n * `AgentCommandRegistry` + `AgentDropRegistry` (singletons via `providedIn: 'root'`,\n * shared across federation), `flyAgentDraggable` directive, payload-guard helpers\n * (`validateAgentPayload`, `trimAgentPayload`, `trimAgentString`, `utf8ByteLength`),\n * and the cross-cutting `FLY_LOCALE_CATALOG` (31 entries, frozen — verbatim port of\n * `Fly.Shared.Core.LanguageDTO[]`). Three RTL flagged: `he-IL`, `ur-IN`, `ar-AE`.\n * The catalog's RTL helper is exported as `isRtlLocaleEntry` to avoid colliding with\n * the existing `isRtlLocale(lang: string)` from `i18n.service.ts`.\n * No UI consumers yet — Phase 2 wires the registries into the shell input component.\n * v2.9.0: Federation-safe cross-app deep-linking contract. The shell publishes\n * every launch onto a `FLYOS_LAUNCH_EVENT` (`'flyos:launch'`) window\n * CustomEvent AND a `globalThis[FlyosPendingLaunchesGlobalKey]` registry,\n * both keyed by `appId`. New exports: `FLYOS_LAUNCH_EVENT`,\n * `FlyosPendingLaunchesGlobalKey`, `FlyLaunchEventDetail`,\n * `FlyosPendingLaunches`. `LAUNCH_CONTEXT` is now documented as\n * shell-internal — Native Federation can split the InjectionToken across\n * host/remote bundles, so federated remotes must consume the\n * event + registry surfaces. See `skills/cross-app-deep-linking.md`.\n * Also: new `SourceAppResolver` service + `APP_LOOKUP` adapter token,\n * centralising the canonicalization rule that strips `-service` from\n * JWT client_ids (`circles-service` → `circles`) so chips, banners,\n * and launchers stay consistent across the shell.\n * v2.6.0: Agent action bus + flight animator. New imperative sibling to\n * `AgentCommandRegistry` / `AgentDropRegistry`: `AgentActionBus` lets\n * any app push a typed `AgentAction { verb, payload, dispatch, originRect }`\n * to the agent panel without going through drag-drop. `AgentFlightAnimator`\n * plays a FLIP-style transform animation from the source DOM rect to the\n * registered panel-header rect (hardcoded 420 ms / cubic-bezier; honours\n * prefers-reduced-motion). Phase 1 supports `dispatch: 'stage'` only —\n * `'auto'` throws `AgentActionUnsupportedDispatchError` until\n * `AgentInputComponent.programmaticSubmit` ships. Re-uses\n * `AgentDragPayload<T>` as the wire envelope so drag and programmatic\n * transports never fork. New verbs: `explain`, `why-empty`,\n * `compose-query`, `compare`, `forecast`, `summarize`.\n * v2.10.0: Per-window help-deeplink contract. The shell renders a help-icon\n * button in every non-chromeless `<fly-window>` titlebar. By default\n * the deeplink uses `win.appId`; apps override or augment via the\n * new `WINDOW_HELP_HINT` InjectionToken (a `WritableSignal<WindowHelpHint | null>`)\n * provided per-window. `WindowHelpHint` is `{ appId?, topic? }` —\n * `topic` is a free-form search-query seed updated dynamically as the\n * user navigates within the app. New federation-safe channel\n * `FLY_WINDOW_HELP_HINT_EVENT` mirrors the DI surface for federated\n * remotes. New exports: `WindowHelpHint`, `WINDOW_HELP_HINT`,\n * `FLY_WINDOW_HELP_HINT_EVENT`, `FlyWindowHelpHintEventDetail`.\n * Backed by the help-center reader's new `params.topic` launch payload\n * and \"no help for this app yet\" empty-state. See\n * `skills/help-center.md` and `skills/desktop-shell-angular.md`.\n * v2.5.1: New `MessageBoxService.showAcknowledged()` entry point returning\n * `DialogResultWithAcknowledgement` for \"Don't ask again\"-style flows.\n * The `dontAskAgain` config (`MessageBoxDontAskAgainConfig`) lives ONLY on\n * `MessageBoxOptionsWithAcknowledgement` — the base `MessageBoxOptions`\n * no longer carries it, so the type system enforces \"checkbox ⇒ caller\n * MUST use `showAcknowledged()`\" and eliminates the silent-discard path\n * on `show()`. Existing `show()` callers are unaffected. Case-insensitive\n * `findLocaleByDialect` / `findLocaleByPrefix` (BCP-47 §2.1.1). See\n * `.workflow/plans/agent-input-component.md` Phase 2b-1.\n * See docs/ExternalAppsGuide/03-frontend-app.md.\n */\n\n// ─── Federation singleton self-check (side effect; must run first) ───────────\n// Loud console.error if a federated remote forks its own DS copy instead of\n// binding to the shell's shared singleton. See the module doc.\nimport './lib/fly-federation-singleton-guard';\n\n// ─── Models ──────────────────────────────────────────────────────────────────\nexport type { DesktopApp, DesktopAppKind } from './lib/models/app.model';\nexport type {\n WindowInstance,\n WindowState,\n ChildWindowData,\n LaunchContext,\n FlyLaunchEventDetail,\n FlyosPendingLaunches,\n FlyRemoteRouteEventDetail,\n WindowHelpHint,\n FlyWindowHelpHintEventDetail,\n} from './lib/models/window.model';\nexport {\n WINDOW_DATA,\n LAUNCH_CONTEXT,\n FLYOS_LAUNCH_EVENT,\n FlyosPendingLaunchesGlobalKey,\n FLYOS_REMOTE_ROUTE_EVENT,\n FlyosShellOwnsHistoryGlobalKey,\n WINDOW_HELP_HINT,\n FLY_WINDOW_HELP_HINT_EVENT,\n} from './lib/models/window.model';\nexport type { User } from './lib/models/user.model';\n\nexport type {\n SharePermissionEntry,\n SharePrincipal,\n SharePrincipalKind,\n UserPrincipal,\n RolePrincipal,\n OuPrincipal,\n AppEveryonePrincipal,\n ShareUserResult,\n ShareOuNode,\n ShareOrgChartOption,\n SharePanelLevelOption,\n} from './lib/models/share-panel.model';\nexport {\n SHARE_ORG_CHART_SYSTEM_KEY_DEFAULT,\n SHARE_ORG_CHART_SYSTEM_KEY_APPS,\n} from './lib/models/share-panel.model';\n\n// ─── Audience Targeting ──────────────────────────────────────────────────────\nexport type {\n AudienceFilter,\n AudienceTerm,\n AudienceTermKind,\n UsersTerm,\n RolesTerm,\n OuTerm,\n AppEveryoneTerm,\n ChartTerm,\n PresetTerm,\n AudiencePresetKind,\n AudienceOptions,\n} from './lib/models/audience.model';\nexport {\n AUDIENCE_LIMITS,\n AUDIENCE_TERM_KINDS,\n AUDIENCE_PRESETS,\n} from './lib/models/audience.model';\n\n/**\n * Stable error codes returned by audience-aware backend endpoints. Mirror of\n * `Fly.Shared.Core.Audience.AudienceErrorCodes`. Compare on these strings, not on HTTP\n * status, so localized messages can change without breaking integrations.\n */\nexport const AUDIENCE_ERROR_CODES = {\n invalidFilter: 'INVALID_AUDIENCE_FILTER',\n audienceTooLarge: 'AUDIENCE_TOO_LARGE',\n resolverUnavailable: 'AUDIENCE_RESOLVER_UNAVAILABLE',\n invalidAudienceKind: 'INVALID_AUDIENCE_KIND',\n} as const;\nexport type AudienceErrorCode =\n (typeof AUDIENCE_ERROR_CODES)[keyof typeof AUDIENCE_ERROR_CODES];\n\nexport type { AudienceEditTarget } from './lib/components/audience-builder/audience-builder.component';\n\n// ─── Remote App Registration ─────────────────────────────────────────────────\nexport type { RemoteAppDef } from './lib/models/remote-app.model';\n\n// ─── Services ────────────────────────────────────────────────────────────────\nexport { AuthService } from './lib/services/auth.service';\nexport type { LoadBundleOptions } from './lib/services/i18n.service';\nexport { I18nService, RTL_LOCALE_SET, isRtlLocale } from './lib/services/i18n.service';\n// Built-in DS component strings (lowest-priority I18nService layer). Exported so a\n// standalone consumer can introspect/extend the keys DS components rely on.\nexport { DS_BASELINE_LOCALES } from './lib/i18n/baseline-locales';\nexport {\n FlyThemeService,\n type FlyThemeMode,\n DEFAULT_FLY_THEME_MODE,\n FLY_THEME_MODE_IDS,\n normalizeFlyTheme,\n} from './lib/services/fly-theme.service';\nexport {\n WindowManagerService,\n StandaloneWindowManagerService,\n type OpenWindowOptions,\n} from './lib/services/window-manager.service';\nexport { FlyRemoteRouter } from './lib/services/fly-remote-router.service';\nexport {\n FlyRemoteContextService,\n type FlyRemoteContext,\n FLY_REMOTE_CONTEXT_STORE_KEY,\n FLY_REMOTE_CONTEXT_EVENT,\n} from './lib/services/fly-remote-context.service';\nexport {\n SourceAppResolver,\n APP_LOOKUP,\n type AppLookup,\n type AppLookupEntry,\n} from './lib/services/source-app-resolver.service';\nexport { FlyWindowHelpService, type FlyWindowHelpPublisher } from './lib/services/fly-window-help.service';\nexport {\n loadRemoteStyles,\n unloadRemoteStyles,\n} from './lib/services/fly-remote-styles';\nexport {\n FLY_REMOTE_ROUTES,\n FLY_REMOTE_BASE_PATH,\n type FlyRemoteRoute,\n type FlyRemoteMatch,\n matchFlyRoutePattern,\n} from './lib/services/fly-remote-router.types';\nexport { FlyRemoteRouterOutletComponent } from './lib/components/fly-remote-router-outlet/fly-remote-router-outlet.component';\n\n// ─── Pipes ───────────────────────────────────────────────────────────────────\nexport { TranslatePipe } from './lib/pipes/translate.pipe';\n\n// ─── Mock Auth (for fileReplacements in dev/mock builds) ─────────────────────\nexport { MockAuthService, type MockAuthConfig } from './lib/services/auth.service.mock';\n\n// ─── Components ──────────────────────────────────────────────────────────────\nexport { EntityLookupComponent } from './lib/components/entity-lookup/entity-lookup.component';\nexport { type EntityLinkSelection } from './lib/components/entity-lookup/entity-lookup.types';\n\nexport { FlyMarkdownEditorComponent } from './lib/components/markdown-editor/markdown-editor.component';\nexport { FlyosLink, registerFlyosProtocol, FLYOS_PROTOCOL } from './lib/tiptap/flyos-link';\nexport {\n ENTITY_LINK_LAUNCHER,\n MARKDOWN_TOOLBAR_PRESETS,\n type EntityLinkLauncher,\n type MarkdownToolbarItem,\n type MarkdownToolbarPreset,\n} from './lib/components/markdown-editor/markdown-editor.types';\n\nexport {\n ContextMenuComponent,\n type ContextMenuItem,\n type ContextMenuSection,\n} from './lib/components/context-menu/context-menu.component';\n\nexport {\n MessageBoxComponent,\n} from './lib/components/message-box/message-box.component';\n\nexport {\n MessageBoxService,\n MessageBoxButtons,\n MessageBoxIcon,\n DialogResult,\n type MessageBoxOptions,\n type MessageBoxOptionsWithAcknowledgement,\n type MessageBoxDontAskAgainConfig,\n type MessageBoxButton,\n type DialogResultWithAcknowledgement,\n} from './lib/components/message-box/message-box.service';\n\nexport {\n SharePanelComponent,\n SHARE_PANEL_DEFAULT_FILE_LEVELS,\n type RoleOuLookupRow,\n} from './lib/components/share-panel/share-panel.component';\n\nexport {\n AudienceBuilderComponent,\n} from './lib/components/audience-builder/audience-builder.component';\n\nexport { FlyBlockUiComponent } from './lib/components/block-ui/block-ui.component';\n\nexport {\n FlyDrawerComponent,\n type FlyDrawerSize,\n type FlyDrawerSide,\n} from './lib/components/drawer/drawer.component';\n\n// ─── File Upload Components ─────────────────────────────────────────────────\nexport type { FlyFileInfo } from './lib/models/file.model';\n\nexport { FlyImageUploadComponent } from './lib/components/image-upload/fly-image-upload.component';\n\nexport { FlyFileUploadComponent } from './lib/components/file-upload/fly-file-upload.component';\n\n// ─── Agent input — registries, directives, types (Phase 1) ──────────────────\nexport {\n AgentCommandRegistry,\n AgentLookupRegistry,\n AgentDropRegistry,\n AgentActionBus,\n AgentFlightAnimator,\n} from './lib/services/agent-input';\n\nexport type {\n AgentAction,\n AgentActionVerb,\n AgentActionDispatch,\n} from './lib/models/agent-action.model';\n\nexport { AgentActionUnsupportedDispatchError } from './lib/models/agent-action.model';\n\nexport { FlyAgentDraggableDirective } from './lib/directives/fly-agent-draggable.directive';\nexport { FlySecureSrcDirective } from './lib/directives/fly-secure-src.directive';\n\nexport {\n AGENT_DRAG_MIME,\n AGENT_PAYLOAD_VERSION,\n SUPPORTED_AGENT_PAYLOAD_VERSIONS,\n DEFAULT_AGENT_PAYLOAD_LIMITS,\n} from './lib/models/agent-input.model';\n\nexport type {\n AgentCommand,\n AgentCommandScope,\n AgentCommandHandle,\n AgentCommandRegistration,\n AgentCommandSlashSpec,\n AgentCommandContextBinding,\n LookupSearch,\n LookupDescriptor,\n LookupRegistration,\n LookupResult,\n LookupHandle,\n AgentDragPayload,\n AgentMessageEnvelope,\n AgentEnvelopeAttachment,\n AgentMcpScope,\n AgentDropChipMode,\n AgentChipHostInputs,\n AgentDraggableItem,\n AgentDropRendererRegistration,\n AgentPayloadLimits,\n AgentPayloadValidationResult,\n} from './lib/models/agent-input.model';\n\nexport {\n utf8ByteLength,\n trimAgentString,\n trimAgentPayload,\n validateAgentPayload,\n AgentPayloadOversizeError,\n} from './lib/utils/agent-payload-guards';\n\n// ─── Cross-cutting locale catalog (dictation today, future translation feature) ──\nexport type { FlyLocaleEntry } from './lib/models/fly-locale-catalog.model';\nexport {\n FLY_LOCALE_CATALOG,\n findLocaleByDialect,\n findLocaleByPrefix,\n isRtlLocaleEntry,\n} from './lib/models/fly-locale-catalog';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"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