@standards/schema 1.0.0-alpha.425 → 1.0.0-alpha.427
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.d.mts +5 -1
- package/dist/api/index.d.ts +5 -1
- package/dist/api/index.js +1 -1
- package/dist/api/index.mjs +1 -1
- package/dist/{index-BT3TfqdG.d.ts → index-DKdl7had.d.ts} +13 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/record-operation-CMCTHaqH.js +2 -0
- package/dist/record-operation-GX6TNLz8.mjs +2 -0
- package/dist/{record-query-YF8WzWYV.d.mts → record-query-BY66cePE.d.mts} +13 -1
- package/dist/validation/all.d.mts +1 -1
- package/dist/validation/all.d.ts +1 -1
- package/openapi.json +36 -0
- package/package.json +2 -2
- package/dist/record-operation-D7k5gbx0.js +0 -2
- package/dist/record-operation-DYs9460M.mjs +0 -2
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
|
|
2
|
-
import{NonJsonValueError as e,asTenantId as t,asUserId as n,canonicalStringify as r,deepEqual as i,generateId as a,indexBy as o,sameStableValue as s,serializeCanonicalJson as c,serializeStableJson as l}from"./utils-DKrBP9EH.mjs";import{ACTIONABLE_DECISION_KINDS as u,AGENDA_BLOCK as d,AGGREGATE_BUCKETS as f,AGGREGATE_MEASURES as p,ARTIFACT_PREVIEW_EXTENSION as m,ATTRIBUTE_FILTER_OPERATORS as h,ATTRIBUTE_NAME_SCHEMA as ee,ATTRIBUTE_TYPES as te,ATTRIBUTE_TYPE_DESCRIPTORS as ne,BLOCK_CONTEXTS as re,BLOCK_PERIODS as ie,BLOCK_WIDTHS as g,CARD_BLOCK as _,CHART_BLOCK as v,CHART_KINDS as ae,CONTENT_PLACEMENT_CONTEXTS as oe,DECISIONS_BLOCK as se,DECISION_INBOX_STATES as ce,DECISION_KINDS as le,DECISION_LINE_MAX_LENGTH as ue,DECISION_LINK_TARGET_TYPES as de,DECISION_LIST_STATES as fe,DECISION_READ_STATES as pe,DECISION_SENDER_KINDS as me,DECISION_SETTINGS_AREAS as he,DECISION_TITLE_MAX_LENGTH as ge,DECISION_TRANSFERS_KEY as _e,DECISION_TYPES_V1 as ve,DECISION_TYPE_ACCESS_GRANTED as ye,DECISION_TYPE_AGENT_APPROVAL as be,DECISION_TYPE_AGENT_MESSAGE as xe,DECISION_TYPE_AGENT_QUESTION as Se,DECISION_TYPE_AGENT_REVIEW as Ce,DECISION_TYPE_AGENT_ROUTINE_RUN_FAILED as we,DECISION_TYPE_AGENT_SETUP as Te,DECISION_TYPE_BUNDLE_SETUP as Ee,DECISION_TYPE_CONNECTOR_CONNECTION_ERROR as De,DECISION_TYPE_CONNECTOR_CONNECTION_REAUTH_REQUIRED as Oe,DECISION_TYPE_ENVIRONMENT_BUILD_FAILED as ke,DECISION_TYPE_KINDS as y,DECISION_TYPE_PERSON as Ae,DECISION_TYPE_RECORD_ASSIGNED as je,DECISION_TYPE_RECORD_MENTIONED as Me,DECISION_WORK_STATES as Ne,DEFAULT_LAYOUT_TRAITS as Pe,GROUPABLE_ATTRIBUTE_TYPES as Fe,HEADING_BLOCK as Ie,HIERARCHY_ATTRIBUTE_IDS as Le,HIERARCHY_ATTRIBUTE_NAMES as Re,HIERARCHY_CHILD_IDS_LIMIT as ze,INVENTORY_LIMIT as Be,LIST_VIEW_TAB_VISIBILITIES as Ve,LOCATION_FILTER_PROPERTIES as He,MAILBOX_BLOCK as Ue,MAX_AGGREGATE_GROUPS as We,MEASURABLE_ATTRIBUTE_TYPES as Ge,MEETINGS_UPCOMING_BLOCK as Ke,METRIC_BLOCK as b,NATIVE_BLOCKS as qe,NATIVE_OBJECT_NAMES as Je,NO_VALUE_OPERATORS as Ye,OBJECT_NAME_SCHEMA 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 x,RECORD_LIST_SCOPES as nt,RECORD_OBJECT as rt,RELATION_TARGET_ANY as it,REMOVED_OPERATOR_REPLACEMENTS as at,RESERVED_ATTRIBUTE_NAMES as ot,RESERVED_OBJECT_NAMES as st,RESOURCE_VISIBILITIES as ct,RecordQuery as lt,SCHEMA_LIMITS as S,SYNONYM_ALIASES as ut,SYSTEM_ATTRIBUTES as dt,SYSTEM_ATTRIBUTE_I18N_KEYS as ft,SYSTEM_FIELD_NAMES as pt,SYSTEM_FILTER_ATTRIBUTE_TYPES as mt,TEXT_BLOCK as C,assertUniqueBy as ht,attributeFilterTarget as gt,attributeInventory as _t,blockObjectInputs as vt,buildQualifiedAttribute as yt,canonicalizeFilterValue as bt,capped as xt,collectContentViewCatalogue as St,collectQualifiedRuleIssues as Ct,collectionContentSourceSchema as wt,collectionSourceAddress as Tt,collectionSourceAddressOf as Et,colorIdSchema as Dt,columnsSchema as Ot,contentExtensionRegistry as w,contentReadObjects as kt,contentViewDefinitionSchema as T,contentViewDefinitionSchemaFor as At,currentActor as jt,decisionArchiveAllResultSchema as Mt,decisionAttachmentSchema as Nt,decisionCountsSchema as Pt,decisionLinkSchema as Ft,decisionListResultSchema as It,decisionRecipientSchema as Lt,decisionSchema as Rt,decisionSenderSchema as zt,decisionThreadKey as Bt,decisionTransferBy as Vt,decisionTransferTargetsSchema as Ht,decisionTransfersOf as Ut,decisionWithRecipientSchema as Wt,defineBlock as Gt,describeViewIssue as Kt,displayAttributesSchema as qt,draftContentViewDefinitionSchema as Jt,draftContentViewDefinitionSchemaFor as Yt,edgePropertyFilterTarget as Xt,extractCurrencyFilterValue as Zt,extractFilterValue as Qt,filterOperatorsOfType as $t,filterStateSchema as en,filterTargetsOf as tn,findGridViolation as nn,findGroupViolation as rn,findLayoutRuleViolation as an,findRelationAttribute as on,findRowLimitViolation as sn,formatDecisionLink as cn,getAttributeCapabilities as ln,getAttributeFilterOperators as un,getHierarchyAttributes as dn,getObjectSystemAttributes as fn,getOperatorPolarity as pn,getRollupFilterOperators as mn,getSystemAttributeI18nKey as hn,getSystemAttributeList as gn,gridPositionSchema as _n,groupSizeMessage as vn,groupedMembers as yn,hasTypeTrait as bn,hasValueKind as xn,iconNameSchema as E,inferInverseCardinality as Sn,input as Cn,invalidViewMessage as wn,isActionableDecisionKind as Tn,isAttributeFilterable as En,isAttributeGroupable as Dn,isAttributeKanbanGroupable as On,isAttributeSearchable as kn,isAttributeSortable as An,isBilateralRelation as jn,isBoardGrouping as Mn,isCalendarDay as Nn,isCollectionContent as Pn,isDynamicValue as Fn,isHierarchyAttribute as In,isLocationFilterProperty as Ln,isLocationPartOperator as Rn,isManagedSystemAttribute as zn,isNativeObjectName as D,isNoValueOperator as Bn,isPlainRecord as Vn,isRelativeDateValue as Hn,isSetMembershipOperator as Un,isUniversalRelation as Wn,isValueKindType as O,layoutTraitsOf as Gn,locationPartFilterTarget as Kn,memberlessGroups as k,metricComparePeriod as qn,normalizeFilterRule as Jn,normalizeForEdgeRpc as Yn,normalizeOperator as Xn,now as Zn,overlaps as Qn,pageTraitsOf as $n,parseBlockParameters as A,parseDecisionLink as er,parseQualifiedAttribute as tr,parseRecordListScope as nr,parseResourceVisibility as rr,publishedViewContentDefinitionSchema as j,query as ir,recordQueryDefinitionSchema as ar,relationAcceptsObject as or,relationTargetsOf as sr,requireContentPlacement as cr,requireRecordContentContext as lr,requireSingleRelationTarget as ur,resolveCollectionActions as dr,resolveContentNavigation as fr,resolveEffectiveFilterType as pr,resolveIsWithinBounds as mr,resolveUtcDayBounds as hr,singleRelationTarget as gr,sortsSchema as _r,sourcedAttributeOf as vr,systemColumnFilterTarget as yr,toMultiValueOperator as br,toUtcDayString as xr,today as Sr,validateAttributeName as Cr,validateContentViewCatalogue as wr,validateIconName as Tr,validateLabel as Er,validateObjectName as Dr,validateOptions as Or,validateQualifiedRule as kr,validateStoredViews as Ar,validateViewName as jr}from"./attribute-validators-RdwWgLqZ.mjs";import{COMPUTED_RETURN_TYPES as Mr,DEFAULT_VALIDATION_MESSAGES as Nr,SIMPLE_PROPERTY_TYPES as Pr,TEXT_FORMAT_PATTERNS as Fr,WIRE_OFFERED_BASE_CONFIG as Ir,WIRE_OMITTED_CONFIG_KEYS as Lr,attributeConfigSchemas as Rr,createAttributeValidator as zr,createFormAttributeValidator as Br,createObjectValidator as Vr,datePrecisionIssues as Hr,formatPhoneForDisplay as Ur,formatZodErrors as Wr,getAttributeConfigSchema as Gr,getAttributeConfigWriteSchema as Kr,getIso2 as qr,isEmptyValue as Jr,isNullishOrEmptyString as Yr,isValuePresent as Xr,normalizeCountrylessPhoneNumber as Zr,normalizePhoneNumber as Qr,parseAttributeConfig as $r,parseAttributeConfigForCreate as ei,parseAttributeConfigForUpdate as ti,propertyAttributeSchema as ni,propertyAttributeWireSchema as ri,propertySchemaSchema as ii,propertySchemaWireSchema as ai,refuseForeignKeys as oi,rejectUnknownAttributesOrThrow as si,resolveTextPattern as ci,selectOptionWriteSchema as li,statusGroupSchema as ui,statusOptionWriteSchema as di,validateAttribute as fi,validateDraft as pi,validateDraftOrThrow as mi,validateObject as hi,validateObjectOrThrow as gi,wireHiddenTypeConfigMask as _i,wireOmittedConfigKeysFor as vi,withoutUnknownOptionKeys as yi}from"./all-BKRTNSnx.mjs";import"./zod-locale.mjs";import{ACCESS_CAPABILITIES as bi,ACCESS_LEVELS as xi,ACCESS_ROLES as Si,ACTOR_TYPES as Ci,AGENT_ASIDE_ANSWER_MAX_LENGTH as wi,AGENT_ASIDE_HISTORY_LIMIT as Ti,AGENT_ASIDE_QUESTION_MAX_LENGTH as Ei,AGENT_AVATAR_EXPRESSIONS as Di,AGENT_AVATAR_TYPES as Oi,AGENT_ENVIRONMENT_MODES as ki,AGENT_MESSAGE_KIND as Ai,AGENT_MESSAGE_SENDER_NAME_KEY as ji,AGENT_NOTIFICATION_KIND as Mi,AGENT_SESSION_ACCESS_ROLES as Ni,AGENT_SESSION_LIST_ORDERS as Pi,AGENT_SESSION_ORIGINS as Fi,AGENT_SESSION_PROVENANCES as Ii,AGENT_STARTERS_MAX as Li,AGENT_STARTER_MAX_LENGTH as Ri,AGENT_SYSTEM_PROMPT_MAX_LENGTH as zi,AGENT_TASK_KINDS as Bi,AGENT_WAKE_KIND as Vi,AI_MODEL_INPUT_MODALITIES as Hi,AI_MODEL_PROFILE_LABELS as Ui,AI_MODEL_REASONING_MODES as Wi,ALL_CATALOG_TOOL_NAMES as Gi,ALWAYS_KINDS as Ki,APPEARANCE_FACETS as qi,APPROVAL_FAMILY_TOOL_NAMES as Ji,ARCHITECT_PUBLICATION_KIND as Yi,ASK_QUESTIONS_ANSWER_MAX_LENGTH as Xi,ASK_QUESTIONS_ANSWER_MAX_VALUES as Zi,ASK_QUESTIONS_MAX_BATCH as Qi,ASK_QUESTIONS_TOOL_NAME as $i,ATTACH_FILE_ACTIONS as ea,AUDIT_ACTIONS as ta,AUDIT_AGENT_SESSION_METADATA_KEY as na,AUDIT_RESOURCE_TYPES as ra,AgentBuilder as M,BILLING_MODES as ia,BROWSER_LAUNCH_TOOL_NAME as aa,BROWSER_TOOL_NAMES as oa,BUNDLE_LOCALES as sa,BUNDLE_SETUP_PROMPT_MAX_LENGTH as ca,CATALOG_RESOURCES as la,CONNECTION_GRANT_PROVIDERS as ua,CONNECTION_STATUS_IDS as da,CONNECTOR_PROVIDER_IDS as fa,CONNECTOR_SCOPES as pa,CONTINUATION_KEY_PATTERN as ma,CONVERSATION_SURFACES as ha,COPY_VERB_NAME as ga,CORE_RECORD_TOOL_NAMES as _a,CORE_TOOL_NAMES as va,COUNT_MODES as ya,CUSTOM_LEVEL as ba,DEFAULT_AGENT_EXECUTION_CONFIG as xa,DEFAULT_AGENT_TOOL_GROUPS as Sa,DEFAULT_APPEARANCE_ICON as Ca,DEFAULT_APPROVAL_POLICY as wa,DEFAULT_BLUEPRINT_TOOL_GROUPS as Ta,DEFAULT_DAILY_ACTIVITY_DAYS as Ea,DEFAULT_DICTATION_LIMITS as Da,DEFAULT_MEETING_BOT_DISPLAY_NAME as Oa,DEFAULT_TENANT_SETTINGS as ka,DEVICE_ACCESS_ROLES as Aa,DEVICE_CHANNEL_AUTHENTICATE_TIMEOUT_MS as ja,DEVICE_CHANNEL_IDLE_POLL_MS as Ma,DEVICE_CHANNEL_KEEPALIVE_MS as Na,DEVICE_CHANNEL_MAX_FRAME_BYTES as Pa,DEVICE_CHANNEL_PATH as Fa,DEVICE_CHANNEL_PRESENCE_MS as Ia,DEVICE_CHANNEL_WORKER_CLOSE_PROTOCOL_VIOLATION as La,DEVICE_COMMAND_ERROR_CODES as Ra,DEVICE_DESKTOP_STATES as za,DEVICE_SHELLS as Ba,DICTATION_FINALIZATION_TIMEOUT_MS as Va,DICTATION_FRAME_BYTES as Ha,DICTATION_MAX_BUFFER_BYTES as Ua,DICTATION_MAX_FRAME_BYTES as Wa,DICTATION_MAX_TRANSCRIPT_BYTES as Ga,DICTATION_MODEL_ID as Ka,DICTATION_PREPARATION_TIMEOUT_MS as qa,DICTATION_SAMPLE_RATE as Ja,DICTATION_TICKET_TTL_MS as Ya,DISCARD_ARCHITECT_DRAFT_TOOL_NAME as Xa,DOCUMENT_KINDS as Za,DOCUMENT_SORT_MODES as Qa,DRAFT_WRITE_TOOL_NAMES as $a,DeviceChannelProtocolError as eo,DeviceChannelServerFrameSchema as to,DeviceChannelWorkerFrameSchema as no,DeviceDesktopStatusSchema as ro,EMAIL_CATEGORY_DEFAULT_COLOR as io,EMAIL_CATEGORY_DEFAULT_ICON as ao,EMAIL_CATEGORY_DESCRIPTION_MAX as oo,EMAIL_CATEGORY_DESCRIPTION_MIN as so,EMAIL_CATEGORY_LIMIT as co,EMAIL_CATEGORY_NAME_MAX as lo,EMAIL_CATEGORY_SCOPES as uo,EMAIL_CLASSIFIED_BY as fo,EMAIL_DIRECTIONS as po,EMAIL_PARTICIPANT_ROLES as mo,EMAIL_PROVIDERS as ho,EMAIL_RULE_SCOPES as go,ENVIRONMENT_BUILD_LOG_STEPS as _o,ENVIRONMENT_BUILD_LOG_STEP_PREFIX as vo,ENVIRONMENT_HARNESSES as yo,ENVIRONMENT_HARNESS_SANDBOX_WORKDIR as bo,ENVIRONMENT_HARNESS_WORKDIR as xo,ENVIRONMENT_IMAGES as So,ENVIRONMENT_MEMORY_GB_PER_VCPU as Co,ENVIRONMENT_NAME_MAX_CHARS as wo,ENVIRONMENT_NETWORK_ALLOW_MAX as To,ENVIRONMENT_SCRIPT_MAX_BYTES as Eo,ENVIRONMENT_SIZES as Do,ENVIRONMENT_SIZE_VCPUS as Oo,ENVIRONMENT_STANDARDS_WORKDIR as ko,ENV_VAR_KEY_PATTERN as Ao,ESTIMATED_COUNT_CAP as jo,FILE_LIST_MAX_IDS as Mo,FILE_OCR_STATUSES as No,FILE_URLS_MAX_IDS as Po,FORM_STATUSES as Fo,FORM_SUBMISSION_STATUSES as Io,GET_ARCHITECT_DRAFT_TOOL_NAME as Lo,GITHUB_TRIGGER_CATALOG as Ro,GRANT_ENABLES as zo,HARNESS_BRIDGE_PORT as Bo,HITL_TOOL_NAMES as Vo,IMAGE_FORMATS as Ho,IMAGE_SHAPES as Uo,IMAGE_SOURCES as Wo,INFERENCE_REASONING_OPTIONS as Go,INFERENCE_ROUTING_MODES as Ko,INFERENCE_SPEEDS as qo,LAST_RUN_ERROR_MAX_LENGTH as Jo,LINK_COOKIE_MAX_AGE_MS as Yo,LINK_DEFAULT_MS as Xo,LINK_MAX_MS as Zo,MACHINE_KEY_KINDS as Qo,MAILBOX_ACCOUNT_VISIBILITIES as $o,MAILBOX_LIST_MODES as es,MAIL_DRAFT_BODY_MAX_CHARS as ts,MAIL_DRAFT_MODES as ns,MAIL_SIGNATURE_MAX_CHARS as rs,MAIL_SUBJECT_MAX_CHARS as is,MAX_DAILY_ACTIVITY_DAYS as as,MAX_TODOS as os,MAX_TODO_DESCRIPTION_CHARS as ss,MAX_TODO_ID_CHARS as cs,MEETING_BOT_IMAGE as ls,MEETING_BOT_IMAGE_BASE64_MAX_LENGTH as us,MEETING_BOT_NO_CREDITS as ds,MEETING_BOT_SILENT_REASON as fs,MEETING_CONFERENCE_REQUESTS as ps,MEETING_PARTICIPANT_ROLES as ms,MEETING_RESPONSES as hs,MEETING_RESPONSE_STATUSES as gs,MEETING_STATUSES as _s,MEMORY_SPEND_LIMIT_PATTERN as vs,NATIVE_TOOL_GROUPS as ys,NATIVE_TOOL_GROUP_CATALOG as bs,NEWS_DEFAULT_DISPLAY_DAYS as xs,NEWS_DISPLAY_CAP_DAYS as Ss,NEWS_INDEX_MAX_ENTRIES as Cs,NEWS_INTENSITIES as ws,NEWS_TARGET_KINDS as Ts,NO_ACCESS as Es,NO_RECORDING as Ds,OAUTH_TICKET_TTL_MS as Os,OBJECT_GRANT as ks,OPEN_TOOL_PART_STATES as As,OPERATION_MAX_STEPS as js,PERMISSION_ACTIONS as Ms,PERMISSION_CAPABILITIES as Ns,PERMISSION_CATALOG as Ps,PERSISTENCE_OWNED_QUOTA_KEYS as Fs,PROVIDER_DRAFT_LABEL as Is,PROVIDER_NAMES as Ls,PUBLIC_MAIL_DOMAINS as Rs,QUESTION_FAMILY_TOOL_NAMES as zs,QUOTA_KEYS as Bs,RECENT_ACTIVITY_LEDGER_LIMIT as Vs,RECIPIENT_IDENTITIES_MAX as Hs,RECORDING_OVERRIDES as Us,RECORDING_POLICIES as Ws,RECORD_ACCESS_ROLES as Gs,RECORD_ACCESS_SOURCES as Ks,RECORD_DRIVE_CURSOR_MAX_LENGTH as qs,RECORD_DRIVE_PAGE_DEFAULT_LIMIT as Js,RECORD_DRIVE_PAGE_MAX_LIMIT as Ys,RECORD_GRAPH_DEFAULT_LIMIT_PER_NODE as Xs,RECORD_GRAPH_MAX_LIMIT_PER_NODE as Zs,RECORD_GRAPH_MAX_NODES as Qs,RECORD_IMAGE_MAX_BYTES as $s,REFERENCE_KINDS as ec,REPLY_MODES as tc,REQUEST_DESIGN_REVIEW_TOOL_NAME as nc,REQUEST_SETUP_TOOL_NAME as rc,RESOURCE_GRANT_KINDS as ic,RESOURCE_KIND_CATALOG as ac,ROUTING_PRICE_CEILINGS as oc,RUN_ORIGIN_METADATA_KEY as sc,SEND_VERB_NAME as cc,SESSION_INFERENCE_PATCH_KEYS as lc,SLACK_TRIGGER_CATALOG as uc,SPEAKS_THROUGH_SEND_METADATA_KEY as dc,SURFACE_TOOL_NAMES as fc,SYSTEM_EMAIL_CATEGORIES as pc,SYSTEM_EMAIL_CATEGORY_NAMES as mc,SYSTEM_PART_CODES as hc,TASK_DEMAND_LEVELS as gc,TENANT_INVITATION_DEFAULT_TTL_MS as _c,TENANT_INVITATION_DELIVERY_STATUSES as vc,TENANT_INVITATION_MAX_TTL_MS as yc,TENANT_INVITATION_MIN_TTL_MS as bc,TENANT_INVITATION_RESEND_INTERVAL_MS as xc,TENANT_INVITATION_STATUSES as Sc,TODO_PHASES as Cc,TODO_PLAN_STATUSES as wc,TODO_STATUSES as Tc,TOOL_APPROVAL_STATES as Ec,TOOL_IMPACT_COUNT_KEYS as Dc,TRANSCRIPT_STATUSES as Oc,TRIAGE_ACTIONS as kc,TRIGGER_EVENT_TYPES as Ac,TURN_OUTCOMES as jc,UNSHAREABLE_OBJECT_NAMES as Mc,USAGE_MODALITIES as Nc,USAGE_SCOPES as Pc,USERS_RESOLVE_MAX_IDS as Fc,USER_STATUSES as Ic,USER_WORK_POSTURES as Lc,VERB_NAMES as Rc,WAKE_TURN_METADATA_KEY as zc,WAKE_TURN_SPOKE_METADATA_KEY as Bc,WALLET_STATUSES as Vc,accessGrantSchema as Hc,actorSchema as Uc,agent as Wc,agentApprovalResolutionSchema as Gc,agentAvatarFromMetadata as Kc,agentAvatarOutputSchema as qc,agentAvatarSchema as Jc,agentConversationOverviewSchema as Yc,agentDataChunk as Xc,agentDefinitionActivitySchema as Zc,agentDefinitionAudienceSchema as Qc,agentDefinitionDailyActivitySchema as $c,agentDefinitionSchema as el,agentDisplayName as tl,agentExecutionConfigOutputSchema as nl,agentHistoryMessageSchema as rl,agentInferencePreferencesOutputSchema as il,agentInferencePreferencesSchema as al,agentMemoryViewSchema as ol,agentMessageAttachmentSchema as sl,agentMessagePartSchema as cl,agentRequestAnswerSchema as ll,agentRoleSchema as ul,agentRolesSetResultSchema as dl,agentRunSchema as fl,agentRunStatusSchema as pl,agentScheduleOutputSchema as ml,agentScheduleSchema as hl,agentSessionAudienceSchema as gl,agentSessionDefinitionAppearanceSchema as _l,agentSessionHistoryPageSchema as vl,agentSessionInferenceOverridesInputSchema as yl,agentSessionInferenceOverridesSchema as bl,agentSessionLinkSchema as xl,agentSessionMessageOutputSchema as Sl,agentSessionMessageSchema as Cl,agentSessionSchema as wl,agentSetupResponseSchema as Tl,agentStartersSchema as El,agentTodoPlanViewSchema as Dl,agentToolCatalogSchema as Ol,agentTriggerBaseSchema as kl,agentTriggerDefinitionSchema as Al,agentTriggerLastCallSchema as jl,agentTriggerPatchSchema as Ml,agentTriggerSchema as Nl,agentUIValidationError as Pl,agentWakeSchema as Fl,agentWakeViewSchema as Il,apiKeyRoleSchema as Ll,apiKeySchema as Rl,apiKeyWithSecretSchema as zl,architectProjectionSchema as Bl,artifactQuoteSchema as Vl,askQuestionsOutputSchema as Hl,assertCustomAgentUIMessageChunk as Ul,assertSessionState as Wl,attachedRecordDocumentSchema as Gl,attributeOutputSchema as Kl,attributeSaveOutputSchema as ql,auditChangeSchema as Jl,auditLogEntrySchema as Yl,availableBundleSummarySchema as Xl,browserProfilePreparationSchema as Zl,browserProfileViewSchema as Ql,bundleAddPlanSchema as $l,bundleAddResultSchema as eu,bundleContentsSchema as tu,bundleListSchema as nu,bundleModeSchema as ru,bundleOriginSchema as iu,bundlePieceKindSchema as au,bundlePlanPieceSchema as ou,bundleRemovalPreviewSchema as su,bundleStatusEntrySchema as cu,bundleStatusSchema as lu,bundleUpdateGroupSchema as uu,bundleUpdatePieceKindSchema as du,bundleUpdatePieceSchema as fu,bundleUpdatePlanSchema as pu,bundleUpdateReasonCodeSchema as mu,bundleUpdateResultSchema as hu,cancelAgentWakeResultSchema as gu,canonicalToolGroups as _u,capabilityForResource as vu,classificationRestoreSchema as yu,classificationUndoSchema as bu,classifyEmailResultSchema as xu,classifyEmailSchema as Su,cliDefaultModelOf as Cu,cloudBrowserLiveViewSchema as wu,collectionOutputSchema as Tu,collectionPageSchema as Eu,compareAgentSessionMessages as Du,compareVersions as Ou,compiledHarnessModels as ku,computeReconnectDelay as Au,computeRetryDelay as ju,connectionCapabilitiesSchema as Mu,connectionGrantKindsOf as Nu,connectionSyncProgressSchema as Pu,connectionViewSchema as Fu,connectorProvidersResultSchema as Iu,connectorTriggerMatchSchema as Lu,createAgentTriggerResultSchema as Ru,criticConfigOutputSchema as zu,customDataChunkSchemas as Bu,declaredImageRequests as Vu,decodeAgentSessionListCursor as Hu,decodeRecordValues as Uu,defaultEnvironmentSchema as Wu,deriveViewerAccess as Gu,deviceAudienceSchema as Ku,deviceChannelUrl as qu,documentFileSchema as Ju,documentRecordOwnerPageSchema as Yu,documentRecordOwnerSchema as Xu,documentSchema as Zu,documentWithSubCountSchema as Qu,draftAppendOutputSchema as $u,draftCommandGuardSchema as ed,driveFileSchema as td,durableDateSchema as nd,editAgentSessionMessageResultSchema as rd,effectivePermissionsSchema as id,emailAttachmentMetaSchema as ad,emailCategoryCreateSchema as od,emailCategoryDeleteSchema as sd,emailCategorySchema as cd,emailCategoryScopeQuerySchema as ld,emailCategoryUpdateSchema as ud,emailCategoryUsageSchema as dd,emailParticipantRefSchema as fd,emailRuleScopeSchema as pd,emailSenderRuleSchema as md,emailVerdictSchema as hd,encodeAgentSessionListCursor as gd,encodeRecordValues as _d,envVarEntrySchema as vd,environmentBuildFailureSchema as yd,environmentBuildStateSchema as bd,environmentDetailSchema as xd,environmentHarness as Sd,environmentHarnessSchema as Cd,environmentListSchema as wd,environmentNetworkPolicyOutputSchema as Td,environmentRepositorySourceSchema as Ed,environmentSchema as Dd,environmentWorkdir as Od,fileSchema as kd,fileUrlsResponseSchema as Ad,findEnvironmentHarness as jd,findGrantIssues as Md,formDefinitionSchema as Nd,formSlotSchema as Pd,formStepSchema as Fd,formSubmissionSchema as Id,formatNewsTarget as Ld,formatReference as Rd,githubConditionSchema as zd,githubTriggerMatchSchema as Bd,grantKindOf as Vd,harnessModelChoices as Hd,harnessModelListSchema as Ud,harnessModelOptionSchema as Wd,hasLocale as Gd,humanRequestId as Kd,humanRequestKind as qd,imageModelFormatDefect as Jd,imageModelIdSchema as Yd,inferenceReasoningSchema as Xd,inferenceRoutingSchema as Zd,inferenceSpeedSchema as Qd,installedBundleSummarySchema as $d,isAgentMessageMetadata as ef,isAgentNotificationMetadata as tf,isAgentUIDataName as nf,isAgentWakeMetadata as rf,isAgentWrittenAuditEntry as af,isArchitectPublicationMetadata as of,isAwaitingHuman as sf,isBlocking as cf,isCatalogResource as lf,isEnvironmentBuildLogStep as uf,isEnvironmentHarnessId as df,isFormDefinition as ff,isImageSource as pf,isMailProvider as mf,isMailboxListMode as hf,isNativeToolGroup as gf,isOpenToolPartState as _f,isParkedOnHuman as vf,isProviderDraft as yf,isPublicMailDomain as bf,isQuestionPart as xf,isReplyMode as Sf,isResourceGrant as Cf,isRoutineActorMetadata as wf,isSemver as Tf,isSessionInferencePatch as Ef,isSystemEmailCategory as Df,isSystemEmailCategoryName as Of,isSystemPartCode as kf,isToolApprovalState as Af,isToolImpactCountKey as jf,isWildcard as Mf,lastPublicationSchema as Nf,lastPublishErrorSchema as Pf,levelActions as Ff,levelFloor as If,levelOf as Lf,linkedRecordRefSchema as Rf,lockingSendCall as zf,loginSecretEntrySchema as Bf,mailDraftAttachmentSchema as Vf,mailDraftSchema as Hf,mailSignatureSchema as Uf,mailboxAccountSchema as Wf,mailboxCursorSchema as Gf,mailboxEmailSchema as Kf,mailboxListResponseSchema as qf,mailboxSenderImageSchema as Jf,mailboxThreadDetailSchema as Yf,mailboxThreadSchema as Xf,mcpCatalogCategorySchema as Zf,mcpCatalogEntrySchema as Qf,mcpOAuthAttemptStartedSchema as $f,mcpServerAuthTypeSchema as ep,mcpServerStatusSchema as tp,mcpServerViewSchema as np,meetingBotDispatchRequestSchema as rp,meetingBotDispatchResponseSchema as ip,meetingBotNotificationSchema as ap,meetingLinkedRecordSchema as op,meetingParticipantRefSchema as sp,meetingRecordingSchema as cp,meetingSchema as lp,meetingSiblingRefSchema as up,meetingTranscriptProvenanceSchema as dp,meetingTranscriptResponseSchema as fp,meetingTranscriptSegmentSchema as pp,meetingTranscriptSourceRefSchema as mp,meetingsListResponseSchema as hp,memberSchema as gp,mentionReferenceSchema as _p,mergeSessionInferencePatch as vp,modelDefinitionOutputSchema as yp,modelDefinitionSchema as bp,modelReferenceOutputSchema as xp,modelReferenceSchema as Sp,mutationReceiptSchema as Cp,myPreferencesSchema as wp,needsManageWhenUnattended as Tp,newsBodySchema as Ep,newsIndexSchema as Dp,normalizeNewsLocale as Op,normalizedMeetingTranscriptSchema as kp,oauthAttemptStartedSchema as Ap,objectDefinitionOutputSchema as jp,objectRecordOutputSchema as Mp,openRequests as Np,orderAgentSessionMessages as Pp,pageAudienceSchema as Fp,pageReadSchema as Ip,pageSummarySchema as Lp,parseAgentDefinitionAccessRole as Rp,parseAgentSessionAccessRole as zp,parseCountMode as Bp,parseDeviceAccessRole as Vp,parseDeviceChannelFrame as Hp,parseMergedAgentTrigger as Up,parseNewsBody as Wp,parseNewsIndex as Gp,parseNewsIntensity as Kp,parseNewsTarget as qp,parseOptionalCountMode as Jp,parsePageAccessRole as Yp,parseRecordAccessRole as Xp,parseReference as Zp,parseServerFrame as Qp,parseToolGroupGrant as $p,parseWorkerFrame as em,permissionFlagsSchema as tm,permissionGrantSchema as nm,permissionSchema as rm,preferenceEntry as im,preferenceEntrySchema as am,providerNameSchema as om,publishBlockerSchema as sm,publishDraftOutputSchema as cm,quotaStateSchema as lm,readArchitectPublication as um,readAskQuestionsResult as dm,readRunOriginMetadata as fm,recentActivityEntryKey as pm,recipientContactSchema as mm,recipientIdentitySchema as hm,recipientSuggestionSchema as gm,recordAggregatesSchema as _m,recordAudienceSchema as vm,recordCollectionOutputSchema as ym,recordDeletionCountSchema as bm,recordDriveChildSchema as xm,recordDriveChildrenPageSchema as Sm,recordDriveSearchHitSchema as Cm,recordDriveSearchResultSchema as wm,recordGraphEdgeSchema as Tm,recordGraphNodeKey as Em,recordGraphNodeSchema as Dm,recordGraphRequestSchema as Om,recordGraphResponseSchema as km,recordIncomingReferenceSchema as Am,recordIncomingReferencesPageSchema as jm,recordMeetingsCount as Mm,recordOperationSchema as Nm,recordPurgeResultSchema as Pm,recordValuesCodec as Fm,recordsBulkCreateResultSchema as Im,recordsBulkDeleteResultSchema as Lm,recordsBulkUpdateResultSchema as Rm,refineTrigger as zm,relationOptionSchema as Bm,relationOptionsResponseSchema as Vm,replyDefaultsSchema as Hm,requestedCapabilities as Um,resolveAppearance as Wm,resolveLocalized as Gm,resolvedRelationsBatchSchema as Km,resourceGrant as qm,resourceUsedBySchema as Jm,retryPolicyOutputSchema as Ym,roleSchema as Xm,routedMessageInferenceSchema as Zm,routineAudiencePreviewSchema as Qm,routineAudienceSchema as $m,sameActions as eh,schemaDraftOutputSchema as th,schemaGroupListSchema as nh,schemaGroupSchema as rh,schemaStateAddressOf as ih,schemaStateEntrySchema as ah,schemaStateSchema as oh,secretEntrySchema as sh,sessionImageUsageSchema as ch,sessionInferenceOverridesOutputSchema as lh,sessionInferencePatchSchema as uh,sessionStateSchema as dh,setAgentSessionWorkPostureResultSchema as fh,slackConditionSchema as ph,slackTriggerMatchSchema as mh,submitOutcomeSchema as hh,syncBundleResultSchema as gh,tenantInvitationSchema as _h,tenantSettingsResponseSchema as vh,tenantSettingsSchema as yh,todoItemSchema as bh,todoPlanSchema as xh,toolImpactSchema as Sh,triageResultSchema as Ch,userProfileSchema as wh,utf8ByteLength as Th,viewPreferenceAddressSchema as Eh,viewReadSchema as Dh,viewerAccessSchema as Oh,withPreferenceEntry as kh,withoutTrailingSlashes as Ah}from"./record-operation-DYs9460M.mjs";import{AccessDeniedError as jh,AggregateValidationError as Mh,AmbiguousSchemaChangeError as Nh,AttributeInUseError as Ph,AttributeNotFoundError as Fh,ConcurrentModificationError as Ih,DuplicateError as N,ExportTooLargeError as Lh,ForbiddenError as Rh,InvalidPermissionGrantError as zh,LogoProviderUnavailableError as Bh,LogoSearchRateLimitedError as Vh,MemoryNotFoundError as Hh,NotFoundError as Uh,NotImplementedError as Wh,ObjectNotFoundError as Gh,ObjectReferencedError as Kh,OrphanSystemAttributeError as qh,PageReferencedError as Jh,ProtectedResourceError as Yh,ProtectedRoleError as Xh,QueryTimeoutError as Zh,RealtimeDeliveryError as Qh,RealtimeRateLimitedError as $h,RealtimeSubscriptionError as eg,RecordNotFoundError as tg,RecordReferencedError as ng,RepositoryError as rg,ReservedObjectNameError as P,RoleNotFoundError as ig,SCHEMA_ERROR_HTTP_STATUS as ag,SchemaError as F,SchemaErrorCode as I,SearchBackendError as og,SearchPathNotIndexedError as sg,StorageError as cg,SyncCascadeError as lg,SyncConflictError as ug,SyncError as dg,SystemEntityImmutableError as fg,ToolGroupGrantError as pg,ValidationError as L,WorkspaceInvariantReason as mg,isAttributeInUseError as hg,isNotFoundError as gg,isObjectReferencedError as _g,isProtectedResourceError as vg,isRecordReferencedError as yg,isSchemaError as bg,isValidationError as xg}from"./exceptions.mjs";import*as R from"zod";import{getCountryByIso2 as Sg,isValidCurrencyCode as Cg,isValidIso3 as wg}from"@standards/constants";import{parsePhoneNumberFromString as Tg}from"libphonenumber-js";const Eg=`__stndrdsNativeUiPartIds`,Dg=1;function invalidNativePartIds(){throw new L(`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?.[Eg];isPlainRecord$1(t)||invalidNativePartIds(),Object.keys(t).length===2&&t.schemaVersion===1&&isPlainRecord$1(t.partIds)||invalidNativePartIds();let n=/* @__PURE__ */ new Map;for(let[t,r]of e.parts.entries()){let e=nativeAgentUIPartIdMetadataKey(r,t);!e||n.has(e)?e&&invalidNativePartIds():n.set(e,r)}let r=Object.entries(t.partIds);r.length!==n.size&&invalidNativePartIds();let i=/* @__PURE__ */ 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 Og=5,z=[`relation`,`multiRelation`,`formula`,`rollup`,`document`,`richtext`,`user`];function isFormSlotFieldRef(e){return e.type===`slot`}function isFormFreeFieldRef(e){return e.type===`free`}function resolveFieldRequired(e){return e.readOnly===!0?!1:e.fieldRequired===void 0?e.slotMode===`create`&&e.attributeRequired===!0:e.fieldRequired}function getSlotFieldTargets(e){return e.additionalSlotIds?.length?[e.slotId,...e.additionalSlotIds]:[e.slotId]}function formFieldKey(e){return isFormSlotFieldRef(e)?`${e.slotId}.${e.attribute}`:`free.${e.attribute.name}`}function formFieldFlatKey(e){return isFormSlotFieldRef(e)?e.attribute:e.attribute.name}function readFormFieldValue(e,t){return e[formFieldKey(t)]??e[formFieldFlatKey(t)]}function isFormFieldsRow(e){return e.type===`fields`}function isFormHeadingRow(e){return e.type===`heading`}function isFormSeparatorRow(e){return e.type===`separator`}function isFormTextRow(e){return e.type===`text`}function 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 O(e.type,`options`)}function schemaGroupKey(e){return`${e.kind}:${e.name}`}function refuse$2(e){throw new L(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>S.labelLength&&refuse$2(`Label is too long (max ${S.labelLength} characters)`),n.label=t}}return n}const B=/^(?:core|bundle:.+)$/u;function parseSchemaOwner(e){if(e===null)return null;if(!B.test(e))throw new L(`Invalid schema owner "${e}"`,[]);return e}const kg=[`web`,`presentation`,`document`,`spreadsheet`,`image`,`code`,`other`],Ag=[`ephemeral`,`conversation`,`persistent`],jg=[`source`,`preview`,`entrypoint`,`asset`];var NoopGeocodingAdapter=class{async autocomplete(){return await Promise.resolve([])}async geocode(){return await Promise.resolve(null)}};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 Mg=[`B`,`KB`,`MB`,`GB`,`TB`];function formatByteSize(e){let{value:t,unitIndex:n}=computeByteMagnitude(e);return`${t} ${Mg[n]}`}const Ng=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(!Ng.includes(e.type))throw Error(`Property type "${e.type}" is not supported in .qualifyWith()`);t.push(e)}return{definitions:t}}const Pg=[`UPPER`,`LOWER`,`capitalize`,`trim`],Fg=[`prefix`,`suffix`,`wrap`,`default`],V=[...Pg,...Fg],Ig=/^\s*where\s*(?::(.*))?$/s,Lg=`[A-Za-z_][A-Za-z0-9_]*`,Rg=/^[^\s,()|{}="']+$/,zg=RegExp(`^(${Lg})\\s*=\\s*(.*)$`),Bg=RegExp(`^(${Lg})\\s+in\\s*\\(([^()]*)\\)$`);function isWherePipe(e){return Ig.test(e)}function parseWherePipe(e){let t=e.match(Ig)?.[1]?.trim();if(!t)return null;let n=t.match(Bg);if(n){let e=n[2].split(`,`).map(e=>e.trim());return e.every(e=>Rg.test(e))?{property:n[1],values:e}:null}let r=t.match(zg);return r&&Rg.test(r[2])?{property:r[1],values:[r[2]]}:null}const H=R.string().min(1,`labelExpression cannot be empty`).refine(e=>isLabelExpression(e),{message:`labelExpression must contain at least one {{ attribute }} interpolation`}).refine(e=>!/\{\{\s*\}\}/.test(e),{message:`labelExpression contains empty {{ }} interpolation`}).refine(e=>{let t=/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g,n;for(;(n=t.exec(e))!==null;){let e=n[1];if(!V.includes(e))return!1}return!0},{message:`Invalid pipe name. Valid pipes: ${V.join(`, `)}`});function validateLabelExpression(e){let t=H.safeParse(e);return t.success?{success:!0,attributes:extractAttributeNames(e)}:{success:!1,error:t.error.issues[0]?.message??`Invalid labelExpression`}}function applyPipe(e,t){let{name:n,args:r}=parsePipeExpression(t);switch(n){case`UPPER`:return e.toUpperCase();case`LOWER`:return e.toLowerCase();case`capitalize`:return e.replace(/(^|\s)\S/g,e=>e.toUpperCase());case`trim`:return e.trim();case`prefix`:return e?`${r[0]??``}${e}`:``;case`suffix`:return e?`${e}${r[0]??``}`:``;case`wrap`:return e?`${r[0]??``}${e}${r[1]??``}`:``;case`default`:return e||r[0]||``;default:return e}}function applyPipes(e,t){let n=e;for(let e of t)n=applyPipe(n,e);return n}function getValue(e,t){return t.split(`.`).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e)}const Vg=`(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=Vg){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 Hg=/^\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}$/;function getSingleAttributeFromExpression(e){let t=e.trim().match(Hg);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`||ln(r).authoring.readOnly?null:r}const Ug=`memory`,Wg=4e3,Gg=`workspace`,U={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[U.name]),description:textValue(t[U.description]),content:textValue(t[U.content]),visibility:e.visibility,ownedBy:e.ownedBy,updatedAt:new Date(e.updatedAt).toISOString()}}const Kg={meetingHour:`0.80`,computeVcpuHour:`0.20`,browserHour:`0.60`},qg=[`meeting.recording`,`sandbox.agent`,`sandbox.harness`,`sandbox.build`,`browser.session`];function isMeteredChargeKind(e){return qg.includes(e)}const Jg=/^\d+(?:\.\d+)?$/u;function meteredUsd(e,t){if(!Jg.test(e))throw new L(`Invalid metered rate "${e}"`,[]);if(!(t>=0&&t<=2**53-1))throw new L(`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 Yg=`@standards/schema`;function createStandardSchemaProps(e){return{version:1,vendor:Yg,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(zr(this.build()))}constructor(e,t,n){Cr(t),Er(n),this.attr={name:t,label:n,type:e,required:!1,system:!0}}asPhantomState(){return this}required(){return this.attr.required=!0,this.asPhantomState()}optional(){return this.attr.required=!1,this.asPhantomState()}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 Tr(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||!O(String(this.attr.type),`computed`))&&(this.attr.defaultValue=e),this}metadata(e){return this.attr.metadata=e,this}build(){return this.attr}},TextAttributeBuilder=class extends BaseAttributeBuilder{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}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(`text`,e,t)}var RichtextAttributeBuilder=class extends BaseAttributeBuilder{};function richtext(e,t){return new RichtextAttributeBuilder(`richtext`,e,t)}var NumberAttributeBuilder=class extends BaseAttributeBuilder{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}};function number(e,t){return new NumberAttributeBuilder(`number`,e,t)}var CheckboxAttributeBuilder=class extends BaseAttributeBuilder{};function checkbox(e,t){return new CheckboxAttributeBuilder(`checkbox`,e,t)}var DateAttributeBuilder=class extends BaseAttributeBuilder{format(e){return this.attr.dateFormat=e,this}precision(e){return this.attr.precision=e,this}build(){let[e]=Hr(`date`,this.attr);if(e!==void 0)throw new L(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}};function date(e,t){return new DateAttributeBuilder(`date`,e,t)}var PhoneAttributeBuilder=class extends BaseAttributeBuilder{defaultCountry(e){return this.attr.defaultCountryCode=e,this}};function phone(e,t){return new PhoneAttributeBuilder(`phone`,e,t)}var CurrencyAttributeBuilder=class extends BaseAttributeBuilder{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}};function currency(e,t){return new CurrencyAttributeBuilder(`currency`,e,t)}function setOptions(e,t){let n=asMutableArray(t);Or(e.name??`unknown`,n),e.options=n}function addOption(e,t){e.options||=[],Or(e.name??`unknown`,[...e.options,t]),e.options.push(t)}var StatusAttributeBuilder=class extends BaseAttributeBuilder{options(e){return setOptions(this.attr,e),this.asPhantomState()}option(e){return addOption(this.attr,e),this}};function status(e,t){return new StatusAttributeBuilder(`status`,e,t)}var SelectAttributeBuilder=class extends BaseAttributeBuilder{options(e){return setOptions(this.attr,e),this.asPhantomState()}option(e){return addOption(this.attr,e),this}renderAs(e){return this.attr.renderAs=e,this}};function select(e,t){return new SelectAttributeBuilder(`select`,e,t)}var MultiselectAttributeBuilder=class extends BaseAttributeBuilder{options(e){return setOptions(this.attr,e),this.asPhantomState()}option(e){return addOption(this.attr,e),this}renderAs(e){return this.attr.renderAs=e,this}};function multiselect(e,t){return new MultiselectAttributeBuilder(`multiselect`,e,t)}var LocationAttributeBuilder=class extends BaseAttributeBuilder{granularity(e){return this.attr.granularity=e,this}defaultCountry(e){return this.attr.defaultCountry=e,this}allowedCountries(e){return this.attr.allowedCountries=e,this}};function location(e,t){return new LocationAttributeBuilder(`location`,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}};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(Wn(this.attr))throw Error(`Bilateral relations are not supported for universal relations (.toAny()).`);let n=t[0]?.object;if(!n)throw new L(`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 L(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}},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.attr.required=!0)}maxItems(e){return this.attr.maxItems=e,this}};function relation(e,t){return new SingleRelationAttributeBuilder(e,t)}var FormulaAttributeBuilder=class extends BaseAttributeBuilder{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.`)}};function formula(e,t){return new FormulaAttributeBuilder(`formula`,e,t)}var RollupAttributeBuilder=class extends BaseAttributeBuilder{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 F(`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}").`,I.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.`)}};function rollup(e,t){return new RollupAttributeBuilder(`rollup`,e,t)}var DocumentAttributeBuilder=class extends BaseAttributeBuilder{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}};function document(e,t){return new DocumentAttributeBuilder(`document`,e,t)}const W={owner:`standardshq`,repo:`skills`,ref:`stable`},G=`[A-Za-z0-9._-]+`,Xg=`[A-Za-z0-9_-]+`,Zg=RegExp(`^(${Xg})/(${G})@([a-z0-9-]+)(?:#(${G}))?$`),Qg=RegExp(`^(${Xg})/(${G})$`),$g=/^[0-9a-f]{40}$/i;function isSafeSegment(e){return e!==`.`&&!e.startsWith(`-`)&&!e.includes(`..`)}function refuse$1(e,t){throw new L(`Invalid skill source "${e}": ${t} (expected owner/repo@skill or owner/repo@skill#ref)`,[{path:[`source`],message:t}])}function canonicalRef(e){return $g.test(e)?e.toLowerCase():e}function parseSkillSource(e){let t=e.trim(),n=t.startsWith(`github.com/`)?t.slice(11):t,r=Zg.exec(n);if(!r)return refuse$1(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$1(e,"a segment cannot start with `-`, hold `..` or be `.`")}function isSkillRepository(e){return Qg.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&&$g.test(e.ref)}const K=/^[a-z0-9][a-z0-9-]{0,62}$/,q=`core`;function assertBundleName(e){if(!K.test(e))throw new L(`Invalid bundle name "${e}": expected a lowercase slug matching ${K}`,[]);if(e===`core`)throw new L(`Bundle name "${q}" 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 L(e,[{path:t,message:e}])}}function requireBuilderName(e,t){if(typeof e!=`string`||e.trim().length===0)throw new L(`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 L(`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 L(e,[{path:[...t,n],message:e}])}let n=j.safeParse({...e,name:`content`,placement:e.type===`group`?`grid`:`main`});if(!n.success)throw L.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=g.filter(e=>e>=n&&e<=r);return i.length===0?g.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=/* @__PURE__ */ 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=/* @__PURE__ */ 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&&g.includes(e.w)&&e.x+e.w<=12}function keptStatics(e){let t=[],n=/* @__PURE__ */ 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(!g.includes(t)){let e=`A block spans ${g.join(`, `)} columns, not ${String(t)}`;throw new L(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 L?new L(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 L(`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&&A({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))r===void 0?delete t[n]: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`]),A(this.extension,e.parameters,[`content`,`parameters`]),e}span(e){return spanContent(this,e)}},Measures=class{count(){return this.measured(`count`)}sum(e){return this.measured(`sum`,e)}avg(e){return this.measured(`avg`,e)}min(e){return this.measured(`min`,e)}max(e){return this.measured(`max`,e)}};function measure(e,t,n){return{query:e,measure:t,...n===void 0?{}:{attribute:n}}}var MetricBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}trend(e,t){return this.with({trend:e,trendBucket:t})}compare(e,t){return this.with({compare:e,period:t})}target(e){return this.with({target:e})}},MetricQuery=class extends Measures{constructor(e){super(),this.query=e}measured(e,t){return new MetricBuilder(b,checkInputs(b,measure(this.query,e,t)))}};function groupBy(e){return typeof e==`string`?[e,void 0]:[e.attribute,e.bucket]}var ChartBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}by(e){let[t,n]=groupBy(e);return this.with({by:t,byBucket:n})}by2(e){let[t,n]=groupBy(e);return this.with({by2:t,by2Bucket:n})}kind(e){return this.with({kind:e})}bar(){return this.kind(`bar`)}horizontalBar(){return this.kind(`horizontal_bar`)}line(){return this.kind(`line`)}area(){return this.kind(`area`)}donut(){return this.kind(`donut`)}funnel(){return this.kind(`funnel`)}treemap(){return this.kind(`treemap`)}calendar(){return this.kind(`calendar`)}},ChartQuery=class extends Measures{constructor(e){super(),this.query=e}measured(e,t){return new ChartBuilder(v,checkInputs(v,{...measure(this.query,e,t),kind:`bar`}))}};const e_={"7d":7,"30d":30};var AgendaBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}next(e){let t=typeof e==`number`?e:e_[e];if(!Number.isInteger(t)||t<1){let e=`An agenda looks ahead a whole number of days, at least 1`;throw new L(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(d,checkInputs(d,{query:storedQuery(e,`agenda`),attribute:t}))}function card(e){let t=e===void 0||typeof e==`string`?e:e.build().name;return new CardBuilder(_,t===void 0?{}:checkInputs(_,{object:t}))}function text$1(e){return new BlockContentBuilder(C,checkInputs(C,{markdown:e}))}function decisions(){return new DecisionsBuilder(se,{})}function meetingsUpcoming(){return new MeetingsUpcomingBuilder(Ke,{})}function mailbox(){return new MailboxBuilder(Ue,{})}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);else for(let t of g)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 L(t,[{path:e,message:t}])}function traitsOf(e,t=[]){return Gn(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(Ie,r),span:12}}function groupOf(e,t,n){let[r]=e.map(e=>e.name).sort(),i=vn(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`),cr(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 J=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 L.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 J({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 L.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`])),cr(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 M)}function assertPiece(e,t){if(typeof e!=`object`||!e)throw new L(`Unsupported bundle piece: ${t}`,[]);if(isViewPiece(e)||e instanceof M||typeof e.build==`function`)return;let n=e.name;throw new L(`Unsupported bundle piece: ${typeof n==`string`?n:String(t)}`,[])}function declarationOf$1(e){return e instanceof J||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=L.fromZodErrors(t.error.issues.map(e=>({path:e.path.map(String),message:e.message})));throw new L(`View "${n}" is invalid. ${r.message}`,r.errors)}function identityOf(e){return`${e.object??``}:${e.name}`}function assertUniqueIdentities(e,t){let n=/* @__PURE__ */ new Set;for(let r of t){let t=identityOf(r);if(n.has(t))throw new N(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})))}))}const t_={title:120,why:200,prompt:ca};function assertSetupWithinLimits(e){let t=Object.keys(t_).flatMap(t=>{let n=t_[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 L(`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=/* @__PURE__ */ new Set,n=e.flatMap(e=>{let n=skillProblem(e,t);return n===null?[]:[{path:[`skills`],message:n}]});if(n.length>0)throw new L(`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!==W.owner||n.repo!==W.repo?`Skill "${e}" must come from ${W.owner}/${W.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===q;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(D);if(e!==void 0)throw new P(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 n_=Symbol.for(`standards.bundle`);function isBundle(e){return typeof e==`object`&&!!e&&e[n_]===!0}var BundleBuilder=class{constructor(e,t){this[n_]=!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 M)r.push(a.build());else if(isViewPiece(a)){let e=declarationOf$1(a);isPage(e)?n.push(e):t.push(e.definition)}else e.push(a.build());return this.assertNotInUsed(e),builtBundleFromPieces({name:this.name,label:this.label,description:this.descriptionText,objects:e,views:t,pages:n,agents:r,uses:this.used.map(e=>e.name),samples:this.sampleRecords,...this.setupInvitation?{setup:this.setupInvitation}:{},skills:this.skillSources,translations:{...this.translationTables}})}assertNotInUsed(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ 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 N(`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 r_=R.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=R.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 R.ZodError?Error(`[FormBuilder] ${e.issues[0].message}`):e}}validateRequiredData(){if(this.data.slots.length===0)throw Error(`[FormBuilder] At least one slot is required. Use .slot() to add slots.`);if(this.data.steps.length===0)throw Error(`[FormBuilder] At least one step is required. Use .step() to add steps.`)}validateSlotReferences(){let e=new Map(this.data.slots.map(e=>[e.id,e.objectName]));for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n))for(let r of n.fields){if(r.type!==`slot`)continue;let n=getSlotFieldTargets(r);for(let r of n)if(!e.has(r))throw Error(`[FormBuilder] Step "${t.id}" references unknown slot "${r}". Declare it with .slot("${r}", ...) first.`);let i=new Set(n.map(t=>e.get(t)));if(i.size>1)throw Error(`[FormBuilder] Step "${t.id}" field on attribute "${r.attribute}" targets slots of different objects (${[...i].join(`, `)}). A multi-slot field must target slots of the same object.`)}}validatePrefillExpressions(){let e=[...V,`join`,`where`];for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n))for(let r of n.fields){if(!isFormFreeFieldRef(r)||!r.prefillExpression)continue;let n=r.prefillExpression,i=`prefillExpression on free field "${r.attribute.name}" in step "${t.id}"`;if(!isLabelExpression(n))throw Error(`[FormBuilder] ${i} must contain at least one {{ attribute }} interpolation.`);if(/\{\{\s*\}\}/.test(n))throw Error(`[FormBuilder] ${i} contains empty {{ }} interpolation.`);for(let a of n.matchAll(/(?<!\|)\|(?!\|)\s*(\w+)(?:\s*:[^|}]*)?/g)){let n=a[1];if(!e.includes(n))throw Error(`[FormBuilder] ${i} uses invalid pipe "${n}". Valid pipes: ${e.join(`, `)}`);let o=a[0].replace(/^\|/,``);if(isWherePipe(o)&&!parseWherePipe(o))throw new L(`[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(r_.safeParse(n.readOnly).success)continue;let t=isFormFreeFieldRef(n)?n.attribute.name:n.attribute,r=isFormFreeFieldRef(n)?`free field`:`field`;throw new L(`[FormBuilder] readOnly on ${r} "${t}" in step "${e.id}" must be a boolean.`,[{path:[e.id,t,`readOnly`],message:`Expected a boolean`}])}}validateFreeFields(){let e=new Set(z);for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n)){for(let r of n.fields)if(isFormFreeFieldRef(r)){let n=r.attribute.type;if(e.has(n))throw Error(`[FormBuilder] Free field in step "${t.id}" uses forbidden attribute type "${n}". Forbidden types: ${z.join(`, `)}`)}}}};function form(e,t){return new FormBuilder(e,t)}const i_=R.object({shape:R.enum(Uo),from:R.array(R.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 L(`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=/* @__PURE__ */ 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 F(`Object "${t}" must have a labelExpression. The labelExpression defines how records are displayed in lists and relations (e.g. "{{ name }}").`,I.VALIDATION_FAILED);let i=H.safeParse(n);if(!i.success){let e=i.error.issues[0]?.message??`Invalid labelExpression`;throw new F(`Invalid labelExpression for "${t}": ${e}`,I.VALIDATION_FAILED)}if(r!==void 0){let e=H.safeParse(r);if(!e.success){let n=e.error.issues[0]?.message??`Invalid embeddingExpression`;throw new F(`Invalid embeddingExpression for "${t}": ${n}`,I.VALIDATION_FAILED)}}}var ObjectBuilder=class{get"~standard"(){return createStandardSchemaProps(Vr(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);ht([...this.obj.attributes,...t],e=>e.name,e=>new N(`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 L(`[ObjectBuilder] Missing required field: name`,[{path:[`name`],message:`name is required`}]);if(!this.obj.label)throw new L(`[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&&Dr(e)}};function object(e,t){if(D(e))throw new P(e,`builder`);return new ObjectBuilder(e,t)}function validatePresetStructure(e,t,n){let fail=(t,n)=>{throw new L(t,[{path:[`documentLayout`,`presets`,e],message:n}])};n>5&&fail(`Preset structure exceeds max depth of 5`,`Preset structure too deep`);let r=/* @__PURE__ */ 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`&&A(this.extension,e.parameters,[`content`,`parameters`]),e}},a_=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 L?new L(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 a_(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 L(`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 L(`Expected custom content`,[]);let r=new X({...n,extension:e.name},e);return r.build(),r}function recordLinksTab(){return[x.name,x.label,custom(tt,{}).icon(x.icon)]}function page$1(e){let{object:t,name:n}=e.definition;if(typeof t!=`string`){let e=`Page "${n}" is standalone; a record tab renders a record page (\`page(...).for(object)\`)`;throw new L(e,[{path:[`content`,`page`,`object`],message:e}])}return new X({type:`page`,page:{object:t,name:n}})}const o_={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=/* @__PURE__ */ new Set;if(e.length<=S.tabsPerView)return n;let r=new Map(e.map(e=>[e.name,e])),i=/* @__PURE__ */ 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<=S.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=k(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??$n(s,w),l=yn([...s.values()]),u=o.filter(e=>!l.has(e.name)),d={},f=[],place=(e,t)=>{t&&!Object.values(d).some(e=>Qn(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=k(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]}let Z;function unaccentRules(){if(Z)return Z;let e=/* @__PURE__ */ new Map;for(let t of`
|
|
2
|
+
import{NonJsonValueError as e,asTenantId as t,asUserId as n,canonicalStringify as r,deepEqual as i,generateId as a,indexBy as o,sameStableValue as s,serializeCanonicalJson as c,serializeStableJson as l}from"./utils-DKrBP9EH.mjs";import{ACTIONABLE_DECISION_KINDS as u,AGENDA_BLOCK as d,AGGREGATE_BUCKETS as f,AGGREGATE_MEASURES as p,ARTIFACT_PREVIEW_EXTENSION as m,ATTRIBUTE_FILTER_OPERATORS as h,ATTRIBUTE_NAME_SCHEMA as ee,ATTRIBUTE_TYPES as te,ATTRIBUTE_TYPE_DESCRIPTORS as ne,BLOCK_CONTEXTS as re,BLOCK_PERIODS as ie,BLOCK_WIDTHS as g,CARD_BLOCK as _,CHART_BLOCK as v,CHART_KINDS as ae,CONTENT_PLACEMENT_CONTEXTS as oe,DECISIONS_BLOCK as se,DECISION_INBOX_STATES as ce,DECISION_KINDS as le,DECISION_LINE_MAX_LENGTH as ue,DECISION_LINK_TARGET_TYPES as de,DECISION_LIST_STATES as fe,DECISION_READ_STATES as pe,DECISION_SENDER_KINDS as me,DECISION_SETTINGS_AREAS as he,DECISION_TITLE_MAX_LENGTH as ge,DECISION_TRANSFERS_KEY as _e,DECISION_TYPES_V1 as ve,DECISION_TYPE_ACCESS_GRANTED as ye,DECISION_TYPE_AGENT_APPROVAL as be,DECISION_TYPE_AGENT_MESSAGE as xe,DECISION_TYPE_AGENT_QUESTION as Se,DECISION_TYPE_AGENT_REVIEW as Ce,DECISION_TYPE_AGENT_ROUTINE_RUN_FAILED as we,DECISION_TYPE_AGENT_SETUP as Te,DECISION_TYPE_BUNDLE_SETUP as Ee,DECISION_TYPE_CONNECTOR_CONNECTION_ERROR as De,DECISION_TYPE_CONNECTOR_CONNECTION_REAUTH_REQUIRED as Oe,DECISION_TYPE_ENVIRONMENT_BUILD_FAILED as ke,DECISION_TYPE_KINDS as y,DECISION_TYPE_PERSON as Ae,DECISION_TYPE_RECORD_ASSIGNED as je,DECISION_TYPE_RECORD_MENTIONED as Me,DECISION_WORK_STATES as Ne,DEFAULT_LAYOUT_TRAITS as Pe,GROUPABLE_ATTRIBUTE_TYPES as Fe,HEADING_BLOCK as Ie,HIERARCHY_ATTRIBUTE_IDS as Le,HIERARCHY_ATTRIBUTE_NAMES as Re,HIERARCHY_CHILD_IDS_LIMIT as ze,INVENTORY_LIMIT as Be,LIST_VIEW_TAB_VISIBILITIES as Ve,LOCATION_FILTER_PROPERTIES as He,MAILBOX_BLOCK as Ue,MAX_AGGREGATE_GROUPS as We,MEASURABLE_ATTRIBUTE_TYPES as Ge,MEETINGS_UPCOMING_BLOCK as Ke,METRIC_BLOCK as b,NATIVE_BLOCKS as qe,NATIVE_OBJECT_NAMES as Je,NO_VALUE_OPERATORS as Ye,OBJECT_NAME_SCHEMA 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 x,RECORD_LIST_SCOPES as nt,RECORD_OBJECT as rt,RELATION_TARGET_ANY as it,REMOVED_OPERATOR_REPLACEMENTS as at,RESERVED_ATTRIBUTE_NAMES as ot,RESERVED_OBJECT_NAMES as st,RESOURCE_VISIBILITIES as ct,RecordQuery as lt,SCHEMA_LIMITS as S,SYNONYM_ALIASES as ut,SYSTEM_ATTRIBUTES as dt,SYSTEM_ATTRIBUTE_I18N_KEYS as ft,SYSTEM_FIELD_NAMES as pt,SYSTEM_FILTER_ATTRIBUTE_TYPES as mt,TEXT_BLOCK as C,assertUniqueBy as ht,attributeFilterTarget as gt,attributeInventory as _t,blockObjectInputs as vt,buildQualifiedAttribute as yt,canonicalizeFilterValue as bt,capped as xt,collectContentViewCatalogue as St,collectQualifiedRuleIssues as Ct,collectionContentSourceSchema as wt,collectionSourceAddress as Tt,collectionSourceAddressOf as Et,colorIdSchema as Dt,columnsSchema as Ot,contentExtensionRegistry as w,contentReadObjects as kt,contentViewDefinitionSchema as T,contentViewDefinitionSchemaFor as At,currentActor as jt,decisionArchiveAllResultSchema as Mt,decisionAttachmentSchema as Nt,decisionCountsSchema as Pt,decisionLinkSchema as Ft,decisionListResultSchema as It,decisionRecipientSchema as Lt,decisionSchema as Rt,decisionSenderSchema as zt,decisionThreadKey as Bt,decisionTransferBy as Vt,decisionTransferTargetsSchema as Ht,decisionTransfersOf as Ut,decisionWithRecipientSchema as Wt,defineBlock as Gt,describeViewIssue as Kt,displayAttributesSchema as qt,draftContentViewDefinitionSchema as Jt,draftContentViewDefinitionSchemaFor as Yt,edgePropertyFilterTarget as Xt,extractCurrencyFilterValue as Zt,extractFilterValue as Qt,filterOperatorsOfType as $t,filterStateSchema as en,filterTargetsOf as tn,findGridViolation as nn,findGroupViolation as rn,findLayoutRuleViolation as an,findRelationAttribute as on,findRowLimitViolation as sn,formatDecisionLink as cn,getAttributeCapabilities as ln,getAttributeFilterOperators as un,getHierarchyAttributes as dn,getObjectSystemAttributes as fn,getOperatorPolarity as pn,getRollupFilterOperators as mn,getSystemAttributeI18nKey as hn,getSystemAttributeList as gn,gridPositionSchema as _n,groupSizeMessage as vn,groupedMembers as yn,hasTypeTrait as bn,hasValueKind as xn,iconNameSchema as E,inferInverseCardinality as Sn,input as Cn,invalidViewMessage as wn,isActionableDecisionKind as Tn,isAttributeFilterable as En,isAttributeGroupable as Dn,isAttributeKanbanGroupable as On,isAttributeSearchable as kn,isAttributeSortable as An,isBilateralRelation as jn,isBoardGrouping as Mn,isCalendarDay as Nn,isCollectionContent as Pn,isDynamicValue as Fn,isHierarchyAttribute as In,isLocationFilterProperty as Ln,isLocationPartOperator as Rn,isManagedSystemAttribute as zn,isNativeObjectName as D,isNoValueOperator as Bn,isPlainRecord as Vn,isRelativeDateValue as Hn,isSetMembershipOperator as Un,isUniversalRelation as Wn,isValueKindType as O,layoutTraitsOf as Gn,locationPartFilterTarget as Kn,memberlessGroups as k,metricComparePeriod as qn,normalizeFilterRule as Jn,normalizeForEdgeRpc as Yn,normalizeOperator as Xn,now as Zn,overlaps as Qn,pageTraitsOf as $n,parseBlockParameters as A,parseDecisionLink as er,parseQualifiedAttribute as tr,parseRecordListScope as nr,parseResourceVisibility as rr,publishedViewContentDefinitionSchema as j,query as ir,recordQueryDefinitionSchema as ar,relationAcceptsObject as or,relationTargetsOf as sr,requireContentPlacement as cr,requireRecordContentContext as lr,requireSingleRelationTarget as ur,resolveCollectionActions as dr,resolveContentNavigation as fr,resolveEffectiveFilterType as pr,resolveIsWithinBounds as mr,resolveUtcDayBounds as hr,singleRelationTarget as gr,sortsSchema as _r,sourcedAttributeOf as vr,systemColumnFilterTarget as yr,toMultiValueOperator as br,toUtcDayString as xr,today as Sr,validateAttributeName as Cr,validateContentViewCatalogue as wr,validateIconName as Tr,validateLabel as Er,validateObjectName as Dr,validateOptions as Or,validateQualifiedRule as kr,validateStoredViews as Ar,validateViewName as jr}from"./attribute-validators-RdwWgLqZ.mjs";import{COMPUTED_RETURN_TYPES as Mr,DEFAULT_VALIDATION_MESSAGES as Nr,SIMPLE_PROPERTY_TYPES as Pr,TEXT_FORMAT_PATTERNS as Fr,WIRE_OFFERED_BASE_CONFIG as Ir,WIRE_OMITTED_CONFIG_KEYS as Lr,attributeConfigSchemas as Rr,createAttributeValidator as zr,createFormAttributeValidator as Br,createObjectValidator as Vr,datePrecisionIssues as Hr,formatPhoneForDisplay as Ur,formatZodErrors as Wr,getAttributeConfigSchema as Gr,getAttributeConfigWriteSchema as Kr,getIso2 as qr,isEmptyValue as Jr,isNullishOrEmptyString as Yr,isValuePresent as Xr,normalizeCountrylessPhoneNumber as Zr,normalizePhoneNumber as Qr,parseAttributeConfig as $r,parseAttributeConfigForCreate as ei,parseAttributeConfigForUpdate as ti,propertyAttributeSchema as ni,propertyAttributeWireSchema as ri,propertySchemaSchema as ii,propertySchemaWireSchema as ai,refuseForeignKeys as oi,rejectUnknownAttributesOrThrow as si,resolveTextPattern as ci,selectOptionWriteSchema as li,statusGroupSchema as ui,statusOptionWriteSchema as di,validateAttribute as fi,validateDraft as pi,validateDraftOrThrow as mi,validateObject as hi,validateObjectOrThrow as gi,wireHiddenTypeConfigMask as _i,wireOmittedConfigKeysFor as vi,withoutUnknownOptionKeys as yi}from"./all-BKRTNSnx.mjs";import"./zod-locale.mjs";import{ACCESS_CAPABILITIES as bi,ACCESS_LEVELS as xi,ACCESS_ROLES as Si,ACTOR_TYPES as Ci,AGENT_ASIDE_ANSWER_MAX_LENGTH as wi,AGENT_ASIDE_HISTORY_LIMIT as Ti,AGENT_ASIDE_QUESTION_MAX_LENGTH as Ei,AGENT_AVATAR_EXPRESSIONS as Di,AGENT_AVATAR_TYPES as Oi,AGENT_ENVIRONMENT_MODES as ki,AGENT_MESSAGE_KIND as Ai,AGENT_MESSAGE_SENDER_NAME_KEY as ji,AGENT_NOTIFICATION_KIND as Mi,AGENT_SESSION_ACCESS_ROLES as Ni,AGENT_SESSION_LIST_ORDERS as Pi,AGENT_SESSION_ORIGINS as Fi,AGENT_SESSION_PROVENANCES as Ii,AGENT_STARTERS_MAX as Li,AGENT_STARTER_MAX_LENGTH as Ri,AGENT_SYSTEM_PROMPT_MAX_LENGTH as zi,AGENT_TASK_KINDS as Bi,AGENT_WAKE_KIND as Vi,AI_MODEL_INPUT_MODALITIES as Hi,AI_MODEL_PROFILE_LABELS as Ui,AI_MODEL_REASONING_MODES as Wi,ALL_CATALOG_TOOL_NAMES as Gi,ALWAYS_KINDS as Ki,APPEARANCE_FACETS as qi,APPROVAL_FAMILY_TOOL_NAMES as Ji,ARCHITECT_PUBLICATION_KIND as Yi,ASK_QUESTIONS_ANSWER_MAX_LENGTH as Xi,ASK_QUESTIONS_ANSWER_MAX_VALUES as Zi,ASK_QUESTIONS_MAX_BATCH as Qi,ASK_QUESTIONS_TOOL_NAME as $i,ATTACH_FILE_ACTIONS as ea,AUDIT_ACTIONS as ta,AUDIT_AGENT_SESSION_METADATA_KEY as na,AUDIT_RESOURCE_TYPES as ra,AgentBuilder as M,BILLING_MODES as ia,BROWSER_LAUNCH_TOOL_NAME as aa,BROWSER_TOOL_NAMES as oa,BUNDLE_LOCALES as sa,BUNDLE_SETUP_PROMPT_MAX_LENGTH as ca,CATALOG_RESOURCES as la,CONNECTION_GRANT_PROVIDERS as ua,CONNECTION_STATUS_IDS as da,CONNECTOR_PROVIDER_IDS as fa,CONNECTOR_SCOPES as pa,CONTINUATION_KEY_PATTERN as ma,CONVERSATION_SURFACES as ha,COPY_VERB_NAME as ga,CORE_RECORD_TOOL_NAMES as _a,CORE_TOOL_NAMES as va,COUNT_MODES as ya,CUSTOM_LEVEL as ba,DEFAULT_AGENT_EXECUTION_CONFIG as xa,DEFAULT_AGENT_TOOL_GROUPS as Sa,DEFAULT_APPEARANCE_ICON as Ca,DEFAULT_APPROVAL_POLICY as wa,DEFAULT_BLUEPRINT_TOOL_GROUPS as Ta,DEFAULT_DAILY_ACTIVITY_DAYS as Ea,DEFAULT_DICTATION_LIMITS as Da,DEFAULT_MEETING_BOT_DISPLAY_NAME as Oa,DEFAULT_TENANT_SETTINGS as ka,DEVICE_ACCESS_ROLES as Aa,DEVICE_CHANNEL_AUTHENTICATE_TIMEOUT_MS as ja,DEVICE_CHANNEL_IDLE_POLL_MS as Ma,DEVICE_CHANNEL_KEEPALIVE_MS as Na,DEVICE_CHANNEL_MAX_FRAME_BYTES as Pa,DEVICE_CHANNEL_PATH as Fa,DEVICE_CHANNEL_PRESENCE_MS as Ia,DEVICE_CHANNEL_WORKER_CLOSE_PROTOCOL_VIOLATION as La,DEVICE_COMMAND_ERROR_CODES as Ra,DEVICE_DESKTOP_STATES as za,DEVICE_SHELLS as Ba,DICTATION_FINALIZATION_TIMEOUT_MS as Va,DICTATION_FRAME_BYTES as Ha,DICTATION_MAX_BUFFER_BYTES as Ua,DICTATION_MAX_FRAME_BYTES as Wa,DICTATION_MAX_TRANSCRIPT_BYTES as Ga,DICTATION_MODEL_ID as Ka,DICTATION_PREPARATION_TIMEOUT_MS as qa,DICTATION_SAMPLE_RATE as Ja,DICTATION_TICKET_TTL_MS as Ya,DISCARD_ARCHITECT_DRAFT_TOOL_NAME as Xa,DOCUMENT_KINDS as Za,DOCUMENT_SORT_MODES as Qa,DRAFT_WRITE_TOOL_NAMES as $a,DeviceChannelProtocolError as eo,DeviceChannelServerFrameSchema as to,DeviceChannelWorkerFrameSchema as no,DeviceDesktopStatusSchema as ro,EMAIL_CATEGORY_DEFAULT_COLOR as io,EMAIL_CATEGORY_DEFAULT_ICON as ao,EMAIL_CATEGORY_DESCRIPTION_MAX as oo,EMAIL_CATEGORY_DESCRIPTION_MIN as so,EMAIL_CATEGORY_LIMIT as co,EMAIL_CATEGORY_NAME_MAX as lo,EMAIL_CATEGORY_SCOPES as uo,EMAIL_CLASSIFIED_BY as fo,EMAIL_DIRECTIONS as po,EMAIL_PARTICIPANT_ROLES as mo,EMAIL_PROVIDERS as ho,EMAIL_RULE_SCOPES as go,ENVIRONMENT_BUILD_LOG_STEPS as _o,ENVIRONMENT_BUILD_LOG_STEP_PREFIX as vo,ENVIRONMENT_HARNESSES as yo,ENVIRONMENT_HARNESS_SANDBOX_WORKDIR as bo,ENVIRONMENT_HARNESS_WORKDIR as xo,ENVIRONMENT_IMAGES as So,ENVIRONMENT_MEMORY_GB_PER_VCPU as Co,ENVIRONMENT_NAME_MAX_CHARS as wo,ENVIRONMENT_NETWORK_ALLOW_MAX as To,ENVIRONMENT_SCRIPT_MAX_BYTES as Eo,ENVIRONMENT_SIZES as Do,ENVIRONMENT_SIZE_VCPUS as Oo,ENVIRONMENT_STANDARDS_WORKDIR as ko,ENV_VAR_KEY_PATTERN as Ao,ESTIMATED_COUNT_CAP as jo,FILE_LIST_MAX_IDS as Mo,FILE_OCR_STATUSES as No,FILE_URLS_MAX_IDS as Po,FORM_STATUSES as Fo,FORM_SUBMISSION_STATUSES as Io,GET_ARCHITECT_DRAFT_TOOL_NAME as Lo,GITHUB_TRIGGER_CATALOG as Ro,GRANT_ENABLES as zo,HARNESS_BRIDGE_PORT as Bo,HITL_TOOL_NAMES as Vo,IMAGE_FORMATS as Ho,IMAGE_SHAPES as Uo,IMAGE_SOURCES as Wo,INFERENCE_REASONING_OPTIONS as Go,INFERENCE_ROUTING_MODES as Ko,INFERENCE_SPEEDS as qo,LAST_RUN_ERROR_MAX_LENGTH as Jo,LINK_COOKIE_MAX_AGE_MS as Yo,LINK_DEFAULT_MS as Xo,LINK_MAX_MS as Zo,MACHINE_KEY_KINDS as Qo,MAILBOX_ACCOUNT_VISIBILITIES as $o,MAILBOX_LIST_MODES as es,MAIL_DRAFT_BODY_MAX_CHARS as ts,MAIL_DRAFT_MODES as ns,MAIL_SIGNATURE_MAX_CHARS as rs,MAIL_SUBJECT_MAX_CHARS as is,MAX_DAILY_ACTIVITY_DAYS as as,MAX_TODOS as os,MAX_TODO_DESCRIPTION_CHARS as ss,MAX_TODO_ID_CHARS as cs,MEETING_BOT_IMAGE as ls,MEETING_BOT_IMAGE_BASE64_MAX_LENGTH as us,MEETING_BOT_NO_CREDITS as ds,MEETING_BOT_SILENT_REASON as fs,MEETING_CONFERENCE_REQUESTS as ps,MEETING_PARTICIPANT_ROLES as ms,MEETING_RESPONSES as hs,MEETING_RESPONSE_STATUSES as gs,MEETING_STATUSES as _s,MEMORY_SPEND_LIMIT_PATTERN as vs,NATIVE_TOOL_GROUPS as ys,NATIVE_TOOL_GROUP_CATALOG as bs,NEWS_DEFAULT_DISPLAY_DAYS as xs,NEWS_DISPLAY_CAP_DAYS as Ss,NEWS_INDEX_MAX_ENTRIES as Cs,NEWS_INTENSITIES as ws,NEWS_TARGET_KINDS as Ts,NO_ACCESS as Es,NO_RECORDING as Ds,OAUTH_TICKET_TTL_MS as Os,OBJECT_GRANT as ks,OPEN_TOOL_PART_STATES as As,OPERATION_MAX_STEPS as js,PERMISSION_ACTIONS as Ms,PERMISSION_CAPABILITIES as Ns,PERMISSION_CATALOG as Ps,PERSISTENCE_OWNED_QUOTA_KEYS as Fs,PROVIDER_DRAFT_LABEL as Is,PROVIDER_NAMES as Ls,PUBLIC_MAIL_DOMAINS as Rs,QUESTION_FAMILY_TOOL_NAMES as zs,QUOTA_KEYS as Bs,RECENT_ACTIVITY_LEDGER_LIMIT as Vs,RECIPIENT_IDENTITIES_MAX as Hs,RECORDING_OVERRIDES as Us,RECORDING_POLICIES as Ws,RECORD_ACCESS_ROLES as Gs,RECORD_ACCESS_SOURCES as Ks,RECORD_DRIVE_CURSOR_MAX_LENGTH as qs,RECORD_DRIVE_PAGE_DEFAULT_LIMIT as Js,RECORD_DRIVE_PAGE_MAX_LIMIT as Ys,RECORD_GRAPH_DEFAULT_LIMIT_PER_NODE as Xs,RECORD_GRAPH_MAX_LIMIT_PER_NODE as Zs,RECORD_GRAPH_MAX_NODES as Qs,RECORD_IMAGE_MAX_BYTES as $s,REFERENCE_KINDS as ec,REPLY_MODES as tc,REQUEST_DESIGN_REVIEW_TOOL_NAME as nc,REQUEST_SETUP_TOOL_NAME as rc,RESOURCE_GRANT_KINDS as ic,RESOURCE_KIND_CATALOG as ac,ROUTING_PRICE_CEILINGS as oc,RUN_ORIGIN_METADATA_KEY as sc,SEND_VERB_NAME as cc,SESSION_INFERENCE_PATCH_KEYS as lc,SLACK_TRIGGER_CATALOG as uc,SPEAKS_THROUGH_SEND_METADATA_KEY as dc,SURFACE_TOOL_NAMES as fc,SYSTEM_EMAIL_CATEGORIES as pc,SYSTEM_EMAIL_CATEGORY_NAMES as mc,SYSTEM_PART_CODES as hc,TASK_DEMAND_LEVELS as gc,TENANT_INVITATION_DEFAULT_TTL_MS as _c,TENANT_INVITATION_DELIVERY_STATUSES as vc,TENANT_INVITATION_MAX_TTL_MS as yc,TENANT_INVITATION_MIN_TTL_MS as bc,TENANT_INVITATION_RESEND_INTERVAL_MS as xc,TENANT_INVITATION_STATUSES as Sc,TODO_PHASES as Cc,TODO_PLAN_STATUSES as wc,TODO_STATUSES as Tc,TOOL_APPROVAL_STATES as Ec,TOOL_IMPACT_COUNT_KEYS as Dc,TRANSCRIPT_STATUSES as Oc,TRIAGE_ACTIONS as kc,TRIGGER_EVENT_TYPES as Ac,TURN_OUTCOMES as jc,UNSHAREABLE_OBJECT_NAMES as Mc,USAGE_MODALITIES as Nc,USAGE_SCOPES as Pc,USERS_RESOLVE_MAX_IDS as Fc,USER_STATUSES as Ic,USER_WORK_POSTURES as Lc,VERB_NAMES as Rc,WAKE_TURN_METADATA_KEY as zc,WAKE_TURN_SPOKE_METADATA_KEY as Bc,WALLET_STATUSES as Vc,accessGrantSchema as Hc,actorSchema as Uc,agent as Wc,agentApprovalResolutionSchema as Gc,agentAvatarFromMetadata as Kc,agentAvatarOutputSchema as qc,agentAvatarSchema as Jc,agentConversationOverviewSchema as Yc,agentDataChunk as Xc,agentDefinitionActivitySchema as Zc,agentDefinitionAudienceSchema as Qc,agentDefinitionDailyActivitySchema as $c,agentDefinitionSchema as el,agentDisplayName as tl,agentExecutionConfigOutputSchema as nl,agentHistoryMessageSchema as rl,agentInferencePreferencesOutputSchema as il,agentInferencePreferencesSchema as al,agentMemoryViewSchema as ol,agentMessageAttachmentSchema as sl,agentMessagePartSchema as cl,agentRequestAnswerSchema as ll,agentRoleSchema as ul,agentRolesSetResultSchema as dl,agentRunSchema as fl,agentRunStatusSchema as pl,agentScheduleOutputSchema as ml,agentScheduleSchema as hl,agentSessionAudienceSchema as gl,agentSessionDefinitionAppearanceSchema as _l,agentSessionHistoryPageSchema as vl,agentSessionInferenceOverridesInputSchema as yl,agentSessionInferenceOverridesSchema as bl,agentSessionLinkSchema as xl,agentSessionMessageOutputSchema as Sl,agentSessionMessageSchema as Cl,agentSessionSchema as wl,agentSetupResponseSchema as Tl,agentStartersSchema as El,agentTodoPlanViewSchema as Dl,agentToolCatalogSchema as Ol,agentTriggerBaseSchema as kl,agentTriggerDefinitionSchema as Al,agentTriggerLastCallSchema as jl,agentTriggerPatchSchema as Ml,agentTriggerSchema as Nl,agentUIValidationError as Pl,agentWakeSchema as Fl,agentWakeViewSchema as Il,apiKeyRoleSchema as Ll,apiKeySchema as Rl,apiKeyWithSecretSchema as zl,architectProjectionSchema as Bl,artifactQuoteSchema as Vl,askQuestionsOutputSchema as Hl,assertCustomAgentUIMessageChunk as Ul,assertSessionState as Wl,attachedRecordDocumentSchema as Gl,attributeOutputSchema as Kl,attributeSaveOutputSchema as ql,auditChangeSchema as Jl,auditLogEntrySchema as Yl,availableBundleSummarySchema as Xl,browserProfilePreparationSchema as Zl,browserProfileViewSchema as Ql,bundleAddPlanSchema as $l,bundleAddResultSchema as eu,bundleContentsSchema as tu,bundleListSchema as nu,bundleModeSchema as ru,bundleOriginSchema as iu,bundlePieceKindSchema as au,bundlePlanPieceSchema as ou,bundleRemovalPreviewSchema as su,bundleStatusEntrySchema as cu,bundleStatusSchema as lu,bundleUpdateGroupSchema as uu,bundleUpdatePieceKindSchema as du,bundleUpdatePieceSchema as fu,bundleUpdatePlanSchema as pu,bundleUpdateReasonCodeSchema as mu,bundleUpdateResultSchema as hu,cancelAgentWakeResultSchema as gu,canonicalToolGroups as _u,capabilityForResource as vu,classificationRestoreSchema as yu,classificationUndoSchema as bu,classifyEmailResultSchema as xu,classifyEmailSchema as Su,cliDefaultModelOf as Cu,cloudBrowserLiveViewSchema as wu,collectionOutputSchema as Tu,collectionPageSchema as Eu,compareAgentSessionMessages as Du,compareVersions as Ou,compiledHarnessModels as ku,computeReconnectDelay as Au,computeRetryDelay as ju,connectionCapabilitiesSchema as Mu,connectionGrantKindsOf as Nu,connectionSyncProgressSchema as Pu,connectionViewSchema as Fu,connectorProvidersResultSchema as Iu,connectorTriggerMatchSchema as Lu,createAgentTriggerResultSchema as Ru,criticConfigOutputSchema as zu,customDataChunkSchemas as Bu,declaredImageRequests as Vu,decodeAgentSessionListCursor as Hu,decodeRecordValues as Uu,defaultEnvironmentSchema as Wu,deriveViewerAccess as Gu,deviceAudienceSchema as Ku,deviceChannelUrl as qu,documentFileSchema as Ju,documentRecordOwnerPageSchema as Yu,documentRecordOwnerSchema as Xu,documentSchema as Zu,documentWithSubCountSchema as Qu,draftAppendOutputSchema as $u,draftCommandGuardSchema as ed,driveFileSchema as td,durableDateSchema as nd,editAgentSessionMessageResultSchema as rd,effectivePermissionsSchema as id,emailAttachmentMetaSchema as ad,emailCategoryCreateSchema as od,emailCategoryDeleteSchema as sd,emailCategorySchema as cd,emailCategoryScopeQuerySchema as ld,emailCategoryUpdateSchema as ud,emailCategoryUsageSchema as dd,emailParticipantRefSchema as fd,emailRuleScopeSchema as pd,emailSenderRuleSchema as md,emailVerdictSchema as hd,encodeAgentSessionListCursor as gd,encodeRecordValues as _d,envVarEntrySchema as vd,environmentBuildFailureSchema as yd,environmentBuildStateSchema as bd,environmentDetailSchema as xd,environmentHarness as Sd,environmentHarnessSchema as Cd,environmentListSchema as wd,environmentNetworkPolicyOutputSchema as Td,environmentRepositorySourceSchema as Ed,environmentSchema as Dd,environmentWorkdir as Od,fileSchema as kd,fileUrlsResponseSchema as Ad,findEnvironmentHarness as jd,findGrantIssues as Md,formDefinitionSchema as Nd,formSlotSchema as Pd,formStepSchema as Fd,formSubmissionSchema as Id,formatNewsTarget as Ld,formatReference as Rd,githubConditionSchema as zd,githubTriggerMatchSchema as Bd,grantKindOf as Vd,harnessModelChoices as Hd,harnessModelListSchema as Ud,harnessModelOptionSchema as Wd,hasLocale as Gd,humanRequestId as Kd,humanRequestKind as qd,imageModelFormatDefect as Jd,imageModelIdSchema as Yd,inferenceReasoningSchema as Xd,inferenceRoutingSchema as Zd,inferenceSpeedSchema as Qd,installedBundleSummarySchema as $d,isAgentMessageMetadata as ef,isAgentNotificationMetadata as tf,isAgentUIDataName as nf,isAgentWakeMetadata as rf,isAgentWrittenAuditEntry as af,isArchitectPublicationMetadata as of,isAwaitingHuman as sf,isBlocking as cf,isCatalogResource as lf,isEnvironmentBuildLogStep as uf,isEnvironmentHarnessId as df,isFormDefinition as ff,isImageSource as pf,isMailProvider as mf,isMailboxListMode as hf,isNativeToolGroup as gf,isOpenToolPartState as _f,isParkedOnHuman as vf,isProviderDraft as yf,isPublicMailDomain as bf,isQuestionPart as xf,isReplyMode as Sf,isResourceGrant as Cf,isRoutineActorMetadata as wf,isSemver as Tf,isSessionInferencePatch as Ef,isSystemEmailCategory as Df,isSystemEmailCategoryName as Of,isSystemPartCode as kf,isToolApprovalState as Af,isToolImpactCountKey as jf,isWildcard as Mf,lastPublicationSchema as Nf,lastPublishErrorSchema as Pf,levelActions as Ff,levelFloor as If,levelOf as Lf,linkedRecordRefSchema as Rf,lockingSendCall as zf,loginSecretEntrySchema as Bf,mailDraftAttachmentSchema as Vf,mailDraftSchema as Hf,mailSignatureSchema as Uf,mailboxAccountSchema as Wf,mailboxCursorSchema as Gf,mailboxEmailSchema as Kf,mailboxListResponseSchema as qf,mailboxSenderImageSchema as Jf,mailboxThreadDetailSchema as Yf,mailboxThreadSchema as Xf,mcpCatalogCategorySchema as Zf,mcpCatalogEntrySchema as Qf,mcpOAuthAttemptStartedSchema as $f,mcpServerAuthTypeSchema as ep,mcpServerStatusSchema as tp,mcpServerViewSchema as np,meetingBotDispatchRequestSchema as rp,meetingBotDispatchResponseSchema as ip,meetingBotNotificationSchema as ap,meetingLinkedRecordSchema as op,meetingParticipantRefSchema as sp,meetingRecordingSchema as cp,meetingSchema as lp,meetingSiblingRefSchema as up,meetingTranscriptProvenanceSchema as dp,meetingTranscriptResponseSchema as fp,meetingTranscriptSegmentSchema as pp,meetingTranscriptSourceRefSchema as mp,meetingsListResponseSchema as hp,memberSchema as gp,mentionReferenceSchema as _p,mergeSessionInferencePatch as vp,modelDefinitionOutputSchema as yp,modelDefinitionSchema as bp,modelReferenceOutputSchema as xp,modelReferenceSchema as Sp,mutationReceiptSchema as Cp,myPreferencesSchema as wp,needsManageWhenUnattended as Tp,newsBodySchema as Ep,newsIndexSchema as Dp,normalizeNewsLocale as Op,normalizedMeetingTranscriptSchema as kp,oauthAttemptStartedSchema as Ap,objectDefinitionOutputSchema as jp,objectRecordOutputSchema as Mp,openRequests as Np,orderAgentSessionMessages as Pp,pageAudienceSchema as Fp,pageReadSchema as Ip,pageSummarySchema as Lp,parseAgentDefinitionAccessRole as Rp,parseAgentSessionAccessRole as zp,parseCountMode as Bp,parseDeviceAccessRole as Vp,parseDeviceChannelFrame as Hp,parseMergedAgentTrigger as Up,parseNewsBody as Wp,parseNewsIndex as Gp,parseNewsIntensity as Kp,parseNewsTarget as qp,parseOptionalCountMode as Jp,parsePageAccessRole as Yp,parseRecordAccessRole as Xp,parseReference as Zp,parseServerFrame as Qp,parseToolGroupGrant as $p,parseWorkerFrame as em,permissionFlagsSchema as tm,permissionGrantSchema as nm,permissionSchema as rm,preferenceEntry as im,preferenceEntrySchema as am,providerNameSchema as om,publishBlockerSchema as sm,publishDraftOutputSchema as cm,quotaStateSchema as lm,readArchitectPublication as um,readAskQuestionsResult as dm,readRunOriginMetadata as fm,recentActivityEntryKey as pm,recipientContactSchema as mm,recipientIdentitySchema as hm,recipientSuggestionSchema as gm,recordAggregatesSchema as _m,recordAudienceSchema as vm,recordCollectionOutputSchema as ym,recordDeletionCountSchema as bm,recordDriveChildSchema as xm,recordDriveChildrenPageSchema as Sm,recordDriveSearchHitSchema as Cm,recordDriveSearchResultSchema as wm,recordGraphEdgeSchema as Tm,recordGraphNodeKey as Em,recordGraphNodeSchema as Dm,recordGraphRequestSchema as Om,recordGraphResponseSchema as km,recordIncomingReferenceSchema as Am,recordIncomingReferencesPageSchema as jm,recordMeetingsCount as Mm,recordOperationSchema as Nm,recordPurgeResultSchema as Pm,recordValuesCodec as Fm,recordsBulkCreateResultSchema as Im,recordsBulkDeleteResultSchema as Lm,recordsBulkUpdateResultSchema as Rm,refineTrigger as zm,relationOptionSchema as Bm,relationOptionsResponseSchema as Vm,replyDefaultsSchema as Hm,requestedCapabilities as Um,resolveAppearance as Wm,resolveLocalized as Gm,resolvedRelationsBatchSchema as Km,resourceGrant as qm,resourceUsedBySchema as Jm,retryPolicyOutputSchema as Ym,roleSchema as Xm,routedMessageInferenceSchema as Zm,routineAudiencePreviewSchema as Qm,routineAudienceSchema as $m,sameActions as eh,schemaDraftOutputSchema as th,schemaGroupListSchema as nh,schemaGroupSchema as rh,schemaStateAddressOf as ih,schemaStateEntrySchema as ah,schemaStateSchema as oh,secretEntrySchema as sh,sessionImageUsageSchema as ch,sessionInferenceOverridesOutputSchema as lh,sessionInferencePatchSchema as uh,sessionStateSchema as dh,setAgentSessionWorkPostureResultSchema as fh,slackConditionSchema as ph,slackTriggerMatchSchema as mh,submitOutcomeSchema as hh,syncBundleResultSchema as gh,tenantInvitationSchema as _h,tenantSettingsResponseSchema as vh,tenantSettingsSchema as yh,todoItemSchema as bh,todoPlanSchema as xh,toolImpactSchema as Sh,triageResultSchema as Ch,userProfileSchema as wh,utf8ByteLength as Th,viewPreferenceAddressSchema as Eh,viewReadSchema as Dh,viewerAccessSchema as Oh,withPreferenceEntry as kh,withoutTrailingSlashes as Ah}from"./record-operation-GX6TNLz8.mjs";import{AccessDeniedError as jh,AggregateValidationError as Mh,AmbiguousSchemaChangeError as Nh,AttributeInUseError as Ph,AttributeNotFoundError as Fh,ConcurrentModificationError as Ih,DuplicateError as N,ExportTooLargeError as Lh,ForbiddenError as Rh,InvalidPermissionGrantError as zh,LogoProviderUnavailableError as Bh,LogoSearchRateLimitedError as Vh,MemoryNotFoundError as Hh,NotFoundError as Uh,NotImplementedError as Wh,ObjectNotFoundError as Gh,ObjectReferencedError as Kh,OrphanSystemAttributeError as qh,PageReferencedError as Jh,ProtectedResourceError as Yh,ProtectedRoleError as Xh,QueryTimeoutError as Zh,RealtimeDeliveryError as Qh,RealtimeRateLimitedError as $h,RealtimeSubscriptionError as eg,RecordNotFoundError as tg,RecordReferencedError as ng,RepositoryError as rg,ReservedObjectNameError as P,RoleNotFoundError as ig,SCHEMA_ERROR_HTTP_STATUS as ag,SchemaError as F,SchemaErrorCode as I,SearchBackendError as og,SearchPathNotIndexedError as sg,StorageError as cg,SyncCascadeError as lg,SyncConflictError as ug,SyncError as dg,SystemEntityImmutableError as fg,ToolGroupGrantError as pg,ValidationError as L,WorkspaceInvariantReason as mg,isAttributeInUseError as hg,isNotFoundError as gg,isObjectReferencedError as _g,isProtectedResourceError as vg,isRecordReferencedError as yg,isSchemaError as bg,isValidationError as xg}from"./exceptions.mjs";import*as R from"zod";import{getCountryByIso2 as Sg,isValidCurrencyCode as Cg,isValidIso3 as wg}from"@standards/constants";import{parsePhoneNumberFromString as Tg}from"libphonenumber-js";const Eg=`__stndrdsNativeUiPartIds`,Dg=1;function invalidNativePartIds(){throw new L(`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?.[Eg];isPlainRecord$1(t)||invalidNativePartIds(),Object.keys(t).length===2&&t.schemaVersion===1&&isPlainRecord$1(t.partIds)||invalidNativePartIds();let n=/* @__PURE__ */ new Map;for(let[t,r]of e.parts.entries()){let e=nativeAgentUIPartIdMetadataKey(r,t);!e||n.has(e)?e&&invalidNativePartIds():n.set(e,r)}let r=Object.entries(t.partIds);r.length!==n.size&&invalidNativePartIds();let i=/* @__PURE__ */ 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 Og=5,z=[`relation`,`multiRelation`,`formula`,`rollup`,`document`,`richtext`,`user`];function isFormSlotFieldRef(e){return e.type===`slot`}function isFormFreeFieldRef(e){return e.type===`free`}function resolveFieldRequired(e){return e.readOnly===!0?!1:e.fieldRequired===void 0?e.slotMode===`create`&&e.attributeRequired===!0:e.fieldRequired}function getSlotFieldTargets(e){return e.additionalSlotIds?.length?[e.slotId,...e.additionalSlotIds]:[e.slotId]}function formFieldKey(e){return isFormSlotFieldRef(e)?`${e.slotId}.${e.attribute}`:`free.${e.attribute.name}`}function formFieldFlatKey(e){return isFormSlotFieldRef(e)?e.attribute:e.attribute.name}function readFormFieldValue(e,t){return e[formFieldKey(t)]??e[formFieldFlatKey(t)]}function isFormFieldsRow(e){return e.type===`fields`}function isFormHeadingRow(e){return e.type===`heading`}function isFormSeparatorRow(e){return e.type===`separator`}function isFormTextRow(e){return e.type===`text`}function 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 O(e.type,`options`)}function schemaGroupKey(e){return`${e.kind}:${e.name}`}function refuse$2(e){throw new L(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>S.labelLength&&refuse$2(`Label is too long (max ${S.labelLength} characters)`),n.label=t}}return n}const B=/^(?:core|bundle:.+)$/u;function parseSchemaOwner(e){if(e===null)return null;if(!B.test(e))throw new L(`Invalid schema owner "${e}"`,[]);return e}const kg=[`web`,`presentation`,`document`,`spreadsheet`,`image`,`code`,`other`],Ag=[`ephemeral`,`conversation`,`persistent`],jg=[`source`,`preview`,`entrypoint`,`asset`];var NoopGeocodingAdapter=class{async autocomplete(){return await Promise.resolve([])}async geocode(){return await Promise.resolve(null)}};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 Mg=[`B`,`KB`,`MB`,`GB`,`TB`];function formatByteSize(e){let{value:t,unitIndex:n}=computeByteMagnitude(e);return`${t} ${Mg[n]}`}const Ng=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(!Ng.includes(e.type))throw Error(`Property type "${e.type}" is not supported in .qualifyWith()`);t.push(e)}return{definitions:t}}const Pg=[`UPPER`,`LOWER`,`capitalize`,`trim`],Fg=[`prefix`,`suffix`,`wrap`,`default`],V=[...Pg,...Fg],Ig=/^\s*where\s*(?::(.*))?$/s,Lg=`[A-Za-z_][A-Za-z0-9_]*`,Rg=/^[^\s,()|{}="']+$/,zg=RegExp(`^(${Lg})\\s*=\\s*(.*)$`),Bg=RegExp(`^(${Lg})\\s+in\\s*\\(([^()]*)\\)$`);function isWherePipe(e){return Ig.test(e)}function parseWherePipe(e){let t=e.match(Ig)?.[1]?.trim();if(!t)return null;let n=t.match(Bg);if(n){let e=n[2].split(`,`).map(e=>e.trim());return e.every(e=>Rg.test(e))?{property:n[1],values:e}:null}let r=t.match(zg);return r&&Rg.test(r[2])?{property:r[1],values:[r[2]]}:null}const H=R.string().min(1,`labelExpression cannot be empty`).refine(e=>isLabelExpression(e),{message:`labelExpression must contain at least one {{ attribute }} interpolation`}).refine(e=>!/\{\{\s*\}\}/.test(e),{message:`labelExpression contains empty {{ }} interpolation`}).refine(e=>{let t=/(?<!\|)\|(?!\|)\s*(\w+)(?::[^|}]*)?/g,n;for(;(n=t.exec(e))!==null;){let e=n[1];if(!V.includes(e))return!1}return!0},{message:`Invalid pipe name. Valid pipes: ${V.join(`, `)}`});function validateLabelExpression(e){let t=H.safeParse(e);return t.success?{success:!0,attributes:extractAttributeNames(e)}:{success:!1,error:t.error.issues[0]?.message??`Invalid labelExpression`}}function applyPipe(e,t){let{name:n,args:r}=parsePipeExpression(t);switch(n){case`UPPER`:return e.toUpperCase();case`LOWER`:return e.toLowerCase();case`capitalize`:return e.replace(/(^|\s)\S/g,e=>e.toUpperCase());case`trim`:return e.trim();case`prefix`:return e?`${r[0]??``}${e}`:``;case`suffix`:return e?`${e}${r[0]??``}`:``;case`wrap`:return e?`${r[0]??``}${e}${r[1]??``}`:``;case`default`:return e||r[0]||``;default:return e}}function applyPipes(e,t){let n=e;for(let e of t)n=applyPipe(n,e);return n}function getValue(e,t){return t.split(`.`).reduce((e,t)=>{if(typeof e==`object`&&e)return e[t]},e)}const Vg=`(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=Vg){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 Hg=/^\{\{\s*([a-zA-Z_][a-zA-Z0-9_]*)\s*\}\}$/;function getSingleAttributeFromExpression(e){let t=e.trim().match(Hg);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`||ln(r).authoring.readOnly?null:r}const Ug=`memory`,Wg=4e3,Gg=`workspace`,U={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[U.name]),description:textValue(t[U.description]),content:textValue(t[U.content]),visibility:e.visibility,ownedBy:e.ownedBy,updatedAt:new Date(e.updatedAt).toISOString()}}const Kg={meetingHour:`0.80`,computeVcpuHour:`0.20`,browserHour:`0.60`},qg=[`meeting.recording`,`sandbox.agent`,`sandbox.harness`,`sandbox.build`,`browser.session`];function isMeteredChargeKind(e){return qg.includes(e)}const Jg=/^\d+(?:\.\d+)?$/u;function meteredUsd(e,t){if(!Jg.test(e))throw new L(`Invalid metered rate "${e}"`,[]);if(!(t>=0&&t<=2**53-1))throw new L(`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 Yg=`@standards/schema`;function createStandardSchemaProps(e){return{version:1,vendor:Yg,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(zr(this.build()))}constructor(e,t,n){Cr(t),Er(n),this.attr={name:t,label:n,type:e,required:!1,system:!0}}asPhantomState(){return this}required(){return this.attr.required=!0,this.asPhantomState()}optional(){return this.attr.required=!1,this.asPhantomState()}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 Tr(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||!O(String(this.attr.type),`computed`))&&(this.attr.defaultValue=e),this}metadata(e){return this.attr.metadata=e,this}build(){return this.attr}},TextAttributeBuilder=class extends BaseAttributeBuilder{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}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(`text`,e,t)}var RichtextAttributeBuilder=class extends BaseAttributeBuilder{};function richtext(e,t){return new RichtextAttributeBuilder(`richtext`,e,t)}var NumberAttributeBuilder=class extends BaseAttributeBuilder{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}};function number(e,t){return new NumberAttributeBuilder(`number`,e,t)}var CheckboxAttributeBuilder=class extends BaseAttributeBuilder{};function checkbox(e,t){return new CheckboxAttributeBuilder(`checkbox`,e,t)}var DateAttributeBuilder=class extends BaseAttributeBuilder{format(e){return this.attr.dateFormat=e,this}precision(e){return this.attr.precision=e,this}build(){let[e]=Hr(`date`,this.attr);if(e!==void 0)throw new L(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}};function date(e,t){return new DateAttributeBuilder(`date`,e,t)}var PhoneAttributeBuilder=class extends BaseAttributeBuilder{defaultCountry(e){return this.attr.defaultCountryCode=e,this}};function phone(e,t){return new PhoneAttributeBuilder(`phone`,e,t)}var CurrencyAttributeBuilder=class extends BaseAttributeBuilder{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}};function currency(e,t){return new CurrencyAttributeBuilder(`currency`,e,t)}function setOptions(e,t){let n=asMutableArray(t);Or(e.name??`unknown`,n),e.options=n}function addOption(e,t){e.options||=[],Or(e.name??`unknown`,[...e.options,t]),e.options.push(t)}var StatusAttributeBuilder=class extends BaseAttributeBuilder{options(e){return setOptions(this.attr,e),this.asPhantomState()}option(e){return addOption(this.attr,e),this}};function status(e,t){return new StatusAttributeBuilder(`status`,e,t)}var SelectAttributeBuilder=class extends BaseAttributeBuilder{options(e){return setOptions(this.attr,e),this.asPhantomState()}option(e){return addOption(this.attr,e),this}renderAs(e){return this.attr.renderAs=e,this}};function select(e,t){return new SelectAttributeBuilder(`select`,e,t)}var MultiselectAttributeBuilder=class extends BaseAttributeBuilder{options(e){return setOptions(this.attr,e),this.asPhantomState()}option(e){return addOption(this.attr,e),this}renderAs(e){return this.attr.renderAs=e,this}};function multiselect(e,t){return new MultiselectAttributeBuilder(`multiselect`,e,t)}var LocationAttributeBuilder=class extends BaseAttributeBuilder{granularity(e){return this.attr.granularity=e,this}defaultCountry(e){return this.attr.defaultCountry=e,this}allowedCountries(e){return this.attr.allowedCountries=e,this}};function location(e,t){return new LocationAttributeBuilder(`location`,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}};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(Wn(this.attr))throw Error(`Bilateral relations are not supported for universal relations (.toAny()).`);let n=t[0]?.object;if(!n)throw new L(`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 L(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}},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.attr.required=!0)}maxItems(e){return this.attr.maxItems=e,this}};function relation(e,t){return new SingleRelationAttributeBuilder(e,t)}var FormulaAttributeBuilder=class extends BaseAttributeBuilder{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.`)}};function formula(e,t){return new FormulaAttributeBuilder(`formula`,e,t)}var RollupAttributeBuilder=class extends BaseAttributeBuilder{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 F(`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}").`,I.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.`)}};function rollup(e,t){return new RollupAttributeBuilder(`rollup`,e,t)}var DocumentAttributeBuilder=class extends BaseAttributeBuilder{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}};function document(e,t){return new DocumentAttributeBuilder(`document`,e,t)}const W={owner:`standardshq`,repo:`skills`,ref:`stable`},G=`[A-Za-z0-9._-]+`,Xg=`[A-Za-z0-9_-]+`,Zg=RegExp(`^(${Xg})/(${G})@([a-z0-9-]+)(?:#(${G}))?$`),Qg=RegExp(`^(${Xg})/(${G})$`),$g=/^[0-9a-f]{40}$/i;function isSafeSegment(e){return e!==`.`&&!e.startsWith(`-`)&&!e.includes(`..`)}function refuse$1(e,t){throw new L(`Invalid skill source "${e}": ${t} (expected owner/repo@skill or owner/repo@skill#ref)`,[{path:[`source`],message:t}])}function canonicalRef(e){return $g.test(e)?e.toLowerCase():e}function parseSkillSource(e){let t=e.trim(),n=t.startsWith(`github.com/`)?t.slice(11):t,r=Zg.exec(n);if(!r)return refuse$1(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$1(e,"a segment cannot start with `-`, hold `..` or be `.`")}function isSkillRepository(e){return Qg.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&&$g.test(e.ref)}const K=/^[a-z0-9][a-z0-9-]{0,62}$/,q=`core`;function assertBundleName(e){if(!K.test(e))throw new L(`Invalid bundle name "${e}": expected a lowercase slug matching ${K}`,[]);if(e===`core`)throw new L(`Bundle name "${q}" 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 L(e,[{path:t,message:e}])}}function requireBuilderName(e,t){if(typeof e!=`string`||e.trim().length===0)throw new L(`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 L(`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 L(e,[{path:[...t,n],message:e}])}let n=j.safeParse({...e,name:`content`,placement:e.type===`group`?`grid`:`main`});if(!n.success)throw L.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=g.filter(e=>e>=n&&e<=r);return i.length===0?g.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=/* @__PURE__ */ 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=/* @__PURE__ */ 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&&g.includes(e.w)&&e.x+e.w<=12}function keptStatics(e){let t=[],n=/* @__PURE__ */ 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(!g.includes(t)){let e=`A block spans ${g.join(`, `)} columns, not ${String(t)}`;throw new L(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 L?new L(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 L(`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&&A({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))r===void 0?delete t[n]: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`]),A(this.extension,e.parameters,[`content`,`parameters`]),e}span(e){return spanContent(this,e)}},Measures=class{count(){return this.measured(`count`)}sum(e){return this.measured(`sum`,e)}avg(e){return this.measured(`avg`,e)}min(e){return this.measured(`min`,e)}max(e){return this.measured(`max`,e)}};function measure(e,t,n){return{query:e,measure:t,...n===void 0?{}:{attribute:n}}}var MetricBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}trend(e,t){return this.with({trend:e,trendBucket:t})}compare(e,t){return this.with({compare:e,period:t})}target(e){return this.with({target:e})}},MetricQuery=class extends Measures{constructor(e){super(),this.query=e}measured(e,t){return new MetricBuilder(b,checkInputs(b,measure(this.query,e,t)))}};function groupBy(e){return typeof e==`string`?[e,void 0]:[e.attribute,e.bucket]}var ChartBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}by(e){let[t,n]=groupBy(e);return this.with({by:t,byBucket:n})}by2(e){let[t,n]=groupBy(e);return this.with({by2:t,by2Bucket:n})}kind(e){return this.with({kind:e})}bar(){return this.kind(`bar`)}horizontalBar(){return this.kind(`horizontal_bar`)}line(){return this.kind(`line`)}area(){return this.kind(`area`)}donut(){return this.kind(`donut`)}funnel(){return this.kind(`funnel`)}treemap(){return this.kind(`treemap`)}calendar(){return this.kind(`calendar`)}},ChartQuery=class extends Measures{constructor(e){super(),this.query=e}measured(e,t){return new ChartBuilder(v,checkInputs(v,{...measure(this.query,e,t),kind:`bar`}))}};const e_={"7d":7,"30d":30};var AgendaBuilder=class extends BlockContentBuilder{label(e){return this.with({label:e})}next(e){let t=typeof e==`number`?e:e_[e];if(!Number.isInteger(t)||t<1){let e=`An agenda looks ahead a whole number of days, at least 1`;throw new L(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(d,checkInputs(d,{query:storedQuery(e,`agenda`),attribute:t}))}function card(e){let t=e===void 0||typeof e==`string`?e:e.build().name;return new CardBuilder(_,t===void 0?{}:checkInputs(_,{object:t}))}function text$1(e){return new BlockContentBuilder(C,checkInputs(C,{markdown:e}))}function decisions(){return new DecisionsBuilder(se,{})}function meetingsUpcoming(){return new MeetingsUpcomingBuilder(Ke,{})}function mailbox(){return new MailboxBuilder(Ue,{})}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);else for(let t of g)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 L(t,[{path:e,message:t}])}function traitsOf(e,t=[]){return Gn(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(Ie,r),span:12}}function groupOf(e,t,n){let[r]=e.map(e=>e.name).sort(),i=vn(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`),cr(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 J=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 L.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 J({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 L.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`])),cr(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 M)}function assertPiece(e,t){if(typeof e!=`object`||!e)throw new L(`Unsupported bundle piece: ${t}`,[]);if(isViewPiece(e)||e instanceof M||typeof e.build==`function`)return;let n=e.name;throw new L(`Unsupported bundle piece: ${typeof n==`string`?n:String(t)}`,[])}function declarationOf$1(e){return e instanceof J||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=L.fromZodErrors(t.error.issues.map(e=>({path:e.path.map(String),message:e.message})));throw new L(`View "${n}" is invalid. ${r.message}`,r.errors)}function identityOf(e){return`${e.object??``}:${e.name}`}function assertUniqueIdentities(e,t){let n=/* @__PURE__ */ new Set;for(let r of t){let t=identityOf(r);if(n.has(t))throw new N(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})))}))}const t_={title:120,why:200,prompt:ca};function assertSetupWithinLimits(e){let t=Object.keys(t_).flatMap(t=>{let n=t_[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 L(`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=/* @__PURE__ */ new Set,n=e.flatMap(e=>{let n=skillProblem(e,t);return n===null?[]:[{path:[`skills`],message:n}]});if(n.length>0)throw new L(`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!==W.owner||n.repo!==W.repo?`Skill "${e}" must come from ${W.owner}/${W.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===q;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(D);if(e!==void 0)throw new P(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 n_=Symbol.for(`standards.bundle`);function isBundle(e){return typeof e==`object`&&!!e&&e[n_]===!0}var BundleBuilder=class{constructor(e,t){this[n_]=!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 M)r.push(a.build());else if(isViewPiece(a)){let e=declarationOf$1(a);isPage(e)?n.push(e):t.push(e.definition)}else e.push(a.build());return this.assertNotInUsed(e),builtBundleFromPieces({name:this.name,label:this.label,description:this.descriptionText,objects:e,views:t,pages:n,agents:r,uses:this.used.map(e=>e.name),samples:this.sampleRecords,...this.setupInvitation?{setup:this.setupInvitation}:{},skills:this.skillSources,translations:{...this.translationTables}})}assertNotInUsed(e){let t=/* @__PURE__ */ new Map,n=/* @__PURE__ */ 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 N(`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 r_=R.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=R.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 R.ZodError?Error(`[FormBuilder] ${e.issues[0].message}`):e}}validateRequiredData(){if(this.data.slots.length===0)throw Error(`[FormBuilder] At least one slot is required. Use .slot() to add slots.`);if(this.data.steps.length===0)throw Error(`[FormBuilder] At least one step is required. Use .step() to add steps.`)}validateSlotReferences(){let e=new Map(this.data.slots.map(e=>[e.id,e.objectName]));for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n))for(let r of n.fields){if(r.type!==`slot`)continue;let n=getSlotFieldTargets(r);for(let r of n)if(!e.has(r))throw Error(`[FormBuilder] Step "${t.id}" references unknown slot "${r}". Declare it with .slot("${r}", ...) first.`);let i=new Set(n.map(t=>e.get(t)));if(i.size>1)throw Error(`[FormBuilder] Step "${t.id}" field on attribute "${r.attribute}" targets slots of different objects (${[...i].join(`, `)}). A multi-slot field must target slots of the same object.`)}}validatePrefillExpressions(){let e=[...V,`join`,`where`];for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n))for(let r of n.fields){if(!isFormFreeFieldRef(r)||!r.prefillExpression)continue;let n=r.prefillExpression,i=`prefillExpression on free field "${r.attribute.name}" in step "${t.id}"`;if(!isLabelExpression(n))throw Error(`[FormBuilder] ${i} must contain at least one {{ attribute }} interpolation.`);if(/\{\{\s*\}\}/.test(n))throw Error(`[FormBuilder] ${i} contains empty {{ }} interpolation.`);for(let a of n.matchAll(/(?<!\|)\|(?!\|)\s*(\w+)(?:\s*:[^|}]*)?/g)){let n=a[1];if(!e.includes(n))throw Error(`[FormBuilder] ${i} uses invalid pipe "${n}". Valid pipes: ${e.join(`, `)}`);let o=a[0].replace(/^\|/,``);if(isWherePipe(o)&&!parseWherePipe(o))throw new L(`[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(r_.safeParse(n.readOnly).success)continue;let t=isFormFreeFieldRef(n)?n.attribute.name:n.attribute,r=isFormFreeFieldRef(n)?`free field`:`field`;throw new L(`[FormBuilder] readOnly on ${r} "${t}" in step "${e.id}" must be a boolean.`,[{path:[e.id,t,`readOnly`],message:`Expected a boolean`}])}}validateFreeFields(){let e=new Set(z);for(let t of this.data.steps)for(let n of t.rows)if(isFormFieldsRow(n)){for(let r of n.fields)if(isFormFreeFieldRef(r)){let n=r.attribute.type;if(e.has(n))throw Error(`[FormBuilder] Free field in step "${t.id}" uses forbidden attribute type "${n}". Forbidden types: ${z.join(`, `)}`)}}}};function form(e,t){return new FormBuilder(e,t)}const i_=R.object({shape:R.enum(Uo),from:R.array(R.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 L(`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=/* @__PURE__ */ 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 F(`Object "${t}" must have a labelExpression. The labelExpression defines how records are displayed in lists and relations (e.g. "{{ name }}").`,I.VALIDATION_FAILED);let i=H.safeParse(n);if(!i.success){let e=i.error.issues[0]?.message??`Invalid labelExpression`;throw new F(`Invalid labelExpression for "${t}": ${e}`,I.VALIDATION_FAILED)}if(r!==void 0){let e=H.safeParse(r);if(!e.success){let n=e.error.issues[0]?.message??`Invalid embeddingExpression`;throw new F(`Invalid embeddingExpression for "${t}": ${n}`,I.VALIDATION_FAILED)}}}var ObjectBuilder=class{get"~standard"(){return createStandardSchemaProps(Vr(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);ht([...this.obj.attributes,...t],e=>e.name,e=>new N(`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 L(`[ObjectBuilder] Missing required field: name`,[{path:[`name`],message:`name is required`}]);if(!this.obj.label)throw new L(`[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&&Dr(e)}};function object(e,t){if(D(e))throw new P(e,`builder`);return new ObjectBuilder(e,t)}function validatePresetStructure(e,t,n){let fail=(t,n)=>{throw new L(t,[{path:[`documentLayout`,`presets`,e],message:n}])};n>5&&fail(`Preset structure exceeds max depth of 5`,`Preset structure too deep`);let r=/* @__PURE__ */ 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`&&A(this.extension,e.parameters,[`content`,`parameters`]),e}},a_=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 L?new L(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 a_(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 L(`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 L(`Expected custom content`,[]);let r=new X({...n,extension:e.name},e);return r.build(),r}function recordLinksTab(){return[x.name,x.label,custom(tt,{}).icon(x.icon)]}function page$1(e){let{object:t,name:n}=e.definition;if(typeof t!=`string`){let e=`Page "${n}" is standalone; a record tab renders a record page (\`page(...).for(object)\`)`;throw new L(e,[{path:[`content`,`page`,`object`],message:e}])}return new X({type:`page`,page:{object:t,name:n}})}const o_={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=/* @__PURE__ */ new Set;if(e.length<=S.tabsPerView)return n;let r=new Map(e.map(e=>[e.name,e])),i=/* @__PURE__ */ 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<=S.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=k(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??$n(s,w),l=yn([...s.values()]),u=o.filter(e=>!l.has(e.name)),d={},f=[],place=(e,t)=>{t&&!Object.values(d).some(e=>Qn(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=k(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]}let Z;function unaccentRules(){if(Z)return Z;let e=/* @__PURE__ */ new Map;for(let t of`
|
|
3
3
|
¡!
|
|
4
4
|
©(C)
|
|
5
5
|
«<<
|