@stndrds/schema 1.0.0-alpha.321 → 1.0.0-alpha.323

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.
@@ -1,2 +1,2 @@
1
1
  'use strict';var chunk2M4YXNYZ_js=require('./chunk-2M4YXNYZ.js'),chunkJSKLP4GI_js=require('./chunk-JSKLP4GI.js'),chunkDPD6ZWL2_js=require('./chunk-DPD6ZWL2.js'),zod=require('zod');/*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
- var Se={createdAt:"createdAt",updatedAt:"updatedAt",createdBy:"createdBy",lastUpdatedBy:"lastUpdatedBy",attachments:"attachments"};function Nt(e){return Se[e]}chunkDPD6ZWL2_js.a(Nt,"getSystemAttributeI18nKey");var Re={createdAt:{id:"system:createdAt",name:"createdAt",label:"Created time",type:"date",required:false,system:true,icon:"clock-circle",description:"When this record was created"},updatedAt:{id:"system:updatedAt",name:"updatedAt",label:"Last edited time",type:"date",required:false,system:true,icon:"clock-circle",description:"When this record was last modified"},createdBy:{id:"system:createdBy",name:"createdBy",label:"Created by",type:"user",required:false,system:true,multiple:false,icon:"user",description:"Actor who created this record"},lastUpdatedBy:{id:"system:lastUpdatedBy",name:"lastUpdatedBy",label:"Last edited by",type:"user",required:false,system:true,multiple:false,icon:"user",description:"Actor who last modified this record"},attachments:{id:"system:attachments",name:"attachments",label:"Attachments",type:"document",required:false,system:true,hidden:true,icon:"paperclip",description:"Free-form document attachments"}};function qt(){return Object.values(Re)}chunkDPD6ZWL2_js.a(qt,"getSystemAttributeList");function $(e){return e.id?.startsWith("system:")??false}chunkDPD6ZWL2_js.a($,"isManagedSystemAttribute");var K=["is","is_not","contains","not_contains","starts_with","ends_with","is_empty","is_not_empty"],Y=["is","is_not","less_than","greater_than","less_or_equal","greater_or_equal","is_empty","is_not_empty"],Oe=["is"],Te=["is","is_not","less_than","greater_than","less_or_equal","greater_or_equal","is_within","on_day_month","is_empty","is_not_empty"],z=["is","is_not","any_of","none_of","is_empty","is_not_empty"],Ee=["any_of","none_of","is_empty","is_not_empty"],W=["is","is_not","any_of","none_of","is_empty","is_not_empty"],xe=["is_empty","is_not_empty"],Fe=["is","is_not","less_than","greater_than","less_or_equal","greater_or_equal","contains","not_contains","is_empty","is_not_empty"],x=["city","postalCode","country"];function F(e){return x.includes(e)}chunkDPD6ZWL2_js.a(F,"isLocationFilterProperty");function Yt(e){return K.includes(e)}chunkDPD6ZWL2_js.a(Yt,"isLocationPartOperator");var y={text:K,richtext:[],number:Y,checkbox:Oe,date:Te,phone:["is","is_not","contains","not_contains","starts_with","is_empty","is_not_empty"],currency:Y,status:z,select:z,multiselect:Ee,location:[],user:W,relation:W,formula:Fe,document:xe},we=new Set(["formula","rollup"]),Ce=new Set(["user","relation","document"]),Pe=new Set(["text","richtext","number","select","multiselect","status","date","phone","currency","location","user","relation","document"]),ve=new Set(["text","number","date","phone","currency","select","multiselect"]),De=new Set(["text","phone","status","select","multiselect"]),Ie=new Set(["text","number","checkbox","date","phone","currency","status","select"]);function g(e){let r=!!(e.hidden||e.archived),o=!e.archived,i=we.has(e.type),a=e.type==="document",s=Ce.has(e.type),l=ke(e),c=r?[]:Ve(e),u=c.length>0&&!r,h=!r&&De.has(e.type),_=!r&&Ie.has(e.type),A=!r&&Ye(e.type),T=!r&&e.type==="status",_e=$(e),M=i||a||_e,E=!(r||M),ge=Ne(e.type)?"forbidden":"allowed",Ae=qe(e.type),L=Me(e),N=ve.has(e.type),q=!!(e.deprecated&&!r),B=$e(e);return {lifecycle:{active:o,deprecated:!!e.deprecated,visibleInArchitect:true,visibleInRuntime:!r,warningWhenDeprecated:q},storage:{mode:i?"computed":s?"edge":"value",cardinality:l,edgeBacked:s,preservesExistingValues:!!e.archived,qualifiedProperties:Le(e.type),polymorphic:je(e),maxItems:L},authoring:{editable:E,readOnly:M,directEdit:E&&B==="inline",required:ge,defaultValue:Ae,placeholder:N,maxItems:L},presentation:{formField:!r&&Ue(e.type),tableCell:!r&&G(e.type),defaultColumn:!r&&Be(e.type),compactDisplay:!r,popoverEditor:!r&&B==="popover",placeholder:N,warningWhenDeprecated:q},query:{filterable:u,searchable:h,sortable:_,groupable:A,kanbanGroupable:T,operators:c},agent:{readable:!r,writable:E&&!a,compactReadable:!r,contentReadable:!r&&ze(e.type),requiresDedicatedTool:a},exchange:{importable:!r,exportable:!r,schemaExportable:true,metadataExportable:false}}}chunkDPD6ZWL2_js.a(g,"getAttributeCapabilities");function J(e){return g(e).query.operators}chunkDPD6ZWL2_js.a(J,"getAttributeFilterOperators");function zt(e){return g(e).query.filterable}chunkDPD6ZWL2_js.a(zt,"isAttributeFilterable");function Wt(e){return g(e).query.searchable}chunkDPD6ZWL2_js.a(Wt,"isAttributeSearchable");function Kt(e){return g(e).query.sortable}chunkDPD6ZWL2_js.a(Kt,"isAttributeSortable");function Jt(e){return g(e).query.groupable}chunkDPD6ZWL2_js.a(Jt,"isAttributeGroupable");function Gt(e){return g(e).query.kanbanGroupable}chunkDPD6ZWL2_js.a(Gt,"isAttributeKanbanGroupable");function w(e){if(e.type!=="rollup")return e.type;let r=e;if(r.function==="earliest"||r.function==="latest")return "date";if(r.function==="original"){let o=r.targetAttributeType;if(o&&Q(o))return o}return "number"}chunkDPD6ZWL2_js.a(w,"resolveEffectiveFilterType");function C(e){let r=w(e);return Q(r)?y[r]:y.number}chunkDPD6ZWL2_js.a(C,"getRollupFilterOperators");function Ve(e){return e.type==="rollup"?C(e):y[e.type]??[]}chunkDPD6ZWL2_js.a(Ve,"getRawFilterOperators");function ke(e){return e.type==="multiselect"||e.type==="document"||e.type==="user"&&e.multiple===true||e.type==="relation"&&e.cardinality==="many"?"many":"one"}chunkDPD6ZWL2_js.a(ke,"getAttributeCardinality");function je(e){if(e.type!=="relation")return "none";let o=e.targets??[];return o.length===1&&o[0]?.object==="*"?"internal":o.length>1?"code-only":"none"}chunkDPD6ZWL2_js.a(je,"getPolymorphicCapability");function Me(e){return e.type==="multiselect"?true:e.type==="relation"?e.cardinality==="many":false}chunkDPD6ZWL2_js.a(Me,"supportsMaxItems");function Le(e){return e==="relation"||e==="document"}chunkDPD6ZWL2_js.a(Le,"supportsQualifiedProperties");function Ne(e){return e==="checkbox"||e==="formula"||e==="rollup"}chunkDPD6ZWL2_js.a(Ne,"isRequiredForbidden");function qe(e){return e==="checkbox"?"automatic":e==="formula"||e==="rollup"?"forbidden":Pe.has(e)?"static":"forbidden"}chunkDPD6ZWL2_js.a(qe,"getDefaultValueCapability");function Be(e){return G(e)}chunkDPD6ZWL2_js.a(Be,"isDefaultColumnType");function G(e){return e!=="richtext"&&e!=="document"}chunkDPD6ZWL2_js.a(G,"isTableCellType");function Ue(e){return e!=="richtext"}chunkDPD6ZWL2_js.a(Ue,"isFormFieldType");function $e(e){switch(e.type){case "checkbox":return "inline";case "number":return e.renderAs==="rating"?"inline":"default";case "select":case "multiselect":return e.renderAs==="badges"?"inline":"popover";case "status":case "relation":case "user":case "date":return "popover";default:return "default"}}chunkDPD6ZWL2_js.a($e,"resolveEditMode");function Ye(e){return e==="status"||e==="currency"}chunkDPD6ZWL2_js.a(Ye,"isGroupableType");function ze(e){return e==="richtext"||e==="document"}chunkDPD6ZWL2_js.a(ze,"isContentReadableType");function Q(e){return Object.prototype.hasOwnProperty.call(y,e)}chunkDPD6ZWL2_js.a(Q,"hasFilterOperatorEntry");var f=y,We=["is_empty","is_not_empty"];function H(e){return We.includes(e)}chunkDPD6ZWL2_js.a(H,"isNoValueOperator");function Zt(e){return C(e)}chunkDPD6ZWL2_js.a(Zt,"getRollupFilterOperators");function R(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&"dynamic"in e}chunkDPD6ZWL2_js.a(R,"isDynamicValue");function rr(){return {dynamic:"actor",ref:"current"}}chunkDPD6ZWL2_js.a(rr,"currentActor");function or(){return {dynamic:"date",anchor:"today"}}chunkDPD6ZWL2_js.a(or,"today");function nr(){return {dynamic:"date",anchor:"now"}}chunkDPD6ZWL2_js.a(nr,"now");function X(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let r=Number(e);return Number.isFinite(r)?r:null}return null}chunkDPD6ZWL2_js.a(X,"toAmount");function Z(e){return e!==null&&typeof e=="object"?"value"in e?X(e.value):null:X(e)}chunkDPD6ZWL2_js.a(Z,"extractCurrencyFilterValue");function sr(e){return e==null?null:typeof e=="object"&&"value"in e?e.value??null:e}chunkDPD6ZWL2_js.a(sr,"extractFilterValue");var Ke=new Set(["is_not","not_contains","none_of","is_empty"]),Je={is_not:"is",not_contains:"contains",none_of:"any_of",is_empty:"is_not_empty"};function ur(e){return Ke.has(e)?"none":"any"}chunkDPD6ZWL2_js.a(ur,"getOperatorPolarity");function pr(e){return Je[e]??e}chunkDPD6ZWL2_js.a(pr,"normalizeForEdgeRpc");var ee={is:"any_of",is_not:"none_of"};function dr(e){return ee[e]??e}chunkDPD6ZWL2_js.a(dr,"toMultiValueOperator");var Ge=new Set(Object.values(ee).filter(e=>e!==void 0));function te(e){return Ge.has(e)}chunkDPD6ZWL2_js.a(te,"isSetMembershipOperator");function re(e,r){let o=e.value;if(H(e.operator)||o==null||R(o))return;if(te(e.operator)){Array.isArray(o)||(e.value=[o]);return}if(r!=="currency")return;let i=Z(o);if(i!==null){e.value=i;return}if(!Qe(o))return;let a=`Filter on a currency attribute expected a numeric amount, received ${JSON.stringify(o)}`;throw new chunkJSKLP4GI_js.h(a,[{path:["value"],message:a}])}chunkDPD6ZWL2_js.a(re,"canonicalizeFilterValue");function Qe(e){return typeof e!="object"?true:"value"in e?e.value!=null:false}chunkDPD6ZWL2_js.a(Qe,"hasCurrencyAmount");var He={eq:"is",equals:"is",equal:"is","==":"is","=":"is",neq:"is_not",notEqual:"is_not",isNot:"is_not","!=":"is_not","<>":"is_not",lt:"less_than","<":"less_than",gt:"greater_than",">":"greater_than",lte:"less_or_equal","<=":"less_or_equal",gte:"greater_or_equal",">=":"greater_or_equal",in:"any_of",isAnyOf:"any_of",anyOf:"any_of",oneOf:"any_of",notIn:"none_of",not_in:"none_of",isNoneOf:"none_of",noneOf:"none_of",notOneOf:"none_of",startsWith:"starts_with",beginsWith:"starts_with",endsWith:"ends_with",doesNotContain:"not_contains",notContain:"not_contains",isEmpty:"is_empty",isNotEmpty:"is_not_empty"};function P(e){return He[e]??e}chunkDPD6ZWL2_js.a(P,"normalizeOperator");function Rr(e){let r=P(e.operator);return r===e.operator?e:{...e,operator:r}}chunkDPD6ZWL2_js.a(Rr,"normalizeFilterRule");var Xe=new Set(["days","weeks","months","years"]),Ze=new Set(["past","future"]);function v(e){if(typeof e!="object"||e===null)return false;let r=e;return typeof r.amount=="number"&&Number.isFinite(r.amount)&&r.amount>0&&typeof r.unit=="string"&&Xe.has(r.unit)&&typeof r.direction=="string"&&Ze.has(r.direction)}chunkDPD6ZWL2_js.a(v,"isRelativeDateValue");function ne(e){return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}chunkDPD6ZWL2_js.a(ne,"utcDayStart");function oe(e,r,o){if(o==="days")return e+r*864e5;if(o==="weeks")return e+r*7*864e5;let i=new Date(e),a=i.getUTCFullYear()+(o==="years"?r:0),s=i.getUTCMonth()+(o==="months"?r:0),l=new Date(Date.UTC(a,s+1,0)).getUTCDate();return Date.UTC(a,s,Math.min(i.getUTCDate(),l))}chunkDPD6ZWL2_js.a(oe,"shiftUtcDay");function Er(e,r=new Date){if(!v(e))return null;let o=ne(r),i=Math.trunc(e.amount),a=e.direction==="past"?{startMs:oe(o,-i,e.unit),endMs:o+864e5}:{startMs:o,endMs:oe(o,i,e.unit)+864e5};return Number.isFinite(a.startMs)&&Number.isFinite(a.endMs)?a:null}chunkDPD6ZWL2_js.a(Er,"resolveIsWithinBounds");function xr(e){if(!Number.isFinite(e))return null;let r=ne(new Date(e));return Number.isFinite(r)?{startMs:r,endMs:r+864e5}:null}chunkDPD6ZWL2_js.a(xr,"resolveUtcDayBounds");function Fr(e){return new Date(e).toISOString().slice(0,10)}chunkDPD6ZWL2_js.a(Fr,"toUtcDayString");var et=new Set(["relation","document","user"]),D=["is","is_not","any_of","none_of","is_empty","is_not_empty"],tt={id:D,objectId:D,tenantId:D,label:f.text,createdAt:f.date,updatedAt:f.date,deletedAt:f.date,createdBy:f.user,lastUpdatedBy:f.user},rt={id:"text",objectId:"text",objectName:"text",tenantId:"text",label:"text",createdAt:"date",updatedAt:"date",deletedAt:"date",deletedBy:"user",createdBy:"user",lastUpdatedBy:"user",visibility:"select",ownedBy:"user"},k={before:'"less_than"',after:'"greater_than"',on_or_before:'"less_or_equal"',on_or_after:'"greater_or_equal"',is_checked:'"is" with value true',is_not_checked:'"is" with value false',day_month_eq:'"on_day_month"'},ot=new Set(Object.entries(y).filter(([,e])=>e.includes("any_of")&&!e.includes("contains")).map(([e])=>e)),nt={contains:"any_of",not_contains:"none_of"};function I(e,r){let o=k[e];if(o){let s=`Unknown filter operator "${e}" \u2014 use ${o}`;throw new chunkJSKLP4GI_js.h(s,[{path:["operator"],message:s}])}let i=P(e),a=nt[i];if(a&&ot.has(r)){let s=`Operator "${i}" is not valid for type "${r}" \u2014 use "${a}"`;throw new chunkJSKLP4GI_js.h(s,[{path:["operator"],message:s}])}return i}chunkDPD6ZWL2_js.a(I,"resolveCanonicalOperator");function ie(e,r,o){let i=I(e,r),a=f[r];if(!a?.includes(i)){let s=a?.length?a.join(", "):"(no operators registered for this type)",l=`Operator "${e}" is not valid for ${o} type "${r}". Valid operators: ${s}.`;throw new chunkJSKLP4GI_js.h(l,[{path:["operator"],message:l}])}return i}chunkDPD6ZWL2_js.a(ie,"assertOperatorForType");function it(e){if(e.operator==="is_within"&&!v(e.value)){let r='Operator "is_within" requires a relative-date value { amount: positive number, unit: days|weeks|months|years, direction: past|future }';throw new chunkJSKLP4GI_js.h(r,[{path:["value"],message:r}])}}chunkDPD6ZWL2_js.a(it,"assertRelativeDateValue");function O(e,r,o){e.operator=r,re(e,o),it(e);}chunkDPD6ZWL2_js.a(O,"applyCanonicalForm");function ae(e,r){if(!R(e.value))return;let o=e.value;if(o.dynamic==="actor"&&r!=="user"){let i=`actor token (@me) is only valid on user attributes, not "${r}"`;throw new chunkJSKLP4GI_js.h(i,[{path:["value"],message:i}])}if(o.dynamic==="date"&&r!=="date"){let i=`date token (@today/@now) is only valid on date attributes, not "${r}"`;throw new chunkJSKLP4GI_js.h(i,[{path:["value"],message:i}])}}chunkDPD6ZWL2_js.a(ae,"assertDynamicValueForAttribute");var V=x.map(e=>`"${e}"`).join(", ");function at(e){return e==="location"?` A location is filtered on one of its parts: set "property" to one of ${V} and use a text operator (e.g. contains).`:""}chunkDPD6ZWL2_js.a(at,"locationPartsHint");function Mr(e,r){try{return st({...e},r),[]}catch(o){if(!(o instanceof chunkJSKLP4GI_js.h))throw o;return o.errors.map(i=>({...i,path:[...i.path]}))}}chunkDPD6ZWL2_js.a(Mr,"collectQualifiedRuleIssues");function st(e,r){let o=r.attributes.find(c=>c.name===e.attribute),i=tt[e.attribute];if(!(o||i)){let[c,...u]=e.attribute.split("."),_=(u.length>0?r.attributes.find(T=>T.name===c):void 0)?.type==="location"?` Dotted paths are not supported \u2014 set "attribute" to "${c}" and "property" to ${F(u[0]??"")?`"${u[0]}"`:`one of ${V}`}.`:e.attribute.includes(".")?' Dotted paths are not supported \u2014 filter on the attribute name alone, or use the full-text "query" parameter to match text inside a value.':"",A=`Unknown attribute: ${e.attribute}${_}`;throw new chunkJSKLP4GI_js.h(A,[{path:["attribute"],message:A}])}if(e.quantifier!==void 0&&!e.property){let c='quantifier is only valid on qualified edge rules (set "property")';throw new chunkJSKLP4GI_js.h(c,[{path:["quantifier"],message:c}])}if(!o){if(e.property)throw new chunkJSKLP4GI_js.h(`Cannot qualify system attribute "${e.attribute}"`,[{path:["property"],message:`"${e.attribute}" is a system column, not a reference`}]);let c=rt[e.attribute]??"text",u=I(e.operator,c);if(!i.includes(u)){let h=`Operator "${e.operator}" is not valid for system attribute "${e.attribute}". Valid operators: ${i.join(", ")}.`;throw new chunkJSKLP4GI_js.h(h,[{path:["operator"],message:h}])}O(e,u,c);return}if(!e.property){ae(e,o.type);let c=J(o),u=I(e.operator,o.type);if(!c.includes(u)){let h=c.length?c.join(", "):"(not filterable)",_=`Operator "${e.operator}" is not valid for attribute "${o.name}". Valid operators: ${h}.${at(o.type)}`;throw new chunkJSKLP4GI_js.h(_,[{path:["operator"],message:_}])}O(e,u,w(o));return}if(o.type==="location"){if(e.quantifier!==void 0){let u="quantifier is not valid on a location part \u2014 a location is one value, not a set of edges";throw new chunkJSKLP4GI_js.h(u,[{path:["quantifier"],message:u}])}if(!F(e.property)){let u=`Property "${e.property}" is not a part of location "${e.attribute}". Valid parts: ${V}.`;throw new chunkJSKLP4GI_js.h(u,[{path:["property"],message:u}])}ae(e,"text");let c=ie(e.operator,"text","property");O(e,c,"text");return}if(!et.has(o.type))throw new chunkJSKLP4GI_js.h(`Cannot qualify ${o.type} attribute "${e.attribute}"`,[{path:["property"],message:`Attribute "${e.attribute}" is not a reference type`}]);let a=o.properties;if(!a)throw new chunkJSKLP4GI_js.h(`Attribute "${e.attribute}" has no qualifyWith schema`,[{path:["property"],message:`"${e.attribute}" has no qualifyWith`}]);let s=a.definitions.find(c=>c.name===e.property);if(!s)throw new chunkJSKLP4GI_js.h(`Property "${e.property}" not defined on "${e.attribute}".qualifyWith()`,[{path:["property"],message:`Unknown property: ${e.property}`}]);let l=ie(e.operator,s.type,"property");O(e,l,s.type);}chunkDPD6ZWL2_js.a(st,"validateQualifiedRule");var se=64,le=1e4;function ce(e){let r=Object.getPrototypeOf(e);return r===Object.prototype||r===null}chunkDPD6ZWL2_js.a(ce,"isPlainJsonObject");function m(e,r,o=[]){e.addIssue({code:"custom",message:r,path:o});}chunkDPD6ZWL2_js.a(m,"addJsonIssue");function ct(e,r,o,i){for(let a of Reflect.ownKeys(e))if(a!=="length"){if(a==="__proto__"){m(i,"The __proto__ key is not allowed in custom props",[...r.path,a]);continue}(typeof a=="symbol"||!/^(0|[1-9]\d*)$/.test(a))&&m(i,"Arrays cannot contain non-index JSON properties",[...r.path,a]);}for(let a=e.length-1;a>=0;a--){let s=Object.getOwnPropertyDescriptor(e,String(a)),l=[...r.path,a];if(!(s&&"value"in s)){m(i,"Sparse arrays are not valid JSON values",l);continue}o.push({kind:"enter",value:s.value,path:l,depth:r.depth+1});}}chunkDPD6ZWL2_js.a(ct,"pushJsonArrayChildren");function ut(e,r,o,i){let a=Reflect.ownKeys(e);for(let s=a.length-1;s>=0;s--){let l=a[s],c=[...r.path,l];if(l==="__proto__"){m(i,"The __proto__ key is not allowed in custom props",c);continue}if(typeof l=="symbol"){m(i,"Symbol keys are not valid JSON keys",c);continue}let u=Object.getOwnPropertyDescriptor(e,l);if(!(u?.enumerable&&"value"in u)){m(i,"Custom props must contain enumerable data properties only",c);continue}o.push({kind:"enter",value:u.value,path:c,depth:r.depth+1});}}chunkDPD6ZWL2_js.a(ut,"pushJsonObjectChildren");function pt(e,r){if(e===null||typeof e!="object"){m(r,"Expected a plain JSON object");return}try{if(Array.isArray(e)||!ce(e)){m(r,"Expected a plain JSON object");return}}catch{m(r,"Custom props contain an object that cannot be safely inspected");return}let o=new WeakSet,i=[{kind:"enter",value:e,path:[],depth:0}],a=0;for(;i.length>0;){let s=i.pop();if(!s)break;if(s.kind==="exit"){o.delete(s.value);continue}if(a++,a>le){m(r,`Custom props cannot exceed ${le.toLocaleString("en-US")} total JSON nodes`,s.path);return}if(s.depth>se){m(r,`Custom props cannot exceed depth ${se}`,s.path);continue}let l=s.value;if(!(l===null||typeof l=="string"||typeof l=="boolean"||typeof l=="number"&&Number.isFinite(l))){if(typeof l!="object"){m(r,"Expected a JSON value",s.path);continue}if(o.has(l)){m(r,"Custom props cannot contain circular references",s.path);continue}try{if(Array.isArray(l)){o.add(l),i.push({kind:"exit",value:l}),ct(l,s,i,r);continue}if(!ce(l)){m(r,"Expected an array or plain JSON object",s.path);continue}o.add(l),i.push({kind:"exit",value:l}),ut(l,s,i,r);}catch{m(r,"Custom props contain an object that cannot be safely inspected",s.path);}}}}chunkDPD6ZWL2_js.a(pt,"validateJsonProps");var ue=zod.z.unknown().superRefine(pt).transform(e=>e);var Gr=zod.z.array(zod.z.string()).max(chunk2M4YXNYZ_js.r.columnsPerTab),dt=zod.z.array(zod.z.string().min(1)).max(chunk2M4YXNYZ_js.r.columnsPerTab).refine(e=>new Set(e).size===e.length,{message:"Displayed attribute names must be unique"}),mt=zod.z.object({attribute:zod.z.string().describe("Attribute to sort by"),direction:zod.z.enum(["asc","desc"]).describe("asc or desc")}).strict(),bt=zod.z.array(mt).max(chunk2M4YXNYZ_js.r.sortsPerTab),yt=zod.z.object({amount:zod.z.number().describe("Count"),unit:zod.z.enum(["days","weeks","months","years"]).describe("Unit"),direction:zod.z.enum(["past","future"]).describe("Past or future")}).strict(),ft=zod.z.object({value:zod.z.number().nullable().describe("Amount"),code:zod.z.array(zod.z.string()).optional().describe("Currency codes")}).strict(),ht=zod.z.object({phoneNumber:zod.z.string().nullable().describe("Number"),countryCode:zod.z.string().optional().describe("ISO country code")}).strict(),_t=zod.z.discriminatedUnion("dynamic",[zod.z.object({dynamic:zod.z.literal("actor").describe("Resolved at filter time"),ref:zod.z.literal("current").describe("The current actor")}).strict(),zod.z.object({dynamic:zod.z.literal("date").describe("Resolved at filter time"),anchor:zod.z.enum(["today","now"]).describe("Anchor")}).strict()]),gt=zod.z.object({month:zod.z.number().describe("1-12"),day:zod.z.number().describe("Day")}).strict(),At=zod.z.union([zod.z.string(),zod.z.number(),zod.z.boolean(),zod.z.array(zod.z.string()),yt,ft,ht,gt,_t,zod.z.null()]),St=zod.z.enum(["is","is_not","contains","not_contains","starts_with","ends_with","is_empty","is_not_empty","less_than","greater_than","less_or_equal","greater_or_equal","is_within","on_day_month","any_of","none_of"],{error:chunkDPD6ZWL2_js.a(e=>{let r=e.input,o=typeof r=="string"?k[r]:void 0;return o?`Unknown filter operator "${r}" \u2014 use ${o}`:void 0},"error")}),Rt=zod.z.object({attribute:zod.z.string().describe("Attribute to filter on"),property:zod.z.string().optional().describe("Qualified edge property"),quantifier:zod.z.enum(["any","none"]).optional().describe("For a multi-value attribute"),operator:St.describe("Comparison"),value:At.describe("Comparison value, by attribute type")}).strict(),Ot=zod.z.array(Rt).max(chunk2M4YXNYZ_js.r.filterRulesPerTab),Tt=zod.z.object({combinator:zod.z.enum(["and","or"]).describe("Match every rule or any rule"),rules:Ot.describe("The rules")}).strict(),Et={span:zod.z.union([zod.z.literal(1),zod.z.literal(2),zod.z.literal(3),zod.z.literal(4),zod.z.literal(5),zod.z.literal(6),zod.z.literal(7),zod.z.literal(8),zod.z.literal(9),zod.z.literal(10),zod.z.literal(11),zod.z.literal(12)]).optional().describe("Columns of 12 this field occupies"),label:zod.z.string().optional().describe("Overrides the attribute's label"),readOnly:zod.z.boolean().optional().describe("Shows the value, not editable")},xt=zod.z.object({attribute:zod.z.string().describe("Attribute API name shown by this field"),...Et}).strict(),Ft=zod.z.object({name:zod.z.string().describe("Group API name, unique in the form"),label:zod.z.string().describe("Label people see"),description:zod.z.string().optional().describe("Extra context under the label"),collapsible:zod.z.boolean().optional().describe("Whether the group can be collapsed"),collapsed:zod.z.boolean().optional().describe("Whether the group starts collapsed"),fields:zod.z.array(xt).max(chunk2M4YXNYZ_js.r.fieldsPerGroup).describe("Fields in this group, in order")}).strict();function pe(e,r){e.groups.reduce((s,l)=>s+l.fields.length,0)>chunk2M4YXNYZ_js.r.fieldsPerFormTab&&r.addIssue({code:"too_big",origin:"array",maximum:chunk2M4YXNYZ_js.r.fieldsPerFormTab,inclusive:true,message:`A form content can contain at most ${chunk2M4YXNYZ_js.r.fieldsPerFormTab} fields`,path:["groups"]});let i=new Set,a=new Set;e.groups.forEach((s,l)=>{i.has(s.name)&&r.addIssue({code:"custom",message:`Duplicate group name "${s.name}"`,path:["groups",l,"name"]}),i.add(s.name),s.fields.forEach((c,u)=>{a.has(c.attribute)&&r.addIssue({code:"custom",message:`Duplicate field attribute "${c.attribute}"`,path:["groups",l,"fields",u,"attribute"]}),a.add(c.attribute);});});}chunkDPD6ZWL2_js.a(pe,"refineFormContent");var b={name:zod.z.string().describe("Content API name, unique in the view"),label:zod.z.string().optional().describe("Label people see"),icon:chunk2M4YXNYZ_js.t.optional().describe("Icon name"),placement:zod.z.enum(["main","aside"]).describe("main: any tabs. aside: at most one, a form")},de=zod.z.object({object:zod.z.string().optional().describe("Every record of this object"),relation:zod.z.string().optional().describe("Records linked through this relation")}).strict().superRefine((e,r)=>{e.object===void 0&&e.relation===void 0&&r.addIssue({code:"custom",message:"Collection source must define an object, a relation, or both"});}).transform(e=>e.relation===void 0?{object:e.object}:e.object===void 0?{relation:e.relation}:{object:e.object,relation:e.relation}),wt={...b,type:zod.z.literal("collection"),source:de.describe("object: every record; relation: records linked to this record; both: records of object whose relation points at this record"),visibility:zod.z.enum(chunk2M4YXNYZ_js.d).optional().describe("all: no scope; workspace: every member; private: viewer's own"),columns:zod.z.array(zod.z.union([zod.z.string(),zod.z.object({relationProperty:zod.z.string().refine(e=>e.trim().length>0).describe("Qualified edge property shown as a column")}).strict()])).max(chunk2M4YXNYZ_js.r.columnsPerTab).optional().describe("Table columns, in order"),descriptionAttribute:zod.z.string().optional().describe("Secondary line under each row's title (list layout)"),displayAttributes:dt.optional().describe("Attributes shown on each card"),filters:Tt.optional().describe("Restricts which records show"),sorts:bt.optional().describe("Sort order"),actions:zod.z.enum(["create","update","delete","attach","detach"]).array().optional().describe("Offered actions; absent = every action, [] = none"),openMode:zod.z.enum(["page","peek"]).optional().describe("page or peek (the record panel)"),createMode:zod.z.enum(["page","peek","inline"]).optional().describe("page, peek, or inline (creates without opening)")},Ct=zod.z.object({...wt,layout:zod.z.enum(["table","list","kanban"]).describe("table columns, list cards, kanban board grouped by a select/status attribute"),columnSizing:zod.z.record(zod.z.string(),zod.z.number()).optional().describe("Column widths in pixels, by attribute name"),groupByAttribute:zod.z.string().optional().describe("Kanban only: the select or status attribute that names the columns"),kanbanColumnOrder:zod.z.array(zod.z.string()).optional().describe("Kanban: column order by option value"),kanbanColumnVisibility:zod.z.record(zod.z.string(),zod.z.boolean()).optional().describe("Kanban: which columns are shown"),kanbanPinnedColumns:zod.z.array(zod.z.string()).optional().describe("Kanban: columns pinned first")}).strict().superRefine((e,r)=>{let o=["groupByAttribute","kanbanColumnOrder","kanbanColumnVisibility","kanbanPinnedColumns"];if(e.layout==="kanban"){e.groupByAttribute===void 0&&r.addIssue({code:"custom",path:["groupByAttribute"],message:"A kanban layout requires groupByAttribute"});return}for(let i of o)e[i]!==void 0&&r.addIssue({code:"custom",path:[i],message:"Only a kanban layout groups by an attribute"});}),j={...b,type:zod.z.literal("form"),groups:zod.z.array(Ft).max(chunk2M4YXNYZ_js.r.groupsPerFormTab).describe("Field groups, in order"),formColumns:zod.z.union([zod.z.literal(1),zod.z.literal(2),zod.z.literal(3)]).optional().describe("Grid columns, 1-3"),density:zod.z.enum(["compact","comfortable","spacious"]).optional().describe("Vertical spacing between fields")},Pt=zod.z.object(j).strict().superRefine(pe),vt=zod.z.object({...j,groups:j.groups.min(1,"A published form content requires at least one group")}).strict().superRefine(pe),me=[Ct,zod.z.object({...b,type:zod.z.literal("custom"),extension:zod.z.string().describe("Name of a registered extension"),parameters:zod.z.lazy(()=>ue).optional().describe("Extension parameters")}).strict(),zod.z.object({...b,type:zod.z.literal("activity")}).strict(),zod.z.object({...b,type:zod.z.literal("richtext"),attribute:zod.z.string().describe("Richtext attribute edited in place"),titleAttribute:zod.z.string().optional().describe("Text attribute shown as the title")}).strict(),zod.z.object({...b,type:zod.z.literal("documents"),allowUpload:zod.z.boolean().optional().describe("Lets people add files here"),allowRemove:zod.z.boolean().optional().describe("Lets people remove files here"),hideAttachments:zod.z.boolean().optional().describe("Hides files attached elsewhere (e.g. emails)"),relations:zod.z.array(zod.z.string()).optional().describe("Document relations shown; the record's own files if absent")}).strict(),zod.z.object({...b,type:zod.z.literal("forms"),objectName:zod.z.string().optional().describe("Limits to this object's published forms")}).strict(),zod.z.object({...b,type:zod.z.literal("emails"),emailAttributes:zod.z.array(zod.z.string()).max(chunk2M4YXNYZ_js.r.emailAttributesPerTab).describe("Addresses")}).strict(),zod.z.object({...b,type:zod.z.literal("meetings"),emailAttributes:zod.z.array(zod.z.string()).max(chunk2M4YXNYZ_js.r.emailAttributesPerTab).describe("Addresses")}).strict()],Dt=zod.z.discriminatedUnion("type",[Pt,...me]),be=zod.z.discriminatedUnion("type",[vt,...me]),ye={object:zod.z.string(),name:zod.z.string(),label:zod.z.string(),description:zod.z.string().optional(),icon:chunk2M4YXNYZ_js.t.optional(),context:zod.z.enum(["collection","record"]),default:zod.z.boolean().optional()},It=zod.z.object({...ye,contents:zod.z.array(Dt).max(chunk2M4YXNYZ_js.r.tabsPerView)}).strict(),Vt=zod.z.object({...ye,contents:zod.z.array(be).max(chunk2M4YXNYZ_js.r.tabsPerView)}).strict();function fe(e,r){let o=new Set;e.contents.forEach((i,a)=>{o.has(i.name)&&r.addIssue({code:"custom",message:`Duplicate content name "${i.name}"`,path:["contents",a,"name"]}),o.add(i.name);});}chunkDPD6ZWL2_js.a(fe,"addDuplicateContentNameIssues");function he(e,r){let o=e.contents.map((i,a)=>({content:i,index:a})).filter(({content:i})=>i.placement==="aside");o.length>1&&r.addIssue({code:"custom",path:["contents",o[1].index,"placement"],message:"Aside holds one content for now; put the others in main"});for(let{content:i,index:a}of o)i.type!=="form"&&r.addIssue({code:"custom",path:["contents",a,"type"],message:`Only a form content can sit in aside for now; put ${i.type} in main`});}chunkDPD6ZWL2_js.a(he,"addAsideIssues");function kt({asideRule:e="enforce"}={}){return It.superRefine((r,o)=>{fe(r,o),e==="enforce"&&he(r,o);})}chunkDPD6ZWL2_js.a(kt,"draftContentViewDefinitionSchemaFor");function jt({asideRule:e="enforce"}={}){return Vt.superRefine((r,o)=>{fe(r,o),r.contents.some(i=>i.placement==="main")||o.addIssue({code:"custom",message:"A published view requires at least one main content",path:["contents"]}),e==="enforce"&&he(r,o);})}chunkDPD6ZWL2_js.a(jt,"contentViewDefinitionSchemaFor");var Mt=kt(),Lt=jt();exports.A=sr;exports.B=ur;exports.C=pr;exports.D=dr;exports.E=te;exports.F=re;exports.G=He;exports.H=P;exports.I=Rr;exports.J=v;exports.K=Er;exports.L=xr;exports.M=Fr;exports.N=rt;exports.O=k;exports.P=Mr;exports.Q=st;exports.R=Gr;exports.S=dt;exports.T=bt;exports.U=Tt;exports.V=de;exports.W=be;exports.X=kt;exports.Y=jt;exports.Z=Mt;exports._=Lt;exports.a=Se;exports.b=Nt;exports.c=Re;exports.d=qt;exports.e=$;exports.f=x;exports.g=F;exports.h=Yt;exports.i=y;exports.j=g;exports.k=J;exports.l=zt;exports.m=Wt;exports.n=Kt;exports.o=Jt;exports.p=Gt;exports.q=w;exports.r=f;exports.s=We;exports.t=H;exports.u=Zt;exports.v=R;exports.w=rr;exports.x=or;exports.y=nr;exports.z=Z;
2
+ var Se={createdAt:"createdAt",updatedAt:"updatedAt",createdBy:"createdBy",lastUpdatedBy:"lastUpdatedBy",attachments:"attachments"};function Nt(e){return Se[e]}chunkDPD6ZWL2_js.a(Nt,"getSystemAttributeI18nKey");var Re={createdAt:{id:"system:createdAt",name:"createdAt",label:"Created time",type:"date",required:false,system:true,icon:"clock-circle",description:"When this record was created"},updatedAt:{id:"system:updatedAt",name:"updatedAt",label:"Last edited time",type:"date",required:false,system:true,icon:"clock-circle",description:"When this record was last modified"},createdBy:{id:"system:createdBy",name:"createdBy",label:"Created by",type:"user",required:false,system:true,multiple:false,icon:"user",description:"Actor who created this record"},lastUpdatedBy:{id:"system:lastUpdatedBy",name:"lastUpdatedBy",label:"Last edited by",type:"user",required:false,system:true,multiple:false,icon:"user",description:"Actor who last modified this record"},attachments:{id:"system:attachments",name:"attachments",label:"Attachments",type:"document",required:false,system:true,hidden:true,icon:"paperclip",description:"Free-form document attachments"}};function qt(){return Object.values(Re)}chunkDPD6ZWL2_js.a(qt,"getSystemAttributeList");function $(e){return e.id?.startsWith("system:")??false}chunkDPD6ZWL2_js.a($,"isManagedSystemAttribute");var K=["is","is_not","contains","not_contains","starts_with","ends_with","is_empty","is_not_empty"],Y=["is","is_not","less_than","greater_than","less_or_equal","greater_or_equal","is_empty","is_not_empty"],Oe=["is"],Te=["is","is_not","less_than","greater_than","less_or_equal","greater_or_equal","is_within","on_day_month","is_empty","is_not_empty"],z=["is","is_not","any_of","none_of","is_empty","is_not_empty"],Ee=["any_of","none_of","is_empty","is_not_empty"],W=["is","is_not","any_of","none_of","is_empty","is_not_empty"],xe=["is_empty","is_not_empty"],Fe=["is","is_not","less_than","greater_than","less_or_equal","greater_or_equal","contains","not_contains","is_empty","is_not_empty"],x=["city","postalCode","country"];function F(e){return x.includes(e)}chunkDPD6ZWL2_js.a(F,"isLocationFilterProperty");function Yt(e){return K.includes(e)}chunkDPD6ZWL2_js.a(Yt,"isLocationPartOperator");var y={text:K,richtext:[],number:Y,checkbox:Oe,date:Te,phone:["is","is_not","contains","not_contains","starts_with","is_empty","is_not_empty"],currency:Y,status:z,select:z,multiselect:Ee,location:[],user:W,relation:W,formula:Fe,document:xe},we=new Set(["formula","rollup"]),Ce=new Set(["user","relation","document"]),Pe=new Set(["text","richtext","number","select","multiselect","status","date","phone","currency","location","user","relation","document"]),ve=new Set(["text","number","date","phone","currency","select","multiselect"]),De=new Set(["text","phone","status","select","multiselect"]),Ie=new Set(["text","number","checkbox","date","phone","currency","status","select"]);function g(e){let r=!!(e.hidden||e.archived),o=!e.archived,i=we.has(e.type),a=e.type==="document",s=Ce.has(e.type),l=ke(e),c=r?[]:Ve(e),u=c.length>0&&!r,h=!r&&De.has(e.type),_=!r&&Ie.has(e.type),A=!r&&Ye(e.type),T=!r&&e.type==="status",_e=$(e),M=i||a||_e,E=!(r||M),ge=Ne(e.type)?"forbidden":"allowed",Ae=qe(e.type),L=Me(e),N=ve.has(e.type),q=!!(e.deprecated&&!r),B=$e(e);return {lifecycle:{active:o,deprecated:!!e.deprecated,visibleInArchitect:true,visibleInRuntime:!r,warningWhenDeprecated:q},storage:{mode:i?"computed":s?"edge":"value",cardinality:l,edgeBacked:s,preservesExistingValues:!!e.archived,qualifiedProperties:Le(e.type),polymorphic:je(e),maxItems:L},authoring:{editable:E,readOnly:M,directEdit:E&&B==="inline",required:ge,defaultValue:Ae,placeholder:N,maxItems:L},presentation:{formField:!r&&Ue(e.type),tableCell:!r&&G(e.type),defaultColumn:!r&&Be(e.type),compactDisplay:!r,popoverEditor:!r&&B==="popover",placeholder:N,warningWhenDeprecated:q},query:{filterable:u,searchable:h,sortable:_,groupable:A,kanbanGroupable:T,operators:c},agent:{readable:!r,writable:E&&!a,compactReadable:!r,contentReadable:!r&&ze(e.type),requiresDedicatedTool:a},exchange:{importable:!r,exportable:!r,schemaExportable:true,metadataExportable:false}}}chunkDPD6ZWL2_js.a(g,"getAttributeCapabilities");function J(e){return g(e).query.operators}chunkDPD6ZWL2_js.a(J,"getAttributeFilterOperators");function zt(e){return g(e).query.filterable}chunkDPD6ZWL2_js.a(zt,"isAttributeFilterable");function Wt(e){return g(e).query.searchable}chunkDPD6ZWL2_js.a(Wt,"isAttributeSearchable");function Kt(e){return g(e).query.sortable}chunkDPD6ZWL2_js.a(Kt,"isAttributeSortable");function Jt(e){return g(e).query.groupable}chunkDPD6ZWL2_js.a(Jt,"isAttributeGroupable");function Gt(e){return g(e).query.kanbanGroupable}chunkDPD6ZWL2_js.a(Gt,"isAttributeKanbanGroupable");function w(e){if(e.type!=="rollup")return e.type;let r=e;if(r.function==="earliest"||r.function==="latest")return "date";if(r.function==="original"){let o=r.targetAttributeType;if(o&&Q(o))return o}return "number"}chunkDPD6ZWL2_js.a(w,"resolveEffectiveFilterType");function C(e){let r=w(e);return Q(r)?y[r]:y.number}chunkDPD6ZWL2_js.a(C,"getRollupFilterOperators");function Ve(e){return e.type==="rollup"?C(e):y[e.type]??[]}chunkDPD6ZWL2_js.a(Ve,"getRawFilterOperators");function ke(e){return e.type==="multiselect"||e.type==="document"||e.type==="user"&&e.multiple===true||e.type==="relation"&&e.cardinality==="many"?"many":"one"}chunkDPD6ZWL2_js.a(ke,"getAttributeCardinality");function je(e){if(e.type!=="relation")return "none";let o=e.targets??[];return o.length===1&&o[0]?.object==="*"?"internal":o.length>1?"code-only":"none"}chunkDPD6ZWL2_js.a(je,"getPolymorphicCapability");function Me(e){return e.type==="multiselect"?true:e.type==="relation"?e.cardinality==="many":false}chunkDPD6ZWL2_js.a(Me,"supportsMaxItems");function Le(e){return e==="relation"||e==="document"}chunkDPD6ZWL2_js.a(Le,"supportsQualifiedProperties");function Ne(e){return e==="checkbox"||e==="formula"||e==="rollup"}chunkDPD6ZWL2_js.a(Ne,"isRequiredForbidden");function qe(e){return e==="checkbox"?"automatic":e==="formula"||e==="rollup"?"forbidden":Pe.has(e)?"static":"forbidden"}chunkDPD6ZWL2_js.a(qe,"getDefaultValueCapability");function Be(e){return G(e)}chunkDPD6ZWL2_js.a(Be,"isDefaultColumnType");function G(e){return e!=="richtext"&&e!=="document"}chunkDPD6ZWL2_js.a(G,"isTableCellType");function Ue(e){return e!=="richtext"}chunkDPD6ZWL2_js.a(Ue,"isFormFieldType");function $e(e){switch(e.type){case "checkbox":return "inline";case "number":return e.renderAs==="rating"?"inline":"default";case "select":case "multiselect":return e.renderAs==="badges"?"inline":"popover";case "status":case "relation":case "user":case "date":return "popover";default:return "default"}}chunkDPD6ZWL2_js.a($e,"resolveEditMode");function Ye(e){return e==="status"||e==="currency"}chunkDPD6ZWL2_js.a(Ye,"isGroupableType");function ze(e){return e==="richtext"||e==="document"}chunkDPD6ZWL2_js.a(ze,"isContentReadableType");function Q(e){return Object.prototype.hasOwnProperty.call(y,e)}chunkDPD6ZWL2_js.a(Q,"hasFilterOperatorEntry");var f=y,We=["is_empty","is_not_empty"];function H(e){return We.includes(e)}chunkDPD6ZWL2_js.a(H,"isNoValueOperator");function Zt(e){return C(e)}chunkDPD6ZWL2_js.a(Zt,"getRollupFilterOperators");function R(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&"dynamic"in e}chunkDPD6ZWL2_js.a(R,"isDynamicValue");function rr(){return {dynamic:"actor",ref:"current"}}chunkDPD6ZWL2_js.a(rr,"currentActor");function or(){return {dynamic:"date",anchor:"today"}}chunkDPD6ZWL2_js.a(or,"today");function nr(){return {dynamic:"date",anchor:"now"}}chunkDPD6ZWL2_js.a(nr,"now");function X(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let r=Number(e);return Number.isFinite(r)?r:null}return null}chunkDPD6ZWL2_js.a(X,"toAmount");function Z(e){return e!==null&&typeof e=="object"?"value"in e?X(e.value):null:X(e)}chunkDPD6ZWL2_js.a(Z,"extractCurrencyFilterValue");function sr(e){return e==null?null:typeof e=="object"&&"value"in e?e.value??null:e}chunkDPD6ZWL2_js.a(sr,"extractFilterValue");var Ke=new Set(["is_not","not_contains","none_of","is_empty"]),Je={is_not:"is",not_contains:"contains",none_of:"any_of",is_empty:"is_not_empty"};function ur(e){return Ke.has(e)?"none":"any"}chunkDPD6ZWL2_js.a(ur,"getOperatorPolarity");function pr(e){return Je[e]??e}chunkDPD6ZWL2_js.a(pr,"normalizeForEdgeRpc");var ee={is:"any_of",is_not:"none_of"};function dr(e){return ee[e]??e}chunkDPD6ZWL2_js.a(dr,"toMultiValueOperator");var Ge=new Set(Object.values(ee).filter(e=>e!==void 0));function te(e){return Ge.has(e)}chunkDPD6ZWL2_js.a(te,"isSetMembershipOperator");function re(e,r){let o=e.value;if(H(e.operator)||o==null||R(o))return;if(te(e.operator)){Array.isArray(o)||(e.value=[o]);return}if(r!=="currency")return;let i=Z(o);if(i!==null){e.value=i;return}if(!Qe(o))return;let a=`Filter on a currency attribute expected a numeric amount, received ${JSON.stringify(o)}`;throw new chunkJSKLP4GI_js.h(a,[{path:["value"],message:a}])}chunkDPD6ZWL2_js.a(re,"canonicalizeFilterValue");function Qe(e){return typeof e!="object"?true:"value"in e?e.value!=null:false}chunkDPD6ZWL2_js.a(Qe,"hasCurrencyAmount");var He={eq:"is",equals:"is",equal:"is","==":"is","=":"is",neq:"is_not",notEqual:"is_not",isNot:"is_not","!=":"is_not","<>":"is_not",lt:"less_than","<":"less_than",gt:"greater_than",">":"greater_than",lte:"less_or_equal","<=":"less_or_equal",gte:"greater_or_equal",">=":"greater_or_equal",in:"any_of",isAnyOf:"any_of",anyOf:"any_of",oneOf:"any_of",notIn:"none_of",not_in:"none_of",isNoneOf:"none_of",noneOf:"none_of",notOneOf:"none_of",startsWith:"starts_with",beginsWith:"starts_with",endsWith:"ends_with",doesNotContain:"not_contains",notContain:"not_contains",isEmpty:"is_empty",isNotEmpty:"is_not_empty"};function P(e){return He[e]??e}chunkDPD6ZWL2_js.a(P,"normalizeOperator");function Rr(e){let r=P(e.operator);return r===e.operator?e:{...e,operator:r}}chunkDPD6ZWL2_js.a(Rr,"normalizeFilterRule");var Xe=new Set(["days","weeks","months","years"]),Ze=new Set(["past","future"]);function v(e){if(typeof e!="object"||e===null)return false;let r=e;return typeof r.amount=="number"&&Number.isFinite(r.amount)&&r.amount>0&&typeof r.unit=="string"&&Xe.has(r.unit)&&typeof r.direction=="string"&&Ze.has(r.direction)}chunkDPD6ZWL2_js.a(v,"isRelativeDateValue");function ne(e){return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}chunkDPD6ZWL2_js.a(ne,"utcDayStart");function oe(e,r,o){if(o==="days")return e+r*864e5;if(o==="weeks")return e+r*7*864e5;let i=new Date(e),a=i.getUTCFullYear()+(o==="years"?r:0),s=i.getUTCMonth()+(o==="months"?r:0),l=new Date(Date.UTC(a,s+1,0)).getUTCDate();return Date.UTC(a,s,Math.min(i.getUTCDate(),l))}chunkDPD6ZWL2_js.a(oe,"shiftUtcDay");function Er(e,r=new Date){if(!v(e))return null;let o=ne(r),i=Math.trunc(e.amount),a=e.direction==="past"?{startMs:oe(o,-i,e.unit),endMs:o+864e5}:{startMs:o,endMs:oe(o,i,e.unit)+864e5};return Number.isFinite(a.startMs)&&Number.isFinite(a.endMs)?a:null}chunkDPD6ZWL2_js.a(Er,"resolveIsWithinBounds");function xr(e){if(!Number.isFinite(e))return null;let r=ne(new Date(e));return Number.isFinite(r)?{startMs:r,endMs:r+864e5}:null}chunkDPD6ZWL2_js.a(xr,"resolveUtcDayBounds");function Fr(e){return new Date(e).toISOString().slice(0,10)}chunkDPD6ZWL2_js.a(Fr,"toUtcDayString");var et=new Set(["relation","document","user"]),D=["is","is_not","any_of","none_of","is_empty","is_not_empty"],tt={id:D,objectId:D,tenantId:D,label:f.text,createdAt:f.date,updatedAt:f.date,deletedAt:f.date,createdBy:f.user,lastUpdatedBy:f.user},rt={id:"text",objectId:"text",objectName:"text",tenantId:"text",label:"text",createdAt:"date",updatedAt:"date",deletedAt:"date",deletedBy:"user",createdBy:"user",lastUpdatedBy:"user",visibility:"select",ownedBy:"user"},k={before:'"less_than"',after:'"greater_than"',on_or_before:'"less_or_equal"',on_or_after:'"greater_or_equal"',is_checked:'"is" with value true',is_not_checked:'"is" with value false',day_month_eq:'"on_day_month"'},ot=new Set(Object.entries(y).filter(([,e])=>e.includes("any_of")&&!e.includes("contains")).map(([e])=>e)),nt={contains:"any_of",not_contains:"none_of"};function I(e,r){let o=k[e];if(o){let s=`Unknown filter operator "${e}" \u2014 use ${o}`;throw new chunkJSKLP4GI_js.h(s,[{path:["operator"],message:s}])}let i=P(e),a=nt[i];if(a&&ot.has(r)){let s=`Operator "${i}" is not valid for type "${r}" \u2014 use "${a}"`;throw new chunkJSKLP4GI_js.h(s,[{path:["operator"],message:s}])}return i}chunkDPD6ZWL2_js.a(I,"resolveCanonicalOperator");function ie(e,r,o){let i=I(e,r),a=f[r];if(!a?.includes(i)){let s=a?.length?a.join(", "):"(no operators registered for this type)",l=`Operator "${e}" is not valid for ${o} type "${r}". Valid operators: ${s}.`;throw new chunkJSKLP4GI_js.h(l,[{path:["operator"],message:l}])}return i}chunkDPD6ZWL2_js.a(ie,"assertOperatorForType");function it(e){if(e.operator==="is_within"&&!v(e.value)){let r='Operator "is_within" requires a relative-date value { amount: positive number, unit: days|weeks|months|years, direction: past|future }';throw new chunkJSKLP4GI_js.h(r,[{path:["value"],message:r}])}}chunkDPD6ZWL2_js.a(it,"assertRelativeDateValue");function O(e,r,o){e.operator=r,re(e,o),it(e);}chunkDPD6ZWL2_js.a(O,"applyCanonicalForm");function ae(e,r){if(!R(e.value))return;let o=e.value;if(o.dynamic==="actor"&&r!=="user"){let i=`actor token (@me) is only valid on user attributes, not "${r}"`;throw new chunkJSKLP4GI_js.h(i,[{path:["value"],message:i}])}if(o.dynamic==="date"&&r!=="date"){let i=`date token (@today/@now) is only valid on date attributes, not "${r}"`;throw new chunkJSKLP4GI_js.h(i,[{path:["value"],message:i}])}}chunkDPD6ZWL2_js.a(ae,"assertDynamicValueForAttribute");var V=x.map(e=>`"${e}"`).join(", ");function at(e){return e==="location"?` A location is filtered on one of its parts: set "property" to one of ${V} and use a text operator (e.g. contains).`:""}chunkDPD6ZWL2_js.a(at,"locationPartsHint");function Mr(e,r){try{return st({...e},r),[]}catch(o){if(!(o instanceof chunkJSKLP4GI_js.h))throw o;return o.errors.map(i=>({...i,path:[...i.path]}))}}chunkDPD6ZWL2_js.a(Mr,"collectQualifiedRuleIssues");function st(e,r){let o=r.attributes.find(c=>c.name===e.attribute),i=tt[e.attribute];if(!(o||i)){let[c,...u]=e.attribute.split("."),_=(u.length>0?r.attributes.find(T=>T.name===c):void 0)?.type==="location"?` Dotted paths are not supported \u2014 set "attribute" to "${c}" and "property" to ${F(u[0]??"")?`"${u[0]}"`:`one of ${V}`}.`:e.attribute.includes(".")?' Dotted paths are not supported \u2014 filter on the attribute name alone, or use the full-text "query" parameter to match text inside a value.':"",A=`Unknown attribute: ${e.attribute}${_}`;throw new chunkJSKLP4GI_js.h(A,[{path:["attribute"],message:A}])}if(e.quantifier!==void 0&&!e.property){let c='quantifier is only valid on qualified edge rules (set "property")';throw new chunkJSKLP4GI_js.h(c,[{path:["quantifier"],message:c}])}if(!o){if(e.property)throw new chunkJSKLP4GI_js.h(`Cannot qualify system attribute "${e.attribute}"`,[{path:["property"],message:`"${e.attribute}" is a system column, not a reference`}]);let c=rt[e.attribute]??"text",u=I(e.operator,c);if(!i.includes(u)){let h=`Operator "${e.operator}" is not valid for system attribute "${e.attribute}". Valid operators: ${i.join(", ")}.`;throw new chunkJSKLP4GI_js.h(h,[{path:["operator"],message:h}])}O(e,u,c);return}if(!e.property){ae(e,o.type);let c=J(o),u=I(e.operator,o.type);if(!c.includes(u)){let h=c.length?c.join(", "):"(not filterable)",_=`Operator "${e.operator}" is not valid for attribute "${o.name}". Valid operators: ${h}.${at(o.type)}`;throw new chunkJSKLP4GI_js.h(_,[{path:["operator"],message:_}])}O(e,u,w(o));return}if(o.type==="location"){if(e.quantifier!==void 0){let u="quantifier is not valid on a location part \u2014 a location is one value, not a set of edges";throw new chunkJSKLP4GI_js.h(u,[{path:["quantifier"],message:u}])}if(!F(e.property)){let u=`Property "${e.property}" is not a part of location "${e.attribute}". Valid parts: ${V}.`;throw new chunkJSKLP4GI_js.h(u,[{path:["property"],message:u}])}ae(e,"text");let c=ie(e.operator,"text","property");O(e,c,"text");return}if(!et.has(o.type))throw new chunkJSKLP4GI_js.h(`Cannot qualify ${o.type} attribute "${e.attribute}"`,[{path:["property"],message:`Attribute "${e.attribute}" is not a reference type`}]);let a=o.properties;if(!a)throw new chunkJSKLP4GI_js.h(`Attribute "${e.attribute}" has no qualifyWith schema`,[{path:["property"],message:`"${e.attribute}" has no qualifyWith`}]);let s=a.definitions.find(c=>c.name===e.property);if(!s)throw new chunkJSKLP4GI_js.h(`Property "${e.property}" not defined on "${e.attribute}".qualifyWith()`,[{path:["property"],message:`Unknown property: ${e.property}`}]);let l=ie(e.operator,s.type,"property");O(e,l,s.type);}chunkDPD6ZWL2_js.a(st,"validateQualifiedRule");var se=64,le=1e4;function ce(e){let r=Object.getPrototypeOf(e);return r===null||r===Object.prototype?true:Object.getPrototypeOf(r)===null&&r.constructor?.name==="Object"}chunkDPD6ZWL2_js.a(ce,"isPlainJsonObject");function m(e,r,o=[]){e.addIssue({code:"custom",message:r,path:o});}chunkDPD6ZWL2_js.a(m,"addJsonIssue");function ct(e,r,o,i){for(let a of Reflect.ownKeys(e))if(a!=="length"){if(a==="__proto__"){m(i,"The __proto__ key is not allowed in custom props",[...r.path,a]);continue}(typeof a=="symbol"||!/^(0|[1-9]\d*)$/.test(a))&&m(i,"Arrays cannot contain non-index JSON properties",[...r.path,a]);}for(let a=e.length-1;a>=0;a--){let s=Object.getOwnPropertyDescriptor(e,String(a)),l=[...r.path,a];if(!(s&&"value"in s)){m(i,"Sparse arrays are not valid JSON values",l);continue}o.push({kind:"enter",value:s.value,path:l,depth:r.depth+1});}}chunkDPD6ZWL2_js.a(ct,"pushJsonArrayChildren");function ut(e,r,o,i){let a=Reflect.ownKeys(e);for(let s=a.length-1;s>=0;s--){let l=a[s],c=[...r.path,l];if(l==="__proto__"){m(i,"The __proto__ key is not allowed in custom props",c);continue}if(typeof l=="symbol"){m(i,"Symbol keys are not valid JSON keys",c);continue}let u=Object.getOwnPropertyDescriptor(e,l);if(!(u?.enumerable&&"value"in u)){m(i,"Custom props must contain enumerable data properties only",c);continue}o.push({kind:"enter",value:u.value,path:c,depth:r.depth+1});}}chunkDPD6ZWL2_js.a(ut,"pushJsonObjectChildren");function pt(e,r){if(e===null||typeof e!="object"){m(r,"Expected a plain JSON object");return}try{if(Array.isArray(e)||!ce(e)){m(r,"Expected a plain JSON object");return}}catch{m(r,"Custom props contain an object that cannot be safely inspected");return}let o=new WeakSet,i=[{kind:"enter",value:e,path:[],depth:0}],a=0;for(;i.length>0;){let s=i.pop();if(!s)break;if(s.kind==="exit"){o.delete(s.value);continue}if(a++,a>le){m(r,`Custom props cannot exceed ${le.toLocaleString("en-US")} total JSON nodes`,s.path);return}if(s.depth>se){m(r,`Custom props cannot exceed depth ${se}`,s.path);continue}let l=s.value;if(!(l===null||typeof l=="string"||typeof l=="boolean"||typeof l=="number"&&Number.isFinite(l))){if(typeof l!="object"){m(r,"Expected a JSON value",s.path);continue}if(o.has(l)){m(r,"Custom props cannot contain circular references",s.path);continue}try{if(Array.isArray(l)){o.add(l),i.push({kind:"exit",value:l}),ct(l,s,i,r);continue}if(!ce(l)){m(r,"Expected an array or plain JSON object",s.path);continue}o.add(l),i.push({kind:"exit",value:l}),ut(l,s,i,r);}catch{m(r,"Custom props contain an object that cannot be safely inspected",s.path);}}}}chunkDPD6ZWL2_js.a(pt,"validateJsonProps");var ue=zod.z.unknown().superRefine(pt).transform(e=>e);var Gr=zod.z.array(zod.z.string()).max(chunk2M4YXNYZ_js.r.columnsPerTab),dt=zod.z.array(zod.z.string().min(1)).max(chunk2M4YXNYZ_js.r.columnsPerTab).refine(e=>new Set(e).size===e.length,{message:"Displayed attribute names must be unique"}),mt=zod.z.object({attribute:zod.z.string().describe("Attribute to sort by"),direction:zod.z.enum(["asc","desc"]).describe("asc or desc")}).strict(),bt=zod.z.array(mt).max(chunk2M4YXNYZ_js.r.sortsPerTab),yt=zod.z.object({amount:zod.z.number().describe("Count"),unit:zod.z.enum(["days","weeks","months","years"]).describe("Unit"),direction:zod.z.enum(["past","future"]).describe("Past or future")}).strict(),ft=zod.z.object({value:zod.z.number().nullable().describe("Amount"),code:zod.z.array(zod.z.string()).optional().describe("Currency codes")}).strict(),ht=zod.z.object({phoneNumber:zod.z.string().nullable().describe("Number"),countryCode:zod.z.string().optional().describe("ISO country code")}).strict(),_t=zod.z.discriminatedUnion("dynamic",[zod.z.object({dynamic:zod.z.literal("actor").describe("Resolved at filter time"),ref:zod.z.literal("current").describe("The current actor")}).strict(),zod.z.object({dynamic:zod.z.literal("date").describe("Resolved at filter time"),anchor:zod.z.enum(["today","now"]).describe("Anchor")}).strict()]),gt=zod.z.object({month:zod.z.number().describe("1-12"),day:zod.z.number().describe("Day")}).strict(),At=zod.z.union([zod.z.string(),zod.z.number(),zod.z.boolean(),zod.z.array(zod.z.string()),yt,ft,ht,gt,_t,zod.z.null()]),St=zod.z.enum(["is","is_not","contains","not_contains","starts_with","ends_with","is_empty","is_not_empty","less_than","greater_than","less_or_equal","greater_or_equal","is_within","on_day_month","any_of","none_of"],{error:chunkDPD6ZWL2_js.a(e=>{let r=e.input,o=typeof r=="string"?k[r]:void 0;return o?`Unknown filter operator "${r}" \u2014 use ${o}`:void 0},"error")}),Rt=zod.z.object({attribute:zod.z.string().describe("Attribute to filter on"),property:zod.z.string().optional().describe("Qualified edge property"),quantifier:zod.z.enum(["any","none"]).optional().describe("For a multi-value attribute"),operator:St.describe("Comparison"),value:At.describe("Comparison value, by attribute type")}).strict(),Ot=zod.z.array(Rt).max(chunk2M4YXNYZ_js.r.filterRulesPerTab),Tt=zod.z.object({combinator:zod.z.enum(["and","or"]).describe("Match every rule or any rule"),rules:Ot.describe("The rules")}).strict(),Et={span:zod.z.union([zod.z.literal(1),zod.z.literal(2),zod.z.literal(3),zod.z.literal(4),zod.z.literal(5),zod.z.literal(6),zod.z.literal(7),zod.z.literal(8),zod.z.literal(9),zod.z.literal(10),zod.z.literal(11),zod.z.literal(12)]).optional().describe("Columns of 12 this field occupies"),label:zod.z.string().optional().describe("Overrides the attribute's label"),readOnly:zod.z.boolean().optional().describe("Shows the value, not editable")},xt=zod.z.object({attribute:zod.z.string().describe("Attribute API name shown by this field"),...Et}).strict(),Ft=zod.z.object({name:zod.z.string().describe("Group API name, unique in the form"),label:zod.z.string().describe("Label people see"),description:zod.z.string().optional().describe("Extra context under the label"),collapsible:zod.z.boolean().optional().describe("Whether the group can be collapsed"),collapsed:zod.z.boolean().optional().describe("Whether the group starts collapsed"),fields:zod.z.array(xt).max(chunk2M4YXNYZ_js.r.fieldsPerGroup).describe("Fields in this group, in order")}).strict();function pe(e,r){e.groups.reduce((s,l)=>s+l.fields.length,0)>chunk2M4YXNYZ_js.r.fieldsPerFormTab&&r.addIssue({code:"too_big",origin:"array",maximum:chunk2M4YXNYZ_js.r.fieldsPerFormTab,inclusive:true,message:`A form content can contain at most ${chunk2M4YXNYZ_js.r.fieldsPerFormTab} fields`,path:["groups"]});let i=new Set,a=new Set;e.groups.forEach((s,l)=>{i.has(s.name)&&r.addIssue({code:"custom",message:`Duplicate group name "${s.name}"`,path:["groups",l,"name"]}),i.add(s.name),s.fields.forEach((c,u)=>{a.has(c.attribute)&&r.addIssue({code:"custom",message:`Duplicate field attribute "${c.attribute}"`,path:["groups",l,"fields",u,"attribute"]}),a.add(c.attribute);});});}chunkDPD6ZWL2_js.a(pe,"refineFormContent");var b={name:zod.z.string().describe("Content API name, unique in the view"),label:zod.z.string().optional().describe("Label people see"),icon:chunk2M4YXNYZ_js.t.optional().describe("Icon name"),placement:zod.z.enum(["main","aside"]).describe("main: any tabs. aside: at most one, a form")},de=zod.z.object({object:zod.z.string().optional().describe("Every record of this object"),relation:zod.z.string().optional().describe("Records linked through this relation")}).strict().superRefine((e,r)=>{e.object===void 0&&e.relation===void 0&&r.addIssue({code:"custom",message:"Collection source must define an object, a relation, or both"});}).transform(e=>e.relation===void 0?{object:e.object}:e.object===void 0?{relation:e.relation}:{object:e.object,relation:e.relation}),wt={...b,type:zod.z.literal("collection"),source:de.describe("object: every record; relation: records linked to this record; both: records of object whose relation points at this record"),visibility:zod.z.enum(chunk2M4YXNYZ_js.d).optional().describe("all: no scope; workspace: every member; private: viewer's own"),columns:zod.z.array(zod.z.union([zod.z.string(),zod.z.object({relationProperty:zod.z.string().refine(e=>e.trim().length>0).describe("Qualified edge property shown as a column")}).strict()])).max(chunk2M4YXNYZ_js.r.columnsPerTab).optional().describe("Table columns, in order"),descriptionAttribute:zod.z.string().optional().describe("Secondary line under each row's title (list layout)"),displayAttributes:dt.optional().describe("Attributes shown on each card"),filters:Tt.optional().describe("Restricts which records show"),sorts:bt.optional().describe("Sort order"),actions:zod.z.enum(["create","update","delete","attach","detach"]).array().optional().describe("Offered actions; absent = every action, [] = none"),openMode:zod.z.enum(["page","peek"]).optional().describe("page or peek (the record panel)"),createMode:zod.z.enum(["page","peek","inline"]).optional().describe("page, peek, or inline (creates without opening)")},Ct=zod.z.object({...wt,layout:zod.z.enum(["table","list","kanban"]).describe("table columns, list cards, kanban board grouped by a select/status attribute"),columnSizing:zod.z.record(zod.z.string(),zod.z.number()).optional().describe("Column widths in pixels, by attribute name"),groupByAttribute:zod.z.string().optional().describe("Kanban only: the select or status attribute that names the columns"),kanbanColumnOrder:zod.z.array(zod.z.string()).optional().describe("Kanban: column order by option value"),kanbanColumnVisibility:zod.z.record(zod.z.string(),zod.z.boolean()).optional().describe("Kanban: which columns are shown"),kanbanPinnedColumns:zod.z.array(zod.z.string()).optional().describe("Kanban: columns pinned first")}).strict().superRefine((e,r)=>{let o=["groupByAttribute","kanbanColumnOrder","kanbanColumnVisibility","kanbanPinnedColumns"];if(e.layout==="kanban"){e.groupByAttribute===void 0&&r.addIssue({code:"custom",path:["groupByAttribute"],message:"A kanban layout requires groupByAttribute"});return}for(let i of o)e[i]!==void 0&&r.addIssue({code:"custom",path:[i],message:"Only a kanban layout groups by an attribute"});}),j={...b,type:zod.z.literal("form"),groups:zod.z.array(Ft).max(chunk2M4YXNYZ_js.r.groupsPerFormTab).describe("Field groups, in order"),formColumns:zod.z.union([zod.z.literal(1),zod.z.literal(2),zod.z.literal(3)]).optional().describe("Grid columns, 1-3"),density:zod.z.enum(["compact","comfortable","spacious"]).optional().describe("Vertical spacing between fields")},Pt=zod.z.object(j).strict().superRefine(pe),vt=zod.z.object({...j,groups:j.groups.min(1,"A published form content requires at least one group")}).strict().superRefine(pe),me=[Ct,zod.z.object({...b,type:zod.z.literal("custom"),extension:zod.z.string().describe("Name of a registered extension"),parameters:zod.z.lazy(()=>ue).optional().describe("Extension parameters")}).strict(),zod.z.object({...b,type:zod.z.literal("activity")}).strict(),zod.z.object({...b,type:zod.z.literal("richtext"),attribute:zod.z.string().describe("Richtext attribute edited in place"),titleAttribute:zod.z.string().optional().describe("Text attribute shown as the title")}).strict(),zod.z.object({...b,type:zod.z.literal("documents"),allowUpload:zod.z.boolean().optional().describe("Lets people add files here"),allowRemove:zod.z.boolean().optional().describe("Lets people remove files here"),hideAttachments:zod.z.boolean().optional().describe("Hides files attached elsewhere (e.g. emails)"),relations:zod.z.array(zod.z.string()).optional().describe("Document relations shown; the record's own files if absent")}).strict(),zod.z.object({...b,type:zod.z.literal("forms"),objectName:zod.z.string().optional().describe("Limits to this object's published forms")}).strict(),zod.z.object({...b,type:zod.z.literal("emails"),emailAttributes:zod.z.array(zod.z.string()).max(chunk2M4YXNYZ_js.r.emailAttributesPerTab).describe("Addresses")}).strict(),zod.z.object({...b,type:zod.z.literal("meetings"),emailAttributes:zod.z.array(zod.z.string()).max(chunk2M4YXNYZ_js.r.emailAttributesPerTab).describe("Addresses")}).strict()],Dt=zod.z.discriminatedUnion("type",[Pt,...me]),be=zod.z.discriminatedUnion("type",[vt,...me]),ye={object:zod.z.string(),name:zod.z.string(),label:zod.z.string(),description:zod.z.string().optional(),icon:chunk2M4YXNYZ_js.t.optional(),context:zod.z.enum(["collection","record"]),default:zod.z.boolean().optional()},It=zod.z.object({...ye,contents:zod.z.array(Dt).max(chunk2M4YXNYZ_js.r.tabsPerView)}).strict(),Vt=zod.z.object({...ye,contents:zod.z.array(be).max(chunk2M4YXNYZ_js.r.tabsPerView)}).strict();function fe(e,r){let o=new Set;e.contents.forEach((i,a)=>{o.has(i.name)&&r.addIssue({code:"custom",message:`Duplicate content name "${i.name}"`,path:["contents",a,"name"]}),o.add(i.name);});}chunkDPD6ZWL2_js.a(fe,"addDuplicateContentNameIssues");function he(e,r){let o=e.contents.map((i,a)=>({content:i,index:a})).filter(({content:i})=>i.placement==="aside");o.length>1&&r.addIssue({code:"custom",path:["contents",o[1].index,"placement"],message:"Aside holds one content for now; put the others in main"});for(let{content:i,index:a}of o)i.type!=="form"&&r.addIssue({code:"custom",path:["contents",a,"type"],message:`Only a form content can sit in aside for now; put ${i.type} in main`});}chunkDPD6ZWL2_js.a(he,"addAsideIssues");function kt({asideRule:e="enforce"}={}){return It.superRefine((r,o)=>{fe(r,o),e==="enforce"&&he(r,o);})}chunkDPD6ZWL2_js.a(kt,"draftContentViewDefinitionSchemaFor");function jt({asideRule:e="enforce"}={}){return Vt.superRefine((r,o)=>{fe(r,o),r.contents.some(i=>i.placement==="main")||o.addIssue({code:"custom",message:"A published view requires at least one main content",path:["contents"]}),e==="enforce"&&he(r,o);})}chunkDPD6ZWL2_js.a(jt,"contentViewDefinitionSchemaFor");var Mt=kt(),Lt=jt();exports.A=sr;exports.B=ur;exports.C=pr;exports.D=dr;exports.E=te;exports.F=re;exports.G=He;exports.H=P;exports.I=Rr;exports.J=v;exports.K=Er;exports.L=xr;exports.M=Fr;exports.N=rt;exports.O=k;exports.P=Mr;exports.Q=st;exports.R=Gr;exports.S=dt;exports.T=bt;exports.U=Tt;exports.V=de;exports.W=be;exports.X=kt;exports.Y=jt;exports.Z=Mt;exports._=Lt;exports.a=Se;exports.b=Nt;exports.c=Re;exports.d=qt;exports.e=$;exports.f=x;exports.g=F;exports.h=Yt;exports.i=y;exports.j=g;exports.k=J;exports.l=zt;exports.m=Wt;exports.n=Kt;exports.o=Jt;exports.p=Gt;exports.q=w;exports.r=f;exports.s=We;exports.t=H;exports.u=Zt;exports.v=R;exports.w=rr;exports.x=or;exports.y=nr;exports.z=Z;
@@ -1,2 +1,2 @@
1
1
  import {r,t,d}from'./chunk-EZCWO4XV.mjs';import {h}from'./chunk-XRWRECDA.mjs';import {a}from'./chunk-KSPJP74K.mjs';import {z as z$1}from'zod';/*! © 2025-2026 AND YOU CREATE SAS (RCS Paris 940 190 614). Proprietary — see LICENSE (Standards SDK License 1.0). */
