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