@standards/schema 1.0.0-alpha.411 → 1.0.0-alpha.413

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 (91) hide show
  1. package/dist/{all-B606hHr3.mjs → all-B9epSh3g.mjs} +1 -1
  2. package/dist/{all-DaEjCqVl.d.ts → all-Cg6JJd0x.d.ts} +252 -252
  3. package/dist/{all-CuE-2q6r.d.mts → all-CkcnOJxd.d.mts} +252 -252
  4. package/dist/{all-C-dQf23e.js → all-iuPkq14_.js} +1 -1
  5. package/dist/api/index.d.mts +253 -97
  6. package/dist/api/index.d.ts +253 -97
  7. package/dist/api/index.js +1 -1
  8. package/dist/api/index.mjs +1 -1
  9. package/dist/{attributes-D4nvUmw6.d.ts → attributes-DW19xkoM.d.ts} +1 -1
  10. package/dist/{attributes-BgPCTw3y.d.mts → attributes-QBySx30F.d.mts} +1 -1
  11. package/dist/{checkbox-D11vN4kY.d.mts → checkbox-O7Onsazk.d.mts} +2 -2
  12. package/dist/{checkbox-DSAorFpa.d.ts → checkbox-u5bh3lq-.d.ts} +2 -2
  13. package/dist/{date-C29k_cah.d.ts → date-Bn8fqwCq.d.ts} +2 -2
  14. package/dist/{date-CtZVrU3Z.d.mts → date-D7JMxFgD.d.mts} +2 -2
  15. package/dist/{exceptions-CmMd5DGH.d.ts → exceptions-BHqt4Omx.d.mts} +3 -1
  16. package/dist/{exceptions-CmMd5DGH.d.mts → exceptions-BHqt4Omx.d.ts} +3 -1
  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-CCt_hCgK.d.ts → index-BFKJEyq-.d.ts} +1 -1
  22. package/dist/{index-BgJpzGaC.d.ts → index-C8VygCbt.d.ts} +5553 -5317
  23. package/dist/{index-CK8JL1dT.d.ts → index-Cc3a-97k.d.ts} +5 -3
  24. package/dist/{index-CKiYLDTp.d.mts → index-CkhBfmkf.d.mts} +5553 -5317
  25. package/dist/{index-BDMlzqIt.d.ts → index-CtmwL85u.d.ts} +3 -3
  26. package/dist/{index-CcFQSyk9.d.mts → index-DR5eSskq.d.mts} +5 -3
  27. package/dist/{index-Ckbiu3d9.d.mts → index-D_IPqiMd.d.mts} +3 -3
  28. package/dist/{index-B6XCKKgD.d.mts → index-jE6uAt4g.d.mts} +1 -1
  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/local-path-CDRPquGU.js +2 -0
  34. package/dist/local-path-PA4ZoNKq.mjs +2 -0
  35. package/dist/{number-g88uoxhJ.d.mts → number-DGfXEFnt.d.mts} +2 -2
  36. package/dist/{number-BGpvOweC.d.ts → number-DiV9wvFE.d.ts} +2 -2
  37. package/dist/{objects-Ddi_zEYp.d.mts → objects-B4OojzI4.d.mts} +2 -2
  38. package/dist/{objects-Bt5C4BNO.d.ts → objects-Cvd1pe1g.d.ts} +2 -2
  39. package/dist/record-aggregates-BrLE4IsX.mjs +2 -0
  40. package/dist/record-aggregates-BuOfVWPJ.js +2 -0
  41. package/dist/record-operation-B4DrBgkp.mjs +2 -0
  42. package/dist/record-operation-BA4V9LB0.js +2 -0
  43. package/dist/{text-Dyxn_QlR.d.mts → text-8GklpZzL.d.mts} +2 -2
  44. package/dist/{text-CMMMIBIT.d.ts → text-Biomo4m8.d.ts} +2 -2
  45. package/dist/{utils-mBdW0zGZ.d.mts → utils-BT8u9zYO.d.mts} +11 -1
  46. package/dist/{utils-Du85J1nY.d.ts → utils-CChBw_3d.d.ts} +11 -1
  47. package/dist/utils.d.mts +2 -2
  48. package/dist/utils.d.ts +2 -2
  49. package/dist/utils.js +1 -1
  50. package/dist/utils.mjs +1 -1
  51. package/dist/validation/all.d.mts +4 -4
  52. package/dist/validation/all.d.ts +4 -4
  53. package/dist/validation/all.js +1 -1
  54. package/dist/validation/all.mjs +1 -1
  55. package/dist/validation/complex/currency.d.mts +2 -2
  56. package/dist/validation/complex/currency.d.ts +2 -2
  57. package/dist/validation/complex/location.d.mts +2 -2
  58. package/dist/validation/complex/location.d.ts +2 -2
  59. package/dist/validation/complex/phone.d.mts +2 -2
  60. package/dist/validation/complex/phone.d.ts +2 -2
  61. package/dist/validation/complex/relation.d.mts +2 -2
  62. package/dist/validation/complex/relation.d.ts +2 -2
  63. package/dist/validation/complex/richtext.d.mts +2 -2
  64. package/dist/validation/complex/richtext.d.ts +2 -2
  65. package/dist/validation/complex/select.d.mts +2 -2
  66. package/dist/validation/complex/select.d.ts +2 -2
  67. package/dist/validation/complex/user.d.mts +2 -2
  68. package/dist/validation/complex/user.d.ts +2 -2
  69. package/dist/validation/computed/formula.d.mts +2 -2
  70. package/dist/validation/computed/formula.d.ts +2 -2
  71. package/dist/validation/computed/rollup.d.mts +2 -2
  72. package/dist/validation/computed/rollup.d.ts +2 -2
  73. package/dist/validation/config/index.d.mts +1 -1
  74. package/dist/validation/config/index.d.ts +1 -1
  75. package/dist/validation/core/index.d.mts +1 -1
  76. package/dist/validation/core/index.d.ts +1 -1
  77. package/dist/validation/object/index.d.mts +1 -1
  78. package/dist/validation/object/index.d.ts +1 -1
  79. package/dist/validation/primitives/checkbox.d.mts +1 -1
  80. package/dist/validation/primitives/checkbox.d.ts +1 -1
  81. package/dist/validation/primitives/date.d.mts +1 -1
  82. package/dist/validation/primitives/date.d.ts +1 -1
  83. package/dist/validation/primitives/number.d.mts +1 -1
  84. package/dist/validation/primitives/number.d.ts +1 -1
  85. package/dist/validation/primitives/text.d.mts +1 -1
  86. package/dist/validation/primitives/text.d.ts +1 -1
  87. package/package.json +2 -2
  88. package/dist/record-aggregates-Cl_62tuW.mjs +0 -2
  89. package/dist/record-aggregates-eFfvQOzG.js +0 -2
  90. package/dist/record-operation-BI3fiAdX.js +0 -2
  91. package/dist/record-operation-C-IkTR6T.mjs +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_TRANSFERS_KEY as d,DECISION_TYPES_V1 as f,DECISION_TYPE_ACCESS_GRANTED as p,DECISION_TYPE_AGENT_APPROVAL as m,DECISION_TYPE_AGENT_MESSAGE as h,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 g,DECISION_TYPE_PERSON as se,DECISION_TYPE_RECORD_ASSIGNED as ce,DECISION_TYPE_RECORD_MENTIONED as le,DECISION_WORK_STATES as ue,HIERARCHY_ATTRIBUTE_IDS as de,HIERARCHY_ATTRIBUTE_NAMES as fe,HIERARCHY_CHILD_IDS_LIMIT as pe,MAX_AGGREGATE_GROUPS as me,SYSTEM_ATTRIBUTES as he,SYSTEM_ATTRIBUTE_I18N_KEYS as ge,decisionThreadKey as _e,decisionTransferBy as ve,decisionTransfersOf as ye,formatDecisionLink as be,getHierarchyAttributes as xe,getObjectSystemAttributes as Se,getSystemAttributeI18nKey as Ce,getSystemAttributeList as we,isActionableDecisionKind as Te,isHierarchyAttribute as Ee,isManagedSystemAttribute as De,parseDecisionLink as Oe}from"./record-aggregates-Cl_62tuW.mjs";import{AGENDA_BLOCK as _,ARTIFACT_PREVIEW_EXTENSION as ke,ATTRIBUTE_FILTER_OPERATORS as Ae,ATTRIBUTE_TYPES as je,BLOCK_CONTEXTS as Me,BLOCK_PERIODS as Ne,BLOCK_WIDTHS as v,CARD_BLOCK as y,CHART_BLOCK as b,CHART_KINDS as Pe,CONTENT_PLACEMENT_CONTEXTS as Fe,DECISIONS_BLOCK as Ie,DEFAULT_LAYOUT_TRAITS as Le,GROUPABLE_ATTRIBUTE_TYPES as Re,HEADING_BLOCK as ze,INVENTORY_LIMIT as Be,LOCATION_FILTER_PROPERTIES as Ve,MAILBOX_BLOCK as He,MEASURABLE_ATTRIBUTE_TYPES as Ue,MEETINGS_UPCOMING_BLOCK as We,METRIC_BLOCK as x,NATIVE_BLOCKS as Ge,NO_VALUE_OPERATORS as Ke,OPERATORS_BY_TYPE as qe,PAGE_GRID_COLUMNS as Je,QUALIFIED_SEPARATOR as Ye,QUERY_OBJECT as Xe,RECORD_LINKS_BLOCK as Ze,RECORD_LINKS_CONTENT as S,RECORD_OBJECT as Qe,RELATION_TARGET_ANY as $e,REMOVED_OPERATOR_REPLACEMENTS as et,RecordQuery as tt,SYNONYM_ALIASES as nt,SYSTEM_FILTER_ATTRIBUTE_TYPES as rt,TEXT_BLOCK as C,attributeFilterTarget as it,attributeInventory as at,blockObjectInputs as ot,buildQualifiedAttribute as st,canonicalizeFilterValue as ct,capped as lt,collectContentViewCatalogue as ut,collectQualifiedRuleIssues as dt,collectionContentSourceSchema as ft,collectionSourceAddress as pt,collectionSourceAddressOf as mt,columnsSchema as ht,contentExtensionRegistry as w,contentReadObjects as gt,contentViewDefinitionSchema as T,contentViewDefinitionSchemaFor as _t,currentActor as vt,defineBlock as yt,describeViewIssue as bt,displayAttributesSchema as xt,draftContentViewDefinitionSchema as St,draftContentViewDefinitionSchemaFor as Ct,edgePropertyFilterTarget as wt,extractCurrencyFilterValue as Tt,extractFilterValue as Et,filterOperatorsOfType as Dt,filterStateSchema as Ot,filterTargetsOf as kt,findGridViolation as At,findGroupViolation as jt,findLayoutRuleViolation as Mt,findRelationAttribute as Nt,findRowLimitViolation as Pt,getAttributeCapabilities as Ft,getAttributeFilterOperators as It,getOperatorPolarity as Lt,getRollupFilterOperators as Rt,gridPositionSchema as zt,groupSizeMessage as Bt,groupedMembers as Vt,inferInverseCardinality as Ht,input as Ut,invalidViewMessage as Wt,isAttributeFilterable as Gt,isAttributeGroupable as Kt,isAttributeKanbanGroupable as qt,isAttributeSearchable as Jt,isAttributeSortable as Yt,isBilateralRelation as Xt,isCalendarDay as Zt,isCollectionContent as Qt,isDynamicValue as $t,isLocationFilterProperty as en,isLocationPartOperator as tn,isNoValueOperator as nn,isRelativeDateValue as rn,isSetMembershipOperator as an,isUniversalRelation as on,layoutTraitsOf as sn,locationPartFilterTarget as cn,memberlessGroups as ln,metricComparePeriod as un,normalizeFilterRule as dn,normalizeForEdgeRpc as fn,normalizeOperator as pn,now as mn,overlaps as hn,pageTraitsOf as gn,parseBlockParameters as E,parseQualifiedAttribute as _n,publishedViewContentDefinitionSchema as D,query as vn,recordQueryDefinitionSchema as yn,relationAcceptsObject as bn,relationTargetsOf as xn,requireContentPlacement as Sn,requireRecordContentContext as Cn,requireSingleRelationTarget as wn,resolveCollectionActions as Tn,resolveContentNavigation as En,resolveEffectiveFilterType as Dn,resolveIsWithinBounds as On,resolveUtcDayBounds as kn,singleRelationTarget as An,sortsSchema as jn,sourcedAttributeOf as Mn,systemColumnFilterTarget as Nn,toMultiValueOperator as Pn,toUtcDayString as Fn,today as In,validateContentViewCatalogue as Ln,validateQualifiedRule as Rn,validateStoredViews as zn}from"./all-B606hHr3.mjs";import{AccessDeniedError as Bn,AggregateValidationError as Vn,AmbiguousSchemaChangeError as Hn,AttributeInUseError as Un,AttributeNotFoundError as Wn,ConcurrentModificationError as Gn,DuplicateError as O,ExportTooLargeError as Kn,ForbiddenError as qn,InvalidPermissionGrantError as Jn,LogoProviderUnavailableError as Yn,LogoSearchRateLimitedError as Xn,MemoryNotFoundError as Zn,NotFoundError as Qn,NotImplementedError as $n,ObjectNotFoundError as er,ObjectReferencedError as tr,OrphanSystemAttributeError as nr,PageReferencedError as rr,ProtectedResourceError as ir,ProtectedRoleError as ar,QueryTimeoutError as or,RealtimeDeliveryError as sr,RealtimeRateLimitedError as cr,RealtimeSubscriptionError as lr,RecordNotFoundError as ur,RecordReferencedError as dr,RepositoryError as fr,ReservedObjectNameError as k,RoleNotFoundError as pr,SchemaError as A,SchemaErrorCode as j,SearchBackendError as mr,SearchPathNotIndexedError as hr,StorageError as gr,SyncCascadeError as _r,SyncConflictError as vr,SyncError as yr,SystemEntityImmutableError as br,ToolGroupGrantError as xr,ValidationError as M,WorkspaceInvariantReason as Sr,isAttributeInUseError as Cr,isNotFoundError as wr,isObjectReferencedError as Tr,isProtectedResourceError as Er,isRecordReferencedError as Dr,isSchemaError as Or,isValidationError as kr}from"./exceptions.mjs";import{ACCESS_LEVELS as Ar,ACCESS_ROLES as jr,AGENT_ASIDE_ANSWER_MAX_LENGTH as Mr,AGENT_ASIDE_HISTORY_LIMIT as Nr,AGENT_ASIDE_QUESTION_MAX_LENGTH as Pr,AGENT_AVATAR_EXPRESSIONS as Fr,AGENT_AVATAR_TYPES as Ir,AGENT_MESSAGE_KIND as Lr,AGENT_NOTIFICATION_KIND as Rr,AGENT_SESSION_ACCESS_ROLES as zr,AGENT_SESSION_LIST_ORDERS as Br,AGENT_SESSION_ORIGINS as Vr,AGENT_SESSION_PROVENANCES as Hr,AGENT_STARTERS_MAX as Ur,AGENT_STARTER_MAX_LENGTH as Wr,AGENT_SYSTEM_PROMPT_MAX_LENGTH as Gr,AGENT_TASK_KINDS as Kr,ALL_CATALOG_TOOL_NAMES as qr,ALWAYS_KINDS as Jr,APPROVAL_FAMILY_TOOL_NAMES as Yr,ARCHITECT_PUBLICATION_KIND as Xr,ASK_QUESTIONS_ANSWER_MAX_LENGTH as Zr,ASK_QUESTIONS_ANSWER_MAX_VALUES as Qr,ASK_QUESTIONS_MAX_BATCH as $r,ASK_QUESTIONS_TOOL_NAME as ei,AUDIT_ACTIONS as ti,AUDIT_AGENT_SESSION_METADATA_KEY as ni,AUDIT_RESOURCE_TYPES as ri,AgentBuilder as N,BROWSER_LAUNCH_TOOL_NAME as ii,BROWSER_TOOL_NAMES as ai,BUNDLE_LOCALES as oi,CONNECTION_GRANT_PROVIDERS as si,CONTINUATION_KEY_PATTERN as ci,CONVERSATION_SURFACES as li,COPY_VERB_NAME as ui,CORE_RECORD_TOOL_NAMES as di,CORE_TOOL_NAMES as fi,COUNT_MODES as pi,DEFAULT_AGENT_EXECUTION_CONFIG as mi,DEFAULT_AGENT_TOOL_GROUPS as hi,DEFAULT_APPROVAL_POLICY as gi,DEFAULT_BLUEPRINT_TOOL_GROUPS as _i,DEFAULT_DAILY_ACTIVITY_DAYS as vi,DEFAULT_MEETING_BOT_DISPLAY_NAME as yi,DEFAULT_PROACTIVE_TENANT_MONTHLY_LIMIT_USD as bi,DEFAULT_TENANT_SETTINGS as xi,DEVICE_ACCESS_ROLES as Si,DISCARD_ARCHITECT_DRAFT_TOOL_NAME as Ci,DOCUMENT_SORT_MODES as wi,DRAFT_WRITE_TOOL_NAMES as Ti,EMAIL_CATEGORY_DEFAULT_COLOR as Ei,EMAIL_CATEGORY_DEFAULT_ICON as Di,EMAIL_CATEGORY_DESCRIPTION_MAX as Oi,EMAIL_CATEGORY_DESCRIPTION_MIN as ki,EMAIL_CATEGORY_LIMIT as Ai,EMAIL_CATEGORY_NAME_MAX as ji,ENVIRONMENT_BUILD_LOG_STEP_PREFIX as Mi,ENVIRONMENT_HARNESSES as Ni,ENVIRONMENT_HARNESS_SANDBOX_WORKDIR as Pi,ENVIRONMENT_HARNESS_WORKDIR as Fi,ENVIRONMENT_IMAGES as Ii,ENVIRONMENT_MEMORY_GB_PER_VCPU as Li,ENVIRONMENT_NAME_MAX_CHARS as Ri,ENVIRONMENT_NETWORK_ALLOW_MAX as zi,ENVIRONMENT_SCRIPT_MAX_BYTES as Bi,ENVIRONMENT_SIZES as Vi,ENVIRONMENT_SIZE_VCPUS as Hi,ENVIRONMENT_STANDARDS_WORKDIR as Ui,ENV_VAR_KEY_PATTERN as Wi,ESTIMATED_COUNT_CAP as Gi,FILE_URLS_MAX_IDS as Ki,GET_ARCHITECT_DRAFT_TOOL_NAME as qi,GITHUB_TRIGGER_CATALOG as Ji,GRANT_ENABLES as Yi,HITL_TOOL_NAMES as Xi,INFERENCE_REASONING_OPTIONS as Zi,INFERENCE_ROUTING_MODES as Qi,INFERENCE_SPEEDS as $i,LAST_RUN_ERROR_MAX_LENGTH as ea,MAILBOX_LIST_MODES as ta,MAIL_DRAFT_BODY_MAX_CHARS as na,MAIL_SIGNATURE_MAX_CHARS as ra,MAIL_SUBJECT_MAX_CHARS as ia,MAX_DAILY_ACTIVITY_DAYS as aa,MAX_TODOS as oa,MAX_TODO_DESCRIPTION_CHARS as sa,MAX_TODO_ID_CHARS as ca,MCP_SERVER_NAME_MAX_LENGTH as la,MEETING_BOT_IMAGE as ua,MEETING_BOT_IMAGE_BASE64_MAX_LENGTH as da,MEETING_BOT_SILENT_REASON as fa,MEETING_RESPONSES as pa,MEMORY_SPEND_LIMIT_PATTERN as ma,McpOAuthCompletionMode as ha,NATIVE_TOOL_GROUPS as ga,NATIVE_TOOL_GROUP_CATALOG as _a,NO_RECORDING as va,OPEN_TOOL_PART_STATES as ya,OPERATION_MAX_STEPS as ba,PROACTIVE_AGENT_NAMES as xa,PROVIDER_DRAFT_LABEL as Sa,PROVIDER_NAMES as Ca,PUBLIC_MAIL_DOMAINS as wa,QUESTION_FAMILY_TOOL_NAMES as Ta,RECENT_ACTIVITY_LEDGER_LIMIT as Ea,RECIPIENT_IDENTITIES_MAX as Da,RECORDING_OVERRIDES as Oa,RECORDING_POLICIES as ka,RECORD_ACCESS_ROLES as Aa,RECORD_ACCESS_SOURCES as ja,RECORD_DRIVE_CURSOR_MAX_LENGTH as Ma,RECORD_DRIVE_PAGE_DEFAULT_LIMIT as Na,RECORD_DRIVE_PAGE_MAX_LIMIT as Pa,RECORD_GRAPH_DEFAULT_LIMIT_PER_NODE as Fa,RECORD_GRAPH_MAX_LIMIT_PER_NODE as Ia,RECORD_GRAPH_MAX_NODES as La,RECORD_IMAGE_MAX_BYTES as Ra,REPLY_MODES as za,REQUEST_DESIGN_REVIEW_TOOL_NAME as Ba,REQUEST_SETUP_TOOL_NAME as Va,RESOURCE_GRANT_KINDS as Ha,RESOURCE_KIND_CATALOG as Ua,ROUTING_PRICE_CEILINGS as Wa,SEND_VERB_NAME as Ga,SESSION_INFERENCE_PATCH_KEYS as Ka,SLACK_TRIGGER_CATALOG as qa,SPEAKS_THROUGH_SEND_METADATA_KEY as Ja,SURFACE_TOOL_NAMES as Ya,SYSTEM_EMAIL_CATEGORIES as Xa,SYSTEM_EMAIL_CATEGORY_NAMES as Za,SYSTEM_PART_CODES as Qa,TASK_DEMAND_LEVELS as $a,TODO_PHASES as eo,TODO_PLAN_STATUSES as to,TODO_STATUSES as no,TOOL_APPROVAL_STATES as ro,TRIAGE_ACTIONS as io,TRIGGER_EVENT_TYPES as ao,TURN_OUTCOMES as oo,UNSHAREABLE_OBJECT_NAMES as so,USERS_RESOLVE_MAX_IDS as co,USER_STATUSES as lo,USER_WORK_POSTURES as uo,VERB_NAMES as fo,agent as po,agentAvatarFromMetadata as mo,agentAvatarSchema as ho,agentDataChunk as go,agentDisplayName as _o,agentInferencePreferencesSchema as vo,agentMessageAttachmentSchema as yo,agentMessagePartSchema as bo,agentScheduleSchema as xo,agentSessionInferenceOverridesInputSchema as So,agentSessionInferenceOverridesSchema as Co,agentSessionMessageSchema as wo,agentStartersSchema as To,agentTriggerBaseSchema as Eo,agentTriggerPatchSchema as Do,agentTriggerSchema as Oo,agentUIValidationError as ko,artifactQuoteSchema as Ao,askQuestionsOutputSchema as jo,assertCustomAgentUIMessageChunk as Mo,assertSessionState as No,canonicalToolGroups as Po,classificationRestoreSchema as Fo,classifyEmailSchema as Io,cliDefaultModelOf as Lo,compareAgentSessionMessages as Ro,compiledHarnessModels as zo,connectionGrantKindsOf as Bo,connectorTriggerMatchSchema as Vo,customDataChunkSchemas as Ho,decodeAgentSessionListCursor as Uo,deriveViewerAccess as Wo,durableDateSchema as Go,emailCategoryCreateSchema as Ko,emailCategoryDeleteSchema as qo,emailCategoryScopeQuerySchema as Jo,emailCategoryUpdateSchema as Yo,emailRuleScopeSchema as Xo,encodeAgentSessionListCursor as Zo,environmentHarness as Qo,environmentWorkdir as $o,findEnvironmentHarness as es,githubConditionSchema as ts,githubTriggerMatchSchema as ns,grantKindOf as rs,harnessModelChoices as is,humanRequestId as as,humanRequestKind as os,imageModelIdSchema as ss,inferenceReasoningSchema as cs,inferenceRoutingSchema as ls,inferenceSpeedSchema as us,isAgentMessageMetadata as ds,isAgentNotificationMetadata as fs,isAgentUIDataName as ps,isAgentWrittenAuditEntry as ms,isArchitectPublicationMetadata as hs,isAwaitingHuman as gs,isBlocking as _s,isEnvironmentHarnessId as vs,isMailProvider as ys,isMailboxListMode as bs,isNativeToolGroup as xs,isOpenToolPartState as Ss,isParkedOnHuman as Cs,isProviderDraft as ws,isPublicMailDomain as Ts,isQuestionPart as Es,isReplyMode as Ds,isResourceGrant as Os,isRoutineActorMetadata as ks,isSessionInferencePatch as As,isSystemEmailCategory as js,isSystemEmailCategoryName as Ms,isSystemPartCode as Ns,isToolApprovalState as Ps,lockingSendCall as Fs,meetingBotDispatchRequestSchema as Is,meetingBotDispatchResponseSchema as Ls,meetingBotNotificationSchema as Rs,meetingTranscriptSegmentSchema as zs,mentionReferenceSchema as Bs,mergeSessionInferencePatch as Vs,modelDefinitionSchema as Hs,modelReferenceSchema as Us,needsManageWhenUnattended as Ws,normalizedMeetingTranscriptSchema as Gs,openRequests as Ks,orderAgentSessionMessages as qs,parseAgentDefinitionAccessRole as Js,parseAgentSessionAccessRole as Ys,parseCountMode as Xs,parseDeviceAccessRole as Zs,parseMergedAgentTrigger as Qs,parseOptionalCountMode as $s,parsePageAccessRole as ec,parseRecordAccessRole as tc,parseToolGroupGrant as nc,providerNameSchema as rc,readAskQuestionsResult as ic,recentActivityEntryKey as ac,recordGraphNodeKey as oc,recordGraphRequestSchema as sc,recordMeetingsCount as cc,recordOperationSchema as lc,refineTrigger as uc,resourceGrant as dc,routedMessageInferenceSchema as fc,sessionInferencePatchSchema as pc,slackConditionSchema as mc,slackTriggerMatchSchema as hc,todoItemSchema as gc,todoPlanSchema as _c,toolImpactSchema as vc,utf8ByteLength as yc}from"./record-operation-C-IkTR6T.mjs";import"./zod-locale.mjs";import{ATTRIBUTE_NAME_SCHEMA as bc,LIST_VIEW_TAB_VISIBILITIES as xc,NATIVE_OBJECT_NAMES as Sc,OBJECT_NAME_SCHEMA as Cc,RECORD_LIST_SCOPES as wc,RESERVED_ATTRIBUTE_NAMES as Tc,RESERVED_OBJECT_NAMES as Ec,RESOURCE_VISIBILITIES as Dc,SCHEMA_LIMITS as P,SYSTEM_FIELD_NAMES as Oc,assertUniqueBy as kc,colorIdSchema as Ac,iconNameSchema as F,isNativeObjectName as I,isPlainRecord as jc,parseRecordListScope as Mc,parseResourceVisibility as Nc,validateAttributeName as Pc,validateIconName as Fc,validateLabel as Ic,validateObjectName as Lc,validateOptions as L,validateViewName as Rc}from"./primitives-BCJLtpaI.mjs";import{COMPUTED_RETURN_TYPES as zc,SIMPLE_PROPERTY_TYPES as Bc,WIRE_OFFERED_BASE_CONFIG as Vc,WIRE_OMITTED_CONFIG_KEYS as Hc,attributeConfigSchemas as Uc,datePrecisionIssues as Wc,getAttributeConfigSchema as Gc,getAttributeConfigWriteSchema as Kc,parseAttributeConfig as qc,parseAttributeConfigForCreate as Jc,parseAttributeConfigForUpdate as Yc,propertyAttributeSchema as Xc,propertyAttributeWireSchema as Zc,propertySchemaSchema as Qc,propertySchemaWireSchema as $c,refuseForeignKeys as el,selectOptionWriteSchema as tl,statusGroupSchema as nl,statusOptionWriteSchema as rl,wireHiddenTypeConfigMask as il,wireOmittedConfigKeysFor as al,withoutUnknownOptionKeys as ol}from"./config-iUwnquKr.mjs";import{NonJsonValueError as sl,asTenantId as cl,asUserId as ll,canonicalStringify as R,deepEqual as ul,generateId as dl,indexBy as fl,sameStableValue as pl,serializeCanonicalJson as ml,serializeStableJson as hl}from"./utils-DaejNWxh.mjs";import{createAttributeValidator as gl,createFormAttributeValidator as _l,createObjectValidator as vl,isEmptyValue as yl,isNullishOrEmptyString as bl,isValuePresent as xl,rejectUnknownAttributesOrThrow as Sl,validateAttribute as Cl,validateDraft as wl,validateDraftOrThrow as Tl,validateObject as El,validateObjectOrThrow as Dl}from"./object-BF5y6bgs.mjs";import{TEXT_FORMAT_PATTERNS as Ol,resolveTextPattern as kl}from"./text-BaxaZ5Vv.mjs";import{DEFAULT_VALIDATION_MESSAGES as Al,formatZodErrors as jl}from"./core-rKI7Q9_U.mjs";import{formatPhoneForDisplay as Ml,getIso2 as Nl,normalizeCountrylessPhoneNumber as Pl,normalizePhoneNumber as Fl}from"./phone-BGJea5sr.mjs";import*as z from"zod";import{colorIdFromString as Il,getCountryByIso2 as Ll,isValidCurrencyCode as Rl,isValidIso3 as zl}from"@standards/constants";import{parsePhoneNumberFromString as Bl}from"libphonenumber-js";const Vl=`__stndrdsNativeUiPartIds`,Hl=1;function invalidNativePartIds(){throw new M(`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?.[Vl];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 Ul=`/v1/device-worker/channel`,Wl=262144,Gl=1e4,Kl=2e3,ql=2e3,Jl=2e4,Yl=4008,Xl={initialMs:1e3,maxMs:3e4};function deviceChannelUrl(e){let t=new URL(e);return`${t.protocol===`https:`?`wss:`:`ws:`}//${t.host}${Ul}`}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,Xl)}const Zl=[`worker_disconnected`,`cancelled`,`timed_out`,`execution_failed`];var DeviceChannelProtocolError=class extends A{constructor(e){super(e,j.DEVICE_CHANNEL_PROTOCOL),this._tag=`DeviceChannelProtocolError`,this.name=`DeviceChannelProtocolError`}};const Ql=[`zsh`,`bash`,`sh`,`fish`,`pwsh`,`powershell`],$l=[`ready`,`permission_missing`,`no_session`,`unavailable`],eu=z.strictObject({state:z.enum($l),version:z.string().min(1)}),B={id:z.uuid(),leaseToken:z.string().min(1)},tu=z.discriminatedUnion(`type`,[z.strictObject({type:z.literal(`authenticate`),credential:z.string().regex(/^Device \S+$/),protocol:z.number().int().positive().optional(),desktop:eu.optional(),shell:z.enum(Ql).optional()}),z.strictObject({type:z.literal(`running`),...B}),z.strictObject({type:z.literal(`heartbeat`),...B}),z.strictObject({type:z.literal(`output`),...B,stdout:z.string().optional(),stderr:z.string().optional()}),z.strictObject({type:z.literal(`complete`),...B,result:z.strictObject({stdout:z.string().optional(),stderr:z.string().optional(),exitCode:z.number().int(),success:z.boolean(),errorCode:z.enum(Zl).optional()}),background:z.strictObject({pid:z.number().int(),logPath:z.string().min(1)}).optional()}),z.strictObject({type:z.literal(`pong`)})]),nu=z.discriminatedUnion(`type`,[z.strictObject({type:z.literal(`ready`),device:z.strictObject({id:z.string(),name:z.string(),capability:z.enum([`shell`,`browser`])}),protocol:z.number().int().positive().optional()}),z.strictObject({type:z.literal(`command`),...B,kind:z.enum([`shell`,`browser`]),intent:z.string(),timeoutMs:z.number().int(),command:z.string().optional(),cwd:z.string().nullable().optional(),rootSessionId:z.string().min(1).optional(),background:z.boolean().optional()}),z.strictObject({type:z.literal(`release_session`),rootSessionId:z.string().min(1)}),z.strictObject({type:z.literal(`cancel`),id:z.uuid(),reason:z.enum([`cancelled`,`timed_out`,`revoked`])}),z.strictObject({type:z.literal(`reauthenticate`)}),z.strictObject({type:z.literal(`revoked`)}),z.strictObject({type:z.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(tu,e)}function parseServerFrame(e){return parseDeviceChannelFrame(nu,e)}const ru=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 V=[`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 moveWidensAudience(e){return e.added.length>0||!e.workspaceBefore&&e.workspaceAfter}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 M(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>P.labelLength&&refuse$2(`Label is too long (max ${P.labelLength} characters)`),n.label=t}}return n}const H=/^(?:core|bundle:.+)$/u;function parseSchemaOwner(e){if(e===null)return null;if(!H.test(e))throw new M(`Invalid schema owner "${e}"`,[]);return e}const iu=16e3,au=3200,ou=6400,su=16e3,cu=65536,lu=15e3,uu=1e4,du=5e3,fu=`google/gemini-3.5-transcribe-live`,pu={maxDurationMs:3e5,dailyDurationMs:36e5,monthlyDurationMs:72e6,tenantMonthlyBudgetMicrousd:5e7,globalMonthlyBudgetMicrousd:5e7,estimatedMicrousdPerSecond:150,reservationMultiplier:2},mu=[`web`,`presentation`,`document`,`spreadsheet`,`image`,`code`,`other`],hu=[`ephemeral`,`conversation`,`persistent`],gu=[`source`,`preview`,`entrypoint`,`asset`];var NoopGeocodingAdapter=class{async autocomplete(){return await Promise.resolve([])}async geocode(){return await Promise.resolve(null)}};const _u=6048e5,vu=36e5,yu=2592e6,bu=6e4,xu=[`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 wu=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(!wu.includes(e.type))throw Error(`Property type "${e.type}" is not supported in .qualifyWith()`);t.push(e)}return{definitions:t}}const Tu=[`UPPER`,`LOWER`,`capitalize`,`trim`],Eu=[`prefix`,`suffix`,`wrap`,`default`],U=[...Tu,...Eu],Du=/^\s*where\s*(?::(.*))?$/s,Ou=`[A-Za-z_][A-Za-z0-9_]*`,ku=/^[^\s,()|{}="']+$/,Au=RegExp(`^(${Ou})\\s*=\\s*(.*)$`),ju=RegExp(`^(${Ou})\\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(ju);if(n){let e=n[2].split(`,`).map(e=>e.trim());return e.every(e=>ku.test(e))?{property:n[1],values:e}:null}let r=t.match(Au);return r&&ku.test(r[2])?{property:r[1],values:[r[2]]}:null}const W=z.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(!U.includes(e))return!1}return!0},{message:`Invalid pipe name. Valid pipes: ${U.join(`, `)}`});function validateLabelExpression(e){let t=W.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 Mu=`(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=Mu){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 Nu=/^\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}$/;function getSingleAttributeFromExpression(e){let t=e.trim().match(Nu);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`||Ft(r).authoring.readOnly?null:r}const Pu=[{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:`devices`,resources:[`devices`],levels:[{id:`manage`,add:[`manage`]}]}]},{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`]}]}]}],G=`none`,Fu=`custom`,K={actions:[`read`,`create`,`update`,`delete`],purge:`manage`,levels:[{id:`read`,add:[`read`]},{id:`edit`,add:[`create`,`update`]},{id:`full`,add:[`delete`]}]},q=Pu.flatMap(e=>e.capabilities),Iu=q.flatMap(e=>e.resources),Lu=new Map(q.flatMap(e=>e.resources.map(t=>[t,e])));function isCatalogResource(e){return Lu.has(e)}function capabilityForResource(e){let t=Lu.get(e);if(!t)throw new A(`Unknown catalog resource "${e}"`,j.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=G;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 G;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 Fu}const Ru=[`read`,`create`,`update`,`delete`,`manage`],zu=z.object({scope:z.enum([`object`,`system`]),target:z.string().min(1),actions:z.array(z.enum(Ru))}).strict();function findGrantIssues(e,t){let n=[],r=new Map;for(let i of e){let e=zu.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===`*`?[...K.actions,K.purge]:K.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 Bu=`memory`,Vu=4e3,Hu=`workspace`,J={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[J.name]),description:textValue(t[J.description]),content:textValue(t[J.content]),visibility:e.visibility,ownedBy:e.ownedBy,updatedAt:new Date(e.updatedAt).toISOString()}}const Uu=`@standards/schema`;function createStandardSchemaProps(e){return{version:1,vendor:Uu,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(gl(this.build()))}constructor(e,t,n){Pc(t),Ic(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 Fc(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]=Wc(`date`,this.attr);if(e!==void 0)throw new M(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 L(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 L(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 L(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 L(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 L(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 L(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(on(this.attr))throw Error(`Bilateral relations are not supported for universal relations (.toAny()).`);let n=t[0]?.object;if(!n)throw new M(`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 M(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 A(`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}").`,j.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 Wu=/^[a-z0-9][a-z0-9-]{0,62}$/,Gu=`core`;function assertBundleName(e){if(!Wu.test(e))throw new M(`Invalid bundle name "${e}": expected a lowercase slug matching ${Wu}`,[]);if(e===`core`)throw new M(`Bundle name "${Gu}" 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 M(e,[{path:t,message:e}])}}function requireBuilderName(e,t){if(typeof e!=`string`||e.trim().length===0)throw new M(`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 M(`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 M(e,[{path:[...t,n],message:e}])}let n=D.safeParse({...e,name:`content`,placement:e.type===`group`?`grid`:`main`});if(!n.success)throw M.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 M(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 M?new M(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 M(`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&&E({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`]),E(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 Ku={"7d":7,"30d":30};var AgendaBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}next(e){let t=typeof e==`number`?e:Ku[e];if(!Number.isInteger(t)||t<1){let e=`An agenda looks ahead a whole number of days, at least 1`;throw new M(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(C,checkInputs(C,{markdown:e}))}function decisions(){return new DecisionsBuilder(Ie,{})}function meetingsUpcoming(){return new MeetingsUpcomingBuilder(We,{})}function mailbox(){return new MailboxBuilder(He,{})}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 M(t,[{path:e,message:t}])}function traitsOf(e,t=[]){return sn(e,w,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(ze,r),span:12}}function groupOf(e,t,n){let[r]=e.map(e=>e.name).sort(),i=Bt(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`),Sn(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 qu=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 M.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 qu({name:e,label:t,object:void 0,sections:[]})}var Y=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 M.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`])),Sn(t,this.extensions[n],t.name,this.data.context,r)}),{kind:`view`,definition:cloneBuilderValue(this.data,e)}}};function detailView(e,t){return new Y({name:e,label:t,object:void 0,context:`record`,contents:[]})}function listView(e,t){return new Y({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 N)}function assertPiece(e,t){if(typeof e!=`object`||!e)throw new M(`Unsupported bundle piece: ${t}`,[]);if(isViewPiece(e)||e instanceof N||typeof e.build==`function`)return;let n=e.name;throw new M(`Unsupported bundle piece: ${typeof n==`string`?n:String(t)}`,[])}function declarationOf$1(e){return e instanceof qu||e instanceof Y?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=M.fromZodErrors(t.error.issues.map(e=>({path:e.path.map(String),message:e.message})));throw new M(`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 O(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(R({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===Gu;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(I);if(e!==void 0)throw new k(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 Ju=Symbol.for(`standards.bundle`);function isBundle(e){return typeof e==`object`&&!!e&&e[Ju]===!0}var BundleBuilder=class{constructor(e,t){this[Ju]=!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 N)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 O(`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 Yu=z.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=z.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 z.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=[...U,`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 M(`[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(Yu.safeParse(n.readOnly).success)continue;let t=isFormFreeFieldRef(n)?n.attribute.name:n.attribute,r=isFormFreeFieldRef(n)?`free field`:`field`;throw new M(`[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(V);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: ${V.join(`, `)}`)}}}};function form(e,t){return new FormBuilder(e,t)}const Xu=`box`,Zu=[`circle`,`square`],Qu=[`upload`,`website`,`name`,`email`];function isImageSource(e){return Qu.some(t=>t===e)}const $u={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?Il(r):void 0),a=e.icon??t?.icon??`box`;return i?{kind:`tile`,icon:a,color:i}:{kind:`glyph`,icon:a}}const ed=z.object({shape:z.enum(Zu),from:z.array(z.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 M(`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 A(`Object "${t}" must have a labelExpression. The labelExpression defines how records are displayed in lists and relations (e.g. "{{ name }}").`,j.VALIDATION_FAILED);let i=W.safeParse(n);if(!i.success){let e=i.error.issues[0]?.message??`Invalid labelExpression`;throw new A(`Invalid labelExpression for "${t}": ${e}`,j.VALIDATION_FAILED)}if(r!==void 0){let e=W.safeParse(r);if(!e.success){let n=e.error.issues[0]?.message??`Invalid embeddingExpression`;throw new A(`Invalid embeddingExpression for "${t}": ${n}`,j.VALIDATION_FAILED)}}}var ObjectBuilder=class{get"~standard"(){return createStandardSchemaProps(vl(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);kc([...this.obj.attributes,...t],e=>e.name,e=>new O(`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}hierarchical(){return this.obj.hierarchical=!0,this}build(){if(!this.obj.name)throw new M(`[ObjectBuilder] Missing required field: name`,[{path:[`name`],message:`name is required`}]);if(!this.obj.label)throw new M(`[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&&Lc(e)}};function object(e,t){if(I(e))throw new k(e,`builder`);return new ObjectBuilder(e,t)}function validatePresetStructure(e,t,n){let fail=(t,n)=>{throw new M(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 X=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`&&E(this.extension,e.parameters,[`content`,`parameters`]),e}},td=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})}alwaysOpen(){let{collapsed:e,...t}=this.presentation();return new GroupBuilder(this.data.name,this.data.label,this.data.fields,{...t,collapsible:!1})}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 M?new M(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 td(e,t,[])}function collection(e){return new X({type:`collection`,...storedQuery(e,`collection`)})}function form$1(...e){return new X({type:`form`,groups:e.map(e=>`build`in e?e.build():e)})}function activity(){return new X({type:`activity`})}function richtext$1(e){return new X({type:`richtext`,attribute:e})}function documents(){return new X({type:`documents`})}function forms(){return new X({type:`forms`})}function emails(...e){return new X({type:`emails`,emailAttributes:e})}function meetings(...e){return new X({type:`meetings`,emailAttributes:e})}function custom(e,t){if(typeof e!=`object`||!e||typeof e.name!=`string`)throw new M(`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 M(`Expected custom content`,[]);let r=new X({...n,extension:e.name},e);return r.build(),r}function recordLinksTab(){return[S.name,S.label,custom(Ze,{}).icon(S.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 M(e,[{path:[`content`,`page`,`object`],message:e}])}return new X({type:`page`,page:{object:t,name:n}})}const nd={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<=P.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<=P.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=ln(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??gn(s,w),l=Vt([...s.values()]),u=o.filter(e=>!l.has(e.name)),d={},f=[],place=(e,t)=>{t&&!Object.values(d).some(e=>hn(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=ln(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 Z=[`record`,`document`,`file`,`email`,`thread`,`event`,`memory`,`skill`,`schema`,`user`,`guide`,`bundle`,`draft`,`decision`,`session`],rd=new Set([`memory`,`schema`]),id=/^[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 Z.includes(e)}function refuse$1(e,t){return{ok:!1,reason:e,expected:t}}function parseReference(e){let t=e.trim();if(id.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 ${Z.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===`*`&&!rd.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===`*`&&rd.has(e.kind)}function requestedCapabilities(e){let t=[];return e.canModify&&t.push(`modify`),e.canSend&&t.push(`send`),t}const ad={status:`connector_status`,error:`connector_error`,provider:`connector_provider`},od={phone:`text`,currency:`number`},sd={rename:[`kind`,`object`,`from`,`to`],phone:[`kind`,`object`,`attribute`,`to`,`defaultCountryCode`],currency:[`kind`,`object`,`attribute`,`to`,`currencyCode`]};function refuse(e,t,n){throw new M(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(jc(t)||refuse(e,void 0,`Resolution ${e} must be an object`),t.kind===`rename`){assertKeys(e,t,sd.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,sd[t.to]),t.to===`phone`){let n=t.defaultCountryCode;/^[A-Z]{3}$/.test(n)&&zl(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)&&Rl(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 M("`resolutions` must be an array",[{path:[`resolutions`],message:"`resolutions` must be an array"}]);if(e.length>100)throw new M(`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=Bl(n,Nl(t));if(!r?.isPossible()||r.country===void 0||r.ext!==void 0)return;let i=Ll(r.country)?.iso3;if(i!==void 0)return{value:{countryCode:i,phoneNumber:Fl(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=z.string().refine(e=>e.trim().length>0,`Must not be blank`),cd=z.union([z.tuple([z.literal(`object`),Q]),z.tuple([z.literal(`attribute`),Q,Q]),z.tuple([z.literal(`view`),Q,Q]),z.tuple([z.literal(`content`),Q,Q,Q])]),ld=z.object({label:Q,pluralLabel:z.string().optional(),description:z.string().optional(),icon:F.optional(),color:Ac.optional(),image:ed.optional(),labelExpression:z.string(),embeddingExpression:z.string().optional(),sealed:z.boolean().optional(),toleratedAttributes:z.array(Q).optional(),metadata:z.record(z.string(),z.unknown()).optional(),documentLayout:z.record(z.string(),z.unknown()).optional(),hierarchical:z.boolean().optional()}).strict();function failure(e){throw new M(e,[])}function definitionSchema(e){return z.custom(t=>{let n=z.record(z.string(),z.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`:ld.parse(n);break;case`attribute`:{let e=z.enum(je).parse(n.type);Gc(e).extend({type:z.literal(e),label:Q,required:z.boolean().optional(),unique:z.boolean().optional(),icon:F.optional()}).strict().parse(n);break}case`view`:{let{contents:t,...r}=n,i=z.array(Q).parse(t);new Set(i).size!==i.length&&failure(`Invalid schema state: duplicate content membership`),St.parse({...r,object:e[1],name:e[2],contents:[]});break}case`content`:D.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=z.record(z.string(),z.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=z.object({modelVersion:z.literal(1),hashVersion:z.literal(1),tenant:Q,sourceFingerprint:z.string().regex(/^[a-f0-9]{64}$/),entries:z.array(z.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]}`),M.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=cd.parse(z.object({address:z.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`?z.object({id:z.string().uuid(),updatedAt:z.string().datetime()}).strict():z.object({id:z.string().uuid(),revision:z.number().int().nonnegative()}).strict(),o=z.object({address:cd,source:i,effective:i,status:z.enum([`source`,`runtime`,`copy`,`suppressed`]),sourceOwner:z.string().regex(H).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 z.ZodError?M.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`:R(n.source)===R(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 $=z.string().min(1),ud=z.union([z.object({objectName:$,viewName:$,contentName:$.optional()}).strict().describe(`Full configuration of a view, or of one content when contentName is given`),z.object({objectId:$}).strict().describe(`An object with its attributes, by id`),z.object({objectName:$}).strict().describe(`An object with its attributes`),z.object({objectId:$,attributeName:$}).strict().describe(`One attribute's config, by name`),z.object({objectId:$,attributeId:$}).strict().describe(`One attribute's config, by id`),z.object({objectId:$,recordId:$}).strict().describe(`One sample record`)]);function parseNamedTarget(e){let t=ud.safeParse(e);if(!t.success)throw new M(`Invalid scoped target`,[{path:[`target`],message:`Expected exactly one named target branch`}]);return t.data}const dd=[`object`,`attribute`,`view`,`content`,`sample`],fd=z.object({mode:z.enum([`inline`,`window`]),interaction:z.enum([`static`,`interactive`]),size:z.enum([`compact`,`regular`]),aspectRatio:z.number().positive().finite().optional()}).strict(),pd=z.object({artifactId:z.string().min(1),revision:z.number().int().positive(),name:z.string().min(1),kind:z.string().min(1),retention:z.enum(hu),display:fd}).strict();function readArtifactResult(e){let t=pd.safeParse(e);return t.success?t.data:null}const md=z.string().regex(/^[^/\s]+\/[^/\s]+$/),hd=z.object({kind:z.literal(`generated-image`),artifact:z.unknown(),generation:z.object({attemptId:z.uuid(),requestedModelId:md,executedModelId:md.nullable(),format:z.enum(xu),mimeType:z.enum([`image/png`,`image/jpeg`,`image/webp`])}).strict()}).strict();function readGeneratedImageResult(e){let t=hd.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 gd={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,gd)}}return[...t.values()]}const _d={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,_d);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,_d)}}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 vd=z.object({provider:z.custom(e=>isNonBlankString(e)&&e.length<=200,{message:`must be a non-blank string of at most 200 characters`}),model:z.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 yd=Object.keys({home:!0,agents:!0,routines:!0,object:!0,settings:!0}),bd=[`dot`,`label`,`bubble`];function parseNewsIntensity(e){return bd.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 xd=/^(\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=xd.exec(e),r=xd.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 xd.test(e)}const Sd=30,Cd=90,wd=50,Td=z.looseObject({fr:z.string().optional(),en:z.string().optional()}),Ed=z.iso.datetime({offset:!0}),Dd=z.looseObject({id:z.string().min(1),slug:z.string().min(1),updatedAt:Ed,publishedAt:Ed,since:z.string(),displayDays:z.number().int().positive().optional(),requires:z.looseObject({capability:z.string(),level:z.string()}).optional(),target:z.string().optional(),intensity:z.unknown().optional(),title:Td,summary:Td});function knownRequirement(e){let t=q.find(t=>t.id===e.capability);return t!==void 0&&levelActions(t,e.level).length>0}function parseEntry(e){let t=Dd.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 M(`News feed: document must be an object`,[]);let n=e;if(!Array.isArray(n.entries))throw new M(`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 Od=z.looseObject({id:z.string().min(1),slug:z.string().min(1),updatedAt:Ed,body:Td});function parseNewsBody(e){let t=Od.safeParse(e);if(!t.success)throw new M(`News body: malformed document`,[]);if(!hasLocale(t.data.body))throw new M(`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 kd=``;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 Ad=z.strictObject({model:vd.optional(),routing:z.literal(`auto`).optional()}),jd=z.strictObject({inApp:z.boolean()});function isActionableType(e){let t=g[e];return t!==void 0&&Te(t.kind)}const Md=[preference(`workPosture`,{value:z.enum(uo),default:`auto`,audited:!0}),preference(`chat.default`,{value:Ad,default:{},audited:!0}),preference(`conversationSurface`,{value:z.enum(li),default:`panel`}),preference(`mailboxListMode`,{value:z.enum(ta),default:`threads`}),preference(`home`,{value:z.string().uuid().nullable(),default:null}),preference(`memory.learnFromEmail`,{value:z.boolean(),default:!0,audited:!0}),preference(`memory.shareWithTeam`,{value:z.boolean(),default:!0,audited:!0}),preference(`decisions.seenAt`,{value:z.iso.datetime().nullable(),default:null}),preference(`decisions.delivery`,{value:jd,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{Ar as ACCESS_LEVELS,jr as ACCESS_ROLES,e as ACTIONABLE_DECISION_KINDS,_ as AGENDA_BLOCK,Mr as AGENT_ASIDE_ANSWER_MAX_LENGTH,Nr as AGENT_ASIDE_HISTORY_LIMIT,Pr as AGENT_ASIDE_QUESTION_MAX_LENGTH,Fr as AGENT_AVATAR_EXPRESSIONS,Ir as AGENT_AVATAR_TYPES,Lr as AGENT_MESSAGE_KIND,Rr as AGENT_NOTIFICATION_KIND,zr as AGENT_SESSION_ACCESS_ROLES,Br as AGENT_SESSION_LIST_ORDERS,Vr as AGENT_SESSION_ORIGINS,Hr as AGENT_SESSION_PROVENANCES,Ur as AGENT_STARTERS_MAX,Wr as AGENT_STARTER_MAX_LENGTH,Gr as AGENT_SYSTEM_PROMPT_MAX_LENGTH,Kr as AGENT_TASK_KINDS,t as AGGREGATE_BUCKETS,n as AGGREGATE_MEASURES,wu as ALLOWED_PROPERTY_TYPES,qr as ALL_CATALOG_TOOL_NAMES,U as ALL_PIPES,Jr as ALWAYS_KINDS,$u as APPEARANCE_FACETS,Yr as APPROVAL_FAMILY_TOOL_NAMES,Xr as ARCHITECT_PUBLICATION_KIND,gu as ARTIFACT_FILE_ROLES,mu as ARTIFACT_KINDS,ke as ARTIFACT_PREVIEW_EXTENSION,hu as ARTIFACT_RETENTIONS,Zr as ASK_QUESTIONS_ANSWER_MAX_LENGTH,Qr as ASK_QUESTIONS_ANSWER_MAX_VALUES,$r as ASK_QUESTIONS_MAX_BATCH,ei as ASK_QUESTIONS_TOOL_NAME,Ae as ATTRIBUTE_FILTER_OPERATORS,bc as ATTRIBUTE_NAME_SCHEMA,je as ATTRIBUTE_TYPES,ti as AUDIT_ACTIONS,ni as AUDIT_AGENT_SESSION_METADATA_KEY,ri as AUDIT_RESOURCE_TYPES,Bn as AccessDeniedError,AgendaBuilder,N as AgentBuilder,Vn as AggregateValidationError,Hn as AmbiguousSchemaChangeError,Un as AttributeInUseError,Wn as AttributeNotFoundError,Me as BLOCK_CONTEXTS,Ne as BLOCK_PERIODS,v as BLOCK_WIDTHS,ii as BROWSER_LAUNCH_TOOL_NAME,ai as BROWSER_TOOL_NAMES,oi as BUNDLE_LOCALES,Wu as BUNDLE_NAME_PATTERN,Cu as BYTE_UNIT_LABELS,BlockContentBuilder,BundleBuilder,y as CARD_BLOCK,Iu as CATALOG_RESOURCES,b as CHART_BLOCK,Pe as CHART_KINDS,zc as COMPUTED_RETURN_TYPES,si as CONNECTION_GRANT_PROVIDERS,ad as CONNECTOR_CALLBACK_PARAM,Fe as CONTENT_PLACEMENT_CONTEXTS,ci as CONTINUATION_KEY_PATTERN,li as CONVERSATION_SURFACES,ui as COPY_VERB_NAME,Gu as CORE_BUNDLE_NAME,Md as CORE_PREFERENCES,di as CORE_RECORD_TOOL_NAMES,fi as CORE_TOOL_NAMES,pi as COUNT_MODES,Fu as CUSTOM_LEVEL,CardBuilder,ChartBuilder,ChartQuery,Gn as ConcurrentModificationError,X as ContentBuilder,Ie 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_TRANSFERS_KEY,f as DECISION_TYPES_V1,p as DECISION_TYPE_ACCESS_GRANTED,m as DECISION_TYPE_AGENT_APPROVAL,h 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,g 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,mi as DEFAULT_AGENT_EXECUTION_CONFIG,hi as DEFAULT_AGENT_TOOL_GROUPS,Xu as DEFAULT_APPEARANCE_ICON,gi as DEFAULT_APPROVAL_POLICY,_i as DEFAULT_BLUEPRINT_TOOL_GROUPS,vi as DEFAULT_DAILY_ACTIVITY_DAYS,pu as DEFAULT_DICTATION_LIMITS,Mu as DEFAULT_LABEL_FALLBACK,Le as DEFAULT_LAYOUT_TRAITS,yi as DEFAULT_MEETING_BOT_DISPLAY_NAME,bi as DEFAULT_PROACTIVE_TENANT_MONTHLY_LIMIT_USD,xi as DEFAULT_TENANT_SETTINGS,Al as DEFAULT_VALIDATION_MESSAGES,Si as DEVICE_ACCESS_ROLES,Gl as DEVICE_CHANNEL_AUTHENTICATE_TIMEOUT_MS,Kl as DEVICE_CHANNEL_IDLE_POLL_MS,Jl as DEVICE_CHANNEL_KEEPALIVE_MS,Wl as DEVICE_CHANNEL_MAX_FRAME_BYTES,Ul as DEVICE_CHANNEL_PATH,ql as DEVICE_CHANNEL_PRESENCE_MS,Yl as DEVICE_CHANNEL_WORKER_CLOSE_PROTOCOL_VIOLATION,Zl as DEVICE_COMMAND_ERROR_CODES,$l as DEVICE_DESKTOP_STATES,Ql as DEVICE_SHELLS,du as DICTATION_FINALIZATION_TIMEOUT_MS,au as DICTATION_FRAME_BYTES,su as DICTATION_MAX_BUFFER_BYTES,ou as DICTATION_MAX_FRAME_BYTES,cu as DICTATION_MAX_TRANSCRIPT_BYTES,fu as DICTATION_MODEL_ID,uu as DICTATION_PREPARATION_TIMEOUT_MS,iu as DICTATION_SAMPLE_RATE,lu as DICTATION_TICKET_TTL_MS,Ci as DISCARD_ARCHITECT_DRAFT_TOOL_NAME,wi as DOCUMENT_SORT_MODES,dd as DRAFT_CONFLICT_KINDS,Ti as DRAFT_WRITE_TOOL_NAMES,DecisionsBuilder,DeviceChannelProtocolError,nu as DeviceChannelServerFrameSchema,tu as DeviceChannelWorkerFrameSchema,eu as DeviceDesktopStatusSchema,O as DuplicateError,Ei as EMAIL_CATEGORY_DEFAULT_COLOR,Di as EMAIL_CATEGORY_DEFAULT_ICON,Oi as EMAIL_CATEGORY_DESCRIPTION_MAX,ki as EMAIL_CATEGORY_DESCRIPTION_MIN,Ai as EMAIL_CATEGORY_LIMIT,ji as EMAIL_CATEGORY_NAME_MAX,Mi as ENVIRONMENT_BUILD_LOG_STEP_PREFIX,Ni as ENVIRONMENT_HARNESSES,Pi as ENVIRONMENT_HARNESS_SANDBOX_WORKDIR,Fi as ENVIRONMENT_HARNESS_WORKDIR,Ii as ENVIRONMENT_IMAGES,Li as ENVIRONMENT_MEMORY_GB_PER_VCPU,Ri as ENVIRONMENT_NAME_MAX_CHARS,zi as ENVIRONMENT_NETWORK_ALLOW_MAX,Bi as ENVIRONMENT_SCRIPT_MAX_BYTES,Vi as ENVIRONMENT_SIZES,Hi as ENVIRONMENT_SIZE_VCPUS,Ui as ENVIRONMENT_STANDARDS_WORKDIR,Wi as ENV_VAR_KEY_PATTERN,Gi as ESTIMATED_COUNT_CAP,Kn as ExportTooLargeError,Ki as FILE_URLS_MAX_IDS,V as FORM_FORBIDDEN_ATTRIBUTE_TYPES,qn as ForbiddenError,FormBuilder,FormRowBuilder,FormStepBuilder,qi as GET_ARCHITECT_DRAFT_TOOL_NAME,Ji as GITHUB_TRIGGER_CATALOG,Yi as GRANT_ENABLES,Re as GROUPABLE_ATTRIBUTE_TYPES,td as GroupBuilder,ze as HEADING_BLOCK,de as HIERARCHY_ATTRIBUTE_IDS,fe as HIERARCHY_ATTRIBUTE_NAMES,pe as HIERARCHY_CHILD_IDS_LIMIT,Xi as HITL_TOOL_NAMES,xu as IMAGE_FORMATS,Zu as IMAGE_SHAPES,Qu as IMAGE_SOURCES,Zi as INFERENCE_REASONING_OPTIONS,Qi as INFERENCE_ROUTING_MODES,$i as INFERENCE_SPEEDS,Be as INVENTORY_LIMIT,Jn as InvalidPermissionGrantError,ea as LAST_RUN_ERROR_MAX_LENGTH,xc as LIST_VIEW_TAB_VISIBILITIES,Ve as LOCATION_FILTER_PROPERTIES,Yn as LogoProviderUnavailableError,Xn as LogoSearchRateLimitedError,He as MAILBOX_BLOCK,ta as MAILBOX_LIST_MODES,na as MAIL_DRAFT_BODY_MAX_CHARS,ra as MAIL_SIGNATURE_MAX_CHARS,ia as MAIL_SUBJECT_MAX_CHARS,me as MAX_AGGREGATE_GROUPS,aa as MAX_DAILY_ACTIVITY_DAYS,ru as MAX_PRESET_DEPTH,oa as MAX_TODOS,sa as MAX_TODO_DESCRIPTION_CHARS,ca as MAX_TODO_ID_CHARS,la as MCP_SERVER_NAME_MAX_LENGTH,Ue as MEASURABLE_ATTRIBUTE_TYPES,We as MEETINGS_UPCOMING_BLOCK,ua as MEETING_BOT_IMAGE,da as MEETING_BOT_IMAGE_BASE64_MAX_LENGTH,fa as MEETING_BOT_SILENT_REASON,pa as MEETING_RESPONSES,J as MEMORY_ATTRIBUTES,Vu as MEMORY_PAGE_MAX_CHARS,ma as MEMORY_SPEND_LIMIT_PATTERN,Hu as MEMORY_WORKSPACE_PROFILE,Bu as MEMORY_WRITE_SOURCE,x as METRIC_BLOCK,MailboxBuilder,ha as McpOAuthCompletionMode,Zn as MemoryNotFoundError,MetricBuilder,MetricQuery,MultiRelationAttributeBuilder,Vl as NATIVE_AGENT_UI_PART_IDS_METADATA_KEY,Hl as NATIVE_AGENT_UI_PART_IDS_METADATA_SCHEMA_VERSION,Ge as NATIVE_BLOCKS,Sc as NATIVE_OBJECT_NAMES,ga as NATIVE_TOOL_GROUPS,_a as NATIVE_TOOL_GROUP_CATALOG,Sd as NEWS_DEFAULT_DISPLAY_DAYS,Cd as NEWS_DISPLAY_CAP_DAYS,wd as NEWS_INDEX_MAX_ENTRIES,bd as NEWS_INTENSITIES,yd as NEWS_TARGET_KINDS,G as NO_ACCESS,kd as NO_PREFERENCE_PARAMETER,va as NO_RECORDING,Ke as NO_VALUE_OPERATORS,sl as NonJsonValueError,NoopGeocodingAdapter,Qn as NotFoundError,$n as NotImplementedError,K as OBJECT_GRANT,Cc as OBJECT_NAME_SCHEMA,ya as OPEN_TOOL_PART_STATES,ba as OPERATION_MAX_STEPS,qe as OPERATORS_BY_TYPE,ObjectBuilder,er as ObjectNotFoundError,tr as ObjectReferencedError,nr as OrphanSystemAttributeError,Je as PAGE_GRID_COLUMNS,Ru as PERMISSION_ACTIONS,q as PERMISSION_CAPABILITIES,Pu as PERMISSION_CATALOG,Eu as PIPES_WITH_ARGS,xa as PROACTIVE_AGENT_NAMES,Sa as PROVIDER_DRAFT_LABEL,Ca as PROVIDER_NAMES,wa as PUBLIC_MAIL_DOMAINS,qu as PageBuilder,rr as PageReferencedError,ir as ProtectedResourceError,ar as ProtectedRoleError,Ye as QUALIFIED_SEPARATOR,Xe as QUERY_OBJECT,Ta as QUESTION_FAMILY_TOOL_NAMES,Su as QUOTA_KEYS,or as QueryTimeoutError,Ea as RECENT_ACTIVITY_LEDGER_LIMIT,Da as RECIPIENT_IDENTITIES_MAX,Oa as RECORDING_OVERRIDES,ka as RECORDING_POLICIES,Aa as RECORD_ACCESS_ROLES,ja as RECORD_ACCESS_SOURCES,Ma as RECORD_DRIVE_CURSOR_MAX_LENGTH,Na as RECORD_DRIVE_PAGE_DEFAULT_LIMIT,Pa as RECORD_DRIVE_PAGE_MAX_LIMIT,Fa as RECORD_GRAPH_DEFAULT_LIMIT_PER_NODE,Ia as RECORD_GRAPH_MAX_LIMIT_PER_NODE,La as RECORD_GRAPH_MAX_NODES,Ra as RECORD_IMAGE_MAX_BYTES,Ze as RECORD_LINKS_BLOCK,S as RECORD_LINKS_CONTENT,wc as RECORD_LIST_SCOPES,Qe as RECORD_OBJECT,Z as REFERENCE_KINDS,$e as RELATION_TARGET_ANY,et as REMOVED_OPERATOR_REPLACEMENTS,za as REPLY_MODES,Ba as REQUEST_DESIGN_REVIEW_TOOL_NAME,Va as REQUEST_SETUP_TOOL_NAME,Tc as RESERVED_ATTRIBUTE_NAMES,Ec as RESERVED_OBJECT_NAMES,Ha as RESOURCE_GRANT_KINDS,Ua as RESOURCE_KIND_CATALOG,Dc as RESOURCE_VISIBILITIES,Wa as ROUTING_PRICE_CEILINGS,sr as RealtimeDeliveryError,cr as RealtimeRateLimitedError,lr as RealtimeSubscriptionError,ur as RecordNotFoundError,tt as RecordQuery,dr as RecordReferencedError,fr as RepositoryError,k as ReservedObjectNameError,pr as RoleNotFoundError,P as SCHEMA_LIMITS,H as SCHEMA_OWNER_PATTERN,od as SCHEMA_SOURCE_RETYPE_FROM,Ga as SEND_VERB_NAME,Ka as SESSION_INFERENCE_PATCH_KEYS,Tu as SIMPLE_PIPES,Bc as SIMPLE_PROPERTY_TYPES,qa as SLACK_TRIGGER_CATALOG,Ja as SPEAKS_THROUGH_SEND_METADATA_KEY,Uu as STANDARD_SCHEMA_VENDOR,Ya as SURFACE_TOOL_NAMES,nt as SYNONYM_ALIASES,he as SYSTEM_ATTRIBUTES,ge as SYSTEM_ATTRIBUTE_I18N_KEYS,Xa as SYSTEM_EMAIL_CATEGORIES,Za as SYSTEM_EMAIL_CATEGORY_NAMES,Oc as SYSTEM_FIELD_NAMES,rt as SYSTEM_FILTER_ATTRIBUTE_TYPES,Qa as SYSTEM_PART_CODES,A as SchemaError,j as SchemaErrorCode,mr as SearchBackendError,hr as SearchPathNotIndexedError,SingleRelationAttributeBuilder,gr as StorageError,_r as SyncCascadeError,vr as SyncConflictError,yr as SyncError,br as SystemEntityImmutableError,$a as TASK_DEMAND_LEVELS,_u as TENANT_INVITATION_DEFAULT_TTL_MS,yu as TENANT_INVITATION_MAX_TTL_MS,vu as TENANT_INVITATION_MIN_TTL_MS,bu as TENANT_INVITATION_RESEND_INTERVAL_MS,C as TEXT_BLOCK,Ol as TEXT_FORMAT_PATTERNS,eo as TODO_PHASES,to as TODO_PLAN_STATUSES,no as TODO_STATUSES,ro as TOOL_APPROVAL_STATES,io as TRIAGE_ACTIONS,ao as TRIGGER_EVENT_TYPES,oo as TURN_OUTCOMES,xr as ToolGroupGrantError,so as UNSHAREABLE_OBJECT_NAMES,co as USERS_RESOLVE_MAX_IDS,lo as USER_STATUSES,uo as USER_WORK_POSTURES,fo as VERB_NAMES,M as ValidationError,Y as ViewBuilder,Vc as WIRE_OFFERED_BASE_CONFIG,Hc as WIRE_OMITTED_CONFIG_KEYS,Sr as WorkspaceInvariantReason,po as agent,mo as agentAvatarFromMetadata,ho as agentAvatarSchema,go as agentDataChunk,_o as agentDisplayName,vo as agentInferencePreferencesSchema,yo as agentMessageAttachmentSchema,bo as agentMessagePartSchema,xo as agentScheduleSchema,So as agentSessionInferenceOverridesInputSchema,Co as agentSessionInferenceOverridesSchema,wo as agentSessionMessageSchema,To as agentStartersSchema,Eo as agentTriggerBaseSchema,Do as agentTriggerPatchSchema,Oo as agentTriggerSchema,ko as agentUIValidationError,applyPipes,Ao as artifactQuoteSchema,cl as asTenantId,ll as asUserId,jo as askQuestionsOutputSchema,assertBundleName,Mo as assertCustomAgentUIMessageChunk,assertSchemaSourceResolutions,No as assertSessionState,Uc as attributeConfigSchemas,it as attributeFilterTarget,at as attributeInventory,ot as blockObjectInputs,buildPropertySchema,st as buildQualifiedAttribute,builtBundleFromPieces,bundle,R as canonicalStringify,Po as canonicalToolGroups,ct as canonicalizeFilterValue,capabilityForResource,lt as capped,checkbox,Fo as classificationRestoreSchema,Io as classifyEmailSchema,Lo as cliDefaultModelOf,ut as collectContentViewCatalogue,dt as collectQualifiedRuleIssues,ft as collectionContentSourceSchema,pt as collectionSourceAddress,mt as collectionSourceAddressOf,Ac as colorIdSchema,ht as columnsSchema,Ro as compareAgentSessionMessages,compareSchemaStateEntries,compareVersions,zo as compiledHarnessModels,computeByteMagnitude,computeReconnectDelay,computeRetryDelay,Bo as connectionGrantKindsOf,Vo as connectorTriggerMatchSchema,nd as content,contentDefinition,w as contentExtensionRegistry,gt as contentReadObjects,T as contentViewDefinitionSchema,_t as contentViewDefinitionSchemaFor,convertRetypedValue,gl as createAttributeValidator,_l as createFormAttributeValidator,createStandardSchemaProps,currency,vt as currentActor,Ho as customDataChunkSchemas,date,_e as decisionThreadKey,ve as decisionTransferBy,ye as decisionTransfersOf,declaredImageRequests,Uo as decodeAgentSessionListCursor,ul as deepEqual,yt as defineBlock,deriveLayout6,Wo as deriveViewerAccess,bt as describeViewIssue,detailView,deviceChannelUrl,diffSchemaState,xt as displayAttributesSchema,document,St as draftContentViewDefinitionSchema,Ct as draftContentViewDefinitionSchemaFor,droppedContents,Go as durableDateSchema,wt as edgePropertyFilterTarget,Ko as emailCategoryCreateSchema,qo as emailCategoryDeleteSchema,Jo as emailCategoryScopeQuerySchema,Yo as emailCategoryUpdateSchema,Xo as emailRuleScopeSchema,Zo as encodeAgentSessionListCursor,Qo as environmentHarness,$o as environmentWorkdir,extractAttributeNames,extractAttributePaths,Tt as extractCurrencyFilterValue,Et as extractFilterValue,extractReadRecordIds,extractTouchedArtifacts,extractTouchedDocuments,extractTouchedRecords,Dt as filterOperatorsOfType,Ot as filterStateSchema,kt as filterTargetsOf,es as findEnvironmentHarness,findGrantIssues,At as findGridViolation,jt as findGroupViolation,Mt as findLayoutRuleViolation,Nt as findRelationAttribute,Pt as findRowLimitViolation,form,formFieldFlatKey,formFieldKey,formatByteSize,be as formatDecisionLink,formatNewsTarget,Ml as formatPhoneForDisplay,formatReference,jl as formatZodErrors,formula,dl as generateId,Ft as getAttributeCapabilities,Gc as getAttributeConfigSchema,Kc as getAttributeConfigWriteSchema,It as getAttributeFilterOperators,getEditableLabelAttribute,xe as getHierarchyAttributes,Se as getObjectSystemAttributes,Lt as getOperatorPolarity,Rt as getRollupFilterOperators,getSingleAttributeFromExpression,getSlotFieldTargets,Ce as getSystemAttributeI18nKey,we as getSystemAttributeList,ts as githubConditionSchema,ns as githubTriggerMatchSchema,rs as grantKindOf,zt as gridPositionSchema,group,Bt as groupSizeMessage,Vt as groupedMembers,is as harnessModelChoices,hasLocale,hasOptions,hashBundlePieces,as as humanRequestId,os as humanRequestKind,F as iconNameSchema,imageLookupKindOf,imageModelFormatDefect,ss as imageModelIdSchema,fl as indexBy,Ht as inferInverseCardinality,cs as inferenceReasoningSchema,ls as inferenceRoutingSchema,us as inferenceSpeedSchema,Ut as input,Wt as invalidViewMessage,Te as isActionableDecisionKind,ds as isAgentMessageMetadata,fs as isAgentNotificationMetadata,ps as isAgentUIDataName,ms as isAgentWrittenAuditEntry,hs as isArchitectPublicationMetadata,Gt as isAttributeFilterable,Kt as isAttributeGroupable,Cr as isAttributeInUseError,qt as isAttributeKanbanGroupable,Jt as isAttributeSearchable,Yt as isAttributeSortable,gs as isAwaitingHuman,Xt as isBilateralRelation,_s as isBlocking,isBundle,Zt as isCalendarDay,isCatalogResource,Qt as isCollectionContent,$t as isDynamicValue,yl as isEmptyValue,vs as isEnvironmentHarnessId,isFormDefinition,isFormFieldsRow,isFormFreeFieldRef,isFormHeadingRow,isFormSeparatorRow,isFormSlotFieldRef,isFormTextRow,Ee as isHierarchyAttribute,isImageSource,isLabelExpression,en as isLocationFilterProperty,tn as isLocationPartOperator,ys as isMailProvider,bs as isMailboxListMode,De as isManagedSystemAttribute,I as isNativeObjectName,xs as isNativeToolGroup,nn as isNoValueOperator,wr as isNotFoundError,bl as isNullishOrEmptyString,Tr as isObjectReferencedError,Ss as isOpenToolPartState,Cs as isParkedOnHuman,jc as isPlainRecord,Er as isProtectedResourceError,ws as isProviderDraft,Ts as isPublicMailDomain,Es as isQuestionPart,Dr as isRecordReferencedError,rn as isRelativeDateValue,Ds as isReplyMode,Os as isResourceGrant,ks as isRoutineActorMetadata,Or as isSchemaError,isSemver,As as isSessionInferencePatch,an as isSetMembershipOperator,isStandardSchema,js as isSystemEmailCategory,Ms as isSystemEmailCategoryName,Ns as isSystemPartCode,Ps as isToolApprovalState,on as isUniversalRelation,kr as isValidationError,xl as isValuePresent,isWherePipe,isWildcard,judgePreferenceWrite,keptFill,W as labelExpressionSchema,sn as layoutTraitsOf,levelActions,levelFloor,levelOf,listView,locatePreference,location,cn as locationPartFilterTarget,Fs as lockingSendCall,Is as meetingBotDispatchRequestSchema,Ls as meetingBotDispatchResponseSchema,Rs as meetingBotNotificationSchema,zs as meetingTranscriptSegmentSchema,ln as memberlessGroups,memoryPageViewOf,Bs as mentionReferenceSchema,Vs as mergeSessionInferencePatch,un as metricComparePeriod,Hs as modelDefinitionSchema,vd as modelIdentitySchema,Us as modelReferenceSchema,moveWidensAudience,multiselect,nameSlug,ud as namedTargetSchema,nativeAgentUIPartIdMetadataKey,Ws as needsManageWhenUnattended,Pl as normalizeCountrylessPhoneNumber,dn as normalizeFilterRule,fn as normalizeForEdgeRpc,normalizeNewsLocale,pn as normalizeOperator,Fl as normalizePhoneNumber,Gs as normalizedMeetingTranscriptSchema,mn as now,number,object,ed as objectImageSchema,Ks as openRequests,qs as orderAgentSessionMessages,packLayout,page,pageCompactor,gn as pageTraitsOf,Js as parseAgentDefinitionAccessRole,Ys as parseAgentSessionAccessRole,qc as parseAttributeConfig,Jc as parseAttributeConfigForCreate,Yc as parseAttributeConfigForUpdate,E as parseBlockParameters,Xs as parseCountMode,Oe as parseDecisionLink,Zs as parseDeviceAccessRole,parseDeviceChannelFrame,Qs as parseMergedAgentTrigger,parseNamedTarget,parseNativeAgentUIPartIdsMetadata,parseNewsBody,parseNewsIndex,parseNewsIntensity,parseNewsTarget,$s as parseOptionalCountMode,ec as parsePageAccessRole,_n as parseQualifiedAttribute,tc as parseRecordAccessRole,Mc as parseRecordListScope,parseReference,Nc as parseResourceVisibility,parseSchemaGroupPresentation,parseSchemaOwner,parseSchemaState,parseServerFrame,nc as parseToolGroupGrant,parseWherePipe,parseWorkerFrame,zu as permissionGrantSchema,phone,placeNew,preference,preferenceEntry,Xc as propertyAttributeSchema,Zc as propertyAttributeWireSchema,Qc as propertySchemaSchema,$c as propertySchemaWireSchema,rc as providerNameSchema,D as publishedViewContentDefinitionSchema,vn as query,readArtifactResult,ic as readAskQuestionsResult,readFormFieldValue,readGeneratedImageResult,ac as recentActivityEntryKey,oc as recordGraphNodeKey,sc as recordGraphRequestSchema,recordLinksTab,cc as recordMeetingsCount,lc as recordOperationSchema,yn as recordQueryDefinitionSchema,uc as refineTrigger,el as refuseForeignKeys,Sl as rejectUnknownAttributesOrThrow,relation,bn as relationAcceptsObject,relationProperty,xn as relationTargetsOf,renderLabelExpression,repairPageGrid,requestedCapabilities,Cn as requireRecordContentContext,wn as requireSingleRelationTarget,resolveAppearance,Tn as resolveCollectionActions,En as resolveContentNavigation,Dn as resolveEffectiveFilterType,resolveFieldRequired,On as resolveIsWithinBounds,resolveLocalized,resolvePageGrid,resolvePropertyDefinitions,kl as resolveTextPattern,kn as resolveUtcDayBounds,resolveViewContents,dc as resourceGrant,richtext,rollup,fc as routedMessageInferenceSchema,sameActions,pl as sameStableValue,schemaGroupKey,schemaStateSourcePayload,select,tl as selectOptionWriteSchema,ml as serializeCanonicalJson,hl as serializeStableJson,pc as sessionInferencePatchSchema,settleLayout,sha256Hex,An as singleRelationTarget,mc as slackConditionSchema,hc as slackTriggerMatchSchema,snapWidth,jn as sortsSchema,Mn as sourcedAttributeOf,status,nl as statusGroupSchema,rl as statusOptionWriteSchema,storedContentDefinition,Nn as systemColumnFilterTarget,text,Pn as toMultiValueOperator,Fn as toUtcDayString,In as today,gc as todoItemSchema,_c as todoPlanSchema,vc as toolImpactSchema,user,yc as utf8ByteLength,Cl as validateAttribute,Pc as validateAttributeName,Ln as validateContentViewCatalogue,wl as validateDraft,Tl as validateDraftOrThrow,validateLabelExpression,El as validateObject,validateObjectExpressions,validateObjectImage,Lc as validateObjectName,Dl as validateObjectOrThrow,Rn as validateQualifiedRule,zn as validateStoredViews,Rc as validateViewName,widthStepConstraint,il as wireHiddenTypeConfigMask,al as wireOmittedConfigKeysFor,withPreferenceEntry,withoutTrailingSlashes,ol 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_TRANSFERS_KEY as d,DECISION_TYPES_V1 as f,DECISION_TYPE_ACCESS_GRANTED as p,DECISION_TYPE_AGENT_APPROVAL as m,DECISION_TYPE_AGENT_MESSAGE as ee,DECISION_TYPE_AGENT_QUESTION as te,DECISION_TYPE_AGENT_REVIEW as ne,DECISION_TYPE_AGENT_ROUTINE_RUN_FAILED as re,DECISION_TYPE_AGENT_SETUP as ie,DECISION_TYPE_BUNDLE_SETUP as ae,DECISION_TYPE_CONNECTOR_CONNECTION_ERROR as oe,DECISION_TYPE_CONNECTOR_CONNECTION_REAUTH_REQUIRED as se,DECISION_TYPE_ENVIRONMENT_BUILD_FAILED as ce,DECISION_TYPE_KINDS as h,DECISION_TYPE_PERSON as le,DECISION_TYPE_RECORD_ASSIGNED as ue,DECISION_TYPE_RECORD_MENTIONED as de,DECISION_WORK_STATES as fe,HIERARCHY_ATTRIBUTE_IDS as pe,HIERARCHY_ATTRIBUTE_NAMES as me,HIERARCHY_CHILD_IDS_LIMIT as he,MAX_AGGREGATE_GROUPS as ge,SYSTEM_ATTRIBUTES as _e,SYSTEM_ATTRIBUTE_I18N_KEYS as ve,decisionThreadKey as ye,decisionTransferBy as be,decisionTransfersOf as xe,formatDecisionLink as Se,getHierarchyAttributes as Ce,getObjectSystemAttributes as we,getSystemAttributeI18nKey as Te,getSystemAttributeList as Ee,isActionableDecisionKind as De,isHierarchyAttribute as Oe,isManagedSystemAttribute as ke,parseDecisionLink as Ae}from"./record-aggregates-BrLE4IsX.mjs";import{AGENDA_BLOCK as g,ARTIFACT_PREVIEW_EXTENSION as je,ATTRIBUTE_FILTER_OPERATORS as Me,ATTRIBUTE_TYPES as Ne,BLOCK_CONTEXTS as Pe,BLOCK_PERIODS as Fe,BLOCK_WIDTHS as _,CARD_BLOCK as v,CHART_BLOCK as Ie,CHART_KINDS as Le,CONTENT_PLACEMENT_CONTEXTS as Re,DECISIONS_BLOCK as ze,DEFAULT_LAYOUT_TRAITS as Be,GROUPABLE_ATTRIBUTE_TYPES as Ve,HEADING_BLOCK as He,INVENTORY_LIMIT as Ue,LOCATION_FILTER_PROPERTIES as We,MAILBOX_BLOCK as Ge,MEASURABLE_ATTRIBUTE_TYPES as Ke,MEETINGS_UPCOMING_BLOCK as qe,METRIC_BLOCK as Je,NATIVE_BLOCKS as Ye,NO_VALUE_OPERATORS as Xe,OPERATORS_BY_TYPE as Ze,PAGE_GRID_COLUMNS as Qe,QUALIFIED_SEPARATOR as $e,QUERY_OBJECT as et,RECORD_LINKS_BLOCK as tt,RECORD_LINKS_CONTENT as y,RECORD_OBJECT as nt,RELATION_TARGET_ANY as rt,REMOVED_OPERATOR_REPLACEMENTS as it,RecordQuery as at,SYNONYM_ALIASES as ot,SYSTEM_FILTER_ATTRIBUTE_TYPES as st,TEXT_BLOCK as ct,attributeFilterTarget as lt,attributeInventory as ut,blockObjectInputs as dt,buildQualifiedAttribute as ft,canonicalizeFilterValue as pt,capped as mt,collectContentViewCatalogue as ht,collectQualifiedRuleIssues as gt,collectionContentSourceSchema as _t,collectionSourceAddress as vt,collectionSourceAddressOf as yt,columnsSchema as bt,contentExtensionRegistry as b,contentReadObjects as xt,contentViewDefinitionSchema as x,contentViewDefinitionSchemaFor as St,currentActor as Ct,defineBlock as wt,describeViewIssue as Tt,displayAttributesSchema as Et,draftContentViewDefinitionSchema as Dt,draftContentViewDefinitionSchemaFor as Ot,edgePropertyFilterTarget as kt,extractCurrencyFilterValue as At,extractFilterValue as jt,filterOperatorsOfType as Mt,filterStateSchema as Nt,filterTargetsOf as Pt,findGridViolation as Ft,findGroupViolation as It,findLayoutRuleViolation as Lt,findRelationAttribute as Rt,findRowLimitViolation as zt,getAttributeCapabilities as Bt,getAttributeFilterOperators as Vt,getOperatorPolarity as Ht,getRollupFilterOperators as Ut,gridPositionSchema as Wt,groupSizeMessage as Gt,groupedMembers as Kt,inferInverseCardinality as qt,input as Jt,invalidViewMessage as Yt,isAttributeFilterable as Xt,isAttributeGroupable as Zt,isAttributeKanbanGroupable as Qt,isAttributeSearchable as $t,isAttributeSortable as en,isBilateralRelation as tn,isCalendarDay as nn,isCollectionContent as rn,isDynamicValue as an,isLocationFilterProperty as on,isLocationPartOperator as sn,isNoValueOperator as cn,isRelativeDateValue as ln,isSetMembershipOperator as un,isUniversalRelation as dn,layoutTraitsOf as fn,locationPartFilterTarget as pn,memberlessGroups as mn,metricComparePeriod as hn,normalizeFilterRule as gn,normalizeForEdgeRpc as _n,normalizeOperator as vn,now as yn,overlaps as bn,pageTraitsOf as xn,parseBlockParameters as S,parseQualifiedAttribute as Sn,publishedViewContentDefinitionSchema as C,query as Cn,recordQueryDefinitionSchema as wn,relationAcceptsObject as Tn,relationTargetsOf as En,requireContentPlacement as Dn,requireRecordContentContext as On,requireSingleRelationTarget as kn,resolveCollectionActions as An,resolveContentNavigation as jn,resolveEffectiveFilterType as Mn,resolveIsWithinBounds as Nn,resolveUtcDayBounds as Pn,singleRelationTarget as Fn,sortsSchema as In,sourcedAttributeOf as Ln,systemColumnFilterTarget as Rn,toMultiValueOperator as zn,toUtcDayString as Bn,today as Vn,validateContentViewCatalogue as Hn,validateQualifiedRule as Un,validateStoredViews as Wn}from"./all-B9epSh3g.mjs";import{AccessDeniedError as Gn,AggregateValidationError as Kn,AmbiguousSchemaChangeError as qn,AttributeInUseError as Jn,AttributeNotFoundError as Yn,ConcurrentModificationError as Xn,DuplicateError as w,ExportTooLargeError as Zn,ForbiddenError as Qn,InvalidPermissionGrantError as $n,LogoProviderUnavailableError as er,LogoSearchRateLimitedError as tr,MemoryNotFoundError as nr,NotFoundError as rr,NotImplementedError as ir,ObjectNotFoundError as ar,ObjectReferencedError as or,OrphanSystemAttributeError as sr,PageReferencedError as cr,ProtectedResourceError as lr,ProtectedRoleError as ur,QueryTimeoutError as dr,RealtimeDeliveryError as fr,RealtimeRateLimitedError as pr,RealtimeSubscriptionError as mr,RecordNotFoundError as hr,RecordReferencedError as gr,RepositoryError as _r,ReservedObjectNameError as T,RoleNotFoundError as vr,SchemaError as E,SchemaErrorCode as D,SearchBackendError as yr,SearchPathNotIndexedError as br,StorageError as xr,SyncCascadeError as Sr,SyncConflictError as Cr,SyncError as wr,SystemEntityImmutableError as Tr,ToolGroupGrantError as Er,ValidationError as O,WorkspaceInvariantReason as Dr,isAttributeInUseError as Or,isNotFoundError as kr,isObjectReferencedError as Ar,isProtectedResourceError as jr,isRecordReferencedError as Mr,isSchemaError as Nr,isValidationError as Pr}from"./exceptions.mjs";import{ACCESS_LEVELS as Fr,ACCESS_ROLES as Ir,AGENT_ASIDE_ANSWER_MAX_LENGTH as Lr,AGENT_ASIDE_HISTORY_LIMIT as Rr,AGENT_ASIDE_QUESTION_MAX_LENGTH as zr,AGENT_AVATAR_EXPRESSIONS as Br,AGENT_AVATAR_TYPES as Vr,AGENT_MESSAGE_KIND as Hr,AGENT_NOTIFICATION_KIND as Ur,AGENT_SESSION_ACCESS_ROLES as Wr,AGENT_SESSION_LIST_ORDERS as Gr,AGENT_SESSION_ORIGINS as Kr,AGENT_SESSION_PROVENANCES as qr,AGENT_STARTERS_MAX as Jr,AGENT_STARTER_MAX_LENGTH as Yr,AGENT_SYSTEM_PROMPT_MAX_LENGTH as Xr,AGENT_TASK_KINDS as Zr,ALL_CATALOG_TOOL_NAMES as Qr,ALWAYS_KINDS as $r,APPROVAL_FAMILY_TOOL_NAMES as ei,ARCHITECT_PUBLICATION_KIND as ti,ASK_QUESTIONS_ANSWER_MAX_LENGTH as ni,ASK_QUESTIONS_ANSWER_MAX_VALUES as ri,ASK_QUESTIONS_MAX_BATCH as ii,ASK_QUESTIONS_TOOL_NAME as ai,AUDIT_ACTIONS as oi,AUDIT_AGENT_SESSION_METADATA_KEY as si,AUDIT_RESOURCE_TYPES as ci,AgentBuilder as k,BROWSER_LAUNCH_TOOL_NAME as li,BROWSER_TOOL_NAMES as ui,BUNDLE_LOCALES as di,BUNDLE_SETUP_PROMPT_MAX_LENGTH as fi,CONNECTION_GRANT_PROVIDERS as pi,CONTINUATION_KEY_PATTERN as mi,CONVERSATION_SURFACES as hi,COPY_VERB_NAME as gi,CORE_RECORD_TOOL_NAMES as _i,CORE_TOOL_NAMES as vi,COUNT_MODES as yi,DEFAULT_AGENT_EXECUTION_CONFIG as bi,DEFAULT_AGENT_TOOL_GROUPS as xi,DEFAULT_APPROVAL_POLICY as Si,DEFAULT_BLUEPRINT_TOOL_GROUPS as Ci,DEFAULT_DAILY_ACTIVITY_DAYS as wi,DEFAULT_MEETING_BOT_DISPLAY_NAME as Ti,DEFAULT_TENANT_SETTINGS as Ei,DEVICE_ACCESS_ROLES as Di,DISCARD_ARCHITECT_DRAFT_TOOL_NAME as Oi,DOCUMENT_SORT_MODES as ki,DRAFT_WRITE_TOOL_NAMES as Ai,EMAIL_CATEGORY_DEFAULT_COLOR as ji,EMAIL_CATEGORY_DEFAULT_ICON as Mi,EMAIL_CATEGORY_DESCRIPTION_MAX as Ni,EMAIL_CATEGORY_DESCRIPTION_MIN as Pi,EMAIL_CATEGORY_LIMIT as Fi,EMAIL_CATEGORY_NAME_MAX as Ii,ENVIRONMENT_BUILD_LOG_STEP_PREFIX as Li,ENVIRONMENT_HARNESSES as Ri,ENVIRONMENT_HARNESS_SANDBOX_WORKDIR as zi,ENVIRONMENT_HARNESS_WORKDIR as Bi,ENVIRONMENT_IMAGES as Vi,ENVIRONMENT_MEMORY_GB_PER_VCPU as Hi,ENVIRONMENT_NAME_MAX_CHARS as Ui,ENVIRONMENT_NETWORK_ALLOW_MAX as Wi,ENVIRONMENT_SCRIPT_MAX_BYTES as Gi,ENVIRONMENT_SIZES as Ki,ENVIRONMENT_SIZE_VCPUS as qi,ENVIRONMENT_STANDARDS_WORKDIR as Ji,ENV_VAR_KEY_PATTERN as Yi,ESTIMATED_COUNT_CAP as Xi,FILE_URLS_MAX_IDS as Zi,GET_ARCHITECT_DRAFT_TOOL_NAME as Qi,GITHUB_TRIGGER_CATALOG as $i,GRANT_ENABLES as ea,HITL_TOOL_NAMES as ta,INFERENCE_REASONING_OPTIONS as na,INFERENCE_ROUTING_MODES as ra,INFERENCE_SPEEDS as ia,LAST_RUN_ERROR_MAX_LENGTH as aa,MAILBOX_LIST_MODES as oa,MAIL_DRAFT_BODY_MAX_CHARS as sa,MAIL_SIGNATURE_MAX_CHARS as ca,MAIL_SUBJECT_MAX_CHARS as la,MAX_DAILY_ACTIVITY_DAYS as ua,MAX_TODOS as da,MAX_TODO_DESCRIPTION_CHARS as fa,MAX_TODO_ID_CHARS as pa,MCP_SERVER_NAME_MAX_LENGTH as ma,MEETING_BOT_IMAGE as ha,MEETING_BOT_IMAGE_BASE64_MAX_LENGTH as ga,MEETING_BOT_NO_CREDITS as _a,MEETING_BOT_SILENT_REASON as va,MEETING_RESPONSES as ya,MEMORY_SPEND_LIMIT_PATTERN as ba,McpOAuthCompletionMode as xa,NATIVE_TOOL_GROUPS as Sa,NATIVE_TOOL_GROUP_CATALOG as Ca,NO_RECORDING as wa,OPEN_TOOL_PART_STATES as Ta,OPERATION_MAX_STEPS as Ea,PROVIDER_DRAFT_LABEL as Da,PROVIDER_NAMES as Oa,PUBLIC_MAIL_DOMAINS as ka,QUESTION_FAMILY_TOOL_NAMES as Aa,RECENT_ACTIVITY_LEDGER_LIMIT as ja,RECIPIENT_IDENTITIES_MAX as Ma,RECORDING_OVERRIDES as Na,RECORDING_POLICIES as Pa,RECORD_ACCESS_ROLES as Fa,RECORD_ACCESS_SOURCES as Ia,RECORD_DRIVE_CURSOR_MAX_LENGTH as La,RECORD_DRIVE_PAGE_DEFAULT_LIMIT as Ra,RECORD_DRIVE_PAGE_MAX_LIMIT as za,RECORD_GRAPH_DEFAULT_LIMIT_PER_NODE as Ba,RECORD_GRAPH_MAX_LIMIT_PER_NODE as Va,RECORD_GRAPH_MAX_NODES as Ha,RECORD_IMAGE_MAX_BYTES as Ua,REPLY_MODES as Wa,REQUEST_DESIGN_REVIEW_TOOL_NAME as Ga,REQUEST_SETUP_TOOL_NAME as Ka,RESOURCE_GRANT_KINDS as qa,RESOURCE_KIND_CATALOG as Ja,ROUTING_PRICE_CEILINGS as Ya,SEND_VERB_NAME as Xa,SESSION_INFERENCE_PATCH_KEYS as Za,SLACK_TRIGGER_CATALOG as Qa,SPEAKS_THROUGH_SEND_METADATA_KEY as $a,SURFACE_TOOL_NAMES as eo,SYSTEM_EMAIL_CATEGORIES as to,SYSTEM_EMAIL_CATEGORY_NAMES as no,SYSTEM_PART_CODES as ro,TASK_DEMAND_LEVELS as io,TODO_PHASES as ao,TODO_PLAN_STATUSES as oo,TODO_STATUSES as so,TOOL_APPROVAL_STATES as co,TOOL_IMPACT_COUNT_KEYS as lo,TRIAGE_ACTIONS as uo,TRIGGER_EVENT_TYPES as fo,TURN_OUTCOMES as po,UNSHAREABLE_OBJECT_NAMES as mo,USERS_RESOLVE_MAX_IDS as ho,USER_STATUSES as go,USER_WORK_POSTURES as _o,VERB_NAMES as vo,agent as yo,agentAvatarFromMetadata as bo,agentAvatarSchema as xo,agentDataChunk as So,agentDisplayName as Co,agentInferencePreferencesSchema as wo,agentMessageAttachmentSchema as To,agentMessagePartSchema as Eo,agentScheduleSchema as Do,agentSessionInferenceOverridesInputSchema as Oo,agentSessionInferenceOverridesSchema as ko,agentSessionMessageSchema as Ao,agentStartersSchema as jo,agentTriggerBaseSchema as Mo,agentTriggerPatchSchema as No,agentTriggerSchema as Po,agentUIValidationError as Fo,artifactQuoteSchema as Io,askQuestionsOutputSchema as Lo,assertCustomAgentUIMessageChunk as Ro,assertSessionState as zo,canonicalToolGroups as Bo,classificationRestoreSchema as Vo,classifyEmailSchema as Ho,cliDefaultModelOf as Uo,compareAgentSessionMessages as Wo,compiledHarnessModels as Go,connectionGrantKindsOf as Ko,connectorTriggerMatchSchema as qo,customDataChunkSchemas as Jo,decodeAgentSessionListCursor as Yo,deriveViewerAccess as Xo,durableDateSchema as Zo,emailCategoryCreateSchema as Qo,emailCategoryDeleteSchema as $o,emailCategoryScopeQuerySchema as es,emailCategoryUpdateSchema as ts,emailRuleScopeSchema as ns,encodeAgentSessionListCursor as rs,environmentHarness as is,environmentWorkdir as as,findEnvironmentHarness as os,githubConditionSchema as ss,githubTriggerMatchSchema as cs,grantKindOf as ls,harnessModelChoices as us,humanRequestId as ds,humanRequestKind as fs,imageModelIdSchema as ps,inferenceReasoningSchema as ms,inferenceRoutingSchema as hs,inferenceSpeedSchema as gs,isAgentMessageMetadata as _s,isAgentNotificationMetadata as vs,isAgentUIDataName as ys,isAgentWrittenAuditEntry as bs,isArchitectPublicationMetadata as xs,isAwaitingHuman as Ss,isBlocking as Cs,isEnvironmentHarnessId as ws,isMailProvider as Ts,isMailboxListMode as Es,isNativeToolGroup as Ds,isOpenToolPartState as Os,isParkedOnHuman as ks,isProviderDraft as As,isPublicMailDomain as js,isQuestionPart as Ms,isReplyMode as Ns,isResourceGrant as Ps,isRoutineActorMetadata as Fs,isSessionInferencePatch as Is,isSystemEmailCategory as Ls,isSystemEmailCategoryName as Rs,isSystemPartCode as zs,isToolApprovalState as Bs,isToolImpactCountKey as Vs,lockingSendCall as Hs,meetingBotDispatchRequestSchema as Us,meetingBotDispatchResponseSchema as Ws,meetingBotNotificationSchema as Gs,meetingTranscriptSegmentSchema as Ks,mentionReferenceSchema as qs,mergeSessionInferencePatch as Js,modelDefinitionSchema as Ys,modelReferenceSchema as Xs,needsManageWhenUnattended as Zs,normalizedMeetingTranscriptSchema as Qs,openRequests as $s,orderAgentSessionMessages as ec,parseAgentDefinitionAccessRole as tc,parseAgentSessionAccessRole as nc,parseCountMode as rc,parseDeviceAccessRole as ic,parseMergedAgentTrigger as ac,parseOptionalCountMode as oc,parsePageAccessRole as sc,parseRecordAccessRole as cc,parseToolGroupGrant as lc,providerNameSchema as uc,readArchitectPublication as dc,readAskQuestionsResult as fc,recentActivityEntryKey as pc,recordGraphNodeKey as mc,recordGraphRequestSchema as hc,recordMeetingsCount as gc,recordOperationSchema as _c,refineTrigger as vc,resourceGrant as yc,routedMessageInferenceSchema as bc,sessionInferencePatchSchema as xc,slackConditionSchema as Sc,slackTriggerMatchSchema as Cc,todoItemSchema as wc,todoPlanSchema as Tc,toolImpactSchema as Ec,utf8ByteLength as Dc}from"./record-operation-B4DrBgkp.mjs";import"./zod-locale.mjs";import{ATTRIBUTE_NAME_SCHEMA as Oc,LIST_VIEW_TAB_VISIBILITIES as kc,NATIVE_OBJECT_NAMES as Ac,OBJECT_NAME_SCHEMA as jc,RECORD_LIST_SCOPES as Mc,RESERVED_ATTRIBUTE_NAMES as Nc,RESERVED_OBJECT_NAMES as Pc,RESOURCE_VISIBILITIES as Fc,SCHEMA_LIMITS as A,SYSTEM_FIELD_NAMES as Ic,assertUniqueBy as Lc,colorIdSchema as Rc,iconNameSchema as j,isNativeObjectName as M,isPlainRecord as zc,parseRecordListScope as Bc,parseResourceVisibility as Vc,validateAttributeName as Hc,validateIconName as Uc,validateLabel as Wc,validateObjectName as Gc,validateOptions as N,validateViewName as Kc}from"./primitives-BCJLtpaI.mjs";import{COMPUTED_RETURN_TYPES as qc,SIMPLE_PROPERTY_TYPES as Jc,WIRE_OFFERED_BASE_CONFIG as Yc,WIRE_OMITTED_CONFIG_KEYS as Xc,attributeConfigSchemas as Zc,datePrecisionIssues as Qc,getAttributeConfigSchema as $c,getAttributeConfigWriteSchema as el,parseAttributeConfig as tl,parseAttributeConfigForCreate as nl,parseAttributeConfigForUpdate as rl,propertyAttributeSchema as il,propertyAttributeWireSchema as al,propertySchemaSchema as ol,propertySchemaWireSchema as sl,refuseForeignKeys as cl,selectOptionWriteSchema as ll,statusGroupSchema as ul,statusOptionWriteSchema as dl,wireHiddenTypeConfigMask as fl,wireOmittedConfigKeysFor as pl,withoutUnknownOptionKeys as ml}from"./config-iUwnquKr.mjs";import{NonJsonValueError as hl,asTenantId as gl,asUserId as _l,canonicalStringify as P,deepEqual as vl,generateId as yl,indexBy as bl,sameStableValue as xl,serializeCanonicalJson as Sl,serializeStableJson as Cl}from"./utils-DaejNWxh.mjs";import{createAttributeValidator as wl,createFormAttributeValidator as Tl,createObjectValidator as El,isEmptyValue as Dl,isNullishOrEmptyString as Ol,isValuePresent as kl,rejectUnknownAttributesOrThrow as Al,validateAttribute as jl,validateDraft as Ml,validateDraftOrThrow as Nl,validateObject as Pl,validateObjectOrThrow as Fl}from"./object-BF5y6bgs.mjs";import{TEXT_FORMAT_PATTERNS as Il,resolveTextPattern as Ll}from"./text-BaxaZ5Vv.mjs";import{DEFAULT_VALIDATION_MESSAGES as Rl,formatZodErrors as zl}from"./core-rKI7Q9_U.mjs";import{formatPhoneForDisplay as Bl,getIso2 as Vl,normalizeCountrylessPhoneNumber as Hl,normalizePhoneNumber as Ul}from"./phone-BGJea5sr.mjs";import*as F from"zod";import{colorIdFromString as Wl,getCountryByIso2 as Gl,isValidCurrencyCode as Kl,isValidIso3 as ql}from"@standards/constants";import{parsePhoneNumberFromString as Jl}from"libphonenumber-js";const Yl=`__stndrdsNativeUiPartIds`,Xl=1;function invalidNativePartIds(){throw new O(`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?.[Yl];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 Zl=`/v1/device-worker/channel`,Ql=262144,$l=1e4,eu=2e3,tu=2e3,nu=2e4,ru=4008,iu={initialMs:1e3,maxMs:3e4};function deviceChannelUrl(e){let t=new URL(e);return`${t.protocol===`https:`?`wss:`:`ws:`}//${t.host}${Zl}`}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,iu)}const au=[`worker_disconnected`,`cancelled`,`timed_out`,`execution_failed`];var DeviceChannelProtocolError=class extends E{constructor(e){super(e,D.DEVICE_CHANNEL_PROTOCOL),this._tag=`DeviceChannelProtocolError`,this.name=`DeviceChannelProtocolError`}};const ou=[`zsh`,`bash`,`sh`,`fish`,`pwsh`,`powershell`],su=[`ready`,`permission_missing`,`no_session`,`unavailable`],cu=F.strictObject({state:F.enum(su),version:F.string().min(1)}),I={id:F.uuid(),leaseToken:F.string().min(1)},lu=F.discriminatedUnion(`type`,[F.strictObject({type:F.literal(`authenticate`),credential:F.string().regex(/^Device \S+$/),protocol:F.number().int().positive().optional(),desktop:cu.optional(),shell:F.enum(ou).optional()}),F.strictObject({type:F.literal(`running`),...I}),F.strictObject({type:F.literal(`heartbeat`),...I}),F.strictObject({type:F.literal(`output`),...I,stdout:F.string().optional(),stderr:F.string().optional()}),F.strictObject({type:F.literal(`complete`),...I,result:F.strictObject({stdout:F.string().optional(),stderr:F.string().optional(),exitCode:F.number().int(),success:F.boolean(),errorCode:F.enum(au).optional()}),background:F.strictObject({pid:F.number().int(),logPath:F.string().min(1)}).optional()}),F.strictObject({type:F.literal(`pong`)})]),uu=F.discriminatedUnion(`type`,[F.strictObject({type:F.literal(`ready`),device:F.strictObject({id:F.string(),name:F.string(),capability:F.enum([`shell`,`browser`])}),protocol:F.number().int().positive().optional()}),F.strictObject({type:F.literal(`command`),...I,kind:F.enum([`shell`,`browser`]),intent:F.string(),timeoutMs:F.number().int(),command:F.string().optional(),cwd:F.string().nullable().optional(),rootSessionId:F.string().min(1).optional(),background:F.boolean().optional()}),F.strictObject({type:F.literal(`release_session`),rootSessionId:F.string().min(1)}),F.strictObject({type:F.literal(`cancel`),id:F.uuid(),reason:F.enum([`cancelled`,`timed_out`,`revoked`])}),F.strictObject({type:F.literal(`reauthenticate`)}),F.strictObject({type:F.literal(`revoked`)}),F.strictObject({type:F.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(lu,e)}function parseServerFrame(e){return parseDeviceChannelFrame(uu,e)}const du=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 L=[`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 moveWidensAudience(e){return e.added.length>0||!e.workspaceBefore&&e.workspaceAfter}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$3(e){throw new O(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$3(`Label must be a string`);else{let t=e.trim();t.length===0&&refuse$3(`Label must not be empty`),t.length>A.labelLength&&refuse$3(`Label is too long (max ${A.labelLength} characters)`),n.label=t}}return n}const R=/^(?:core|bundle:.+)$/u;function parseSchemaOwner(e){if(e===null)return null;if(!R.test(e))throw new O(`Invalid schema owner "${e}"`,[]);return e}const fu=16e3,pu=3200,mu=6400,hu=16e3,gu=65536,_u=15e3,vu=1e4,yu=5e3,bu=`google/gemini-3.5-transcribe-live`,xu={maxDurationMs:3e5,dailyDurationMs:36e5,monthlyDurationMs:72e6,tenantMonthlyBudgetMicrousd:5e7,globalMonthlyBudgetMicrousd:5e7,estimatedMicrousdPerSecond:150,reservationMultiplier:2},Su=[`web`,`presentation`,`document`,`spreadsheet`,`image`,`code`,`other`],Cu=[`ephemeral`,`conversation`,`persistent`],wu=[`source`,`preview`,`entrypoint`,`asset`];var NoopGeocodingAdapter=class{async autocomplete(){return await Promise.resolve([])}async geocode(){return await Promise.resolve(null)}};const Tu=6048e5,Eu=36e5,Du=2592e6,Ou=6e4,ku=[`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 Au=[`storage.bytes`,`members.seats`,`data.live_records`,`email.mailboxes`,`calendar.connections`],ju=new Set([`data.live_records`,`email.mailboxes`,`calendar.connections`]);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 Mu=[`B`,`KB`,`MB`,`GB`,`TB`];function formatByteSize(e){let{value:t,unitIndex:n}=computeByteMagnitude(e);return`${t} ${Mu[n]}`}const Nu=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(!Nu.includes(e.type))throw Error(`Property type "${e.type}" is not supported in .qualifyWith()`);t.push(e)}return{definitions:t}}const Pu=[`UPPER`,`LOWER`,`capitalize`,`trim`],Fu=[`prefix`,`suffix`,`wrap`,`default`],z=[...Pu,...Fu],Iu=/^\s*where\s*(?::(.*))?$/s,Lu=`[A-Za-z_][A-Za-z0-9_]*`,Ru=/^[^\s,()|{}="']+$/,zu=RegExp(`^(${Lu})\\s*=\\s*(.*)$`),Bu=RegExp(`^(${Lu})\\s+in\\s*\\(([^()]*)\\)$`);function isWherePipe(e){return Iu.test(e)}function parseWherePipe(e){let t=e.match(Iu)?.[1]?.trim();if(!t)return null;let n=t.match(Bu);if(n){let e=n[2].split(`,`).map(e=>e.trim());return e.every(e=>Ru.test(e))?{property:n[1],values:e}:null}let r=t.match(zu);return r&&Ru.test(r[2])?{property:r[1],values:[r[2]]}:null}const B=F.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(!z.includes(e))return!1}return!0},{message:`Invalid pipe name. Valid pipes: ${z.join(`, `)}`});function validateLabelExpression(e){let t=B.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 Vu=`(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=Vu){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 Hu=/^\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}$/;function getSingleAttributeFromExpression(e){let t=e.trim().match(Hu);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`||Bt(r).authoring.readOnly?null:r}const Uu=[{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:`create`,add:[`create`]},{id:`build`,add:[`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:`devices`,resources:[`devices`],levels:[{id:`manage`,add:[`manage`]}]}]},{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`]}]}]}],V=`none`,Wu=`custom`,H={actions:[`read`,`create`,`update`,`delete`],purge:`manage`,levels:[{id:`read`,add:[`read`]},{id:`edit`,add:[`create`,`update`]},{id:`full`,add:[`delete`]}]},U=Uu.flatMap(e=>e.capabilities),Gu=U.flatMap(e=>e.resources),Ku=new Map(U.flatMap(e=>e.resources.map(t=>[t,e])));function isCatalogResource(e){return Ku.has(e)}function capabilityForResource(e){let t=Ku.get(e);if(!t)throw new E(`Unknown catalog resource "${e}"`,D.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=V;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 V;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 Wu}const qu=[`read`,`create`,`update`,`delete`,`manage`],Ju=F.object({scope:F.enum([`object`,`system`]),target:F.string().min(1),actions:F.array(F.enum(qu))}).strict();function findGrantIssues(e,t){let n=[],r=new Map;for(let i of e){let e=Ju.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===`*`?[...H.actions,H.purge]:H.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 Yu=`memory`,Xu=4e3,Zu=`workspace`,W={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[W.name]),description:textValue(t[W.description]),content:textValue(t[W.content]),visibility:e.visibility,ownedBy:e.ownedBy,updatedAt:new Date(e.updatedAt).toISOString()}}const Qu={meetingHour:`0.80`,computeVcpuHour:`0.20`,browserHour:`0.60`},$u=[`meeting.recording`,`sandbox.agent`,`sandbox.harness`,`sandbox.build`,`browser.session`];function isMeteredChargeKind(e){return $u.includes(e)}const ed=/^\d+(?:\.\d+)?$/u;function meteredUsd(e,t){if(!ed.test(e))throw new O(`Invalid metered rate "${e}"`,[]);if(!(t>=0&&t<=2**53-1))throw new O(`Invalid metered duration "${t}"`,[]);let[n=`0`,r=``]=e.split(`.`),i=BigInt(n+r)*BigInt(t.toFixed(12).replace(`.`,``)),a=10n**BigInt(r.length+12-4),o=(i+a-1n)/a,s=10n**BigInt(4),c=(o%s).toString().padStart(4,`0`).replace(/0+$/u,``);return c?`${o/s}.${c}`:`${o/s}`}const td=`@standards/schema`;function createStandardSchemaProps(e){return{version:1,vendor:td,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(wl(this.build()))}constructor(e,t,n){Hc(t),Wc(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 Uc(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]=Qc(`date`,this.attr);if(e!==void 0)throw new O(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 N(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 N(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 N(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 N(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 N(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 N(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(dn(this.attr))throw Error(`Bilateral relations are not supported for universal relations (.toAny()).`);let n=t[0]?.object;if(!n)throw new O(`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 O(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 E(`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}").`,D.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 G={owner:`standardshq`,repo:`skills`,ref:`stable`},K=`[A-Za-z0-9._-]+`,nd=`[A-Za-z0-9_-]+`,rd=RegExp(`^(${nd})/(${K})@([a-z0-9-]+)(?:#(${K}))?$`),id=RegExp(`^(${nd})/(${K})$`),ad=/^[0-9a-f]{40}$/i;function isSafeSegment(e){return e!==`.`&&!e.startsWith(`-`)&&!e.includes(`..`)}function refuse$2(e,t){throw new O(`Invalid skill source "${e}": ${t} (expected owner/repo@skill or owner/repo@skill#ref)`,[{path:[`source`],message:t}])}function canonicalRef(e){return ad.test(e)?e.toLowerCase():e}function parseSkillSource(e){let t=e.trim(),n=t.startsWith(`github.com/`)?t.slice(11):t,r=rd.exec(n);if(!r)return refuse$2(e,`malformed or not a github.com source`);let[,i,a,o,s]=r;return[i,a,s??``].every(isSafeSegment)?{host:`github.com`,owner:i,repo:a,skill:o,ref:s===void 0?null:canonicalRef(s)}:refuse$2(e,"a segment cannot start with `-`, hold `..` or be `.`")}function isSkillRepository(e){return id.exec(e)?.slice(1).every(isSafeSegment)??!1}function formatSkillSource(e){let t=`${e.owner}/${e.repo}@${e.skill}`;return e.ref===null?t:`${t}#${e.ref}`}function isPinnedSkillSource(e){return e.ref!==null&&ad.test(e.ref)}const q=/^[a-z0-9][a-z0-9-]{0,62}$/,J=`core`;function assertBundleName(e){if(!q.test(e))throw new O(`Invalid bundle name "${e}": expected a lowercase slug matching ${q}`,[]);if(e===`core`)throw new O(`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 O(e,[{path:t,message:e}])}}function requireBuilderName(e,t){if(typeof e!=`string`||e.trim().length===0)throw new O(`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 O(`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 O(e,[{path:[...t,n],message:e}])}let n=C.safeParse({...e,name:`content`,placement:e.type===`group`?`grid`:`main`});if(!n.success)throw O.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 O(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 O?new O(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 O(`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&&S({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`]),S(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(Je,checkInputs(Je,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(Ie,checkInputs(Ie,{...measure(this.query,e,t),kind:`bar`}))}};const od={"7d":7,"30d":30};var AgendaBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}next(e){let t=typeof e==`number`?e:od[e];if(!Number.isInteger(t)||t<1){let e=`An agenda looks ahead a whole number of days, at least 1`;throw new O(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(ct,checkInputs(ct,{markdown:e}))}function decisions(){return new DecisionsBuilder(ze,{})}function meetingsUpcoming(){return new MeetingsUpcomingBuilder(qe,{})}function mailbox(){return new MailboxBuilder(Ge,{})}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 O(t,[{path:e,message:t}])}function traitsOf(e,t=[]){return fn(e,b,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(He,r),span:12}}function groupOf(e,t,n){let[r]=e.map(e=>e.name).sort(),i=Gt(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`),Dn(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=x.safeParse(m);if(!ee.success)throw O.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=x.safeParse(this.data);if(!t.success)throw O.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`])),Dn(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 k)}function assertPiece(e,t){if(typeof e!=`object`||!e)throw new O(`Unsupported bundle piece: ${t}`,[]);if(isViewPiece(e)||e instanceof k||typeof e.build==`function`)return;let n=e.name;throw new O(`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=x.safeParse(e);if(t.success)return t.data;let n=typeof e==`object`&&e&&`name`in e?String(e.name):`(unnamed)`,r=O.fromZodErrors(t.error.issues.map(e=>({path:e.path.map(String),message:e.message})));throw new O(`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 w(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(P({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})))}))}const sd={title:120,why:200,prompt:fi};function assertSetupWithinLimits(e){let t=Object.keys(sd).flatMap(t=>{let n=sd[t],r=e[t];return r!==void 0&&r.length>n?[{path:[`setup`,t],message:`Setup ${t} must be at most ${n} characters`}]:[]});if(t.length>0)throw new O(`Bundle setup is invalid`,t)}function assertSetup(e,t){e&&assertSetupWithinLimits(e);for(let e of Object.values(t))assertSetupWithinLimits({title:e[`setup.title`],why:e[`setup.why`],prompt:e[`setup.prompt`]})}function assertSkills(e){let t=new Set,n=e.flatMap(e=>{let n=skillProblem(e,t);return n===null?[]:[{path:[`skills`],message:n}]});if(n.length>0)throw new O(`Bundle skills are invalid`,n)}function skillProblem(e,t){let n;try{n=parseSkillSource(e)}catch(t){return t instanceof Error?t.message:`Invalid skill source "${e}"`}return n.owner!==G.owner||n.repo!==G.repo?`Skill "${e}" must come from ${G.owner}/${G.repo}`:n.ref===null?t.has(n.skill)?`Skill "${e}" is declared twice`:(t.add(n.skill),null):`Skill "${e}" cannot pin a ref`}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(M);if(e!==void 0)throw new T(e,`bundle`)}let{setup:s}=e,c=e.translations??{};assertSetup(s,c);let l=e.skills??[];return assertSkills(l),{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??[],...s?{setup:s}:{},...l.length>0?{skills:l}:{},translations:c}}const cd=Symbol.for(`standards.bundle`);function isBundle(e){return typeof e==`object`&&!!e&&e[cd]===!0}var BundleBuilder=class{constructor(e,t){this[cd]=!0,this.pieces=[],this.used=[],this.descriptionText=null,this.sampleRecords=[],this.skillSources=[],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()}setup(e){return this.setupInvitation=e,this.changed()}skills(...e){return this.skillSources=[...this.skillSources,...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 k)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,...this.setupInvitation?{setup:this.setupInvitation}:{},skills:this.skillSources,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 w(`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 ld=F.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=F.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 F.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=[...z,`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 O(`[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(ld.safeParse(n.readOnly).success)continue;let t=isFormFreeFieldRef(n)?n.attribute.name:n.attribute,r=isFormFreeFieldRef(n)?`free field`:`field`;throw new O(`[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(L);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: ${L.join(`, `)}`)}}}};function form(e,t){return new FormBuilder(e,t)}const ud=`box`,dd=[`circle`,`square`],fd=[`upload`,`website`,`name`,`email`];function isImageSource(e){return fd.some(t=>t===e)}const pd={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?Wl(r):void 0),a=e.icon??t?.icon??`box`;return i?{kind:`tile`,icon:a,color:i}:{kind:`glyph`,icon:a}}const md=F.object({shape:F.enum(dd),from:F.array(F.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 O(`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 E(`Object "${t}" must have a labelExpression. The labelExpression defines how records are displayed in lists and relations (e.g. "{{ name }}").`,D.VALIDATION_FAILED);let i=B.safeParse(n);if(!i.success){let e=i.error.issues[0]?.message??`Invalid labelExpression`;throw new E(`Invalid labelExpression for "${t}": ${e}`,D.VALIDATION_FAILED)}if(r!==void 0){let e=B.safeParse(r);if(!e.success){let n=e.error.issues[0]?.message??`Invalid embeddingExpression`;throw new E(`Invalid embeddingExpression for "${t}": ${n}`,D.VALIDATION_FAILED)}}}var ObjectBuilder=class{get"~standard"(){return createStandardSchemaProps(El(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);Lc([...this.obj.attributes,...t],e=>e.name,e=>new w(`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}hierarchical(){return this.obj.hierarchical=!0,this}build(){if(!this.obj.name)throw new O(`[ObjectBuilder] Missing required field: name`,[{path:[`name`],message:`name is required`}]);if(!this.obj.label)throw new O(`[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&&Gc(e)}};function object(e,t){if(M(e))throw new T(e,`builder`);return new ObjectBuilder(e,t)}function validatePresetStructure(e,t,n){let fail=(t,n)=>{throw new O(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`&&S(this.extension,e.parameters,[`content`,`parameters`]),e}},hd=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})}alwaysOpen(){let{collapsed:e,...t}=this.presentation();return new GroupBuilder(this.data.name,this.data.label,this.data.fields,{...t,collapsible:!1})}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 O?new O(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 hd(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 O(`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 O(`Expected custom content`,[]);let r=new Z({...n,extension:e.name},e);return r.build(),r}function recordLinksTab(){return[y.name,y.label,custom(tt,{}).icon(y.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 O(e,[{path:[`content`,`page`,`object`],message:e}])}return new Z({type:`page`,page:{object:t,name:n}})}const gd={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<=A.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<=A.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=mn(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??xn(s,b),l=Kt([...s.values()]),u=o.filter(e=>!l.has(e.name)),d={},f=[],place=(e,t)=>{t&&!Object.values(d).some(e=>bn(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=mn(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 _d=[`record`,`document`,`file`,`email`,`thread`,`event`,`memory`,`skill`,`schema`,`user`,`guide`,`bundle`,`draft`,`decision`,`session`,`catalog`],vd=new Set([`memory`,`schema`]),yd=/^[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 _d.includes(e)}function refuse$1(e,t){return{ok:!1,reason:e,expected:t}}function parseReference(e){let t=e.trim();if(yd.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 ${_d.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===`*`&&!vd.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===`*`&&vd.has(e.kind)}function requestedCapabilities(e){let t=[];return e.canModify&&t.push(`modify`),e.canSend&&t.push(`send`),t}const bd={status:`connector_status`,error:`connector_error`,provider:`connector_provider`,quota:`connector_quota`},xd={phone:`text`,currency:`number`},Sd={rename:[`kind`,`object`,`from`,`to`],phone:[`kind`,`object`,`attribute`,`to`,`defaultCountryCode`],currency:[`kind`,`object`,`attribute`,`to`,`currencyCode`]};function refuse(e,t,n){throw new O(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(zc(t)||refuse(e,void 0,`Resolution ${e} must be an object`),t.kind===`rename`){assertKeys(e,t,Sd.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,Sd[t.to]),t.to===`phone`){let n=t.defaultCountryCode;/^[A-Z]{3}$/.test(n)&&ql(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)&&Kl(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 O("`resolutions` must be an array",[{path:[`resolutions`],message:"`resolutions` must be an array"}]);if(e.length>100)throw new O(`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=Jl(n,Vl(t));if(!r?.isPossible()||r.country===void 0||r.ext!==void 0)return;let i=Gl(r.country)?.iso3;if(i!==void 0)return{value:{countryCode:i,phoneNumber:Ul(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=F.string().refine(e=>e.trim().length>0,`Must not be blank`),Cd=F.union([F.tuple([F.literal(`object`),Q]),F.tuple([F.literal(`attribute`),Q,Q]),F.tuple([F.literal(`view`),Q,Q]),F.tuple([F.literal(`content`),Q,Q,Q])]),wd=F.object({label:Q,pluralLabel:F.string().optional(),description:F.string().optional(),icon:j.optional(),color:Rc.optional(),image:md.optional(),labelExpression:F.string(),embeddingExpression:F.string().optional(),sealed:F.boolean().optional(),toleratedAttributes:F.array(Q).optional(),metadata:F.record(F.string(),F.unknown()).optional(),documentLayout:F.record(F.string(),F.unknown()).optional(),hierarchical:F.boolean().optional()}).strict();function failure(e){throw new O(e,[])}function definitionSchema(e){return F.custom(t=>{let n=F.record(F.string(),F.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`:wd.parse(n);break;case`attribute`:{let e=F.enum(Ne).parse(n.type);$c(e).extend({type:F.literal(e),label:Q,required:F.boolean().optional(),unique:F.boolean().optional(),icon:j.optional()}).strict().parse(n);break}case`view`:{let{contents:t,...r}=n,i=F.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`:C.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=F.record(F.string(),F.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=F.object({modelVersion:F.literal(1),hashVersion:F.literal(1),tenant:Q,sourceFingerprint:F.string().regex(/^[a-f0-9]{64}$/),entries:F.array(F.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]}`),O.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=Cd.parse(F.object({address:F.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`?F.object({id:F.string().uuid(),updatedAt:F.string().datetime()}).strict():F.object({id:F.string().uuid(),revision:F.number().int().nonnegative()}).strict(),o=F.object({address:Cd,source:i,effective:i,status:F.enum([`source`,`runtime`,`copy`,`suppressed`]),sourceOwner:F.string().regex(R).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 F.ZodError?O.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`:P(n.source)===P(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 $=F.string().min(1),Td=F.union([F.object({objectName:$,viewName:$,contentName:$.optional()}).strict().describe(`Full configuration of a view, or of one content when contentName is given`),F.object({objectId:$}).strict().describe(`An object with its attributes, by id`),F.object({objectName:$}).strict().describe(`An object with its attributes`),F.object({objectId:$,attributeName:$}).strict().describe(`One attribute's config, by name`),F.object({objectId:$,attributeId:$}).strict().describe(`One attribute's config, by id`),F.object({objectId:$,recordId:$}).strict().describe(`One sample record`)]);function parseNamedTarget(e){let t=Td.safeParse(e);if(!t.success)throw new O(`Invalid scoped target`,[{path:[`target`],message:`Expected exactly one named target branch`}]);return t.data}const Ed=[`object`,`attribute`,`view`,`content`,`sample`],Dd=F.object({mode:F.enum([`inline`,`window`]),interaction:F.enum([`static`,`interactive`]),size:F.enum([`compact`,`regular`]),aspectRatio:F.number().positive().finite().optional()}).strict(),Od=F.object({artifactId:F.string().min(1),revision:F.number().int().positive(),name:F.string().min(1),kind:F.string().min(1),retention:F.enum(Cu),display:Dd}).strict();function readArtifactResult(e){let t=Od.safeParse(e);return t.success?t.data:null}const kd=F.string().regex(/^[^/\s]+\/[^/\s]+$/),Ad=F.object({kind:F.literal(`generated-image`),artifact:F.unknown(),generation:F.object({attemptId:F.uuid(),requestedModelId:kd,executedModelId:kd.nullable(),format:F.enum(ku),mimeType:F.enum([`image/png`,`image/jpeg`,`image/webp`])}).strict()}).strict();function readGeneratedImageResult(e){let t=Ad.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 jd={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,jd)}}return[...t.values()]}const Md={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,Md);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,Md)}}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 Nd=F.object({provider:F.custom(e=>isNonBlankString(e)&&e.length<=200,{message:`must be a non-blank string of at most 200 characters`}),model:F.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 Pd=Object.keys({home:!0,agents:!0,routines:!0,object:!0,settings:!0}),Fd=[`dot`,`label`,`bubble`];function parseNewsIntensity(e){return Fd.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 Id=/^(\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=Id.exec(e),r=Id.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 Id.test(e)}const Ld=30,Rd=90,zd=50,Bd=F.looseObject({fr:F.string().optional(),en:F.string().optional()}),Vd=F.iso.datetime({offset:!0}),Hd=F.looseObject({id:F.string().min(1),slug:F.string().min(1),updatedAt:Vd,publishedAt:Vd,since:F.string(),displayDays:F.number().int().positive().optional(),requires:F.looseObject({capability:F.string(),level:F.string()}).optional(),target:F.string().optional(),intensity:F.unknown().optional(),title:Bd,summary:Bd});function knownRequirement(e){let t=U.find(t=>t.id===e.capability);return t!==void 0&&levelActions(t,e.level).length>0}function parseEntry(e){let t=Hd.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 O(`News feed: document must be an object`,[]);let n=e;if(!Array.isArray(n.entries))throw new O(`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=F.looseObject({id:F.string().min(1),slug:F.string().min(1),updatedAt:Vd,body:Bd});function parseNewsBody(e){let t=Ud.safeParse(e);if(!t.success)throw new O(`News body: malformed document`,[]);if(!hasLocale(t.data.body))throw new O(`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 Wd=``;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=F.strictObject({model:Nd.optional(),routing:F.literal(`auto`).optional()}),Kd=F.strictObject({inApp:F.boolean()});function isActionableType(e){let t=h[e];return t!==void 0&&De(t.kind)}const qd=[preference(`workPosture`,{value:F.enum(_o),default:`auto`,audited:!0}),preference(`chat.default`,{value:Gd,default:{},audited:!0}),preference(`conversationSurface`,{value:F.enum(hi),default:`panel`}),preference(`mailboxListMode`,{value:F.enum(oa),default:`threads`}),preference(`home`,{value:F.string().uuid().nullable(),default:null}),preference(`memory.learnFromEmail`,{value:F.boolean(),default:!0,audited:!0}),preference(`memory.shareWithTeam`,{value:F.boolean(),default:!0,audited:!0}),preference(`onboarding.completed`,{value:F.boolean(),default:!1,audited:!1}),preference(`decisions.seenAt`,{value:F.iso.datetime().nullable(),default:null}),preference(`decisions.delivery`,{value:Kd,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{Fr as ACCESS_LEVELS,Ir as ACCESS_ROLES,e as ACTIONABLE_DECISION_KINDS,g as AGENDA_BLOCK,Lr as AGENT_ASIDE_ANSWER_MAX_LENGTH,Rr as AGENT_ASIDE_HISTORY_LIMIT,zr as AGENT_ASIDE_QUESTION_MAX_LENGTH,Br as AGENT_AVATAR_EXPRESSIONS,Vr as AGENT_AVATAR_TYPES,Hr as AGENT_MESSAGE_KIND,Ur as AGENT_NOTIFICATION_KIND,Wr as AGENT_SESSION_ACCESS_ROLES,Gr as AGENT_SESSION_LIST_ORDERS,Kr as AGENT_SESSION_ORIGINS,qr as AGENT_SESSION_PROVENANCES,Jr as AGENT_STARTERS_MAX,Yr as AGENT_STARTER_MAX_LENGTH,Xr as AGENT_SYSTEM_PROMPT_MAX_LENGTH,Zr as AGENT_TASK_KINDS,t as AGGREGATE_BUCKETS,n as AGGREGATE_MEASURES,Nu as ALLOWED_PROPERTY_TYPES,Qr as ALL_CATALOG_TOOL_NAMES,z as ALL_PIPES,$r as ALWAYS_KINDS,pd as APPEARANCE_FACETS,ei as APPROVAL_FAMILY_TOOL_NAMES,ti as ARCHITECT_PUBLICATION_KIND,wu as ARTIFACT_FILE_ROLES,Su as ARTIFACT_KINDS,je as ARTIFACT_PREVIEW_EXTENSION,Cu as ARTIFACT_RETENTIONS,ni as ASK_QUESTIONS_ANSWER_MAX_LENGTH,ri as ASK_QUESTIONS_ANSWER_MAX_VALUES,ii as ASK_QUESTIONS_MAX_BATCH,ai as ASK_QUESTIONS_TOOL_NAME,Me as ATTRIBUTE_FILTER_OPERATORS,Oc as ATTRIBUTE_NAME_SCHEMA,Ne as ATTRIBUTE_TYPES,oi as AUDIT_ACTIONS,si as AUDIT_AGENT_SESSION_METADATA_KEY,ci as AUDIT_RESOURCE_TYPES,Gn as AccessDeniedError,AgendaBuilder,k as AgentBuilder,Kn as AggregateValidationError,qn as AmbiguousSchemaChangeError,Jn as AttributeInUseError,Yn as AttributeNotFoundError,Pe as BLOCK_CONTEXTS,Fe as BLOCK_PERIODS,_ as BLOCK_WIDTHS,li as BROWSER_LAUNCH_TOOL_NAME,ui as BROWSER_TOOL_NAMES,di as BUNDLE_LOCALES,q as BUNDLE_NAME_PATTERN,fi as BUNDLE_SETUP_PROMPT_MAX_LENGTH,Mu as BYTE_UNIT_LABELS,BlockContentBuilder,BundleBuilder,v as CARD_BLOCK,Gu as CATALOG_RESOURCES,Ie as CHART_BLOCK,Le as CHART_KINDS,qc as COMPUTED_RETURN_TYPES,pi as CONNECTION_GRANT_PROVIDERS,bd as CONNECTOR_CALLBACK_PARAM,Re as CONTENT_PLACEMENT_CONTEXTS,mi as CONTINUATION_KEY_PATTERN,hi as CONVERSATION_SURFACES,gi as COPY_VERB_NAME,J as CORE_BUNDLE_NAME,qd as CORE_PREFERENCES,_i as CORE_RECORD_TOOL_NAMES,vi as CORE_TOOL_NAMES,yi as COUNT_MODES,Wu as CUSTOM_LEVEL,CardBuilder,ChartBuilder,ChartQuery,Xn as ConcurrentModificationError,Z as ContentBuilder,ze 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_TRANSFERS_KEY,f as DECISION_TYPES_V1,p as DECISION_TYPE_ACCESS_GRANTED,m as DECISION_TYPE_AGENT_APPROVAL,ee as DECISION_TYPE_AGENT_MESSAGE,te as DECISION_TYPE_AGENT_QUESTION,ne as DECISION_TYPE_AGENT_REVIEW,re as DECISION_TYPE_AGENT_ROUTINE_RUN_FAILED,ie as DECISION_TYPE_AGENT_SETUP,ae as DECISION_TYPE_BUNDLE_SETUP,oe as DECISION_TYPE_CONNECTOR_CONNECTION_ERROR,se as DECISION_TYPE_CONNECTOR_CONNECTION_REAUTH_REQUIRED,ce as DECISION_TYPE_ENVIRONMENT_BUILD_FAILED,h as DECISION_TYPE_KINDS,le as DECISION_TYPE_PERSON,ue as DECISION_TYPE_RECORD_ASSIGNED,de as DECISION_TYPE_RECORD_MENTIONED,fe as DECISION_WORK_STATES,bi as DEFAULT_AGENT_EXECUTION_CONFIG,xi as DEFAULT_AGENT_TOOL_GROUPS,ud as DEFAULT_APPEARANCE_ICON,Si as DEFAULT_APPROVAL_POLICY,Ci as DEFAULT_BLUEPRINT_TOOL_GROUPS,wi as DEFAULT_DAILY_ACTIVITY_DAYS,xu as DEFAULT_DICTATION_LIMITS,Vu as DEFAULT_LABEL_FALLBACK,Be as DEFAULT_LAYOUT_TRAITS,Ti as DEFAULT_MEETING_BOT_DISPLAY_NAME,Ei as DEFAULT_TENANT_SETTINGS,Rl as DEFAULT_VALIDATION_MESSAGES,Di as DEVICE_ACCESS_ROLES,$l as DEVICE_CHANNEL_AUTHENTICATE_TIMEOUT_MS,eu as DEVICE_CHANNEL_IDLE_POLL_MS,nu as DEVICE_CHANNEL_KEEPALIVE_MS,Ql as DEVICE_CHANNEL_MAX_FRAME_BYTES,Zl as DEVICE_CHANNEL_PATH,tu as DEVICE_CHANNEL_PRESENCE_MS,ru as DEVICE_CHANNEL_WORKER_CLOSE_PROTOCOL_VIOLATION,au as DEVICE_COMMAND_ERROR_CODES,su as DEVICE_DESKTOP_STATES,ou as DEVICE_SHELLS,yu as DICTATION_FINALIZATION_TIMEOUT_MS,pu as DICTATION_FRAME_BYTES,hu as DICTATION_MAX_BUFFER_BYTES,mu as DICTATION_MAX_FRAME_BYTES,gu as DICTATION_MAX_TRANSCRIPT_BYTES,bu as DICTATION_MODEL_ID,vu as DICTATION_PREPARATION_TIMEOUT_MS,fu as DICTATION_SAMPLE_RATE,_u as DICTATION_TICKET_TTL_MS,Oi as DISCARD_ARCHITECT_DRAFT_TOOL_NAME,ki as DOCUMENT_SORT_MODES,Ed as DRAFT_CONFLICT_KINDS,Ai as DRAFT_WRITE_TOOL_NAMES,DecisionsBuilder,DeviceChannelProtocolError,uu as DeviceChannelServerFrameSchema,lu as DeviceChannelWorkerFrameSchema,cu as DeviceDesktopStatusSchema,w as DuplicateError,ji as EMAIL_CATEGORY_DEFAULT_COLOR,Mi as EMAIL_CATEGORY_DEFAULT_ICON,Ni as EMAIL_CATEGORY_DESCRIPTION_MAX,Pi as EMAIL_CATEGORY_DESCRIPTION_MIN,Fi as EMAIL_CATEGORY_LIMIT,Ii as EMAIL_CATEGORY_NAME_MAX,Li as ENVIRONMENT_BUILD_LOG_STEP_PREFIX,Ri as ENVIRONMENT_HARNESSES,zi as ENVIRONMENT_HARNESS_SANDBOX_WORKDIR,Bi as ENVIRONMENT_HARNESS_WORKDIR,Vi as ENVIRONMENT_IMAGES,Hi as ENVIRONMENT_MEMORY_GB_PER_VCPU,Ui as ENVIRONMENT_NAME_MAX_CHARS,Wi as ENVIRONMENT_NETWORK_ALLOW_MAX,Gi as ENVIRONMENT_SCRIPT_MAX_BYTES,Ki as ENVIRONMENT_SIZES,qi as ENVIRONMENT_SIZE_VCPUS,Ji as ENVIRONMENT_STANDARDS_WORKDIR,Yi as ENV_VAR_KEY_PATTERN,Xi as ESTIMATED_COUNT_CAP,Zn as ExportTooLargeError,Zi as FILE_URLS_MAX_IDS,L as FORM_FORBIDDEN_ATTRIBUTE_TYPES,Qn as ForbiddenError,FormBuilder,FormRowBuilder,FormStepBuilder,Qi as GET_ARCHITECT_DRAFT_TOOL_NAME,$i as GITHUB_TRIGGER_CATALOG,ea as GRANT_ENABLES,Ve as GROUPABLE_ATTRIBUTE_TYPES,hd as GroupBuilder,He as HEADING_BLOCK,pe as HIERARCHY_ATTRIBUTE_IDS,me as HIERARCHY_ATTRIBUTE_NAMES,he as HIERARCHY_CHILD_IDS_LIMIT,ta as HITL_TOOL_NAMES,ku as IMAGE_FORMATS,dd as IMAGE_SHAPES,fd as IMAGE_SOURCES,na as INFERENCE_REASONING_OPTIONS,ra as INFERENCE_ROUTING_MODES,ia as INFERENCE_SPEEDS,Ue as INVENTORY_LIMIT,$n as InvalidPermissionGrantError,aa as LAST_RUN_ERROR_MAX_LENGTH,kc as LIST_VIEW_TAB_VISIBILITIES,We as LOCATION_FILTER_PROPERTIES,er as LogoProviderUnavailableError,tr as LogoSearchRateLimitedError,Ge as MAILBOX_BLOCK,oa as MAILBOX_LIST_MODES,sa as MAIL_DRAFT_BODY_MAX_CHARS,ca as MAIL_SIGNATURE_MAX_CHARS,la as MAIL_SUBJECT_MAX_CHARS,ge as MAX_AGGREGATE_GROUPS,ua as MAX_DAILY_ACTIVITY_DAYS,du as MAX_PRESET_DEPTH,da as MAX_TODOS,fa as MAX_TODO_DESCRIPTION_CHARS,pa as MAX_TODO_ID_CHARS,ma as MCP_SERVER_NAME_MAX_LENGTH,Ke as MEASURABLE_ATTRIBUTE_TYPES,qe as MEETINGS_UPCOMING_BLOCK,ha as MEETING_BOT_IMAGE,ga as MEETING_BOT_IMAGE_BASE64_MAX_LENGTH,_a as MEETING_BOT_NO_CREDITS,va as MEETING_BOT_SILENT_REASON,ya as MEETING_RESPONSES,W as MEMORY_ATTRIBUTES,Xu as MEMORY_PAGE_MAX_CHARS,ba as MEMORY_SPEND_LIMIT_PATTERN,Zu as MEMORY_WORKSPACE_PROFILE,Yu as MEMORY_WRITE_SOURCE,$u as METERED_CHARGE_KINDS,Qu as METERED_RATES_USD,Je as METRIC_BLOCK,MailboxBuilder,xa as McpOAuthCompletionMode,nr as MemoryNotFoundError,MetricBuilder,MetricQuery,MultiRelationAttributeBuilder,Yl as NATIVE_AGENT_UI_PART_IDS_METADATA_KEY,Xl as NATIVE_AGENT_UI_PART_IDS_METADATA_SCHEMA_VERSION,Ye as NATIVE_BLOCKS,Ac as NATIVE_OBJECT_NAMES,Sa as NATIVE_TOOL_GROUPS,Ca as NATIVE_TOOL_GROUP_CATALOG,Ld as NEWS_DEFAULT_DISPLAY_DAYS,Rd as NEWS_DISPLAY_CAP_DAYS,zd as NEWS_INDEX_MAX_ENTRIES,Fd as NEWS_INTENSITIES,Pd as NEWS_TARGET_KINDS,V as NO_ACCESS,Wd as NO_PREFERENCE_PARAMETER,wa as NO_RECORDING,Xe as NO_VALUE_OPERATORS,hl as NonJsonValueError,NoopGeocodingAdapter,rr as NotFoundError,ir as NotImplementedError,H as OBJECT_GRANT,jc as OBJECT_NAME_SCHEMA,G as OFFICIAL_SKILLS_REPO,Ta as OPEN_TOOL_PART_STATES,Ea as OPERATION_MAX_STEPS,Ze as OPERATORS_BY_TYPE,ObjectBuilder,ar as ObjectNotFoundError,or as ObjectReferencedError,sr as OrphanSystemAttributeError,Qe as PAGE_GRID_COLUMNS,qu as PERMISSION_ACTIONS,U as PERMISSION_CAPABILITIES,Uu as PERMISSION_CATALOG,ju as PERSISTENCE_OWNED_QUOTA_KEYS,Fu as PIPES_WITH_ARGS,Da as PROVIDER_DRAFT_LABEL,Oa as PROVIDER_NAMES,ka as PUBLIC_MAIL_DOMAINS,Y as PageBuilder,cr as PageReferencedError,lr as ProtectedResourceError,ur as ProtectedRoleError,$e as QUALIFIED_SEPARATOR,et as QUERY_OBJECT,Aa as QUESTION_FAMILY_TOOL_NAMES,Au as QUOTA_KEYS,dr as QueryTimeoutError,ja as RECENT_ACTIVITY_LEDGER_LIMIT,Ma as RECIPIENT_IDENTITIES_MAX,Na as RECORDING_OVERRIDES,Pa as RECORDING_POLICIES,Fa as RECORD_ACCESS_ROLES,Ia as RECORD_ACCESS_SOURCES,La as RECORD_DRIVE_CURSOR_MAX_LENGTH,Ra as RECORD_DRIVE_PAGE_DEFAULT_LIMIT,za as RECORD_DRIVE_PAGE_MAX_LIMIT,Ba as RECORD_GRAPH_DEFAULT_LIMIT_PER_NODE,Va as RECORD_GRAPH_MAX_LIMIT_PER_NODE,Ha as RECORD_GRAPH_MAX_NODES,Ua as RECORD_IMAGE_MAX_BYTES,tt as RECORD_LINKS_BLOCK,y as RECORD_LINKS_CONTENT,Mc as RECORD_LIST_SCOPES,nt as RECORD_OBJECT,_d as REFERENCE_KINDS,rt as RELATION_TARGET_ANY,it as REMOVED_OPERATOR_REPLACEMENTS,Wa as REPLY_MODES,Ga as REQUEST_DESIGN_REVIEW_TOOL_NAME,Ka as REQUEST_SETUP_TOOL_NAME,Nc as RESERVED_ATTRIBUTE_NAMES,Pc as RESERVED_OBJECT_NAMES,qa as RESOURCE_GRANT_KINDS,Ja as RESOURCE_KIND_CATALOG,Fc as RESOURCE_VISIBILITIES,Ya as ROUTING_PRICE_CEILINGS,fr as RealtimeDeliveryError,pr as RealtimeRateLimitedError,mr as RealtimeSubscriptionError,hr as RecordNotFoundError,at as RecordQuery,gr as RecordReferencedError,_r as RepositoryError,T as ReservedObjectNameError,vr as RoleNotFoundError,A as SCHEMA_LIMITS,R as SCHEMA_OWNER_PATTERN,xd as SCHEMA_SOURCE_RETYPE_FROM,Xa as SEND_VERB_NAME,Za as SESSION_INFERENCE_PATCH_KEYS,Pu as SIMPLE_PIPES,Jc as SIMPLE_PROPERTY_TYPES,Qa as SLACK_TRIGGER_CATALOG,$a as SPEAKS_THROUGH_SEND_METADATA_KEY,td as STANDARD_SCHEMA_VENDOR,eo as SURFACE_TOOL_NAMES,ot as SYNONYM_ALIASES,_e as SYSTEM_ATTRIBUTES,ve as SYSTEM_ATTRIBUTE_I18N_KEYS,to as SYSTEM_EMAIL_CATEGORIES,no as SYSTEM_EMAIL_CATEGORY_NAMES,Ic as SYSTEM_FIELD_NAMES,st as SYSTEM_FILTER_ATTRIBUTE_TYPES,ro as SYSTEM_PART_CODES,E as SchemaError,D as SchemaErrorCode,yr as SearchBackendError,br as SearchPathNotIndexedError,SingleRelationAttributeBuilder,xr as StorageError,Sr as SyncCascadeError,Cr as SyncConflictError,wr as SyncError,Tr as SystemEntityImmutableError,io as TASK_DEMAND_LEVELS,Tu as TENANT_INVITATION_DEFAULT_TTL_MS,Du as TENANT_INVITATION_MAX_TTL_MS,Eu as TENANT_INVITATION_MIN_TTL_MS,Ou as TENANT_INVITATION_RESEND_INTERVAL_MS,ct as TEXT_BLOCK,Il as TEXT_FORMAT_PATTERNS,ao as TODO_PHASES,oo as TODO_PLAN_STATUSES,so as TODO_STATUSES,co as TOOL_APPROVAL_STATES,lo as TOOL_IMPACT_COUNT_KEYS,uo as TRIAGE_ACTIONS,fo as TRIGGER_EVENT_TYPES,po as TURN_OUTCOMES,Er as ToolGroupGrantError,mo as UNSHAREABLE_OBJECT_NAMES,ho as USERS_RESOLVE_MAX_IDS,go as USER_STATUSES,_o as USER_WORK_POSTURES,vo as VERB_NAMES,O as ValidationError,X as ViewBuilder,Yc as WIRE_OFFERED_BASE_CONFIG,Xc as WIRE_OMITTED_CONFIG_KEYS,Dr as WorkspaceInvariantReason,yo as agent,bo as agentAvatarFromMetadata,xo as agentAvatarSchema,So as agentDataChunk,Co as agentDisplayName,wo as agentInferencePreferencesSchema,To as agentMessageAttachmentSchema,Eo as agentMessagePartSchema,Do as agentScheduleSchema,Oo as agentSessionInferenceOverridesInputSchema,ko as agentSessionInferenceOverridesSchema,Ao as agentSessionMessageSchema,jo as agentStartersSchema,Mo as agentTriggerBaseSchema,No as agentTriggerPatchSchema,Po as agentTriggerSchema,Fo as agentUIValidationError,applyPipes,Io as artifactQuoteSchema,gl as asTenantId,_l as asUserId,Lo as askQuestionsOutputSchema,assertBundleName,Ro as assertCustomAgentUIMessageChunk,assertSchemaSourceResolutions,zo as assertSessionState,Zc as attributeConfigSchemas,lt as attributeFilterTarget,ut as attributeInventory,dt as blockObjectInputs,buildPropertySchema,ft as buildQualifiedAttribute,builtBundleFromPieces,bundle,P as canonicalStringify,Bo as canonicalToolGroups,pt as canonicalizeFilterValue,capabilityForResource,mt as capped,checkbox,Vo as classificationRestoreSchema,Ho as classifyEmailSchema,Uo as cliDefaultModelOf,ht as collectContentViewCatalogue,gt as collectQualifiedRuleIssues,_t as collectionContentSourceSchema,vt as collectionSourceAddress,yt as collectionSourceAddressOf,Rc as colorIdSchema,bt as columnsSchema,Wo as compareAgentSessionMessages,compareSchemaStateEntries,compareVersions,Go as compiledHarnessModels,computeByteMagnitude,computeReconnectDelay,computeRetryDelay,Ko as connectionGrantKindsOf,qo as connectorTriggerMatchSchema,gd as content,contentDefinition,b as contentExtensionRegistry,xt as contentReadObjects,x as contentViewDefinitionSchema,St as contentViewDefinitionSchemaFor,convertRetypedValue,wl as createAttributeValidator,Tl as createFormAttributeValidator,createStandardSchemaProps,currency,Ct as currentActor,Jo as customDataChunkSchemas,date,ye as decisionThreadKey,be as decisionTransferBy,xe as decisionTransfersOf,declaredImageRequests,Yo as decodeAgentSessionListCursor,vl as deepEqual,wt as defineBlock,deriveLayout6,Xo as deriveViewerAccess,Tt as describeViewIssue,detailView,deviceChannelUrl,diffSchemaState,Et as displayAttributesSchema,document,Dt as draftContentViewDefinitionSchema,Ot as draftContentViewDefinitionSchemaFor,droppedContents,Zo as durableDateSchema,kt as edgePropertyFilterTarget,Qo as emailCategoryCreateSchema,$o as emailCategoryDeleteSchema,es as emailCategoryScopeQuerySchema,ts as emailCategoryUpdateSchema,ns as emailRuleScopeSchema,rs as encodeAgentSessionListCursor,is as environmentHarness,as as environmentWorkdir,extractAttributeNames,extractAttributePaths,At as extractCurrencyFilterValue,jt as extractFilterValue,extractReadRecordIds,extractTouchedArtifacts,extractTouchedDocuments,extractTouchedRecords,Mt as filterOperatorsOfType,Nt as filterStateSchema,Pt as filterTargetsOf,os as findEnvironmentHarness,findGrantIssues,Ft as findGridViolation,It as findGroupViolation,Lt as findLayoutRuleViolation,Rt as findRelationAttribute,zt as findRowLimitViolation,form,formFieldFlatKey,formFieldKey,formatByteSize,Se as formatDecisionLink,formatNewsTarget,Bl as formatPhoneForDisplay,formatReference,formatSkillSource,zl as formatZodErrors,formula,yl as generateId,Bt as getAttributeCapabilities,$c as getAttributeConfigSchema,el as getAttributeConfigWriteSchema,Vt as getAttributeFilterOperators,getEditableLabelAttribute,Ce as getHierarchyAttributes,we as getObjectSystemAttributes,Ht as getOperatorPolarity,Ut as getRollupFilterOperators,getSingleAttributeFromExpression,getSlotFieldTargets,Te as getSystemAttributeI18nKey,Ee as getSystemAttributeList,ss as githubConditionSchema,cs as githubTriggerMatchSchema,ls as grantKindOf,Wt as gridPositionSchema,group,Gt as groupSizeMessage,Kt as groupedMembers,us as harnessModelChoices,hasLocale,hasOptions,hashBundlePieces,ds as humanRequestId,fs as humanRequestKind,j as iconNameSchema,imageLookupKindOf,imageModelFormatDefect,ps as imageModelIdSchema,bl as indexBy,qt as inferInverseCardinality,ms as inferenceReasoningSchema,hs as inferenceRoutingSchema,gs as inferenceSpeedSchema,Jt as input,Yt as invalidViewMessage,De as isActionableDecisionKind,_s as isAgentMessageMetadata,vs as isAgentNotificationMetadata,ys as isAgentUIDataName,bs as isAgentWrittenAuditEntry,xs as isArchitectPublicationMetadata,Xt as isAttributeFilterable,Zt as isAttributeGroupable,Or as isAttributeInUseError,Qt as isAttributeKanbanGroupable,$t as isAttributeSearchable,en as isAttributeSortable,Ss as isAwaitingHuman,tn as isBilateralRelation,Cs as isBlocking,isBundle,nn as isCalendarDay,isCatalogResource,rn as isCollectionContent,an as isDynamicValue,Dl as isEmptyValue,ws as isEnvironmentHarnessId,isFormDefinition,isFormFieldsRow,isFormFreeFieldRef,isFormHeadingRow,isFormSeparatorRow,isFormSlotFieldRef,isFormTextRow,Oe as isHierarchyAttribute,isImageSource,isLabelExpression,on as isLocationFilterProperty,sn as isLocationPartOperator,Ts as isMailProvider,Es as isMailboxListMode,ke as isManagedSystemAttribute,isMeteredChargeKind,M as isNativeObjectName,Ds as isNativeToolGroup,cn as isNoValueOperator,kr as isNotFoundError,Ol as isNullishOrEmptyString,Ar as isObjectReferencedError,Os as isOpenToolPartState,ks as isParkedOnHuman,isPinnedSkillSource,zc as isPlainRecord,jr as isProtectedResourceError,As as isProviderDraft,js as isPublicMailDomain,Ms as isQuestionPart,Mr as isRecordReferencedError,ln as isRelativeDateValue,Ns as isReplyMode,Ps as isResourceGrant,Fs as isRoutineActorMetadata,Nr as isSchemaError,isSemver,Is as isSessionInferencePatch,un as isSetMembershipOperator,isSkillRepository,isStandardSchema,Ls as isSystemEmailCategory,Rs as isSystemEmailCategoryName,zs as isSystemPartCode,Bs as isToolApprovalState,Vs as isToolImpactCountKey,dn as isUniversalRelation,Pr as isValidationError,kl as isValuePresent,isWherePipe,isWildcard,judgePreferenceWrite,keptFill,B as labelExpressionSchema,fn as layoutTraitsOf,levelActions,levelFloor,levelOf,listView,locatePreference,location,pn as locationPartFilterTarget,Hs as lockingSendCall,Us as meetingBotDispatchRequestSchema,Ws as meetingBotDispatchResponseSchema,Gs as meetingBotNotificationSchema,Ks as meetingTranscriptSegmentSchema,mn as memberlessGroups,memoryPageViewOf,qs as mentionReferenceSchema,Js as mergeSessionInferencePatch,meteredUsd,hn as metricComparePeriod,Ys as modelDefinitionSchema,Nd as modelIdentitySchema,Xs as modelReferenceSchema,moveWidensAudience,multiselect,nameSlug,Td as namedTargetSchema,nativeAgentUIPartIdMetadataKey,Zs as needsManageWhenUnattended,Hl as normalizeCountrylessPhoneNumber,gn as normalizeFilterRule,_n as normalizeForEdgeRpc,normalizeNewsLocale,vn as normalizeOperator,Ul as normalizePhoneNumber,Qs as normalizedMeetingTranscriptSchema,yn as now,number,object,md as objectImageSchema,$s as openRequests,ec as orderAgentSessionMessages,packLayout,page,pageCompactor,xn as pageTraitsOf,tc as parseAgentDefinitionAccessRole,nc as parseAgentSessionAccessRole,tl as parseAttributeConfig,nl as parseAttributeConfigForCreate,rl as parseAttributeConfigForUpdate,S as parseBlockParameters,rc as parseCountMode,Ae as parseDecisionLink,ic as parseDeviceAccessRole,parseDeviceChannelFrame,ac as parseMergedAgentTrigger,parseNamedTarget,parseNativeAgentUIPartIdsMetadata,parseNewsBody,parseNewsIndex,parseNewsIntensity,parseNewsTarget,oc as parseOptionalCountMode,sc as parsePageAccessRole,Sn as parseQualifiedAttribute,cc as parseRecordAccessRole,Bc as parseRecordListScope,parseReference,Vc as parseResourceVisibility,parseSchemaGroupPresentation,parseSchemaOwner,parseSchemaState,parseServerFrame,parseSkillSource,lc as parseToolGroupGrant,parseWherePipe,parseWorkerFrame,Ju as permissionGrantSchema,phone,placeNew,preference,preferenceEntry,il as propertyAttributeSchema,al as propertyAttributeWireSchema,ol as propertySchemaSchema,sl as propertySchemaWireSchema,uc as providerNameSchema,C as publishedViewContentDefinitionSchema,Cn as query,dc as readArchitectPublication,readArtifactResult,fc as readAskQuestionsResult,readFormFieldValue,readGeneratedImageResult,pc as recentActivityEntryKey,mc as recordGraphNodeKey,hc as recordGraphRequestSchema,recordLinksTab,gc as recordMeetingsCount,_c as recordOperationSchema,wn as recordQueryDefinitionSchema,vc as refineTrigger,cl as refuseForeignKeys,Al as rejectUnknownAttributesOrThrow,relation,Tn as relationAcceptsObject,relationProperty,En as relationTargetsOf,renderLabelExpression,repairPageGrid,requestedCapabilities,On as requireRecordContentContext,kn as requireSingleRelationTarget,resolveAppearance,An as resolveCollectionActions,jn as resolveContentNavigation,Mn as resolveEffectiveFilterType,resolveFieldRequired,Nn as resolveIsWithinBounds,resolveLocalized,resolvePageGrid,resolvePropertyDefinitions,Ll as resolveTextPattern,Pn as resolveUtcDayBounds,resolveViewContents,yc as resourceGrant,richtext,rollup,bc as routedMessageInferenceSchema,sameActions,xl as sameStableValue,schemaGroupKey,schemaStateSourcePayload,select,ll as selectOptionWriteSchema,Sl as serializeCanonicalJson,Cl as serializeStableJson,xc as sessionInferencePatchSchema,settleLayout,sha256Hex,Fn as singleRelationTarget,Sc as slackConditionSchema,Cc as slackTriggerMatchSchema,snapWidth,In as sortsSchema,Ln as sourcedAttributeOf,status,ul as statusGroupSchema,dl as statusOptionWriteSchema,storedContentDefinition,Rn as systemColumnFilterTarget,text,zn as toMultiValueOperator,Bn as toUtcDayString,Vn as today,wc as todoItemSchema,Tc as todoPlanSchema,Ec as toolImpactSchema,user,Dc as utf8ByteLength,jl as validateAttribute,Hc as validateAttributeName,Hn as validateContentViewCatalogue,Ml as validateDraft,Nl as validateDraftOrThrow,validateLabelExpression,Pl as validateObject,validateObjectExpressions,validateObjectImage,Gc as validateObjectName,Fl as validateObjectOrThrow,Un as validateQualifiedRule,Wn as validateStoredViews,Kc as validateViewName,widthStepConstraint,fl as wireHiddenTypeConfigMask,pl as wireOmittedConfigKeysFor,withPreferenceEntry,withoutTrailingSlashes,ml as withoutUnknownOptionKeys,workspaceViewAuthoring};