import { b as Scope, C as ContextValue, d as ContextField, e as ContextFieldKind, f as ContextReference } from '../doors-DZzgZBEf.js'; export { A as ARCHIVED_SCOPES_PAGE, g as ArchivedScope, h as ArchivedScopeType, i as CONTEXT_FIELD_KINDS, j as ContextFieldSpec, k as ContextPolicy, l as ContextSensitivity, m as ContextValueWrite, n as ContextValueWritten, F as FIELD_KERNEL_ID, o as FILE_KERNEL_ID, I as INCOMPLETE_SAVE_REFUSAL, p as IncompleteValue, R as ReadContextFileText, q as SCOPES_PER_CALL, r as SCOPES_PER_VALUES_CALL, s as SCOPE_TYPES_PER_FIELDS_CALL, t as SYSTEM_CONTEXT_TYPE_ID, a as ScopeDoorCall, S as ScopeDoors, u as ScopePage, v as ScopeSpec, w as ScopeTemplate, x as ScopeType, y as ScopeTypeLabel, z as ScopeTypeSkeleton, B as ScopeTypeSpec, D as ScopeTypeWithScopes, E as ScopeWithType, G as StoreSystemItemRow, H as StoreWholeValue, J as SystemContextField, K as SystemContextItemClass, T as TYPE_SCOPES_PAGE, L as TableTemplate, M as TableTemplateField, N as completeWholeValues, O as contextFieldFromStore, P as contextFieldKind, Q as contextValueFromStore, U as contextValueWrite, c as createScopeDoors, V as incompleteSaveRefusal, W as referenceFence, X as referencesFromFence, Y as referencesOf, Z as scopeFromStore, _ as scopeTypeFromStore, $ as scopeWithTypeFromStore, a0 as settingFromStore, a1 as systemContextFieldFromStore } from '../doors-DZzgZBEf.js'; import { Uuid, RecordsResult } from '../core/index.js'; /** An organization role, as `iam.organization_member` holds it. */ type ScopeSeatRole = "owner" | "admin" | "member" | string; /** * WHO MAY CHANGE A SCOPE TYPE'S STRUCTURE — rename it, add/edit/archive its fields, archive or restore * it: an organization owner or admin, or the person who made the type. Every member works the DATA * (adds, renames, archives and restores scopes, writes values). Arman 2026-10-07: "structure is the * org admins' and the creator's". Mirrors `custom.context_type_write` / `_archive` / `_restore` and * `custom.context_item_write` / `_archive` / `_restore`. */ declare function canShapeScopeType(role: ScopeSeatRole | null | undefined, userId: Uuid | null | undefined, type: { created_by?: Uuid | null; } | null | undefined): boolean; /** Display name → kebab URL slug. */ declare function toSlug(name: string): string; /** Display name → snake_case field key. */ declare function toFieldKey(name: string): string; /** True when `s` is a clean slug: a-z, 0-9, single hyphens or underscores between words. */ declare function isValidSlug(s: string): boolean; /** Route segments that are literal pages of the scope screens; no slug may equal one. */ declare const RESERVED_SCOPE_SLUGS: ReadonlySet; declare function isReservedSlug(s: string): boolean; /** * Two slugs name the same thing when they differ only by `-` ↔ `_` (the store's Table grammar is * `practice_areas`; a link a person typed may say `practice-areas`). */ declare function sameSlug(a: string | null | undefined, b: string | null | undefined): boolean; /** The slug a write sends: the one supplied, else one made from the name; refused when unusable. */ declare function resolveSlug(supplied: string | undefined, fallbackName: string): RecordsResult; /** One context field of a scope type beside the scope's value for it (`value` null = empty). */ interface ScopeFieldValue { field: ContextField; value: ContextValue | null; has_value: boolean; } /** A scope type's fields beside one scope's values, in the fields' order. */ declare function joinFieldValues(fields: readonly ContextField[], values: Readonly>): ScopeFieldValue[]; /** Whether a value holds anything: a reference cell its references, any other cell a non-empty value. */ declare function hasCell(value: Pick): boolean; type ContextSourceKind = "scope" | "project" | "task"; type ContextSourceOrigin = "local" | "global"; /** One contributor to a resolved context. Lower `priority` = closer to the action. */ interface ContextSource { kind: ContextSourceKind; id: Uuid; origin: ContextSourceOrigin; priority: number; } /** A resolved cell. A reference cell's `value` is its `referenceFence(references)`. */ interface ResolvedValue { field_id: Uuid; key: string; label: string; kind: ContextFieldKind; value: unknown; references: ContextReference[]; version: number; } interface ScopeContradiction { scope_type_id: Uuid; global_scope_id: Uuid; local_scope_id: Uuid; } interface ResolvedScopeContext { /** field id → the winning cell. */ values: Record; /** field id → the source that won it. */ sourcePerKey: Record; contradictions: ScopeContradiction[]; /** Every contributing source, closest first. */ activeScopes: ContextSource[]; } interface ResolveScopeContextInput { /** Finds a scope (for its type) by id; a scope it cannot find contributes nothing locally. */ scopeById: (id: Uuid) => Pick | undefined; local?: { taskId?: Uuid | null; projectId?: Uuid | null; scopeIds?: readonly Uuid[]; }; global?: { taskId?: Uuid | null; projectId?: Uuid | null; scopeIds?: readonly Uuid[]; }; /** scope id → its values by field id; a scope whose values are not read yet is absent. */ valuesByScope: Readonly> | undefined>>; /** field id → its field, for the label (a field not here resolves with an empty label). */ fieldById?: (id: Uuid) => Pick | undefined; } /** Local-vs-global resolution of the active scopes' values (see the header for the rule). */ declare function resolveScopeContext(input: ResolveScopeContextInput): ResolvedScopeContext; /** One cell as a resolved value: a reference cell's `value` is its fence. */ declare function toResolvedValue(cell: ContextValue, label?: string): ResolvedValue; export { ContextField, ContextFieldKind, ContextReference, ContextValue, RESERVED_SCOPE_SLUGS, Scope, canShapeScopeType, hasCell, isReservedSlug, isValidSlug, joinFieldValues, resolveScopeContext, resolveSlug, sameSlug, toFieldKey, toResolvedValue, toSlug }; export type { ContextSource, ContextSourceKind, ContextSourceOrigin, ResolveScopeContextInput, ResolvedScopeContext, ResolvedValue, ScopeContradiction, ScopeFieldValue, ScopeSeatRole };