2
- var Se={createdAt:"createdAt",updatedAt:"updatedAt",createdBy:"createdBy",lastUpdatedBy:"lastUpdatedBy",attachments:"attachments"};function Nt(e){return Se[e]}a(Nt,"getSystemAttributeI18nKey");var Re={createdAt:{id:"system:createdAt",name:"createdAt",label:"Created time",type:"date",required:false,system:true,icon:"clock-circle",description:"When this record was created"},updatedAt:{id:"system:updatedAt",name:"updatedAt",label:"Last edited time",type:"date",required:false,system:true,icon:"clock-circle",description:"When this record was last modified"},createdBy:{id:"system:createdBy",name:"createdBy",label:"Created by",type:"user",required:false,system:true,multiple:false,icon:"user",description:"Actor who created this record"},lastUpdatedBy:{id:"system:lastUpdatedBy",name:"lastUpdatedBy",label:"Last edited by",type:"user",required:false,system:true,multiple:false,icon:"user",description:"Actor who last modified this record"},attachments:{id:"system:attachments",name:"attachments",label:"Attachments",type:"document",required:false,system:true,hidden:true,icon:"paperclip",description:"Free-form document attachments"}};function qt(){return Object.values(Re)}a(qt,"getSystemAttributeList");function $(e){return e.id?.startsWith("system:")??false}a($,"isManagedSystemAttribute");var K=["is","is_not","contains","not_contains","starts_with","ends_with","is_empty","is_not_empty"],Y=["is","is_not","less_than","greater_than","less_or_equal","greater_or_equal","is_empty","is_not_empty"],Oe=["is"],Te=["is","is_not","less_than","greater_than","less_or_equal","greater_or_equal","is_within","on_day_month","is_empty","is_not_empty"],z=["is","is_not","any_of","none_of","is_empty","is_not_empty"],Ee=["any_of","none_of","is_empty","is_not_empty"],W=["is","is_not","any_of","none_of","is_empty","is_not_empty"],xe=["is_empty","is_not_empty"],Fe=["is","is_not","less_than","greater_than","less_or_equal","greater_or_equal","contains","not_contains","is_empty","is_not_empty"],x=["city","postalCode","country"];function F(e){return x.includes(e)}a(F,"isLocationFilterProperty");function Yt(e){return K.includes(e)}a(Yt,"isLocationPartOperator");var y={text:K,richtext:[],number:Y,checkbox:Oe,date:Te,phone:["is","is_not","contains","not_contains","starts_with","is_empty","is_not_empty"],currency:Y,status:z,select:z,multiselect:Ee,location:[],user:W,relation:W,formula:Fe,document:xe},we=new Set(["formula","rollup"]),Ce=new Set(["user","relation","document"]),Pe=new Set(["text","richtext","number","select","multiselect","status","date","phone","currency","location","user","relation","document"]),ve=new Set(["text","number","date","phone","currency","select","multiselect"]),De=new Set(["text","phone","status","select","multiselect"]),Ie=new Set(["text","number","checkbox","date","phone","currency","status","select"]);function g(e){let r=!!(e.hidden||e.archived),o=!e.archived,i=we.has(e.type),a=e.type==="document",s=Ce.has(e.type),l=ke(e),c=r?[]:Ve(e),u=c.length>0&&!r,h=!r&&De.has(e.type),_=!r&&Ie.has(e.type),A=!r&&Ye(e.type),T=!r&&e.type==="status",_e=$(e),M=i||a||_e,E=!(r||M),ge=Ne(e.type)?"forbidden":"allowed",Ae=qe(e.type),L=Me(e),N=ve.has(e.type),q=!!(e.deprecated&&!r),B=$e(e);return {lifecycle:{active:o,deprecated:!!e.deprecated,visibleInArchitect:true,visibleInRuntime:!r,warningWhenDeprecated:q},storage:{mode:i?"computed":s?"edge":"value",cardinality:l,edgeBacked:s,preservesExistingValues:!!e.archived,qualifiedProperties:Le(e.type),polymorphic:je(e),maxItems:L},authoring:{editable:E,readOnly:M,directEdit:E&&B==="inline",required:ge,defaultValue:Ae,placeholder:N,maxItems:L},presentation:{formField:!r&&Ue(e.type),tableCell:!r&&G(e.type),defaultColumn:!r&&Be(e.type),compactDisplay:!r,popoverEditor:!r&&B==="popover",placeholder:N,warningWhenDeprecated:q},query:{filterable:u,searchable:h,sortable:_,groupable:A,kanbanGroupable:T,operators:c},agent:{readable:!r,writable:E&&!a,compactReadable:!r,contentReadable:!r&&ze(e.type),requiresDedicatedTool:a},exchange:{importable:!r,exportable:!r,schemaExportable:true,metadataExportable:false}}}a(g,"getAttributeCapabilities");function J(e){return g(e).query.operators}a(J,"getAttributeFilterOperators");function zt(e){return g(e).query.filterable}a(zt,"isAttributeFilterable");function Wt(e){return g(e).query.searchable}a(Wt,"isAttributeSearchable");function Kt(e){return g(e).query.sortable}a(Kt,"isAttributeSortable");function Jt(e){return g(e).query.groupable}a(Jt,"isAttributeGroupable");function Gt(e){return g(e).query.kanbanGroupable}a(Gt,"isAttributeKanbanGroupable");function w(e){if(e.type!=="rollup")return e.type;let r=e;if(r.function==="earliest"||r.function==="latest")return "date";if(r.function==="original"){let o=r.targetAttributeType;if(o&&Q(o))return o}return "number"}a(w,"resolveEffectiveFilterType");function C(e){let r=w(e);return Q(r)?y[r]:y.number}a(C,"getRollupFilterOperators");function Ve(e){return e.type==="rollup"?C(e):y[e.type]??[]}a(Ve,"getRawFilterOperators");function ke(e){return e.type==="multiselect"||e.type==="document"||e.type==="user"&&e.multiple===true||e.type==="relation"&&e.cardinality==="many"?"many":"one"}a(ke,"getAttributeCardinality");function je(e){if(e.type!=="relation")return "none";let o=e.targets??[];return o.length===1&&o[0]?.object==="*"?"internal":o.length>1?"code-only":"none"}a(je,"getPolymorphicCapability");function Me(e){return e.type==="multiselect"?true:e.type==="relation"?e.cardinality==="many":false}a(Me,"supportsMaxItems");function Le(e){return e==="relation"||e==="document"}a(Le,"supportsQualifiedProperties");function Ne(e){return e==="checkbox"||e==="formula"||e==="rollup"}a(Ne,"isRequiredForbidden");function qe(e){return e==="checkbox"?"automatic":e==="formula"||e==="rollup"?"forbidden":Pe.has(e)?"static":"forbidden"}a(qe,"getDefaultValueCapability");function Be(e){return G(e)}a(Be,"isDefaultColumnType");function G(e){return e!=="richtext"&&e!=="document"}a(G,"isTableCellType");function Ue(e){return e!=="richtext"}a(Ue,"isFormFieldType");function $e(e){switch(e.type){case "checkbox":return "inline";case "number":return e.renderAs==="rating"?"inline":"default";case "select":case "multiselect":return e.renderAs==="badges"?"inline":"popover";case "status":case "relation":case "user":case "date":return "popover";default:return "default"}}a($e,"resolveEditMode");function Ye(e){return e==="status"||e==="currency"}a(Ye,"isGroupableType");function ze(e){return e==="richtext"||e==="document"}a(ze,"isContentReadableType");function Q(e){return Object.prototype.hasOwnProperty.call(y,e)}a(Q,"hasFilterOperatorEntry");var f=y,We=["is_empty","is_not_empty"];function H(e){return We.includes(e)}a(H,"isNoValueOperator");function Zt(e){return C(e)}a(Zt,"getRollupFilterOperators");function R(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&"dynamic"in e}a(R,"isDynamicValue");function rr(){return {dynamic:"actor",ref:"current"}}a(rr,"currentActor");function or(){return {dynamic:"date",anchor:"today"}}a(or,"today");function nr(){return {dynamic:"date",anchor:"now"}}a(nr,"now");function X(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let r=Number(e);return Number.isFinite(r)?r:null}return null}a(X,"toAmount");function Z(e){return e!==null&&typeof e=="object"?"value"in e?X(e.value):null:X(e)}a(Z,"extractCurrencyFilterValue");function sr(e){return e==null?null:typeof e=="object"&&"value"in e?e.value??null:e}a(sr,"extractFilterValue");var Ke=new Set(["is_not","not_contains","none_of","is_empty"]),Je={is_not:"is",not_contains:"contains",none_of:"any_of",is_empty:"is_not_empty"};function ur(e){return Ke.has(e)?"none":"any"}a(ur,"getOperatorPolarity");function pr(e){return Je[e]??e}a(pr,"normalizeForEdgeRpc");var ee={is:"any_of",is_not:"none_of"};function dr(e){return ee[e]??e}a(dr,"toMultiValueOperator");var Ge=new Set(Object.values(ee).filter(e=>e!==void 0));function te(e){return Ge.has(e)}a(te,"isSetMembershipOperator");function re(e,r){let o=e.value;if(H(e.operator)||o==null||R(o))return;if(te(e.operator)){Array.isArray(o)||(e.value=[o]);return}if(r!=="currency")return;let i=Z(o);if(i!==null){e.value=i;return}if(!Qe(o))return;let a=`Filter on a currency attribute expected a numeric amount, received ${JSON.stringify(o)}`;throw new h(a,[{path:["value"],message:a}])}a(re,"canonicalizeFilterValue");function Qe(e){return typeof e!="object"?true:"value"in e?e.value!=null:false}a(Qe,"hasCurrencyAmount");var He={eq:"is",equals:"is",equal:"is","==":"is","=":"is",neq:"is_not",notEqual:"is_not",isNot:"is_not","!=":"is_not","<>":"is_not",lt:"less_than","<":"less_than",gt:"greater_than",">":"greater_than",lte:"less_or_equal","<=":"less_or_equal",gte:"greater_or_equal",">=":"greater_or_equal",in:"any_of",isAnyOf:"any_of",anyOf:"any_of",oneOf:"any_of",notIn:"none_of",not_in:"none_of",isNoneOf:"none_of",noneOf:"none_of",notOneOf:"none_of",startsWith:"starts_with",beginsWith:"starts_with",endsWith:"ends_with",doesNotContain:"not_contains",notContain:"not_contains",isEmpty:"is_empty",isNotEmpty:"is_not_empty"};function P(e){return He[e]??e}a(P,"normalizeOperator");function Rr(e){let r=P(e.operator);return r===e.operator?e:{...e,operator:r}}a(Rr,"normalizeFilterRule");var Xe=new Set(["days","weeks","months","years"]),Ze=new Set(["past","future"]);function v(e){if(typeof e!="object"||e===null)return false;let r=e;return typeof r.amount=="number"&&Number.isFinite(r.amount)&&r.amount>0&&typeof r.unit=="string"&&Xe.has(r.unit)&&typeof r.direction=="string"&&Ze.has(r.direction)}a(v,"isRelativeDateValue");function ne(e){return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}a(ne,"utcDayStart");function oe(e,r,o){if(o==="days")return e+r*864e5;if(o==="weeks")return e+r*7*864e5;let i=new Date(e),a=i.getUTCFullYear()+(o==="years"?r:0),s=i.getUTCMonth()+(o==="months"?r:0),l=new Date(Date.UTC(a,s+1,0)).getUTCDate();return Date.UTC(a,s,Math.min(i.getUTCDate(),l))}a(oe,"shiftUtcDay");function Er(e,r=new Date){if(!v(e))return null;let o=ne(r),i=Math.trunc(e.amount),a=e.direction==="past"?{startMs:oe(o,-i,e.unit),endMs:o+864e5}:{startMs:o,endMs:oe(o,i,e.unit)+864e5};return Number.isFinite(a.startMs)&&Number.isFinite(a.endMs)?a:null}a(Er,"resolveIsWithinBounds");function xr(e){if(!Number.isFinite(e))return null;let r=ne(new Date(e));return Number.isFinite(r)?{startMs:r,endMs:r+864e5}:null}a(xr,"resolveUtcDayBounds");function Fr(e){return new Date(e).toISOString().slice(0,10)}a(Fr,"toUtcDayString");var et=new Set(["relation","document","user"]),D=["is","is_not","any_of","none_of","is_empty","is_not_empty"],tt={id:D,objectId:D,tenantId:D,label:f.text,createdAt:f.date,updatedAt:f.date,deletedAt:f.date,createdBy:f.user,lastUpdatedBy:f.user},rt={id:"text",objectId:"text",objectName:"text",tenantId:"text",label:"text",createdAt:"date",updatedAt:"date",deletedAt:"date",deletedBy:"user",createdBy:"user",lastUpdatedBy:"user",visibility:"select",ownedBy:"user"},k={before:'"less_than"',after:'"greater_than"',on_or_before:'"less_or_equal"',on_or_after:'"greater_or_equal"',is_checked:'"is" with value true',is_not_checked:'"is" with value false',day_month_eq:'"on_day_month"'},ot=new Set(Object.entries(y).filter(([,e])=>e.includes("any_of")&&!e.includes("contains")).map(([e])=>e)),nt={contains:"any_of",not_contains:"none_of"};function I(e,r){let o=k[e];if(o){let s=`Unknown filter operator "${e}" \u2014 use ${o}`;throw new h(s,[{path:["operator"],message:s}])}let i=P(e),a=nt[i];if(a&&ot.has(r)){let s=`Operator "${i}" is not valid for type "${r}" \u2014 use "${a}"`;throw new h(s,[{path:["operator"],message:s}])}return i}a(I,"resolveCanonicalOperator");function ie(e,r,o){let i=I(e,r),a=f[r];if(!a?.includes(i)){let s=a?.length?a.join(", "):"(no operators registered for this type)",l=`Operator "${e}" is not valid for ${o} type "${r}". Valid operators: ${s}.`;throw new h(l,[{path:["operator"],message:l}])}return i}a(ie,"assertOperatorForType");function it(e){if(e.operator==="is_within"&&!v(e.value)){let r='Operator "is_within" requires a relative-date value { amount: positive number, unit: days|weeks|months|years, direction: past|future }';throw new h(r,[{path:["value"],message:r}])}}a(it,"assertRelativeDateValue");function O(e,r,o){e.operator=r,re(e,o),it(e);}a(O,"applyCanonicalForm");function ae(e,r){if(!R(e.value))return;let o=e.value;if(o.dynamic==="actor"&&r!=="user"){let i=`actor token (@me) is only valid on user attributes, not "${r}"`;throw new h(i,[{path:["value"],message:i}])}if(o.dynamic==="date"&&r!=="date"){let i=`date token (@today/@now) is only valid on date attributes, not "${r}"`;throw new h(i,[{path:["value"],message:i}])}}a(ae,"assertDynamicValueForAttribute");var V=x.map(e=>`"${e}"`).join(", ");function at(e){return e==="location"?` A location is filtered on one of its parts: set "property" to one of ${V} and use a text operator (e.g. contains).`:""}a(at,"locationPartsHint");function Mr(e,r){try{return st({...e},r),[]}catch(o){if(!(o instanceof h))throw o;return o.errors.map(i=>({...i,path:[...i.path]}))}}a(Mr,"collectQualifiedRuleIssues");function st(e,r){let o=r.attributes.find(c=>c.name===e.attribute),i=tt[e.attribute];if(!(o||i)){let[c,...u]=e.attribute.split("."),_=(u.length>0?r.attributes.find(T=>T.name===c):void 0)?.type==="location"?` Dotted paths are not supported \u2014 set "attribute" to "${c}" and "property" to ${F(u[0]??"")?`"${u[0]}"`:`one of ${V}`}.`:e.attribute.includes(".")?' Dotted paths are not supported \u2014 filter on the attribute name alone, or use the full-text "query" parameter to match text inside a value.':"",A=`Unknown attribute: ${e.attribute}${_}`;throw new h(A,[{path:["attribute"],message:A}])}if(e.quantifier!==void 0&&!e.property){let c='quantifier is only valid on qualified edge rules (set "property")';throw new h(c,[{path:["quantifier"],message:c}])}if(!o){if(e.property)throw new h(`Cannot qualify system attribute "${e.attribute}"`,[{path:["property"],message:`"${e.attribute}" is a system column, not a reference`}]);let c=rt[e.attribute]??"text",u=I(e.operator,c);if(!i.includes(u)){let h$1=`Operator "${e.operator}" is not valid for system attribute "${e.attribute}". Valid operators: ${i.join(", ")}.`;throw new h(h$1,[{path:["operator"],message:h$1}])}O(e,u,c);return}if(!e.property){ae(e,o.type);let c=J(o),u=I(e.operator,o.type);if(!c.includes(u)){let h$1=c.length?c.join(", "):"(not filterable)",_=`Operator "${e.operator}" is not valid for attribute "${o.name}". Valid operators: ${h$1}.${at(o.type)}`;throw new h(_,[{path:["operator"],message:_}])}O(e,u,w(o));return}if(o.type==="location"){if(e.quantifier!==void 0){let u="quantifier is not valid on a location part \u2014 a location is one value, not a set of edges";throw new h(u,[{path:["quantifier"],message:u}])}if(!F(e.property)){let u=`Property "${e.property}" is not a part of location "${e.attribute}". Valid parts: ${V}.`;throw new h(u,[{path:["property"],message:u}])}ae(e,"text");let c=ie(e.operator,"text","property");O(e,c,"text");return}if(!et.has(o.type))throw new h(`Cannot qualify ${o.type} attribute "${e.attribute}"`,[{path:["property"],message:`Attribute "${e.attribute}" is not a reference type`}]);let a=o.properties;if(!a)throw new h(`Attribute "${e.attribute}" has no qualifyWith schema`,[{path:["property"],message:`"${e.attribute}" has no qualifyWith`}]);let s=a.definitions.find(c=>c.name===e.property);if(!s)throw new h(`Property "${e.property}" not defined on "${e.attribute}".qualifyWith()`,[{path:["property"],message:`Unknown property: ${e.property}`}]);let l=ie(e.operator,s.type,"property");O(e,l,s.type);}a(st,"validateQualifiedRule");var se=64,le=1e4;function ce(e){let r=Object.getPrototypeOf(e);return r===Object.prototype||r===null}a(ce,"isPlainJsonObject");function m(e,r,o=[]){e.addIssue({code:"custom",message:r,path:o});}a(m,"addJsonIssue");function ct(e,r,o,i){for(let a of Reflect.ownKeys(e))if(a!=="length"){if(a==="__proto__"){m(i,"The __proto__ key is not allowed in custom props",[...r.path,a]);continue}(typeof a=="symbol"||!/^(0|[1-9]\d*)$/.test(a))&&m(i,"Arrays cannot contain non-index JSON properties",[...r.path,a]);}for(let a=e.length-1;a>=0;a--){let s=Object.getOwnPropertyDescriptor(e,String(a)),l=[...r.path,a];if(!(s&&"value"in s)){m(i,"Sparse arrays are not valid JSON values",l);continue}o.push({kind:"enter",value:s.value,path:l,depth:r.depth+1});}}a(ct,"pushJsonArrayChildren");function ut(e,r,o,i){let a=Reflect.ownKeys(e);for(let s=a.length-1;s>=0;s--){let l=a[s],c=[...r.path,l];if(l==="__proto__"){m(i,"The __proto__ key is not allowed in custom props",c);continue}if(typeof l=="symbol"){m(i,"Symbol keys are not valid JSON keys",c);continue}let u=Object.getOwnPropertyDescriptor(e,l);if(!(u?.enumerable&&"value"in u)){m(i,"Custom props must contain enumerable data properties only",c);continue}o.push({kind:"enter",value:u.value,path:c,depth:r.depth+1});}}a(ut,"pushJsonObjectChildren");function pt(e,r){if(e===null||typeof e!="object"){m(r,"Expected a plain JSON object");return}try{if(Array.isArray(e)||!ce(e)){m(r,"Expected a plain JSON object");return}}catch{m(r,"Custom props contain an object that cannot be safely inspected");return}let o=new WeakSet,i=[{kind:"enter",value:e,path:[],depth:0}],a=0;for(;i.length>0;){let s=i.pop();if(!s)break;if(s.kind==="exit"){o.delete(s.value);continue}if(a++,a>le){m(r,`Custom props cannot exceed ${le.toLocaleString("en-US")} total JSON nodes`,s.path);return}if(s.depth>se){m(r,`Custom props cannot exceed depth ${se}`,s.path);continue}let l=s.value;if(!(l===null||typeof l=="string"||typeof l=="boolean"||typeof l=="number"&&Number.isFinite(l))){if(typeof l!="object"){m(r,"Expected a JSON value",s.path);continue}if(o.has(l)){m(r,"Custom props cannot contain circular references",s.path);continue}try{if(Array.isArray(l)){o.add(l),i.push({kind:"exit",value:l}),ct(l,s,i,r);continue}if(!ce(l)){m(r,"Expected an array or plain JSON object",s.path);continue}o.add(l),i.push({kind:"exit",value:l}),ut(l,s,i,r);}catch{m(r,"Custom props contain an object that cannot be safely inspected",s.path);}}}}a(pt,"validateJsonProps");var ue=z$1.unknown().superRefine(pt).transform(e=>e);var Gr=z$1.array(z$1.string()).max(r.columnsPerTab),dt=z$1.array(z$1.string().min(1)).max(r.columnsPerTab).refine(e=>new Set(e).size===e.length,{message:"Displayed attribute names must be unique"}),mt=z$1.object({attribute:z$1.string().describe("Attribute to sort by"),direction:z$1.enum(["asc","desc"]).describe("asc or desc")}).strict(),bt=z$1.array(mt).max(r.sortsPerTab),yt=z$1.object({amount:z$1.number().describe("Count"),unit:z$1.enum(["days","weeks","months","years"]).describe("Unit"),direction:z$1.enum(["past","future"]).describe("Past or future")}).strict(),ft=z$1.object({value:z$1.number().nullable().describe("Amount"),code:z$1.array(z$1.string()).optional().describe("Currency codes")}).strict(),ht=z$1.object({phoneNumber:z$1.string().nullable().describe("Number"),countryCode:z$1.string().optional().describe("ISO country code")}).strict(),_t=z$1.discriminatedUnion("dynamic",[z$1.object({dynamic:z$1.literal("actor").describe("Resolved at filter time"),ref:z$1.literal("current").describe("The current actor")}).strict(),z$1.object({dynamic:z$1.literal("date").describe("Resolved at filter time"),anchor:z$1.enum(["today","now"]).describe("Anchor")}).strict()]),gt=z$1.object({month:z$1.number().describe("1-12"),day:z$1.number().describe("Day")}).strict(),At=z$1.union([z$1.string(),z$1.number(),z$1.boolean(),z$1.array(z$1.string()),yt,ft,ht,gt,_t,z$1.null()]),St=z$1.enum(["is","is_not","contains","not_contains","starts_with","ends_with","is_empty","is_not_empty","less_than","greater_than","less_or_equal","greater_or_equal","is_within","on_day_month","any_of","none_of"],{error:a(e=>{let r=e.input,o=typeof r=="string"?k[r]:void 0;return o?`Unknown filter operator "${r}" \u2014 use ${o}`:void 0},"error")}),Rt=z$1.object({attribute:z$1.string().describe("Attribute to filter on"),property:z$1.string().optional().describe("Qualified edge property"),quantifier:z$1.enum(["any","none"]).optional().describe("For a multi-value attribute"),operator:St.describe("Comparison"),value:At.describe("Comparison value, by attribute type")}).strict(),Ot=z$1.array(Rt).max(r.filterRulesPerTab),Tt=z$1.object({combinator:z$1.enum(["and","or"]).describe("Match every rule or any rule"),rules:Ot.describe("The rules")}).strict(),Et={span:z$1.union([z$1.literal(1),z$1.literal(2),z$1.literal(3),z$1.literal(4),z$1.literal(5),z$1.literal(6),z$1.literal(7),z$1.literal(8),z$1.literal(9),z$1.literal(10),z$1.literal(11),z$1.literal(12)]).optional().describe("Columns of 12 this field occupies"),label:z$1.string().optional().describe("Overrides the attribute's label"),readOnly:z$1.boolean().optional().describe("Shows the value, not editable")},xt=z$1.object({attribute:z$1.string().describe("Attribute API name shown by this field"),...Et}).strict(),Ft=z$1.object({name:z$1.string().describe("Group API name, unique in the form"),label:z$1.string().describe("Label people see"),description:z$1.string().optional().describe("Extra context under the label"),collapsible:z$1.boolean().optional().describe("Whether the group can be collapsed"),collapsed:z$1.boolean().optional().describe("Whether the group starts collapsed"),fields:z$1.array(xt).max(r.fieldsPerGroup).describe("Fields in this group, in order")}).strict();function pe(e,r$1){e.groups.reduce((s,l)=>s+l.fields.length,0)>r.fieldsPerFormTab&&r$1.addIssue({code:"too_big",origin:"array",maximum:r.fieldsPerFormTab,inclusive:true,message:`A form content can contain at most ${r.fieldsPerFormTab} fields`,path:["groups"]});let i=new Set,a=new Set;e.groups.forEach((s,l)=>{i.has(s.name)&&r$1.addIssue({code:"custom",message:`Duplicate group name "${s.name}"`,path:["groups",l,"name"]}),i.add(s.name),s.fields.forEach((c,u)=>{a.has(c.attribute)&&r$1.addIssue({code:"custom",message:`Duplicate field attribute "${c.attribute}"`,path:["groups",l,"fields",u,"attribute"]}),a.add(c.attribute);});});}a(pe,"refineFormContent");var b={name:z$1.string().describe("Content API name, unique in the view"),label:z$1.string().optional().describe("Label people see"),icon:t.optional().describe("Icon name"),placement:z$1.enum(["main","aside"]).describe("main: any tabs. aside: at most one, a form")},de=z$1.object({object:z$1.string().optional().describe("Every record of this object"),relation:z$1.string().optional().describe("Records linked through this relation")}).strict().superRefine((e,r)=>{e.object===void 0&&e.relation===void 0&&r.addIssue({code:"custom",message:"Collection source must define an object, a relation, or both"});}).transform(e=>e.relation===void 0?{object:e.object}:e.object===void 0?{relation:e.relation}:{object:e.object,relation:e.relation}),wt={...b,type:z$1.literal("collection"),source:de.describe("object: every record; relation: records linked to this record; both: records of object whose relation points at this record"),visibility:z$1.enum(d).optional().describe("all: no scope; workspace: every member; private: viewer's own"),columns:z$1.array(z$1.union([z$1.string(),z$1.object({relationProperty:z$1.string().refine(e=>e.trim().length>0).describe("Qualified edge property shown as a column")}).strict()])).max(r.columnsPerTab).optional().describe("Table columns, in order"),descriptionAttribute:z$1.string().optional().describe("Secondary line under each row's title (list layout)"),displayAttributes:dt.optional().describe("Attributes shown on each card"),filters:Tt.optional().describe("Restricts which records show"),sorts:bt.optional().describe("Sort order"),actions:z$1.enum(["create","update","delete","attach","detach"]).array().optional().describe("Offered actions; absent = every action, [] = none"),openMode:z$1.enum(["page","peek"]).optional().describe("page or peek (the record panel)"),createMode:z$1.enum(["page","peek","inline"]).optional().describe("page, peek, or inline (creates without opening)")},Ct=z$1.object({...wt,layout:z$1.enum(["table","list","kanban"]).describe("table columns, list cards, kanban board grouped by a select/status attribute"),columnSizing:z$1.record(z$1.string(),z$1.number()).optional().describe("Column widths in pixels, by attribute name"),groupByAttribute:z$1.string().optional().describe("Kanban only: the select or status attribute that names the columns"),kanbanColumnOrder:z$1.array(z$1.string()).optional().describe("Kanban: column order by option value"),kanbanColumnVisibility:z$1.record(z$1.string(),z$1.boolean()).optional().describe("Kanban: which columns are shown"),kanbanPinnedColumns:z$1.array(z$1.string()).optional().describe("Kanban: columns pinned first")}).strict().superRefine((e,r)=>{let o=["groupByAttribute","kanbanColumnOrder","kanbanColumnVisibility","kanbanPinnedColumns"];if(e.layout==="kanban"){e.groupByAttribute===void 0&&r.addIssue({code:"custom",path:["groupByAttribute"],message:"A kanban layout requires groupByAttribute"});return}for(let i of o)e[i]!==void 0&&r.addIssue({code:"custom",path:[i],message:"Only a kanban layout groups by an attribute"});}),j={...b,type:z$1.literal("form"),groups:z$1.array(Ft).max(r.groupsPerFormTab).describe("Field groups, in order"),formColumns:z$1.union([z$1.literal(1),z$1.literal(2),z$1.literal(3)]).optional().describe("Grid columns, 1-3"),density:z$1.enum(["compact","comfortable","spacious"]).optional().describe("Vertical spacing between fields")},Pt=z$1.object(j).strict().superRefine(pe),vt=z$1.object({...j,groups:j.groups.min(1,"A published form content requires at least one group")}).strict().superRefine(pe),me=[Ct,z$1.object({...b,type:z$1.literal("custom"),extension:z$1.string().describe("Name of a registered extension"),parameters:z$1.lazy(()=>ue).optional().describe("Extension parameters")}).strict(),z$1.object({...b,type:z$1.literal("activity")}).strict(),z$1.object({...b,type:z$1.literal("richtext"),attribute:z$1.string().describe("Richtext attribute edited in place"),titleAttribute:z$1.string().optional().describe("Text attribute shown as the title")}).strict(),z$1.object({...b,type:z$1.literal("documents"),allowUpload:z$1.boolean().optional().describe("Lets people add files here"),allowRemove:z$1.boolean().optional().describe("Lets people remove files here"),hideAttachments:z$1.boolean().optional().describe("Hides files attached elsewhere (e.g. emails)"),relations:z$1.array(z$1.string()).optional().describe("Document relations shown; the record's own files if absent")}).strict(),z$1.object({...b,type:z$1.literal("forms"),objectName:z$1.string().optional().describe("Limits to this object's published forms")}).strict(),z$1.object({...b,type:z$1.literal("emails"),emailAttributes:z$1.array(z$1.string()).max(r.emailAttributesPerTab).describe("Addresses")}).strict(),z$1.object({...b,type:z$1.literal("meetings"),emailAttributes:z$1.array(z$1.string()).max(r.emailAttributesPerTab).describe("Addresses")}).strict()],Dt=z$1.discriminatedUnion("type",[Pt,...me]),be=z$1.discriminatedUnion("type",[vt,...me]),ye={object:z$1.string(),name:z$1.string(),label:z$1.string(),description:z$1.string().optional(),icon:t.optional(),context:z$1.enum(["collection","record"]),default:z$1.boolean().optional()},It=z$1.object({...ye,contents:z$1.array(Dt).max(r.tabsPerView)}).strict(),Vt=z$1.object({...ye,contents:z$1.array(be).max(r.tabsPerView)}).strict();function fe(e,r){let o=new Set;e.contents.forEach((i,a)=>{o.has(i.name)&&r.addIssue({code:"custom",message:`Duplicate content name "${i.name}"`,path:["contents",a,"name"]}),o.add(i.name);});}a(fe,"addDuplicateContentNameIssues");function he(e,r){let o=e.contents.map((i,a)=>({content:i,index:a})).filter(({content:i})=>i.placement==="aside");o.length>1&&r.addIssue({code:"custom",path:["contents",o[1].index,"placement"],message:"Aside holds one content for now; put the others in main"});for(let{content:i,index:a}of o)i.type!=="form"&&r.addIssue({code:"custom",path:["contents",a,"type"],message:`Only a form content can sit in aside for now; put ${i.type} in main`});}a(he,"addAsideIssues");function kt({asideRule:e="enforce"}={}){return It.superRefine((r,o)=>{fe(r,o),e==="enforce"&&he(r,o);})}a(kt,"draftContentViewDefinitionSchemaFor");function jt({asideRule:e="enforce"}={}){return Vt.superRefine((r,o)=>{fe(r,o),r.contents.some(i=>i.placement==="main")||o.addIssue({code:"custom",message:"A published view requires at least one main content",path:["contents"]}),e==="enforce"&&he(r,o);})}a(jt,"contentViewDefinitionSchemaFor");var Mt=kt(),Lt=jt();export{sr as A,ur as B,pr as C,dr as D,te as E,re as F,He as G,P as H,Rr as I,v as J,Er as K,xr as L,Fr as M,rt as N,k as O,Mr as P,st as Q,Gr as R,dt as S,bt as T,Tt as U,de as V,be as W,kt as X,jt as Y,Mt as Z,Lt as _,Se as a,Nt as b,Re as c,qt as d,$ as e,x as f,F as g,Yt as h,y as i,g as j,J as k,zt as l,Wt as m,Kt as n,Jt as o,Gt as p,w as q,f as r,We as s,H as t,Zt as u,R as v,rr as w,or as x,nr as y,Z as z};
2
+ var Se={createdAt:"createdAt",updatedAt:"updatedAt",createdBy:"createdBy",lastUpdatedBy:"lastUpdatedBy",attachments:"attachments"};function Nt(e){return Se[e]}a(Nt,"getSystemAttributeI18nKey");var Re={createdAt:{id:"system:createdAt",name:"createdAt",label:"Created time",type:"date",required:false,system:true,icon:"clock-circle",description:"When this record was created"},updatedAt:{id:"system:updatedAt",name:"updatedAt",label:"Last edited time",type:"date",required:false,system:true,icon:"clock-circle",description:"When this record was last modified"},createdBy:{id:"system:createdBy",name:"createdBy",label:"Created by",type:"user",required:false,system:true,multiple:false,icon:"user",description:"Actor who created this record"},lastUpdatedBy:{id:"system:lastUpdatedBy",name:"lastUpdatedBy",label:"Last edited by",type:"user",required:false,system:true,multiple:false,icon:"user",description:"Actor who last modified this record"},attachments:{id:"system:attachments",name:"attachments",label:"Attachments",type:"document",required:false,system:true,hidden:true,icon:"paperclip",description:"Free-form document attachments"}};function qt(){return Object.values(Re)}a(qt,"getSystemAttributeList");function $(e){return e.id?.startsWith("system:")??false}a($,"isManagedSystemAttribute");var K=["is","is_not","contains","not_contains","starts_with","ends_with","is_empty","is_not_empty"],Y=["is","is_not","less_than","greater_than","less_or_equal","greater_or_equal","is_empty","is_not_empty"],Oe=["is"],Te=["is","is_not","less_than","greater_than","less_or_equal","greater_or_equal","is_within","on_day_month","is_empty","is_not_empty"],z=["is","is_not","any_of","none_of","is_empty","is_not_empty"],Ee=["any_of","none_of","is_empty","is_not_empty"],W=["is","is_not","any_of","none_of","is_empty","is_not_empty"],xe=["is_empty","is_not_empty"],Fe=["is","is_not","less_than","greater_than","less_or_equal","greater_or_equal","contains","not_contains","is_empty","is_not_empty"],x=["city","postalCode","country"];function F(e){return x.includes(e)}a(F,"isLocationFilterProperty");function Yt(e){return K.includes(e)}a(Yt,"isLocationPartOperator");var y={text:K,richtext:[],number:Y,checkbox:Oe,date:Te,phone:["is","is_not","contains","not_contains","starts_with","is_empty","is_not_empty"],currency:Y,status:z,select:z,multiselect:Ee,location:[],user:W,relation:W,formula:Fe,document:xe},we=new Set(["formula","rollup"]),Ce=new Set(["user","relation","document"]),Pe=new Set(["text","richtext","number","select","multiselect","status","date","phone","currency","location","user","relation","document"]),ve=new Set(["text","number","date","phone","currency","select","multiselect"]),De=new Set(["text","phone","status","select","multiselect"]),Ie=new Set(["text","number","checkbox","date","phone","currency","status","select"]);function g(e){let r=!!(e.hidden||e.archived),o=!e.archived,i=we.has(e.type),a=e.type==="document",s=Ce.has(e.type),l=ke(e),c=r?[]:Ve(e),u=c.length>0&&!r,h=!r&&De.has(e.type),_=!r&&Ie.has(e.type),A=!r&&Ye(e.type),T=!r&&e.type==="status",_e=$(e),M=i||a||_e,E=!(r||M),ge=Ne(e.type)?"forbidden":"allowed",Ae=qe(e.type),L=Me(e),N=ve.has(e.type),q=!!(e.deprecated&&!r),B=$e(e);return {lifecycle:{active:o,deprecated:!!e.deprecated,visibleInArchitect:true,visibleInRuntime:!r,warningWhenDeprecated:q},storage:{mode:i?"computed":s?"edge":"value",cardinality:l,edgeBacked:s,preservesExistingValues:!!e.archived,qualifiedProperties:Le(e.type),polymorphic:je(e),maxItems:L},authoring:{editable:E,readOnly:M,directEdit:E&&B==="inline",required:ge,defaultValue:Ae,placeholder:N,maxItems:L},presentation:{formField:!r&&Ue(e.type),tableCell:!r&&G(e.type),defaultColumn:!r&&Be(e.type),compactDisplay:!r,popoverEditor:!r&&B==="popover",placeholder:N,warningWhenDeprecated:q},query:{filterable:u,searchable:h,sortable:_,groupable:A,kanbanGroupable:T,operators:c},agent:{readable:!r,writable:E&&!a,compactReadable:!r,contentReadable:!r&&ze(e.type),requiresDedicatedTool:a},exchange:{importable:!r,exportable:!r,schemaExportable:true,metadataExportable:false}}}a(g,"getAttributeCapabilities");function J(e){return g(e).query.operators}a(J,"getAttributeFilterOperators");function zt(e){return g(e).query.filterable}a(zt,"isAttributeFilterable");function Wt(e){return g(e).query.searchable}a(Wt,"isAttributeSearchable");function Kt(e){return g(e).query.sortable}a(Kt,"isAttributeSortable");function Jt(e){return g(e).query.groupable}a(Jt,"isAttributeGroupable");function Gt(e){return g(e).query.kanbanGroupable}a(Gt,"isAttributeKanbanGroupable");function w(e){if(e.type!=="rollup")return e.type;let r=e;if(r.function==="earliest"||r.function==="latest")return "date";if(r.function==="original"){let o=r.targetAttributeType;if(o&&Q(o))return o}return "number"}a(w,"resolveEffectiveFilterType");function C(e){let r=w(e);return Q(r)?y[r]:y.number}a(C,"getRollupFilterOperators");function Ve(e){return e.type==="rollup"?C(e):y[e.type]??[]}a(Ve,"getRawFilterOperators");function ke(e){return e.type==="multiselect"||e.type==="document"||e.type==="user"&&e.multiple===true||e.type==="relation"&&e.cardinality==="many"?"many":"one"}a(ke,"getAttributeCardinality");function je(e){if(e.type!=="relation")return "none";let o=e.targets??[];return o.length===1&&o[0]?.object==="*"?"internal":o.length>1?"code-only":"none"}a(je,"getPolymorphicCapability");function Me(e){return e.type==="multiselect"?true:e.type==="relation"?e.cardinality==="many":false}a(Me,"supportsMaxItems");function Le(e){return e==="relation"||e==="document"}a(Le,"supportsQualifiedProperties");function Ne(e){return e==="checkbox"||e==="formula"||e==="rollup"}a(Ne,"isRequiredForbidden");function qe(e){return e==="checkbox"?"automatic":e==="formula"||e==="rollup"?"forbidden":Pe.has(e)?"static":"forbidden"}a(qe,"getDefaultValueCapability");function Be(e){return G(e)}a(Be,"isDefaultColumnType");function G(e){return e!=="richtext"&&e!=="document"}a(G,"isTableCellType");function Ue(e){return e!=="richtext"}a(Ue,"isFormFieldType");function $e(e){switch(e.type){case "checkbox":return "inline";case "number":return e.renderAs==="rating"?"inline":"default";case "select":case "multiselect":return e.renderAs==="badges"?"inline":"popover";case "status":case "relation":case "user":case "date":return "popover";default:return "default"}}a($e,"resolveEditMode");function Ye(e){return e==="status"||e==="currency"}a(Ye,"isGroupableType");function ze(e){return e==="richtext"||e==="document"}a(ze,"isContentReadableType");function Q(e){return Object.prototype.hasOwnProperty.call(y,e)}a(Q,"hasFilterOperatorEntry");var f=y,We=["is_empty","is_not_empty"];function H(e){return We.includes(e)}a(H,"isNoValueOperator");function Zt(e){return C(e)}a(Zt,"getRollupFilterOperators");function R(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)&&"dynamic"in e}a(R,"isDynamicValue");function rr(){return {dynamic:"actor",ref:"current"}}a(rr,"currentActor");function or(){return {dynamic:"date",anchor:"today"}}a(or,"today");function nr(){return {dynamic:"date",anchor:"now"}}a(nr,"now");function X(e){if(typeof e=="number")return Number.isFinite(e)?e:null;if(typeof e=="string"&&e.trim()!==""){let r=Number(e);return Number.isFinite(r)?r:null}return null}a(X,"toAmount");function Z(e){return e!==null&&typeof e=="object"?"value"in e?X(e.value):null:X(e)}a(Z,"extractCurrencyFilterValue");function sr(e){return e==null?null:typeof e=="object"&&"value"in e?e.value??null:e}a(sr,"extractFilterValue");var Ke=new Set(["is_not","not_contains","none_of","is_empty"]),Je={is_not:"is",not_contains:"contains",none_of:"any_of",is_empty:"is_not_empty"};function ur(e){return Ke.has(e)?"none":"any"}a(ur,"getOperatorPolarity");function pr(e){return Je[e]??e}a(pr,"normalizeForEdgeRpc");var ee={is:"any_of",is_not:"none_of"};function dr(e){return ee[e]??e}a(dr,"toMultiValueOperator");var Ge=new Set(Object.values(ee).filter(e=>e!==void 0));function te(e){return Ge.has(e)}a(te,"isSetMembershipOperator");function re(e,r){let o=e.value;if(H(e.operator)||o==null||R(o))return;if(te(e.operator)){Array.isArray(o)||(e.value=[o]);return}if(r!=="currency")return;let i=Z(o);if(i!==null){e.value=i;return}if(!Qe(o))return;let a=`Filter on a currency attribute expected a numeric amount, received ${JSON.stringify(o)}`;throw new h(a,[{path:["value"],message:a}])}a(re,"canonicalizeFilterValue");function Qe(e){return typeof e!="object"?true:"value"in e?e.value!=null:false}a(Qe,"hasCurrencyAmount");var He={eq:"is",equals:"is",equal:"is","==":"is","=":"is",neq:"is_not",notEqual:"is_not",isNot:"is_not","!=":"is_not","<>":"is_not",lt:"less_than","<":"less_than",gt:"greater_than",">":"greater_than",lte:"less_or_equal","<=":"less_or_equal",gte:"greater_or_equal",">=":"greater_or_equal",in:"any_of",isAnyOf:"any_of",anyOf:"any_of",oneOf:"any_of",notIn:"none_of",not_in:"none_of",isNoneOf:"none_of",noneOf:"none_of",notOneOf:"none_of",startsWith:"starts_with",beginsWith:"starts_with",endsWith:"ends_with",doesNotContain:"not_contains",notContain:"not_contains",isEmpty:"is_empty",isNotEmpty:"is_not_empty"};function P(e){return He[e]??e}a(P,"normalizeOperator");function Rr(e){let r=P(e.operator);return r===e.operator?e:{...e,operator:r}}a(Rr,"normalizeFilterRule");var Xe=new Set(["days","weeks","months","years"]),Ze=new Set(["past","future"]);function v(e){if(typeof e!="object"||e===null)return false;let r=e;return typeof r.amount=="number"&&Number.isFinite(r.amount)&&r.amount>0&&typeof r.unit=="string"&&Xe.has(r.unit)&&typeof r.direction=="string"&&Ze.has(r.direction)}a(v,"isRelativeDateValue");function ne(e){return Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate())}a(ne,"utcDayStart");function oe(e,r,o){if(o==="days")return e+r*864e5;if(o==="weeks")return e+r*7*864e5;let i=new Date(e),a=i.getUTCFullYear()+(o==="years"?r:0),s=i.getUTCMonth()+(o==="months"?r:0),l=new Date(Date.UTC(a,s+1,0)).getUTCDate();return Date.UTC(a,s,Math.min(i.getUTCDate(),l))}a(oe,"shiftUtcDay");function Er(e,r=new Date){if(!v(e))return null;let o=ne(r),i=Math.trunc(e.amount),a=e.direction==="past"?{startMs:oe(o,-i,e.unit),endMs:o+864e5}:{startMs:o,endMs:oe(o,i,e.unit)+864e5};return Number.isFinite(a.startMs)&&Number.isFinite(a.endMs)?a:null}a(Er,"resolveIsWithinBounds");function xr(e){if(!Number.isFinite(e))return null;let r=ne(new Date(e));return Number.isFinite(r)?{startMs:r,endMs:r+864e5}:null}a(xr,"resolveUtcDayBounds");function Fr(e){return new Date(e).toISOString().slice(0,10)}a(Fr,"toUtcDayString");var et=new Set(["relation","document","user"]),D=["is","is_not","any_of","none_of","is_empty","is_not_empty"],tt={id:D,objectId:D,tenantId:D,label:f.text,createdAt:f.date,updatedAt:f.date,deletedAt:f.date,createdBy:f.user,lastUpdatedBy:f.user},rt={id:"text",objectId:"text",objectName:"text",tenantId:"text",label:"text",createdAt:"date",updatedAt:"date",deletedAt:"date",deletedBy:"user",createdBy:"user",lastUpdatedBy:"user",visibility:"select",ownedBy:"user"},k={before:'"less_than"',after:'"greater_than"',on_or_before:'"less_or_equal"',on_or_after:'"greater_or_equal"',is_checked:'"is" with value true',is_not_checked:'"is" with value false',day_month_eq:'"on_day_month"'},ot=new Set(Object.entries(y).filter(([,e])=>e.includes("any_of")&&!e.includes("contains")).map(([e])=>e)),nt={contains:"any_of",not_contains:"none_of"};function I(e,r){let o=k[e];if(o){let s=`Unknown filter operator "${e}" \u2014 use ${o}`;throw new h(s,[{path:["operator"],message:s}])}let i=P(e),a=nt[i];if(a&&ot.has(r)){let s=`Operator "${i}" is not valid for type "${r}" \u2014 use "${a}"`;throw new h(s,[{path:["operator"],message:s}])}return i}a(I,"resolveCanonicalOperator");function ie(e,r,o){let i=I(e,r),a=f[r];if(!a?.includes(i)){let s=a?.length?a.join(", "):"(no operators registered for this type)",l=`Operator "${e}" is not valid for ${o} type "${r}". Valid operators: ${s}.`;throw new h(l,[{path:["operator"],message:l}])}return i}a(ie,"assertOperatorForType");function it(e){if(e.operator==="is_within"&&!v(e.value)){let r='Operator "is_within" requires a relative-date value { amount: positive number, unit: days|weeks|months|years, direction: past|future }';throw new h(r,[{path:["value"],message:r}])}}a(it,"assertRelativeDateValue");function O(e,r,o){e.operator=r,re(e,o),it(e);}a(O,"applyCanonicalForm");function ae(e,r){if(!R(e.value))return;let o=e.value;if(o.dynamic==="actor"&&r!=="user"){let i=`actor token (@me) is only valid on user attributes, not "${r}"`;throw new h(i,[{path:["value"],message:i}])}if(o.dynamic==="date"&&r!=="date"){let i=`date token (@today/@now) is only valid on date attributes, not "${r}"`;throw new h(i,[{path:["value"],message:i}])}}a(ae,"assertDynamicValueForAttribute");var V=x.map(e=>`"${e}"`).join(", ");function at(e){return e==="location"?` A location is filtered on one of its parts: set "property" to one of ${V} and use a text operator (e.g. contains).`:""}a(at,"locationPartsHint");function Mr(e,r){try{return st({...e},r),[]}catch(o){if(!(o instanceof h))throw o;return o.errors.map(i=>({...i,path:[...i.path]}))}}a(Mr,"collectQualifiedRuleIssues");function st(e,r){let o=r.attributes.find(c=>c.name===e.attribute),i=tt[e.attribute];if(!(o||i)){let[c,...u]=e.attribute.split("."),_=(u.length>0?r.attributes.find(T=>T.name===c):void 0)?.type==="location"?` Dotted paths are not supported \u2014 set "attribute" to "${c}" and "property" to ${F(u[0]??"")?`"${u[0]}"`:`one of ${V}`}.`:e.attribute.includes(".")?' Dotted paths are not supported \u2014 filter on the attribute name alone, or use the full-text "query" parameter to match text inside a value.':"",A=`Unknown attribute: ${e.attribute}${_}`;throw new h(A,[{path:["attribute"],message:A}])}if(e.quantifier!==void 0&&!e.property){let c='quantifier is only valid on qualified edge rules (set "property")';throw new h(c,[{path:["quantifier"],message:c}])}if(!o){if(e.property)throw new h(`Cannot qualify system attribute "${e.attribute}"`,[{path:["property"],message:`"${e.attribute}" is a system column, not a reference`}]);let c=rt[e.attribute]??"text",u=I(e.operator,c);if(!i.includes(u)){let h$1=`Operator "${e.operator}" is not valid for system attribute "${e.attribute}". Valid operators: ${i.join(", ")}.`;throw new h(h$1,[{path:["operator"],message:h$1}])}O(e,u,c);return}if(!e.property){ae(e,o.type);let c=J(o),u=I(e.operator,o.type);if(!c.includes(u)){let h$1=c.length?c.join(", "):"(not filterable)",_=`Operator "${e.operator}" is not valid for attribute "${o.name}". Valid operators: ${h$1}.${at(o.type)}`;throw new h(_,[{path:["operator"],message:_}])}O(e,u,w(o));return}if(o.type==="location"){if(e.quantifier!==void 0){let u="quantifier is not valid on a location part \u2014 a location is one value, not a set of edges";throw new h(u,[{path:["quantifier"],message:u}])}if(!F(e.property)){let u=`Property "${e.property}" is not a part of location "${e.attribute}". Valid parts: ${V}.`;throw new h(u,[{path:["property"],message:u}])}ae(e,"text");let c=ie(e.operator,"text","property");O(e,c,"text");return}if(!et.has(o.type))throw new h(`Cannot qualify ${o.type} attribute "${e.attribute}"`,[{path:["property"],message:`Attribute "${e.attribute}" is not a reference type`}]);let a=o.properties;if(!a)throw new h(`Attribute "${e.attribute}" has no qualifyWith schema`,[{path:["property"],message:`"${e.attribute}" has no qualifyWith`}]);let s=a.definitions.find(c=>c.name===e.property);if(!s)throw new h(`Property "${e.property}" not defined on "${e.attribute}".qualifyWith()`,[{path:["property"],message:`Unknown property: ${e.property}`}]);let l=ie(e.operator,s.type,"property");O(e,l,s.type);}a(st,"validateQualifiedRule");var se=64,le=1e4;function ce(e){let r=Object.getPrototypeOf(e);return r===null||r===Object.prototype?true:Object.getPrototypeOf(r)===null&&r.constructor?.name==="Object"}a(ce,"isPlainJsonObject");function m(e,r,o=[]){e.addIssue({code:"custom",message:r,path:o});}a(m,"addJsonIssue");function ct(e,r,o,i){for(let a of Reflect.ownKeys(e))if(a!=="length"){if(a==="__proto__"){m(i,"The __proto__ key is not allowed in custom props",[...r.path,a]);continue}(typeof a=="symbol"||!/^(0|[1-9]\d*)$/.test(a))&&m(i,"Arrays cannot contain non-index JSON properties",[...r.path,a]);}for(let a=e.length-1;a>=0;a--){let s=Object.getOwnPropertyDescriptor(e,String(a)),l=[...r.path,a];if(!(s&&"value"in s)){m(i,"Sparse arrays are not valid JSON values",l);continue}o.push({kind:"enter",value:s.value,path:l,depth:r.depth+1});}}a(ct,"pushJsonArrayChildren");function ut(e,r,o,i){let a=Reflect.ownKeys(e);for(let s=a.length-1;s>=0;s--){let l=a[s],c=[...r.path,l];if(l==="__proto__"){m(i,"The __proto__ key is not allowed in custom props",c);continue}if(typeof l=="symbol"){m(i,"Symbol keys are not valid JSON keys",c);continue}let u=Object.getOwnPropertyDescriptor(e,l);if(!(u?.enumerable&&"value"in u)){m(i,"Custom props must contain enumerable data properties only",c);continue}o.push({kind:"enter",value:u.value,path:c,depth:r.depth+1});}}a(ut,"pushJsonObjectChildren");function pt(e,r){if(e===null||typeof e!="object"){m(r,"Expected a plain JSON object");return}try{if(Array.isArray(e)||!ce(e)){m(r,"Expected a plain JSON object");return}}catch{m(r,"Custom props contain an object that cannot be safely inspected");return}let o=new WeakSet,i=[{kind:"enter",value:e,path:[],depth:0}],a=0;for(;i.length>0;){let s=i.pop();if(!s)break;if(s.kind==="exit"){o.delete(s.value);continue}if(a++,a>le){m(r,`Custom props cannot exceed ${le.toLocaleString("en-US")} total JSON nodes`,s.path);return}if(s.depth>se){m(r,`Custom props cannot exceed depth ${se}`,s.path);continue}let l=s.value;if(!(l===null||typeof l=="string"||typeof l=="boolean"||typeof l=="number"&&Number.isFinite(l))){if(typeof l!="object"){m(r,"Expected a JSON value",s.path);continue}if(o.has(l)){m(r,"Custom props cannot contain circular references",s.path);continue}try{if(Array.isArray(l)){o.add(l),i.push({kind:"exit",value:l}),ct(l,s,i,r);continue}if(!ce(l)){m(r,"Expected an array or plain JSON object",s.path);continue}o.add(l),i.push({kind:"exit",value:l}),ut(l,s,i,r);}catch{m(r,"Custom props contain an object that cannot be safely inspected",s.path);}}}}a(pt,"validateJsonProps");var ue=z$1.unknown().superRefine(pt).transform(e=>e);var Gr=z$1.array(z$1.string()).max(r.columnsPerTab),dt=z$1.array(z$1.string().min(1)).max(r.columnsPerTab).refine(e=>new Set(e).size===e.length,{message:"Displayed attribute names must be unique"}),mt=z$1.object({attribute:z$1.string().describe("Attribute to sort by"),direction:z$1.enum(["asc","desc"]).describe("asc or desc")}).strict(),bt=z$1.array(mt).max(r.sortsPerTab),yt=z$1.object({amount:z$1.number().describe("Count"),unit:z$1.enum(["days","weeks","months","years"]).describe("Unit"),direction:z$1.enum(["past","future"]).describe("Past or future")}).strict(),ft=z$1.object({value:z$1.number().nullable().describe("Amount"),code:z$1.array(z$1.string()).optional().describe("Currency codes")}).strict(),ht=z$1.object({phoneNumber:z$1.string().nullable().describe("Number"),countryCode:z$1.string().optional().describe("ISO country code")}).strict(),_t=z$1.discriminatedUnion("dynamic",[z$1.object({dynamic:z$1.literal("actor").describe("Resolved at filter time"),ref:z$1.literal("current").describe("The current actor")}).strict(),z$1.object({dynamic:z$1.literal("date").describe("Resolved at filter time"),anchor:z$1.enum(["today","now"]).describe("Anchor")}).strict()]),gt=z$1.object({month:z$1.number().describe("1-12"),day:z$1.number().describe("Day")}).strict(),At=z$1.union([z$1.string(),z$1.number(),z$1.boolean(),z$1.array(z$1.string()),yt,ft,ht,gt,_t,z$1.null()]),St=z$1.enum(["is","is_not","contains","not_contains","starts_with","ends_with","is_empty","is_not_empty","less_than","greater_than","less_or_equal","greater_or_equal","is_within","on_day_month","any_of","none_of"],{error:a(e=>{let r=e.input,o=typeof r=="string"?k[r]:void 0;return o?`Unknown filter operator "${r}" \u2014 use ${o}`:void 0},"error")}),Rt=z$1.object({attribute:z$1.string().describe("Attribute to filter on"),property:z$1.string().optional().describe("Qualified edge property"),quantifier:z$1.enum(["any","none"]).optional().describe("For a multi-value attribute"),operator:St.describe("Comparison"),value:At.describe("Comparison value, by attribute type")}).strict(),Ot=z$1.array(Rt).max(r.filterRulesPerTab),Tt=z$1.object({combinator:z$1.enum(["and","or"]).describe("Match every rule or any rule"),rules:Ot.describe("The rules")}).strict(),Et={span:z$1.union([z$1.literal(1),z$1.literal(2),z$1.literal(3),z$1.literal(4),z$1.literal(5),z$1.literal(6),z$1.literal(7),z$1.literal(8),z$1.literal(9),z$1.literal(10),z$1.literal(11),z$1.literal(12)]).optional().describe("Columns of 12 this field occupies"),label:z$1.string().optional().describe("Overrides the attribute's label"),readOnly:z$1.boolean().optional().describe("Shows the value, not editable")},xt=z$1.object({attribute:z$1.string().describe("Attribute API name shown by this field"),...Et}).strict(),Ft=z$1.object({name:z$1.string().describe("Group API name, unique in the form"),label:z$1.string().describe("Label people see"),description:z$1.string().optional().describe("Extra context under the label"),collapsible:z$1.boolean().optional().describe("Whether the group can be collapsed"),collapsed:z$1.boolean().optional().describe("Whether the group starts collapsed"),fields:z$1.array(xt).max(r.fieldsPerGroup).describe("Fields in this group, in order")}).strict();function pe(e,r$1){e.groups.reduce((s,l)=>s+l.fields.length,0)>r.fieldsPerFormTab&&r$1.addIssue({code:"too_big",origin:"array",maximum:r.fieldsPerFormTab,inclusive:true,message:`A form content can contain at most ${r.fieldsPerFormTab} fields`,path:["groups"]});let i=new Set,a=new Set;e.groups.forEach((s,l)=>{i.has(s.name)&&r$1.addIssue({code:"custom",message:`Duplicate group name "${s.name}"`,path:["groups",l,"name"]}),i.add(s.name),s.fields.forEach((c,u)=>{a.has(c.attribute)&&r$1.addIssue({code:"custom",message:`Duplicate field attribute "${c.attribute}"`,path:["groups",l,"fields",u,"attribute"]}),a.add(c.attribute);});});}a(pe,"refineFormContent");var b={name:z$1.string().describe("Content API name, unique in the view"),label:z$1.string().optional().describe("Label people see"),icon:t.optional().describe("Icon name"),placement:z$1.enum(["main","aside"]).describe("main: any tabs. aside: at most one, a form")},de=z$1.object({object:z$1.string().optional().describe("Every record of this object"),relation:z$1.string().optional().describe("Records linked through this relation")}).strict().superRefine((e,r)=>{e.object===void 0&&e.relation===void 0&&r.addIssue({code:"custom",message:"Collection source must define an object, a relation, or both"});}).transform(e=>e.relation===void 0?{object:e.object}:e.object===void 0?{relation:e.relation}:{object:e.object,relation:e.relation}),wt={...b,type:z$1.literal("collection"),source:de.describe("object: every record; relation: records linked to this record; both: records of object whose relation points at this record"),visibility:z$1.enum(d).optional().describe("all: no scope; workspace: every member; private: viewer's own"),columns:z$1.array(z$1.union([z$1.string(),z$1.object({relationProperty:z$1.string().refine(e=>e.trim().length>0).describe("Qualified edge property shown as a column")}).strict()])).max(r.columnsPerTab).optional().describe("Table columns, in order"),descriptionAttribute:z$1.string().optional().describe("Secondary line under each row's title (list layout)"),displayAttributes:dt.optional().describe("Attributes shown on each card"),filters:Tt.optional().describe("Restricts which records show"),sorts:bt.optional().describe("Sort order"),actions:z$1.enum(["create","update","delete","attach","detach"]).array().optional().describe("Offered actions; absent = every action, [] = none"),openMode:z$1.enum(["page","peek"]).optional().describe("page or peek (the record panel)"),createMode:z$1.enum(["page","peek","inline"]).optional().describe("page, peek, or inline (creates without opening)")},Ct=z$1.object({...wt,layout:z$1.enum(["table","list","kanban"]).describe("table columns, list cards, kanban board grouped by a select/status attribute"),columnSizing:z$1.record(z$1.string(),z$1.number()).optional().describe("Column widths in pixels, by attribute name"),groupByAttribute:z$1.string().optional().describe("Kanban only: the select or status attribute that names the columns"),kanbanColumnOrder:z$1.array(z$1.string()).optional().describe("Kanban: column order by option value"),kanbanColumnVisibility:z$1.record(z$1.string(),z$1.boolean()).optional().describe("Kanban: which columns are shown"),kanbanPinnedColumns:z$1.array(z$1.string()).optional().describe("Kanban: columns pinned first")}).strict().superRefine((e,r)=>{let o=["groupByAttribute","kanbanColumnOrder","kanbanColumnVisibility","kanbanPinnedColumns"];if(e.layout==="kanban"){e.groupByAttribute===void 0&&r.addIssue({code:"custom",path:["groupByAttribute"],message:"A kanban layout requires groupByAttribute"});return}for(let i of o)e[i]!==void 0&&r.addIssue({code:"custom",path:[i],message:"Only a kanban layout groups by an attribute"});}),j={...b,type:z$1.literal("form"),groups:z$1.array(Ft).max(r.groupsPerFormTab).describe("Field groups, in order"),formColumns:z$1.union([z$1.literal(1),z$1.literal(2),z$1.literal(3)]).optional().describe("Grid columns, 1-3"),density:z$1.enum(["compact","comfortable","spacious"]).optional().describe("Vertical spacing between fields")},Pt=z$1.object(j).strict().superRefine(pe),vt=z$1.object({...j,groups:j.groups.min(1,"A published form content requires at least one group")}).strict().superRefine(pe),me=[Ct,z$1.object({...b,type:z$1.literal("custom"),extension:z$1.string().describe("Name of a registered extension"),parameters:z$1.lazy(()=>ue).optional().describe("Extension parameters")}).strict(),z$1.object({...b,type:z$1.literal("activity")}).strict(),z$1.object({...b,type:z$1.literal("richtext"),attribute:z$1.string().describe("Richtext attribute edited in place"),titleAttribute:z$1.string().optional().describe("Text attribute shown as the title")}).strict(),z$1.object({...b,type:z$1.literal("documents"),allowUpload:z$1.boolean().optional().describe("Lets people add files here"),allowRemove:z$1.boolean().optional().describe("Lets people remove files here"),hideAttachments:z$1.boolean().optional().describe("Hides files attached elsewhere (e.g. emails)"),relations:z$1.array(z$1.string()).optional().describe("Document relations shown; the record's own files if absent")}).strict(),z$1.object({...b,type:z$1.literal("forms"),objectName:z$1.string().optional().describe("Limits to this object's published forms")}).strict(),z$1.object({...b,type:z$1.literal("emails"),emailAttributes:z$1.array(z$1.string()).max(r.emailAttributesPerTab).describe("Addresses")}).strict(),z$1.object({...b,type:z$1.literal("meetings"),emailAttributes:z$1.array(z$1.string()).max(r.emailAttributesPerTab).describe("Addresses")}).strict()],Dt=z$1.discriminatedUnion("type",[Pt,...me]),be=z$1.discriminatedUnion("type",[vt,...me]),ye={object:z$1.string(),name:z$1.string(),label:z$1.string(),description:z$1.string().optional(),icon:t.optional(),context:z$1.enum(["collection","record"]),default:z$1.boolean().optional()},It=z$1.object({...ye,contents:z$1.array(Dt).max(r.tabsPerView)}).strict(),Vt=z$1.object({...ye,contents:z$1.array(be).max(r.tabsPerView)}).strict();function fe(e,r){let o=new Set;e.contents.forEach((i,a)=>{o.has(i.name)&&r.addIssue({code:"custom",message:`Duplicate content name "${i.name}"`,path:["contents",a,"name"]}),o.add(i.name);});}a(fe,"addDuplicateContentNameIssues");function he(e,r){let o=e.contents.map((i,a)=>({content:i,index:a})).filter(({content:i})=>i.placement==="aside");o.length>1&&r.addIssue({code:"custom",path:["contents",o[1].index,"placement"],message:"Aside holds one content for now; put the others in main"});for(let{content:i,index:a}of o)i.type!=="form"&&r.addIssue({code:"custom",path:["contents",a,"type"],message:`Only a form content can sit in aside for now; put ${i.type} in main`});}a(he,"addAsideIssues");function kt({asideRule:e="enforce"}={}){return It.superRefine((r,o)=>{fe(r,o),e==="enforce"&&he(r,o);})}a(kt,"draftContentViewDefinitionSchemaFor");function jt({asideRule:e="enforce"}={}){return Vt.superRefine((r,o)=>{fe(r,o),r.contents.some(i=>i.placement==="main")||o.addIssue({code:"custom",message:"A published view requires at least one main content",path:["contents"]}),e==="enforce"&&he(r,o);})}a(jt,"contentViewDefinitionSchemaFor");var Mt=kt(),Lt=jt();export{sr as A,ur as B,pr as C,dr as D,te as E,re as F,He as G,P as H,Rr as I,v as J,Er as K,xr as L,Fr as M,rt as N,k as O,Mr as P,st as Q,Gr as R,dt as S,bt as T,Tt as U,de as V,be as W,kt as X,jt as Y,Mt as Z,Lt as _,Se as a,Nt as b,Re as c,qt as d,$ as e,x as f,F as g,Yt as h,y as i,g as j,J as k,zt as l,Wt as m,Kt as n,Jt as o,Gt as p,w as q,f as r,We as s,H as t,Zt as u,R as v,rr as w,or as x,nr as y,Z as z};