@standards/schema 1.0.0-alpha.406 → 1.0.0-alpha.407

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/{all-Bqa1vVKw.d.mts → all-1spF7ByM.d.mts} +10 -10
  2. package/dist/all-BNOv4MuC.js +2 -0
  3. package/dist/all-Bzzltedd.mjs +2 -0
  4. package/dist/{all-B85Wnp0r.d.ts → all-CYfzNNTD.d.ts} +10 -10
  5. package/dist/api/index.d.mts +54 -167
  6. package/dist/api/index.d.ts +54 -167
  7. package/dist/api/index.js +1 -1
  8. package/dist/api/index.mjs +1 -1
  9. package/dist/{attributes-Ck0gooEG.d.mts → attributes-CB6EJyu2.d.mts} +1 -1
  10. package/dist/{attributes-DW963WrS.d.ts → attributes-DPwwMMgq.d.ts} +1 -1
  11. package/dist/{checkbox-BKYTSUqh.d.mts → checkbox-B6TumdR6.d.mts} +2 -2
  12. package/dist/{checkbox-nWLlzMJ1.d.ts → checkbox-M5L3PYDZ.d.ts} +2 -2
  13. package/dist/{date-duOYv4di.d.ts → date-D5D3aP1p.d.ts} +2 -2
  14. package/dist/{date-DaPijpKs.d.mts → date-DM0ExRcF.d.mts} +2 -2
  15. package/dist/{exceptions-DXqs9eEl.d.ts → exceptions-BlKiQcvh.d.mts} +2 -6
  16. package/dist/{exceptions-DXqs9eEl.d.mts → exceptions-BlKiQcvh.d.ts} +2 -6
  17. package/dist/exceptions.d.mts +1 -1
  18. package/dist/exceptions.d.ts +1 -1
  19. package/dist/exceptions.js +1 -1
  20. package/dist/exceptions.mjs +1 -1
  21. package/dist/{index-DI3HCT5W.d.mts → index-BQ4MPVw-.d.ts} +137 -259
  22. package/dist/{index-DYUP0iFu.d.ts → index-Ba5hViTX.d.ts} +1 -1
  23. package/dist/{index-C5uNsr5k.d.mts → index-CIS58KNs.d.mts} +2 -2
  24. package/dist/{index-DDYMnrrw.d.ts → index-CPeCTcO1.d.mts} +137 -259
  25. package/dist/{index-D4QnVstw.d.mts → index-CXyPgHS_.d.mts} +1 -1
  26. package/dist/{index-DOGNjgeo.d.ts → index-ChyZg9Dl.d.ts} +2 -2
  27. package/dist/{index-D2VrYWdg.d.ts → index-CkNJkuYX.d.ts} +3 -3
  28. package/dist/{index-DdPx9mQV.d.mts → index-DfaotFfW.d.mts} +3 -3
  29. package/dist/index.d.mts +10 -10
  30. package/dist/index.d.ts +10 -10
  31. package/dist/index.js +1 -1
  32. package/dist/index.mjs +1 -1
  33. package/dist/{number-D9YL-T2k.d.mts → number-BulsVlZX.d.mts} +2 -2
  34. package/dist/{number-wv170cGZ.d.ts → number-CIP0eOB9.d.ts} +2 -2
  35. package/dist/{objects-BaZWr4GU.d.ts → objects-B07Ix6br.d.ts} +2 -2
  36. package/dist/{objects-DHddGZu5.d.mts → objects-Cvc21DHf.d.mts} +2 -2
  37. package/dist/record-aggregates-Bhi1lCSm.js +2 -0
  38. package/dist/record-aggregates-DEBOOgA0.mjs +2 -0
  39. package/dist/record-operation-CuRWYQ7i.js +2 -0
  40. package/dist/record-operation-CylhzAbn.mjs +2 -0
  41. package/dist/{text-CHRRi3X_.d.mts → text-9dEmwy7y.d.mts} +2 -2
  42. package/dist/{text-Dbo08j8D.d.ts → text-BsEjIQsm.d.ts} +2 -2
  43. package/dist/{utils-BUDoiMT0.d.ts → utils-5JI2a7Qr.d.ts} +1 -1
  44. package/dist/{utils-tn-_IHkr.d.mts → utils-Vep_JDSS.d.mts} +1 -1
  45. package/dist/utils.d.mts +1 -1
  46. package/dist/utils.d.ts +1 -1
  47. package/dist/validation/all.d.mts +4 -4
  48. package/dist/validation/all.d.ts +4 -4
  49. package/dist/validation/all.js +1 -1
  50. package/dist/validation/all.mjs +1 -1
  51. package/dist/validation/complex/currency.d.mts +2 -2
  52. package/dist/validation/complex/currency.d.ts +2 -2
  53. package/dist/validation/complex/location.d.mts +2 -2
  54. package/dist/validation/complex/location.d.ts +2 -2
  55. package/dist/validation/complex/phone.d.mts +2 -2
  56. package/dist/validation/complex/phone.d.ts +2 -2
  57. package/dist/validation/complex/relation.d.mts +2 -2
  58. package/dist/validation/complex/relation.d.ts +2 -2
  59. package/dist/validation/complex/richtext.d.mts +2 -2
  60. package/dist/validation/complex/richtext.d.ts +2 -2
  61. package/dist/validation/complex/select.d.mts +2 -2
  62. package/dist/validation/complex/select.d.ts +2 -2
  63. package/dist/validation/complex/user.d.mts +2 -2
  64. package/dist/validation/complex/user.d.ts +2 -2
  65. package/dist/validation/computed/formula.d.mts +2 -2
  66. package/dist/validation/computed/formula.d.ts +2 -2
  67. package/dist/validation/computed/rollup.d.mts +2 -2
  68. package/dist/validation/computed/rollup.d.ts +2 -2
  69. package/dist/validation/config/index.d.mts +1 -1
  70. package/dist/validation/config/index.d.ts +1 -1
  71. package/dist/validation/core/index.d.mts +1 -1
  72. package/dist/validation/core/index.d.ts +1 -1
  73. package/dist/validation/object/index.d.mts +1 -1
  74. package/dist/validation/object/index.d.ts +1 -1
  75. package/dist/validation/primitives/checkbox.d.mts +1 -1
  76. package/dist/validation/primitives/checkbox.d.ts +1 -1
  77. package/dist/validation/primitives/date.d.mts +1 -1
  78. package/dist/validation/primitives/date.d.ts +1 -1
  79. package/dist/validation/primitives/number.d.mts +1 -1
  80. package/dist/validation/primitives/number.d.ts +1 -1
  81. package/dist/validation/primitives/text.d.mts +1 -1
  82. package/dist/validation/primitives/text.d.ts +1 -1
  83. package/package.json +2 -2
  84. package/dist/all-B8viW8TH.mjs +0 -2
  85. package/dist/all-BFPhXNTB.js +0 -2
  86. package/dist/record-aggregates-CkETp1q-.js +0 -2
  87. package/dist/record-aggregates-ynh52lNO.mjs +0 -2
  88. package/dist/record-operation-COFZLn3T.mjs +0 -2
  89. package/dist/record-operation-DeR-ykzG.js +0 -2
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  /*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
- import{ACTIONABLE_DECISION_KINDS as e,AGGREGATE_BUCKETS as t,AGGREGATE_MEASURES as n,DECISION_INBOX_STATES as r,DECISION_KINDS as i,DECISION_LINE_MAX_LENGTH as a,DECISION_LINK_TARGET_TYPES as o,DECISION_LIST_STATES as s,DECISION_READ_STATES as c,DECISION_SETTINGS_AREAS as l,DECISION_TITLE_MAX_LENGTH as u,DECISION_TYPES_V1 as d,DECISION_TYPE_ACCESS_GRANTED as f,DECISION_TYPE_AGENT_APPROVAL as p,DECISION_TYPE_AGENT_QUESTION as m,DECISION_TYPE_AGENT_REVIEW as h,DECISION_TYPE_AGENT_ROUTINE_RUN_FAILED as ee,DECISION_TYPE_AGENT_ROUTINE_RUN_NOTICE as te,DECISION_TYPE_AGENT_SETUP as ne,DECISION_TYPE_CONNECTOR_CONNECTION_ERROR as re,DECISION_TYPE_CONNECTOR_CONNECTION_REAUTH_REQUIRED as ie,DECISION_TYPE_ENVIRONMENT_BUILD_FAILED as ae,DECISION_TYPE_KINDS as g,DECISION_TYPE_PERSON as oe,DECISION_TYPE_RECORD_ASSIGNED as se,DECISION_TYPE_RECORD_MENTIONED as ce,DECISION_WORK_STATES as le,MAX_AGGREGATE_GROUPS as ue,decisionThreadKey as de,formatDecisionLink as fe,isActionableDecisionKind as pe,parseDecisionLink as me}from"./record-aggregates-ynh52lNO.mjs";import{AGENDA_BLOCK as _,ARTIFACT_PREVIEW_EXTENSION as he,ATTRIBUTE_FILTER_OPERATORS as ge,ATTRIBUTE_TYPES as _e,BLOCK_CONTEXTS as ve,BLOCK_PERIODS as ye,BLOCK_WIDTHS as v,CARD_BLOCK as y,CHART_BLOCK as b,CHART_KINDS as be,CONTENT_PLACEMENT_CONTEXTS as xe,DECISIONS_BLOCK as Se,DEFAULT_LAYOUT_TRAITS as Ce,GROUPABLE_ATTRIBUTE_TYPES as we,HEADING_BLOCK as Te,INVENTORY_LIMIT as Ee,LOCATION_FILTER_PROPERTIES as De,MAILBOX_BLOCK as Oe,MEASURABLE_ATTRIBUTE_TYPES as ke,MEETINGS_UPCOMING_BLOCK as Ae,METRIC_BLOCK as x,NATIVE_BLOCKS as je,NO_VALUE_OPERATORS as Me,OPERATORS_BY_TYPE as Ne,PAGE_GRID_COLUMNS as Pe,QUALIFIED_SEPARATOR as Fe,QUERY_OBJECT as Ie,RECORD_LINKS_BLOCK as Le,RECORD_LINKS_CONTENT as S,RECORD_MEMORY_BLOCK as Re,RECORD_MEMORY_CONTENT as C,RECORD_OBJECT as ze,RELATION_TARGET_ANY as Be,REMOVED_OPERATOR_REPLACEMENTS as Ve,RecordQuery as He,SYNONYM_ALIASES as Ue,SYSTEM_ATTRIBUTES as We,SYSTEM_ATTRIBUTE_I18N_KEYS as Ge,SYSTEM_FILTER_ATTRIBUTE_TYPES as Ke,TEXT_BLOCK as w,attributeFilterTarget as qe,attributeInventory as Je,blockObjectInputs as Ye,buildQualifiedAttribute as Xe,canonicalizeFilterValue as Ze,capped as Qe,collectContentViewCatalogue as $e,collectQualifiedRuleIssues as et,collectionContentSourceSchema as tt,collectionSourceAddress as nt,collectionSourceAddressOf as rt,columnsSchema as it,contentExtensionRegistry as at,contentReadObjects as ot,contentViewDefinitionSchema as T,contentViewDefinitionSchemaFor as st,currentActor as ct,defineBlock as lt,describeViewIssue as ut,displayAttributesSchema as dt,draftContentViewDefinitionSchema as ft,draftContentViewDefinitionSchemaFor as pt,edgePropertyFilterTarget as mt,extractCurrencyFilterValue as ht,extractFilterValue as gt,filterOperatorsOfType as _t,filterStateSchema as vt,filterTargetsOf as yt,findGridViolation as bt,findGroupViolation as xt,findLayoutRuleViolation as St,findRelationAttribute as Ct,findRowLimitViolation as wt,getAttributeCapabilities as Tt,getAttributeFilterOperators as Et,getOperatorPolarity as Dt,getRollupFilterOperators as Ot,getSystemAttributeI18nKey as kt,getSystemAttributeList as At,gridPositionSchema as jt,groupSizeMessage as Mt,groupedMembers as Nt,inferInverseCardinality as Pt,input as Ft,invalidViewMessage as It,isAttributeFilterable as Lt,isAttributeGroupable as Rt,isAttributeKanbanGroupable as zt,isAttributeSearchable as Bt,isAttributeSortable as Vt,isBilateralRelation as Ht,isCalendarDay as Ut,isCollectionContent as Wt,isDynamicValue as Gt,isLocationFilterProperty as Kt,isLocationPartOperator as qt,isManagedSystemAttribute as Jt,isNoValueOperator as Yt,isRelativeDateValue as Xt,isSetMembershipOperator as Zt,isUniversalRelation as Qt,layoutTraitsOf as $t,locationPartFilterTarget as en,memberlessGroups as E,metricComparePeriod as tn,normalizeFilterRule as nn,normalizeForEdgeRpc as rn,normalizeOperator as an,now as on,overlaps as sn,pageTraitsOf as cn,parseBlockParameters as D,parseQualifiedAttribute as ln,publishedViewContentDefinitionSchema as O,query as un,recordQueryDefinitionSchema as dn,relationAcceptsObject as fn,relationTargetsOf as pn,requireContentPlacement as mn,requireRecordContentContext as hn,requireSingleRelationTarget as gn,resolveCollectionActions as _n,resolveContentNavigation as vn,resolveEffectiveFilterType as yn,resolveIsWithinBounds as bn,resolveUtcDayBounds as xn,singleRelationTarget as Sn,sortsSchema as Cn,sourcedAttributeOf as wn,systemColumnFilterTarget as Tn,toMultiValueOperator as En,toUtcDayString as Dn,today as On,validateContentViewCatalogue as kn,validateQualifiedRule as An,validateStoredViews as jn}from"./all-B8viW8TH.mjs";import{AccessDeniedError as Mn,AggregateValidationError as Nn,AmbiguousSchemaChangeError as Pn,AttributeInUseError as Fn,AttributeNotFoundError as In,ConcurrentModificationError as Ln,DuplicateError as k,ExportTooLargeError as Rn,ForbiddenError as zn,InvalidPermissionGrantError as Bn,LogoProviderUnavailableError as Vn,LogoSearchRateLimitedError as Hn,MemoryNotFoundError as Un,NotFoundError as Wn,NotImplementedError as Gn,ObjectNotFoundError as Kn,ObjectReferencedError as qn,OrphanSystemAttributeError as Jn,PageReferencedError as Yn,ProtectedResourceError as Xn,ProtectedRoleError as Zn,QueryTimeoutError as Qn,RealtimeDeliveryError as $n,RealtimeRateLimitedError as er,RealtimeSubscriptionError as tr,RecordNotFoundError as nr,RecordReferencedError as rr,RepositoryError as ir,ReservedObjectNameError as A,RoleNotFoundError as ar,SchemaError as j,SchemaErrorCode as M,SearchBackendError as or,SearchPathNotIndexedError as sr,StorageError as cr,SyncCascadeError as lr,SyncConflictError as ur,SyncError as dr,SystemEntityImmutableError as fr,ToolGroupGrantError as pr,ValidationError as N,WorkspaceInvariantReason as mr,isAttributeInUseError as hr,isNotFoundError as gr,isObjectReferencedError as _r,isProtectedResourceError as vr,isRecordReferencedError as yr,isSchemaError as br,isValidationError as xr}from"./exceptions.mjs";import{ACCESS_LEVELS as Sr,ACCESS_ROLES as Cr,AGENT_ASIDE_ANSWER_MAX_LENGTH as wr,AGENT_ASIDE_HISTORY_LIMIT as Tr,AGENT_ASIDE_QUESTION_MAX_LENGTH as Er,AGENT_AVATAR_EXPRESSIONS as Dr,AGENT_AVATAR_TYPES as Or,AGENT_MESSAGE_KIND as kr,AGENT_NOTIFICATION_KIND as Ar,AGENT_SESSION_ACCESS_ROLES as jr,AGENT_SESSION_LIST_ORDERS as Mr,AGENT_SESSION_ORIGINS as Nr,AGENT_SESSION_PROVENANCES as Pr,AGENT_STARTERS_MAX as Fr,AGENT_STARTER_MAX_LENGTH as Ir,AGENT_TASK_KINDS as Lr,ALL_CATALOG_TOOL_NAMES as Rr,ALWAYS_KINDS as zr,APPROVAL_FAMILY_TOOL_NAMES as Br,ARCHITECT_PUBLICATION_KIND as Vr,ASK_QUESTIONS_ANSWER_MAX_LENGTH as Hr,ASK_QUESTIONS_ANSWER_MAX_VALUES as Ur,ASK_QUESTIONS_MAX_BATCH as Wr,ASK_QUESTIONS_TOOL_NAME as Gr,AUDIT_ACTIONS as Kr,AUDIT_AGENT_SESSION_METADATA_KEY as qr,AUDIT_RESOURCE_TYPES as Jr,AgentBuilder as P,BROWSER_LAUNCH_TOOL_NAME as Yr,BUNDLE_LOCALES as Xr,CONNECTION_GRANT_PROVIDERS as Zr,CONTINUATION_KEY_PATTERN as Qr,CONVERSATION_SURFACES as $r,CORE_RECORD_TOOL_NAMES as ei,CORE_TOOL_NAMES as ti,COUNT_MODES as ni,DEFAULT_AGENT_EXECUTION_CONFIG as ri,DEFAULT_AGENT_TOOL_GROUPS as ii,DEFAULT_APPROVAL_POLICY as ai,DEFAULT_BLUEPRINT_TOOL_GROUPS as oi,DEFAULT_DAILY_ACTIVITY_DAYS as si,DEFAULT_MEETING_BOT_DISPLAY_NAME as ci,DEFAULT_TENANT_SETTINGS as li,DISCARD_ARCHITECT_DRAFT_TOOL_NAME as ui,DOCUMENT_SORT_MODES as di,DRAFT_WRITE_TOOL_NAMES as fi,EMAIL_CATEGORY_DEFAULT_COLOR as pi,EMAIL_CATEGORY_DEFAULT_ICON as mi,EMAIL_CATEGORY_DESCRIPTION_MAX as hi,EMAIL_CATEGORY_DESCRIPTION_MIN as gi,EMAIL_CATEGORY_LIMIT as _i,EMAIL_CATEGORY_NAME_MAX as vi,ENVIRONMENT_BUILD_LOG_STEP_PREFIX as yi,ENVIRONMENT_CHECKS_MAX as bi,ENVIRONMENT_CHECK_COMMAND_MAX_CHARS as xi,ENVIRONMENT_CHECK_NAME_MAX_CHARS as Si,ENVIRONMENT_HARNESSES as Ci,ENVIRONMENT_HARNESS_SANDBOX_WORKDIR as wi,ENVIRONMENT_HARNESS_WORKDIR as Ti,ENVIRONMENT_IMAGES as Ei,ENVIRONMENT_MEMORY_GB_PER_VCPU as Di,ENVIRONMENT_NAME_MAX_CHARS as Oi,ENVIRONMENT_NETWORK_ALLOW_MAX as ki,ENVIRONMENT_SCRIPT_MAX_BYTES as Ai,ENVIRONMENT_SIZES as ji,ENVIRONMENT_SIZE_VCPUS as Mi,ENVIRONMENT_STANDARDS_WORKDIR as Ni,ENV_VAR_KEY_PATTERN as Pi,ESTIMATED_COUNT_CAP as Fi,FILE_URLS_MAX_IDS as Ii,GET_ARCHITECT_DRAFT_TOOL_NAME as Li,GITHUB_TRIGGER_CATALOG as Ri,GRANT_ENABLES as zi,HITL_TOOL_NAMES as Bi,INFERENCE_REASONING_OPTIONS as Vi,INFERENCE_ROUTING_MODES as Hi,INFERENCE_SPEEDS as Ui,LAST_RUN_ERROR_MAX_LENGTH as Wi,MAILBOX_LIST_MODES as Gi,MAIL_DRAFT_BODY_MAX_CHARS as Ki,MAIL_SIGNATURE_MAX_CHARS as qi,MAIL_SUBJECT_MAX_CHARS as Ji,MAX_DAILY_ACTIVITY_DAYS as Yi,MAX_TODOS as Xi,MAX_TODO_DESCRIPTION_CHARS as Zi,MAX_TODO_ID_CHARS as Qi,MCP_SERVER_NAME_MAX_LENGTH as $i,MEETING_BOT_IMAGE as ea,MEETING_BOT_IMAGE_BASE64_MAX_LENGTH as ta,MEETING_RESPONSES as na,MEMORY_SPEND_LIMIT_PATTERN as ra,McpOAuthCompletionMode as ia,NATIVE_TOOL_GROUPS as aa,NATIVE_TOOL_GROUP_CATALOG as oa,NO_RECORDING as sa,OPEN_TOOL_PART_STATES as ca,OPERATION_MAX_STEPS as la,PROVIDER_DRAFT_LABEL as ua,PROVIDER_NAMES as da,PUBLIC_MAIL_DOMAINS as fa,QUESTION_FAMILY_TOOL_NAMES as pa,RECENT_ACTIVITY_LEDGER_LIMIT as ma,RECIPIENT_IDENTITIES_MAX as ha,RECORDING_OVERRIDES as ga,RECORDING_POLICIES as _a,RECORD_ACCESS_ROLES as va,RECORD_ACCESS_SOURCES as ya,RECORD_DRIVE_CURSOR_MAX_LENGTH as ba,RECORD_DRIVE_PAGE_DEFAULT_LIMIT as xa,RECORD_DRIVE_PAGE_MAX_LIMIT as Sa,RECORD_GRAPH_DEFAULT_LIMIT_PER_NODE as Ca,RECORD_GRAPH_MAX_LIMIT_PER_NODE as wa,RECORD_GRAPH_MAX_NODES as Ta,RECORD_IMAGE_MAX_BYTES as Ea,REPLY_MODES as Da,REQUEST_DESIGN_REVIEW_TOOL_NAME as Oa,REQUEST_SETUP_TOOL_NAME as ka,RESOURCE_GRANT_KINDS as Aa,RESOURCE_KIND_CATALOG as ja,ROUTING_PRICE_CEILINGS as Ma,SESSION_INFERENCE_PATCH_KEYS as Na,SLACK_TRIGGER_CATALOG as Pa,SURFACE_TOOL_NAMES as Fa,SYSTEM_EMAIL_CATEGORIES as Ia,SYSTEM_EMAIL_CATEGORY_NAMES as La,SYSTEM_PART_CODES as Ra,TASK_DEMAND_LEVELS as za,TODO_PHASES as Ba,TODO_PLAN_STATUSES as Va,TODO_STATUSES as Ha,TOOL_APPROVAL_STATES as Ua,TRIAGE_ACTIONS as Wa,TRIGGER_EVENT_TYPES as Ga,TURN_OUTCOMES as Ka,UNSHAREABLE_OBJECT_NAMES as qa,USERS_RESOLVE_MAX_IDS as Ja,USER_STATUSES as Ya,USER_WORK_POSTURES as Xa,VERB_NAMES as Za,agent as Qa,agentAvatarFromMetadata as $a,agentAvatarSchema as eo,agentDataChunk as to,agentDisplayName as no,agentInferencePreferencesSchema as ro,agentMessageAttachmentSchema as io,agentMessagePartSchema as ao,agentScheduleSchema as oo,agentSessionInferenceOverridesInputSchema as so,agentSessionInferenceOverridesSchema as co,agentSessionMessageSchema as lo,agentStartersSchema as uo,agentTriggerBaseSchema as fo,agentTriggerPatchSchema as po,agentTriggerSchema as mo,agentUIValidationError as ho,artifactQuoteSchema as go,askQuestionsOutputSchema as _o,assertCustomAgentUIMessageChunk as vo,assertSessionState as yo,canonicalToolGroups as bo,classificationRestoreSchema as xo,classifyEmailSchema as So,cliDefaultModelOf as Co,compareAgentSessionMessages as wo,compiledHarnessModels as To,connectionGrantKindsOf as Eo,connectorTriggerMatchSchema as Do,customDataChunkSchemas as Oo,decodeAgentSessionListCursor as ko,deriveViewerAccess as Ao,durableDateSchema as jo,emailCategoryCreateSchema as Mo,emailCategoryDeleteSchema as No,emailCategoryScopeQuerySchema as Po,emailCategoryUpdateSchema as Fo,emailRuleScopeSchema as Io,encodeAgentSessionListCursor as Lo,environmentHarness as Ro,environmentWorkdir as zo,findEnvironmentHarness as Bo,githubConditionSchema as Vo,githubTriggerMatchSchema as Ho,grantKindOf as Uo,harnessModelChoices as Wo,humanRequestId as Go,humanRequestKind as Ko,imageModelIdSchema as qo,inferenceReasoningSchema as Jo,inferenceRoutingSchema as Yo,inferenceSpeedSchema as Xo,isAgentMessageMetadata as Zo,isAgentNotificationMetadata as Qo,isAgentUIDataName as $o,isAgentWrittenAuditEntry as es,isArchitectPublicationMetadata as ts,isAwaitingHuman as ns,isBlocking as rs,isEnvironmentHarnessId as is,isMailProvider as as,isMailboxListMode as os,isNativeToolGroup as ss,isOpenToolPartState as cs,isParkedOnHuman as ls,isProviderDraft as us,isPublicMailDomain as ds,isQuestionPart as fs,isReplyMode as ps,isResourceGrant as ms,isRoutineActorMetadata as hs,isSessionInferencePatch as gs,isSystemEmailCategory as _s,isSystemEmailCategoryName as vs,isSystemPartCode as ys,isToolApprovalState as bs,meetingBotDispatchRequestSchema as xs,meetingBotDispatchResponseSchema as Ss,meetingBotNotificationSchema as Cs,meetingTranscriptSegmentSchema as ws,mentionReferenceSchema as Ts,mergeSessionInferencePatch as Es,modelDefinitionSchema as Ds,modelReferenceSchema as Os,needsManageWhenUnattended as ks,normalizedMeetingTranscriptSchema as As,openRequests as js,orderAgentSessionMessages as Ms,parseAgentDefinitionAccessRole as Ns,parseAgentSessionAccessRole as Ps,parseCountMode as Fs,parseMergedAgentTrigger as Is,parseOptionalCountMode as Ls,parsePageAccessRole as Rs,parseRecordAccessRole as zs,parseToolGroupGrant as Bs,providerNameSchema as Vs,readAskQuestionsResult as Hs,recentActivityEntryKey as Us,recordGraphNodeKey as Ws,recordGraphRequestSchema as Gs,recordMeetingsCount as Ks,recordOperationSchema as qs,refineTrigger as Js,resourceGrant as Ys,routedMessageInferenceSchema as Xs,sessionInferencePatchSchema as Zs,slackConditionSchema as Qs,slackTriggerMatchSchema as $s,todoItemSchema as ec,todoPlanSchema as tc,toolImpactSchema as nc,utf8ByteLength as rc}from"./record-operation-COFZLn3T.mjs";import"./zod-locale.mjs";import{ATTRIBUTE_NAME_SCHEMA as ic,LIST_VIEW_TAB_VISIBILITIES as ac,NATIVE_OBJECT_NAMES as oc,OBJECT_NAME_SCHEMA as sc,RECORD_LIST_SCOPES as cc,RESERVED_ATTRIBUTE_NAMES as lc,RESERVED_OBJECT_NAMES as uc,RESOURCE_VISIBILITIES as dc,SCHEMA_LIMITS as F,SYSTEM_FIELD_NAMES as fc,assertUniqueBy as pc,colorIdSchema as mc,iconNameSchema as I,isNativeObjectName as L,isPlainRecord as hc,parseRecordListScope as gc,parseResourceVisibility as _c,validateAttributeName as vc,validateIconName as yc,validateLabel as bc,validateObjectName as xc,validateOptions as R,validateViewName as Sc}from"./primitives-D9A6pmXV.mjs";import{COMPUTED_RETURN_TYPES as Cc,SIMPLE_PROPERTY_TYPES as wc,WIRE_OFFERED_BASE_CONFIG as Tc,WIRE_OMITTED_CONFIG_KEYS as Ec,attributeConfigSchemas as Dc,datePrecisionIssues as Oc,getAttributeConfigSchema as kc,getAttributeConfigWriteSchema as Ac,parseAttributeConfig as jc,parseAttributeConfigForCreate as Mc,parseAttributeConfigForUpdate as Nc,propertyAttributeSchema as Pc,propertyAttributeWireSchema as Fc,propertySchemaSchema as Ic,propertySchemaWireSchema as Lc,refuseForeignKeys as Rc,selectOptionWriteSchema as zc,statusGroupSchema as Bc,statusOptionWriteSchema as Vc,wireHiddenTypeConfigMask as Hc,wireOmittedConfigKeysFor as Uc,withoutUnknownOptionKeys as Wc}from"./config-BwshhFai.mjs";import{NonJsonValueError as Gc,asTenantId as Kc,asUserId as qc,canonicalStringify as z,deepEqual as Jc,generateId as Yc,indexBy as Xc,sameStableValue as Zc,serializeCanonicalJson as Qc,serializeStableJson as $c}from"./utils-DaejNWxh.mjs";import{createAttributeValidator as el,createFormAttributeValidator as tl,createObjectValidator as nl,isEmptyValue as rl,isNullishOrEmptyString as il,isValuePresent as al,rejectUnknownAttributesOrThrow as ol,validateAttribute as sl,validateDraft as cl,validateDraftOrThrow as ll,validateObject as ul,validateObjectOrThrow as dl}from"./object-BF5y6bgs.mjs";import{TEXT_FORMAT_PATTERNS as fl,resolveTextPattern as pl}from"./text-BaxaZ5Vv.mjs";import{DEFAULT_VALIDATION_MESSAGES as ml,formatZodErrors as hl}from"./core-rKI7Q9_U.mjs";import{formatPhoneForDisplay as gl,getIso2 as _l,normalizeCountrylessPhoneNumber as vl,normalizePhoneNumber as yl}from"./phone-BGJea5sr.mjs";import*as B from"zod";import{colorIdFromString as bl,getCountryByIso2 as xl,isValidCurrencyCode as Sl,isValidIso3 as Cl}from"@standards/constants";import{parsePhoneNumberFromString as wl}from"libphonenumber-js";const Tl=`__stndrdsNativeUiPartIds`,El=1;function invalidNativePartIds(){throw new N(`Native agent UI part IDs metadata is invalid`,[])}function isPlainRecord$1(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function nativeAgentUIPartIdMetadataKey(e,t){if(e.type===`text`||e.type===`reasoning`)return`${e.type}:${t}`;if(e.type===`tool`)return`tool:${e.toolCallId}`}function parseNativeAgentUIPartIdsMetadata(e){let t=e.metadata?.[Tl];isPlainRecord$1(t)||invalidNativePartIds(),(Object.keys(t).length!==2||t.schemaVersion!==1||!isPlainRecord$1(t.partIds))&&invalidNativePartIds();let n=new Map;for(let[t,r]of e.parts.entries()){let e=nativeAgentUIPartIdMetadataKey(r,t);if(!e||n.has(e)){e&&invalidNativePartIds();continue}n.set(e,r)}let r=Object.entries(t.partIds);r.length!==n.size&&invalidNativePartIds();let i=new Map,a={};for(let[e,t]of r){let r=n.get(e);r&&typeof t==`string`&&t.length>0||invalidNativePartIds();let o=i.get(t);o&&(r.type===`tool`||o!==r.type)&&invalidNativePartIds(),r.type===`tool`&&t!==r.toolCallId&&invalidNativePartIds(),i.set(t,r.type),a[e]=t}return a}const Dl=`/v1/device-worker/channel`,Ol=262144,kl=15e4,Al=1e4,jl=2e3,Ml=2e3,Nl=2e4,Pl=4008,Fl={initialMs:1e3,maxMs:3e4};function deviceChannelUrl(e){let t=new URL(e);return`${t.protocol===`https:`?`wss:`:`ws:`}//${t.host}${Dl}`}function computeRetryDelay(e,t,n){return Math.min(n.initialMs*2**e,n.maxMs)+Math.floor(t()*250)}function computeReconnectDelay(e,t=Math.random){return computeRetryDelay(e,t,Fl)}const Il=[`worker_disconnected`,`cancelled`,`timed_out`,`execution_failed`,`stale_reference`,`tab_unavailable`,`debugger_unavailable`,`blocked_by_user`,`not_actionable`,`javascript_error`,`batch_cap_exceeded`,`no_reference_screenshot`],Ll=`UPGRADE_REQUIRED`;var DeviceChannelProtocolError=class extends j{constructor(e){super(e,M.DEVICE_CHANNEL_PROTOCOL),this._tag=`DeviceChannelProtocolError`,this.name=`DeviceChannelProtocolError`}};const V={id:B.uuid(),leaseToken:B.string().min(1)},Rl=B.record(B.string(),B.unknown());function defineDeviceChannelFrames(e){return{worker:B.discriminatedUnion(`type`,[B.strictObject({type:B.literal(`authenticate`),credential:B.string().regex(/^(Device|Bearer) \S+$/),protocol:B.number().int().positive().optional()}),B.strictObject({type:B.literal(`running`),...V}),B.strictObject({type:B.literal(`heartbeat`),...V}),B.strictObject({type:B.literal(`output`),...V,stdout:B.string().optional(),stderr:B.string().optional()}),B.strictObject({type:B.literal(`complete`),...V,result:B.strictObject({stdout:B.string().optional(),stderr:B.string().optional(),exitCode:B.number().int(),success:B.boolean(),errorCode:B.enum(Il).optional(),result:e.result.optional()})}),B.strictObject({type:B.literal(`pong`)})]),server:B.discriminatedUnion(`type`,[B.strictObject({type:B.literal(`ready`),device:B.strictObject({id:B.string(),name:B.string(),capability:B.enum([`shell`,`browser`])}),protocol:B.number().int().positive().optional()}),B.strictObject({type:B.literal(`command`),...V,kind:B.enum([`shell`,`browser`]),intent:B.string(),timeoutMs:B.number().int(),command:B.string().optional(),cwd:B.string().nullable().optional(),action:e.action.optional()}),B.strictObject({type:B.literal(`cancel`),id:B.uuid(),reason:B.enum([`cancelled`,`timed_out`,`revoked`])}),B.strictObject({type:B.literal(`reauthenticate`)}),B.strictObject({type:B.literal(`revoked`)}),B.strictObject({type:B.literal(`ping`)})])}}const zl=defineDeviceChannelFrames({action:Rl,result:Rl}),Bl=zl.worker,Vl=zl.server;function parseDeviceChannelFrame(e,t){let n;try{n=JSON.parse(t)}catch{throw new DeviceChannelProtocolError(`Frame is not JSON`)}let r=e.safeParse(n);if(!r.success)throw new DeviceChannelProtocolError(`Frame does not match the channel protocol`);return r.data}function parseWorkerFrame(e){return parseDeviceChannelFrame(Bl,e)}function parseServerFrame(e){return parseDeviceChannelFrame(Vl,e)}const Hl=5;function isFormDefinition(e){return typeof e==`object`&&!!e&&`slots`in e&&`steps`in e&&`name`in e&&typeof e.name==`string`&&Array.isArray(e.slots)&&Array.isArray(e.steps)}const H=[`relation`,`multiRelation`,`formula`,`rollup`,`document`,`richtext`,`user`];function isFormSlotFieldRef(e){return e.type===`slot`}function isFormFreeFieldRef(e){return e.type===`free`}function resolveFieldRequired(e){return e.readOnly===!0?!1:e.fieldRequired===void 0?e.slotMode===`create`&&e.attributeRequired===!0:e.fieldRequired}function getSlotFieldTargets(e){return e.additionalSlotIds?.length?[e.slotId,...e.additionalSlotIds]:[e.slotId]}function formFieldKey(e){return isFormSlotFieldRef(e)?`${e.slotId}.${e.attribute}`:`free.${e.attribute.name}`}function formFieldFlatKey(e){return isFormSlotFieldRef(e)?e.attribute:e.attribute.name}function readFormFieldValue(e,t){return e[formFieldKey(t)]??e[formFieldFlatKey(t)]}function isFormFieldsRow(e){return e.type===`fields`}function isFormHeadingRow(e){return e.type===`heading`}function isFormSeparatorRow(e){return e.type===`separator`}function isFormTextRow(e){return e.type===`text`}function resolvePropertyDefinitions(e){let t=e.properties;if(!t)return[];if(Array.isArray(t))return t;let n=t;return Array.isArray(n.definitions)?n.definitions:[]}function hasOptions(e){return e.type===`select`||e.type===`status`||e.type===`multiselect`}function schemaGroupKey(e){return`${e.kind}:${e.name}`}function refuse$2(e){throw new N(e,[{path:[`label`],message:e}])}function parseSchemaGroupPresentation(e){let t=e??{},n={};if(t.label!==void 0){let e=t.label;if(e===null)n.label=null;else if(typeof e!=`string`)refuse$2(`Label must be a string`);else{let t=e.trim();t.length===0&&refuse$2(`Label must not be empty`),t.length>F.labelLength&&refuse$2(`Label is too long (max ${F.labelLength} characters)`),n.label=t}}return n}const U=/^(?:core|bundle:.+)$/u;function parseSchemaOwner(e){if(e===null)return null;if(!U.test(e))throw new N(`Invalid schema owner "${e}"`,[]);return e}const Ul=16e3,Wl=3200,Gl=6400,Kl=16e3,ql=65536,Jl=15e3,Yl=1e4,Xl=5e3,Zl=`google/gemini-3.5-transcribe-live`,Ql={maxDurationMs:3e5,dailyDurationMs:36e5,monthlyDurationMs:72e6,tenantMonthlyBudgetMicrousd:5e7,globalMonthlyBudgetMicrousd:5e7,estimatedMicrousdPerSecond:150,reservationMultiplier:2},$l=[`web`,`presentation`,`document`,`spreadsheet`,`image`,`code`,`other`],eu=[`ephemeral`,`conversation`,`persistent`],tu=[`source`,`preview`,`entrypoint`,`asset`];var NoopGeocodingAdapter=class{async autocomplete(){return await Promise.resolve([])}async geocode(){return await Promise.resolve(null)}};const nu=6048e5,ru=36e5,iu=2592e6,au=6e4,ou=[`square`,`landscape`,`portrait`];function imageModelFormatDefect(e){if(e.formats.length===0)return`declares no output format`;for(let t of e.formats)if(e.requests[t]===void 0)return`declares the format "${t}" without a request`;for(let t of Object.keys(e.requests))if(!e.formats.includes(t))return`carries a request for the undeclared format "${t}"`}function declaredImageRequests(e){let t={};for(let n of e.formats){let r=e.requests[n];r!==void 0&&(t[n]=r)}return t}const su=[`storage.bytes`,`members.seats`,`data.live_records`];function computeByteMagnitude(e){if(e<=0)return{value:0,unitIndex:0};let t=1e3,n=Math.min(4,Math.floor(Math.log(e)/Math.log(t)));return{value:Number.parseFloat((e/t**n).toFixed(1)),unitIndex:n}}const cu=[`B`,`KB`,`MB`,`GB`,`TB`];function formatByteSize(e){let{value:t,unitIndex:n}=computeByteMagnitude(e);return`${t} ${cu[n]}`}const lu=Object.freeze([`text`,`number`,`checkbox`,`date`,`phone`,`currency`,`status`,`select`,`multiselect`,`location`]);function buildPropertySchema(e){let t=[];for(let n of e){let e=n.build();if(!lu.includes(e.type))throw Error(`Property type "${e.type}" is not supported in .qualifyWith()`);t.push(e)}return{definitions:t}}const uu=[`UPPER`,`LOWER`,`capitalize`,`trim`],du=[`prefix`,`suffix`,`wrap`,`default`],W=[...uu,...du],fu=/^\s*where\s*(?::(.*))?$/s,pu=`[A-Za-z_][A-Za-z0-9_]*`,mu=/^[^\s,()|{}="']+$/,hu=RegExp(`^(${pu})\\s*=\\s*(.*)$`),gu=RegExp(`^(${pu})\\s+in\\s*\\(([^()]*)\\)$`);function isWherePipe(e){return fu.test(e)}function parseWherePipe(e){let t=e.match(fu)?.[1]?.trim();if(!t)return null;let n=t.match(gu);if(n){let e=n[2].split(`,`).map(e=>e.trim());return e.every(e=>mu.test(e))?{property:n[1],values:e}:null}let r=t.match(hu);return r&&mu.test(r[2])?{property:r[1],values:[r[2]]}:null}const G=B.string().min(1,`labelExpression cannot be empty`).refine(e=>isLabelExpression(e),{message:`labelExpression must contain at least one {{ attribute }} interpolation`}).refine(e=>!/\{\{\s*\}\}/.test(e),{message:`labelExpression contains empty {{ }} interpolation`}).refine(e=>{let t=/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g,n;for(;(n=t.exec(e))!==null;){let e=n[1];if(!W.includes(e))return!1}return!0},{message:`Invalid pipe name. Valid pipes: ${W.join(`, `)}`});function validateLabelExpression(e){let t=G.safeParse(e);return t.success?{success:!0,attributes:extractAttributeNames(e)}:{success:!1,error:t.error.issues[0]?.message??`Invalid labelExpression`}}function applyPipe(e,t){let{name:n,args:r}=parsePipeExpression(t);switch(n){case`UPPER`:return e.toUpperCase();case`LOWER`:return e.toLowerCase();case`capitalize`:return e.replace(/(^|\s)\S/g,e=>e.toUpperCase());case`trim`:return e.trim();case`prefix`:return e?`${r[0]??``}${e}`:``;case`suffix`:return e?`${e}${r[0]??``}`:``;case`wrap`:return e?`${r[0]??``}${e}${r[1]??``}`:``;case`default`:return e||r[0]||``;default:return e}}function applyPipes(e,t){let n=e;for(let e of t)n=applyPipe(n,e);return n}function getValue(e,t){return t.split(`.`).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e)}const _u=`(Untitled)`;function parsePipeExpression(e){let t=e.match(/^(\w+)(?::(.*))?$/);if(!t)return{name:e,args:[]};let n=t[1],r=t[2];if(!r)return{name:n,args:[]};let i=[],a=/["']([^"']*?)["']/g,o;for(;(o=a.exec(r))!==null;)i.push(o[1]);return{name:n,args:i}}function*templateBlocks(e){let t=0;for(;t<e.length;){let n=e.indexOf(`{{`,t);if(n<0)return;let r=e.indexOf(`}`,n+2);if(r<0)return;if(e[r+1]!==`}`){t=r+1;continue}t=r+2;let i=e.slice(n+2,r);i.length>0&&(yield{start:n,end:t,expr:i})}}function resolveLabelBlock(e,t){let n=e.split(`||`).map(e=>e.trim()),r=n[n.length-1].split(`|`).map(e=>e.trim());n[n.length-1]=r[0];let i=r.slice(1).filter(Boolean),a=n.filter(Boolean),o=``;for(let e of a){let n=toText(getValue(t,e));if(n!==``){o=n;break}}return applyPipes(o,i)}function renderLabelExpression(e,t,n=_u){let r=[],i=0;for(let n of templateBlocks(e))r.push(e.slice(i,n.start),resolveLabelBlock(n.expr,t)),i=n.end;return r.push(e.slice(i)),r.join(``).trim()||n}function toText(e){if(e==null||typeof e==`function`)return``;if(typeof e!=`object`)return String(e);if(Array.isArray(e))return e.map(toText).filter(Boolean).join(`,`);let t=e.toString;return typeof t==`function`&&t!==Object.prototype.toString?String(e):``}function isLabelExpression(e){let t=0;for(;t<e.length;){let n=e.indexOf(`{{`,t);if(n<0)return!1;let r=e.indexOf(`}}`,n+2);if(r<0)return!1;if(e.slice(n+2,r).trim().length>0)return!0;t=r+2}return!1}function extractAttributeNames(e){let t=[];for(let n of templateBlocks(e)){let e=n.expr.trim();if(!e)continue;let r=e.split(`||`).map(e=>e.trim()),i=r[r.length-1];r[r.length-1]=i.split(`|`)[0].trim();for(let e of r){if(!e)continue;let n=e.split(`.`)[0];n&&!t.includes(n)&&t.push(n)}}return t}const vu=/^\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}$/;function getSingleAttributeFromExpression(e){let t=e.trim().match(vu);return t?t[1]:null}function getEditableLabelAttribute(e,t){let n=getSingleAttributeFromExpression(e);if(n===null)return null;let r=t.find(e=>e.name===n);return!r||r.type!==`text`||Tt(r).authoring.readOnly?null:r}const yu=[{id:`data`,capabilities:[{id:`forms`,resources:[`forms`],levels:[{id:`fill`,add:[`read`]},{id:`edit`,add:[`create`,`update`,`delete`]},{id:`manage`,add:[`manage`]}]}]},{id:`structure`,capabilities:[{id:`schema`,resources:[`architect`],levels:[{id:`use`,add:[`read`]},{id:`edit`,add:[`create`,`update`,`delete`]}]},{id:`pages`,resources:[`pages`],levels:[{id:`read`,add:[`read`]},{id:`create`,add:[`create`,`update`,`delete`]}]}]},{id:`ai`,capabilities:[{id:`agents`,resources:[`agents`],levels:[{id:`chat`,add:[`read`]},{id:`build`,add:[`create`,`update`,`delete`]},{id:`manage`,add:[`manage`]}]},{id:`environments`,resources:[`environments`],levels:[{id:`use`,add:[`read`]},{id:`create`,add:[`create`]}]},{id:`browser-profiles`,resources:[`browser-profiles`],levels:[{id:`use`,add:[`create`]}]},{id:`private-secrets`,resources:[`private-secrets`],levels:[{id:`use`,add:[`create`]}]},{id:`routine-audiences`,resources:[`routine-audiences`],levels:[{id:`use`,add:[`create`]}]},{id:`supervision`,resources:[`supervision`],levels:[{id:`use`,add:[`create`]}]}]},{id:`files`,capabilities:[{id:`files`,resources:[`files`,`documents`],levels:[{id:`read`,add:[`read`]},{id:`edit`,add:[`create`,`update`]},{id:`full`,add:[`delete`]}]}]},{id:`team`,capabilities:[{id:`people`,resources:[`people`],levels:[{id:`view`,add:[`read`]},{id:`invite`,add:[`create`]},{id:`manage`,add:[`update`,`delete`]}]}]},{id:`integrations`,capabilities:[{id:`connectors`,resources:[`connectors`],levels:[{id:`use`,add:[`read`,`create`,`update`,`delete`]}]},{id:`api-keys`,resources:[`api-keys`],levels:[{id:`view`,add:[`read`]},{id:`manage`,add:[`create`,`delete`]}]},{id:`env-vars`,resources:[`env-vars`],levels:[{id:`view`,add:[`read`]},{id:`manage`,add:[`create`,`delete`]}]}]},{id:`administration`,capabilities:[{id:`settings`,resources:[`settings`],levels:[{id:`view`,add:[`read`]},{id:`manage`,add:[`update`,`delete`,`manage`]}]},{id:`audit`,resources:[`audit`],levels:[{id:`view`,add:[`read`]}]},{id:`billing`,resources:[`billing`],levels:[{id:`view`,add:[`read`]}]}]}],K=`none`,bu=`custom`,q={actions:[`read`,`create`,`update`,`delete`],purge:`manage`,levels:[{id:`read`,add:[`read`]},{id:`edit`,add:[`create`,`update`]},{id:`full`,add:[`delete`]}]},J=yu.flatMap(e=>e.capabilities),xu=J.flatMap(e=>e.resources),Su=new Map(J.flatMap(e=>e.resources.map(t=>[t,e])));function isCatalogResource(e){return Su.has(e)}function capabilityForResource(e){let t=Su.get(e);if(!t)throw new j(`Unknown catalog resource "${e}"`,M.INVARIANT_VIOLATION);return t}function sameActions(e,t){let n=new Set(e),r=new Set(t);return n.size===r.size&&[...n].every(e=>r.has(e))}function levelActions(e,t){let n=new Set;for(let r of e.levels){for(let e of r.add)n.add(e);if(r.id===t)return[...n]}return[]}function levelFloor(e,t){let n=e.levels[e.levels.length-1];if(t.includes(`*`)&&n)return n.id;let r=new Set(t),i=K;for(let t of e.levels){if(!t.add.every(e=>r.has(e)))break;i=t.id}return i}function levelOf(e,t){if(t.length===0)return K;let n=e.levels[e.levels.length-1];if(t.includes(`*`)&&n)return n.id;let r=new Set(t),i=new Set;for(let t of e.levels){for(let e of t.add)i.add(e);if(i.size===r.size&&[...r].every(e=>i.has(e)))return t.id}return bu}const Cu=[`read`,`create`,`update`,`delete`,`manage`],wu=B.object({scope:B.enum([`object`,`system`]),target:B.string().min(1),actions:B.array(B.enum(Cu))}).strict();function findGrantIssues(e,t){let n=[],r=new Map;for(let i of e){let e=wu.safeParse(i);if(!e.success){let e=typeof i==`object`&&i&&`target`in i?String(i.target):`?`;n.push({target:e,reason:`shape`});continue}let a=e.data;if(a.scope===`system`){if(!isCatalogResource(a.target)){n.push({target:a.target,reason:`unknown-resource`});continue}if(levelOf(capabilityForResource(a.target),a.actions)===`custom`){n.push({target:a.target,reason:`off-level`});continue}r.set(a.target,a.actions);continue}if(a.target!==`*`&&!t.objectNames.has(a.target)){n.push({target:a.target,reason:`unknown-object`});continue}let o=a.target===`*`?[...q.actions,q.purge]:q.actions;a.actions.every(e=>o.includes(e))||n.push({target:a.target,reason:`object-action`})}let i=new Set;for(let[e,t]of r){let a=capabilityForResource(e);if(!i.has(a)){for(let o of a.resources)if(!sameActions(t,r.get(o)??[])){n.push({target:e,reason:`split-capability`}),i.add(a);break}}}return n}const Tu=`memory`,Eu=4e3,Du=`workspace`,Y={name:`name`,description:`description`,content:`content`,profileOf:`profileOf`,profileActor:`profileActor`,subjects:`subjects`,subjectId:`subjectId`};function textValue(e){return typeof e==`string`?e:``}function memoryPageViewOf(e){let{values:t}=e;return{id:e.id,name:textValue(t[Y.name]),description:textValue(t[Y.description]),content:textValue(t[Y.content]),visibility:e.visibility,ownedBy:e.ownedBy,updatedAt:new Date(e.updatedAt).toISOString()}}const Ou=`@standards/schema`;function createStandardSchemaProps(e){return{version:1,vendor:Ou,validate:t=>{let n=e.safeParse(t);return n.success?{value:n.data}:{issues:n.error.issues.map(e=>({message:e.message,path:e.path}))}}}}function isStandardSchema(e){return typeof e==`object`&&!!e&&`~standard`in e&&typeof e[`~standard`]==`object`&&e[`~standard`].version===1}function asMutableArray(e){return e}var BaseAttributeBuilder=class{get"~standard"(){return createStandardSchemaProps(el(this.build()))}constructor(e,t,n){vc(t),bc(n),this.attr={name:t,label:n,type:e,required:!1,system:!0}}setRequired(e){this.attr.required=e}asRequiredState(){return this}asPhantomState(){return this}runtime(){return this.attr.system=!1,this}hidden(){return this.attr.hidden=!0,this}placeholder(e){return this.attr.placeholder=e,this}description(e){return this.attr.description=e,this}icon(e){return yc(e,`attribute "${this.attr.name}"`),this.attr.icon=e,this}order(e){return this.attr.order=e,this}defaultValue(e){return(`defaultValue`in this.attr||![`formula`,`rollup`].includes(this.attr.type))&&(this.attr.defaultValue=e),this}metadata(e){return this.attr.metadata=e,this}build(){return this.attr}},TextAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`text`,e,t)}minLength(e){return this.attr.minLength=e,this}maxLength(e){return this.attr.maxLength=e,this}pattern(e){return this.attr.pattern=e,this.attr.format=void 0,this}multiline(e=!0){return this.attr.multiline=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}email(){return this.attr.format=`email`,this.attr.pattern=void 0,this}url(){return this.attr.format=`url`,this.attr.pattern=void 0,this}slug(){return this.attr.format=`slug`,this.attr.pattern=void 0,this}};function text(e,t){return new TextAttributeBuilder(e,t)}var RichtextAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`richtext`,e,t)}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function richtext(e,t){return new RichtextAttributeBuilder(e,t)}var NumberAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`number`,e,t)}min(e){return this.attr.min=e,this}max(e){return this.attr.max=e,this}integer(){return this.attr.unit=`integer`,this.attr.decimals=0,this}decimal(e=2){return this.attr.unit=`decimal`,this.attr.decimals=e,this}percentage(){return this.attr.unit=`percentage`,this}renderAs(e){return this.attr.renderAs=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function number(e,t){return new NumberAttributeBuilder(e,t)}var CheckboxAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`checkbox`,e,t)}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function checkbox(e,t){return new CheckboxAttributeBuilder(e,t)}var DateAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`date`,e,t)}format(e){return this.attr.dateFormat=e,this}precision(e){return this.attr.precision=e,this}build(){let[e]=Oc(`date`,this.attr);if(e!==void 0)throw new N(e.message,[{path:[`precision`],message:e.message}]);return super.build()}minDate(e){return this.attr.minDate=e,this}maxDate(e){return this.attr.maxDate=e,this}endDate(){return this.attr.endDate=!0,this.asPhantomState()}includeTime(){return this.attr.includeTime=!0,this}timeFormat(e){return this.attr.timeFormat=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function date(e,t){return new DateAttributeBuilder(e,t)}var PhoneAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`phone`,e,t)}defaultCountry(e){return this.attr.defaultCountryCode=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function phone(e,t){return new PhoneAttributeBuilder(e,t)}var CurrencyAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`currency`,e,t)}defaultCurrency(e){return this.attr.defaultCurrency=e,this}allowedCurrencies(e){return this.attr.allowedCurrencies=e,this}allowNegative(e=!0){return this.attr.allowNegative=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function currency(e,t){return new CurrencyAttributeBuilder(e,t)}var StatusAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`status`,e,t)}options(e){let t=asMutableArray(e);return R(this.attr.name??`unknown`,t),this.attr.options=t,this.asPhantomState()}option(e){this.attr.options||(this.attr.options=[]);let t=[...this.attr.options,e];return R(this.attr.name??`unknown`,t),this.attr.options.push(e),this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function status(e,t){return new StatusAttributeBuilder(e,t)}var SelectAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`select`,e,t)}options(e){let t=asMutableArray(e);return R(this.attr.name??`unknown`,t),this.attr.options=t,this.asPhantomState()}option(e){this.attr.options||(this.attr.options=[]);let t=[...this.attr.options,e];return R(this.attr.name??`unknown`,t),this.attr.options.push(e),this}renderAs(e){return this.attr.renderAs=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function select(e,t){return new SelectAttributeBuilder(e,t)}var MultiselectAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`multiselect`,e,t)}options(e){let t=asMutableArray(e);return R(this.attr.name??`unknown`,t),this.attr.options=t,this.asPhantomState()}option(e){this.attr.options||(this.attr.options=[]);let t=[...this.attr.options,e];return R(this.attr.name??`unknown`,t),this.attr.options.push(e),this}renderAs(e){return this.attr.renderAs=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function multiselect(e,t){return new MultiselectAttributeBuilder(e,t)}var LocationAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`location`,e,t)}granularity(e){return this.attr.granularity=e,this}defaultCountry(e){return this.attr.defaultCountry=e,this}allowedCountries(e){return this.attr.allowedCountries=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function location(e,t){return new LocationAttributeBuilder(e,t)}var UserAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`user`,e,t),this.attr.types=[`user`,`agent`]}types(e){let t=[...new Set(e)];if(t.length===0)throw Error(`[AttributeBuilder] user.types must contain at least one type.`);return this.attr.types=t,this}multiple(){return this.attr.multiple=!0,this}notifiesOnAssign(){return this.attr.notifiesOnAssign=!0,this}actors(){return this.attr.actors=!0,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function user(e,t){return new UserAttributeBuilder(e,t)}var BaseRelationAttributeBuilder=class extends BaseAttributeBuilder{to(e,t){let n={object:e,...t};return this.attr.targets?.push(n),this}toAny(){return this.attr.targets=[{object:`*`}],this}qualifyWith(...e){let t=this.attr.targets;if(!t||t.length===0)throw Error(`.qualifyWith() must be called AFTER .to(). Example: relation("companies", "Companies").to("companies").qualifyWith(...)`);return this.attr.properties=buildPropertySchema(e),this}bilateral(e){let t=this.attr.targets;if(!t||t.length===0)throw Error(`.bilateral() must be called AFTER .to(). Example: relation("company", "Company").to("companies").bilateral({ ... })`);if(t.length>1)throw Error(`Bilateral relations are not supported for polymorphic relations (multiple .to() targets).`);if(Qt(this.attr))throw Error(`Bilateral relations are not supported for universal relations (.toAny()).`);let n=t[0]?.object;if(!n)throw new N(`Bilateral relation requires one target object`,[{path:[`bilateral`,`object`],message:`Bilateral relation requires one target object`}]);if(e.object&&e.object!==n){let t=`Bilateral inverse object ${e.object} must match relation target ${n}`;throw new N(t,[{path:[`bilateral`,`object`],message:t}])}return this.attr.bilateral={...e,object:n},this}},SingleRelationAttributeBuilder=class extends BaseRelationAttributeBuilder{constructor(e,t){super(`relation`,e,t),this.attr.cardinality=`one`,this.attr.targets=[]}many(){let e=new MultiRelationAttributeBuilder(this.attr.name,this.attr.label??``,{targets:this.attr.targets,isRequired:this.attr.required});return this.attr.system===!1&&e.runtime(),this.attr.hidden&&e.hidden(),this.attr.placeholder&&e.placeholder(this.attr.placeholder),this.attr.description&&e.description(this.attr.description),this.attr.icon&&e.icon(this.attr.icon),this.attr.order!==void 0&&e.order(this.attr.order),this.attr.metadata&&e.metadata(this.attr.metadata),e}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}},MultiRelationAttributeBuilder=class extends BaseRelationAttributeBuilder{constructor(e,t,n){super(`relation`,e,t),this.attr.cardinality=`many`,this.attr.targets=n?.targets??[],this.attr.defaultValue=[],n?.isRequired&&this.setRequired(!0)}maxItems(e){return this.attr.maxItems=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function relation(e,t){return new SingleRelationAttributeBuilder(e,t)}var FormulaAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`formula`,e,t),this.attr.required=!1}expression(e){return this.attr.expression=e,this}returns(e){return this.attr.returnType=e,this}decimals(e){return this.attr.decimals=e,this}currency(e){return this.attr.currencyCode=e,this}required(){throw Error(`Formula attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.`)}optional(){return this}};function formula(e,t){return new FormulaAttributeBuilder(e,t)}var RollupAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`rollup`,e,t),this.attr.required=!1}from(e){return this.attr.relationAttribute=e,this}aggregate(e){return this.attr.targetAttribute=e,this}using(e){return this.attr.function=e,this}decimals(e){return this.attr.decimals=e,this}path(e){return this.attr.relationPath=e,this}targetType(e){return this.attr.targetAttributeType=e,this}targetOptions(e){return this.attr.targetAttributeOptions=asMutableArray(e),this}targetCurrency(e){return this.attr.targetCurrencyCode=e,this}build(){let e=this.attr.function,t=this.attr.targetAttributeType;if(e===`original`&&t!==void 0&&t!==`select`&&t!==`status`&&t!==`multiselect`){let e=this.attr.relationAttribute??`relation`,n=this.attr.targetAttribute??`field`;throw new j(`Rollup "${this.attr.name}": .using("original") only supports a "select", "status", or "multiselect" target, but .targetType("${t}") was given. To surface a plain ${t} value from a related record, use a formula instead — e.g. formula("${this.attr.name}", "…").expression("${e}.${n}").`,M.VALIDATION_FAILED)}return super.build()}required(){throw Error(`Rollup attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.`)}optional(){return this}};function rollup(e,t){return new RollupAttributeBuilder(e,t)}var DocumentAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`document`,e,t)}accepts(e){return this.attr.accepts=e,this}maxFileSize(e){return this.attr.maxFileSize=e,this}qualifyWith(...e){return this.attr.properties=buildPropertySchema(e),this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function document(e,t){return new DocumentAttributeBuilder(e,t)}const ku=/^[a-z0-9][a-z0-9-]{0,62}$/,Au=`core`;function assertBundleName(e){if(!ku.test(e))throw new N(`Invalid bundle name "${e}": expected a lowercase slug matching ${ku}`,[]);if(e===`core`)throw new N(`Bundle name "${Au}" is reserved`,[])}async function sha256Hex(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}function nameSlug(e,t){return e.normalize(`NFKD`).replace(/\p{M}/gu,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).slice(0,t).replace(/^_+|_+$/g,``)}function cloneBuilderValue(e,t){try{return structuredClone(e)}catch{let e=`Builder configuration must contain cloneable data`;throw new N(e,[{path:t,message:e}])}}function requireBuilderName(e,t){if(typeof e!=`string`||e.trim().length===0)throw new N(`Name must not be blank`,[{path:t,message:`Name must not be blank`}])}function validateContentConfiguration(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw new N(`Invalid content configuration`,[{path:t,message:`Expected content configuration`}]);for(let n of[`name`,`label`,`placement`])if(Object.hasOwn(e,n)){let e=`Independent content configuration cannot define ${n}`;throw new N(e,[{path:[...t,n],message:e}])}let n=O.safeParse({...e,name:`content`,placement:e.type===`group`?`grid`:`main`});if(!n.success)throw N.fromZodErrors(n.error.issues.map(e=>({path:[...t,...e.path.map(String)],message:e.message})));n.data.type===`form`&&n.data.groups.forEach((e,n)=>requireBuilderName(e.name,[...t,`groups`,String(n),`name`]));let{name:r,label:i,placement:a,...o}=n.data;return cloneBuilderValue(o,t)}function validateLiteralContent(e,t){return validateContentConfiguration(e,t),cloneBuilderValue(e,t)}function positionOf(e){return{x:e.x,y:e.y,w:e.w,h:e.h}}function bottomOf(e){return e.y+e.h}function collides(e,t){return e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h}function firstCollision(e,t){return t.find(t=>collides(e,t))}function inReadingOrder$1(e){return[...e].sort((e,t)=>e.y-t.y||e.x-t.x)}function snapWidth(e,t,n){let r=12-t,i=v.filter(e=>e>=n&&e<=r);return i.length===0?v.find(e=>e>=n)??n:i.reduce((t,n)=>{let r=Math.abs(n-e),i=Math.abs(t-e);return r<i||r===i&&n>t?n:t})}function sharesColumns(e,t){return e.x<t.x+t.w&&t.x<e.x+e.w}function risenRow(e,t){return t.reduce((t,n)=>n.y<e.y&&sharesColumns(e,n)?Math.max(t,bottomOf(n)):t,0)}function packLayout(e,t){let n=e.map(e=>{let n=t?.get(e.i);return n===void 0?e:{...e,h:n}}),r=n.filter(e=>e.static===!0),i=new Map(r.map(e=>[e.i,e]));for(let e of inReadingOrder$1(n.filter(e=>e.static!==!0))){let t=risenRow(e,r),n=firstCollision({...e,y:t},r);for(;n!==void 0;)t=bottomOf(n),n=firstCollision({...e,y:t},r);let a={...e,y:t};r.push(a),i.set(e.i,a)}return n.map(e=>i.get(e.i)??e)}function settleLayout(e,t){let n=e.filter(e=>e.static===!0),r=e.filter(e=>e.static!==!0),i=new Map;for(let e of[...inReadingOrder$1(r.filter(e=>t.has(e.i))),...inReadingOrder$1(r.filter(e=>!t.has(e.i)))]){let t=e,r=firstCollision(t,n);for(;r!==void 0;)t={...t,y:bottomOf(r)},r=firstCollision(t,n);n.push(t),i.set(e.i,t)}return packLayout(e.map(e=>i.get(e.i)??e))}function pageCompactor(){return{type:`vertical`,allowOverlap:!1,preventCollision:!1,compact:e=>packLayout(e).map(e=>({...e,moved:!1}))}}function clampHeight(e,t){let n=t.minHeight??1,r=t.maxHeight??1/0;return Math.max(1,n,Math.min(r,e))}function widthStepConstraint(e){return{name:`width-steps`,constrainSize:(t,n,r)=>{let i=e(t.i),a=snapWidth(n,t.x,i.minWidth);return i.height===`fit`?{w:a,h:t.h}:i.height===`flexible`?{w:a,h:clampHeight(r,i)}:{w:a,h:Math.max(1,r)}}}}function snapCell(e,t){let n=Math.max(0,Math.min(e.x,11)),r=snapWidth(e.w,n,t(e.i).minWidth);return{...e,x:Math.min(n,12-r),y:Math.max(0,e.y),w:r,h:Math.max(1,e.h)}}function samePosition(e,t){return e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h}function pushApart(e){let t=e.filter(e=>e.static===!0),n=new Map;for(let r of inReadingOrder$1(e.filter(e=>e.static!==!0))){let e=r,i=firstCollision(e,t);for(;i!==void 0;){let n={...e,x:i.x+i.w};e=n.x+n.w<=12&&firstCollision(n,t)===void 0?n:{...e,y:bottomOf(i)},i=firstCollision(e,t)}t.push(e),n.set(r.i,e)}return e.map(e=>n.get(e.i)??e)}function isValidStatic(e){return[e.x,e.y,e.w,e.h].every(Number.isInteger)&&e.x>=0&&e.y>=0&&e.h>=1&&v.includes(e.w)&&e.x+e.w<=12}function keptStatics(e){let t=[],n=new Set;for(let r of inReadingOrder$1(e.filter(e=>e.static===!0)))isValidStatic(r)&&firstCollision(r,t)===void 0?t.push(r):n.add(r.i);return e.map(e=>n.has(e.i)?{...e,static:!1}:e)}function boundedHeight(e,t){let n=t(e.i);if(e.static===!0||n.height!==`flexible`)return e;let r=clampHeight(e.h,n);return r===e.h?e:{...e,h:r}}function repairPageGrid(e,t){let n=[],r=keptStatics(e).map(e=>{let r=boundedHeight(e,t);return r!==e&&n.push({name:e.i,kind:`height`,from:positionOf(e),to:positionOf(r)}),r}).map(e=>{if(e.static===!0)return e;let r=snapCell(e,t);return samePosition(e,r)||n.push({name:e.i,kind:`width`,from:positionOf(e),to:positionOf(r)}),r}),i=pushApart(r);i.forEach((e,t)=>{let i=r[t];i!==void 0&&!samePosition(i,e)&&n.push({name:e.i,kind:`pushed`,from:positionOf(i),to:positionOf(e)})});let a=packLayout(i),o=keptFill(a,t);for(let e of inReadingOrder$1(a))e.i!==o&&t(e.i).height===`fill`&&n.push({name:e.i,kind:`fill`});return{cells:a,repairs:n}}function keptFill(e,t){return inReadingOrder$1(e).find(e=>e.static!==!0&&t(e.i).height===`fill`)?.i}function firstFreeSlot(e,t,n){let r=t.reduce((e,t)=>Math.max(e,bottomOf(t)),0);for(let i=n;i<=r;i+=1)for(let n=0;n+e.w<=6;n+=1)if(firstCollision({x:n,y:i,...e},t)===void 0)return{x:n,y:i};return{x:0,y:r}}function deriveLayout6(e,t){let n=[];for(let r of inReadingOrder$1(e)){let e=Math.min(6,Math.max(t(r.i).minWidth,Math.ceil(r.w/2))),i=n.at(-1)?.y??0;n.push({i:r.i,...firstFreeSlot({w:e,h:r.h},n,i),w:e,h:r.h})}return n}function figureSlot(e,t,n){for(let r of inReadingOrder$1(e.filter(e=>n.has(e.i)))){let n={x:r.x+r.w,y:r.y,...t};if(n.x+n.w<=12&&firstCollision(n,e)===void 0)return n}}function placeNew(e,t,n,r){let i={w:snapWidth(n.size.w,0,n.minWidth),h:Math.max(1,n.size.h)};return n.figure?{i:t,...figureSlot(e,i,r)??{x:0,y:0,...i}}:{i:t,x:0,y:e.reduce((e,t)=>Math.max(e,bottomOf(t)),0),...i}}function spanContent(e,t){if(!v.includes(t)){let e=`A block spans ${v.join(`, `)} columns, not ${String(t)}`;throw new N(e,[{path:[`content`,`span`],message:e}])}return{content:e,span:t}}function configureContent(e,t){try{return typeof e==`object`&&e&&`build`in e&&typeof e.build==`function`?{configuration:validateContentConfiguration(e.build(),t),extension:e.extension}:{configuration:validateContentConfiguration(e,t)}}catch(e){throw e instanceof N?new N(e.message,e.errors.map(e=>({...e,path:e.path[0]===`content`?[...t,...e.path.slice(1)]:e.path}))):e}}function storedQuery(e,t){let n=[`search`,`offset`].filter(t=>e.state[t]!==void 0);if(n.length>0)throw new N(`A ${t} cannot keep a query's ${n.join(` or `)}`,n.map(e=>({path:[t,e],message:`A ${t} stores no ${e}; use filters and limit instead`})));return e.toDefinition()}function checkInputs(e,t){for(let[n,r]of Object.entries(t)){let t=e.inputs[n];r!==void 0&&t!==void 0&&D({parameters:t.schema},r,[`content`,`parameters`,n])}return t}var BlockContentBuilder=class{constructor(e,t,n){this.extension=e,this.parameters=t,this.heightMode=n}copy(e,t){let n=this.constructor;return new n(this.extension,e,t)}with(e){let t={...this.parameters};for(let[n,r]of Object.entries(e)){if(r===void 0){delete t[n];continue}t[n]=r}return checkInputs(this.extension,e),this.copy(t,this.heightMode)}height(e){return this.copy(this.parameters,e)}build(){let e={type:`custom`,extension:this.extension.name,parameters:cloneBuilderValue(this.parameters,[`content`,`parameters`]),...this.heightMode===void 0?{}:{height:this.heightMode}};return validateContentConfiguration(e,[`content`]),D(this.extension,e.parameters,[`content`,`parameters`]),e}span(e){return spanContent(this,e)}},Measures=class{count(){return this.measured(`count`)}sum(e){return this.measured(`sum`,e)}avg(e){return this.measured(`avg`,e)}min(e){return this.measured(`min`,e)}max(e){return this.measured(`max`,e)}};function measure(e,t,n){return{query:e,measure:t,...n===void 0?{}:{attribute:n}}}var MetricBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}trend(e,t){return this.with({trend:e,trendBucket:t})}compare(e,t){return this.with({compare:e,period:t})}target(e){return this.with({target:e})}},MetricQuery=class extends Measures{constructor(e){super(),this.query=e}measured(e,t){return new MetricBuilder(x,checkInputs(x,measure(this.query,e,t)))}};function groupBy(e){return typeof e==`string`?[e,void 0]:[e.attribute,e.bucket]}var ChartBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}by(e){let[t,n]=groupBy(e);return this.with({by:t,byBucket:n})}by2(e){let[t,n]=groupBy(e);return this.with({by2:t,by2Bucket:n})}kind(e){return this.with({kind:e})}bar(){return this.kind(`bar`)}horizontalBar(){return this.kind(`horizontal_bar`)}line(){return this.kind(`line`)}area(){return this.kind(`area`)}donut(){return this.kind(`donut`)}funnel(){return this.kind(`funnel`)}treemap(){return this.kind(`treemap`)}calendar(){return this.kind(`calendar`)}},ChartQuery=class extends Measures{constructor(e){super(),this.query=e}measured(e,t){return new ChartBuilder(b,checkInputs(b,{...measure(this.query,e,t),kind:`bar`}))}};const ju={"7d":7,"30d":30};var AgendaBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}next(e){let t=typeof e==`number`?e:ju[e];if(!Number.isInteger(t)||t<1){let e=`An agenda looks ahead a whole number of days, at least 1`;throw new N(e,[{path:[`content`,`parameters`,`next`],message:e}])}return this.with({next:t})}yearly(){return this.with({yearly:!0})}},CardBuilder=class extends BlockContentBuilder{fields(...e){return this.with({fields:e})}record(e){return this.with({record:e})}},DecisionsBuilder=class extends BlockContentBuilder{kinds(...e){return this.with({kinds:e})}limit(e){return this.with({limit:e})}},MeetingsUpcomingBuilder=class extends BlockContentBuilder{limit(e){return this.with({limit:e})}},MailboxBuilder=class extends BlockContentBuilder{category(e){return this.with({category:e})}important(){return this.with({important:!0})}unread(){return this.with({unread:!0})}limit(e){return this.with({limit:e})}label(e){return this.with({label:e})}};function metric(e){return new MetricQuery(storedQuery(e,`metric`))}function chart(e){return new ChartQuery(storedQuery(e,`chart`))}function agenda(e,t){return new AgendaBuilder(_,checkInputs(_,{query:storedQuery(e,`agenda`),attribute:t}))}function card(e){let t=e===void 0||typeof e==`string`?e:e.build().name;return new CardBuilder(y,t===void 0?{}:checkInputs(y,{object:t}))}function text$1(e){return new BlockContentBuilder(w,checkInputs(w,{markdown:e}))}function decisions(){return new DecisionsBuilder(Se,{})}function meetingsUpcoming(){return new MeetingsUpcomingBuilder(Ae,{})}function mailbox(){return new MailboxBuilder(Oe,{})}function isSpanned(e){return typeof e==`object`&&!!e&&`span`in e&&`content`in e}function total(e){return e.reduce((e,t)=>e+t,0)}function spread(e){return e.length===0?0:Math.max(...e)-Math.min(...e)}function betterSplit(e,t){let n=total(e)-total(t);if(n!==0)return n>0;let r=spread(t)-spread(e);if(r!==0)return r>0;let i=e.findIndex((e,n)=>e!==t[n]);return i!==-1&&(e[i]??0)>(t[i]??0)}function splitColumns(e,t){let n=[...t];function visit(r,i){let a=t[r.length];if(a===void 0){betterSplit(r,n)&&(n=r);return}for(let t of v)t>=a&&i+t<=e&&visit([...r,t],i+t)}return visit([],0),n}function rowWidths(e,t){let n=e.filter(e=>e.span===void 0);n.length>4&&reject(t,`A row holds at most 4 unsized blocks`);let r=total(e.map(e=>e.span??e.minWidth));r>12&&reject(t,`Blocks ${e.map(e=>`"${e.key}"`).join(`, `)} do not fit one row: they need at least ${r} of 12 columns`);let i=splitColumns(12-total(e.map(e=>e.span??0)),n.map(e=>e.minWidth)),a=0;return e.map(e=>{if(e.span!==void 0)return e.span;let t=i[a]??e.minWidth;return a+=1,t})}function reject(e,t){throw new N(t,[{path:e,message:t}])}function traitsOf(e,t=[]){return $t(e,at,new Map(t.map(e=>[e.name,e])))}function headingNames(e){let t=new Set(e.flatMap(e=>e.kind===`heading`?e.meta.name===void 0?[]:[e.meta.name]:[...Object.keys(e.blocks),...e.group?.name===void 0?[]:[e.group.name]]));return e.flatMap(e=>{if(e.kind!==`heading`)return[];if(e.meta.name!==void 0)return[e.meta.name];let n=nameSlug(e.title,40),r=n===``?`heading`:`heading_${n}`,i=r;for(let e=2;t.has(i);e+=1)i=`${r}_${e}`;return t.add(i),[i]})}function headingEntry(e,t,n){let r={title:t,...n.description===void 0?{}:{description:n.description},...n.icon===void 0?{}:{icon:n.icon}};return{key:e,content:new BlockContentBuilder(Te,r),span:12}}function groupOf(e,t,n){let[r]=e.map(e=>e.name).sort(),i=Mt(e.length);return(i!==void 0||r===void 0)&&reject(n,String(i)),{type:`group`,name:t.name??`group_${r}`,placement:`grid`,...t.label===void 0?{}:{label:t.label},members:e.map(e=>e.name)}}function requirePlacement(e,t,n,r,i){if(e.type===`page`&&reject(i,`Content "${n}" cannot reference a page from a page`),mn(e,t,n,r,i),e.type!==`custom`)return;let a=t?.refine?.(e.parameters??{},r);a&&reject([...i,`parameters`,a.input],a.message)}var Mu=class PageBuilder{constructor(e){this.kind=`view`,this.data=e}icon(e){return new PageBuilder({...this.data,icon:e})}description(e){return new PageBuilder({...this.data,description:e})}home(){return new PageBuilder({...this.data,home:!0})}for(e){let t=typeof e==`string`?e:e.build().name;return new PageBuilder({...this.data,object:t})}row(e,t={}){let n=t.group===void 0?{kind:`row`,blocks:e}:{kind:`row`,blocks:e,group:t.group};return new PageBuilder({...this.data,sections:[...this.data.sections,n]})}heading(e,t={}){let n={kind:`heading`,title:e,meta:t};return new PageBuilder({...this.data,sections:[...this.data.sections,n]})}build(){let e=[`views`,`0`],{name:t,label:n,object:r,icon:i,description:a,home:o,sections:s}=this.data;requireBuilderName(t,[...e,`name`]),r!==void 0&&requireBuilderName(r,[...e,`object`]),o&&r!==void 0&&reject([...e,`home`],`Only a standalone page can be the home`),s.every(e=>e.kind===`row`&&Object.keys(e.blocks).length===0)&&reject([...e,`contents`],`A page declares at least one block`);let c=r===void 0?`page`:`record`,l=[],u=[],d=headingNames(s),f=0;for(let t of s){let n=[...e,`contents`,String(l.length)],r=(t.kind===`heading`?[headingEntry(d[f++]??``,t.title,t.meta)]:Object.entries(t.blocks).map(([e,t])=>isSpanned(t)?{key:e,content:t.content,span:t.span}:{key:e,content:t,span:void 0})).map(t=>{let n=[...e,`contents`,String(l.length)];requireBuilderName(t.key,[...n,`name`]);let{configuration:r,extension:i}=configureContent(t.content,n);requirePlacement(r,i,t.key,c,n);let a={...r,name:t.key,placement:`grid`};return l.push(a),{content:a,span:t.span}}),i=rowWidths(r.map(({content:e,span:t})=>({key:e.name,...t===void 0?{}:{span:t},minWidth:traitsOf(e).minWidth})),n),a=u.reduce((e,t)=>Math.max(e,t.y+t.h),0);if(t.kind===`row`&&t.group!==void 0){let e=groupOf(r.map(({content:e})=>e),t.group,n);l.push(e),u.push({i:e.name,x:0,y:a,w:12,h:traitsOf(e,l).size.h});continue}let o=0;r.forEach(({content:e},t)=>{let n=i[t]??0;u.push({i:e.name,x:o,y:a,w:n,h:traitsOf(e).size.h}),o+=n})}let p=Object.fromEntries(packLayout(u).map(({i:e,x:t,y:n,w:r,h:i})=>[e,{x:t,y:n,w:r,h:i}])),m={name:t,label:n,...r===void 0?{}:{object:r},context:`page`,...i===void 0?{}:{icon:i},...a===void 0?{}:{description:a},...o?{home:!0}:{},contents:l,grid:p},h=T.safeParse(m);if(!h.success)throw N.fromZodErrors(h.error.issues.map(t=>({path:[...e,...t.path.map(String)],message:t.message})));return{kind:`view`,definition:cloneBuilderValue(m,e)}}};function page(e,t){return new Mu({name:e,label:t,object:void 0,sections:[]})}var X=class ViewBuilder{constructor(e,t=[]){this.kind=`view`,this.data=cloneBuilderValue(e,[`views`,`0`]),this.extensions=t.map(e=>e&&{...e})}for(e){let t=typeof e==`string`?e:e.build().name;return new ViewBuilder({...this.data,object:t},this.extensions)}default(){return new ViewBuilder({...this.data,default:!0},this.extensions)}description(e){return new ViewBuilder({...this.data,description:e},this.extensions)}icon(e){return new ViewBuilder({...this.data,icon:e},this.extensions)}place(e,t,n,r,i){let{configuration:a,extension:o}=configureContent(n,[`views`,`0`,`contents`,String(this.data.contents.length)]),s={...a,name:e,label:t,placement:r},c=[...this.data.contents,s],l=i===void 0?{}:{anchors:{...this.data.anchors,[e]:{after:i}}};return new ViewBuilder({...this.data,...l,contents:c},[...this.extensions,o])}tab(e,t,n,r){return this.place(e,t,n,`main`,r?.after)}aside(e,t,n){return this.place(e,t,n,`aside`)}build(){let e=[`views`,`0`];requireBuilderName(this.data.name,[...e,`name`]),requireBuilderName(this.data.object,[...e,`object`]);let t=T.safeParse(this.data);if(!t.success)throw N.fromZodErrors(t.error.issues.map(t=>({path:[...e,...t.path.map(String)],message:t.message})));return this.data.contents.forEach((t,n)=>{let r=[...e,`contents`,String(n)];requireBuilderName(t.name,[...r,`name`]),t.type===`form`&&t.groups.forEach((e,t)=>requireBuilderName(e.name,[...r,`groups`,String(t),`name`])),mn(t,this.extensions[n],t.name,this.data.context,r)}),{kind:`view`,definition:cloneBuilderValue(this.data,e)}}};function detailView(e,t){return new X({name:e,label:t,object:void 0,context:`record`,contents:[]})}function listView(e,t){return new X({name:e,label:t,object:void 0,context:`collection`,contents:[]})}function isViewPiece(e){return`kind`in e&&e.kind===`view`}function isObjectPiece(e){return!(isViewPiece(e)||e instanceof P)}function assertPiece(e,t){if(typeof e!=`object`||!e)throw new N(`Unsupported bundle piece: ${t}`,[]);if(isViewPiece(e)||e instanceof P||typeof e.build==`function`)return;let n=e.name;throw new N(`Unsupported bundle piece: ${typeof n==`string`?n:String(t)}`,[])}function declarationOf$1(e){return e instanceof Mu||e instanceof X?e.build():e}function isPage(e){return e.definition.context===`page`}function validateView(e){let t=T.safeParse(e);if(t.success)return t.data;let n=typeof e==`object`&&e&&`name`in e?String(e.name):`(unnamed)`,r=N.fromZodErrors(t.error.issues.map(e=>({path:e.path.map(String),message:e.message})));throw new N(`View "${n}" is invalid. ${r.message}`,r.errors)}function identityOf(e){return`${e.object??``}:${e.name}`}function assertUniqueIdentities(e,t){let n=new Set;for(let r of t){let t=identityOf(r);if(n.has(t))throw new k(e,r.name);n.add(t)}}function byIdentity(e){return(t,n)=>{let r=identityOf(e(t)),i=identityOf(e(n));return r<i?-1:+(r>i)}}async function hashBundlePieces(e){return sha256Hex(z({objects:[...e.objects].sort(byIdentity(e=>({name:e.name}))),views:[...e.views].sort(byIdentity(e=>e)),pages:[...e.pages].sort(byIdentity(e=>e.definition)),agents:[...e.agents].sort(byIdentity(e=>({name:e.name})))}))}async function builtBundleFromPieces(e){let t=e.name===Au;t||assertBundleName(e.name);let{objects:n,pages:r,agents:i}=e,a=e.views.map(validateView),o=n.map(e=>e.name);if(assertUniqueIdentities(`object`,o.map(e=>({name:e}))),assertUniqueIdentities(`view`,a),assertUniqueIdentities(`page`,r.map(e=>e.definition)),assertUniqueIdentities(`agent`,i.map(e=>({name:e.name}))),!t){let e=o.find(L);if(e!==void 0)throw new A(e,`bundle`)}return{name:e.name,label:e.label.trim(),description:e.description??null,hash:await hashBundlePieces({objects:n,views:a,pages:r,agents:i}),objects:n,views:a,pages:r,agents:i,uses:e.uses??[],samples:e.samples??[],translations:e.translations??{}}}const Nu=Symbol.for(`standards.bundle`);function isBundle(e){return typeof e==`object`&&!!e&&e[Nu]===!0}var BundleBuilder=class{constructor(e,t){this[Nu]=!0,this.pieces=[],this.used=[],this.descriptionText=null,this.sampleRecords=[],this.translationTables={},this.built=null,assertBundleName(e),this.name=e,this.label=t,this.objectBuilders=[]}description(e){return this.descriptionText=e,this.changed()}add(...e){return this.pieces.push(...e),this.objectBuilders.push(...e.filter(isObjectPiece)),this.changed(),this}uses(...e){return this.used.push(...e),this.changed()}samples(e){return this.sampleRecords=e,this.changed()}translations(e,t){return this.translationTables[e]=t,this.changed()}build(){return this.built??=this.assemble(),this.built}changed(){return this.built=null,this}async assemble(){let e=[],t=[],n=[],r=[];for(let[i,a]of this.pieces.entries())if(assertPiece(a,i),a instanceof P)r.push(a.build());else if(isViewPiece(a)){let e=declarationOf$1(a);isPage(e)?n.push(e):t.push(e.definition)}else e.push(a.build());return this.assertNotInUsed(e),builtBundleFromPieces({name:this.name,label:this.label,description:this.descriptionText,objects:e,views:t,pages:n,agents:r,uses:this.used.map(e=>e.name),samples:this.sampleRecords,translations:{...this.translationTables}})}assertNotInUsed(e){let t=new Map,n=new Set([this]),visit=e=>{if(!n.has(e)){n.add(e);for(let n of e.objectBuilders){let r=n.build().name;t.has(r)||t.set(r,e.name)}for(let t of e.used)visit(t)}};for(let e of this.used)visit(e);for(let{name:n}of e){let e=t.get(n);if(e!==void 0)throw new k(`object`,n,`Object "${n}" is declared by bundle "${this.name}" and by its used bundle "${e}"`)}}};function bundle(e,t){return new BundleBuilder(e,t)}function readOnlyOption(e){return e?.readOnly===void 0?{}:{readOnly:e.readOnly}}function buildFreeFieldRef(e,t){return{type:`free`,attribute:e.build(),label:t?.label,required:t?.required,prefillExpression:t?.prefillExpression,...readOnlyOption(t)}}function buildSlotFieldRef(e,t,n){let[r,...i]=Array.isArray(e)?e:[e];return{type:`slot`,slotId:r,additionalSlotIds:i.length>0?i:void 0,attribute:t,label:n?.label,required:n?.required,tooltip:n?.tooltip,...readOnlyOption(n)}}const Pu=B.boolean().optional();var FormRowBuilder=class{constructor(e,t,n){this._finalized=!1,this.stepBuilder=e,this.rowData={id:t,order:n,type:`fields`,fields:[]}}field(e,t,n){return this.rowData.fields.push(buildSlotFieldRef(e,t,n)),this}freeField(e,t){return this.rowData.fields.push(buildFreeFieldRef(e,t)),this}row(e){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).row(e)}heading(e,t){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).heading(e,t)}separator(){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).separator()}text(e){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).text(e)}endRow(){return this._finalized?this.stepBuilder:(this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData))}},FormStepBuilder=class{constructor(e,t,n){this.rowOrder=0,this.formBuilder=e,this.stepData={id:t,label:n,rows:[]}}description(e){return this.stepData.description=e,this}field(e,t,n){this.rowOrder++;let r=`row-${this.stepData.id}-${this.rowOrder}`,i=buildSlotFieldRef(e,t,n),a={id:r,order:this.rowOrder,type:`fields`,fields:[i]};return this.stepData.rows.push(a),this}freeField(e,t){this.rowOrder++;let n=`row-${this.stepData.id}-${this.rowOrder}`,r=buildFreeFieldRef(e,t),i={id:n,order:this.rowOrder,type:`fields`,fields:[r]};return this.stepData.rows.push(i),this}row(e){return this.rowOrder++,new FormRowBuilder(this,e,this.rowOrder)}heading(e,t){this.rowOrder++;let n={id:`heading-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:`heading`,content:e,level:t};return this.stepData.rows.push(n),this}separator(){this.rowOrder++;let e={id:`sep-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:`separator`};return this.stepData.rows.push(e),this}text(e){this.rowOrder++;let t={id:`text-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:`text`,content:e};return this.stepData.rows.push(t),this}step(e,t){return this.formBuilder._finalizeStep(this.stepData).step(e,t)}build(){return this.formBuilder._finalizeStep(this.stepData).build()}_finalizeRow(e){return e.fields.length>0&&this.stepData.rows.push(e),this}_getData(){return this.stepData}},FormBuilder=class{constructor(e,t){this.data={slots:[],steps:[],status:`draft`,version:1},this.validateName(e),this.data.name=e,this.data.label=t}description(e){return this.data.description=e,this}icon(e){return this.data.icon=e,this}status(e){return this.data.status=e,this}metadata(e){return this.data.metadata=e,this}slot(e,t,n){if(this.data.slots.some(t=>t.id===e))throw Error(`[FormBuilder] Duplicate slot id: "${e}"`);let r={id:e,objectName:t,label:n.label,mode:n.mode??`create`,color:n.color,icon:n.icon};return this.data.slots.push(r),this}step(e,t){if(this.data.steps.some(t=>t.id===e))throw Error(`[FormBuilder] Duplicate step id: "${e}"`);return new FormStepBuilder(this,e,t)}build(){return this.validateRequiredData(),this.validateSlotReferences(),this.validateFreeFields(),this.validatePrefillExpressions(),this.validateReadOnly(),this.data}_finalizeStep(e){return this.data.steps.push(e),this}validateName(e){let t=B.string().min(1,`Form name cannot be empty`).max(63,`Form name is too long (max 63 characters)`).regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,{message:`Invalid form name format. Name must be in kebab-case: 'client-onboarding', 'contact-creation'`});try{t.parse(e)}catch(e){throw e instanceof B.ZodError?Error(`[FormBuilder] ${e.issues[0].message}`):e}}validateRequiredData(){if(this.data.slots.length===0)throw Error(`[FormBuilder] At least one slot is required. Use .slot() to add slots.`);if(this.data.steps.length===0)throw Error(`[FormBuilder] At least one step is required. Use .step() to add steps.`)}validateSlotReferences(){let e=new Map(this.data.slots.map(e=>[e.id,e.objectName]));for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n))for(let r of n.fields){if(r.type!==`slot`)continue;let n=getSlotFieldTargets(r);for(let r of n)if(!e.has(r))throw Error(`[FormBuilder] Step "${t.id}" references unknown slot "${r}". Declare it with .slot("${r}", ...) first.`);let i=new Set(n.map(t=>e.get(t)));if(i.size>1)throw Error(`[FormBuilder] Step "${t.id}" field on attribute "${r.attribute}" targets slots of different objects (${[...i].join(`, `)}). A multi-slot field must target slots of the same object.`)}}validatePrefillExpressions(){let e=[...W,`join`,`where`];for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n))for(let r of n.fields){if(!isFormFreeFieldRef(r)||!r.prefillExpression)continue;let n=r.prefillExpression,i=`prefillExpression on free field "${r.attribute.name}" in step "${t.id}"`;if(!isLabelExpression(n))throw Error(`[FormBuilder] ${i} must contain at least one {{ attribute }} interpolation.`);if(/\{\{\s*\}\}/.test(n))throw Error(`[FormBuilder] ${i} contains empty {{ }} interpolation.`);for(let a of n.matchAll(/(?<!\|)\|(?!\|)\s*(\w+)(?:\s*:[^|}]*)?/g)){let n=a[1];if(!e.includes(n))throw Error(`[FormBuilder] ${i} uses invalid pipe "${n}". Valid pipes: ${e.join(`, `)}`);let o=a[0].replace(/^\|/,``);if(isWherePipe(o)&&!parseWherePipe(o))throw new N(`[FormBuilder] ${i} has a malformed where: pipe "${o.trim()}". Write where:property=value or where:property in (a,b).`,[{path:[t.id,r.attribute.name,`prefillExpression`],message:`Malformed where: pipe`}])}}}validateReadOnly(){for(let e of this.data.steps)for(let t of e.rows)if(isFormFieldsRow(t))for(let n of t.fields){if(Pu.safeParse(n.readOnly).success)continue;let t=isFormFreeFieldRef(n)?n.attribute.name:n.attribute,r=isFormFreeFieldRef(n)?`free field`:`field`;throw new N(`[FormBuilder] readOnly on ${r} "${t}" in step "${e.id}" must be a boolean.`,[{path:[e.id,t,`readOnly`],message:`Expected a boolean`}])}}validateFreeFields(){let e=new Set(H);for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n)){for(let r of n.fields)if(isFormFreeFieldRef(r)){let n=r.attribute.type;if(e.has(n))throw Error(`[FormBuilder] Free field in step "${t.id}" uses forbidden attribute type "${n}". Forbidden types: ${H.join(`, `)}`)}}}};function form(e,t){return new FormBuilder(e,t)}const Fu=`box`,Iu=[`circle`,`square`],Lu=[`upload`,`website`,`name`,`email`];function isImageSource(e){return Lu.some(t=>t===e)}const Ru={object:[`icon`,`color`],record:[`icon`,`image`],emailCategory:[`icon`,`color`],option:[`color`],view:[`icon`],agent:[`color`],user:[`image`]};function imageFileIdOf(e){return`image`in e?e.image?.fileId:`imageFileId`in e?e.imageFileId:void 0}function resolveAppearance(e,t){let n=imageFileIdOf(e);if(n)return{kind:`image`,imageFileId:n,shape:t?.image?.shape??`square`};let r=t?.name??e.name,i=e.color??t?.color??(r?bl(r):void 0),a=e.icon??t?.icon??`box`;return i?{kind:`tile`,icon:a,color:i}:{kind:`glyph`,icon:a}}const zu=B.object({shape:B.enum(Iu),from:B.array(B.string().refine(e=>e.trim().length>0,`Must not be blank`)).optional()}).strict();function imageLookupKindOf(e){return e.type===`text`?e.format===`url`?`website`:e.format===`email`?`email`:`name`:null}function validateObjectImage(e){let t=e.image?.from;if(t===void 0)return;let refuse=(t,n)=>{throw new N(`Object "${e.name}": ${t}`,[{path:n===void 0?[`image`,`from`]:[`image`,`from`,String(n)],message:t}])};t.length===0&&refuse(`image.from must name at least one attribute`);let n=new Map((e.attributes??[]).map(e=>[e.name,e])),r=new Set;for(let[e,i]of t.entries()){r.has(i)&&refuse(`image.from names "${i}" twice`,e),r.add(i);let t=n.get(i);t?imageLookupKindOf(t)===null&&refuse(`image.from names "${i}", a ${t.type} attribute: only text attributes can locate an image`,e):refuse(`image.from names "${i}", which is not one of its attributes`,e)}}function validateObjectExpressions(e){let{name:t,labelExpression:n,embeddingExpression:r}=e;if(!n)throw new j(`Object "${t}" must have a labelExpression. The labelExpression defines how records are displayed in lists and relations (e.g. "{{ name }}").`,M.VALIDATION_FAILED);let i=G.safeParse(n);if(!i.success){let e=i.error.issues[0]?.message??`Invalid labelExpression`;throw new j(`Invalid labelExpression for "${t}": ${e}`,M.VALIDATION_FAILED)}if(r!==void 0){let e=G.safeParse(r);if(!e.success){let n=e.error.issues[0]?.message??`Invalid embeddingExpression`;throw new j(`Invalid embeddingExpression for "${t}": ${n}`,M.VALIDATION_FAILED)}}}var ObjectBuilder=class{get"~standard"(){return createStandardSchemaProps(nl(this.build()))}constructor(e,t){this._sealed=!1,this._toleratedAttributes=[],this.validateName(e),this.obj={name:e,label:t,attributes:[],system:!0}}id(e){return this.obj.id=e,this}description(e){return this.obj.description=e,this}pluralLabel(e){return this._pluralLabel=e,this}icon(e){return this.obj.icon=e,this}color(e){return this.obj.color=e,this}image(e={}){return this.obj.image={shape:e.shape??`square`,...e.from===void 0?{}:{from:[...e.from]}},this}runtime(){return this.obj.system=!1,this}sealed(){return this._sealed=!0,this}tolerate(e){return this._toleratedAttributes=[...this._toleratedAttributes,...e],this}attribute(e){return this.pushAttributes([e]),this}attributes(e){return this.pushAttributes(e),this}pushAttributes(e){let t=e.map(e=>`build`in e&&typeof e.build==`function`?e.build():e);pc([...this.obj.attributes,...t],e=>e.name,e=>new k(`attribute`,e,`Object "${this.obj.name}": duplicate attribute name "${e}"`)),this.obj.attributes.push(...t)}metadata(e){return this.obj.metadata={...this.obj.metadata,...e},this}order(e){return this.obj.metadata={...this.obj.metadata,order:e},this}hidden(){return this.obj.metadata={...this.obj.metadata,hidden:!0},this}labelExpression(e){return this._labelExpression=e,this}embeddingExpression(e){return this._embeddingExpression=e,this}documentLayout(e){if(e.presets)for(let t of e.presets)validatePresetStructure(t.id,t.structure,1);return this.obj.documentLayout=e,this}build(){if(!this.obj.name)throw new N(`[ObjectBuilder] Missing required field: name`,[{path:[`name`],message:`name is required`}]);if(!this.obj.label)throw new N(`[ObjectBuilder] Missing required field: label`,[{path:[`label`],message:`label is required`}]);return validateObjectExpressions({name:this.obj.name,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression}),validateObjectImage({name:this.obj.name,image:this.obj.image,attributes:this.obj.attributes}),{...this.obj,pluralLabel:this._pluralLabel,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression,sealed:this._sealed,toleratedAttributes:this._toleratedAttributes}}validateName(e){e!==void 0&&xc(e)}};function object(e,t){if(L(e))throw new A(e,`builder`);return new ObjectBuilder(e,t)}function validatePresetStructure(e,t,n){let fail=(t,n)=>{throw new N(t,[{path:[`documentLayout`,`presets`,e],message:n}])};n>5&&fail(`Preset structure exceeds max depth of 5`,`Preset structure too deep`);let r=new Set;for(let i of t){let t=i.title.trim();t.length===0&&fail(`Folder preset node title is required`,`Empty folder title`),t.includes(`/`)&&fail(`Folder preset node title cannot contain /`,`Folder title contains /: "${t}"`),r.has(t)&&fail(`Folder preset sibling titles must be unique`,`Duplicate folder title: "${t}"`),r.add(t),i.children&&i.children.length>0&&validatePresetStructure(e,i.children,n+1)}}function relationProperty(e){return requireBuilderName(e,[`relationProperty`]),{relationProperty:e}}var Z=class ContentBuilder{constructor(e,t){this.data=cloneBuilderValue(e,[`content`]),this.extension=t===void 0?void 0:Object.freeze({name:t.name,contexts:t.contexts,parameters:t.parameters,refine:t.refine})}set(e){return new ContentBuilder({...this.data,...e},this.extension)}icon(e){return this.set({icon:e})}object(e){return this.set({objectName:e})}layout(e){let{layout:t,groupByAttribute:n,columnSizing:r,kanbanColumnOrder:i,kanbanColumnVisibility:a,kanbanPinnedColumns:o,...s}={...this.data,layout:void 0,groupByAttribute:void 0,columnSizing:void 0,kanbanColumnOrder:void 0,kanbanColumnVisibility:void 0,kanbanPinnedColumns:void 0};return new ContentBuilder({...s,...e},this.extension)}table(){return this.layout({layout:`table`})}list(){return this.layout({layout:`list`})}kanban(e){return this.layout({layout:`kanban`,groupByAttribute:e})}columns(...e){return this.set({columns:e})}actions(...e){return this.set({actions:e})}openMode(e){return this.set({openMode:e})}createMode(e){return this.set({createMode:e})}visibility(e){return this.set({visibility:e})}descriptionAttribute(e){return this.set({descriptionAttribute:e})}displayAttributes(...e){return this.set({displayAttributes:e})}columnSizing(e){return this.set({columnSizing:e})}kanbanColumnOrder(...e){return this.set({kanbanColumnOrder:e})}kanbanColumnVisibility(e){return this.set({kanbanColumnVisibility:e})}kanbanPinnedColumns(...e){return this.set({kanbanPinnedColumns:e})}formColumns(e){return this.set({formColumns:e})}density(e){return this.set({density:e})}titleAttribute(e){return this.set({titleAttribute:e})}allowUpload(e){return this.set({allowUpload:e})}allowRemove(e){return this.set({allowRemove:e})}hideAttachments(e){return this.set({hideAttachments:e})}relations(...e){return this.set({relations:e})}span(e){return spanContent(this,e)}height(e){return this.set({height:e})}build(){let e=validateLiteralContent(this.data,[`content`]);return this.extension&&e.type===`custom`&&D(this.extension,e.parameters,[`content`,`parameters`]),e}},Bu=class GroupBuilder{constructor(e,t,n,r={}){this.data=cloneBuilderValue({name:e,label:t,fields:n,...r},[`group`])}field(e,t){let{name:n,label:r,fields:i,...a}=this.data;return new GroupBuilder(n,r,[...i,{attribute:e,...t}],a)}fields(...e){let{name:t,label:n,fields:r,...i}=this.data;return new GroupBuilder(t,n,[...r,...e.map(e=>({attribute:e}))],i)}description(e){return new GroupBuilder(this.data.name,this.data.label,this.data.fields,{...this.presentation(),description:e})}collapsible(e=!1){return new GroupBuilder(this.data.name,this.data.label,this.data.fields,{...this.presentation(),collapsible:!0,collapsed:e})}presentation(){let{name:e,label:t,fields:n,...r}=this.data;return r}build(){requireBuilderName(this.data.name,[`group`,`name`]);try{validateLiteralContent({type:`form`,groups:[this.data]},[`group`])}catch(e){throw e instanceof N?new N(e.message,e.errors.map(e=>({...e,path:e.path[1]===`groups`?[`group`,...e.path.slice(3)]:e.path}))):e}return cloneBuilderValue(this.data,[`group`])}};function group(e,t){return new Bu(e,t,[])}function collection(e){return new Z({type:`collection`,...storedQuery(e,`collection`)})}function form$1(...e){return new Z({type:`form`,groups:e.map(e=>`build`in e?e.build():e)})}function activity(){return new Z({type:`activity`})}function richtext$1(e){return new Z({type:`richtext`,attribute:e})}function documents(){return new Z({type:`documents`})}function forms(){return new Z({type:`forms`})}function emails(...e){return new Z({type:`emails`,emailAttributes:e})}function meetings(...e){return new Z({type:`meetings`,emailAttributes:e})}function custom(e,t){if(typeof e!=`object`||!e||typeof e.name!=`string`)throw new N(`Expected registered extension declaration`,[{path:[`content`,`extension`],message:`Expected registered extension declaration`}]);let n=validateContentConfiguration({type:`custom`,extension:e.name,parameters:t},[`content`]);if(n.type!==`custom`)throw new N(`Expected custom content`,[]);let r=new Z({...n,extension:e.name},e);return r.build(),r}function recordLinksTab(){return[S.name,S.label,custom(Le,{}).icon(S.icon)]}function recordMemoryTab(){return[C.name,C.label,custom(Re,{}).icon(C.icon)]}function page$1(e){let{object:t,name:n}=e.definition;if(typeof t!=`string`){let e=`Page "${n}" is standalone; a record tab renders a record page (\`page(...).for(object)\`)`;throw new N(e,[{path:[`content`,`page`,`object`],message:e}])}return new Z({type:`page`,page:{object:t,name:n}})}const Vu={collection,metric,chart,agenda,card,text:text$1,decisions,meetingsUpcoming,mailbox,page:page$1,form:form$1,activity,richtext:richtext$1,documents,forms,emails,meetings,custom};function contentDefinition(e,t){if(t.suppressed)return null;let n=t.workspaceDefinition??t.sourceDefinition;return n===null?null:{...structuredClone(n),name:e}}function storedContentDefinition(e){let{name:t,...n}=e;return structuredClone(n)}function workspaceViewAuthoring(e,t={}){let n={main:0,aside:0};return{origin:`runtime`,mainOrderCustomized:!1,asideOrderCustomized:!1,gridCustomized:Object.keys(t).length>0,homeCustomized:!1,contents:Object.fromEntries(e.map(e=>[e.name,{sourceDefinition:null,workspaceDefinition:storedContentDefinition(e),suppressed:!1,sourcePosition:null,workspacePosition:e.placement===`grid`?null:n[e.placement]++,sourceGrid:null,workspaceGrid:t[e.name]??null}]))}}function byKind(e,t){let rank=e=>Number(e.definition.type===`group`);return rank(e)-rank(t)||e.name.localeCompare(t.name)}function inReadingOrder(e){return(t,n)=>{let r=e(t.name),i=e(n.name);return r===null||i===null?r===i?byKind(t,n):r?-1:1:r.y-i.y||r.x-i.x||byKind(t,n)}}function overLimit(e,t){let n=new Set;if(e.length<=F.tabsPerView)return n;let r=new Map(e.map(e=>[e.name,e])),i=new Map;for(let{name:t,definition:n}of e)if(n.type===`group`)for(let e of n.members)i.has(e)||i.set(e,t);let cellOf=e=>{let n=r.get(e),a=n?t(n.state):null;if(a!==null)return a;let o=r.get(i.get(e)??``);return o?t(o.state):null},a=e.filter(e=>e.state.sourceDefinition===null).sort(inReadingOrder(cellOf)).reverse();for(let t of a){if(e.length-n.size<=F.tabsPerView)break;if(n.has(t.name))continue;let i=t.definition.type===`group`?t.definition.members.flatMap(e=>{let t=r.get(e);return t&&t.definition.type!==`group`?[t]:[]}):[];if(!i.some(e=>e.state.sourceDefinition!==null))for(let e of[t,...i])n.add(e.name)}return n}function resolvePageGrid(e,t={}){let rawCell=t=>e.gridCustomized||t.sourceDefinition===null?t.workspaceGrid:t.sourceGrid,n=Object.entries(e.contents).flatMap(([e,t])=>{let n=contentDefinition(e,t);return n?[{name:e,state:t,definition:n}]:[]}),r=E(n.map(e=>e.definition)),i=n.filter(e=>!r.has(e.name)).sort((e,t)=>e.name.localeCompare(t.name)),a=overLimit(i,rawCell),o=i.filter(e=>!a.has(e.name)),s=new Map(o.map(e=>[e.name,e.definition])),c=t.traitsOf??cn(s,at),l=Nt([...s.values()]),u=o.filter(e=>!l.has(e.name)),d={},f=[],place=(e,t)=>{t&&!Object.values(d).some(e=>sn(t,e))?d[e]={...t}:f.push(e)};if(e.gridCustomized)for(let{name:e,state:t}of u)place(e,t.workspaceGrid);else{for(let{name:e,state:t}of u)t.sourceDefinition!==null&&place(e,t.sourceGrid);for(let{name:e,state:t}of u)t.sourceDefinition===null&&place(e,t.workspaceGrid)}let p=Math.max(0,...Object.values(d).map(e=>e.y+e.h));for(let t of f.sort()){let n=e.contents[t],{w:r,h:i}=n.workspaceGrid??n.sourceGrid??c(t).size;d[t]={x:0,y:p,w:r,h:i},p+=i}let m=repairPageGrid(Object.entries(d).map(([e,n])=>({i:e,...n,...t.statics?.has(e)?{static:!0}:{}})),c);return{grid:Object.fromEntries(m.cells.map(({i:e,x:t,y:n,w:r,h:i})=>[e,{x:t,y:n,w:r,h:i}])),repairs:[...[...a].map(e=>({name:e,kind:`dropped`})),...m.repairs]}}function droppedContents(e){return new Set(e.flatMap(e=>e.kind===`dropped`?[e.name]:[]))}function resolveViewContents(e){let t=Object.entries(e.contents).flatMap(([e,t])=>{let n=contentDefinition(e,t);return n?[{definition:n,...t}]:[]}),n=[`main`,`aside`].flatMap(n=>{let r=n===`main`?e.mainOrderCustomized:e.asideOrderCustomized;return t.filter(e=>e.definition.placement===n).sort((e,t)=>{let n=r?e.workspacePosition:e.sourcePosition,i=r?t.workspacePosition:t.sourcePosition;if(n!==null&&i!==null&&n!==i)return n-i;if(n!==null&&i===null)return-1;if(i!==null&&n===null)return 1;let a=e.sourcePosition??e.workspacePosition,o=t.sourcePosition??t.workspacePosition;return a!==null&&o!==null&&a!==o?a-o:a!==null&&o===null?-1:o!==null&&a===null?1:e.definition.name.localeCompare(t.definition.name)}).map(e=>e.definition)}),r=E(t.map(e=>e.definition)),i=t.filter(e=>e.definition.placement===`grid`&&!r.has(e.definition.name)).map(e=>e.definition).sort((e,t)=>e.name.localeCompare(t.name));return[...n,...i]}const Hu=[`record`,`document`,`file`,`email`,`thread`,`event`,`memory`,`skill`,`schema`,`user`,`guide`,`bundle`,`draft`,`decision`],Uu=new Set([`memory`,`schema`]),Wu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function isReferenceKind(e){return Hu.includes(e)}function refuse$1(e,t){return{ok:!1,reason:e,expected:t}}function parseReference(e){let t=e.trim();if(Wu.test(t))return refuse$1(`bare_uuid`,`record:<id>`);let n=t.indexOf(`:`);if(n===-1)return refuse$1(`malformed`,`<kind>:<id>`);let r=t.slice(0,n).toLowerCase();if(!isReferenceKind(r))return refuse$1(`unknown_kind`,`<kind>:<id> with kind one of ${Hu.join(`, `)}`);let i=t.slice(n+1).trim();return i===``?refuse$1(`malformed`,`${r}:<id>`):r===`record`&&i.includes(`:`)?refuse$1(`legacy_mention`,`record:${i.slice(i.lastIndexOf(`:`)+1)}`):i===`*`&&!Uu.has(r)?refuse$1(`malformed`,`${r}:<id>`):{ok:!0,ref:{kind:r,id:i}}}function formatReference(e){return`${e.kind}:${e.id}`}function isWildcard(e){return e.id===`*`&&Uu.has(e.kind)}function requestedCapabilities(e){let t=[];return e.canModify&&t.push(`modify`),e.canSend&&t.push(`send`),t}const Gu={status:`connector_status`,error:`connector_error`,provider:`connector_provider`},Ku={phone:`text`,currency:`number`},qu={rename:[`kind`,`object`,`from`,`to`],phone:[`kind`,`object`,`attribute`,`to`,`defaultCountryCode`],currency:[`kind`,`object`,`attribute`,`to`,`currencyCode`]};function refuse(e,t,n){throw new N(n,[{path:t===void 0?[`resolutions`,String(e)]:[`resolutions`,String(e),t],message:n}])}function assertKeys(e,t,n){for(let r of n)(typeof t[r]!=`string`||t[r]===``)&&refuse(e,r,`Resolution ${e} needs a non-empty string \`${r}\``);let r=Object.keys(t).find(e=>!n.includes(e));r!==void 0&&refuse(e,r,`Resolution ${e} has an unknown field \`${r}\``)}function assertResolution(e,t){if(hc(t)||refuse(e,void 0,`Resolution ${e} must be an object`),t.kind===`rename`){assertKeys(e,t,qu.rename),t.from===t.to&&refuse(e,`to`,`Resolution ${e} renames "${t.from}" to itself`);return}if(t.kind!==`retype`&&refuse(e,`kind`,`Unknown resolution kind ${JSON.stringify(t.kind)}: expected "rename" or "retype"`),t.to!==`phone`&&t.to!==`currency`&&refuse(e,`to`,`Unsupported retype to ${JSON.stringify(t.to)}: a push converts text → phone and number → currency only`),assertKeys(e,t,qu[t.to]),t.to===`phone`){let n=t.defaultCountryCode;/^[A-Z]{3}$/.test(n)&&Cl(n)||refuse(e,`defaultCountryCode`,`Resolution ${e}: "${n}" is not an ISO 3166-1 alpha-3 country code`);return}let n=t.currencyCode;/^[A-Z]{3}$/.test(n)&&Sl(n)||refuse(e,`currencyCode`,`Resolution ${e}: "${n}" is not a supported ISO 4217 currency code`)}function addressesOf(e){return e.kind===`rename`?{reads:e.from,lands:e.to}:{reads:e.attribute,lands:e.attribute}}function assertSchemaSourceResolutions(e){if(!Array.isArray(e))throw new N("`resolutions` must be an array",[{path:[`resolutions`],message:"`resolutions` must be an array"}]);if(e.length>100)throw new N(`A push carries ${e.length} resolutions; the limit is 100`,[]);let t=new Set;for(let[n,r]of e.entries()){assertResolution(n,r);let{reads:e,lands:i}=addressesOf(r);for(let[a,o]of[[`${r.kind}:${r.object}.${e}`,`of "${r.object}.${e}"`],[`${r.kind}>${r.object}.${i}`,`onto "${r.object}.${i}"`]])t.has(a)&&refuse(n,void 0,`Resolution ${n} repeats a ${r.kind} ${o}`),t.add(a)}}function phoneFromText(e,t){let n=e.trim();if(n===``)return{value:null};let r=wl(n,_l(t));if(!r?.isPossible()||r.country===void 0||r.ext!==void 0)return;let i=xl(r.country)?.iso3;if(i!==void 0)return{value:{countryCode:i,phoneNumber:yl(n,i)}}}function convertRetypedValue(e,t,n={}){if(t===null)return{value:null};if(e.to===`phone`)return typeof t==`string`?phoneFromText(t,e.defaultCountryCode):void 0;if(typeof t==`number`&&Math.abs(t)<=2**53-1&&!(t<0&&n.allowNegative!==!0))return{value:{code:e.currencyCode,value:t}}}const Q=B.string().refine(e=>e.trim().length>0,`Must not be blank`),Ju=B.union([B.tuple([B.literal(`object`),Q]),B.tuple([B.literal(`attribute`),Q,Q]),B.tuple([B.literal(`view`),Q,Q]),B.tuple([B.literal(`content`),Q,Q,Q])]),Yu=B.object({label:Q,pluralLabel:B.string().optional(),description:B.string().optional(),icon:I.optional(),color:mc.optional(),image:zu.optional(),labelExpression:B.string(),embeddingExpression:B.string().optional(),sealed:B.boolean().optional(),toleratedAttributes:B.array(Q).optional(),metadata:B.record(B.string(),B.unknown()).optional(),documentLayout:B.record(B.string(),B.unknown()).optional()}).strict();function failure(e){throw new N(e,[])}function definitionSchema(e){return B.custom(t=>{let n=B.record(B.string(),B.unknown()).parse(t);for(let t of e[0]===`view`?[`object`,`name`]:[`name`])Object.hasOwn(n,t)&&failure(`Invalid schema state: unrecognized definition key ${t}`);switch(e[0]){case`object`:Yu.parse(n);break;case`attribute`:{let e=B.enum(_e).parse(n.type);kc(e).extend({type:B.literal(e),label:Q,required:B.boolean().optional(),unique:B.boolean().optional(),icon:I.optional()}).strict().parse(n);break}case`view`:{let{contents:t,...r}=n,i=B.array(Q).parse(t);new Set(i).size!==i.length&&failure(`Invalid schema state: duplicate content membership`),ft.parse({...r,object:e[1],name:e[2],contents:[]});break}case`content`:O.parse({...n,name:e[3]})}return!0})}function compareSchemaStateEntries(e,t){let n=JSON.stringify(e.address),r=JSON.stringify(t.address);return n<r?-1:+(n>r)}function schemaStateSourcePayload(e){return{modelVersion:1,hashVersion:1,entries:[...e].sort(compareSchemaStateEntries).filter(e=>e.source!==null).map(({address:e,source:t})=>({address:e,source:t}))}}function parseState(e){let t=B.record(B.string(),B.unknown()).parse(e);for(let[e,n]of[[`modelVersion`,`model`],[`hashVersion`,`hash`]])t[e]!==1&&failure(`Unsupported schema ${n} version: expected 1, received ${t[e]===void 0?`missing`:String(t[e])}`);let n=B.object({modelVersion:B.literal(1),hashVersion:B.literal(1),tenant:Q,sourceFingerprint:B.string().regex(/^[a-f0-9]{64}$/),entries:B.array(B.unknown())}).strict().safeParse(e);if(!n.success){let e=n.error.issues.find(e=>e.code===`unrecognized_keys`);throw e?.code===`unrecognized_keys`&&failure(`Invalid schema state: unrecognized key ${e.keys[0]}`),N.fromZodErrors(n.error.issues.map(e=>({path:e.path.map(String),message:e.message})))}let r=new Set,i=n.data.entries.map(e=>{let t=Ju.parse(B.object({address:B.unknown()}).parse(e).address),n=JSON.stringify(t);r.has(n)&&failure(`Invalid schema state: duplicate address ${n}`),r.add(n);let i=definitionSchema(t).nullable(),a=t[0]===`object`||t[0]===`attribute`?B.object({id:B.string().uuid(),updatedAt:B.string().datetime()}).strict():B.object({id:B.string().uuid(),revision:B.number().int().nonnegative()}).strict(),o=B.object({address:Ju,source:i,effective:i,status:B.enum([`source`,`runtime`,`copy`,`suppressed`]),sourceOwner:B.string().regex(U).nullable(),guard:a.nullable()}).strict().parse(e);return(o.status===`runtime`&&(o.source!==null||o.effective===null||o.sourceOwner!==null)||o.status===`suppressed`&&(t[0]!==`content`||o.source===null||o.effective!==null||o.guard===null)||o.status===`copy`&&(o.source===null||o.effective===null)||o.effective!==null&&o.guard===null||o.source===null&&o.effective===null)&&failure(`Invalid schema state: inconsistent status at ${n}`),{...o,sourceOwner:parseSchemaOwner(o.sourceOwner)}});return{...n.data,entries:i.sort(compareSchemaStateEntries)}}function parseSchemaState(e){try{return parseState(e)}catch(e){throw e instanceof B.ZodError?N.fromZodErrors(e.issues.map(e=>({path:e.path.map(String),message:e.message}))):e}}function diffSchemaState(e){let t=[];for(let n of[...e.entries].sort(compareSchemaStateEntries)){let e=n.source===null?`added`:n.status===`suppressed`?`suppressed`:n.effective===null?`removed`:z(n.source)===z(n.effective)?n.status===`copy`?`copied`:null:`changed`;e&&t.push({...n,change:e})}return{modelVersion:1,tenant:e.tenant,sourceFingerprint:e.sourceFingerprint,changes:t}}const $=B.string().min(1),Xu=B.union([B.object({objectName:$,viewName:$,contentName:$.optional()}).strict().describe(`Full configuration of a view, or of one content when contentName is given`),B.object({objectId:$}).strict().describe(`An object with its attributes, by id`),B.object({objectName:$}).strict().describe(`An object with its attributes`),B.object({objectId:$,attributeName:$}).strict().describe(`One attribute's config, by name`),B.object({objectId:$,attributeId:$}).strict().describe(`One attribute's config, by id`),B.object({objectId:$,recordId:$}).strict().describe(`One sample record`)]);function parseNamedTarget(e){let t=Xu.safeParse(e);if(!t.success)throw new N(`Invalid scoped target`,[{path:[`target`],message:`Expected exactly one named target branch`}]);return t.data}const Zu=[`object`,`attribute`,`view`,`content`,`sample`],Qu=B.object({mode:B.enum([`inline`,`window`]),interaction:B.enum([`static`,`interactive`]),size:B.enum([`compact`,`regular`]),aspectRatio:B.number().positive().finite().optional()}).strict(),$u=B.object({artifactId:B.string().min(1),revision:B.number().int().positive(),name:B.string().min(1),kind:B.string().min(1),retention:B.enum(eu),display:Qu}).strict();function readArtifactResult(e){let t=$u.safeParse(e);return t.success?t.data:null}const ed=B.string().regex(/^[^/\s]+\/[^/\s]+$/),td=B.object({kind:B.literal(`generated-image`),artifact:B.unknown(),generation:B.object({attemptId:B.uuid(),requestedModelId:ed,executedModelId:ed.nullable(),format:B.enum(ou),mimeType:B.enum([`image/png`,`image/jpeg`,`image/webp`])}).strict()}).strict();function readGeneratedImageResult(e){let t=td.safeParse(e);if(!t.success)return null;let n=readArtifactResult(t.data.artifact);return!n||n.kind!==`image`?null:{...t.data,artifact:{...n,kind:`image`}}}function isCompletedToolPart(e){return e.type===`tool`&&e.state===`completed`}function readString(e,t){let n=e[t];return typeof n==`string`?n:void 0}function upsertWithPrecedence(e,t,n,r){let i=e.get(t),a=i&&r[i.kind]>r[n.kind]?i:n;e.delete(t),e.set(t,a)}function asRecord(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function readRefId(e,t,n){let r=readString(e,t),i=`${n}:`;return r?.startsWith(i)&&r.length>i.length?r.slice(i.length):void 0}function verbResultEntries(e){let t=asRecord(e);if(!t)return[];let n=[t];for(let e of[`members`,`created`,`updated`]){let r=t[e];if(Array.isArray(r))for(let e of r){let t=asRecord(e);t&&n.push(t)}}return n.filter(e=>!(`error`in e))}function extractReadRecordIds(e){let t=new Set;for(let n of e)if(n.role===`assistant`)for(let e of n.parts){if(!isCompletedToolPart(e)||e.name!==`read`)continue;let n=e.args.refs;if(Array.isArray(n))for(let e of n){if(typeof e!=`string`)continue;let n=parseReference(e);n.ok&&n.ref.kind===`record`&&t.add(n.ref.id)}}return[...t]}const nd={created:1,modified:0};function readSingleRecordEntry(e){if(typeof e!=`object`||!e)return null;let t=e,n=typeof t.record==`object`&&t.record!==null?t.record:void 0,r=(n&&readString(n,`id`))??readString(t,`recordId`);return r?{id:r,label:(n&&readString(n,`label`))??r,objectName:(n&&readString(n,`objectName`))??``}:null}function readBulkRecordEntries(e,t,n){if(typeof e!=`object`||!e)return[];let r=e[t];if(!Array.isArray(r))return[];let i=[];for(let e of r){if(typeof e!=`object`||!e)continue;let t=e,r=readString(t,`id`);r&&i.push({id:r,label:readString(t,`label`)??r,objectName:readString(t,`objectName`)??n})}return i}function readVerbRecordEntries(e){let t=asRecord(asRecord(e.result)?.record),n=readString(e.args,`object`)??(t&&readString(t,`objectName`))??``,r=[];for(let t of verbResultEntries(e.result)){let e=readRefId(t,`ref`,`record`);e&&r.push({id:e,label:readString(t,`title`)||readString(t,`label`)||e,objectName:readString(t,`objectName`)??n})}return r}function extractTouchedRecords(e){let t=new Map;for(let n of e)if(n.role===`assistant`)for(let e of n.parts){if(!isCompletedToolPart(e))continue;let n=[],r;if(e.name===`create_record`||e.name===`update_record`||e.name===`edit_content`){let t=readSingleRecordEntry(e.result);n=t?[t]:[],r=e.name===`create_record`?`created`:`modified`}else if(e.name===`bulk_create_records`||e.name===`bulk_update_records`){let t=readString(e.args,`objectId`)??``,i=e.name===`bulk_create_records`?`created`:`updated`;n=readBulkRecordEntries(e.result,i,t),r=e.name===`bulk_create_records`?`created`:`modified`}else if(e.name===`write`)n=readVerbRecordEntries(e),r=readString(e.args,`action`)===`create`?`created`:`modified`;else continue;for(let e of n){let n={recordId:e.id,objectName:e.objectName,label:e.label,kind:r};upsertWithPrecedence(t,e.id,n,nd)}}return[...t.values()]}const rd={modified:1,consulted:0};function isFilePart(e){return e.type===`file`}function entryFromDocumentMutation(e,t){if(typeof e.result!=`object`||e.result===null)return null;let n=e.result,r=readString(n,`documentId`)??(t===`folderId`?readString(n,t):void 0);return r?{id:r,title:readString(e.args,`name`)??readString(e.args,`title`)??r,kind:`modified`}:null}function entryFromReadDocument(e){let t=readString(e.args,`documentId`);return t?{id:t,title:t,kind:`consulted`}:null}function entryFromRef(e,t,n){let r=readRefId(e,`ref`,`file`),i=r??readRefId(e,`ref`,`document`);return i?{id:i,...r?{fileId:r}:{},title:n||readString(e,`title`)||i,kind:t,mimeType:readString(e,`mimeType`)}:null}function entriesFromOrganize(e){let t=asRecord(e.result);if(!t||`error`in t)return[];let n=readString(e.args,`action`),r=readString(e.args,`name`)??readString(e.args,`title`),i=readString(t,`documentId`);if(i)return[{id:i,title:r??i,kind:`modified`}];let a=readString(t,`folderId`);if(a)return n===`create_folder`?[{id:a,title:r??a,kind:`modified`}]:[];let o=entryFromRef(t,`modified`,r);return o?[o]:[]}function entriesFromCopy(e){let t=asRecord(e.result);if(!t||`error`in t)return[];let n=(Array.isArray(t.copied)?t.copied:[]).flatMap(e=>{let t=asRecord(e),n=t?entryFromRef(t,`modified`,void 0):null;return n?[n]:[]});if(n.length>0)return n;let r=entryFromRef(t,t.ref!==void 0&&t.ref===readString(e.args,`from`)?`consulted`:`modified`,void 0);return r?[r]:[]}function entriesFromRead(e){let t=asRecord(e.result);return(Array.isArray(t?.members)?t.members:[]).flatMap(e=>{let t=asRecord(e);if(!t||`error`in t||!readRefId(t,`ref`,`document`))return[];let n=entryFromRef(t,`consulted`,void 0);return n?[n]:[]})}function entriesFromToolPart(e){switch(e.name){case`organize`:return entriesFromOrganize(e);case`copy`:return entriesFromCopy(e);case`read`:return entriesFromRead(e);default:{let t=entryFromToolPart(e);return t?[t]:[]}}}function entryFromSandboxUpload(e){if(typeof e.result!=`object`||e.result===null)return null;let t=e.result,n=readString(t,`fileId`);return n?{id:n,fileId:n,title:readString(t,`title`)??n,kind:`modified`,mimeType:readString(t,`mimeType`)}:null}function entryFromToolPart(e){switch(e.name){case`update_document`:case`attach_file`:return entryFromDocumentMutation(e,`documentId`);case`create_folder`:return entryFromDocumentMutation(e,`folderId`);case`read_document`:return entryFromReadDocument(e);case`sandbox_upload_file`:return entryFromSandboxUpload(e);default:return null}}function extractTouchedDocuments(e){let t=new Map;for(let n of e)if(n.role===`assistant`){for(let e of n.parts)if(isCompletedToolPart(e))for(let n of entriesFromToolPart(e))upsertWithPrecedence(t,n.id,n,rd);else if(isFilePart(e)&&e.fileId){let n={id:e.fileId,fileId:e.fileId,title:e.name||e.fileId,kind:`modified`,mimeType:e.mimeType};upsertWithPrecedence(t,n.id,n,rd)}}return[...t.values()]}function extractTouchedArtifacts(e){let t=new Map;for(let n of e)if(n.role===`assistant`)for(let e of n.parts){if(!isCompletedToolPart(e)||e.error)continue;let n=e.name===`generate_image`?readGeneratedImageResult(e.result)?.artifact:e.name===`publish_artifact`?readArtifactResult(e.result):null;if(!n)continue;let r=`${n.artifactId}:${n.revision}`;t.delete(r),t.set(r,n)}return[...t.values()]}function isNonBlankString(e){return typeof e==`string`&&/\S/u.test(e)}const id=B.object({provider:B.custom(e=>isNonBlankString(e)&&e.length<=200,{message:`must be a non-blank string of at most 200 characters`}),model:B.string().max(200).regex(/\S/u)});function normalizeNewsLocale(e){return e.toLowerCase().split(`-`)[0]===`fr`?`fr`:`en`}function resolveLocalized(e,t){return e[normalizeNewsLocale(t)]||(e.en?e.en:e.fr||void 0)}function hasLocale(e){return!!(e.fr||e.en)}const ad=Object.keys({home:!0,agents:!0,routines:!0,object:!0,settings:!0}),od=[`dot`,`label`,`bubble`];function parseNewsIntensity(e){return od.find(t=>t===e)??`dot`}function parseNewsTarget(e){let[t,...n]=e.split(`:`),r=n.join(`:`);switch(t){case`home`:case`agents`:case`routines`:return r===``?{kind:t}:null;case`object`:return r?{kind:t,name:r}:null;case`settings`:return r?{kind:t,section:r}:null;default:return null}}function formatNewsTarget(e){return e.kind===`object`?`object:${e.name}`:e.kind===`settings`?`settings:${e.section}`:e.kind}function withoutTrailingSlashes(e){let t=e.length;for(;t>0&&e[t-1]===`/`;)--t;return e.slice(0,t)}const sd=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/;function compareIdentifiers(e,t){let n=/^\d+$/.test(e),r=/^\d+$/.test(t);return n&&r?Math.sign(Number(e)-Number(t)):n?-1:r?1:e<t?-1:+(e>t)}function compareVersions(e,t){let n=sd.exec(e),r=sd.exec(t);if(!(n&&r))return null;for(let e=1;e<=3;e+=1){let t=Number(n[e])-Number(r[e]);if(t!==0)return t<0?-1:1}let i=n[4],a=r[4];if(i===void 0&&a===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;let o=i.split(`.`),s=a.split(`.`);for(let e=0;e<Math.max(o.length,s.length);e+=1){let t=o[e],n=s[e];if(t===void 0)return-1;if(n===void 0)return 1;let r=compareIdentifiers(t,n);if(r!==0)return r<0?-1:1}return 0}function isSemver(e){return sd.test(e)}const cd=30,ld=90,ud=50,dd=B.looseObject({fr:B.string().optional(),en:B.string().optional()}),fd=B.iso.datetime({offset:!0}),pd=B.looseObject({id:B.string().min(1),slug:B.string().min(1),updatedAt:fd,publishedAt:fd,since:B.string(),displayDays:B.number().int().positive().optional(),requires:B.looseObject({capability:B.string(),level:B.string()}).optional(),target:B.string().optional(),intensity:B.unknown().optional(),title:dd,summary:dd});function knownRequirement(e){let t=J.find(t=>t.id===e.capability);return t!==void 0&&levelActions(t,e.level).length>0}function parseEntry(e){let t=pd.safeParse(e);if(!t.success)return`malformed entry: ${t.error.issues[0]?.message??`invalid`}`;let n=t.data;if(!isSemver(n.since))return`entry ${n.id}: since "${n.since}" is not semver`;if(!hasLocale(n.title))return`entry ${n.id}: title has no locale`;if(!hasLocale(n.summary))return`entry ${n.id}: summary has no locale`;if(n.requires&&!knownRequirement(n.requires))return`entry ${n.id}: unknown requirement ${n.requires.capability}/${n.requires.level}`;let r=n.target?parseNewsTarget(n.target):null;return{...n,displayDays:n.displayDays??30,intensity:parseNewsIntensity(n.intensity),target:r??void 0}}function httpsUrl(e){return typeof e==`string`&&e.startsWith(`https://`)?e:void 0}function parseNewsIndex(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw new N(`News feed: document must be an object`,[]);let n=e;if(!Array.isArray(n.entries))throw new N(`News feed: entries must be an array`,[]);let r=[];for(let e of n.entries){let n=parseEntry(e);typeof n==`string`?t?.(n):r.push(n)}let i=httpsUrl(n.blogUrl),a=httpsUrl(n.mediaBaseUrl),o=a?withoutTrailingSlashes(a):void 0;return{...i?{blogUrl:i}:{},...o?{mediaBaseUrl:o}:{},entries:r.slice(0,50)}}const md=B.looseObject({id:B.string().min(1),slug:B.string().min(1),updatedAt:fd,body:dd});function parseNewsBody(e){let t=md.safeParse(e);if(!t.success)throw new N(`News body: malformed document`,[]);if(!hasLocale(t.data.body))throw new N(`News body: body needs at least one locale`,[]);return t.data}function preference(e,t){return{key:e,value:t.value,default:t.default,audited:t.audited??!1,...t.parameter===void 0?{}:{parameter:t.parameter},...t.parameters===void 0?{}:{parameters:t.parameters},...t.refine===void 0?{}:{refine:t.refine}}}const hd=``;function refusal(e,t){return{ok:!1,field:e,message:t,issues:[{path:[e],message:t}]}}function declarationOf(e,t){return`get`in e?e.get(t):e.find(e=>e.key===t)}function locatePreference(e,t,n){let r=declarationOf(e,t);return r?r.parameter===void 0?n===void 0?{ok:!0,declaration:r,parameter:``}:refusal(`parameter`,`Preference "${t}" takes no parameter`):n===void 0||n===``||n.trim()!==n?refusal(`parameter`,`Preference "${t}" is keyed by ${r.parameter}`):r.parameters&&!r.parameters.includes(n)?refusal(`parameter`,`"${n}" is not a ${r.parameter} of "${t}"`):{ok:!0,declaration:r,parameter:n}:refusal(`key`,`Unknown preference "${t}"`)}function judgePreferenceWrite(e,t,n,r){let i=locatePreference(e,t,n);if(!i.ok)return i;let a=i.declaration.value.safeParse(r);if(a.success){let e=i.declaration.refine?.(a.data,i.parameter);return e===void 0?{...i,value:a.data}:refusal(`value`,e)}return{ok:!1,field:`value`,message:`Invalid value for preference "${t}"`,issues:a.error.issues.map(e=>({path:[`value`,...e.path.map(String)],message:e.message}))}}const gd=B.strictObject({model:id.optional(),routing:B.literal(`auto`).optional()}),_d=B.strictObject({inApp:B.boolean()});function isActionableType(e){let t=g[e];return t!==void 0&&pe(t.kind)}const vd=[preference(`workPosture`,{value:B.enum(Xa),default:`auto`,audited:!0}),preference(`chat.default`,{value:gd,default:{},audited:!0}),preference(`conversationSurface`,{value:B.enum($r),default:`panel`}),preference(`mailboxListMode`,{value:B.enum(Gi),default:`threads`}),preference(`home`,{value:B.string().uuid().nullable(),default:null}),preference(`memory.learnFromEmail`,{value:B.boolean(),default:!0,audited:!0}),preference(`memory.shareWithTeam`,{value:B.boolean(),default:!0,audited:!0}),preference(`decisions.seenAt`,{value:B.iso.datetime().nullable(),default:null}),preference(`decisions.delivery`,{value:_d,default:{inApp:!0},parameter:`decision type`,parameters:Object.keys(g),refine:(e,t)=>!e.inApp&&isActionableType(t)?`A "${t}" decision asks you to act: it is always shown in-app`:void 0})];function preferenceEntry(e,t,n){return n===void 0?{key:e,value:t}:{key:e,parameter:n,value:t}}function withPreferenceEntry(e,t){if(t.parameter===void 0)return{...e,values:{...e.values,[t.key]:t.value}};let n=e.entries.findIndex(e=>e.key===t.key&&e.parameter===t.parameter),r=n===-1?[...e.entries,t]:e.entries.map((e,r)=>r===n?t:e);return{...e,entries:r}}export{Sr as ACCESS_LEVELS,Cr as ACCESS_ROLES,e as ACTIONABLE_DECISION_KINDS,_ as AGENDA_BLOCK,wr as AGENT_ASIDE_ANSWER_MAX_LENGTH,Tr as AGENT_ASIDE_HISTORY_LIMIT,Er as AGENT_ASIDE_QUESTION_MAX_LENGTH,Dr as AGENT_AVATAR_EXPRESSIONS,Or as AGENT_AVATAR_TYPES,kr as AGENT_MESSAGE_KIND,Ar as AGENT_NOTIFICATION_KIND,jr as AGENT_SESSION_ACCESS_ROLES,Mr as AGENT_SESSION_LIST_ORDERS,Nr as AGENT_SESSION_ORIGINS,Pr as AGENT_SESSION_PROVENANCES,Fr as AGENT_STARTERS_MAX,Ir as AGENT_STARTER_MAX_LENGTH,Lr as AGENT_TASK_KINDS,t as AGGREGATE_BUCKETS,n as AGGREGATE_MEASURES,lu as ALLOWED_PROPERTY_TYPES,Rr as ALL_CATALOG_TOOL_NAMES,W as ALL_PIPES,zr as ALWAYS_KINDS,Ru as APPEARANCE_FACETS,Br as APPROVAL_FAMILY_TOOL_NAMES,Vr as ARCHITECT_PUBLICATION_KIND,tu as ARTIFACT_FILE_ROLES,$l as ARTIFACT_KINDS,he as ARTIFACT_PREVIEW_EXTENSION,eu as ARTIFACT_RETENTIONS,Hr as ASK_QUESTIONS_ANSWER_MAX_LENGTH,Ur as ASK_QUESTIONS_ANSWER_MAX_VALUES,Wr as ASK_QUESTIONS_MAX_BATCH,Gr as ASK_QUESTIONS_TOOL_NAME,ge as ATTRIBUTE_FILTER_OPERATORS,ic as ATTRIBUTE_NAME_SCHEMA,_e as ATTRIBUTE_TYPES,Kr as AUDIT_ACTIONS,qr as AUDIT_AGENT_SESSION_METADATA_KEY,Jr as AUDIT_RESOURCE_TYPES,Mn as AccessDeniedError,AgendaBuilder,P as AgentBuilder,Nn as AggregateValidationError,Pn as AmbiguousSchemaChangeError,Fn as AttributeInUseError,In as AttributeNotFoundError,ve as BLOCK_CONTEXTS,ye as BLOCK_PERIODS,v as BLOCK_WIDTHS,kl as BROWSER_IMAGE_MAX_BYTES,Yr as BROWSER_LAUNCH_TOOL_NAME,Xr as BUNDLE_LOCALES,ku as BUNDLE_NAME_PATTERN,cu as BYTE_UNIT_LABELS,BlockContentBuilder,BundleBuilder,y as CARD_BLOCK,xu as CATALOG_RESOURCES,b as CHART_BLOCK,be as CHART_KINDS,Cc as COMPUTED_RETURN_TYPES,Zr as CONNECTION_GRANT_PROVIDERS,Gu as CONNECTOR_CALLBACK_PARAM,xe as CONTENT_PLACEMENT_CONTEXTS,Qr as CONTINUATION_KEY_PATTERN,$r as CONVERSATION_SURFACES,Au as CORE_BUNDLE_NAME,vd as CORE_PREFERENCES,ei as CORE_RECORD_TOOL_NAMES,ti as CORE_TOOL_NAMES,ni as COUNT_MODES,bu as CUSTOM_LEVEL,CardBuilder,ChartBuilder,ChartQuery,Ln as ConcurrentModificationError,Z as ContentBuilder,Se as DECISIONS_BLOCK,r as DECISION_INBOX_STATES,i as DECISION_KINDS,a as DECISION_LINE_MAX_LENGTH,o as DECISION_LINK_TARGET_TYPES,s as DECISION_LIST_STATES,c as DECISION_READ_STATES,l as DECISION_SETTINGS_AREAS,u as DECISION_TITLE_MAX_LENGTH,d as DECISION_TYPES_V1,f as DECISION_TYPE_ACCESS_GRANTED,p as DECISION_TYPE_AGENT_APPROVAL,m as DECISION_TYPE_AGENT_QUESTION,h as DECISION_TYPE_AGENT_REVIEW,ee as DECISION_TYPE_AGENT_ROUTINE_RUN_FAILED,te as DECISION_TYPE_AGENT_ROUTINE_RUN_NOTICE,ne as DECISION_TYPE_AGENT_SETUP,re as DECISION_TYPE_CONNECTOR_CONNECTION_ERROR,ie as DECISION_TYPE_CONNECTOR_CONNECTION_REAUTH_REQUIRED,ae as DECISION_TYPE_ENVIRONMENT_BUILD_FAILED,g as DECISION_TYPE_KINDS,oe as DECISION_TYPE_PERSON,se as DECISION_TYPE_RECORD_ASSIGNED,ce as DECISION_TYPE_RECORD_MENTIONED,le as DECISION_WORK_STATES,ri as DEFAULT_AGENT_EXECUTION_CONFIG,ii as DEFAULT_AGENT_TOOL_GROUPS,Fu as DEFAULT_APPEARANCE_ICON,ai as DEFAULT_APPROVAL_POLICY,oi as DEFAULT_BLUEPRINT_TOOL_GROUPS,si as DEFAULT_DAILY_ACTIVITY_DAYS,Ql as DEFAULT_DICTATION_LIMITS,_u as DEFAULT_LABEL_FALLBACK,Ce as DEFAULT_LAYOUT_TRAITS,ci as DEFAULT_MEETING_BOT_DISPLAY_NAME,li as DEFAULT_TENANT_SETTINGS,ml as DEFAULT_VALIDATION_MESSAGES,Al as DEVICE_CHANNEL_AUTHENTICATE_TIMEOUT_MS,jl as DEVICE_CHANNEL_IDLE_POLL_MS,Nl as DEVICE_CHANNEL_KEEPALIVE_MS,Ol as DEVICE_CHANNEL_MAX_FRAME_BYTES,Dl as DEVICE_CHANNEL_PATH,Ml as DEVICE_CHANNEL_PRESENCE_MS,Ll as DEVICE_CHANNEL_UPGRADE_REQUIRED_REASON,Pl as DEVICE_CHANNEL_WORKER_CLOSE_PROTOCOL_VIOLATION,Il as DEVICE_COMMAND_ERROR_CODES,Xl as DICTATION_FINALIZATION_TIMEOUT_MS,Wl as DICTATION_FRAME_BYTES,Kl as DICTATION_MAX_BUFFER_BYTES,Gl as DICTATION_MAX_FRAME_BYTES,ql as DICTATION_MAX_TRANSCRIPT_BYTES,Zl as DICTATION_MODEL_ID,Yl as DICTATION_PREPARATION_TIMEOUT_MS,Ul as DICTATION_SAMPLE_RATE,Jl as DICTATION_TICKET_TTL_MS,ui as DISCARD_ARCHITECT_DRAFT_TOOL_NAME,di as DOCUMENT_SORT_MODES,Zu as DRAFT_CONFLICT_KINDS,fi as DRAFT_WRITE_TOOL_NAMES,DecisionsBuilder,DeviceChannelProtocolError,Vl as DeviceChannelServerFrameSchema,Bl as DeviceChannelWorkerFrameSchema,k as DuplicateError,pi as EMAIL_CATEGORY_DEFAULT_COLOR,mi as EMAIL_CATEGORY_DEFAULT_ICON,hi as EMAIL_CATEGORY_DESCRIPTION_MAX,gi as EMAIL_CATEGORY_DESCRIPTION_MIN,_i as EMAIL_CATEGORY_LIMIT,vi as EMAIL_CATEGORY_NAME_MAX,yi as ENVIRONMENT_BUILD_LOG_STEP_PREFIX,bi as ENVIRONMENT_CHECKS_MAX,xi as ENVIRONMENT_CHECK_COMMAND_MAX_CHARS,Si as ENVIRONMENT_CHECK_NAME_MAX_CHARS,Ci as ENVIRONMENT_HARNESSES,wi as ENVIRONMENT_HARNESS_SANDBOX_WORKDIR,Ti as ENVIRONMENT_HARNESS_WORKDIR,Ei as ENVIRONMENT_IMAGES,Di as ENVIRONMENT_MEMORY_GB_PER_VCPU,Oi as ENVIRONMENT_NAME_MAX_CHARS,ki as ENVIRONMENT_NETWORK_ALLOW_MAX,Ai as ENVIRONMENT_SCRIPT_MAX_BYTES,ji as ENVIRONMENT_SIZES,Mi as ENVIRONMENT_SIZE_VCPUS,Ni as ENVIRONMENT_STANDARDS_WORKDIR,Pi as ENV_VAR_KEY_PATTERN,Fi as ESTIMATED_COUNT_CAP,Rn as ExportTooLargeError,Ii as FILE_URLS_MAX_IDS,H as FORM_FORBIDDEN_ATTRIBUTE_TYPES,zn as ForbiddenError,FormBuilder,FormRowBuilder,FormStepBuilder,Li as GET_ARCHITECT_DRAFT_TOOL_NAME,Ri as GITHUB_TRIGGER_CATALOG,zi as GRANT_ENABLES,we as GROUPABLE_ATTRIBUTE_TYPES,Bu as GroupBuilder,Te as HEADING_BLOCK,Bi as HITL_TOOL_NAMES,ou as IMAGE_FORMATS,Iu as IMAGE_SHAPES,Lu as IMAGE_SOURCES,Vi as INFERENCE_REASONING_OPTIONS,Hi as INFERENCE_ROUTING_MODES,Ui as INFERENCE_SPEEDS,Ee as INVENTORY_LIMIT,Bn as InvalidPermissionGrantError,Wi as LAST_RUN_ERROR_MAX_LENGTH,ac as LIST_VIEW_TAB_VISIBILITIES,De as LOCATION_FILTER_PROPERTIES,Vn as LogoProviderUnavailableError,Hn as LogoSearchRateLimitedError,Oe as MAILBOX_BLOCK,Gi as MAILBOX_LIST_MODES,Ki as MAIL_DRAFT_BODY_MAX_CHARS,qi as MAIL_SIGNATURE_MAX_CHARS,Ji as MAIL_SUBJECT_MAX_CHARS,ue as MAX_AGGREGATE_GROUPS,Yi as MAX_DAILY_ACTIVITY_DAYS,Hl as MAX_PRESET_DEPTH,Xi as MAX_TODOS,Zi as MAX_TODO_DESCRIPTION_CHARS,Qi as MAX_TODO_ID_CHARS,$i as MCP_SERVER_NAME_MAX_LENGTH,ke as MEASURABLE_ATTRIBUTE_TYPES,Ae as MEETINGS_UPCOMING_BLOCK,ea as MEETING_BOT_IMAGE,ta as MEETING_BOT_IMAGE_BASE64_MAX_LENGTH,na as MEETING_RESPONSES,Y as MEMORY_ATTRIBUTES,Eu as MEMORY_PAGE_MAX_CHARS,ra as MEMORY_SPEND_LIMIT_PATTERN,Du as MEMORY_WORKSPACE_PROFILE,Tu as MEMORY_WRITE_SOURCE,x as METRIC_BLOCK,MailboxBuilder,ia as McpOAuthCompletionMode,Un as MemoryNotFoundError,MetricBuilder,MetricQuery,MultiRelationAttributeBuilder,Tl as NATIVE_AGENT_UI_PART_IDS_METADATA_KEY,El as NATIVE_AGENT_UI_PART_IDS_METADATA_SCHEMA_VERSION,je as NATIVE_BLOCKS,oc as NATIVE_OBJECT_NAMES,aa as NATIVE_TOOL_GROUPS,oa as NATIVE_TOOL_GROUP_CATALOG,cd as NEWS_DEFAULT_DISPLAY_DAYS,ld as NEWS_DISPLAY_CAP_DAYS,ud as NEWS_INDEX_MAX_ENTRIES,od as NEWS_INTENSITIES,ad as NEWS_TARGET_KINDS,K as NO_ACCESS,hd as NO_PREFERENCE_PARAMETER,sa as NO_RECORDING,Me as NO_VALUE_OPERATORS,Gc as NonJsonValueError,NoopGeocodingAdapter,Wn as NotFoundError,Gn as NotImplementedError,q as OBJECT_GRANT,sc as OBJECT_NAME_SCHEMA,ca as OPEN_TOOL_PART_STATES,la as OPERATION_MAX_STEPS,Ne as OPERATORS_BY_TYPE,ObjectBuilder,Kn as ObjectNotFoundError,qn as ObjectReferencedError,Jn as OrphanSystemAttributeError,Pe as PAGE_GRID_COLUMNS,Cu as PERMISSION_ACTIONS,J as PERMISSION_CAPABILITIES,yu as PERMISSION_CATALOG,du as PIPES_WITH_ARGS,ua as PROVIDER_DRAFT_LABEL,da as PROVIDER_NAMES,fa as PUBLIC_MAIL_DOMAINS,Mu as PageBuilder,Yn as PageReferencedError,Xn as ProtectedResourceError,Zn as ProtectedRoleError,Fe as QUALIFIED_SEPARATOR,Ie as QUERY_OBJECT,pa as QUESTION_FAMILY_TOOL_NAMES,su as QUOTA_KEYS,Qn as QueryTimeoutError,ma as RECENT_ACTIVITY_LEDGER_LIMIT,ha as RECIPIENT_IDENTITIES_MAX,ga as RECORDING_OVERRIDES,_a as RECORDING_POLICIES,va as RECORD_ACCESS_ROLES,ya as RECORD_ACCESS_SOURCES,ba as RECORD_DRIVE_CURSOR_MAX_LENGTH,xa as RECORD_DRIVE_PAGE_DEFAULT_LIMIT,Sa as RECORD_DRIVE_PAGE_MAX_LIMIT,Ca as RECORD_GRAPH_DEFAULT_LIMIT_PER_NODE,wa as RECORD_GRAPH_MAX_LIMIT_PER_NODE,Ta as RECORD_GRAPH_MAX_NODES,Ea as RECORD_IMAGE_MAX_BYTES,Le as RECORD_LINKS_BLOCK,S as RECORD_LINKS_CONTENT,cc as RECORD_LIST_SCOPES,Re as RECORD_MEMORY_BLOCK,C as RECORD_MEMORY_CONTENT,ze as RECORD_OBJECT,Hu as REFERENCE_KINDS,Be as RELATION_TARGET_ANY,Ve as REMOVED_OPERATOR_REPLACEMENTS,Da as REPLY_MODES,Oa as REQUEST_DESIGN_REVIEW_TOOL_NAME,ka as REQUEST_SETUP_TOOL_NAME,lc as RESERVED_ATTRIBUTE_NAMES,uc as RESERVED_OBJECT_NAMES,Aa as RESOURCE_GRANT_KINDS,ja as RESOURCE_KIND_CATALOG,dc as RESOURCE_VISIBILITIES,Ma as ROUTING_PRICE_CEILINGS,$n as RealtimeDeliveryError,er as RealtimeRateLimitedError,tr as RealtimeSubscriptionError,nr as RecordNotFoundError,He as RecordQuery,rr as RecordReferencedError,ir as RepositoryError,A as ReservedObjectNameError,ar as RoleNotFoundError,F as SCHEMA_LIMITS,U as SCHEMA_OWNER_PATTERN,Ku as SCHEMA_SOURCE_RETYPE_FROM,Na as SESSION_INFERENCE_PATCH_KEYS,uu as SIMPLE_PIPES,wc as SIMPLE_PROPERTY_TYPES,Pa as SLACK_TRIGGER_CATALOG,Ou as STANDARD_SCHEMA_VENDOR,Fa as SURFACE_TOOL_NAMES,Ue as SYNONYM_ALIASES,We as SYSTEM_ATTRIBUTES,Ge as SYSTEM_ATTRIBUTE_I18N_KEYS,Ia as SYSTEM_EMAIL_CATEGORIES,La as SYSTEM_EMAIL_CATEGORY_NAMES,fc as SYSTEM_FIELD_NAMES,Ke as SYSTEM_FILTER_ATTRIBUTE_TYPES,Ra as SYSTEM_PART_CODES,j as SchemaError,M as SchemaErrorCode,or as SearchBackendError,sr as SearchPathNotIndexedError,SingleRelationAttributeBuilder,cr as StorageError,lr as SyncCascadeError,ur as SyncConflictError,dr as SyncError,fr as SystemEntityImmutableError,za as TASK_DEMAND_LEVELS,nu as TENANT_INVITATION_DEFAULT_TTL_MS,iu as TENANT_INVITATION_MAX_TTL_MS,ru as TENANT_INVITATION_MIN_TTL_MS,au as TENANT_INVITATION_RESEND_INTERVAL_MS,w as TEXT_BLOCK,fl as TEXT_FORMAT_PATTERNS,Ba as TODO_PHASES,Va as TODO_PLAN_STATUSES,Ha as TODO_STATUSES,Ua as TOOL_APPROVAL_STATES,Wa as TRIAGE_ACTIONS,Ga as TRIGGER_EVENT_TYPES,Ka as TURN_OUTCOMES,pr as ToolGroupGrantError,qa as UNSHAREABLE_OBJECT_NAMES,Ja as USERS_RESOLVE_MAX_IDS,Ya as USER_STATUSES,Xa as USER_WORK_POSTURES,Za as VERB_NAMES,N as ValidationError,X as ViewBuilder,Tc as WIRE_OFFERED_BASE_CONFIG,Ec as WIRE_OMITTED_CONFIG_KEYS,mr as WorkspaceInvariantReason,Qa as agent,$a as agentAvatarFromMetadata,eo as agentAvatarSchema,to as agentDataChunk,no as agentDisplayName,ro as agentInferencePreferencesSchema,io as agentMessageAttachmentSchema,ao as agentMessagePartSchema,oo as agentScheduleSchema,so as agentSessionInferenceOverridesInputSchema,co as agentSessionInferenceOverridesSchema,lo as agentSessionMessageSchema,uo as agentStartersSchema,fo as agentTriggerBaseSchema,po as agentTriggerPatchSchema,mo as agentTriggerSchema,ho as agentUIValidationError,applyPipes,go as artifactQuoteSchema,Kc as asTenantId,qc as asUserId,_o as askQuestionsOutputSchema,assertBundleName,vo as assertCustomAgentUIMessageChunk,assertSchemaSourceResolutions,yo as assertSessionState,Dc as attributeConfigSchemas,qe as attributeFilterTarget,Je as attributeInventory,Ye as blockObjectInputs,buildPropertySchema,Xe as buildQualifiedAttribute,builtBundleFromPieces,bundle,z as canonicalStringify,bo as canonicalToolGroups,Ze as canonicalizeFilterValue,capabilityForResource,Qe as capped,checkbox,xo as classificationRestoreSchema,So as classifyEmailSchema,Co as cliDefaultModelOf,$e as collectContentViewCatalogue,et as collectQualifiedRuleIssues,tt as collectionContentSourceSchema,nt as collectionSourceAddress,rt as collectionSourceAddressOf,mc as colorIdSchema,it as columnsSchema,wo as compareAgentSessionMessages,compareSchemaStateEntries,compareVersions,To as compiledHarnessModels,computeByteMagnitude,computeReconnectDelay,computeRetryDelay,Eo as connectionGrantKindsOf,Do as connectorTriggerMatchSchema,Vu as content,contentDefinition,at as contentExtensionRegistry,ot as contentReadObjects,T as contentViewDefinitionSchema,st as contentViewDefinitionSchemaFor,convertRetypedValue,el as createAttributeValidator,tl as createFormAttributeValidator,createStandardSchemaProps,currency,ct as currentActor,Oo as customDataChunkSchemas,date,de as decisionThreadKey,declaredImageRequests,ko as decodeAgentSessionListCursor,Jc as deepEqual,lt as defineBlock,defineDeviceChannelFrames,deriveLayout6,Ao as deriveViewerAccess,ut as describeViewIssue,detailView,deviceChannelUrl,diffSchemaState,dt as displayAttributesSchema,document,ft as draftContentViewDefinitionSchema,pt as draftContentViewDefinitionSchemaFor,droppedContents,jo as durableDateSchema,mt as edgePropertyFilterTarget,Mo as emailCategoryCreateSchema,No as emailCategoryDeleteSchema,Po as emailCategoryScopeQuerySchema,Fo as emailCategoryUpdateSchema,Io as emailRuleScopeSchema,Lo as encodeAgentSessionListCursor,Ro as environmentHarness,zo as environmentWorkdir,extractAttributeNames,ht as extractCurrencyFilterValue,gt as extractFilterValue,extractReadRecordIds,extractTouchedArtifacts,extractTouchedDocuments,extractTouchedRecords,_t as filterOperatorsOfType,vt as filterStateSchema,yt as filterTargetsOf,Bo as findEnvironmentHarness,findGrantIssues,bt as findGridViolation,xt as findGroupViolation,St as findLayoutRuleViolation,Ct as findRelationAttribute,wt as findRowLimitViolation,form,formFieldFlatKey,formFieldKey,formatByteSize,fe as formatDecisionLink,formatNewsTarget,gl as formatPhoneForDisplay,formatReference,hl as formatZodErrors,formula,Yc as generateId,Tt as getAttributeCapabilities,kc as getAttributeConfigSchema,Ac as getAttributeConfigWriteSchema,Et as getAttributeFilterOperators,getEditableLabelAttribute,Dt as getOperatorPolarity,Ot as getRollupFilterOperators,getSingleAttributeFromExpression,getSlotFieldTargets,kt as getSystemAttributeI18nKey,At as getSystemAttributeList,Vo as githubConditionSchema,Ho as githubTriggerMatchSchema,Uo as grantKindOf,jt as gridPositionSchema,group,Mt as groupSizeMessage,Nt as groupedMembers,Wo as harnessModelChoices,hasLocale,hasOptions,hashBundlePieces,Go as humanRequestId,Ko as humanRequestKind,I as iconNameSchema,imageLookupKindOf,imageModelFormatDefect,qo as imageModelIdSchema,Xc as indexBy,Pt as inferInverseCardinality,Jo as inferenceReasoningSchema,Yo as inferenceRoutingSchema,Xo as inferenceSpeedSchema,Ft as input,It as invalidViewMessage,pe as isActionableDecisionKind,Zo as isAgentMessageMetadata,Qo as isAgentNotificationMetadata,$o as isAgentUIDataName,es as isAgentWrittenAuditEntry,ts as isArchitectPublicationMetadata,Lt as isAttributeFilterable,Rt as isAttributeGroupable,hr as isAttributeInUseError,zt as isAttributeKanbanGroupable,Bt as isAttributeSearchable,Vt as isAttributeSortable,ns as isAwaitingHuman,Ht as isBilateralRelation,rs as isBlocking,isBundle,Ut as isCalendarDay,isCatalogResource,Wt as isCollectionContent,Gt as isDynamicValue,rl as isEmptyValue,is as isEnvironmentHarnessId,isFormDefinition,isFormFieldsRow,isFormFreeFieldRef,isFormHeadingRow,isFormSeparatorRow,isFormSlotFieldRef,isFormTextRow,isImageSource,isLabelExpression,Kt as isLocationFilterProperty,qt as isLocationPartOperator,as as isMailProvider,os as isMailboxListMode,Jt as isManagedSystemAttribute,L as isNativeObjectName,ss as isNativeToolGroup,Yt as isNoValueOperator,gr as isNotFoundError,il as isNullishOrEmptyString,_r as isObjectReferencedError,cs as isOpenToolPartState,ls as isParkedOnHuman,hc as isPlainRecord,vr as isProtectedResourceError,us as isProviderDraft,ds as isPublicMailDomain,fs as isQuestionPart,yr as isRecordReferencedError,Xt as isRelativeDateValue,ps as isReplyMode,ms as isResourceGrant,hs as isRoutineActorMetadata,br as isSchemaError,isSemver,gs as isSessionInferencePatch,Zt as isSetMembershipOperator,isStandardSchema,_s as isSystemEmailCategory,vs as isSystemEmailCategoryName,ys as isSystemPartCode,bs as isToolApprovalState,Qt as isUniversalRelation,xr as isValidationError,al as isValuePresent,isWherePipe,isWildcard,judgePreferenceWrite,keptFill,G as labelExpressionSchema,$t as layoutTraitsOf,levelActions,levelFloor,levelOf,listView,locatePreference,location,en as locationPartFilterTarget,xs as meetingBotDispatchRequestSchema,Ss as meetingBotDispatchResponseSchema,Cs as meetingBotNotificationSchema,ws as meetingTranscriptSegmentSchema,E as memberlessGroups,memoryPageViewOf,Ts as mentionReferenceSchema,Es as mergeSessionInferencePatch,tn as metricComparePeriod,Ds as modelDefinitionSchema,id as modelIdentitySchema,Os as modelReferenceSchema,multiselect,nameSlug,Xu as namedTargetSchema,nativeAgentUIPartIdMetadataKey,ks as needsManageWhenUnattended,vl as normalizeCountrylessPhoneNumber,nn as normalizeFilterRule,rn as normalizeForEdgeRpc,normalizeNewsLocale,an as normalizeOperator,yl as normalizePhoneNumber,As as normalizedMeetingTranscriptSchema,on as now,number,object,zu as objectImageSchema,js as openRequests,Ms as orderAgentSessionMessages,packLayout,page,pageCompactor,cn as pageTraitsOf,Ns as parseAgentDefinitionAccessRole,Ps as parseAgentSessionAccessRole,jc as parseAttributeConfig,Mc as parseAttributeConfigForCreate,Nc as parseAttributeConfigForUpdate,D as parseBlockParameters,Fs as parseCountMode,me as parseDecisionLink,parseDeviceChannelFrame,Is as parseMergedAgentTrigger,parseNamedTarget,parseNativeAgentUIPartIdsMetadata,parseNewsBody,parseNewsIndex,parseNewsIntensity,parseNewsTarget,Ls as parseOptionalCountMode,Rs as parsePageAccessRole,ln as parseQualifiedAttribute,zs as parseRecordAccessRole,gc as parseRecordListScope,parseReference,_c as parseResourceVisibility,parseSchemaGroupPresentation,parseSchemaOwner,parseSchemaState,parseServerFrame,Bs as parseToolGroupGrant,parseWherePipe,parseWorkerFrame,wu as permissionGrantSchema,phone,placeNew,preference,preferenceEntry,Pc as propertyAttributeSchema,Fc as propertyAttributeWireSchema,Ic as propertySchemaSchema,Lc as propertySchemaWireSchema,Vs as providerNameSchema,O as publishedViewContentDefinitionSchema,un as query,readArtifactResult,Hs as readAskQuestionsResult,readFormFieldValue,readGeneratedImageResult,Us as recentActivityEntryKey,Ws as recordGraphNodeKey,Gs as recordGraphRequestSchema,recordLinksTab,Ks as recordMeetingsCount,recordMemoryTab,qs as recordOperationSchema,dn as recordQueryDefinitionSchema,Js as refineTrigger,Rc as refuseForeignKeys,ol as rejectUnknownAttributesOrThrow,relation,fn as relationAcceptsObject,relationProperty,pn as relationTargetsOf,renderLabelExpression,repairPageGrid,requestedCapabilities,hn as requireRecordContentContext,gn as requireSingleRelationTarget,resolveAppearance,_n as resolveCollectionActions,vn as resolveContentNavigation,yn as resolveEffectiveFilterType,resolveFieldRequired,bn as resolveIsWithinBounds,resolveLocalized,resolvePageGrid,resolvePropertyDefinitions,pl as resolveTextPattern,xn as resolveUtcDayBounds,resolveViewContents,Ys as resourceGrant,richtext,rollup,Xs as routedMessageInferenceSchema,sameActions,Zc as sameStableValue,schemaGroupKey,schemaStateSourcePayload,select,zc as selectOptionWriteSchema,Qc as serializeCanonicalJson,$c as serializeStableJson,Zs as sessionInferencePatchSchema,settleLayout,sha256Hex,Sn as singleRelationTarget,Qs as slackConditionSchema,$s as slackTriggerMatchSchema,snapWidth,Cn as sortsSchema,wn as sourcedAttributeOf,status,Bc as statusGroupSchema,Vc as statusOptionWriteSchema,storedContentDefinition,Tn as systemColumnFilterTarget,text,En as toMultiValueOperator,Dn as toUtcDayString,On as today,ec as todoItemSchema,tc as todoPlanSchema,nc as toolImpactSchema,user,rc as utf8ByteLength,sl as validateAttribute,vc as validateAttributeName,kn as validateContentViewCatalogue,cl as validateDraft,ll as validateDraftOrThrow,validateLabelExpression,ul as validateObject,validateObjectExpressions,validateObjectImage,xc as validateObjectName,dl as validateObjectOrThrow,An as validateQualifiedRule,jn as validateStoredViews,Sc as validateViewName,widthStepConstraint,Hc as wireHiddenTypeConfigMask,Uc as wireOmittedConfigKeysFor,withPreferenceEntry,withoutTrailingSlashes,Wc as withoutUnknownOptionKeys,workspaceViewAuthoring};
2
+ import{ACTIONABLE_DECISION_KINDS as e,AGGREGATE_BUCKETS as t,AGGREGATE_MEASURES as n,DECISION_INBOX_STATES as r,DECISION_KINDS as i,DECISION_LINE_MAX_LENGTH as a,DECISION_LINK_TARGET_TYPES as o,DECISION_LIST_STATES as s,DECISION_READ_STATES as c,DECISION_SETTINGS_AREAS as l,DECISION_TITLE_MAX_LENGTH as u,DECISION_TYPES_V1 as d,DECISION_TYPE_ACCESS_GRANTED as f,DECISION_TYPE_AGENT_APPROVAL as p,DECISION_TYPE_AGENT_MESSAGE as m,DECISION_TYPE_AGENT_QUESTION as ee,DECISION_TYPE_AGENT_REVIEW as te,DECISION_TYPE_AGENT_ROUTINE_RUN_FAILED as ne,DECISION_TYPE_AGENT_SETUP as re,DECISION_TYPE_CONNECTOR_CONNECTION_ERROR as ie,DECISION_TYPE_CONNECTOR_CONNECTION_REAUTH_REQUIRED as ae,DECISION_TYPE_ENVIRONMENT_BUILD_FAILED as oe,DECISION_TYPE_KINDS as h,DECISION_TYPE_PERSON as se,DECISION_TYPE_RECORD_ASSIGNED as ce,DECISION_TYPE_RECORD_MENTIONED as le,DECISION_WORK_STATES as ue,MAX_AGGREGATE_GROUPS as de,decisionThreadKey as fe,formatDecisionLink as pe,isActionableDecisionKind as me,parseDecisionLink as he}from"./record-aggregates-DEBOOgA0.mjs";import{AGENDA_BLOCK as g,ARTIFACT_PREVIEW_EXTENSION as ge,ATTRIBUTE_FILTER_OPERATORS as _e,ATTRIBUTE_TYPES as ve,BLOCK_CONTEXTS as ye,BLOCK_PERIODS as be,BLOCK_WIDTHS as _,CARD_BLOCK as v,CHART_BLOCK as y,CHART_KINDS as xe,CONTENT_PLACEMENT_CONTEXTS as Se,DECISIONS_BLOCK as Ce,DEFAULT_LAYOUT_TRAITS as we,GROUPABLE_ATTRIBUTE_TYPES as Te,HEADING_BLOCK as Ee,INVENTORY_LIMIT as De,LOCATION_FILTER_PROPERTIES as Oe,MAILBOX_BLOCK as ke,MEASURABLE_ATTRIBUTE_TYPES as Ae,MEETINGS_UPCOMING_BLOCK as je,METRIC_BLOCK as b,NATIVE_BLOCKS as Me,NO_VALUE_OPERATORS as Ne,OPERATORS_BY_TYPE as Pe,PAGE_GRID_COLUMNS as Fe,QUALIFIED_SEPARATOR as Ie,QUERY_OBJECT as Le,RECORD_LINKS_BLOCK as Re,RECORD_LINKS_CONTENT as x,RECORD_OBJECT as ze,RELATION_TARGET_ANY as Be,REMOVED_OPERATOR_REPLACEMENTS as Ve,RecordQuery as He,SYNONYM_ALIASES as Ue,SYSTEM_ATTRIBUTES as We,SYSTEM_ATTRIBUTE_I18N_KEYS as Ge,SYSTEM_FILTER_ATTRIBUTE_TYPES as Ke,TEXT_BLOCK as S,attributeFilterTarget as qe,attributeInventory as Je,blockObjectInputs as Ye,buildQualifiedAttribute as Xe,canonicalizeFilterValue as Ze,capped as Qe,collectContentViewCatalogue as $e,collectQualifiedRuleIssues as et,collectionContentSourceSchema as tt,collectionSourceAddress as nt,collectionSourceAddressOf as rt,columnsSchema as it,contentExtensionRegistry as C,contentReadObjects as at,contentViewDefinitionSchema as w,contentViewDefinitionSchemaFor as ot,currentActor as st,defineBlock as ct,describeViewIssue as lt,displayAttributesSchema as ut,draftContentViewDefinitionSchema as dt,draftContentViewDefinitionSchemaFor as ft,edgePropertyFilterTarget as pt,extractCurrencyFilterValue as mt,extractFilterValue as ht,filterOperatorsOfType as gt,filterStateSchema as _t,filterTargetsOf as vt,findGridViolation as yt,findGroupViolation as bt,findLayoutRuleViolation as xt,findRelationAttribute as St,findRowLimitViolation as Ct,getAttributeCapabilities as wt,getAttributeFilterOperators as Tt,getOperatorPolarity as Et,getRollupFilterOperators as Dt,getSystemAttributeI18nKey as Ot,getSystemAttributeList as kt,gridPositionSchema as At,groupSizeMessage as jt,groupedMembers as Mt,inferInverseCardinality as Nt,input as Pt,invalidViewMessage as Ft,isAttributeFilterable as It,isAttributeGroupable as Lt,isAttributeKanbanGroupable as Rt,isAttributeSearchable as zt,isAttributeSortable as Bt,isBilateralRelation as Vt,isCalendarDay as Ht,isCollectionContent as Ut,isDynamicValue as Wt,isLocationFilterProperty as Gt,isLocationPartOperator as Kt,isManagedSystemAttribute as qt,isNoValueOperator as Jt,isRelativeDateValue as Yt,isSetMembershipOperator as Xt,isUniversalRelation as Zt,layoutTraitsOf as Qt,locationPartFilterTarget as $t,memberlessGroups as en,metricComparePeriod as tn,normalizeFilterRule as nn,normalizeForEdgeRpc as rn,normalizeOperator as an,now as on,overlaps as sn,pageTraitsOf as cn,parseBlockParameters as T,parseQualifiedAttribute as ln,publishedViewContentDefinitionSchema as E,query as un,recordQueryDefinitionSchema as dn,relationAcceptsObject as fn,relationTargetsOf as pn,requireContentPlacement as mn,requireRecordContentContext as hn,requireSingleRelationTarget as gn,resolveCollectionActions as _n,resolveContentNavigation as vn,resolveEffectiveFilterType as yn,resolveIsWithinBounds as bn,resolveUtcDayBounds as xn,singleRelationTarget as Sn,sortsSchema as Cn,sourcedAttributeOf as wn,systemColumnFilterTarget as Tn,toMultiValueOperator as En,toUtcDayString as Dn,today as On,validateContentViewCatalogue as kn,validateQualifiedRule as An,validateStoredViews as jn}from"./all-Bzzltedd.mjs";import{AccessDeniedError as Mn,AggregateValidationError as Nn,AmbiguousSchemaChangeError as Pn,AttributeInUseError as Fn,AttributeNotFoundError as In,ConcurrentModificationError as Ln,DuplicateError as D,ExportTooLargeError as Rn,ForbiddenError as zn,InvalidPermissionGrantError as Bn,LogoProviderUnavailableError as Vn,LogoSearchRateLimitedError as Hn,MemoryNotFoundError as Un,NotFoundError as Wn,NotImplementedError as Gn,ObjectNotFoundError as Kn,ObjectReferencedError as qn,OrphanSystemAttributeError as Jn,PageReferencedError as Yn,ProtectedResourceError as Xn,ProtectedRoleError as Zn,QueryTimeoutError as Qn,RealtimeDeliveryError as $n,RealtimeRateLimitedError as er,RealtimeSubscriptionError as tr,RecordNotFoundError as nr,RecordReferencedError as rr,RepositoryError as ir,ReservedObjectNameError as O,RoleNotFoundError as ar,SchemaError as k,SchemaErrorCode as A,SearchBackendError as or,SearchPathNotIndexedError as sr,StorageError as cr,SyncCascadeError as lr,SyncConflictError as ur,SyncError as dr,SystemEntityImmutableError as fr,ToolGroupGrantError as pr,ValidationError as j,WorkspaceInvariantReason as mr,isAttributeInUseError as hr,isNotFoundError as gr,isObjectReferencedError as _r,isProtectedResourceError as vr,isRecordReferencedError as yr,isSchemaError as br,isValidationError as xr}from"./exceptions.mjs";import{ACCESS_LEVELS as Sr,ACCESS_ROLES as Cr,AGENT_ASIDE_ANSWER_MAX_LENGTH as wr,AGENT_ASIDE_HISTORY_LIMIT as Tr,AGENT_ASIDE_QUESTION_MAX_LENGTH as Er,AGENT_AVATAR_EXPRESSIONS as Dr,AGENT_AVATAR_TYPES as Or,AGENT_MESSAGE_KIND as kr,AGENT_NOTIFICATION_KIND as Ar,AGENT_SESSION_ACCESS_ROLES as jr,AGENT_SESSION_LIST_ORDERS as Mr,AGENT_SESSION_ORIGINS as Nr,AGENT_SESSION_PROVENANCES as Pr,AGENT_STARTERS_MAX as Fr,AGENT_STARTER_MAX_LENGTH as Ir,AGENT_SYSTEM_PROMPT_MAX_LENGTH as Lr,AGENT_TASK_KINDS as Rr,ALL_CATALOG_TOOL_NAMES as zr,ALWAYS_KINDS as Br,APPROVAL_FAMILY_TOOL_NAMES as Vr,ARCHITECT_PUBLICATION_KIND as Hr,ASK_QUESTIONS_ANSWER_MAX_LENGTH as Ur,ASK_QUESTIONS_ANSWER_MAX_VALUES as Wr,ASK_QUESTIONS_MAX_BATCH as Gr,ASK_QUESTIONS_TOOL_NAME as Kr,AUDIT_ACTIONS as qr,AUDIT_AGENT_SESSION_METADATA_KEY as Jr,AUDIT_RESOURCE_TYPES as Yr,AgentBuilder as M,BROWSER_LAUNCH_TOOL_NAME as Xr,BROWSER_TOOL_NAMES as Zr,BUNDLE_LOCALES as Qr,CONNECTION_GRANT_PROVIDERS as $r,CONTINUATION_KEY_PATTERN as ei,CONVERSATION_SURFACES as ti,CORE_RECORD_TOOL_NAMES as ni,CORE_TOOL_NAMES as ri,COUNT_MODES as ii,DEFAULT_AGENT_EXECUTION_CONFIG as ai,DEFAULT_AGENT_TOOL_GROUPS as oi,DEFAULT_APPROVAL_POLICY as si,DEFAULT_BLUEPRINT_TOOL_GROUPS as ci,DEFAULT_DAILY_ACTIVITY_DAYS as li,DEFAULT_MEETING_BOT_DISPLAY_NAME as ui,DEFAULT_TENANT_SETTINGS as di,DISCARD_ARCHITECT_DRAFT_TOOL_NAME as fi,DOCUMENT_SORT_MODES as pi,DRAFT_WRITE_TOOL_NAMES as mi,EMAIL_CATEGORY_DEFAULT_COLOR as hi,EMAIL_CATEGORY_DEFAULT_ICON as gi,EMAIL_CATEGORY_DESCRIPTION_MAX as _i,EMAIL_CATEGORY_DESCRIPTION_MIN as vi,EMAIL_CATEGORY_LIMIT as yi,EMAIL_CATEGORY_NAME_MAX as bi,ENVIRONMENT_BUILD_LOG_STEP_PREFIX as xi,ENVIRONMENT_HARNESSES as Si,ENVIRONMENT_HARNESS_SANDBOX_WORKDIR as Ci,ENVIRONMENT_HARNESS_WORKDIR as wi,ENVIRONMENT_IMAGES as Ti,ENVIRONMENT_MEMORY_GB_PER_VCPU as Ei,ENVIRONMENT_NAME_MAX_CHARS as Di,ENVIRONMENT_NETWORK_ALLOW_MAX as Oi,ENVIRONMENT_SCRIPT_MAX_BYTES as ki,ENVIRONMENT_SIZES as Ai,ENVIRONMENT_SIZE_VCPUS as ji,ENVIRONMENT_STANDARDS_WORKDIR as Mi,ENV_VAR_KEY_PATTERN as Ni,ESTIMATED_COUNT_CAP as Pi,FILE_URLS_MAX_IDS as Fi,GET_ARCHITECT_DRAFT_TOOL_NAME as Ii,GITHUB_TRIGGER_CATALOG as Li,GRANT_ENABLES as Ri,HITL_TOOL_NAMES as zi,INFERENCE_REASONING_OPTIONS as Bi,INFERENCE_ROUTING_MODES as Vi,INFERENCE_SPEEDS as Hi,LAST_RUN_ERROR_MAX_LENGTH as Ui,MAILBOX_LIST_MODES as Wi,MAIL_DRAFT_BODY_MAX_CHARS as Gi,MAIL_SIGNATURE_MAX_CHARS as Ki,MAIL_SUBJECT_MAX_CHARS as qi,MAX_DAILY_ACTIVITY_DAYS as Ji,MAX_TODOS as Yi,MAX_TODO_DESCRIPTION_CHARS as Xi,MAX_TODO_ID_CHARS as Zi,MCP_SERVER_NAME_MAX_LENGTH as Qi,MEETING_BOT_IMAGE as $i,MEETING_BOT_IMAGE_BASE64_MAX_LENGTH as ea,MEETING_RESPONSES as ta,MEMORY_SPEND_LIMIT_PATTERN as na,McpOAuthCompletionMode as ra,NATIVE_TOOL_GROUPS as ia,NATIVE_TOOL_GROUP_CATALOG as aa,NO_RECORDING as oa,OPEN_TOOL_PART_STATES as sa,OPERATION_MAX_STEPS as ca,PROVIDER_DRAFT_LABEL as la,PROVIDER_NAMES as ua,PUBLIC_MAIL_DOMAINS as da,QUESTION_FAMILY_TOOL_NAMES as fa,RECENT_ACTIVITY_LEDGER_LIMIT as pa,RECIPIENT_IDENTITIES_MAX as ma,RECORDING_OVERRIDES as ha,RECORDING_POLICIES as ga,RECORD_ACCESS_ROLES as _a,RECORD_ACCESS_SOURCES as va,RECORD_DRIVE_CURSOR_MAX_LENGTH as ya,RECORD_DRIVE_PAGE_DEFAULT_LIMIT as ba,RECORD_DRIVE_PAGE_MAX_LIMIT as xa,RECORD_GRAPH_DEFAULT_LIMIT_PER_NODE as Sa,RECORD_GRAPH_MAX_LIMIT_PER_NODE as Ca,RECORD_GRAPH_MAX_NODES as wa,RECORD_IMAGE_MAX_BYTES as Ta,REPLY_MODES as Ea,REQUEST_DESIGN_REVIEW_TOOL_NAME as Da,REQUEST_SETUP_TOOL_NAME as Oa,RESOURCE_GRANT_KINDS as ka,RESOURCE_KIND_CATALOG as Aa,ROUTING_PRICE_CEILINGS as ja,SEND_VERB_NAME as Ma,SESSION_INFERENCE_PATCH_KEYS as Na,SLACK_TRIGGER_CATALOG as Pa,SPEAKS_THROUGH_SEND_METADATA_KEY as Fa,SURFACE_TOOL_NAMES as Ia,SYSTEM_EMAIL_CATEGORIES as La,SYSTEM_EMAIL_CATEGORY_NAMES as Ra,SYSTEM_PART_CODES as za,TASK_DEMAND_LEVELS as Ba,TODO_PHASES as Va,TODO_PLAN_STATUSES as Ha,TODO_STATUSES as Ua,TOOL_APPROVAL_STATES as Wa,TRIAGE_ACTIONS as Ga,TRIGGER_EVENT_TYPES as Ka,TURN_OUTCOMES as qa,UNSHAREABLE_OBJECT_NAMES as Ja,USERS_RESOLVE_MAX_IDS as Ya,USER_STATUSES as Xa,USER_WORK_POSTURES as Za,VERB_NAMES as Qa,agent as $a,agentAvatarFromMetadata as eo,agentAvatarSchema as to,agentDataChunk as no,agentDisplayName as ro,agentInferencePreferencesSchema as io,agentMessageAttachmentSchema as ao,agentMessagePartSchema as oo,agentScheduleSchema as so,agentSessionInferenceOverridesInputSchema as co,agentSessionInferenceOverridesSchema as lo,agentSessionMessageSchema as uo,agentStartersSchema as fo,agentTriggerBaseSchema as po,agentTriggerPatchSchema as mo,agentTriggerSchema as ho,agentUIValidationError as go,artifactQuoteSchema as _o,askQuestionsOutputSchema as vo,assertCustomAgentUIMessageChunk as yo,assertSessionState as bo,canonicalToolGroups as xo,classificationRestoreSchema as So,classifyEmailSchema as Co,cliDefaultModelOf as wo,compareAgentSessionMessages as To,compiledHarnessModels as Eo,connectionGrantKindsOf as Do,connectorTriggerMatchSchema as Oo,customDataChunkSchemas as ko,decodeAgentSessionListCursor as Ao,deriveViewerAccess as jo,durableDateSchema as Mo,emailCategoryCreateSchema as No,emailCategoryDeleteSchema as Po,emailCategoryScopeQuerySchema as Fo,emailCategoryUpdateSchema as Io,emailRuleScopeSchema as Lo,encodeAgentSessionListCursor as Ro,environmentHarness as zo,environmentWorkdir as Bo,findEnvironmentHarness as Vo,githubConditionSchema as Ho,githubTriggerMatchSchema as Uo,grantKindOf as Wo,harnessModelChoices as Go,humanRequestId as Ko,humanRequestKind as qo,imageModelIdSchema as Jo,inferenceReasoningSchema as Yo,inferenceRoutingSchema as Xo,inferenceSpeedSchema as Zo,isAgentMessageMetadata as Qo,isAgentNotificationMetadata as $o,isAgentUIDataName as es,isAgentWrittenAuditEntry as ts,isArchitectPublicationMetadata as ns,isAwaitingHuman as rs,isBlocking as is,isEnvironmentHarnessId as as,isMailProvider as os,isMailboxListMode as ss,isNativeToolGroup as cs,isOpenToolPartState as ls,isParkedOnHuman as us,isProviderDraft as ds,isPublicMailDomain as fs,isQuestionPart as ps,isReplyMode as ms,isResourceGrant as hs,isRoutineActorMetadata as gs,isSessionInferencePatch as _s,isSystemEmailCategory as vs,isSystemEmailCategoryName as ys,isSystemPartCode as bs,isToolApprovalState as xs,lockingSendCall as Ss,meetingBotDispatchRequestSchema as Cs,meetingBotDispatchResponseSchema as ws,meetingBotNotificationSchema as Ts,meetingTranscriptSegmentSchema as Es,mentionReferenceSchema as Ds,mergeSessionInferencePatch as Os,modelDefinitionSchema as ks,modelReferenceSchema as As,needsManageWhenUnattended as js,normalizedMeetingTranscriptSchema as Ms,openRequests as Ns,orderAgentSessionMessages as Ps,parseAgentDefinitionAccessRole as Fs,parseAgentSessionAccessRole as Is,parseCountMode as Ls,parseMergedAgentTrigger as Rs,parseOptionalCountMode as zs,parsePageAccessRole as Bs,parseRecordAccessRole as Vs,parseToolGroupGrant as Hs,providerNameSchema as Us,readAskQuestionsResult as Ws,recentActivityEntryKey as Gs,recordGraphNodeKey as Ks,recordGraphRequestSchema as qs,recordMeetingsCount as Js,recordOperationSchema as Ys,refineTrigger as Xs,resourceGrant as Zs,routedMessageInferenceSchema as Qs,sessionInferencePatchSchema as $s,slackConditionSchema as ec,slackTriggerMatchSchema as tc,todoItemSchema as nc,todoPlanSchema as rc,toolImpactSchema as ic,utf8ByteLength as ac}from"./record-operation-CylhzAbn.mjs";import"./zod-locale.mjs";import{ATTRIBUTE_NAME_SCHEMA as oc,LIST_VIEW_TAB_VISIBILITIES as sc,NATIVE_OBJECT_NAMES as cc,OBJECT_NAME_SCHEMA as lc,RECORD_LIST_SCOPES as uc,RESERVED_ATTRIBUTE_NAMES as dc,RESERVED_OBJECT_NAMES as fc,RESOURCE_VISIBILITIES as pc,SCHEMA_LIMITS as N,SYSTEM_FIELD_NAMES as mc,assertUniqueBy as hc,colorIdSchema as gc,iconNameSchema as P,isNativeObjectName as _c,isPlainRecord as vc,parseRecordListScope as yc,parseResourceVisibility as bc,validateAttributeName as xc,validateIconName as Sc,validateLabel as Cc,validateObjectName as wc,validateOptions as F,validateViewName as Tc}from"./primitives-D9A6pmXV.mjs";import{COMPUTED_RETURN_TYPES as Ec,SIMPLE_PROPERTY_TYPES as Dc,WIRE_OFFERED_BASE_CONFIG as Oc,WIRE_OMITTED_CONFIG_KEYS as kc,attributeConfigSchemas as Ac,datePrecisionIssues as jc,getAttributeConfigSchema as Mc,getAttributeConfigWriteSchema as Nc,parseAttributeConfig as Pc,parseAttributeConfigForCreate as Fc,parseAttributeConfigForUpdate as Ic,propertyAttributeSchema as Lc,propertyAttributeWireSchema as Rc,propertySchemaSchema as zc,propertySchemaWireSchema as Bc,refuseForeignKeys as Vc,selectOptionWriteSchema as Hc,statusGroupSchema as Uc,statusOptionWriteSchema as Wc,wireHiddenTypeConfigMask as Gc,wireOmittedConfigKeysFor as Kc,withoutUnknownOptionKeys as qc}from"./config-BwshhFai.mjs";import{NonJsonValueError as Jc,asTenantId as Yc,asUserId as Xc,canonicalStringify as I,deepEqual as Zc,generateId as Qc,indexBy as $c,sameStableValue as el,serializeCanonicalJson as tl,serializeStableJson as nl}from"./utils-DaejNWxh.mjs";import{createAttributeValidator as rl,createFormAttributeValidator as il,createObjectValidator as al,isEmptyValue as ol,isNullishOrEmptyString as sl,isValuePresent as cl,rejectUnknownAttributesOrThrow as ll,validateAttribute as ul,validateDraft as dl,validateDraftOrThrow as fl,validateObject as pl,validateObjectOrThrow as ml}from"./object-BF5y6bgs.mjs";import{TEXT_FORMAT_PATTERNS as hl,resolveTextPattern as gl}from"./text-BaxaZ5Vv.mjs";import{DEFAULT_VALIDATION_MESSAGES as _l,formatZodErrors as vl}from"./core-rKI7Q9_U.mjs";import{formatPhoneForDisplay as yl,getIso2 as bl,normalizeCountrylessPhoneNumber as xl,normalizePhoneNumber as Sl}from"./phone-BGJea5sr.mjs";import*as L from"zod";import{colorIdFromString as Cl,getCountryByIso2 as wl,isValidCurrencyCode as Tl,isValidIso3 as El}from"@standards/constants";import{parsePhoneNumberFromString as Dl}from"libphonenumber-js";const Ol=`__stndrdsNativeUiPartIds`,kl=1;function invalidNativePartIds(){throw new j(`Native agent UI part IDs metadata is invalid`,[])}function isPlainRecord$1(e){if(typeof e!=`object`||!e||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function nativeAgentUIPartIdMetadataKey(e,t){if(e.type===`text`||e.type===`reasoning`)return`${e.type}:${t}`;if(e.type===`tool`)return`tool:${e.toolCallId}`}function parseNativeAgentUIPartIdsMetadata(e){let t=e.metadata?.[Ol];isPlainRecord$1(t)||invalidNativePartIds(),(Object.keys(t).length!==2||t.schemaVersion!==1||!isPlainRecord$1(t.partIds))&&invalidNativePartIds();let n=new Map;for(let[t,r]of e.parts.entries()){let e=nativeAgentUIPartIdMetadataKey(r,t);if(!e||n.has(e)){e&&invalidNativePartIds();continue}n.set(e,r)}let r=Object.entries(t.partIds);r.length!==n.size&&invalidNativePartIds();let i=new Map,a={};for(let[e,t]of r){let r=n.get(e);r&&typeof t==`string`&&t.length>0||invalidNativePartIds();let o=i.get(t);o&&(r.type===`tool`||o!==r.type)&&invalidNativePartIds(),r.type===`tool`&&t!==r.toolCallId&&invalidNativePartIds(),i.set(t,r.type),a[e]=t}return a}const Al=`/v1/device-worker/channel`,jl=262144,Ml=1e4,Nl=2e3,Pl=2e3,Fl=2e4,Il=4008,Ll={initialMs:1e3,maxMs:3e4};function deviceChannelUrl(e){let t=new URL(e);return`${t.protocol===`https:`?`wss:`:`ws:`}//${t.host}${Al}`}function computeRetryDelay(e,t,n){return Math.min(n.initialMs*2**e,n.maxMs)+Math.floor(t()*250)}function computeReconnectDelay(e,t=Math.random){return computeRetryDelay(e,t,Ll)}const Rl=[`worker_disconnected`,`cancelled`,`timed_out`,`execution_failed`];var DeviceChannelProtocolError=class extends k{constructor(e){super(e,A.DEVICE_CHANNEL_PROTOCOL),this._tag=`DeviceChannelProtocolError`,this.name=`DeviceChannelProtocolError`}};const R={id:L.uuid(),leaseToken:L.string().min(1)},zl=L.discriminatedUnion(`type`,[L.strictObject({type:L.literal(`authenticate`),credential:L.string().regex(/^Device \S+$/),protocol:L.number().int().positive().optional()}),L.strictObject({type:L.literal(`running`),...R}),L.strictObject({type:L.literal(`heartbeat`),...R}),L.strictObject({type:L.literal(`output`),...R,stdout:L.string().optional(),stderr:L.string().optional()}),L.strictObject({type:L.literal(`complete`),...R,result:L.strictObject({stdout:L.string().optional(),stderr:L.string().optional(),exitCode:L.number().int(),success:L.boolean(),errorCode:L.enum(Rl).optional()})}),L.strictObject({type:L.literal(`pong`)})]),Bl=L.discriminatedUnion(`type`,[L.strictObject({type:L.literal(`ready`),device:L.strictObject({id:L.string(),name:L.string(),capability:L.enum([`shell`,`browser`])}),protocol:L.number().int().positive().optional()}),L.strictObject({type:L.literal(`command`),...R,kind:L.enum([`shell`,`browser`]),intent:L.string(),timeoutMs:L.number().int(),command:L.string().optional(),cwd:L.string().nullable().optional()}),L.strictObject({type:L.literal(`cancel`),id:L.uuid(),reason:L.enum([`cancelled`,`timed_out`,`revoked`])}),L.strictObject({type:L.literal(`reauthenticate`)}),L.strictObject({type:L.literal(`revoked`)}),L.strictObject({type:L.literal(`ping`)})]);function parseDeviceChannelFrame(e,t){let n;try{n=JSON.parse(t)}catch{throw new DeviceChannelProtocolError(`Frame is not JSON`)}let r=e.safeParse(n);if(!r.success)throw new DeviceChannelProtocolError(`Frame does not match the channel protocol`);return r.data}function parseWorkerFrame(e){return parseDeviceChannelFrame(zl,e)}function parseServerFrame(e){return parseDeviceChannelFrame(Bl,e)}const Vl=5;function isFormDefinition(e){return typeof e==`object`&&!!e&&`slots`in e&&`steps`in e&&`name`in e&&typeof e.name==`string`&&Array.isArray(e.slots)&&Array.isArray(e.steps)}const z=[`relation`,`multiRelation`,`formula`,`rollup`,`document`,`richtext`,`user`];function isFormSlotFieldRef(e){return e.type===`slot`}function isFormFreeFieldRef(e){return e.type===`free`}function resolveFieldRequired(e){return e.readOnly===!0?!1:e.fieldRequired===void 0?e.slotMode===`create`&&e.attributeRequired===!0:e.fieldRequired}function getSlotFieldTargets(e){return e.additionalSlotIds?.length?[e.slotId,...e.additionalSlotIds]:[e.slotId]}function formFieldKey(e){return isFormSlotFieldRef(e)?`${e.slotId}.${e.attribute}`:`free.${e.attribute.name}`}function formFieldFlatKey(e){return isFormSlotFieldRef(e)?e.attribute:e.attribute.name}function readFormFieldValue(e,t){return e[formFieldKey(t)]??e[formFieldFlatKey(t)]}function isFormFieldsRow(e){return e.type===`fields`}function isFormHeadingRow(e){return e.type===`heading`}function isFormSeparatorRow(e){return e.type===`separator`}function isFormTextRow(e){return e.type===`text`}function resolvePropertyDefinitions(e){let t=e.properties;if(!t)return[];if(Array.isArray(t))return t;let n=t;return Array.isArray(n.definitions)?n.definitions:[]}function hasOptions(e){return e.type===`select`||e.type===`status`||e.type===`multiselect`}function schemaGroupKey(e){return`${e.kind}:${e.name}`}function refuse$2(e){throw new j(e,[{path:[`label`],message:e}])}function parseSchemaGroupPresentation(e){let t=e??{},n={};if(t.label!==void 0){let e=t.label;if(e===null)n.label=null;else if(typeof e!=`string`)refuse$2(`Label must be a string`);else{let t=e.trim();t.length===0&&refuse$2(`Label must not be empty`),t.length>N.labelLength&&refuse$2(`Label is too long (max ${N.labelLength} characters)`),n.label=t}}return n}const B=/^(?:core|bundle:.+)$/u;function parseSchemaOwner(e){if(e===null)return null;if(!B.test(e))throw new j(`Invalid schema owner "${e}"`,[]);return e}const Hl=16e3,Ul=3200,Wl=6400,Gl=16e3,Kl=65536,ql=15e3,Jl=1e4,Yl=5e3,Xl=`google/gemini-3.5-transcribe-live`,Zl={maxDurationMs:3e5,dailyDurationMs:36e5,monthlyDurationMs:72e6,tenantMonthlyBudgetMicrousd:5e7,globalMonthlyBudgetMicrousd:5e7,estimatedMicrousdPerSecond:150,reservationMultiplier:2},Ql=[`web`,`presentation`,`document`,`spreadsheet`,`image`,`code`,`other`],$l=[`ephemeral`,`conversation`,`persistent`],eu=[`source`,`preview`,`entrypoint`,`asset`];var NoopGeocodingAdapter=class{async autocomplete(){return await Promise.resolve([])}async geocode(){return await Promise.resolve(null)}};const tu=6048e5,nu=36e5,ru=2592e6,iu=6e4,au=[`square`,`landscape`,`portrait`];function imageModelFormatDefect(e){if(e.formats.length===0)return`declares no output format`;for(let t of e.formats)if(e.requests[t]===void 0)return`declares the format "${t}" without a request`;for(let t of Object.keys(e.requests))if(!e.formats.includes(t))return`carries a request for the undeclared format "${t}"`}function declaredImageRequests(e){let t={};for(let n of e.formats){let r=e.requests[n];r!==void 0&&(t[n]=r)}return t}const ou=[`storage.bytes`,`members.seats`,`data.live_records`];function computeByteMagnitude(e){if(e<=0)return{value:0,unitIndex:0};let t=1e3,n=Math.min(4,Math.floor(Math.log(e)/Math.log(t)));return{value:Number.parseFloat((e/t**n).toFixed(1)),unitIndex:n}}const su=[`B`,`KB`,`MB`,`GB`,`TB`];function formatByteSize(e){let{value:t,unitIndex:n}=computeByteMagnitude(e);return`${t} ${su[n]}`}const cu=Object.freeze([`text`,`number`,`checkbox`,`date`,`phone`,`currency`,`status`,`select`,`multiselect`,`location`]);function buildPropertySchema(e){let t=[];for(let n of e){let e=n.build();if(!cu.includes(e.type))throw Error(`Property type "${e.type}" is not supported in .qualifyWith()`);t.push(e)}return{definitions:t}}const lu=[`UPPER`,`LOWER`,`capitalize`,`trim`],uu=[`prefix`,`suffix`,`wrap`,`default`],V=[...lu,...uu],du=/^\s*where\s*(?::(.*))?$/s,fu=`[A-Za-z_][A-Za-z0-9_]*`,pu=/^[^\s,()|{}="']+$/,mu=RegExp(`^(${fu})\\s*=\\s*(.*)$`),hu=RegExp(`^(${fu})\\s+in\\s*\\(([^()]*)\\)$`);function isWherePipe(e){return du.test(e)}function parseWherePipe(e){let t=e.match(du)?.[1]?.trim();if(!t)return null;let n=t.match(hu);if(n){let e=n[2].split(`,`).map(e=>e.trim());return e.every(e=>pu.test(e))?{property:n[1],values:e}:null}let r=t.match(mu);return r&&pu.test(r[2])?{property:r[1],values:[r[2]]}:null}const H=L.string().min(1,`labelExpression cannot be empty`).refine(e=>isLabelExpression(e),{message:`labelExpression must contain at least one {{ attribute }} interpolation`}).refine(e=>!/\{\{\s*\}\}/.test(e),{message:`labelExpression contains empty {{ }} interpolation`}).refine(e=>{let t=/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g,n;for(;(n=t.exec(e))!==null;){let e=n[1];if(!V.includes(e))return!1}return!0},{message:`Invalid pipe name. Valid pipes: ${V.join(`, `)}`});function validateLabelExpression(e){let t=H.safeParse(e);return t.success?{success:!0,attributes:extractAttributeNames(e)}:{success:!1,error:t.error.issues[0]?.message??`Invalid labelExpression`}}function applyPipe(e,t){let{name:n,args:r}=parsePipeExpression(t);switch(n){case`UPPER`:return e.toUpperCase();case`LOWER`:return e.toLowerCase();case`capitalize`:return e.replace(/(^|\s)\S/g,e=>e.toUpperCase());case`trim`:return e.trim();case`prefix`:return e?`${r[0]??``}${e}`:``;case`suffix`:return e?`${e}${r[0]??``}`:``;case`wrap`:return e?`${r[0]??``}${e}${r[1]??``}`:``;case`default`:return e||r[0]||``;default:return e}}function applyPipes(e,t){let n=e;for(let e of t)n=applyPipe(n,e);return n}function getValue(e,t){return t.split(`.`).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e)}const gu=`(Untitled)`;function parsePipeExpression(e){let t=e.match(/^(\w+)(?::(.*))?$/);if(!t)return{name:e,args:[]};let n=t[1],r=t[2];if(!r)return{name:n,args:[]};let i=[],a=/["']([^"']*?)["']/g,o;for(;(o=a.exec(r))!==null;)i.push(o[1]);return{name:n,args:i}}function*templateBlocks(e){let t=0;for(;t<e.length;){let n=e.indexOf(`{{`,t);if(n<0)return;let r=e.indexOf(`}`,n+2);if(r<0)return;if(e[r+1]!==`}`){t=r+1;continue}t=r+2;let i=e.slice(n+2,r);i.length>0&&(yield{start:n,end:t,expr:i})}}function resolveLabelBlock(e,t){let n=e.split(`||`).map(e=>e.trim()),r=n[n.length-1].split(`|`).map(e=>e.trim());n[n.length-1]=r[0];let i=r.slice(1).filter(Boolean),a=n.filter(Boolean),o=``;for(let e of a){let n=toText(getValue(t,e));if(n!==``){o=n;break}}return applyPipes(o,i)}function renderLabelExpression(e,t,n=gu){let r=[],i=0;for(let n of templateBlocks(e))r.push(e.slice(i,n.start),resolveLabelBlock(n.expr,t)),i=n.end;return r.push(e.slice(i)),r.join(``).trim()||n}function toText(e){if(e==null||typeof e==`function`)return``;if(typeof e!=`object`)return String(e);if(Array.isArray(e))return e.map(toText).filter(Boolean).join(`,`);let t=e.toString;return typeof t==`function`&&t!==Object.prototype.toString?String(e):``}function isLabelExpression(e){let t=0;for(;t<e.length;){let n=e.indexOf(`{{`,t);if(n<0)return!1;let r=e.indexOf(`}}`,n+2);if(r<0)return!1;if(e.slice(n+2,r).trim().length>0)return!0;t=r+2}return!1}function extractAttributePaths(e){let t=[];for(let n of templateBlocks(e)){let e=n.expr.trim();if(!e)continue;let r=e.split(`||`).map(e=>e.trim()),i=r[r.length-1];r[r.length-1]=i.split(`|`)[0].trim();for(let e of r)e&&!t.includes(e)&&t.push(e)}return t}function extractAttributeNames(e){let t=extractAttributePaths(e).map(e=>e.split(`.`)[0]).filter(e=>e.length>0);return[...new Set(t)]}const _u=/^\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}$/;function getSingleAttributeFromExpression(e){let t=e.trim().match(_u);return t?t[1]:null}function getEditableLabelAttribute(e,t){let n=getSingleAttributeFromExpression(e);if(n===null)return null;let r=t.find(e=>e.name===n);return!r||r.type!==`text`||wt(r).authoring.readOnly?null:r}const vu=[{id:`data`,capabilities:[{id:`forms`,resources:[`forms`],levels:[{id:`fill`,add:[`read`]},{id:`edit`,add:[`create`,`update`,`delete`]},{id:`manage`,add:[`manage`]}]}]},{id:`structure`,capabilities:[{id:`schema`,resources:[`architect`],levels:[{id:`use`,add:[`read`]},{id:`edit`,add:[`create`,`update`,`delete`]}]},{id:`pages`,resources:[`pages`],levels:[{id:`read`,add:[`read`]},{id:`create`,add:[`create`,`update`,`delete`]}]}]},{id:`ai`,capabilities:[{id:`agents`,resources:[`agents`],levels:[{id:`chat`,add:[`read`]},{id:`build`,add:[`create`,`update`,`delete`]},{id:`manage`,add:[`manage`]}]},{id:`environments`,resources:[`environments`],levels:[{id:`use`,add:[`read`]},{id:`create`,add:[`create`]}]},{id:`browser-profiles`,resources:[`browser-profiles`],levels:[{id:`use`,add:[`create`]}]},{id:`private-secrets`,resources:[`private-secrets`],levels:[{id:`use`,add:[`create`]}]},{id:`routine-audiences`,resources:[`routine-audiences`],levels:[{id:`use`,add:[`create`]}]},{id:`supervision`,resources:[`supervision`],levels:[{id:`use`,add:[`create`]}]}]},{id:`files`,capabilities:[{id:`files`,resources:[`files`,`documents`],levels:[{id:`read`,add:[`read`]},{id:`edit`,add:[`create`,`update`]},{id:`full`,add:[`delete`]}]}]},{id:`team`,capabilities:[{id:`people`,resources:[`people`],levels:[{id:`view`,add:[`read`]},{id:`invite`,add:[`create`]},{id:`manage`,add:[`update`,`delete`]}]}]},{id:`integrations`,capabilities:[{id:`connectors`,resources:[`connectors`],levels:[{id:`use`,add:[`read`,`create`,`update`,`delete`]}]},{id:`api-keys`,resources:[`api-keys`],levels:[{id:`view`,add:[`read`]},{id:`manage`,add:[`create`,`delete`]}]},{id:`env-vars`,resources:[`env-vars`],levels:[{id:`view`,add:[`read`]},{id:`manage`,add:[`create`,`delete`]}]}]},{id:`administration`,capabilities:[{id:`settings`,resources:[`settings`],levels:[{id:`view`,add:[`read`]},{id:`manage`,add:[`update`,`delete`,`manage`]}]},{id:`audit`,resources:[`audit`],levels:[{id:`view`,add:[`read`]}]},{id:`billing`,resources:[`billing`],levels:[{id:`view`,add:[`read`]}]}]}],U=`none`,yu=`custom`,W={actions:[`read`,`create`,`update`,`delete`],purge:`manage`,levels:[{id:`read`,add:[`read`]},{id:`edit`,add:[`create`,`update`]},{id:`full`,add:[`delete`]}]},G=vu.flatMap(e=>e.capabilities),bu=G.flatMap(e=>e.resources),xu=new Map(G.flatMap(e=>e.resources.map(t=>[t,e])));function isCatalogResource(e){return xu.has(e)}function capabilityForResource(e){let t=xu.get(e);if(!t)throw new k(`Unknown catalog resource "${e}"`,A.INVARIANT_VIOLATION);return t}function sameActions(e,t){let n=new Set(e),r=new Set(t);return n.size===r.size&&[...n].every(e=>r.has(e))}function levelActions(e,t){let n=new Set;for(let r of e.levels){for(let e of r.add)n.add(e);if(r.id===t)return[...n]}return[]}function levelFloor(e,t){let n=e.levels[e.levels.length-1];if(t.includes(`*`)&&n)return n.id;let r=new Set(t),i=U;for(let t of e.levels){if(!t.add.every(e=>r.has(e)))break;i=t.id}return i}function levelOf(e,t){if(t.length===0)return U;let n=e.levels[e.levels.length-1];if(t.includes(`*`)&&n)return n.id;let r=new Set(t),i=new Set;for(let t of e.levels){for(let e of t.add)i.add(e);if(i.size===r.size&&[...r].every(e=>i.has(e)))return t.id}return yu}const Su=[`read`,`create`,`update`,`delete`,`manage`],Cu=L.object({scope:L.enum([`object`,`system`]),target:L.string().min(1),actions:L.array(L.enum(Su))}).strict();function findGrantIssues(e,t){let n=[],r=new Map;for(let i of e){let e=Cu.safeParse(i);if(!e.success){let e=typeof i==`object`&&i&&`target`in i?String(i.target):`?`;n.push({target:e,reason:`shape`});continue}let a=e.data;if(a.scope===`system`){if(!isCatalogResource(a.target)){n.push({target:a.target,reason:`unknown-resource`});continue}if(levelOf(capabilityForResource(a.target),a.actions)===`custom`){n.push({target:a.target,reason:`off-level`});continue}r.set(a.target,a.actions);continue}if(a.target!==`*`&&!t.objectNames.has(a.target)){n.push({target:a.target,reason:`unknown-object`});continue}let o=a.target===`*`?[...W.actions,W.purge]:W.actions;a.actions.every(e=>o.includes(e))||n.push({target:a.target,reason:`object-action`})}let i=new Set;for(let[e,t]of r){let a=capabilityForResource(e);if(!i.has(a)){for(let o of a.resources)if(!sameActions(t,r.get(o)??[])){n.push({target:e,reason:`split-capability`}),i.add(a);break}}}return n}const wu=`memory`,Tu=4e3,Eu=`workspace`,K={name:`name`,description:`description`,content:`content`,profileOf:`profileOf`,profileActor:`profileActor`,subjects:`subjects`,subjectId:`subjectId`};function textValue(e){return typeof e==`string`?e:``}function memoryPageViewOf(e){let{values:t}=e;return{id:e.id,name:textValue(t[K.name]),description:textValue(t[K.description]),content:textValue(t[K.content]),visibility:e.visibility,ownedBy:e.ownedBy,updatedAt:new Date(e.updatedAt).toISOString()}}const Du=`@standards/schema`;function createStandardSchemaProps(e){return{version:1,vendor:Du,validate:t=>{let n=e.safeParse(t);return n.success?{value:n.data}:{issues:n.error.issues.map(e=>({message:e.message,path:e.path}))}}}}function isStandardSchema(e){return typeof e==`object`&&!!e&&`~standard`in e&&typeof e[`~standard`]==`object`&&e[`~standard`].version===1}function asMutableArray(e){return e}var BaseAttributeBuilder=class{get"~standard"(){return createStandardSchemaProps(rl(this.build()))}constructor(e,t,n){xc(t),Cc(n),this.attr={name:t,label:n,type:e,required:!1,system:!0}}setRequired(e){this.attr.required=e}asRequiredState(){return this}asPhantomState(){return this}runtime(){return this.attr.system=!1,this}hidden(){return this.attr.hidden=!0,this}placeholder(e){return this.attr.placeholder=e,this}description(e){return this.attr.description=e,this}icon(e){return Sc(e,`attribute "${this.attr.name}"`),this.attr.icon=e,this}order(e){return this.attr.order=e,this}defaultValue(e){return(`defaultValue`in this.attr||![`formula`,`rollup`].includes(this.attr.type))&&(this.attr.defaultValue=e),this}metadata(e){return this.attr.metadata=e,this}build(){return this.attr}},TextAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`text`,e,t)}minLength(e){return this.attr.minLength=e,this}maxLength(e){return this.attr.maxLength=e,this}pattern(e){return this.attr.pattern=e,this.attr.format=void 0,this}multiline(e=!0){return this.attr.multiline=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}email(){return this.attr.format=`email`,this.attr.pattern=void 0,this}url(){return this.attr.format=`url`,this.attr.pattern=void 0,this}slug(){return this.attr.format=`slug`,this.attr.pattern=void 0,this}};function text(e,t){return new TextAttributeBuilder(e,t)}var RichtextAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`richtext`,e,t)}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function richtext(e,t){return new RichtextAttributeBuilder(e,t)}var NumberAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`number`,e,t)}min(e){return this.attr.min=e,this}max(e){return this.attr.max=e,this}integer(){return this.attr.unit=`integer`,this.attr.decimals=0,this}decimal(e=2){return this.attr.unit=`decimal`,this.attr.decimals=e,this}percentage(){return this.attr.unit=`percentage`,this}renderAs(e){return this.attr.renderAs=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function number(e,t){return new NumberAttributeBuilder(e,t)}var CheckboxAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`checkbox`,e,t)}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function checkbox(e,t){return new CheckboxAttributeBuilder(e,t)}var DateAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`date`,e,t)}format(e){return this.attr.dateFormat=e,this}precision(e){return this.attr.precision=e,this}build(){let[e]=jc(`date`,this.attr);if(e!==void 0)throw new j(e.message,[{path:[`precision`],message:e.message}]);return super.build()}minDate(e){return this.attr.minDate=e,this}maxDate(e){return this.attr.maxDate=e,this}endDate(){return this.attr.endDate=!0,this.asPhantomState()}includeTime(){return this.attr.includeTime=!0,this}timeFormat(e){return this.attr.timeFormat=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function date(e,t){return new DateAttributeBuilder(e,t)}var PhoneAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`phone`,e,t)}defaultCountry(e){return this.attr.defaultCountryCode=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function phone(e,t){return new PhoneAttributeBuilder(e,t)}var CurrencyAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`currency`,e,t)}defaultCurrency(e){return this.attr.defaultCurrency=e,this}allowedCurrencies(e){return this.attr.allowedCurrencies=e,this}allowNegative(e=!0){return this.attr.allowNegative=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function currency(e,t){return new CurrencyAttributeBuilder(e,t)}var StatusAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`status`,e,t)}options(e){let t=asMutableArray(e);return F(this.attr.name??`unknown`,t),this.attr.options=t,this.asPhantomState()}option(e){this.attr.options||(this.attr.options=[]);let t=[...this.attr.options,e];return F(this.attr.name??`unknown`,t),this.attr.options.push(e),this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function status(e,t){return new StatusAttributeBuilder(e,t)}var SelectAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`select`,e,t)}options(e){let t=asMutableArray(e);return F(this.attr.name??`unknown`,t),this.attr.options=t,this.asPhantomState()}option(e){this.attr.options||(this.attr.options=[]);let t=[...this.attr.options,e];return F(this.attr.name??`unknown`,t),this.attr.options.push(e),this}renderAs(e){return this.attr.renderAs=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function select(e,t){return new SelectAttributeBuilder(e,t)}var MultiselectAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`multiselect`,e,t)}options(e){let t=asMutableArray(e);return F(this.attr.name??`unknown`,t),this.attr.options=t,this.asPhantomState()}option(e){this.attr.options||(this.attr.options=[]);let t=[...this.attr.options,e];return F(this.attr.name??`unknown`,t),this.attr.options.push(e),this}renderAs(e){return this.attr.renderAs=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function multiselect(e,t){return new MultiselectAttributeBuilder(e,t)}var LocationAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`location`,e,t)}granularity(e){return this.attr.granularity=e,this}defaultCountry(e){return this.attr.defaultCountry=e,this}allowedCountries(e){return this.attr.allowedCountries=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function location(e,t){return new LocationAttributeBuilder(e,t)}var UserAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`user`,e,t),this.attr.types=[`user`,`agent`]}types(e){let t=[...new Set(e)];if(t.length===0)throw Error(`[AttributeBuilder] user.types must contain at least one type.`);return this.attr.types=t,this}multiple(){return this.attr.multiple=!0,this}notifiesOnAssign(){return this.attr.notifiesOnAssign=!0,this}actors(){return this.attr.actors=!0,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function user(e,t){return new UserAttributeBuilder(e,t)}var BaseRelationAttributeBuilder=class extends BaseAttributeBuilder{to(e,t){let n={object:e,...t};return this.attr.targets?.push(n),this}toAny(){return this.attr.targets=[{object:`*`}],this}qualifyWith(...e){let t=this.attr.targets;if(!t||t.length===0)throw Error(`.qualifyWith() must be called AFTER .to(). Example: relation("companies", "Companies").to("companies").qualifyWith(...)`);return this.attr.properties=buildPropertySchema(e),this}bilateral(e){let t=this.attr.targets;if(!t||t.length===0)throw Error(`.bilateral() must be called AFTER .to(). Example: relation("company", "Company").to("companies").bilateral({ ... })`);if(t.length>1)throw Error(`Bilateral relations are not supported for polymorphic relations (multiple .to() targets).`);if(Zt(this.attr))throw Error(`Bilateral relations are not supported for universal relations (.toAny()).`);let n=t[0]?.object;if(!n)throw new j(`Bilateral relation requires one target object`,[{path:[`bilateral`,`object`],message:`Bilateral relation requires one target object`}]);if(e.object&&e.object!==n){let t=`Bilateral inverse object ${e.object} must match relation target ${n}`;throw new j(t,[{path:[`bilateral`,`object`],message:t}])}return this.attr.bilateral={...e,object:n},this}},SingleRelationAttributeBuilder=class extends BaseRelationAttributeBuilder{constructor(e,t){super(`relation`,e,t),this.attr.cardinality=`one`,this.attr.targets=[]}many(){let e=new MultiRelationAttributeBuilder(this.attr.name,this.attr.label??``,{targets:this.attr.targets,isRequired:this.attr.required});return this.attr.system===!1&&e.runtime(),this.attr.hidden&&e.hidden(),this.attr.placeholder&&e.placeholder(this.attr.placeholder),this.attr.description&&e.description(this.attr.description),this.attr.icon&&e.icon(this.attr.icon),this.attr.order!==void 0&&e.order(this.attr.order),this.attr.metadata&&e.metadata(this.attr.metadata),e}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}},MultiRelationAttributeBuilder=class extends BaseRelationAttributeBuilder{constructor(e,t,n){super(`relation`,e,t),this.attr.cardinality=`many`,this.attr.targets=n?.targets??[],this.attr.defaultValue=[],n?.isRequired&&this.setRequired(!0)}maxItems(e){return this.attr.maxItems=e,this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function relation(e,t){return new SingleRelationAttributeBuilder(e,t)}var FormulaAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`formula`,e,t),this.attr.required=!1}expression(e){return this.attr.expression=e,this}returns(e){return this.attr.returnType=e,this}decimals(e){return this.attr.decimals=e,this}currency(e){return this.attr.currencyCode=e,this}required(){throw Error(`Formula attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.`)}optional(){return this}};function formula(e,t){return new FormulaAttributeBuilder(e,t)}var RollupAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`rollup`,e,t),this.attr.required=!1}from(e){return this.attr.relationAttribute=e,this}aggregate(e){return this.attr.targetAttribute=e,this}using(e){return this.attr.function=e,this}decimals(e){return this.attr.decimals=e,this}path(e){return this.attr.relationPath=e,this}targetType(e){return this.attr.targetAttributeType=e,this}targetOptions(e){return this.attr.targetAttributeOptions=asMutableArray(e),this}targetCurrency(e){return this.attr.targetCurrencyCode=e,this}build(){let e=this.attr.function,t=this.attr.targetAttributeType;if(e===`original`&&t!==void 0&&t!==`select`&&t!==`status`&&t!==`multiselect`){let e=this.attr.relationAttribute??`relation`,n=this.attr.targetAttribute??`field`;throw new k(`Rollup "${this.attr.name}": .using("original") only supports a "select", "status", or "multiselect" target, but .targetType("${t}") was given. To surface a plain ${t} value from a related record, use a formula instead — e.g. formula("${this.attr.name}", "…").expression("${e}.${n}").`,A.VALIDATION_FAILED)}return super.build()}required(){throw Error(`Rollup attributes cannot be required: they are computed read-only values. Remove .required() from this attribute definition.`)}optional(){return this}};function rollup(e,t){return new RollupAttributeBuilder(e,t)}var DocumentAttributeBuilder=class extends BaseAttributeBuilder{constructor(e,t){super(`document`,e,t)}accepts(e){return this.attr.accepts=e,this}maxFileSize(e){return this.attr.maxFileSize=e,this}qualifyWith(...e){return this.attr.properties=buildPropertySchema(e),this}required(){return this.setRequired(!0),this.asRequiredState()}optional(){return this.setRequired(!1),this.asRequiredState()}};function document(e,t){return new DocumentAttributeBuilder(e,t)}const q=/^[a-z0-9][a-z0-9-]{0,62}$/,J=`core`;function assertBundleName(e){if(!q.test(e))throw new j(`Invalid bundle name "${e}": expected a lowercase slug matching ${q}`,[]);if(e===`core`)throw new j(`Bundle name "${J}" is reserved`,[])}async function sha256Hex(e){let t=await crypto.subtle.digest(`SHA-256`,new TextEncoder().encode(e));return Array.from(new Uint8Array(t),e=>e.toString(16).padStart(2,`0`)).join(``)}function nameSlug(e,t){return e.normalize(`NFKD`).replace(/\p{M}/gu,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).slice(0,t).replace(/^_+|_+$/g,``)}function cloneBuilderValue(e,t){try{return structuredClone(e)}catch{let e=`Builder configuration must contain cloneable data`;throw new j(e,[{path:t,message:e}])}}function requireBuilderName(e,t){if(typeof e!=`string`||e.trim().length===0)throw new j(`Name must not be blank`,[{path:t,message:`Name must not be blank`}])}function validateContentConfiguration(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw new j(`Invalid content configuration`,[{path:t,message:`Expected content configuration`}]);for(let n of[`name`,`label`,`placement`])if(Object.hasOwn(e,n)){let e=`Independent content configuration cannot define ${n}`;throw new j(e,[{path:[...t,n],message:e}])}let n=E.safeParse({...e,name:`content`,placement:e.type===`group`?`grid`:`main`});if(!n.success)throw j.fromZodErrors(n.error.issues.map(e=>({path:[...t,...e.path.map(String)],message:e.message})));n.data.type===`form`&&n.data.groups.forEach((e,n)=>requireBuilderName(e.name,[...t,`groups`,String(n),`name`]));let{name:r,label:i,placement:a,...o}=n.data;return cloneBuilderValue(o,t)}function validateLiteralContent(e,t){return validateContentConfiguration(e,t),cloneBuilderValue(e,t)}function positionOf(e){return{x:e.x,y:e.y,w:e.w,h:e.h}}function bottomOf(e){return e.y+e.h}function collides(e,t){return e.x<t.x+t.w&&t.x<e.x+e.w&&e.y<t.y+t.h&&t.y<e.y+e.h}function firstCollision(e,t){return t.find(t=>collides(e,t))}function inReadingOrder$1(e){return[...e].sort((e,t)=>e.y-t.y||e.x-t.x)}function snapWidth(e,t,n){let r=12-t,i=_.filter(e=>e>=n&&e<=r);return i.length===0?_.find(e=>e>=n)??n:i.reduce((t,n)=>{let r=Math.abs(n-e),i=Math.abs(t-e);return r<i||r===i&&n>t?n:t})}function sharesColumns(e,t){return e.x<t.x+t.w&&t.x<e.x+e.w}function risenRow(e,t){return t.reduce((t,n)=>n.y<e.y&&sharesColumns(e,n)?Math.max(t,bottomOf(n)):t,0)}function packLayout(e,t){let n=e.map(e=>{let n=t?.get(e.i);return n===void 0?e:{...e,h:n}}),r=n.filter(e=>e.static===!0),i=new Map(r.map(e=>[e.i,e]));for(let e of inReadingOrder$1(n.filter(e=>e.static!==!0))){let t=risenRow(e,r),n=firstCollision({...e,y:t},r);for(;n!==void 0;)t=bottomOf(n),n=firstCollision({...e,y:t},r);let a={...e,y:t};r.push(a),i.set(e.i,a)}return n.map(e=>i.get(e.i)??e)}function settleLayout(e,t){let n=e.filter(e=>e.static===!0),r=e.filter(e=>e.static!==!0),i=new Map;for(let e of[...inReadingOrder$1(r.filter(e=>t.has(e.i))),...inReadingOrder$1(r.filter(e=>!t.has(e.i)))]){let t=e,r=firstCollision(t,n);for(;r!==void 0;)t={...t,y:bottomOf(r)},r=firstCollision(t,n);n.push(t),i.set(e.i,t)}return packLayout(e.map(e=>i.get(e.i)??e))}function pageCompactor(){return{type:`vertical`,allowOverlap:!1,preventCollision:!1,compact:e=>packLayout(e).map(e=>({...e,moved:!1}))}}function clampHeight(e,t){let n=t.minHeight??1,r=t.maxHeight??1/0;return Math.max(1,n,Math.min(r,e))}function widthStepConstraint(e){return{name:`width-steps`,constrainSize:(t,n,r)=>{let i=e(t.i),a=snapWidth(n,t.x,i.minWidth);return i.height===`fit`?{w:a,h:t.h}:i.height===`flexible`?{w:a,h:clampHeight(r,i)}:{w:a,h:Math.max(1,r)}}}}function snapCell(e,t){let n=Math.max(0,Math.min(e.x,11)),r=snapWidth(e.w,n,t(e.i).minWidth);return{...e,x:Math.min(n,12-r),y:Math.max(0,e.y),w:r,h:Math.max(1,e.h)}}function samePosition(e,t){return e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h}function pushApart(e){let t=e.filter(e=>e.static===!0),n=new Map;for(let r of inReadingOrder$1(e.filter(e=>e.static!==!0))){let e=r,i=firstCollision(e,t);for(;i!==void 0;){let n={...e,x:i.x+i.w};e=n.x+n.w<=12&&firstCollision(n,t)===void 0?n:{...e,y:bottomOf(i)},i=firstCollision(e,t)}t.push(e),n.set(r.i,e)}return e.map(e=>n.get(e.i)??e)}function isValidStatic(e){return[e.x,e.y,e.w,e.h].every(Number.isInteger)&&e.x>=0&&e.y>=0&&e.h>=1&&_.includes(e.w)&&e.x+e.w<=12}function keptStatics(e){let t=[],n=new Set;for(let r of inReadingOrder$1(e.filter(e=>e.static===!0)))isValidStatic(r)&&firstCollision(r,t)===void 0?t.push(r):n.add(r.i);return e.map(e=>n.has(e.i)?{...e,static:!1}:e)}function boundedHeight(e,t){let n=t(e.i);if(e.static===!0||n.height!==`flexible`)return e;let r=clampHeight(e.h,n);return r===e.h?e:{...e,h:r}}function repairPageGrid(e,t){let n=[],r=keptStatics(e).map(e=>{let r=boundedHeight(e,t);return r!==e&&n.push({name:e.i,kind:`height`,from:positionOf(e),to:positionOf(r)}),r}).map(e=>{if(e.static===!0)return e;let r=snapCell(e,t);return samePosition(e,r)||n.push({name:e.i,kind:`width`,from:positionOf(e),to:positionOf(r)}),r}),i=pushApart(r);i.forEach((e,t)=>{let i=r[t];i!==void 0&&!samePosition(i,e)&&n.push({name:e.i,kind:`pushed`,from:positionOf(i),to:positionOf(e)})});let a=packLayout(i),o=keptFill(a,t);for(let e of inReadingOrder$1(a))e.i!==o&&t(e.i).height===`fill`&&n.push({name:e.i,kind:`fill`});return{cells:a,repairs:n}}function keptFill(e,t){return inReadingOrder$1(e).find(e=>e.static!==!0&&t(e.i).height===`fill`)?.i}function firstFreeSlot(e,t,n){let r=t.reduce((e,t)=>Math.max(e,bottomOf(t)),0);for(let i=n;i<=r;i+=1)for(let n=0;n+e.w<=6;n+=1)if(firstCollision({x:n,y:i,...e},t)===void 0)return{x:n,y:i};return{x:0,y:r}}function deriveLayout6(e,t){let n=[];for(let r of inReadingOrder$1(e)){let e=Math.min(6,Math.max(t(r.i).minWidth,Math.ceil(r.w/2))),i=n.at(-1)?.y??0;n.push({i:r.i,...firstFreeSlot({w:e,h:r.h},n,i),w:e,h:r.h})}return n}function figureSlot(e,t,n){for(let r of inReadingOrder$1(e.filter(e=>n.has(e.i)))){let n={x:r.x+r.w,y:r.y,...t};if(n.x+n.w<=12&&firstCollision(n,e)===void 0)return n}}function placeNew(e,t,n,r){let i={w:snapWidth(n.size.w,0,n.minWidth),h:Math.max(1,n.size.h)};return n.figure?{i:t,...figureSlot(e,i,r)??{x:0,y:0,...i}}:{i:t,x:0,y:e.reduce((e,t)=>Math.max(e,bottomOf(t)),0),...i}}function spanContent(e,t){if(!_.includes(t)){let e=`A block spans ${_.join(`, `)} columns, not ${String(t)}`;throw new j(e,[{path:[`content`,`span`],message:e}])}return{content:e,span:t}}function configureContent(e,t){try{return typeof e==`object`&&e&&`build`in e&&typeof e.build==`function`?{configuration:validateContentConfiguration(e.build(),t),extension:e.extension}:{configuration:validateContentConfiguration(e,t)}}catch(e){throw e instanceof j?new j(e.message,e.errors.map(e=>({...e,path:e.path[0]===`content`?[...t,...e.path.slice(1)]:e.path}))):e}}function storedQuery(e,t){let n=[`search`,`offset`].filter(t=>e.state[t]!==void 0);if(n.length>0)throw new j(`A ${t} cannot keep a query's ${n.join(` or `)}`,n.map(e=>({path:[t,e],message:`A ${t} stores no ${e}; use filters and limit instead`})));return e.toDefinition()}function checkInputs(e,t){for(let[n,r]of Object.entries(t)){let t=e.inputs[n];r!==void 0&&t!==void 0&&T({parameters:t.schema},r,[`content`,`parameters`,n])}return t}var BlockContentBuilder=class{constructor(e,t,n){this.extension=e,this.parameters=t,this.heightMode=n}copy(e,t){let n=this.constructor;return new n(this.extension,e,t)}with(e){let t={...this.parameters};for(let[n,r]of Object.entries(e)){if(r===void 0){delete t[n];continue}t[n]=r}return checkInputs(this.extension,e),this.copy(t,this.heightMode)}height(e){return this.copy(this.parameters,e)}build(){let e={type:`custom`,extension:this.extension.name,parameters:cloneBuilderValue(this.parameters,[`content`,`parameters`]),...this.heightMode===void 0?{}:{height:this.heightMode}};return validateContentConfiguration(e,[`content`]),T(this.extension,e.parameters,[`content`,`parameters`]),e}span(e){return spanContent(this,e)}},Measures=class{count(){return this.measured(`count`)}sum(e){return this.measured(`sum`,e)}avg(e){return this.measured(`avg`,e)}min(e){return this.measured(`min`,e)}max(e){return this.measured(`max`,e)}};function measure(e,t,n){return{query:e,measure:t,...n===void 0?{}:{attribute:n}}}var MetricBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}trend(e,t){return this.with({trend:e,trendBucket:t})}compare(e,t){return this.with({compare:e,period:t})}target(e){return this.with({target:e})}},MetricQuery=class extends Measures{constructor(e){super(),this.query=e}measured(e,t){return new MetricBuilder(b,checkInputs(b,measure(this.query,e,t)))}};function groupBy(e){return typeof e==`string`?[e,void 0]:[e.attribute,e.bucket]}var ChartBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}by(e){let[t,n]=groupBy(e);return this.with({by:t,byBucket:n})}by2(e){let[t,n]=groupBy(e);return this.with({by2:t,by2Bucket:n})}kind(e){return this.with({kind:e})}bar(){return this.kind(`bar`)}horizontalBar(){return this.kind(`horizontal_bar`)}line(){return this.kind(`line`)}area(){return this.kind(`area`)}donut(){return this.kind(`donut`)}funnel(){return this.kind(`funnel`)}treemap(){return this.kind(`treemap`)}calendar(){return this.kind(`calendar`)}},ChartQuery=class extends Measures{constructor(e){super(),this.query=e}measured(e,t){return new ChartBuilder(y,checkInputs(y,{...measure(this.query,e,t),kind:`bar`}))}};const Ou={"7d":7,"30d":30};var AgendaBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}next(e){let t=typeof e==`number`?e:Ou[e];if(!Number.isInteger(t)||t<1){let e=`An agenda looks ahead a whole number of days, at least 1`;throw new j(e,[{path:[`content`,`parameters`,`next`],message:e}])}return this.with({next:t})}yearly(){return this.with({yearly:!0})}},CardBuilder=class extends BlockContentBuilder{fields(...e){return this.with({fields:e})}record(e){return this.with({record:e})}},DecisionsBuilder=class extends BlockContentBuilder{kinds(...e){return this.with({kinds:e})}limit(e){return this.with({limit:e})}},MeetingsUpcomingBuilder=class extends BlockContentBuilder{limit(e){return this.with({limit:e})}},MailboxBuilder=class extends BlockContentBuilder{category(e){return this.with({category:e})}important(){return this.with({important:!0})}unread(){return this.with({unread:!0})}limit(e){return this.with({limit:e})}label(e){return this.with({label:e})}};function metric(e){return new MetricQuery(storedQuery(e,`metric`))}function chart(e){return new ChartQuery(storedQuery(e,`chart`))}function agenda(e,t){return new AgendaBuilder(g,checkInputs(g,{query:storedQuery(e,`agenda`),attribute:t}))}function card(e){let t=e===void 0||typeof e==`string`?e:e.build().name;return new CardBuilder(v,t===void 0?{}:checkInputs(v,{object:t}))}function text$1(e){return new BlockContentBuilder(S,checkInputs(S,{markdown:e}))}function decisions(){return new DecisionsBuilder(Ce,{})}function meetingsUpcoming(){return new MeetingsUpcomingBuilder(je,{})}function mailbox(){return new MailboxBuilder(ke,{})}function isSpanned(e){return typeof e==`object`&&!!e&&`span`in e&&`content`in e}function total(e){return e.reduce((e,t)=>e+t,0)}function spread(e){return e.length===0?0:Math.max(...e)-Math.min(...e)}function betterSplit(e,t){let n=total(e)-total(t);if(n!==0)return n>0;let r=spread(t)-spread(e);if(r!==0)return r>0;let i=e.findIndex((e,n)=>e!==t[n]);return i!==-1&&(e[i]??0)>(t[i]??0)}function splitColumns(e,t){let n=[...t];function visit(r,i){let a=t[r.length];if(a===void 0){betterSplit(r,n)&&(n=r);return}for(let t of _)t>=a&&i+t<=e&&visit([...r,t],i+t)}return visit([],0),n}function rowWidths(e,t){let n=e.filter(e=>e.span===void 0);n.length>4&&reject(t,`A row holds at most 4 unsized blocks`);let r=total(e.map(e=>e.span??e.minWidth));r>12&&reject(t,`Blocks ${e.map(e=>`"${e.key}"`).join(`, `)} do not fit one row: they need at least ${r} of 12 columns`);let i=splitColumns(12-total(e.map(e=>e.span??0)),n.map(e=>e.minWidth)),a=0;return e.map(e=>{if(e.span!==void 0)return e.span;let t=i[a]??e.minWidth;return a+=1,t})}function reject(e,t){throw new j(t,[{path:e,message:t}])}function traitsOf(e,t=[]){return Qt(e,C,new Map(t.map(e=>[e.name,e])))}function headingNames(e){let t=new Set(e.flatMap(e=>e.kind===`heading`?e.meta.name===void 0?[]:[e.meta.name]:[...Object.keys(e.blocks),...e.group?.name===void 0?[]:[e.group.name]]));return e.flatMap(e=>{if(e.kind!==`heading`)return[];if(e.meta.name!==void 0)return[e.meta.name];let n=nameSlug(e.title,40),r=n===``?`heading`:`heading_${n}`,i=r;for(let e=2;t.has(i);e+=1)i=`${r}_${e}`;return t.add(i),[i]})}function headingEntry(e,t,n){let r={title:t,...n.description===void 0?{}:{description:n.description},...n.icon===void 0?{}:{icon:n.icon}};return{key:e,content:new BlockContentBuilder(Ee,r),span:12}}function groupOf(e,t,n){let[r]=e.map(e=>e.name).sort(),i=jt(e.length);return(i!==void 0||r===void 0)&&reject(n,String(i)),{type:`group`,name:t.name??`group_${r}`,placement:`grid`,...t.label===void 0?{}:{label:t.label},members:e.map(e=>e.name)}}function requirePlacement(e,t,n,r,i){if(e.type===`page`&&reject(i,`Content "${n}" cannot reference a page from a page`),mn(e,t,n,r,i),e.type!==`custom`)return;let a=t?.refine?.(e.parameters??{},r);a&&reject([...i,`parameters`,a.input],a.message)}var Y=class PageBuilder{constructor(e){this.kind=`view`,this.data=e}icon(e){return new PageBuilder({...this.data,icon:e})}description(e){return new PageBuilder({...this.data,description:e})}home(){return new PageBuilder({...this.data,home:!0})}for(e){let t=typeof e==`string`?e:e.build().name;return new PageBuilder({...this.data,object:t})}row(e,t={}){let n=t.group===void 0?{kind:`row`,blocks:e}:{kind:`row`,blocks:e,group:t.group};return new PageBuilder({...this.data,sections:[...this.data.sections,n]})}heading(e,t={}){let n={kind:`heading`,title:e,meta:t};return new PageBuilder({...this.data,sections:[...this.data.sections,n]})}build(){let e=[`views`,`0`],{name:t,label:n,object:r,icon:i,description:a,home:o,sections:s}=this.data;requireBuilderName(t,[...e,`name`]),r!==void 0&&requireBuilderName(r,[...e,`object`]),o&&r!==void 0&&reject([...e,`home`],`Only a standalone page can be the home`),s.every(e=>e.kind===`row`&&Object.keys(e.blocks).length===0)&&reject([...e,`contents`],`A page declares at least one block`);let c=r===void 0?`page`:`record`,l=[],u=[],d=headingNames(s),f=0;for(let t of s){let n=[...e,`contents`,String(l.length)],r=(t.kind===`heading`?[headingEntry(d[f++]??``,t.title,t.meta)]:Object.entries(t.blocks).map(([e,t])=>isSpanned(t)?{key:e,content:t.content,span:t.span}:{key:e,content:t,span:void 0})).map(t=>{let n=[...e,`contents`,String(l.length)];requireBuilderName(t.key,[...n,`name`]);let{configuration:r,extension:i}=configureContent(t.content,n);requirePlacement(r,i,t.key,c,n);let a={...r,name:t.key,placement:`grid`};return l.push(a),{content:a,span:t.span}}),i=rowWidths(r.map(({content:e,span:t})=>({key:e.name,...t===void 0?{}:{span:t},minWidth:traitsOf(e).minWidth})),n),a=u.reduce((e,t)=>Math.max(e,t.y+t.h),0);if(t.kind===`row`&&t.group!==void 0){let e=groupOf(r.map(({content:e})=>e),t.group,n);l.push(e),u.push({i:e.name,x:0,y:a,w:12,h:traitsOf(e,l).size.h});continue}let o=0;r.forEach(({content:e},t)=>{let n=i[t]??0;u.push({i:e.name,x:o,y:a,w:n,h:traitsOf(e).size.h}),o+=n})}let p=Object.fromEntries(packLayout(u).map(({i:e,x:t,y:n,w:r,h:i})=>[e,{x:t,y:n,w:r,h:i}])),m={name:t,label:n,...r===void 0?{}:{object:r},context:`page`,...i===void 0?{}:{icon:i},...a===void 0?{}:{description:a},...o?{home:!0}:{},contents:l,grid:p},ee=w.safeParse(m);if(!ee.success)throw j.fromZodErrors(ee.error.issues.map(t=>({path:[...e,...t.path.map(String)],message:t.message})));return{kind:`view`,definition:cloneBuilderValue(m,e)}}};function page(e,t){return new Y({name:e,label:t,object:void 0,sections:[]})}var X=class ViewBuilder{constructor(e,t=[]){this.kind=`view`,this.data=cloneBuilderValue(e,[`views`,`0`]),this.extensions=t.map(e=>e&&{...e})}for(e){let t=typeof e==`string`?e:e.build().name;return new ViewBuilder({...this.data,object:t},this.extensions)}default(){return new ViewBuilder({...this.data,default:!0},this.extensions)}description(e){return new ViewBuilder({...this.data,description:e},this.extensions)}icon(e){return new ViewBuilder({...this.data,icon:e},this.extensions)}place(e,t,n,r,i){let{configuration:a,extension:o}=configureContent(n,[`views`,`0`,`contents`,String(this.data.contents.length)]),s={...a,name:e,label:t,placement:r},c=[...this.data.contents,s],l=i===void 0?{}:{anchors:{...this.data.anchors,[e]:{after:i}}};return new ViewBuilder({...this.data,...l,contents:c},[...this.extensions,o])}tab(e,t,n,r){return this.place(e,t,n,`main`,r?.after)}aside(e,t,n){return this.place(e,t,n,`aside`)}build(){let e=[`views`,`0`];requireBuilderName(this.data.name,[...e,`name`]),requireBuilderName(this.data.object,[...e,`object`]);let t=w.safeParse(this.data);if(!t.success)throw j.fromZodErrors(t.error.issues.map(t=>({path:[...e,...t.path.map(String)],message:t.message})));return this.data.contents.forEach((t,n)=>{let r=[...e,`contents`,String(n)];requireBuilderName(t.name,[...r,`name`]),t.type===`form`&&t.groups.forEach((e,t)=>requireBuilderName(e.name,[...r,`groups`,String(t),`name`])),mn(t,this.extensions[n],t.name,this.data.context,r)}),{kind:`view`,definition:cloneBuilderValue(this.data,e)}}};function detailView(e,t){return new X({name:e,label:t,object:void 0,context:`record`,contents:[]})}function listView(e,t){return new X({name:e,label:t,object:void 0,context:`collection`,contents:[]})}function isViewPiece(e){return`kind`in e&&e.kind===`view`}function isObjectPiece(e){return!(isViewPiece(e)||e instanceof M)}function assertPiece(e,t){if(typeof e!=`object`||!e)throw new j(`Unsupported bundle piece: ${t}`,[]);if(isViewPiece(e)||e instanceof M||typeof e.build==`function`)return;let n=e.name;throw new j(`Unsupported bundle piece: ${typeof n==`string`?n:String(t)}`,[])}function declarationOf$1(e){return e instanceof Y||e instanceof X?e.build():e}function isPage(e){return e.definition.context===`page`}function validateView(e){let t=w.safeParse(e);if(t.success)return t.data;let n=typeof e==`object`&&e&&`name`in e?String(e.name):`(unnamed)`,r=j.fromZodErrors(t.error.issues.map(e=>({path:e.path.map(String),message:e.message})));throw new j(`View "${n}" is invalid. ${r.message}`,r.errors)}function identityOf(e){return`${e.object??``}:${e.name}`}function assertUniqueIdentities(e,t){let n=new Set;for(let r of t){let t=identityOf(r);if(n.has(t))throw new D(e,r.name);n.add(t)}}function byIdentity(e){return(t,n)=>{let r=identityOf(e(t)),i=identityOf(e(n));return r<i?-1:+(r>i)}}async function hashBundlePieces(e){return sha256Hex(I({objects:[...e.objects].sort(byIdentity(e=>({name:e.name}))),views:[...e.views].sort(byIdentity(e=>e)),pages:[...e.pages].sort(byIdentity(e=>e.definition)),agents:[...e.agents].sort(byIdentity(e=>({name:e.name})))}))}async function builtBundleFromPieces(e){let t=e.name===J;t||assertBundleName(e.name);let{objects:n,pages:r,agents:i}=e,a=e.views.map(validateView),o=n.map(e=>e.name);if(assertUniqueIdentities(`object`,o.map(e=>({name:e}))),assertUniqueIdentities(`view`,a),assertUniqueIdentities(`page`,r.map(e=>e.definition)),assertUniqueIdentities(`agent`,i.map(e=>({name:e.name}))),!t){let e=o.find(_c);if(e!==void 0)throw new O(e,`bundle`)}return{name:e.name,label:e.label.trim(),description:e.description??null,hash:await hashBundlePieces({objects:n,views:a,pages:r,agents:i}),objects:n,views:a,pages:r,agents:i,uses:e.uses??[],samples:e.samples??[],translations:e.translations??{}}}const ku=Symbol.for(`standards.bundle`);function isBundle(e){return typeof e==`object`&&!!e&&e[ku]===!0}var BundleBuilder=class{constructor(e,t){this[ku]=!0,this.pieces=[],this.used=[],this.descriptionText=null,this.sampleRecords=[],this.translationTables={},this.built=null,assertBundleName(e),this.name=e,this.label=t,this.objectBuilders=[]}description(e){return this.descriptionText=e,this.changed()}add(...e){return this.pieces.push(...e),this.objectBuilders.push(...e.filter(isObjectPiece)),this.changed(),this}uses(...e){return this.used.push(...e),this.changed()}samples(e){return this.sampleRecords=e,this.changed()}translations(e,t){return this.translationTables[e]=t,this.changed()}build(){return this.built??=this.assemble(),this.built}changed(){return this.built=null,this}async assemble(){let e=[],t=[],n=[],r=[];for(let[i,a]of this.pieces.entries())if(assertPiece(a,i),a instanceof M)r.push(a.build());else if(isViewPiece(a)){let e=declarationOf$1(a);isPage(e)?n.push(e):t.push(e.definition)}else e.push(a.build());return this.assertNotInUsed(e),builtBundleFromPieces({name:this.name,label:this.label,description:this.descriptionText,objects:e,views:t,pages:n,agents:r,uses:this.used.map(e=>e.name),samples:this.sampleRecords,translations:{...this.translationTables}})}assertNotInUsed(e){let t=new Map,n=new Set([this]),visit=e=>{if(!n.has(e)){n.add(e);for(let n of e.objectBuilders){let r=n.build().name;t.has(r)||t.set(r,e.name)}for(let t of e.used)visit(t)}};for(let e of this.used)visit(e);for(let{name:n}of e){let e=t.get(n);if(e!==void 0)throw new D(`object`,n,`Object "${n}" is declared by bundle "${this.name}" and by its used bundle "${e}"`)}}};function bundle(e,t){return new BundleBuilder(e,t)}function readOnlyOption(e){return e?.readOnly===void 0?{}:{readOnly:e.readOnly}}function buildFreeFieldRef(e,t){return{type:`free`,attribute:e.build(),label:t?.label,required:t?.required,prefillExpression:t?.prefillExpression,...readOnlyOption(t)}}function buildSlotFieldRef(e,t,n){let[r,...i]=Array.isArray(e)?e:[e];return{type:`slot`,slotId:r,additionalSlotIds:i.length>0?i:void 0,attribute:t,label:n?.label,required:n?.required,tooltip:n?.tooltip,...readOnlyOption(n)}}const Au=L.boolean().optional();var FormRowBuilder=class{constructor(e,t,n){this._finalized=!1,this.stepBuilder=e,this.rowData={id:t,order:n,type:`fields`,fields:[]}}field(e,t,n){return this.rowData.fields.push(buildSlotFieldRef(e,t,n)),this}freeField(e,t){return this.rowData.fields.push(buildFreeFieldRef(e,t)),this}row(e){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).row(e)}heading(e,t){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).heading(e,t)}separator(){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).separator()}text(e){return this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData).text(e)}endRow(){return this._finalized?this.stepBuilder:(this._finalized=!0,this.stepBuilder._finalizeRow(this.rowData))}},FormStepBuilder=class{constructor(e,t,n){this.rowOrder=0,this.formBuilder=e,this.stepData={id:t,label:n,rows:[]}}description(e){return this.stepData.description=e,this}field(e,t,n){this.rowOrder++;let r=`row-${this.stepData.id}-${this.rowOrder}`,i=buildSlotFieldRef(e,t,n),a={id:r,order:this.rowOrder,type:`fields`,fields:[i]};return this.stepData.rows.push(a),this}freeField(e,t){this.rowOrder++;let n=`row-${this.stepData.id}-${this.rowOrder}`,r=buildFreeFieldRef(e,t),i={id:n,order:this.rowOrder,type:`fields`,fields:[r]};return this.stepData.rows.push(i),this}row(e){return this.rowOrder++,new FormRowBuilder(this,e,this.rowOrder)}heading(e,t){this.rowOrder++;let n={id:`heading-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:`heading`,content:e,level:t};return this.stepData.rows.push(n),this}separator(){this.rowOrder++;let e={id:`sep-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:`separator`};return this.stepData.rows.push(e),this}text(e){this.rowOrder++;let t={id:`text-${this.stepData.id}-${this.rowOrder}`,order:this.rowOrder,type:`text`,content:e};return this.stepData.rows.push(t),this}step(e,t){return this.formBuilder._finalizeStep(this.stepData).step(e,t)}build(){return this.formBuilder._finalizeStep(this.stepData).build()}_finalizeRow(e){return e.fields.length>0&&this.stepData.rows.push(e),this}_getData(){return this.stepData}},FormBuilder=class{constructor(e,t){this.data={slots:[],steps:[],status:`draft`,version:1},this.validateName(e),this.data.name=e,this.data.label=t}description(e){return this.data.description=e,this}icon(e){return this.data.icon=e,this}status(e){return this.data.status=e,this}metadata(e){return this.data.metadata=e,this}slot(e,t,n){if(this.data.slots.some(t=>t.id===e))throw Error(`[FormBuilder] Duplicate slot id: "${e}"`);let r={id:e,objectName:t,label:n.label,mode:n.mode??`create`,color:n.color,icon:n.icon};return this.data.slots.push(r),this}step(e,t){if(this.data.steps.some(t=>t.id===e))throw Error(`[FormBuilder] Duplicate step id: "${e}"`);return new FormStepBuilder(this,e,t)}build(){return this.validateRequiredData(),this.validateSlotReferences(),this.validateFreeFields(),this.validatePrefillExpressions(),this.validateReadOnly(),this.data}_finalizeStep(e){return this.data.steps.push(e),this}validateName(e){let t=L.string().min(1,`Form name cannot be empty`).max(63,`Form name is too long (max 63 characters)`).regex(/^[a-z0-9]+(-[a-z0-9]+)*$/,{message:`Invalid form name format. Name must be in kebab-case: 'client-onboarding', 'contact-creation'`});try{t.parse(e)}catch(e){throw e instanceof L.ZodError?Error(`[FormBuilder] ${e.issues[0].message}`):e}}validateRequiredData(){if(this.data.slots.length===0)throw Error(`[FormBuilder] At least one slot is required. Use .slot() to add slots.`);if(this.data.steps.length===0)throw Error(`[FormBuilder] At least one step is required. Use .step() to add steps.`)}validateSlotReferences(){let e=new Map(this.data.slots.map(e=>[e.id,e.objectName]));for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n))for(let r of n.fields){if(r.type!==`slot`)continue;let n=getSlotFieldTargets(r);for(let r of n)if(!e.has(r))throw Error(`[FormBuilder] Step "${t.id}" references unknown slot "${r}". Declare it with .slot("${r}", ...) first.`);let i=new Set(n.map(t=>e.get(t)));if(i.size>1)throw Error(`[FormBuilder] Step "${t.id}" field on attribute "${r.attribute}" targets slots of different objects (${[...i].join(`, `)}). A multi-slot field must target slots of the same object.`)}}validatePrefillExpressions(){let e=[...V,`join`,`where`];for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n))for(let r of n.fields){if(!isFormFreeFieldRef(r)||!r.prefillExpression)continue;let n=r.prefillExpression,i=`prefillExpression on free field "${r.attribute.name}" in step "${t.id}"`;if(!isLabelExpression(n))throw Error(`[FormBuilder] ${i} must contain at least one {{ attribute }} interpolation.`);if(/\{\{\s*\}\}/.test(n))throw Error(`[FormBuilder] ${i} contains empty {{ }} interpolation.`);for(let a of n.matchAll(/(?<!\|)\|(?!\|)\s*(\w+)(?:\s*:[^|}]*)?/g)){let n=a[1];if(!e.includes(n))throw Error(`[FormBuilder] ${i} uses invalid pipe "${n}". Valid pipes: ${e.join(`, `)}`);let o=a[0].replace(/^\|/,``);if(isWherePipe(o)&&!parseWherePipe(o))throw new j(`[FormBuilder] ${i} has a malformed where: pipe "${o.trim()}". Write where:property=value or where:property in (a,b).`,[{path:[t.id,r.attribute.name,`prefillExpression`],message:`Malformed where: pipe`}])}}}validateReadOnly(){for(let e of this.data.steps)for(let t of e.rows)if(isFormFieldsRow(t))for(let n of t.fields){if(Au.safeParse(n.readOnly).success)continue;let t=isFormFreeFieldRef(n)?n.attribute.name:n.attribute,r=isFormFreeFieldRef(n)?`free field`:`field`;throw new j(`[FormBuilder] readOnly on ${r} "${t}" in step "${e.id}" must be a boolean.`,[{path:[e.id,t,`readOnly`],message:`Expected a boolean`}])}}validateFreeFields(){let e=new Set(z);for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n)){for(let r of n.fields)if(isFormFreeFieldRef(r)){let n=r.attribute.type;if(e.has(n))throw Error(`[FormBuilder] Free field in step "${t.id}" uses forbidden attribute type "${n}". Forbidden types: ${z.join(`, `)}`)}}}};function form(e,t){return new FormBuilder(e,t)}const ju=`box`,Mu=[`circle`,`square`],Nu=[`upload`,`website`,`name`,`email`];function isImageSource(e){return Nu.some(t=>t===e)}const Pu={object:[`icon`,`color`],record:[`icon`,`image`],emailCategory:[`icon`,`color`],option:[`color`],view:[`icon`],agent:[`color`],user:[`image`]};function imageFileIdOf(e){return`image`in e?e.image?.fileId:`imageFileId`in e?e.imageFileId:void 0}function resolveAppearance(e,t){let n=imageFileIdOf(e);if(n)return{kind:`image`,imageFileId:n,shape:t?.image?.shape??`square`};let r=t?.name??e.name,i=e.color??t?.color??(r?Cl(r):void 0),a=e.icon??t?.icon??`box`;return i?{kind:`tile`,icon:a,color:i}:{kind:`glyph`,icon:a}}const Fu=L.object({shape:L.enum(Mu),from:L.array(L.string().refine(e=>e.trim().length>0,`Must not be blank`)).optional()}).strict();function imageLookupKindOf(e){return e.type===`text`?e.format===`url`?`website`:e.format===`email`?`email`:`name`:null}function validateObjectImage(e){let t=e.image?.from;if(t===void 0)return;let refuse=(t,n)=>{throw new j(`Object "${e.name}": ${t}`,[{path:n===void 0?[`image`,`from`]:[`image`,`from`,String(n)],message:t}])};t.length===0&&refuse(`image.from must name at least one attribute`);let n=new Map((e.attributes??[]).map(e=>[e.name,e])),r=new Set;for(let[e,i]of t.entries()){r.has(i)&&refuse(`image.from names "${i}" twice`,e),r.add(i);let t=n.get(i);t?imageLookupKindOf(t)===null&&refuse(`image.from names "${i}", a ${t.type} attribute: only text attributes can locate an image`,e):refuse(`image.from names "${i}", which is not one of its attributes`,e)}}function validateObjectExpressions(e){let{name:t,labelExpression:n,embeddingExpression:r}=e;if(!n)throw new k(`Object "${t}" must have a labelExpression. The labelExpression defines how records are displayed in lists and relations (e.g. "{{ name }}").`,A.VALIDATION_FAILED);let i=H.safeParse(n);if(!i.success){let e=i.error.issues[0]?.message??`Invalid labelExpression`;throw new k(`Invalid labelExpression for "${t}": ${e}`,A.VALIDATION_FAILED)}if(r!==void 0){let e=H.safeParse(r);if(!e.success){let n=e.error.issues[0]?.message??`Invalid embeddingExpression`;throw new k(`Invalid embeddingExpression for "${t}": ${n}`,A.VALIDATION_FAILED)}}}var ObjectBuilder=class{get"~standard"(){return createStandardSchemaProps(al(this.build()))}constructor(e,t){this._sealed=!1,this._toleratedAttributes=[],this.validateName(e),this.obj={name:e,label:t,attributes:[],system:!0}}id(e){return this.obj.id=e,this}description(e){return this.obj.description=e,this}pluralLabel(e){return this._pluralLabel=e,this}icon(e){return this.obj.icon=e,this}color(e){return this.obj.color=e,this}image(e={}){return this.obj.image={shape:e.shape??`square`,...e.from===void 0?{}:{from:[...e.from]}},this}runtime(){return this.obj.system=!1,this}sealed(){return this._sealed=!0,this}tolerate(e){return this._toleratedAttributes=[...this._toleratedAttributes,...e],this}attribute(e){return this.pushAttributes([e]),this}attributes(e){return this.pushAttributes(e),this}pushAttributes(e){let t=e.map(e=>`build`in e&&typeof e.build==`function`?e.build():e);hc([...this.obj.attributes,...t],e=>e.name,e=>new D(`attribute`,e,`Object "${this.obj.name}": duplicate attribute name "${e}"`)),this.obj.attributes.push(...t)}metadata(e){return this.obj.metadata={...this.obj.metadata,...e},this}order(e){return this.obj.metadata={...this.obj.metadata,order:e},this}hidden(){return this.obj.metadata={...this.obj.metadata,hidden:!0},this}labelExpression(e){return this._labelExpression=e,this}embeddingExpression(e){return this._embeddingExpression=e,this}documentLayout(e){if(e.presets)for(let t of e.presets)validatePresetStructure(t.id,t.structure,1);return this.obj.documentLayout=e,this}build(){if(!this.obj.name)throw new j(`[ObjectBuilder] Missing required field: name`,[{path:[`name`],message:`name is required`}]);if(!this.obj.label)throw new j(`[ObjectBuilder] Missing required field: label`,[{path:[`label`],message:`label is required`}]);return validateObjectExpressions({name:this.obj.name,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression}),validateObjectImage({name:this.obj.name,image:this.obj.image,attributes:this.obj.attributes}),{...this.obj,pluralLabel:this._pluralLabel,labelExpression:this._labelExpression,embeddingExpression:this._embeddingExpression,sealed:this._sealed,toleratedAttributes:this._toleratedAttributes}}validateName(e){e!==void 0&&wc(e)}};function object(e,t){if(_c(e))throw new O(e,`builder`);return new ObjectBuilder(e,t)}function validatePresetStructure(e,t,n){let fail=(t,n)=>{throw new j(t,[{path:[`documentLayout`,`presets`,e],message:n}])};n>5&&fail(`Preset structure exceeds max depth of 5`,`Preset structure too deep`);let r=new Set;for(let i of t){let t=i.title.trim();t.length===0&&fail(`Folder preset node title is required`,`Empty folder title`),t.includes(`/`)&&fail(`Folder preset node title cannot contain /`,`Folder title contains /: "${t}"`),r.has(t)&&fail(`Folder preset sibling titles must be unique`,`Duplicate folder title: "${t}"`),r.add(t),i.children&&i.children.length>0&&validatePresetStructure(e,i.children,n+1)}}function relationProperty(e){return requireBuilderName(e,[`relationProperty`]),{relationProperty:e}}var Z=class ContentBuilder{constructor(e,t){this.data=cloneBuilderValue(e,[`content`]),this.extension=t===void 0?void 0:Object.freeze({name:t.name,contexts:t.contexts,parameters:t.parameters,refine:t.refine})}set(e){return new ContentBuilder({...this.data,...e},this.extension)}icon(e){return this.set({icon:e})}object(e){return this.set({objectName:e})}layout(e){let{layout:t,groupByAttribute:n,columnSizing:r,kanbanColumnOrder:i,kanbanColumnVisibility:a,kanbanPinnedColumns:o,...s}={...this.data,layout:void 0,groupByAttribute:void 0,columnSizing:void 0,kanbanColumnOrder:void 0,kanbanColumnVisibility:void 0,kanbanPinnedColumns:void 0};return new ContentBuilder({...s,...e},this.extension)}table(){return this.layout({layout:`table`})}list(){return this.layout({layout:`list`})}kanban(e){return this.layout({layout:`kanban`,groupByAttribute:e})}columns(...e){return this.set({columns:e})}actions(...e){return this.set({actions:e})}openMode(e){return this.set({openMode:e})}createMode(e){return this.set({createMode:e})}visibility(e){return this.set({visibility:e})}descriptionAttribute(e){return this.set({descriptionAttribute:e})}displayAttributes(...e){return this.set({displayAttributes:e})}columnSizing(e){return this.set({columnSizing:e})}kanbanColumnOrder(...e){return this.set({kanbanColumnOrder:e})}kanbanColumnVisibility(e){return this.set({kanbanColumnVisibility:e})}kanbanPinnedColumns(...e){return this.set({kanbanPinnedColumns:e})}formColumns(e){return this.set({formColumns:e})}density(e){return this.set({density:e})}titleAttribute(e){return this.set({titleAttribute:e})}allowUpload(e){return this.set({allowUpload:e})}allowRemove(e){return this.set({allowRemove:e})}hideAttachments(e){return this.set({hideAttachments:e})}relations(...e){return this.set({relations:e})}span(e){return spanContent(this,e)}height(e){return this.set({height:e})}build(){let e=validateLiteralContent(this.data,[`content`]);return this.extension&&e.type===`custom`&&T(this.extension,e.parameters,[`content`,`parameters`]),e}},Iu=class GroupBuilder{constructor(e,t,n,r={}){this.data=cloneBuilderValue({name:e,label:t,fields:n,...r},[`group`])}field(e,t){let{name:n,label:r,fields:i,...a}=this.data;return new GroupBuilder(n,r,[...i,{attribute:e,...t}],a)}fields(...e){let{name:t,label:n,fields:r,...i}=this.data;return new GroupBuilder(t,n,[...r,...e.map(e=>({attribute:e}))],i)}description(e){return new GroupBuilder(this.data.name,this.data.label,this.data.fields,{...this.presentation(),description:e})}collapsible(e=!1){return new GroupBuilder(this.data.name,this.data.label,this.data.fields,{...this.presentation(),collapsible:!0,collapsed:e})}presentation(){let{name:e,label:t,fields:n,...r}=this.data;return r}build(){requireBuilderName(this.data.name,[`group`,`name`]);try{validateLiteralContent({type:`form`,groups:[this.data]},[`group`])}catch(e){throw e instanceof j?new j(e.message,e.errors.map(e=>({...e,path:e.path[1]===`groups`?[`group`,...e.path.slice(3)]:e.path}))):e}return cloneBuilderValue(this.data,[`group`])}};function group(e,t){return new Iu(e,t,[])}function collection(e){return new Z({type:`collection`,...storedQuery(e,`collection`)})}function form$1(...e){return new Z({type:`form`,groups:e.map(e=>`build`in e?e.build():e)})}function activity(){return new Z({type:`activity`})}function richtext$1(e){return new Z({type:`richtext`,attribute:e})}function documents(){return new Z({type:`documents`})}function forms(){return new Z({type:`forms`})}function emails(...e){return new Z({type:`emails`,emailAttributes:e})}function meetings(...e){return new Z({type:`meetings`,emailAttributes:e})}function custom(e,t){if(typeof e!=`object`||!e||typeof e.name!=`string`)throw new j(`Expected registered extension declaration`,[{path:[`content`,`extension`],message:`Expected registered extension declaration`}]);let n=validateContentConfiguration({type:`custom`,extension:e.name,parameters:t},[`content`]);if(n.type!==`custom`)throw new j(`Expected custom content`,[]);let r=new Z({...n,extension:e.name},e);return r.build(),r}function recordLinksTab(){return[x.name,x.label,custom(Re,{}).icon(x.icon)]}function page$1(e){let{object:t,name:n}=e.definition;if(typeof t!=`string`){let e=`Page "${n}" is standalone; a record tab renders a record page (\`page(...).for(object)\`)`;throw new j(e,[{path:[`content`,`page`,`object`],message:e}])}return new Z({type:`page`,page:{object:t,name:n}})}const Lu={collection,metric,chart,agenda,card,text:text$1,decisions,meetingsUpcoming,mailbox,page:page$1,form:form$1,activity,richtext:richtext$1,documents,forms,emails,meetings,custom};function contentDefinition(e,t){if(t.suppressed)return null;let n=t.workspaceDefinition??t.sourceDefinition;return n===null?null:{...structuredClone(n),name:e}}function storedContentDefinition(e){let{name:t,...n}=e;return structuredClone(n)}function workspaceViewAuthoring(e,t={}){let n={main:0,aside:0};return{origin:`runtime`,mainOrderCustomized:!1,asideOrderCustomized:!1,gridCustomized:Object.keys(t).length>0,homeCustomized:!1,contents:Object.fromEntries(e.map(e=>[e.name,{sourceDefinition:null,workspaceDefinition:storedContentDefinition(e),suppressed:!1,sourcePosition:null,workspacePosition:e.placement===`grid`?null:n[e.placement]++,sourceGrid:null,workspaceGrid:t[e.name]??null}]))}}function byKind(e,t){let rank=e=>Number(e.definition.type===`group`);return rank(e)-rank(t)||e.name.localeCompare(t.name)}function inReadingOrder(e){return(t,n)=>{let r=e(t.name),i=e(n.name);return r===null||i===null?r===i?byKind(t,n):r?-1:1:r.y-i.y||r.x-i.x||byKind(t,n)}}function overLimit(e,t){let n=new Set;if(e.length<=N.tabsPerView)return n;let r=new Map(e.map(e=>[e.name,e])),i=new Map;for(let{name:t,definition:n}of e)if(n.type===`group`)for(let e of n.members)i.has(e)||i.set(e,t);let cellOf=e=>{let n=r.get(e),a=n?t(n.state):null;if(a!==null)return a;let o=r.get(i.get(e)??``);return o?t(o.state):null},a=e.filter(e=>e.state.sourceDefinition===null).sort(inReadingOrder(cellOf)).reverse();for(let t of a){if(e.length-n.size<=N.tabsPerView)break;if(n.has(t.name))continue;let i=t.definition.type===`group`?t.definition.members.flatMap(e=>{let t=r.get(e);return t&&t.definition.type!==`group`?[t]:[]}):[];if(!i.some(e=>e.state.sourceDefinition!==null))for(let e of[t,...i])n.add(e.name)}return n}function resolvePageGrid(e,t={}){let rawCell=t=>e.gridCustomized||t.sourceDefinition===null?t.workspaceGrid:t.sourceGrid,n=Object.entries(e.contents).flatMap(([e,t])=>{let n=contentDefinition(e,t);return n?[{name:e,state:t,definition:n}]:[]}),r=en(n.map(e=>e.definition)),i=n.filter(e=>!r.has(e.name)).sort((e,t)=>e.name.localeCompare(t.name)),a=overLimit(i,rawCell),o=i.filter(e=>!a.has(e.name)),s=new Map(o.map(e=>[e.name,e.definition])),c=t.traitsOf??cn(s,C),l=Mt([...s.values()]),u=o.filter(e=>!l.has(e.name)),d={},f=[],place=(e,t)=>{t&&!Object.values(d).some(e=>sn(t,e))?d[e]={...t}:f.push(e)};if(e.gridCustomized)for(let{name:e,state:t}of u)place(e,t.workspaceGrid);else{for(let{name:e,state:t}of u)t.sourceDefinition!==null&&place(e,t.sourceGrid);for(let{name:e,state:t}of u)t.sourceDefinition===null&&place(e,t.workspaceGrid)}let p=Math.max(0,...Object.values(d).map(e=>e.y+e.h));for(let t of f.sort()){let n=e.contents[t],{w:r,h:i}=n.workspaceGrid??n.sourceGrid??c(t).size;d[t]={x:0,y:p,w:r,h:i},p+=i}let m=repairPageGrid(Object.entries(d).map(([e,n])=>({i:e,...n,...t.statics?.has(e)?{static:!0}:{}})),c);return{grid:Object.fromEntries(m.cells.map(({i:e,x:t,y:n,w:r,h:i})=>[e,{x:t,y:n,w:r,h:i}])),repairs:[...[...a].map(e=>({name:e,kind:`dropped`})),...m.repairs]}}function droppedContents(e){return new Set(e.flatMap(e=>e.kind===`dropped`?[e.name]:[]))}function resolveViewContents(e){let t=Object.entries(e.contents).flatMap(([e,t])=>{let n=contentDefinition(e,t);return n?[{definition:n,...t}]:[]}),n=[`main`,`aside`].flatMap(n=>{let r=n===`main`?e.mainOrderCustomized:e.asideOrderCustomized;return t.filter(e=>e.definition.placement===n).sort((e,t)=>{let n=r?e.workspacePosition:e.sourcePosition,i=r?t.workspacePosition:t.sourcePosition;if(n!==null&&i!==null&&n!==i)return n-i;if(n!==null&&i===null)return-1;if(i!==null&&n===null)return 1;let a=e.sourcePosition??e.workspacePosition,o=t.sourcePosition??t.workspacePosition;return a!==null&&o!==null&&a!==o?a-o:a!==null&&o===null?-1:o!==null&&a===null?1:e.definition.name.localeCompare(t.definition.name)}).map(e=>e.definition)}),r=en(t.map(e=>e.definition)),i=t.filter(e=>e.definition.placement===`grid`&&!r.has(e.definition.name)).map(e=>e.definition).sort((e,t)=>e.name.localeCompare(t.name));return[...n,...i]}const Ru=[`record`,`document`,`file`,`email`,`thread`,`event`,`memory`,`skill`,`schema`,`user`,`guide`,`bundle`,`draft`,`decision`,`session`],zu=new Set([`memory`,`schema`]),Bu=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function isReferenceKind(e){return Ru.includes(e)}function refuse$1(e,t){return{ok:!1,reason:e,expected:t}}function parseReference(e){let t=e.trim();if(Bu.test(t))return refuse$1(`bare_uuid`,`record:<id>`);let n=t.indexOf(`:`);if(n===-1)return refuse$1(`malformed`,`<kind>:<id>`);let r=t.slice(0,n).toLowerCase();if(!isReferenceKind(r))return refuse$1(`unknown_kind`,`<kind>:<id> with kind one of ${Ru.join(`, `)}`);let i=t.slice(n+1).trim();return i===``?refuse$1(`malformed`,`${r}:<id>`):r===`record`&&i.includes(`:`)?refuse$1(`legacy_mention`,`record:${i.slice(i.lastIndexOf(`:`)+1)}`):i===`*`&&!zu.has(r)?refuse$1(`malformed`,`${r}:<id>`):{ok:!0,ref:{kind:r,id:i}}}function formatReference(e){return`${e.kind}:${e.id}`}function isWildcard(e){return e.id===`*`&&zu.has(e.kind)}function requestedCapabilities(e){let t=[];return e.canModify&&t.push(`modify`),e.canSend&&t.push(`send`),t}const Vu={status:`connector_status`,error:`connector_error`,provider:`connector_provider`},Hu={phone:`text`,currency:`number`},Uu={rename:[`kind`,`object`,`from`,`to`],phone:[`kind`,`object`,`attribute`,`to`,`defaultCountryCode`],currency:[`kind`,`object`,`attribute`,`to`,`currencyCode`]};function refuse(e,t,n){throw new j(n,[{path:t===void 0?[`resolutions`,String(e)]:[`resolutions`,String(e),t],message:n}])}function assertKeys(e,t,n){for(let r of n)(typeof t[r]!=`string`||t[r]===``)&&refuse(e,r,`Resolution ${e} needs a non-empty string \`${r}\``);let r=Object.keys(t).find(e=>!n.includes(e));r!==void 0&&refuse(e,r,`Resolution ${e} has an unknown field \`${r}\``)}function assertResolution(e,t){if(vc(t)||refuse(e,void 0,`Resolution ${e} must be an object`),t.kind===`rename`){assertKeys(e,t,Uu.rename),t.from===t.to&&refuse(e,`to`,`Resolution ${e} renames "${t.from}" to itself`);return}if(t.kind!==`retype`&&refuse(e,`kind`,`Unknown resolution kind ${JSON.stringify(t.kind)}: expected "rename" or "retype"`),t.to!==`phone`&&t.to!==`currency`&&refuse(e,`to`,`Unsupported retype to ${JSON.stringify(t.to)}: a push converts text → phone and number → currency only`),assertKeys(e,t,Uu[t.to]),t.to===`phone`){let n=t.defaultCountryCode;/^[A-Z]{3}$/.test(n)&&El(n)||refuse(e,`defaultCountryCode`,`Resolution ${e}: "${n}" is not an ISO 3166-1 alpha-3 country code`);return}let n=t.currencyCode;/^[A-Z]{3}$/.test(n)&&Tl(n)||refuse(e,`currencyCode`,`Resolution ${e}: "${n}" is not a supported ISO 4217 currency code`)}function addressesOf(e){return e.kind===`rename`?{reads:e.from,lands:e.to}:{reads:e.attribute,lands:e.attribute}}function assertSchemaSourceResolutions(e){if(!Array.isArray(e))throw new j("`resolutions` must be an array",[{path:[`resolutions`],message:"`resolutions` must be an array"}]);if(e.length>100)throw new j(`A push carries ${e.length} resolutions; the limit is 100`,[]);let t=new Set;for(let[n,r]of e.entries()){assertResolution(n,r);let{reads:e,lands:i}=addressesOf(r);for(let[a,o]of[[`${r.kind}:${r.object}.${e}`,`of "${r.object}.${e}"`],[`${r.kind}>${r.object}.${i}`,`onto "${r.object}.${i}"`]])t.has(a)&&refuse(n,void 0,`Resolution ${n} repeats a ${r.kind} ${o}`),t.add(a)}}function phoneFromText(e,t){let n=e.trim();if(n===``)return{value:null};let r=Dl(n,bl(t));if(!r?.isPossible()||r.country===void 0||r.ext!==void 0)return;let i=wl(r.country)?.iso3;if(i!==void 0)return{value:{countryCode:i,phoneNumber:Sl(n,i)}}}function convertRetypedValue(e,t,n={}){if(t===null)return{value:null};if(e.to===`phone`)return typeof t==`string`?phoneFromText(t,e.defaultCountryCode):void 0;if(typeof t==`number`&&Math.abs(t)<=2**53-1&&!(t<0&&n.allowNegative!==!0))return{value:{code:e.currencyCode,value:t}}}const Q=L.string().refine(e=>e.trim().length>0,`Must not be blank`),Wu=L.union([L.tuple([L.literal(`object`),Q]),L.tuple([L.literal(`attribute`),Q,Q]),L.tuple([L.literal(`view`),Q,Q]),L.tuple([L.literal(`content`),Q,Q,Q])]),Gu=L.object({label:Q,pluralLabel:L.string().optional(),description:L.string().optional(),icon:P.optional(),color:gc.optional(),image:Fu.optional(),labelExpression:L.string(),embeddingExpression:L.string().optional(),sealed:L.boolean().optional(),toleratedAttributes:L.array(Q).optional(),metadata:L.record(L.string(),L.unknown()).optional(),documentLayout:L.record(L.string(),L.unknown()).optional()}).strict();function failure(e){throw new j(e,[])}function definitionSchema(e){return L.custom(t=>{let n=L.record(L.string(),L.unknown()).parse(t);for(let t of e[0]===`view`?[`object`,`name`]:[`name`])Object.hasOwn(n,t)&&failure(`Invalid schema state: unrecognized definition key ${t}`);switch(e[0]){case`object`:Gu.parse(n);break;case`attribute`:{let e=L.enum(ve).parse(n.type);Mc(e).extend({type:L.literal(e),label:Q,required:L.boolean().optional(),unique:L.boolean().optional(),icon:P.optional()}).strict().parse(n);break}case`view`:{let{contents:t,...r}=n,i=L.array(Q).parse(t);new Set(i).size!==i.length&&failure(`Invalid schema state: duplicate content membership`),dt.parse({...r,object:e[1],name:e[2],contents:[]});break}case`content`:E.parse({...n,name:e[3]})}return!0})}function compareSchemaStateEntries(e,t){let n=JSON.stringify(e.address),r=JSON.stringify(t.address);return n<r?-1:+(n>r)}function schemaStateSourcePayload(e){return{modelVersion:1,hashVersion:1,entries:[...e].sort(compareSchemaStateEntries).filter(e=>e.source!==null).map(({address:e,source:t})=>({address:e,source:t}))}}function parseState(e){let t=L.record(L.string(),L.unknown()).parse(e);for(let[e,n]of[[`modelVersion`,`model`],[`hashVersion`,`hash`]])t[e]!==1&&failure(`Unsupported schema ${n} version: expected 1, received ${t[e]===void 0?`missing`:String(t[e])}`);let n=L.object({modelVersion:L.literal(1),hashVersion:L.literal(1),tenant:Q,sourceFingerprint:L.string().regex(/^[a-f0-9]{64}$/),entries:L.array(L.unknown())}).strict().safeParse(e);if(!n.success){let e=n.error.issues.find(e=>e.code===`unrecognized_keys`);throw e?.code===`unrecognized_keys`&&failure(`Invalid schema state: unrecognized key ${e.keys[0]}`),j.fromZodErrors(n.error.issues.map(e=>({path:e.path.map(String),message:e.message})))}let r=new Set,i=n.data.entries.map(e=>{let t=Wu.parse(L.object({address:L.unknown()}).parse(e).address),n=JSON.stringify(t);r.has(n)&&failure(`Invalid schema state: duplicate address ${n}`),r.add(n);let i=definitionSchema(t).nullable(),a=t[0]===`object`||t[0]===`attribute`?L.object({id:L.string().uuid(),updatedAt:L.string().datetime()}).strict():L.object({id:L.string().uuid(),revision:L.number().int().nonnegative()}).strict(),o=L.object({address:Wu,source:i,effective:i,status:L.enum([`source`,`runtime`,`copy`,`suppressed`]),sourceOwner:L.string().regex(B).nullable(),guard:a.nullable()}).strict().parse(e);return(o.status===`runtime`&&(o.source!==null||o.effective===null||o.sourceOwner!==null)||o.status===`suppressed`&&(t[0]!==`content`||o.source===null||o.effective!==null||o.guard===null)||o.status===`copy`&&(o.source===null||o.effective===null)||o.effective!==null&&o.guard===null||o.source===null&&o.effective===null)&&failure(`Invalid schema state: inconsistent status at ${n}`),{...o,sourceOwner:parseSchemaOwner(o.sourceOwner)}});return{...n.data,entries:i.sort(compareSchemaStateEntries)}}function parseSchemaState(e){try{return parseState(e)}catch(e){throw e instanceof L.ZodError?j.fromZodErrors(e.issues.map(e=>({path:e.path.map(String),message:e.message}))):e}}function diffSchemaState(e){let t=[];for(let n of[...e.entries].sort(compareSchemaStateEntries)){let e=n.source===null?`added`:n.status===`suppressed`?`suppressed`:n.effective===null?`removed`:I(n.source)===I(n.effective)?n.status===`copy`?`copied`:null:`changed`;e&&t.push({...n,change:e})}return{modelVersion:1,tenant:e.tenant,sourceFingerprint:e.sourceFingerprint,changes:t}}const $=L.string().min(1),Ku=L.union([L.object({objectName:$,viewName:$,contentName:$.optional()}).strict().describe(`Full configuration of a view, or of one content when contentName is given`),L.object({objectId:$}).strict().describe(`An object with its attributes, by id`),L.object({objectName:$}).strict().describe(`An object with its attributes`),L.object({objectId:$,attributeName:$}).strict().describe(`One attribute's config, by name`),L.object({objectId:$,attributeId:$}).strict().describe(`One attribute's config, by id`),L.object({objectId:$,recordId:$}).strict().describe(`One sample record`)]);function parseNamedTarget(e){let t=Ku.safeParse(e);if(!t.success)throw new j(`Invalid scoped target`,[{path:[`target`],message:`Expected exactly one named target branch`}]);return t.data}const qu=[`object`,`attribute`,`view`,`content`,`sample`],Ju=L.object({mode:L.enum([`inline`,`window`]),interaction:L.enum([`static`,`interactive`]),size:L.enum([`compact`,`regular`]),aspectRatio:L.number().positive().finite().optional()}).strict(),Yu=L.object({artifactId:L.string().min(1),revision:L.number().int().positive(),name:L.string().min(1),kind:L.string().min(1),retention:L.enum($l),display:Ju}).strict();function readArtifactResult(e){let t=Yu.safeParse(e);return t.success?t.data:null}const Xu=L.string().regex(/^[^/\s]+\/[^/\s]+$/),Zu=L.object({kind:L.literal(`generated-image`),artifact:L.unknown(),generation:L.object({attemptId:L.uuid(),requestedModelId:Xu,executedModelId:Xu.nullable(),format:L.enum(au),mimeType:L.enum([`image/png`,`image/jpeg`,`image/webp`])}).strict()}).strict();function readGeneratedImageResult(e){let t=Zu.safeParse(e);if(!t.success)return null;let n=readArtifactResult(t.data.artifact);return!n||n.kind!==`image`?null:{...t.data,artifact:{...n,kind:`image`}}}function isCompletedToolPart(e){return e.type===`tool`&&e.state===`completed`}function readString(e,t){let n=e[t];return typeof n==`string`?n:void 0}function upsertWithPrecedence(e,t,n,r){let i=e.get(t),a=i&&r[i.kind]>r[n.kind]?i:n;e.delete(t),e.set(t,a)}function asRecord(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function readRefId(e,t,n){let r=readString(e,t),i=`${n}:`;return r?.startsWith(i)&&r.length>i.length?r.slice(i.length):void 0}function verbResultEntries(e){let t=asRecord(e);if(!t)return[];let n=[t];for(let e of[`members`,`created`,`updated`]){let r=t[e];if(Array.isArray(r))for(let e of r){let t=asRecord(e);t&&n.push(t)}}return n.filter(e=>!(`error`in e))}function extractReadRecordIds(e){let t=new Set;for(let n of e)if(n.role===`assistant`)for(let e of n.parts){if(!isCompletedToolPart(e)||e.name!==`read`)continue;let n=e.args.refs;if(Array.isArray(n))for(let e of n){if(typeof e!=`string`)continue;let n=parseReference(e);n.ok&&n.ref.kind===`record`&&t.add(n.ref.id)}}return[...t]}const Qu={created:1,modified:0};function readSingleRecordEntry(e){if(typeof e!=`object`||!e)return null;let t=e,n=typeof t.record==`object`&&t.record!==null?t.record:void 0,r=(n&&readString(n,`id`))??readString(t,`recordId`);return r?{id:r,label:(n&&readString(n,`label`))??r,objectName:(n&&readString(n,`objectName`))??``}:null}function readBulkRecordEntries(e,t,n){if(typeof e!=`object`||!e)return[];let r=e[t];if(!Array.isArray(r))return[];let i=[];for(let e of r){if(typeof e!=`object`||!e)continue;let t=e,r=readString(t,`id`);r&&i.push({id:r,label:readString(t,`label`)??r,objectName:readString(t,`objectName`)??n})}return i}function readVerbRecordEntries(e){let t=asRecord(asRecord(e.result)?.record),n=readString(e.args,`object`)??(t&&readString(t,`objectName`))??``,r=[];for(let t of verbResultEntries(e.result)){let e=readRefId(t,`ref`,`record`);e&&r.push({id:e,label:readString(t,`title`)||readString(t,`label`)||e,objectName:readString(t,`objectName`)??n})}return r}function extractTouchedRecords(e){let t=new Map;for(let n of e)if(n.role===`assistant`)for(let e of n.parts){if(!isCompletedToolPart(e))continue;let n=[],r;if(e.name===`create_record`||e.name===`update_record`||e.name===`edit_content`){let t=readSingleRecordEntry(e.result);n=t?[t]:[],r=e.name===`create_record`?`created`:`modified`}else if(e.name===`bulk_create_records`||e.name===`bulk_update_records`){let t=readString(e.args,`objectId`)??``,i=e.name===`bulk_create_records`?`created`:`updated`;n=readBulkRecordEntries(e.result,i,t),r=e.name===`bulk_create_records`?`created`:`modified`}else if(e.name===`write`)n=readVerbRecordEntries(e),r=readString(e.args,`action`)===`create`?`created`:`modified`;else continue;for(let e of n){let n={recordId:e.id,objectName:e.objectName,label:e.label,kind:r};upsertWithPrecedence(t,e.id,n,Qu)}}return[...t.values()]}const $u={modified:1,consulted:0};function isFilePart(e){return e.type===`file`}function entryFromDocumentMutation(e,t){if(typeof e.result!=`object`||e.result===null)return null;let n=e.result,r=readString(n,`documentId`)??(t===`folderId`?readString(n,t):void 0);return r?{id:r,title:readString(e.args,`name`)??readString(e.args,`title`)??r,kind:`modified`}:null}function entryFromReadDocument(e){let t=readString(e.args,`documentId`);return t?{id:t,title:t,kind:`consulted`}:null}function entryFromRef(e,t,n){let r=readRefId(e,`ref`,`file`),i=r??readRefId(e,`ref`,`document`);return i?{id:i,...r?{fileId:r}:{},title:n||readString(e,`title`)||i,kind:t,mimeType:readString(e,`mimeType`)}:null}function entriesFromOrganize(e){let t=asRecord(e.result);if(!t||`error`in t)return[];let n=readString(e.args,`action`),r=readString(e.args,`name`)??readString(e.args,`title`),i=readString(t,`documentId`);if(i)return[{id:i,title:r??i,kind:`modified`}];let a=readString(t,`folderId`);if(a)return n===`create_folder`?[{id:a,title:r??a,kind:`modified`}]:[];let o=entryFromRef(t,`modified`,r);return o?[o]:[]}function entriesFromCopy(e){let t=asRecord(e.result);if(!t||`error`in t)return[];let n=(Array.isArray(t.copied)?t.copied:[]).flatMap(e=>{let t=asRecord(e),n=t?entryFromRef(t,`modified`,void 0):null;return n?[n]:[]});if(n.length>0)return n;let r=entryFromRef(t,t.ref!==void 0&&t.ref===readString(e.args,`from`)?`consulted`:`modified`,void 0);return r?[r]:[]}function entriesFromRead(e){let t=asRecord(e.result);return(Array.isArray(t?.members)?t.members:[]).flatMap(e=>{let t=asRecord(e);if(!t||`error`in t||!readRefId(t,`ref`,`document`))return[];let n=entryFromRef(t,`consulted`,void 0);return n?[n]:[]})}function entriesFromToolPart(e){switch(e.name){case`organize`:return entriesFromOrganize(e);case`copy`:return entriesFromCopy(e);case`read`:return entriesFromRead(e);default:{let t=entryFromToolPart(e);return t?[t]:[]}}}function entryFromSandboxUpload(e){if(typeof e.result!=`object`||e.result===null)return null;let t=e.result,n=readString(t,`fileId`);return n?{id:n,fileId:n,title:readString(t,`title`)??n,kind:`modified`,mimeType:readString(t,`mimeType`)}:null}function entryFromToolPart(e){switch(e.name){case`update_document`:case`attach_file`:return entryFromDocumentMutation(e,`documentId`);case`create_folder`:return entryFromDocumentMutation(e,`folderId`);case`read_document`:return entryFromReadDocument(e);case`sandbox_upload_file`:return entryFromSandboxUpload(e);default:return null}}function extractTouchedDocuments(e){let t=new Map;for(let n of e)if(n.role===`assistant`){for(let e of n.parts)if(isCompletedToolPart(e))for(let n of entriesFromToolPart(e))upsertWithPrecedence(t,n.id,n,$u);else if(isFilePart(e)&&e.fileId){let n={id:e.fileId,fileId:e.fileId,title:e.name||e.fileId,kind:`modified`,mimeType:e.mimeType};upsertWithPrecedence(t,n.id,n,$u)}}return[...t.values()]}function extractTouchedArtifacts(e){let t=new Map;for(let n of e)if(n.role===`assistant`)for(let e of n.parts){if(!isCompletedToolPart(e)||e.error)continue;let n=e.name===`generate_image`?readGeneratedImageResult(e.result)?.artifact:e.name===`publish_artifact`?readArtifactResult(e.result):null;if(!n)continue;let r=`${n.artifactId}:${n.revision}`;t.delete(r),t.set(r,n)}return[...t.values()]}function isNonBlankString(e){return typeof e==`string`&&/\S/u.test(e)}const ed=L.object({provider:L.custom(e=>isNonBlankString(e)&&e.length<=200,{message:`must be a non-blank string of at most 200 characters`}),model:L.string().max(200).regex(/\S/u)});function normalizeNewsLocale(e){return e.toLowerCase().split(`-`)[0]===`fr`?`fr`:`en`}function resolveLocalized(e,t){return e[normalizeNewsLocale(t)]||(e.en?e.en:e.fr||void 0)}function hasLocale(e){return!!(e.fr||e.en)}const td=Object.keys({home:!0,agents:!0,routines:!0,object:!0,settings:!0}),nd=[`dot`,`label`,`bubble`];function parseNewsIntensity(e){return nd.find(t=>t===e)??`dot`}function parseNewsTarget(e){let[t,...n]=e.split(`:`),r=n.join(`:`);switch(t){case`home`:case`agents`:case`routines`:return r===``?{kind:t}:null;case`object`:return r?{kind:t,name:r}:null;case`settings`:return r?{kind:t,section:r}:null;default:return null}}function formatNewsTarget(e){return e.kind===`object`?`object:${e.name}`:e.kind===`settings`?`settings:${e.section}`:e.kind}function withoutTrailingSlashes(e){let t=e.length;for(;t>0&&e[t-1]===`/`;)--t;return e.slice(0,t)}const rd=/^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?$/;function compareIdentifiers(e,t){let n=/^\d+$/.test(e),r=/^\d+$/.test(t);return n&&r?Math.sign(Number(e)-Number(t)):n?-1:r?1:e<t?-1:+(e>t)}function compareVersions(e,t){let n=rd.exec(e),r=rd.exec(t);if(!(n&&r))return null;for(let e=1;e<=3;e+=1){let t=Number(n[e])-Number(r[e]);if(t!==0)return t<0?-1:1}let i=n[4],a=r[4];if(i===void 0&&a===void 0)return 0;if(i===void 0)return 1;if(a===void 0)return-1;let o=i.split(`.`),s=a.split(`.`);for(let e=0;e<Math.max(o.length,s.length);e+=1){let t=o[e],n=s[e];if(t===void 0)return-1;if(n===void 0)return 1;let r=compareIdentifiers(t,n);if(r!==0)return r<0?-1:1}return 0}function isSemver(e){return rd.test(e)}const id=30,ad=90,od=50,sd=L.looseObject({fr:L.string().optional(),en:L.string().optional()}),cd=L.iso.datetime({offset:!0}),ld=L.looseObject({id:L.string().min(1),slug:L.string().min(1),updatedAt:cd,publishedAt:cd,since:L.string(),displayDays:L.number().int().positive().optional(),requires:L.looseObject({capability:L.string(),level:L.string()}).optional(),target:L.string().optional(),intensity:L.unknown().optional(),title:sd,summary:sd});function knownRequirement(e){let t=G.find(t=>t.id===e.capability);return t!==void 0&&levelActions(t,e.level).length>0}function parseEntry(e){let t=ld.safeParse(e);if(!t.success)return`malformed entry: ${t.error.issues[0]?.message??`invalid`}`;let n=t.data;if(!isSemver(n.since))return`entry ${n.id}: since "${n.since}" is not semver`;if(!hasLocale(n.title))return`entry ${n.id}: title has no locale`;if(!hasLocale(n.summary))return`entry ${n.id}: summary has no locale`;if(n.requires&&!knownRequirement(n.requires))return`entry ${n.id}: unknown requirement ${n.requires.capability}/${n.requires.level}`;let r=n.target?parseNewsTarget(n.target):null;return{...n,displayDays:n.displayDays??30,intensity:parseNewsIntensity(n.intensity),target:r??void 0}}function httpsUrl(e){return typeof e==`string`&&e.startsWith(`https://`)?e:void 0}function parseNewsIndex(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw new j(`News feed: document must be an object`,[]);let n=e;if(!Array.isArray(n.entries))throw new j(`News feed: entries must be an array`,[]);let r=[];for(let e of n.entries){let n=parseEntry(e);typeof n==`string`?t?.(n):r.push(n)}let i=httpsUrl(n.blogUrl),a=httpsUrl(n.mediaBaseUrl),o=a?withoutTrailingSlashes(a):void 0;return{...i?{blogUrl:i}:{},...o?{mediaBaseUrl:o}:{},entries:r.slice(0,50)}}const ud=L.looseObject({id:L.string().min(1),slug:L.string().min(1),updatedAt:cd,body:sd});function parseNewsBody(e){let t=ud.safeParse(e);if(!t.success)throw new j(`News body: malformed document`,[]);if(!hasLocale(t.data.body))throw new j(`News body: body needs at least one locale`,[]);return t.data}function preference(e,t){return{key:e,value:t.value,default:t.default,audited:t.audited??!1,...t.parameter===void 0?{}:{parameter:t.parameter},...t.parameters===void 0?{}:{parameters:t.parameters},...t.refine===void 0?{}:{refine:t.refine}}}const dd=``;function refusal(e,t){return{ok:!1,field:e,message:t,issues:[{path:[e],message:t}]}}function declarationOf(e,t){return`get`in e?e.get(t):e.find(e=>e.key===t)}function locatePreference(e,t,n){let r=declarationOf(e,t);return r?r.parameter===void 0?n===void 0?{ok:!0,declaration:r,parameter:``}:refusal(`parameter`,`Preference "${t}" takes no parameter`):n===void 0||n===``||n.trim()!==n?refusal(`parameter`,`Preference "${t}" is keyed by ${r.parameter}`):r.parameters&&!r.parameters.includes(n)?refusal(`parameter`,`"${n}" is not a ${r.parameter} of "${t}"`):{ok:!0,declaration:r,parameter:n}:refusal(`key`,`Unknown preference "${t}"`)}function judgePreferenceWrite(e,t,n,r){let i=locatePreference(e,t,n);if(!i.ok)return i;let a=i.declaration.value.safeParse(r);if(a.success){let e=i.declaration.refine?.(a.data,i.parameter);return e===void 0?{...i,value:a.data}:refusal(`value`,e)}return{ok:!1,field:`value`,message:`Invalid value for preference "${t}"`,issues:a.error.issues.map(e=>({path:[`value`,...e.path.map(String)],message:e.message}))}}const fd=L.strictObject({model:ed.optional(),routing:L.literal(`auto`).optional()}),pd=L.strictObject({inApp:L.boolean()});function isActionableType(e){let t=h[e];return t!==void 0&&me(t.kind)}const md=[preference(`workPosture`,{value:L.enum(Za),default:`auto`,audited:!0}),preference(`chat.default`,{value:fd,default:{},audited:!0}),preference(`conversationSurface`,{value:L.enum(ti),default:`panel`}),preference(`mailboxListMode`,{value:L.enum(Wi),default:`threads`}),preference(`home`,{value:L.string().uuid().nullable(),default:null}),preference(`memory.learnFromEmail`,{value:L.boolean(),default:!0,audited:!0}),preference(`memory.shareWithTeam`,{value:L.boolean(),default:!0,audited:!0}),preference(`decisions.seenAt`,{value:L.iso.datetime().nullable(),default:null}),preference(`decisions.delivery`,{value:pd,default:{inApp:!0},parameter:`decision type`,parameters:Object.keys(h),refine:(e,t)=>!e.inApp&&isActionableType(t)?`A "${t}" decision asks you to act: it is always shown in-app`:void 0})];function preferenceEntry(e,t,n){return n===void 0?{key:e,value:t}:{key:e,parameter:n,value:t}}function withPreferenceEntry(e,t){if(t.parameter===void 0)return{...e,values:{...e.values,[t.key]:t.value}};let n=e.entries.findIndex(e=>e.key===t.key&&e.parameter===t.parameter),r=n===-1?[...e.entries,t]:e.entries.map((e,r)=>r===n?t:e);return{...e,entries:r}}export{Sr as ACCESS_LEVELS,Cr as ACCESS_ROLES,e as ACTIONABLE_DECISION_KINDS,g as AGENDA_BLOCK,wr as AGENT_ASIDE_ANSWER_MAX_LENGTH,Tr as AGENT_ASIDE_HISTORY_LIMIT,Er as AGENT_ASIDE_QUESTION_MAX_LENGTH,Dr as AGENT_AVATAR_EXPRESSIONS,Or as AGENT_AVATAR_TYPES,kr as AGENT_MESSAGE_KIND,Ar as AGENT_NOTIFICATION_KIND,jr as AGENT_SESSION_ACCESS_ROLES,Mr as AGENT_SESSION_LIST_ORDERS,Nr as AGENT_SESSION_ORIGINS,Pr as AGENT_SESSION_PROVENANCES,Fr as AGENT_STARTERS_MAX,Ir as AGENT_STARTER_MAX_LENGTH,Lr as AGENT_SYSTEM_PROMPT_MAX_LENGTH,Rr as AGENT_TASK_KINDS,t as AGGREGATE_BUCKETS,n as AGGREGATE_MEASURES,cu as ALLOWED_PROPERTY_TYPES,zr as ALL_CATALOG_TOOL_NAMES,V as ALL_PIPES,Br as ALWAYS_KINDS,Pu as APPEARANCE_FACETS,Vr as APPROVAL_FAMILY_TOOL_NAMES,Hr as ARCHITECT_PUBLICATION_KIND,eu as ARTIFACT_FILE_ROLES,Ql as ARTIFACT_KINDS,ge as ARTIFACT_PREVIEW_EXTENSION,$l as ARTIFACT_RETENTIONS,Ur as ASK_QUESTIONS_ANSWER_MAX_LENGTH,Wr as ASK_QUESTIONS_ANSWER_MAX_VALUES,Gr as ASK_QUESTIONS_MAX_BATCH,Kr as ASK_QUESTIONS_TOOL_NAME,_e as ATTRIBUTE_FILTER_OPERATORS,oc as ATTRIBUTE_NAME_SCHEMA,ve as ATTRIBUTE_TYPES,qr as AUDIT_ACTIONS,Jr as AUDIT_AGENT_SESSION_METADATA_KEY,Yr as AUDIT_RESOURCE_TYPES,Mn as AccessDeniedError,AgendaBuilder,M as AgentBuilder,Nn as AggregateValidationError,Pn as AmbiguousSchemaChangeError,Fn as AttributeInUseError,In as AttributeNotFoundError,ye as BLOCK_CONTEXTS,be as BLOCK_PERIODS,_ as BLOCK_WIDTHS,Xr as BROWSER_LAUNCH_TOOL_NAME,Zr as BROWSER_TOOL_NAMES,Qr as BUNDLE_LOCALES,q as BUNDLE_NAME_PATTERN,su as BYTE_UNIT_LABELS,BlockContentBuilder,BundleBuilder,v as CARD_BLOCK,bu as CATALOG_RESOURCES,y as CHART_BLOCK,xe as CHART_KINDS,Ec as COMPUTED_RETURN_TYPES,$r as CONNECTION_GRANT_PROVIDERS,Vu as CONNECTOR_CALLBACK_PARAM,Se as CONTENT_PLACEMENT_CONTEXTS,ei as CONTINUATION_KEY_PATTERN,ti as CONVERSATION_SURFACES,J as CORE_BUNDLE_NAME,md as CORE_PREFERENCES,ni as CORE_RECORD_TOOL_NAMES,ri as CORE_TOOL_NAMES,ii as COUNT_MODES,yu as CUSTOM_LEVEL,CardBuilder,ChartBuilder,ChartQuery,Ln as ConcurrentModificationError,Z as ContentBuilder,Ce as DECISIONS_BLOCK,r as DECISION_INBOX_STATES,i as DECISION_KINDS,a as DECISION_LINE_MAX_LENGTH,o as DECISION_LINK_TARGET_TYPES,s as DECISION_LIST_STATES,c as DECISION_READ_STATES,l as DECISION_SETTINGS_AREAS,u as DECISION_TITLE_MAX_LENGTH,d as DECISION_TYPES_V1,f as DECISION_TYPE_ACCESS_GRANTED,p as DECISION_TYPE_AGENT_APPROVAL,m as DECISION_TYPE_AGENT_MESSAGE,ee as DECISION_TYPE_AGENT_QUESTION,te as DECISION_TYPE_AGENT_REVIEW,ne as DECISION_TYPE_AGENT_ROUTINE_RUN_FAILED,re as DECISION_TYPE_AGENT_SETUP,ie as DECISION_TYPE_CONNECTOR_CONNECTION_ERROR,ae as DECISION_TYPE_CONNECTOR_CONNECTION_REAUTH_REQUIRED,oe as DECISION_TYPE_ENVIRONMENT_BUILD_FAILED,h as DECISION_TYPE_KINDS,se as DECISION_TYPE_PERSON,ce as DECISION_TYPE_RECORD_ASSIGNED,le as DECISION_TYPE_RECORD_MENTIONED,ue as DECISION_WORK_STATES,ai as DEFAULT_AGENT_EXECUTION_CONFIG,oi as DEFAULT_AGENT_TOOL_GROUPS,ju as DEFAULT_APPEARANCE_ICON,si as DEFAULT_APPROVAL_POLICY,ci as DEFAULT_BLUEPRINT_TOOL_GROUPS,li as DEFAULT_DAILY_ACTIVITY_DAYS,Zl as DEFAULT_DICTATION_LIMITS,gu as DEFAULT_LABEL_FALLBACK,we as DEFAULT_LAYOUT_TRAITS,ui as DEFAULT_MEETING_BOT_DISPLAY_NAME,di as DEFAULT_TENANT_SETTINGS,_l as DEFAULT_VALIDATION_MESSAGES,Ml as DEVICE_CHANNEL_AUTHENTICATE_TIMEOUT_MS,Nl as DEVICE_CHANNEL_IDLE_POLL_MS,Fl as DEVICE_CHANNEL_KEEPALIVE_MS,jl as DEVICE_CHANNEL_MAX_FRAME_BYTES,Al as DEVICE_CHANNEL_PATH,Pl as DEVICE_CHANNEL_PRESENCE_MS,Il as DEVICE_CHANNEL_WORKER_CLOSE_PROTOCOL_VIOLATION,Rl as DEVICE_COMMAND_ERROR_CODES,Yl as DICTATION_FINALIZATION_TIMEOUT_MS,Ul as DICTATION_FRAME_BYTES,Gl as DICTATION_MAX_BUFFER_BYTES,Wl as DICTATION_MAX_FRAME_BYTES,Kl as DICTATION_MAX_TRANSCRIPT_BYTES,Xl as DICTATION_MODEL_ID,Jl as DICTATION_PREPARATION_TIMEOUT_MS,Hl as DICTATION_SAMPLE_RATE,ql as DICTATION_TICKET_TTL_MS,fi as DISCARD_ARCHITECT_DRAFT_TOOL_NAME,pi as DOCUMENT_SORT_MODES,qu as DRAFT_CONFLICT_KINDS,mi as DRAFT_WRITE_TOOL_NAMES,DecisionsBuilder,DeviceChannelProtocolError,Bl as DeviceChannelServerFrameSchema,zl as DeviceChannelWorkerFrameSchema,D as DuplicateError,hi as EMAIL_CATEGORY_DEFAULT_COLOR,gi as EMAIL_CATEGORY_DEFAULT_ICON,_i as EMAIL_CATEGORY_DESCRIPTION_MAX,vi as EMAIL_CATEGORY_DESCRIPTION_MIN,yi as EMAIL_CATEGORY_LIMIT,bi as EMAIL_CATEGORY_NAME_MAX,xi as ENVIRONMENT_BUILD_LOG_STEP_PREFIX,Si as ENVIRONMENT_HARNESSES,Ci as ENVIRONMENT_HARNESS_SANDBOX_WORKDIR,wi as ENVIRONMENT_HARNESS_WORKDIR,Ti as ENVIRONMENT_IMAGES,Ei as ENVIRONMENT_MEMORY_GB_PER_VCPU,Di as ENVIRONMENT_NAME_MAX_CHARS,Oi as ENVIRONMENT_NETWORK_ALLOW_MAX,ki as ENVIRONMENT_SCRIPT_MAX_BYTES,Ai as ENVIRONMENT_SIZES,ji as ENVIRONMENT_SIZE_VCPUS,Mi as ENVIRONMENT_STANDARDS_WORKDIR,Ni as ENV_VAR_KEY_PATTERN,Pi as ESTIMATED_COUNT_CAP,Rn as ExportTooLargeError,Fi as FILE_URLS_MAX_IDS,z as FORM_FORBIDDEN_ATTRIBUTE_TYPES,zn as ForbiddenError,FormBuilder,FormRowBuilder,FormStepBuilder,Ii as GET_ARCHITECT_DRAFT_TOOL_NAME,Li as GITHUB_TRIGGER_CATALOG,Ri as GRANT_ENABLES,Te as GROUPABLE_ATTRIBUTE_TYPES,Iu as GroupBuilder,Ee as HEADING_BLOCK,zi as HITL_TOOL_NAMES,au as IMAGE_FORMATS,Mu as IMAGE_SHAPES,Nu as IMAGE_SOURCES,Bi as INFERENCE_REASONING_OPTIONS,Vi as INFERENCE_ROUTING_MODES,Hi as INFERENCE_SPEEDS,De as INVENTORY_LIMIT,Bn as InvalidPermissionGrantError,Ui as LAST_RUN_ERROR_MAX_LENGTH,sc as LIST_VIEW_TAB_VISIBILITIES,Oe as LOCATION_FILTER_PROPERTIES,Vn as LogoProviderUnavailableError,Hn as LogoSearchRateLimitedError,ke as MAILBOX_BLOCK,Wi as MAILBOX_LIST_MODES,Gi as MAIL_DRAFT_BODY_MAX_CHARS,Ki as MAIL_SIGNATURE_MAX_CHARS,qi as MAIL_SUBJECT_MAX_CHARS,de as MAX_AGGREGATE_GROUPS,Ji as MAX_DAILY_ACTIVITY_DAYS,Vl as MAX_PRESET_DEPTH,Yi as MAX_TODOS,Xi as MAX_TODO_DESCRIPTION_CHARS,Zi as MAX_TODO_ID_CHARS,Qi as MCP_SERVER_NAME_MAX_LENGTH,Ae as MEASURABLE_ATTRIBUTE_TYPES,je as MEETINGS_UPCOMING_BLOCK,$i as MEETING_BOT_IMAGE,ea as MEETING_BOT_IMAGE_BASE64_MAX_LENGTH,ta as MEETING_RESPONSES,K as MEMORY_ATTRIBUTES,Tu as MEMORY_PAGE_MAX_CHARS,na as MEMORY_SPEND_LIMIT_PATTERN,Eu as MEMORY_WORKSPACE_PROFILE,wu as MEMORY_WRITE_SOURCE,b as METRIC_BLOCK,MailboxBuilder,ra as McpOAuthCompletionMode,Un as MemoryNotFoundError,MetricBuilder,MetricQuery,MultiRelationAttributeBuilder,Ol as NATIVE_AGENT_UI_PART_IDS_METADATA_KEY,kl as NATIVE_AGENT_UI_PART_IDS_METADATA_SCHEMA_VERSION,Me as NATIVE_BLOCKS,cc as NATIVE_OBJECT_NAMES,ia as NATIVE_TOOL_GROUPS,aa as NATIVE_TOOL_GROUP_CATALOG,id as NEWS_DEFAULT_DISPLAY_DAYS,ad as NEWS_DISPLAY_CAP_DAYS,od as NEWS_INDEX_MAX_ENTRIES,nd as NEWS_INTENSITIES,td as NEWS_TARGET_KINDS,U as NO_ACCESS,dd as NO_PREFERENCE_PARAMETER,oa as NO_RECORDING,Ne as NO_VALUE_OPERATORS,Jc as NonJsonValueError,NoopGeocodingAdapter,Wn as NotFoundError,Gn as NotImplementedError,W as OBJECT_GRANT,lc as OBJECT_NAME_SCHEMA,sa as OPEN_TOOL_PART_STATES,ca as OPERATION_MAX_STEPS,Pe as OPERATORS_BY_TYPE,ObjectBuilder,Kn as ObjectNotFoundError,qn as ObjectReferencedError,Jn as OrphanSystemAttributeError,Fe as PAGE_GRID_COLUMNS,Su as PERMISSION_ACTIONS,G as PERMISSION_CAPABILITIES,vu as PERMISSION_CATALOG,uu as PIPES_WITH_ARGS,la as PROVIDER_DRAFT_LABEL,ua as PROVIDER_NAMES,da as PUBLIC_MAIL_DOMAINS,Y as PageBuilder,Yn as PageReferencedError,Xn as ProtectedResourceError,Zn as ProtectedRoleError,Ie as QUALIFIED_SEPARATOR,Le as QUERY_OBJECT,fa as QUESTION_FAMILY_TOOL_NAMES,ou as QUOTA_KEYS,Qn as QueryTimeoutError,pa as RECENT_ACTIVITY_LEDGER_LIMIT,ma as RECIPIENT_IDENTITIES_MAX,ha as RECORDING_OVERRIDES,ga as RECORDING_POLICIES,_a as RECORD_ACCESS_ROLES,va as RECORD_ACCESS_SOURCES,ya as RECORD_DRIVE_CURSOR_MAX_LENGTH,ba as RECORD_DRIVE_PAGE_DEFAULT_LIMIT,xa as RECORD_DRIVE_PAGE_MAX_LIMIT,Sa as RECORD_GRAPH_DEFAULT_LIMIT_PER_NODE,Ca as RECORD_GRAPH_MAX_LIMIT_PER_NODE,wa as RECORD_GRAPH_MAX_NODES,Ta as RECORD_IMAGE_MAX_BYTES,Re as RECORD_LINKS_BLOCK,x as RECORD_LINKS_CONTENT,uc as RECORD_LIST_SCOPES,ze as RECORD_OBJECT,Ru as REFERENCE_KINDS,Be as RELATION_TARGET_ANY,Ve as REMOVED_OPERATOR_REPLACEMENTS,Ea as REPLY_MODES,Da as REQUEST_DESIGN_REVIEW_TOOL_NAME,Oa as REQUEST_SETUP_TOOL_NAME,dc as RESERVED_ATTRIBUTE_NAMES,fc as RESERVED_OBJECT_NAMES,ka as RESOURCE_GRANT_KINDS,Aa as RESOURCE_KIND_CATALOG,pc as RESOURCE_VISIBILITIES,ja as ROUTING_PRICE_CEILINGS,$n as RealtimeDeliveryError,er as RealtimeRateLimitedError,tr as RealtimeSubscriptionError,nr as RecordNotFoundError,He as RecordQuery,rr as RecordReferencedError,ir as RepositoryError,O as ReservedObjectNameError,ar as RoleNotFoundError,N as SCHEMA_LIMITS,B as SCHEMA_OWNER_PATTERN,Hu as SCHEMA_SOURCE_RETYPE_FROM,Ma as SEND_VERB_NAME,Na as SESSION_INFERENCE_PATCH_KEYS,lu as SIMPLE_PIPES,Dc as SIMPLE_PROPERTY_TYPES,Pa as SLACK_TRIGGER_CATALOG,Fa as SPEAKS_THROUGH_SEND_METADATA_KEY,Du as STANDARD_SCHEMA_VENDOR,Ia as SURFACE_TOOL_NAMES,Ue as SYNONYM_ALIASES,We as SYSTEM_ATTRIBUTES,Ge as SYSTEM_ATTRIBUTE_I18N_KEYS,La as SYSTEM_EMAIL_CATEGORIES,Ra as SYSTEM_EMAIL_CATEGORY_NAMES,mc as SYSTEM_FIELD_NAMES,Ke as SYSTEM_FILTER_ATTRIBUTE_TYPES,za as SYSTEM_PART_CODES,k as SchemaError,A as SchemaErrorCode,or as SearchBackendError,sr as SearchPathNotIndexedError,SingleRelationAttributeBuilder,cr as StorageError,lr as SyncCascadeError,ur as SyncConflictError,dr as SyncError,fr as SystemEntityImmutableError,Ba as TASK_DEMAND_LEVELS,tu as TENANT_INVITATION_DEFAULT_TTL_MS,ru as TENANT_INVITATION_MAX_TTL_MS,nu as TENANT_INVITATION_MIN_TTL_MS,iu as TENANT_INVITATION_RESEND_INTERVAL_MS,S as TEXT_BLOCK,hl as TEXT_FORMAT_PATTERNS,Va as TODO_PHASES,Ha as TODO_PLAN_STATUSES,Ua as TODO_STATUSES,Wa as TOOL_APPROVAL_STATES,Ga as TRIAGE_ACTIONS,Ka as TRIGGER_EVENT_TYPES,qa as TURN_OUTCOMES,pr as ToolGroupGrantError,Ja as UNSHAREABLE_OBJECT_NAMES,Ya as USERS_RESOLVE_MAX_IDS,Xa as USER_STATUSES,Za as USER_WORK_POSTURES,Qa as VERB_NAMES,j as ValidationError,X as ViewBuilder,Oc as WIRE_OFFERED_BASE_CONFIG,kc as WIRE_OMITTED_CONFIG_KEYS,mr as WorkspaceInvariantReason,$a as agent,eo as agentAvatarFromMetadata,to as agentAvatarSchema,no as agentDataChunk,ro as agentDisplayName,io as agentInferencePreferencesSchema,ao as agentMessageAttachmentSchema,oo as agentMessagePartSchema,so as agentScheduleSchema,co as agentSessionInferenceOverridesInputSchema,lo as agentSessionInferenceOverridesSchema,uo as agentSessionMessageSchema,fo as agentStartersSchema,po as agentTriggerBaseSchema,mo as agentTriggerPatchSchema,ho as agentTriggerSchema,go as agentUIValidationError,applyPipes,_o as artifactQuoteSchema,Yc as asTenantId,Xc as asUserId,vo as askQuestionsOutputSchema,assertBundleName,yo as assertCustomAgentUIMessageChunk,assertSchemaSourceResolutions,bo as assertSessionState,Ac as attributeConfigSchemas,qe as attributeFilterTarget,Je as attributeInventory,Ye as blockObjectInputs,buildPropertySchema,Xe as buildQualifiedAttribute,builtBundleFromPieces,bundle,I as canonicalStringify,xo as canonicalToolGroups,Ze as canonicalizeFilterValue,capabilityForResource,Qe as capped,checkbox,So as classificationRestoreSchema,Co as classifyEmailSchema,wo as cliDefaultModelOf,$e as collectContentViewCatalogue,et as collectQualifiedRuleIssues,tt as collectionContentSourceSchema,nt as collectionSourceAddress,rt as collectionSourceAddressOf,gc as colorIdSchema,it as columnsSchema,To as compareAgentSessionMessages,compareSchemaStateEntries,compareVersions,Eo as compiledHarnessModels,computeByteMagnitude,computeReconnectDelay,computeRetryDelay,Do as connectionGrantKindsOf,Oo as connectorTriggerMatchSchema,Lu as content,contentDefinition,C as contentExtensionRegistry,at as contentReadObjects,w as contentViewDefinitionSchema,ot as contentViewDefinitionSchemaFor,convertRetypedValue,rl as createAttributeValidator,il as createFormAttributeValidator,createStandardSchemaProps,currency,st as currentActor,ko as customDataChunkSchemas,date,fe as decisionThreadKey,declaredImageRequests,Ao as decodeAgentSessionListCursor,Zc as deepEqual,ct as defineBlock,deriveLayout6,jo as deriveViewerAccess,lt as describeViewIssue,detailView,deviceChannelUrl,diffSchemaState,ut as displayAttributesSchema,document,dt as draftContentViewDefinitionSchema,ft as draftContentViewDefinitionSchemaFor,droppedContents,Mo as durableDateSchema,pt as edgePropertyFilterTarget,No as emailCategoryCreateSchema,Po as emailCategoryDeleteSchema,Fo as emailCategoryScopeQuerySchema,Io as emailCategoryUpdateSchema,Lo as emailRuleScopeSchema,Ro as encodeAgentSessionListCursor,zo as environmentHarness,Bo as environmentWorkdir,extractAttributeNames,extractAttributePaths,mt as extractCurrencyFilterValue,ht as extractFilterValue,extractReadRecordIds,extractTouchedArtifacts,extractTouchedDocuments,extractTouchedRecords,gt as filterOperatorsOfType,_t as filterStateSchema,vt as filterTargetsOf,Vo as findEnvironmentHarness,findGrantIssues,yt as findGridViolation,bt as findGroupViolation,xt as findLayoutRuleViolation,St as findRelationAttribute,Ct as findRowLimitViolation,form,formFieldFlatKey,formFieldKey,formatByteSize,pe as formatDecisionLink,formatNewsTarget,yl as formatPhoneForDisplay,formatReference,vl as formatZodErrors,formula,Qc as generateId,wt as getAttributeCapabilities,Mc as getAttributeConfigSchema,Nc as getAttributeConfigWriteSchema,Tt as getAttributeFilterOperators,getEditableLabelAttribute,Et as getOperatorPolarity,Dt as getRollupFilterOperators,getSingleAttributeFromExpression,getSlotFieldTargets,Ot as getSystemAttributeI18nKey,kt as getSystemAttributeList,Ho as githubConditionSchema,Uo as githubTriggerMatchSchema,Wo as grantKindOf,At as gridPositionSchema,group,jt as groupSizeMessage,Mt as groupedMembers,Go as harnessModelChoices,hasLocale,hasOptions,hashBundlePieces,Ko as humanRequestId,qo as humanRequestKind,P as iconNameSchema,imageLookupKindOf,imageModelFormatDefect,Jo as imageModelIdSchema,$c as indexBy,Nt as inferInverseCardinality,Yo as inferenceReasoningSchema,Xo as inferenceRoutingSchema,Zo as inferenceSpeedSchema,Pt as input,Ft as invalidViewMessage,me as isActionableDecisionKind,Qo as isAgentMessageMetadata,$o as isAgentNotificationMetadata,es as isAgentUIDataName,ts as isAgentWrittenAuditEntry,ns as isArchitectPublicationMetadata,It as isAttributeFilterable,Lt as isAttributeGroupable,hr as isAttributeInUseError,Rt as isAttributeKanbanGroupable,zt as isAttributeSearchable,Bt as isAttributeSortable,rs as isAwaitingHuman,Vt as isBilateralRelation,is as isBlocking,isBundle,Ht as isCalendarDay,isCatalogResource,Ut as isCollectionContent,Wt as isDynamicValue,ol as isEmptyValue,as as isEnvironmentHarnessId,isFormDefinition,isFormFieldsRow,isFormFreeFieldRef,isFormHeadingRow,isFormSeparatorRow,isFormSlotFieldRef,isFormTextRow,isImageSource,isLabelExpression,Gt as isLocationFilterProperty,Kt as isLocationPartOperator,os as isMailProvider,ss as isMailboxListMode,qt as isManagedSystemAttribute,_c as isNativeObjectName,cs as isNativeToolGroup,Jt as isNoValueOperator,gr as isNotFoundError,sl as isNullishOrEmptyString,_r as isObjectReferencedError,ls as isOpenToolPartState,us as isParkedOnHuman,vc as isPlainRecord,vr as isProtectedResourceError,ds as isProviderDraft,fs as isPublicMailDomain,ps as isQuestionPart,yr as isRecordReferencedError,Yt as isRelativeDateValue,ms as isReplyMode,hs as isResourceGrant,gs as isRoutineActorMetadata,br as isSchemaError,isSemver,_s as isSessionInferencePatch,Xt as isSetMembershipOperator,isStandardSchema,vs as isSystemEmailCategory,ys as isSystemEmailCategoryName,bs as isSystemPartCode,xs as isToolApprovalState,Zt as isUniversalRelation,xr as isValidationError,cl as isValuePresent,isWherePipe,isWildcard,judgePreferenceWrite,keptFill,H as labelExpressionSchema,Qt as layoutTraitsOf,levelActions,levelFloor,levelOf,listView,locatePreference,location,$t as locationPartFilterTarget,Ss as lockingSendCall,Cs as meetingBotDispatchRequestSchema,ws as meetingBotDispatchResponseSchema,Ts as meetingBotNotificationSchema,Es as meetingTranscriptSegmentSchema,en as memberlessGroups,memoryPageViewOf,Ds as mentionReferenceSchema,Os as mergeSessionInferencePatch,tn as metricComparePeriod,ks as modelDefinitionSchema,ed as modelIdentitySchema,As as modelReferenceSchema,multiselect,nameSlug,Ku as namedTargetSchema,nativeAgentUIPartIdMetadataKey,js as needsManageWhenUnattended,xl as normalizeCountrylessPhoneNumber,nn as normalizeFilterRule,rn as normalizeForEdgeRpc,normalizeNewsLocale,an as normalizeOperator,Sl as normalizePhoneNumber,Ms as normalizedMeetingTranscriptSchema,on as now,number,object,Fu as objectImageSchema,Ns as openRequests,Ps as orderAgentSessionMessages,packLayout,page,pageCompactor,cn as pageTraitsOf,Fs as parseAgentDefinitionAccessRole,Is as parseAgentSessionAccessRole,Pc as parseAttributeConfig,Fc as parseAttributeConfigForCreate,Ic as parseAttributeConfigForUpdate,T as parseBlockParameters,Ls as parseCountMode,he as parseDecisionLink,parseDeviceChannelFrame,Rs as parseMergedAgentTrigger,parseNamedTarget,parseNativeAgentUIPartIdsMetadata,parseNewsBody,parseNewsIndex,parseNewsIntensity,parseNewsTarget,zs as parseOptionalCountMode,Bs as parsePageAccessRole,ln as parseQualifiedAttribute,Vs as parseRecordAccessRole,yc as parseRecordListScope,parseReference,bc as parseResourceVisibility,parseSchemaGroupPresentation,parseSchemaOwner,parseSchemaState,parseServerFrame,Hs as parseToolGroupGrant,parseWherePipe,parseWorkerFrame,Cu as permissionGrantSchema,phone,placeNew,preference,preferenceEntry,Lc as propertyAttributeSchema,Rc as propertyAttributeWireSchema,zc as propertySchemaSchema,Bc as propertySchemaWireSchema,Us as providerNameSchema,E as publishedViewContentDefinitionSchema,un as query,readArtifactResult,Ws as readAskQuestionsResult,readFormFieldValue,readGeneratedImageResult,Gs as recentActivityEntryKey,Ks as recordGraphNodeKey,qs as recordGraphRequestSchema,recordLinksTab,Js as recordMeetingsCount,Ys as recordOperationSchema,dn as recordQueryDefinitionSchema,Xs as refineTrigger,Vc as refuseForeignKeys,ll as rejectUnknownAttributesOrThrow,relation,fn as relationAcceptsObject,relationProperty,pn as relationTargetsOf,renderLabelExpression,repairPageGrid,requestedCapabilities,hn as requireRecordContentContext,gn as requireSingleRelationTarget,resolveAppearance,_n as resolveCollectionActions,vn as resolveContentNavigation,yn as resolveEffectiveFilterType,resolveFieldRequired,bn as resolveIsWithinBounds,resolveLocalized,resolvePageGrid,resolvePropertyDefinitions,gl as resolveTextPattern,xn as resolveUtcDayBounds,resolveViewContents,Zs as resourceGrant,richtext,rollup,Qs as routedMessageInferenceSchema,sameActions,el as sameStableValue,schemaGroupKey,schemaStateSourcePayload,select,Hc as selectOptionWriteSchema,tl as serializeCanonicalJson,nl as serializeStableJson,$s as sessionInferencePatchSchema,settleLayout,sha256Hex,Sn as singleRelationTarget,ec as slackConditionSchema,tc as slackTriggerMatchSchema,snapWidth,Cn as sortsSchema,wn as sourcedAttributeOf,status,Uc as statusGroupSchema,Wc as statusOptionWriteSchema,storedContentDefinition,Tn as systemColumnFilterTarget,text,En as toMultiValueOperator,Dn as toUtcDayString,On as today,nc as todoItemSchema,rc as todoPlanSchema,ic as toolImpactSchema,user,ac as utf8ByteLength,ul as validateAttribute,xc as validateAttributeName,kn as validateContentViewCatalogue,dl as validateDraft,fl as validateDraftOrThrow,validateLabelExpression,pl as validateObject,validateObjectExpressions,validateObjectImage,wc as validateObjectName,ml as validateObjectOrThrow,An as validateQualifiedRule,jn as validateStoredViews,Tc as validateViewName,widthStepConstraint,Gc as wireHiddenTypeConfigMask,Kc as wireOmittedConfigKeysFor,withPreferenceEntry,withoutTrailingSlashes,qc as withoutUnknownOptionKeys,workspaceViewAuthoring};