@vcp-dev/contracts 0.6.5 → 0.6.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{z as e}from"zod";var pt=["queued","preparing_source","building","artifact_ready","deploying","released","lock_failed","source_prepare_failed","build_failed","artifact_fetch_failed","artifact_validation_failed","deploy_failed","cleanup_failed"];function fr(t){let n=t.VCP_REDIS_URL??t.REDIS_URL;if(n){let a=new URL(n);return{url:n,host:a.hostname,port:a.port?Number(a.port):6379,password:a.password?decodeURIComponent(a.password):void 0}}return{host:t.VCP_REDIS_HOST??"127.0.0.1",port:Jn(t.VCP_REDIS_PORT,56379)}}function Jn(t,n){if(!t)return n;let a=Number(t);return Number.isInteger(a)&&a>0?a:n}import{z as l}from"zod";var Pe=l.enum(["text","url","document","image"]),ve=l.enum(["pending","ready","failed"]),ei=l.enum(["pending","ready","failed"]),ti=l.enum(["product","price","contact","copy","audience","other"]),pe=l.object({fact:l.string().min(1).max(300),kind:ti,source_id:l.string().min(1),quote:l.string().min(1).max(500),trust:l.enum(["verbatim","ocr"]).default("verbatim")}),ni=l.object({page_type:l.string().min(1).max(40),sections:l.array(l.string().min(1).max(40)).max(12)}),de=l.object({source_id:l.string().min(1),nav_structure:l.array(l.string().min(1).max(30)).max(12),page_patterns:l.array(ni).max(10),tone:l.array(l.string().min(1).max(20)).max(8),screenshot_ref:l.string().optional()}),ii=l.object({source_id:l.string().min(1),type:Pe,status:ve,title:l.string().max(120).optional(),original_ref:l.string().min(1),source_metadata:l.record(l.string(),l.unknown()),error_code:l.string().optional(),submitted:l.boolean().optional()}),ue=l.object({topic:l.string().min(1).max(80),variants:l.array(l.object({value:l.string().min(1).max(300),source_id:l.string().min(1)})).min(2)}),si=l.object({type:l.literal("text"),content:l.string().min(20).max(1e4),title:l.string().min(1).max(120).optional()}).strict(),ai=l.object({type:l.literal("url"),url:l.string().url().max(2048),rights_ack:l.boolean().optional(),title:l.string().min(1).max(120).optional()}).strict(),Ir=l.discriminatedUnion("type",[si,ai]),Rr=[".docx",".html",".md",".txt"],Tr=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],kr=10*1024*1024,Ar=2,Pr=l.object({consent_cross_border:l.union([l.literal(!0),l.literal("true")]),consent_text_version:l.string().min(1).max(120),title:l.string().min(1).max(120).optional()}).strict();function vr(t){return t===!0||t==="true"}var Cr=[".png",".jpg",".jpeg",".webp"],Nr=["image/png","image/jpeg","image/webp","application/octet-stream"],jr=8*1024*1024,Dr=10,oi=l.enum(["asset","reference"]),wr=l.object({image_role:oi,title:l.string().min(1).max(120).optional()}).strict(),Or=l.object({version:l.literal(1),site_id:l.string().min(1),tenant_id:l.string().min(1),user_prompt:l.string(),status:ei,sources:l.array(ii).max(16),facts:l.array(pe).max(120),reference:de.optional(),conflicts:l.array(ue).max(20)}).superRefine((t,n)=>{let a=new Map(t.sources.map(c=>[c.source_id,c]));for(let[c,r]of t.facts.entries()){let m=a.get(r.source_id);(!m||m.type==="url")&&n.addIssue({code:"custom",path:["facts",c,"source_id"],message:"facts must reference a text/document/image source (never url)"})}if(t.reference){let c=a.get(t.reference.source_id),r=c?.type==="image"&&c.source_metadata.image_role==="reference";(!c||c.type!=="url"&&!r)&&n.addIssue({code:"custom",path:["reference","source_id"],message:"reference must point at a url source or reference image source"})}});import{z as u}from"zod";var ri=["design.md","DESIGN.md"],dt=["components/site","src/components/site","lib/generated","src/lib/generated","public"],ci=["app/globals.css","src/app/globals.css"],mi=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],li=new Set(mi),Ce="source-delete",ut=u.literal(Ce),M=u.string().min(1).refine(ht,"Invalid site edit source path"),pi=u.string().min(1).refine(fi,"Invalid site edit source directory path"),Ur=u.enum(["text","binary"]),ge=u.object({path:M,language:u.string().min(1).nullable(),sizeBytes:u.number().int().nonnegative(),contentHash:u.string().min(1).optional()}),di=u.discriminatedUnion("kind",[ge.extend({kind:u.literal("text"),language:u.string().min(1),readonly:u.boolean().default(!1)}),ge.extend({kind:u.literal("binary"),language:u.null(),mimeType:u.string().min(1).optional(),readonly:u.literal(!0)})]),gt=u.lazy(()=>u.discriminatedUnion("kind",[u.object({kind:u.literal("directory"),name:u.string().min(1),path:pi,children:u.array(gt)}),u.object({kind:u.literal("file"),name:u.string().min(1),path:M,file:di}).superRefine((t,n)=>{t.path!==t.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),ui=u.enum(["max-files","max-depth","max-total-bytes"]),gi=u.object({reasons:u.array(ui).min(1),maxFiles:u.number().int().positive(),maxDepth:u.number().int().positive(),maxTotalBytes:u.number().int().positive()}),Kr=u.object({nodes:u.array(gt),defaultPath:M.optional(),totalFiles:u.number().int().nonnegative(),truncated:gi.optional()}),hi=ge.extend({kind:u.literal("text"),language:u.string().min(1),readonly:u.boolean().default(!1),content:u.string()}),Si=u.enum(["too-large","unsupported-mime","bytes-unavailable"]),_i=ge.extend({kind:u.literal("binary"),language:u.null(),readonly:u.literal(!0),mimeType:u.string().min(1),contentBase64:u.string().min(1).optional(),previewUnavailableReason:Si.optional()}),Gr=u.discriminatedUnion("kind",[hi,_i]),bi=u.object({key:u.string().min(1),routeId:u.string().min(1).optional()}),yi=u.object({startLine:u.number().int().positive(),startColumn:u.number().int().nonnegative(),endLine:u.number().int().positive(),endColumn:u.number().int().nonnegative()}),Fr=bi.extend({sourceFile:M,componentName:u.string().min(1),openingElementRange:yi,structuralPath:u.string().min(1),textPreview:u.string().min(1).optional()});function ht(t){return!yt(t)||bt(t)?!1:De(t)||_t(t)||St(t)||dt.some(n=>t===n||t.startsWith(`${n}/`))}function Ne(t){return De(t)||li.has(Ei(t))}function fi(t){return!yt(t)||bt(t)?!1:t==="app"||t.startsWith("app/")||t==="src"||t==="src/app"||t.startsWith("src/app/")||dt.some(n=>t===n||t.startsWith(`${n}/`)||n.startsWith(`${t}/`))}function je(t){return ht(t)?De(t)?"design-document":St(t)?"route-entry":_t(t)?"app-global-style":t.toLowerCase()==="lib/generated/media-assets.ts"||t.toLowerCase()==="src/lib/generated/media-assets.ts"?"generated-media-manifest":null:null}function Br(t){return je(t)!==null}function St(t){return/^(?:src\/)?app\/(?:.*\/)?page\.[cm]?[jt]sx?$/.test(t.toLowerCase())}function _t(t){return ci.some(n=>n.toLowerCase()===t.toLowerCase())}function Ei(t){let n=t.split("/").at(-1)??t,a=n.lastIndexOf(".");return a>0?n.slice(a).toLowerCase():""}function De(t){return!t.includes("/")&&ri.some(n=>n.toLowerCase()===t.toLowerCase())}function bt(t){let n=t.toLowerCase(),a=n.split("/"),r=(a.at(-1)??n).replace(/\.[^.]+$/,"");return/^(?:src\/)?app\/api(?:\/|$)/.test(n)||/^(?:src\/)?app\/(?:.*\/)?route\.[cm]?[jt]sx?$/.test(n)||/^(?:src\/)?app\/(?:.*\/)?(?:action|actions)\.[cm]?[jt]sx?$/.test(n)||/(^|\/)[^/]+\.server\.[cm]?[jt]sx?$/.test(n)||n==="lib/server"||n.startsWith("lib/server")||n==="src/lib/server"||n.startsWith("src/lib/server")||n==="lib/db"||n.startsWith("lib/db")||n==="src/lib/db"||n.startsWith("src/lib/db")||n==="lib/cms"||n.startsWith("lib/cms/")||n==="src/lib/cms"||n.startsWith("src/lib/cms/")?!0:r==="server"||r==="db"||r==="database"||r==="auth"||r==="secret"||r==="secrets"||r==="token"||r==="tokens"||r==="credential"||r==="credentials"||a.includes("server")||a.includes("secrets")}function yt(t){return!t||t.startsWith("/")||t.includes("\\")?!1:t.split("/").every(n=>!(n.length===0||n==="."||n===".."||n.startsWith(".")||n==="package.json"||n==="node_modules"||n==="recipes"||n.startsWith(".env")))}import{z as xi}from"zod";var ft=["zh-CN","zh-HK","zh-TW","en-US","en-GB","ja-JP","ko-KR","es-ES","fr-FR","de-DE","pt-PT","ru-RU","ar-SA","id-ID","vi-VN","th-TH","it-IT","nl-NL","tr-TR","pl-PL","uk-UA","cs-CZ","sk-SK","hu-HU","ro-RO","el-GR","sv-SE","da-DK","fi-FI","hr-HR","lt-LT","lv-LV","et-EE","ga-IE","mt-MT","ka-GE","fa-IR","bn-BD","ta-IN","si-LK","ms-MY","fil-PH","my-MM","km-KH","lo-LA","mn-MN","kk-KZ"],Ii=["en","ja","es","fr","de","ko","pt","pt-BR","it","ru","ar","hi","id","vi","th","tr","nl","pl","uk","sv","da","fi","no","cs","el","hu","ro","he","ms","fil","bn","ta","ca","sk","hr","bg","lt","lv","et","fa","sw","sr","is"],Ri=[...ft,...Ii],Ti=new Set(["ar","fa","he"]),Hr=[{code:"zh-CN",label:"\u7B80\u4F53\u4E2D\u6587",englishName:"Chinese (Simplified)"},{code:"zh-HK",label:"\u7E41\u9AD4\u4E2D\u6587\uFF08\u9999\u6E2F\uFF09",englishName:"Chinese (Traditional, Hong Kong)"},{code:"zh-TW",label:"\u7E41\u9AD4\u4E2D\u6587\uFF08\u53F0\u7063\uFF09",englishName:"Chinese (Traditional, Taiwan)"},{code:"en-US",label:"English (US)",englishName:"English (United States)",common:!0},{code:"en-GB",label:"English (UK)",englishName:"English (United Kingdom)",common:!0},{code:"ja-JP",label:"\u65E5\u672C\u8A9E",englishName:"Japanese"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4",englishName:"Korean"},{code:"es-ES",label:"Espa\xF1ol",englishName:"Spanish"},{code:"fr-FR",label:"Fran\xE7ais",englishName:"French"},{code:"de-DE",label:"Deutsch",englishName:"German"},{code:"pt-PT",label:"Portugu\xEAs",englishName:"Portuguese"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",englishName:"Russian"},{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",englishName:"Arabic"},{code:"id-ID",label:"Bahasa Indonesia",englishName:"Indonesian"},{code:"vi-VN",label:"Ti\u1EBFng Vi\u1EC7t",englishName:"Vietnamese"},{code:"th-TH",label:"\u0E44\u0E17\u0E22",englishName:"Thai"},{code:"it-IT",label:"Italiano",englishName:"Italian"},{code:"nl-NL",label:"Nederlands",englishName:"Dutch"},{code:"tr-TR",label:"T\xFCrk\xE7e",englishName:"Turkish"},{code:"pl-PL",label:"Polski",englishName:"Polish"},{code:"uk-UA",label:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430",englishName:"Ukrainian"},{code:"cs-CZ",label:"\u010Ce\u0161tina",englishName:"Czech"},{code:"sk-SK",label:"Sloven\u010Dina",englishName:"Slovak"},{code:"hu-HU",label:"Magyar",englishName:"Hungarian"},{code:"ro-RO",label:"Rom\xE2n\u0103",englishName:"Romanian"},{code:"el-GR",label:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC",englishName:"Greek"},{code:"sv-SE",label:"Svenska",englishName:"Swedish"},{code:"da-DK",label:"Dansk",englishName:"Danish"},{code:"fi-FI",label:"Suomi",englishName:"Finnish"},{code:"hr-HR",label:"Hrvatski",englishName:"Croatian"},{code:"lt-LT",label:"Lietuvi\u0173",englishName:"Lithuanian"},{code:"lv-LV",label:"Latvie\u0161u",englishName:"Latvian"},{code:"et-EE",label:"Eesti",englishName:"Estonian"},{code:"ga-IE",label:"Gaeilge",englishName:"Irish"},{code:"mt-MT",label:"Malti",englishName:"Maltese"},{code:"ka-GE",label:"\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8",englishName:"Georgian"},{code:"fa-IR",label:"\u0641\u0627\u0631\u0633\u06CC",englishName:"Persian"},{code:"bn-BD",label:"\u09AC\u09BE\u0982\u09B2\u09BE",englishName:"Bengali"},{code:"ta-IN",label:"\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD",englishName:"Tamil"},{code:"si-LK",label:"\u0DC3\u0DD2\u0D82\u0DC4\u0DBD",englishName:"Sinhala"},{code:"ms-MY",label:"Bahasa Melayu",englishName:"Malay"},{code:"fil-PH",label:"Filipino",englishName:"Filipino"},{code:"my-MM",label:"\u1019\u103C\u1014\u103A\u1019\u102C",englishName:"Burmese"},{code:"km-KH",label:"\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A",englishName:"Khmer"},{code:"lo-LA",label:"\u0EA5\u0EB2\u0EA7",englishName:"Lao"},{code:"mn-MN",label:"\u041C\u043E\u043D\u0433\u043E\u043B",englishName:"Mongolian"},{code:"kk-KZ",label:"\u049A\u0430\u0437\u0430\u049B",englishName:"Kazakh"}],ki={en:"en-US",ja:"ja-JP",es:"es-ES",fr:"fr-FR",de:"de-DE",ko:"ko-KR",pt:"pt-PT",it:"it-IT",ru:"ru-RU",ar:"ar-SA",id:"id-ID",vi:"vi-VN",th:"th-TH",tr:"tr-TR",nl:"nl-NL",pl:"pl-PL",uk:"uk-UA",sv:"sv-SE",da:"da-DK",fi:"fi-FI",cs:"cs-CZ",el:"el-GR",hu:"hu-HU",ro:"ro-RO",ms:"ms-MY",fil:"fil-PH",bn:"bn-BD",ta:"ta-IN",sk:"sk-SK",hr:"hr-HR",lt:"lt-LT",lv:"lv-LV",et:"et-EE",fa:"fa-IR"},Ai=new Set(ft);function Vr(t){return Ai.has(t)?t:ki[t]}var Pi="en";function zr(t){let n=t.toLowerCase().split("-",1)[0]??"";return Ti.has(n)?"rtl":"ltr"}var vi={cmn:"zh-CN",eng:"en",jpn:"ja",spa:"es",fra:"fr",deu:"de",kor:"ko",por:"pt",ita:"it",rus:"ru",arb:"ar",ara:"ar",hin:"hi",ind:"id",vie:"vi",tha:"th",tur:"tr",nld:"nl",pol:"pl",ukr:"uk",swe:"sv",dan:"da",fin:"fi",nob:"no",nor:"no",ces:"cs",ell:"el",hun:"hu",ron:"ro",heb:"he",msa:"ms",zsm:"ms",tgl:"fil",ben:"bn",tam:"ta",cat:"ca",slk:"sk",hrv:"hr",bul:"bg",lit:"lt",lav:"lv",est:"et",pes:"fa",fas:"fa",swh:"sw",swa:"sw",srp:"sr",isl:"is"};function $r(t){return vi[t]??Pi}var q=xi.enum(Ri);import{z as I}from"zod";var Et="insertNewComponent",Qr={categoryGroupMissing:"DESIGNER_COMPONENT_CATEGORY_GROUP_MISSING",unavailable:"DESIGNER_COMPONENT_LIBRARY_UNAVAILABLE",timeout:"DESIGNER_COMPONENT_LIBRARY_TIMEOUT",invalidResponse:"DESIGNER_COMPONENT_LIBRARY_INVALID_RESPONSE"},xt=I.lazy(()=>I.object({id:I.string().uuid(),key:I.string().min(1),name:I.string(),children:I.array(xt)}).strict()),It=I.object({category_group_key:I.literal(Et),categories:I.array(xt)}).strict(),Ci=I.object({resource_id:I.string().min(1),name:I.string(),description:I.string().nullable(),thumbnail_url:I.string().nullable(),resolved_version:I.string().min(1),category_id:I.string().uuid().nullable()}).strict(),Rt=I.object({category_group_key:I.literal(Et),items:I.array(Ci),next_cursor:I.string().min(1).nullable()}).strict(),Zr=I.object({category_id:I.string().uuid().optional(),include_descendants:I.enum(["true","false"]).optional().transform(t=>t==="true"),limit:I.coerce.number().int().min(1).max(100).optional().default(20),cursor:I.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})});var $="[a-z0-9]+(?:-[a-z0-9]+)*",ee=new RegExp(`^/(?:${$}(?:/${$})*)?$`);function Ni(t){return t.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Tt(t){return typeof t=="string"&&ee.test(t)}function kt(t){if(typeof t!="string")return null;let n=t.trim();if(/[^\x00-\x7F]/.test(n))return null;let a=n.replace(/^\/+|\/+$/g,"");if(a==="")return"/";let c=a.split("/");if(c.some(p=>p==="."||p===".."))return null;let r=a.toLowerCase();if(r==="index"||r==="home")return"/";let m=c.map(Ni).filter(p=>p.length>0);if(m.length===0)return null;let S=`/${m.join("/")}`;return Tt(S)?S:null}function At(t){let n=kt(t);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function ji(t){let n=At(t);return n==="/"?"app/page.tsx":`app/${n.slice(1)}/page.tsx`}import{z as D}from"zod";var Se=D.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),Di=D.enum(["direct","proxy","upstream","readonly","unsupported"]),wi=D.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),he=D.object({mode:Di,reasonCode:D.string().min(1).optional()}),Oi=D.object({kind:wi,message:D.string().min(1)}),_e=D.object({key:D.string().min(1),canUpdateText:D.boolean(),canInsertChild:D.boolean(),canMove:D.boolean(),canRemove:D.boolean(),editModes:D.object({updateText:he.optional(),insertChild:he.optional(),move:he.optional(),remove:he.optional()}).optional(),constraints:D.array(Oi)});import{z as E}from"zod";import{z as L}from"zod";var Mi=L.object({code:L.string().min(1),message:L.string().min(1)}),sc=L.object({code:L.string().min(1),message:L.string().min(1)});function we(t){return L.object({ok:L.literal(!0),data:t})}function Li(t){let n={ok:L.literal(!1),error:Mi.extend({code:t.codeSchema})};return t.currentSchema&&(n.current=t.currentSchema.optional()),t.diagnosticsSchema&&(n.diagnostics=L.array(t.diagnosticsSchema).optional()),t.dataSchema&&(n.data=t.dataSchema.optional()),L.object(n)}function Pt(t){return L.discriminatedUnion("ok",[we(t.dataSchema),Li({codeSchema:t.codeSchema,currentSchema:t.currentSchema,diagnosticsSchema:t.diagnosticsSchema,dataSchema:t.failureDataSchema})])}var V=E.object({start:E.number().int().nonnegative(),end:E.number().int().nonnegative()}).superRefine((t,n)=>{t.end<t.start&&n.addIssue({code:"custom",path:["end"],message:"end must be greater than or equal to start"})}),Ui=E.object({code:E.enum(["missing-class-name","unsupported-attribute-name","source-locator-warning","invalid-new-attr","version-conflict","write-failed"]),message:E.string().min(1)}),vt=E.object({path:E.string().min(1),content:E.string(),hash:E.string().min(1).optional()}),cc=E.object({revision:E.string().min(1),entryCss:vt,stylesheets:E.array(vt).default([])}),Ct=E.object({key:E.string().min(1),routeId:E.string().min(1),filePath:E.string().min(1),componentName:E.string().min(1),sourceKind:E.enum(["missing","stringLiteral","expression"]),attrRaw:E.string().min(1).nullable(),valueRaw:E.string().min(1).nullable(),attrRange:V.nullable(),openingElementRange:V,version:E.object({documentVersion:E.number().int().nonnegative(),contentHash:E.string().min(1)}),diagnostics:E.array(Ui),computedStyle:E.record(E.string(),E.string()).optional()}).superRefine((t,n)=>{if(t.sourceKind==="missing"){(t.attrRaw!==null||t.valueRaw!==null||t.attrRange!==null)&&n.addIssue({code:"custom",message:"missing className source must not include attr raw or range"});return}(t.attrRaw===null||t.valueRaw===null||t.attrRange===null)&&n.addIssue({code:"custom",message:"present className source must include attr raw and ranges"})}),mc=Ct,lc=we(Ct),Oe=E.object({source:E.enum(["style-panel","class-source-editor"]),operation:E.enum(["replace-static-classname","replace-expression","create-attribute","remove-attribute"])});import{z as Ki}from"zod";var Me=Ki.enum(["src","alt","poster","href","width","height"]);import{z as b}from"zod";import{z as o}from"zod";import{z as C}from"zod";var Gi=64,Fi=512*1024,Bi=4*1024*1024,qi=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function Wi(t){return qi.test(t)}var Nt=C.string().min(1).refine(Wi,{message:"Materialization pathTemplate must be a safe relative path."}),Hi=C.object({pathTemplate:Nt,content:C.string(),role:C.string().min(1).optional()}).strict(),Vi=C.union([C.object({kind:C.literal("default")}).strict(),C.object({kind:C.literal("named"),name:C.string().min(1)}).strict()]),zi=C.object({pathTemplate:Nt,export:Vi}).strict(),$i=C.array(C.never()).optional(),jt=C.object({instanceBaseName:C.string().min(1),files:C.array(Hi).min(1).max(Gi),entry:zi,dataRequirements:$i}).strict().superRefine((t,n)=>{let a=new Set,c=t.entry.pathTemplate,r=0;for(let[m,S]of t.files.entries()){a.has(S.pathTemplate)&&n.addIssue({code:"custom",path:["files",m,"pathTemplate"],message:`Duplicate materialization pathTemplate: ${S.pathTemplate}`}),a.add(S.pathTemplate);let p=new TextEncoder().encode(S.content).length;p>Fi&&n.addIssue({code:"custom",path:["files",m,"content"],message:"Materialization file content exceeds the per-file byte limit."}),r+=p}a.has(c)||n.addIssue({code:"custom",path:["entry","pathTemplate"],message:"Materialization entry pathTemplate must match a file."}),r>Bi&&n.addIssue({code:"custom",path:["files"],message:"Materialization exceeds the total content byte limit."})});import{z as Y}from"zod";var te=Y.object({editingSessionId:Y.string().min(1),lockId:Y.string().min(1),ownerId:Y.string().min(1),leaseAssertion:Y.string().min(1)}).strict(),_c="signed-designer-mutations-v1",bc=Y.object({mutationContext:te}).strict();import{z as s}from"zod";import{z as ne}from"zod";var be="::",Le=ne.object({file:ne.string().min(1),component:ne.string().min(1),structuralPath:ne.string().min(1),key:ne.string().min(1)}).superRefine((t,n)=>{let a=Yi(t.file,t.component,t.structuralPath);t.key!==a&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function Yi(t,n,a){return`${t}${be}${n}${be}${a}`}function Ec(t){let[n,a,...c]=t.split(be);return!n||!a||c.length===0?null:{file:n,component:a,structuralPath:c.join(be)}}var ye=s.enum(["VERSION_STALE","RECOVERY_REQUIRED","MULTIPLE_PAGE_RETURNS","INDIRECT_RETURN_ONLY","PAGE_CONTAINER_AMBIGUOUS","NO_SAFE_PAGE_PLACEMENT","MEMBER_NOT_INDEPENDENT","UNSUPPORTED_ROUTE_STRUCTURE","RUNTIME_ANCHOR_UNRESOLVED","ROUTE_RETURN_NOT_FOUND"]),ie=s.object({code:s.string().min(1),message:s.string().min(1)}).strict(),Xi=s.union([s.object({kind:s.literal("virtual-route-root"),key:s.string().min(1)}).strict(),s.object({kind:s.literal("jsx-container"),key:s.string().min(1),sourceMemberKey:s.string().min(1),sourceFile:s.string().min(1),componentName:s.string().min(1).optional()}).strict(),s.object({kind:s.literal("starter-placeholder"),key:s.string().min(1),sourceFile:s.string().min(1).optional()}).strict()]),Qi=s.object({key:s.string().min(1),kind:s.enum(["jsx-element","jsx-fragment","jsx-expression","null-return","starter-placeholder"]),containerKey:s.string().min(1),label:s.string().min(1),sourceFile:s.string().min(1).optional(),isAtomic:s.boolean()}).strict(),Zi=s.object({key:s.string().min(1),sourceMemberKey:s.string().min(1),containerKey:s.string().min(1),label:s.string().min(1),isIndependent:s.boolean()}).strict(),Ji=s.object({key:s.string().min(1),containerKey:s.string().min(1),businessMemberKeys:s.array(s.string().min(1)),isMultiMember:s.boolean()}).strict(),Ue=s.object({kind:s.literal("page-composition"),placementKey:s.string().min(1),documentVersion:s.number().int().nonnegative()}).strict(),wt=Ue.extend({routeId:s.string().min(1),placementUnitKey:s.string().min(1),relation:s.enum(["before","after","prepend","append"])}).strict(),Ot=wt,Mt=s.object({kind:s.literal("page-unit"),routeId:s.string().min(1),placementUnitKey:s.string().min(1)}).strict();function F(t,n,a,c,r){let m=new Set;for(let[S,p]of t.entries()){let g=c(p);m.has(g)&&n.addIssue({code:"custom",path:[a,S,r],message:`Duplicate ${a} key: ${g}`}),m.add(g)}}var es=s.object({status:s.literal("supported"),version:s.number().int().nonnegative(),routeId:s.string().min(1),container:Xi,sourceMembers:s.array(Qi),businessMembers:s.array(Zi),placementUnits:s.array(Ji),placements:s.array(wt)}).strict().superRefine((t,n)=>{F(t.sourceMembers,n,"sourceMembers",p=>p.key,"key"),F(t.businessMembers,n,"businessMembers",p=>p.key,"key"),F(t.placementUnits,n,"placementUnits",p=>p.key,"key"),F(t.placements,n,"placements",p=>p.placementKey,"placementKey");let a=new Set(t.sourceMembers.map(p=>p.key)),c=new Set(t.placementUnits.map(p=>p.key)),r=new Map(t.sourceMembers.map(p=>[p.key,p])),m=new Map(t.businessMembers.map(p=>[p.key,p]));for(let[p,g]of t.sourceMembers.entries()){g.containerKey!==t.container.key&&!a.has(g.containerKey)&&n.addIssue({code:"custom",path:["sourceMembers",p,"containerKey"],message:"Source member parent must reference the page container or another source member."}),g.containerKey===g.key&&n.addIssue({code:"custom",path:["sourceMembers",p,"containerKey"],message:"Source member cannot contain itself."});let P=new Set([g.key]),d=g.containerKey;for(;d!==t.container.key;){if(P.has(d)){n.addIssue({code:"custom",path:["sourceMembers",p,"containerKey"],message:"Source member hierarchy must be acyclic."});break}P.add(d);let h=r.get(d);if(!h)break;d=h.containerKey}}t.container.kind==="jsx-container"&&!a.has(t.container.sourceMemberKey)&&n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."});for(let[p,g]of t.businessMembers.entries())a.has(g.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",p,"sourceMemberKey"],message:"Business member must reference a source member."}),c.has(g.containerKey)||n.addIssue({code:"custom",path:["businessMembers",p,"containerKey"],message:"Business member must reference a placement unit container."});for(let[p,g]of t.placementUnits.entries()){let P=r.get(g.containerKey);P?P.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",p,"containerKey"],message:"Placement unit must reference a direct child of the page container."}):n.addIssue({code:"custom",path:["placementUnits",p,"containerKey"],message:"Placement unit containerKey must reference a source member."});let d=new Set;for(let[h,N]of g.businessMemberKeys.entries()){let v=m.get(N);if(!v){n.addIssue({code:"custom",path:["placementUnits",p,"businessMemberKeys",h],message:"Placement unit must reference existing business members."});continue}d.has(N)&&n.addIssue({code:"custom",path:["placementUnits",p,"businessMemberKeys",h],message:"Placement unit cannot reference the same business member twice."}),d.add(N),v.containerKey!==g.key&&n.addIssue({code:"custom",path:["placementUnits",p,"businessMemberKeys",h],message:"Business member containerKey must match its placement unit."});let j=v.sourceMemberKey,G=new Set;for(;j&&j!==g.containerKey&&!G.has(j);)G.add(j),j=r.get(j)?.containerKey;j!==g.containerKey&&n.addIssue({code:"custom",path:["placementUnits",p,"businessMemberKeys",h],message:"Placement unit business members must belong to its source subtree."})}}for(let[p,g]of t.businessMembers.entries())t.placementUnits.find(d=>d.key===g.containerKey)?.businessMemberKeys.includes(g.key)||n.addIssue({code:"custom",path:["businessMembers",p,"containerKey"],message:"Business member must be listed by its placement unit container."});let S=new Map;for(let p of t.placementUnits)S.set(p.containerKey,(S.get(p.containerKey)??0)+1);for(let[p,g]of t.sourceMembers.entries())g.containerKey===t.container.key&&S.get(g.key)!==1&&n.addIssue({code:"custom",path:["sourceMembers",p,"key"],message:"Every direct source member must be owned by exactly one placement unit."});for(let[p,g]of t.placements.entries())g.routeId!==t.routeId&&n.addIssue({code:"custom",path:["placements",p,"routeId"],message:"Page placement routeId must match page composition routeId."}),g.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",p,"documentVersion"],message:"Page placement version must match page composition version."}),c.has(g.placementUnitKey)||n.addIssue({code:"custom",path:["placements",p,"placementUnitKey"],message:"Placement option must reference an existing placement unit."})}),ts=s.object({status:s.literal("unsupported"),version:s.number().int().nonnegative(),routeId:s.string().min(1),reason:ye,diagnostics:s.array(ie)}).strict(),ns=s.discriminatedUnion("status",[es,ts]),Lt=2,Tc="page-composition-v2",Ut=s.object({start:s.number().int().nonnegative(),end:s.number().int().nonnegative(),startLine:s.number().int().positive().optional(),startColumn:s.number().int().nonnegative().optional(),endLine:s.number().int().positive().optional(),endColumn:s.number().int().nonnegative().optional()}).strict().superRefine((t,n)=>{t.end<t.start&&n.addIssue({code:"custom",path:["end"],message:"Source range end must be greater than or equal to start."});let a=[t.startLine,t.startColumn,t.endLine,t.endColumn],c=a.some(m=>m!==void 0),r=a.every(m=>m!==void 0);c&&!r&&n.addIssue({code:"custom",path:["startLine"],message:"Source line and column locations must be provided together."}),t.startLine!==void 0&&t.endLine!==void 0&&t.endLine<t.startLine&&n.addIssue({code:"custom",path:["endLine"],message:"Source range endLine must not precede startLine."}),t.startLine!==void 0&&t.endLine===t.startLine&&t.startColumn!==void 0&&t.endColumn!==void 0&&t.endColumn<t.startColumn&&n.addIssue({code:"custom",path:["endColumn"],message:"Source range endColumn must not precede startColumn."})}),is=s.object({key:s.string().min(1),instanceIndex:s.number().int().nonnegative().optional(),instanceCount:s.number().int().positive().optional(),textSegmentIndex:s.number().int().nonnegative().optional()}).strict().superRefine((t,n)=>{t.instanceIndex!==void 0&&t.instanceCount!==void 0&&t.instanceIndex>=t.instanceCount&&n.addIssue({code:"custom",path:["instanceIndex"],message:"instanceIndex must be lower than instanceCount."})}),ss=s.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),as=s.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),os=s.discriminatedUnion("kind",[s.object({kind:s.literal("virtual-route-root"),key:s.null(),routeReturn:s.object({sourceIdentity:Le,sourceRange:Ut}).strict()}).strict(),s.object({kind:s.literal("jsx-container"),key:s.string().min(1),sourceMemberKey:s.string().min(1)}).strict(),s.object({kind:s.literal("starter-placeholder"),key:s.string().min(1),sourceMemberKey:s.string().min(1),replacementMode:s.literal("replace")}).strict()]),rs=s.object({key:s.string().min(1),kind:ss,parentKey:s.string().min(1).nullable(),childKeys:s.array(s.string().min(1)),order:s.number().int().nonnegative(),label:s.string().min(1),sourceIdentity:Le,sourceRange:Ut.nullable(),atomicKind:as}).strict().superRefine((t,n)=>{let a=t.kind==="component-call"||t.kind==="native-jsx"?"none":t.kind;t.atomicKind!==a&&n.addIssue({code:"custom",path:["atomicKind"],message:`atomicKind must be ${a} for ${t.kind}.`});let c=new Set;for(let[r,m]of t.childKeys.entries())c.has(m)&&n.addIssue({code:"custom",path:["childKeys",r],message:`Duplicate child source member key: ${m}`}),c.add(m)}),cs=s.object({key:s.string().min(1),sourceMemberKey:s.string().min(1),placementUnitKey:s.string().min(1),label:s.string().min(1),isIndependent:s.boolean()}).strict(),ms=s.enum(["independent","atomic","container"]),ls=s.object({key:s.string().min(1),containerKey:s.string().min(1).nullable(),sourceMemberKeys:s.array(s.string().min(1)).min(1),businessMemberKeys:s.array(s.string().min(1)),order:s.number().int().nonnegative(),boundaryMode:ms,isIndependent:s.boolean(),isMultiMember:s.boolean()}).strict().superRefine((t,n)=>{Dt(t.sourceMemberKeys,n,"sourceMemberKeys","source member"),Dt(t.businessMemberKeys,n,"businessMemberKeys","business member");let a=t.sourceMemberKeys.length>1||t.businessMemberKeys.length>1;t.isMultiMember!==a&&n.addIssue({code:"custom",path:["isMultiMember"],message:"isMultiMember must reflect the source and business member cardinality."});let c=t.boundaryMode==="independent";t.isIndependent!==c&&n.addIssue({code:"custom",path:["isIndependent"],message:"isIndependent must match boundaryMode."})}),ps=s.enum(["before","after","prepend","append","replace"]),ds=s.enum(["insert-sibling","insert-child","replace-placeholder"]),us=s.object({kind:s.literal("page-composition"),placementKey:s.string().min(1),documentVersion:s.number().int().nonnegative(),routeId:s.string().min(1),placementUnitKey:s.string().min(1),containerKey:s.string().min(1).nullable(),relation:ps,writeMode:ds}).strict().superRefine((t,n)=>{let a=t.relation==="before"||t.relation==="after"?"insert-sibling":t.relation==="prepend"||t.relation==="append"?"insert-child":"replace-placeholder";t.writeMode!==a&&n.addIssue({code:"custom",path:["writeMode"],message:`writeMode must be ${a} for ${t.relation}.`})}),gs=s.object({key:s.string().min(1),placementUnitKey:s.string().min(1),runtimeRefs:s.array(is).min(1)}).strict(),hs=s.object({schemaVersion:s.literal(Lt),status:s.literal("supported"),version:s.number().int().nonnegative(),routeId:s.string().min(1),container:os,sourceMembers:s.array(rs),businessMembers:s.array(cs),placementUnits:s.array(ls),placements:s.array(us),visualAnchors:s.array(gs).optional(),diagnostics:s.array(ie)}).strict().superRefine((t,n)=>{bs(t,n)}),Ss=s.object({schemaVersion:s.literal(Lt),status:s.literal("unsupported"),version:s.number().int().nonnegative(),routeId:s.string().min(1),reason:ye,diagnostics:s.array(ie)}).strict(),_s=s.discriminatedUnion("status",[hs,Ss]),kc=s.union([_s,ns]);function Dt(t,n,a,c){let r=new Set;for(let[m,S]of t.entries())r.has(S)&&n.addIssue({code:"custom",path:[a,m],message:`Duplicate ${c} key: ${S}`}),r.add(S)}function bs(t,n){F(t.sourceMembers,n,"sourceMembers",d=>d.key,"key"),F(t.businessMembers,n,"businessMembers",d=>d.key,"key"),F(t.placementUnits,n,"placementUnits",d=>d.key,"key"),F(t.placements,n,"placements",d=>d.placementKey,"placementKey"),F(t.visualAnchors??[],n,"visualAnchors",d=>d.key,"key"),ys(t,n);let a=new Map(t.sourceMembers.map(d=>[d.key,d])),c=new Map(t.businessMembers.map(d=>[d.key,d])),r=new Map(t.placementUnits.map(d=>[d.key,d]));fs(t,a,n),t.container.kind!=="virtual-route-root"&&(a.has(t.container.sourceMemberKey)||n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."}));let m=new Map,S=new Map,p=new Set;for(let[d,h]of t.placementUnits.entries()){h.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",d,"containerKey"],message:"Placement unit containerKey must match the page container."});let N=`${h.containerKey??"<virtual>"}:${h.order}`;p.has(N)&&n.addIssue({code:"custom",path:["placementUnits",d,"order"],message:"Placement unit order must be unique within its container."}),p.add(N);for(let[v,j]of h.sourceMemberKeys.entries()){a.has(j)||n.addIssue({code:"custom",path:["placementUnits",d,"sourceMemberKeys",v],message:"Placement unit must reference existing source members."});let G=m.get(j);G&&G!==h.key&&n.addIssue({code:"custom",path:["placementUnits",d,"sourceMemberKeys",v],message:`Source member is already assigned to ${G}.`}),m.set(j,h.key)}for(let[v,j]of h.businessMemberKeys.entries()){let G=c.get(j);if(!G){n.addIssue({code:"custom",path:["placementUnits",d,"businessMemberKeys",v],message:"Placement unit must reference existing business members."});continue}G.placementUnitKey!==h.key&&n.addIssue({code:"custom",path:["placementUnits",d,"businessMemberKeys",v],message:"Placement unit and business member must reference each other."}),h.sourceMemberKeys.includes(G.sourceMemberKey)||n.addIssue({code:"custom",path:["placementUnits",d,"businessMemberKeys",v],message:"Business member sourceMemberKey must belong to the placement unit."});let Ae=S.get(j);Ae&&Ae!==h.key&&n.addIssue({code:"custom",path:["placementUnits",d,"businessMemberKeys",v],message:`Business member is already assigned to ${Ae}.`}),S.set(j,h.key)}}for(let[d,h]of t.businessMembers.entries()){a.has(h.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",d,"sourceMemberKey"],message:"Business member must reference a source member."});let N=r.get(h.placementUnitKey);if(!N){n.addIssue({code:"custom",path:["businessMembers",d,"placementUnitKey"],message:"Business member must reference a placement unit."});continue}N.businessMemberKeys.includes(h.key)||n.addIssue({code:"custom",path:["businessMembers",d,"placementUnitKey"],message:"Business member and placement unit must reference each other."}),N.sourceMemberKeys.includes(h.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",d,"sourceMemberKey"],message:"Business member sourceMemberKey must belong to its placement unit."});let v=N.isIndependent&&N.businessMemberKeys.length===1;h.isIndependent!==v&&n.addIssue({code:"custom",path:["businessMembers",d,"isIndependent"],message:"Business member independence must match its placement unit boundary."})}let g=new Set;for(let[d,h]of t.placements.entries()){h.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",d,"documentVersion"],message:"Page placement version must match page composition version."}),h.routeId!==t.routeId&&n.addIssue({code:"custom",path:["placements",d,"routeId"],message:"Page placement routeId must match page composition routeId."});let N=r.get(h.placementUnitKey);N?h.containerKey!==N.containerKey&&n.addIssue({code:"custom",path:["placements",d,"containerKey"],message:"Placement containerKey must match its placement unit."}):n.addIssue({code:"custom",path:["placements",d,"placementUnitKey"],message:"Placement option must reference a placement unit."});let v=`${h.placementUnitKey}:${h.relation}`;g.has(v)&&n.addIssue({code:"custom",path:["placements",d,"relation"],message:"A placement unit cannot expose the same relation more than once."}),g.add(v),h.relation==="replace"&&t.container.kind!=="starter-placeholder"&&n.addIssue({code:"custom",path:["placements",d,"relation"],message:"replace is only valid for a starter placeholder container."}),t.container.kind==="starter-placeholder"&&h.relation!=="replace"&&n.addIssue({code:"custom",path:["placements",d,"relation"],message:"Starter placeholder placements must use replace."})}let P=new Set;for(let[d,h]of(t.visualAnchors??[]).entries())r.has(h.placementUnitKey)||n.addIssue({code:"custom",path:["visualAnchors",d,"placementUnitKey"],message:"Visual anchor must reference a placement unit."}),P.has(h.placementUnitKey)&&n.addIssue({code:"custom",path:["visualAnchors",d,"placementUnitKey"],message:"A placement unit may expose only one visual anchor."}),P.add(h.placementUnitKey)}function ys(t,n){let a=[];t.container.key!==null&&a.push({key:t.container.key,path:["container","key"],namespace:"container"});for(let[r,m]of t.sourceMembers.entries())a.push({key:m.key,path:["sourceMembers",r,"key"],namespace:"source member"});for(let[r,m]of t.businessMembers.entries())a.push({key:m.key,path:["businessMembers",r,"key"],namespace:"business member"});for(let[r,m]of t.placementUnits.entries())a.push({key:m.key,path:["placementUnits",r,"key"],namespace:"placement unit"});for(let[r,m]of(t.visualAnchors??[]).entries())a.push({key:m.key,path:["visualAnchors",r,"key"],namespace:"visual anchor"});let c=new Map;for(let r of a){let m=c.get(r.key);m?n.addIssue({code:"custom",path:r.path,message:`${r.namespace} key collides with ${m}: ${r.key}`}):c.set(r.key,r.namespace)}}function fs(t,n,a){let c=new Set;for(let[r,m]of t.sourceMembers.entries()){let S=`${m.parentKey??"<root>"}:${m.order}`;if(c.has(S)&&a.addIssue({code:"custom",path:["sourceMembers",r,"order"],message:"Source member order must be unique among siblings."}),c.add(S),m.parentKey===m.key&&a.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source member cannot be its own parent."}),m.parentKey!==null){let P=n.get(m.parentKey);P?P.childKeys.includes(m.key)||a.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source parent and child references must be bidirectional."}):a.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source member parentKey must reference a source member."})}for(let[P,d]of m.childKeys.entries()){if(d===m.key){a.addIssue({code:"custom",path:["sourceMembers",r,"childKeys",P],message:"Source member cannot be its own child."});continue}let h=n.get(d);h?h.parentKey!==m.key&&a.addIssue({code:"custom",path:["sourceMembers",r,"childKeys",P],message:"Source parent and child references must be bidirectional."}):a.addIssue({code:"custom",path:["sourceMembers",r,"childKeys",P],message:"Source child key must reference a source member."})}let p=new Set,g=m;for(;g;){if(p.has(g.key)){a.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source member graph must be acyclic."});break}p.add(g.key),g=g.parentKey===null?void 0:n.get(g.parentKey)}}}var se=o.enum(["update-text","update-array-item","remove-node","insert-child","move-node","set-class-name-source","set-props","apply-style-draft","source-edit"]),Kt=o.lazy(()=>o.union([o.string(),o.number(),o.boolean(),o.null(),o.array(Kt),o.record(o.string(),Kt)])),Ft=o.discriminatedUnion("kind",[o.object({kind:o.literal("node"),key:o.string().min(1)}),Mt,o.object({kind:o.literal("route"),routeId:o.string().min(1)}),o.object({kind:o.literal("source-file"),path:M}),o.object({kind:o.literal("source-batch"),paths:o.array(M).min(1)}).superRefine((t,n)=>{let a=new Set;for(let[c,r]of t.paths.entries())a.has(r)&&n.addIssue({code:"custom",path:["paths",c],message:`Duplicate source target path: ${r}`}),a.add(r)})]),Bt=o.enum(["display","position","top","right","bottom","left","zIndex","flexDirection","flexWrap","flexGrow","flexShrink","flexBasis","order","gridTemplateColumns","gridTemplateRows","columns","gridColumn","gridRow","gap","gapX","gapY","spaceX","spaceY","alignItems","justifyContent","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","width","height","minWidth","minHeight","maxWidth","maxHeight","overflow","fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","textAlign","textTransform","textDecoration","textOverflow","textIndent","writingMode","whiteSpace","wordBreak","lineClamp","fontVariantNumeric","screenReaderOnly","color","backgroundColor","backgroundImage","backgroundRepeat","backgroundSize","backgroundPosition","backgroundAttachment","backgroundClip","backgroundOrigin","borderStyle","borderWidth","borderRadius","borderColor","objectFit","objectPosition","aspectRatio","opacity","boxShadow","transform","transformOrigin","transitionProperty","transitionDuration","transitionTimingFunction","animation","pointerEvents","cursor","userSelect","fontStyle","textUnderlineOffset","scrollMarginTop","alignSelf","flex","outlineStyle","resize","ringWidth","ringColor","backdropFilter","overscrollBehavior","divideWidth","divideColor"]),qt=o.enum(["hover","active","focus","disabled"]),Wt=o.enum(["sm","md","lg","xl","2xl"]),Gt=o.union([o.object({relation:o.enum(["before","after"]),anchorKey:o.string().min(1)}),o.object({relation:o.enum(["prepend","append"]),parentKey:o.string().min(1)}),Ot]),Es=o.union([o.object({kind:o.literal("native-tag"),tag:o.string().min(1),text:o.string().optional()}),o.object({kind:o.literal("component-call"),component:o.object({source:o.string().min(1),exportName:o.string().min(1)}),materialization:o.never().optional(),props:o.record(o.string(),o.unknown()).optional()}).strict(),o.object({kind:o.literal("component-call"),component:o.never().optional(),materialization:jt,props:o.record(o.string(),o.never()).optional()}).strict()]),xs=o.discriminatedUnion("kind",[o.object({kind:o.literal("update-text"),segmentIndex:o.number().int().min(0),value:o.string()}),o.object({kind:o.literal("update-array-item"),segmentIndex:o.number().int().min(0),index:o.number().int().min(0),value:o.string()}),o.object({kind:o.literal("remove-node")}),o.object({kind:o.literal("insert-child"),node:Es,position:o.union([Gt,Ue])}),o.object({kind:o.literal("move-node"),target:Gt,preserveBindings:o.boolean().optional()}),o.object({kind:o.literal("set-class-name-source"),routeId:o.string().min(1).optional(),filePath:o.string().min(1),expectedVersion:o.object({documentVersion:o.number().int().nonnegative(),contentHash:o.string().min(1)}),oldAttrRaw:o.string().min(1).nullable(),oldAttrRange:V.nullable(),openingElementRange:V,newAttrRaw:o.string().min(1).nullable(),intent:Oe}),o.object({kind:o.literal("set-props"),props:o.partialRecord(Me,o.string())}),o.object({kind:o.literal("apply-style-draft"),className:o.object({routeId:o.string().min(1).optional(),filePath:o.string().min(1),expectedVersion:o.object({documentVersion:o.number().int().nonnegative(),contentHash:o.string().min(1)}),oldAttrRaw:o.string().min(1).nullable(),oldAttrRange:V.nullable(),openingElementRange:V,newAttrRaw:o.string().min(1).nullable(),intent:Oe}).optional(),props:o.partialRecord(Me,o.string()).optional()}).superRefine((t,n)=>{!t.className&&!t.props&&n.addIssue({code:"custom",message:"apply-style-draft requires className or props"})}),o.object({kind:o.literal("source-edit"),conflictPolicy:o.enum(["compare-and-swap","overwrite"]),edits:o.array(o.discriminatedUnion("operation",[o.object({operation:o.literal("upsert"),path:M,content:o.string(),baseContentHash:o.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{Ne(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit upsert only accepts allowlisted text source files"}),t.content.includes("\0")&&n.addIssue({code:"custom",path:["content"],message:"source-edit content must be valid text"})}),o.object({operation:o.literal("delete"),path:M,capability:ut,confirmDelete:o.literal(!0),confirmPath:M,baseContentHash:o.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{t.capability!==Ce&&n.addIssue({code:"custom",path:["capability"],message:"delete requires source-delete capability"}),t.confirmPath!==t.path&&n.addIssue({code:"custom",path:["confirmPath"],message:"delete confirmation path must match edit path"}),Ne(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit delete only accepts allowlisted text source files"});let a=je(t.path);a&&n.addIssue({code:"custom",path:["path"],message:`Protected source file cannot be deleted: ${t.path} (${a})`})})])).min(1),reason:o.string().min(1).optional()}).strict().superRefine((t,n)=>{let a=new Set;for(let[c,r]of t.edits.entries())a.has(r.path)&&n.addIssue({code:"custom",path:["edits",c,"path"],message:`Duplicate source edit path: ${r.path}`}),a.add(r.path),t.conflictPolicy==="compare-and-swap"&&r.baseContentHash===void 0&&n.addIssue({code:"custom",path:["edits",c,"baseContentHash"],message:"source-edit compare-and-swap requires baseContentHash for every edit"})})]),Ht=o.enum(["NODE_NOT_FOUND","ROUTE_NOT_FOUND","CAPABILITY_REJECTED","CONSTRAINT_VIOLATED","INVALID_PARAMS","PLAN_FAILED","TRANSACTION_PREFLIGHT_FAILED","ROUTE_REBUILD_FAILED","HISTORY_COMMIT_FAILED","MATERIALIZATION_CONFLICT","MATERIALIZATION_REJECTED","MUTATION_ASSERTION_REQUIRED","MUTATION_ASSERTION_INVALID","VERSION_STALE","AST_PARSE_ERROR","UNSUPPORTED_OPERATION","LOCATOR_FAILED","INVALID_TARGET","WRITE_IO_ERROR","CONCURRENT_MODIFIED","ROLLBACK_FAILED","RECOVERY_REQUIRED","RECOVERY_PERSIST_FAILED","MUTATION_SESSION_REQUIRED","LEASE_ASSERTION_INVALID","LEASE_ASSERTION_EXPIRED","LEASE_ASSERTION_SCOPE_MISMATCH","CROSS_PAGE_MOVE_UNSUPPORTED","INTERNAL_ERROR"]),Vt=o.object({code:Ht,message:o.string().min(1),details:o.record(o.string(),o.unknown()).optional()}),zt=o.object({key:o.string().min(1),instanceIndex:o.number().int().nonnegative().optional(),instanceCount:o.number().int().positive().optional()}),Is=o.object({id:o.string().min(1),siteId:o.string().min(1),baseSnapshotId:o.string().min(1),routeId:o.string().min(1).optional(),kind:se,target:Ft,documentVersion:o.number().int().nonnegative(),selectionRef:zt.optional(),mutationContext:te.optional(),params:xs}).superRefine((t,n)=>{if(t.kind!==t.params.kind&&n.addIssue({code:"custom",path:["params","kind"],message:"params.kind must match operation kind"}),t.kind==="source-edit"){if(t.target.kind!=="source-file"&&t.target.kind!=="source-batch")n.addIssue({code:"custom",path:["target","kind"],message:"source-edit requires a source-file or source-batch target"});else if(t.params.kind==="source-edit"){let a=t.params.edits.map(r=>r.path),c=t.target.kind==="source-file"?[t.target.path]:t.target.paths;Rs(a,c)||n.addIssue({code:"custom",path:["target"],message:"source-edit target paths must match edit paths"})}}else(t.target.kind==="source-file"||t.target.kind==="source-batch")&&n.addIssue({code:"custom",path:["target","kind"],message:"source targets are only valid for source-edit"});t.target.kind==="page-unit"&&(t.kind!=="insert-child"&&t.kind!=="move-node"&&t.kind!=="remove-node"&&n.addIssue({code:"custom",path:["target","kind"],message:"page-unit target is only valid for page-level operations"}),t.kind==="move-node"&&t.params.kind==="move-node"&&(!("kind"in t.params.target)||t.params.target.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","target","kind"],message:"page-unit move-node target requires page-composition placement"})),t.params.kind==="insert-child"&&"kind"in t.params.position&&t.params.position.kind==="page-composition"&&t.target.kind!=="page-unit"&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-composition position requires page-unit target"}),t.kind==="insert-child"&&t.target.kind==="page-unit"&&t.params.kind==="insert-child"&&(!("kind"in t.params.position)||t.params.position.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-unit target requires page-composition position"})}),Mc=Is,fe=o.object({requestId:o.string().min(1),kind:se,target:Ft,resultVersion:o.number().int().nonnegative(),affectedFiles:o.array(o.string().min(1)).optional(),selectionRef:zt.optional()}),Lc=Pt({dataSchema:fe,codeSchema:Ht,failureDataSchema:fe.partial()});function Rs(t,n){return t.length===n.length&&t.every((a,c)=>a===n[c])}var Bc=b.discriminatedUnion("type",[b.object({type:b.literal("site-edit.document.changed"),siteId:b.string().min(1),snapshotId:b.string().min(1),routeId:b.string().min(1),version:b.number().int().nonnegative(),at:b.string().min(1)}),b.object({type:b.literal("site-edit.operation.planned"),siteId:b.string().min(1),operationId:b.string().min(1),baseSnapshotId:b.string().min(1),changedFiles:b.array(b.string().min(1)),at:b.string().min(1)}),b.object({type:b.literal("site-edit.operation.completed"),siteId:b.string().min(1),result:fe,at:b.string().min(1)}),b.object({type:b.literal("site-edit.operation.failed"),siteId:b.string().min(1),requestId:b.string().min(1),error:Vt,at:b.string().min(1)}),b.object({type:b.literal("site-edit.capability.changed"),siteId:b.string().min(1),routeId:b.string().min(1),keys:b.array(b.string().min(1)),at:b.string().min(1)})]);import{z as R}from"zod";var Hc="durable-history-v1",Vc=R.enum(["writable","read-only-recovery","unavailable"]),Ts=R.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),ks=R.object({code:Ts,message:R.string().min(1),occurredAt:R.iso.datetime().optional()}).strict(),As=R.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),$t={revision:R.number().int().nonnegative(),undoDepth:R.number().int().nonnegative(),redoDepth:R.number().int().nonnegative()},Ps=R.object({mode:R.literal("writable"),...$t,canUndo:R.boolean(),canRedo:R.boolean()}).strict().superRefine((t,n)=>{t.canUndo!==t.undoDepth>0&&n.addIssue({code:"custom",path:["canUndo"],message:"canUndo must reflect undoDepth."}),t.canRedo!==t.redoDepth>0&&n.addIssue({code:"custom",path:["canRedo"],message:"canRedo must reflect redoDepth."})}),vs=R.object({mode:R.literal("read-only-recovery"),...$t,canUndo:R.literal(!1),canRedo:R.literal(!1),recoveryDiagnostic:ks}).strict(),Cs=R.object({mode:R.literal("unavailable"),revision:R.literal(0),undoDepth:R.literal(0),redoDepth:R.literal(0),canUndo:R.literal(!1),canRedo:R.literal(!1),reason:As}).strict(),zc=R.discriminatedUnion("mode",[Ps,vs,Cs]);import{z as k}from"zod";var Ns=k.string().min(1).refine(t=>!t.startsWith("/")&&!t.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),js=k.string().regex(/^sha256:[a-f0-9]{64}$/),Ds=k.object({path:Ns,operation:k.enum(["create","update","delete"]),expectedHash:js.optional(),fullContent:k.string().optional()}).superRefine((t,n)=>{t.operation==="delete"&&t.fullContent!==void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"delete patches must not include fullContent"}),t.operation!=="delete"&&t.fullContent===void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"create/update patches must include fullContent"})}),Xc=k.object({siteId:k.string().min(1),baseSnapshotId:k.string().min(1),operationId:k.string().min(1),reason:k.string().min(1),patches:k.array(Ds).min(1),changedRouteIds:k.array(k.string().min(1)),diagnostics:k.array(k.object({code:k.string().min(1),message:k.string().min(1),path:k.string().min(1).optional()})).default([])}).superRefine((t,n)=>{let a=new Set;for(let[c,r]of t.patches.entries())a.has(r.path)&&n.addIssue({code:"custom",path:["patches",c,"path"],message:`Duplicate patch path: ${r.path}`}),a.add(r.path)});var Ke="::repeat-item#";function ws(t,n){return`${t}${Ke}${n}`}function Zc(t,n){return n.reduce((a,c)=>ws(a,c),t)}function Os(t){if(typeof t!="string"||t.length===0)return null;let n=[],a=t;for(;;){let c=a.lastIndexOf(Ke);if(c<0)break;let r=Number(a.slice(c+Ke.length));if(!Number.isInteger(r)||r<0)return null;n.unshift({repeatIndex:r}),a=a.slice(0,c)}return!a||n.length===0?null:{baseKey:a,parts:n}}function Jc(t){return Os(t)?.baseKey??t??null}import{z as i}from"zod";import{z as w}from"zod";var Ms=w.object({placementKey:w.string().min(1),placementUnitKey:w.string().min(1),relation:w.enum(["before","after","prepend","append"])}).strict(),Ls=w.object({status:w.literal("supported"),containerKey:w.string().min(1),hasBusinessMembers:w.boolean(),placementUnitKeys:w.array(w.string().min(1)),placements:w.array(Ms)}).strict().superRefine((t,n)=>{let a=new Set(t.placementUnitKeys);a.size!==t.placementUnitKeys.length&&n.addIssue({code:"custom",path:["placementUnitKeys"],message:"Render page composition placement unit keys must be unique."});let c=new Set;t.placements.forEach((r,m)=>{c.has(r.placementKey)&&n.addIssue({code:"custom",path:["placements",m,"placementKey"],message:"Render page composition placement keys must be unique."}),c.add(r.placementKey),a.has(r.placementUnitKey)||n.addIssue({code:"custom",path:["placements",m,"placementUnitKey"],message:"Render page composition placement must reference a projected unit."})})}),Us=w.object({status:w.literal("unsupported"),reason:ye,diagnostics:w.array(ie)}).strict(),Yt=w.discriminatedUnion("status",[Ls,Us]);var Ks=i.object({canUpdateText:i.boolean(),canInsertChild:i.boolean(),canMove:i.boolean(),canRemove:i.boolean()}),Xt=i.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),Gs=i.enum(["cms-field","api-field"]),Fs=i.enum(["text","attribute","richtext","repeat-region","component-prop"]),Bs=i.enum(["exact","safe-derived","partial","unknown"]),qs=i.object({file:i.string().min(1),symbol:i.string().min(1).optional(),reason:i.string().min(1)}),Ws=i.object({sourceKind:Xt,sourceType:Gs,endpointPattern:i.string().min(1).optional(),operation:i.string().min(1).optional(),collection:i.string().min(1).optional(),fieldPath:i.string().min(1).optional(),valuePath:i.string().min(1).optional(),targetKind:Fs,targetName:i.string().min(1),confidence:Bs,readonly:i.literal(!0),evidence:i.array(qs)}),Qt=i.object({hasDynamicData:i.boolean(),bindings:i.array(Ws)}),Zt=i.object({hasDynamicData:i.boolean(),sourceKinds:i.array(Xt),primaryEndpoint:i.string().min(1).optional(),primaryCollection:i.string().min(1).optional(),primaryFieldPath:i.string().min(1).optional()}),Hs=i.object({key:i.string().min(1),pageCompositionUnitKey:i.string().min(1).optional(),operationSummary:Ks,dynamicDataSummary:Zt.optional()}).strict(),dm=i.object({siteId:i.string().min(1),snapshotId:i.string().min(1),routeId:i.string().min(1),version:i.number().int().nonnegative(),entries:i.array(Hs),pageComposition:Yt}).strict(),Ge=i.enum(["api-field","cms-field","i18n-message","config-entry"]),Jt=i.object({kind:i.enum(["literal","binding","imported-binding","repeat-template"]),file:i.string().min(1),expression:i.string().min(1),bindingName:i.string().min(1).optional(),path:i.array(i.union([i.string(),i.number()])).optional()}),Fe=i.object({index:i.number().int().min(0),value:i.string(),editable:i.boolean(),source:Jt.nullable()}),ae=i.object({key:i.string().min(1),label:i.string().min(1),tag:i.string().min(1)}),um=i.object({key:i.string().min(1),canUpdateText:i.boolean(),canInsertChild:i.boolean(),canMove:i.boolean(),canRemove:i.boolean(),boundaryKind:Se.nullable(),isOpaque:i.boolean()}),Vs=i.object({kind:i.enum(["jsx-node","component-proxy","value-binding","route-export"]),file:i.string().min(1),componentName:i.string().min(1),isProxy:i.boolean()}),zs=i.object({kind:i.enum(["jsx-node","value-path","route-export","external-entry"]),file:i.string().min(1).optional(),isProxy:i.boolean(),displayPath:i.string().min(1).optional(),sourceType:Ge.optional(),sourceId:i.string().min(1).optional()}),en=i.object({kind:i.union([i.enum(["jsx-literal","component-prop","binding","imported-binding","object-field","array-item","repeat-template","conditional-branch"]),Ge]),file:i.string().min(1),displayPath:i.string().min(1),externalSource:i.object({sourceType:Ge,sourceId:i.string().min(1),adapterId:i.string().min(1).optional()}).optional()}),$s=i.object({kind:en.shape.kind,file:i.string().min(1),displayName:i.string().min(1),canEditHere:i.boolean()}),oe=i.object({finalSource:en.nullable(),chain:i.array($s),confidence:i.enum(["exact","safe-derived","partial","unknown"]),editMode:i.enum(["direct","proxy","upstream","readonly","unsupported"]),diagnostics:i.array(i.object({code:i.string().min(1),message:i.string().min(1)}))}),Ys=i.object({kind:i.literal("css-style-model"),properties:i.array(i.object({property:Bt,value:i.union([i.string(),i.number(),i.boolean(),i.null()]),resolvedValue:i.union([i.string(),i.number(),i.boolean(),i.null()]).optional(),breakpoint:Wt.optional(),state:qt.optional(),variants:i.array(i.string().min(1)).optional(),options:i.array(i.union([i.string(),i.number()])).optional(),editable:i.boolean(),diagnostics:i.array(i.object({code:i.string().min(1),message:i.string().min(1)})).optional(),operationBoundary:i.array(se).optional()}))}),gm=i.union([i.record(i.string(),i.unknown()),Ys]),tn=i.object({kind:i.literal("class-name-source"),className:i.string(),sourceKind:i.enum(["missing","static-attribute","static-expression","dynamic-expression"]),editable:i.boolean(),operationBoundary:i.array(se),sourcePath:i.string().min(1).optional(),diagnostics:i.array(i.object({code:i.enum(["missing-class-name","dynamic-binding","non-string-binding"]),message:i.string().min(1)})).optional()}),Xs=i.object({startLine:i.number().int().positive(),startColumn:i.number().int().nonnegative(),endLine:i.number().int().positive(),endColumn:i.number().int().nonnegative()}),Be=i.object({sourceFile:i.string().min(1),componentName:i.string().min(1),openingElementRange:Xs,structuralPath:i.string().min(1),textPreview:i.string().min(1).optional()}),hm=i.object({key:i.string().min(1),tag:i.string().min(1),componentName:i.string().min(1),sourceFile:i.string().min(1),sourceLocator:Be.optional(),label:i.string().min(1),capabilities:_e,writeTarget:Vs,effectiveWriteTarget:zs.optional(),provenanceChain:oe.optional(),componentSemantic:i.record(i.string(),i.unknown()).optional(),contentModel:i.record(i.string(),i.unknown()).optional(),mediaModel:i.record(i.string(),i.unknown()).optional(),styleSource:tn.optional(),conditional:i.record(i.string(),i.unknown()).optional(),dynamicData:Qt.optional(),textSegments:i.array(Fe),boundaryKind:Se.nullable(),isOpaque:i.boolean(),ancestors:i.array(ae),children:i.array(ae),siblings:i.array(ae)}),Sm=i.object({key:i.string().min(1),tag:i.string().min(1),label:i.string().min(1),sourceLocator:Be.optional(),capabilities:i.object({constraints:_e.shape.constraints}),isOpaque:i.boolean(),provenanceChain:i.object({editMode:oe.shape.editMode,diagnostics:oe.shape.diagnostics}).optional(),dynamicDataSummary:Zt.optional(),ancestors:i.array(ae)}),_m=i.object({key:i.string().min(1),tag:i.string().min(1),label:i.string().min(1),sourceLocator:Be.optional(),isOpaque:i.boolean(),ancestors:i.array(ae),componentName:i.string().min(1),sourceFile:i.string().min(1),capabilities:_e,provenanceChain:i.object({editMode:oe.shape.editMode,diagnostics:oe.shape.diagnostics}).optional(),textSegments:i.array(i.object({index:Fe.shape.index,editable:Fe.shape.editable,sourceKind:Jt.shape.kind.nullable()})),dynamicData:Qt.optional(),boundaryKind:Se.nullable()}),bm=i.object({key:i.string().min(1),mediaModel:i.record(i.string(),i.unknown()).optional(),styleSource:tn.optional()});var Qs=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Zs=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],Js=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],ea=new Set(Qs),ta=new Set(Zs),na=new Set(Js),ia={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function fm(t){return ea.has(qe(t))}function sa(t){return ta.has(qe(t))}function aa(t){return na.has(qe(t))}function Em(t){let{operationSummary:n}=t;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:t.fallbackMode!=="preview"?{...ia}:{canUpdateText:aa(t.tagName),canInsertChild:sa(t.tagName),canMove:!1,canRemove:!1}}function qe(t){return t?.trim().toLowerCase()??""}import{z as nn}from"zod";var Tm=nn.object({routeId:nn.string().min(1),mutationContext:te.optional()}).strict();var Am={PATCH_VALIDATION_FAILED:"The code didn't pass validation. Try describing the change more specifically.",PATCH_BATCH_FAILED:"The site code couldn't be generated. Please regenerate the site.",PATCH_BATCH_INVALID:"The change couldn't be applied. Try simpler instructions.",VALIDATION_FAILED:"Your message couldn't be sent as written. Please edit it and try again.",WORKSPACE_MESSAGE_CONTAINS_SECRET:"Your message looks like it contains a secret or token, so it wasn't sent. Remove it and try again.",WORKSPACE_TOOL_RESULT_INVALID:"This change couldn't be completed and was rolled back. Please try again.",WORKSPACE_TOOL_FAILED:"A tool step failed. Please try again.",WORKSPACE_TOOL_RESULT_MISSING:"The tool didn't return a usable result. Please try again.",WORKSPACE_MODEL_STREAM_FAILED:"The model stream ended unexpectedly. Please try again.",WORKSPACE_MODEL_STREAM_ABORTED:"Generation was interrupted before finishing. Please try again.",MODEL_OUTPUT_TRUNCATED:"The response was too long and was cut off before any change was applied. Try again, or split the request into smaller changes.",WORKSPACE_EDIT_NOT_APPLIED:"No change was applied. Try describing the change differently.",WORKSPACE_INITIAL_EXECUTION_FAILED:"Initial generation failed. Please retry from the brief.",WORKSPACE_INITIAL_GENERATION_CHECK_FAILED:"Initial generation could not be verified. Please retry.",WORKSPACE_INITIAL_GENERATION_FINALIZE_FAILED:"Initial generation could not finalize. Please retry.",WORKSPACE_INITIAL_GENERATION_QUALITY_GATE_FAILED:"Initial generation failed quality checks. Please regenerate the site.",WORKSPACE_ITERATION_QUALITY_GATE_FAILED:"Quality check failed. The change was rolled back; try a smaller or more specific request.",WORKSPACE_SOCKET_DEAD:"The workspace connection was lost. Please retry.",WORKSPACE_RUN_CANCELLED:"The run was cancelled.",WORKSPACE_RUN_ABANDONED:"This run was interrupted and did not finish. Please try again.",WORKSPACE_RUN_REQUEST_FAILED:"Couldn't start the workspace. Please try again.",WORKSPACE_RUN_BAD_RESPONSE:"The server response was malformed. Please try again.",WORKSPACE_SOCKET_UNAVAILABLE:"Workspace connection unavailable. Please try again.",WORKSPACE_SOCKET_ERROR:"The workspace connection had an error. Please try again.",WORKSPACE_SOCKET_CLOSED:"The workspace connection closed. Please try again.",WORKSPACE_SOCKET_OPEN_TIMEOUT:"Couldn't reach the workspace in time. Please try again.",WORKSPACE_CLIENT_MESSAGE_ID_MISSING:"Something went wrong sending your message. Please try again.",SITE_SNAPSHOT_REQUIRED:"This site has no usable snapshot yet. Complete Step 3 first.",AGENT_TIMEOUT:"That took longer than expected. Try breaking the change into smaller pieces.",SANDBOX_NOT_AVAILABLE:"The preview environment isn't ready. Your edits have still been saved.",PREVIEW_BUILD_FAILED:"Preview is available, but the production build failed. Fix the reported build error before deploying.",PREVIEW_BUILD_NOT_CONFIGURED:"Preview is available, but the production build check is not configured.",PREVIEW_BUILD_SANDBOX_NOT_FOUND:"Preview is available, but the build check could not find the active preview sandbox.",WS_CONNECTION_ERROR:"Connection lost. Reconnecting\u2026",USER_MESSAGE_PERSIST_FAILED:"Your message wasn't saved. Please send it again.",CLARIFICATION_REPLY_STALE:"That question has expired. Please tell me what you'd like to do now.",CLARIFY_MODEL_FAILED:"Clarify couldn't finish generating questions. Please try again.",WORKSPACE_RUN_IN_FLIGHT:"Another session is already running. Please try again in a moment.",SITE_OPERATION_LOCKED:"Another change is already running for this site. Wait for it to finish, then try again.",EDIT_ENGINE_VERSION_INVALID:"Invalid editor version. Refresh the page and try again.",SANDBOX_DEPENDENCY_SYNC_FAILED:"The preview runtime could not be prepared. Please try again.",SANDBOX_PREVIEW_FAILED:"The site preview failed to start. Please try again.",SANDBOX_DEPENDENCY_VERSION_MISMATCH:"The preview runtime could not be verified. Please try again.",SANDBOX_RUNTIME_NOT_READY:"The preview needs to be refreshed before this change can be applied. Refresh the preview and try again.",GENERIC:"Something went wrong. Please try again."},Pm={UNDO_OR_ROLLBACK:"I can't roll back from chat. Use the version history at the top right to pick a restore point.",HISTORY_RECALL:"Tell me what you'd like to change now\u2014I'll work from the current page state.",OUT_OF_SCOPE:"That's outside what I can do from chat. Try the corresponding panel on the right."},vm={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},Cm={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var sn="0.6.5",jm="x-vcp-edit-engine-version",Dm="x-vcp-edit-engine-version-source",We=class extends Error{constructor(n="Invalid edit-engine version."){super(n),this.code="EDIT_ENGINE_VERSION_INVALID",this.name="EditEngineVersionParseError"}},oa=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/;function ra(t){return oa.test(t)}function ca(t){if(typeof t!="string"||!ra(t))throw new We;return t}function wm(t){return t==null?{version:sn,source:"fallback_current"}:{version:ca(t),source:"explicit"}}function Om(){return{version:sn,source:"system_current"}}import{z as y}from"zod";var ma=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],an=y.object({name:y.string().min(1).max(100),type:y.enum(ma),label:y.string().min(1).max(255),required:y.boolean().optional(),options:y.array(y.string()).optional()}),Um=y.object({name:y.string(),cms_type:y.string(),label:y.string().optional(),required:y.boolean().optional(),value_shape:y.string().optional(),front_display:y.enum(["visible","internal","forbidden"]).optional(),choices:y.array(y.object({value:y.union([y.string(),y.number()]),label:y.string()})).optional()}),Km=y.object({route_file_path:y.string().min(1),target_component_path:y.string().min(1),content_type_hint:y.string().min(1),required_fields:y.array(an).optional(),mode:y.enum(["bind_existing","provision"]),list_mode:y.enum(["page","embedded"]).optional(),fields:y.array(an).optional(),seed_records:y.array(y.record(y.string(),y.unknown())).optional()});import{z as T}from"zod";var la=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number"],pa=T.object({name:T.string().min(1).max(100),type:T.enum(la),label:T.string().min(1).max(255),required:T.boolean().optional(),options:T.array(T.string()).optional()}),da=T.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),Bm=T.object({mode:T.enum(["bind_existing","provision"],{error:'mode is required. Use {"mode":"bind_existing","form_hint":"<exact form code or name>"} or {"mode":"provision","name":"<confirmed form name>","component_slug":"<ascii-kebab>","fields":[...]}. Never call connect_form with {}.'}),form_hint:T.string().min(1).optional(),name:T.string().min(1).max(255).optional(),component_slug:da,description:T.string().min(1).max(1e3).optional(),fields:T.array(pa).optional()}).superRefine((t,n)=>{t.mode==="bind_existing"&&!t.form_hint?.trim()&&n.addIssue({code:"custom",path:["form_hint"],message:"form_hint is required for bind_existing"}),t.mode==="provision"&&!t.name?.trim()&&n.addIssue({code:"custom",path:["name"],message:"name is required for provision"})}),qm=T.object({name:T.string(),label:T.string(),cms_type:T.string(),required:T.boolean()});import{z as U}from"zod";var ua=["provisioning","cms_app_created","seeded","ready","failed"],Vm=U.object({tenant_id:U.string().min(1),site_id:U.string().min(1),collection_slug:U.string().min(1),cms_collection_id:U.string().min(1).nullable(),status:U.enum(ua),owned_by_vcp:U.boolean(),run_id:U.string().min(1).nullable(),last_error:U.string().nullable(),created_at:U.string().datetime(),updated_at:U.string().datetime()});var on="/vibe/v1";function $m(t){let n=t?.trim().replace(/\/+$/,"");if(!n)return null;try{let a=new URL(n),c=a.pathname.replace(/\/+$/,"");return a.search="",a.hash="",a.pathname=c.endsWith(on)?c:on,a.href.replace(/\/+$/,"")}catch{return n}}import{z as A}from"zod";var ga=A.object({maxSites:A.number().int().nullable().optional(),maxStorageMb:A.number().int().nullable().optional(),customDomains:A.boolean().nullable().optional()}).passthrough().superRefine((t,n)=>{for(let a of Object.keys(t))a.includes("_")&&n.addIssue({code:"custom",path:[a],message:"Public plan feature fields must use camelCase."})}),ha=A.object({subscriptionId:A.string().min(1),planId:A.string().min(1),locale:A.enum(["en","zh_CN"]).or(A.string().min(1)),currentPeriodEnd:A.string().nullable(),servicePeriodEnd:A.string().nullable(),featureSnapshot:ga.nullable(),code:A.string().nullable(),level:A.number().int().nullable(),name:A.string().nullable()}).strict(),Sa=A.object({hasActiveSubscription:A.boolean()}).strict(),rn=A.object({plan:ha.nullable(),entitlement:Sa}).strict();import{z as _}from"zod";var _a=["pending_dns","active"],Jm="CUSTOM_DOMAIN_ENTITLEMENT_REQUIRED",ba=_.enum(_a),ya=_.enum(["ownershipVerification","certificateValidation","traffic","unknown"]),fa=_.enum(["pending","matched"]),Ea=_.object({id:_.string().min(1),type:_.string().min(1),name:_.string().min(1),value:_.string().min(1),purpose:ya,required:_.boolean(),status:fa.optional()}).strict(),re=_.object({id:_.string().min(1),domainId:_.string().min(1).optional(),hostname:_.string().min(1),displayHostname:_.string().min(1),asciiHostname:_.string().min(1),status:ba,isPrimary:_.boolean(),deletable:_.boolean(),dnsRecords:_.array(Ea),createdAt:_.string().datetime().nullable(),checkedAt:_.string().datetime().nullable()}).strict(),xa=_.object({hostname:_.string().min(1),url:_.string().url(),status:_.literal("ready")}).strict(),cn=_.object({defaultDomain:xa,currentDomain:re.nullable(),customDomains:_.array(re)}).strict(),el=_.object({hostname:_.string().min(1),isPrimary:_.boolean().optional()}).strict(),mn=_.object({domain:re}).strict(),ln=_.object({domain:re}).strict(),pn=_.object({domain:re}).strict(),dn=_.object({deleted:_.boolean()}).strict();var ce={Inter:{import:"Inter"},"Inter Tight":{import:"Inter_Tight"},"DM Sans":{import:"DM_Sans"},"Source Sans 3":{import:"Source_Sans_3"},"Libre Franklin":{import:"Libre_Franklin"},Montserrat:{import:"Montserrat"},Archivo:{import:"Archivo"},"Space Grotesk":{import:"Space_Grotesk"},Manrope:{import:"Manrope"},"IBM Plex Sans":{import:"IBM_Plex_Sans"},Oswald:{import:"Oswald"},"Roboto Condensed":{import:"Roboto_Condensed"},"Bebas Neue":{import:"Bebas_Neue",weights:["400"]},"Playfair Display":{import:"Playfair_Display"},Lora:{import:"Lora"},Fraunces:{import:"Fraunces"},"Cormorant Garamond":{import:"Cormorant_Garamond"},"JetBrains Mono":{import:"JetBrains_Mono"},"IBM Plex Mono":{import:"IBM_Plex_Mono"},"Noto Sans SC":{import:"Noto_Sans_SC",download:!1},"Noto Serif SC":{import:"Noto_Serif_SC",download:!1}},Ia={heading:"Inter",body:"Inter"},un=ce.Inter;function Ee(t){return t.trim().replace(/\s+/g,"_").toLowerCase()}var _n=(()=>{let t=new Map;for(let[n,a]of Object.entries(ce))t.set(Ee(n),a),t.set(Ee(a.import),a);return t})();function Ra(t){return typeof t!="string"||t.trim().length===0?un:_n.get(Ee(t))??un}var Ta=(()=>{let t=new Map;for(let[n,a]of Object.entries(ce))t.set(a.import,n);return t})();function ka(t){if(typeof t!="string"||t.trim().length===0)return"Inter";let n=_n.get(Ee(t));return n?Ta.get(n.import)??"Inter":"Inter"}var Aa=Object.keys(ce),gn='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',hn='Georgia, "Times New Roman", serif',Sn='"SFMono-Regular", Consolas, monospace',Pa=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),va=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(t=>t.toLowerCase())),Ca=new Set(["JetBrains Mono","IBM Plex Mono"].map(t=>t.toLowerCase()));function Na(t){let n=t.toLowerCase();return Ca.has(n)||n.includes("mono")?"mono":va.has(n)||n.includes("serif")?"serif":"sans"}function He(t,n){let a=g=>(g??"").trim().replace(/^['"]|['"]$/g,"").replace(/[^A-Za-z0-9 _-]+/g,"").trim().slice(0,60),c=a(t),r=a(n),m=g=>Pa.has(g.toLowerCase());if(c&&m(c)){let g=c.toLowerCase();return g.includes("mono")?Sn:g.includes("serif")?hn:gn}let S=c;S||(S=m(r)?"":r),S||(S="Inter");let p=Na(S);return p==="mono"?`"${S}", ${Sn}`:p==="serif"?`"${S}", ${hn}`:`"${S}", ${gn}`}function ja(t){return{"--site-font-sans":He(t?.body,"Inter"),"--site-font-heading":He(t?.heading,t?.body??"Inter")}}var Da=[{id:"archivo-inter",heading:"Archivo",body:"Inter"},{id:"playfair-source-sans",heading:"Playfair Display",body:"Source Sans 3"},{id:"space-grotesk-manrope",heading:"Space Grotesk",body:"Manrope"},{id:"fraunces-libre-franklin",heading:"Fraunces",body:"Libre Franklin"},{id:"noto-serif-sc-noto-sans-sc",heading:"Noto Serif SC",body:"Noto Sans SC"},{id:"noto-sans-sc",heading:"Noto Sans SC",body:"Noto Sans SC"}];var wa=[{id:"ocean",colorSeeds:{primary:"#1e3a5f",accent:"#2563eb"}},{id:"forest",colorSeeds:{primary:"#14532d",accent:"#16a34a"}},{id:"clay",colorSeeds:{primary:"#7c2d12",accent:"#ea580c"}},{id:"violet",colorSeeds:{primary:"#3b0764",accent:"#7c3aed"}},{id:"graphite",colorSeeds:{primary:"#1f2937",accent:"#0d9488"}},{id:"crimson",colorSeeds:{primary:"#7f1d1d",accent:"#dc2626"}}];import{z as K}from"zod";var Oa=K.object({colorSeeds:K.object({primary:K.string().min(1).max(40),accent:K.string().min(1).max(40)}).strict().optional(),fonts:K.object({heading:K.string().min(1).max(60),body:K.string().min(1).max(60)}).strict().optional()}).strict().refine(t=>t.colorSeeds!==void 0||t.fonts!==void 0,{message:"colorSeeds or fonts is required"}),Ma=K.object({ok:K.literal(!0),design_plan_version:K.number().int().positive(),snapshot_id:K.string().min(1)});var $e=e.object({heading:e.string().min(1).max(160).optional(),body:e.string().min(1).max(160).optional(),paletteIntent:e.string().min(1).max(400).optional(),surfaceMode:e.enum(["light","dark"]).optional(),radius:e.enum(["none","sm","md","lg","xl"]).optional(),density:e.enum(["compact","comfortable","editorial"]).optional(),colorSeeds:e.object({primary:e.string().min(1).max(40),accent:e.string().min(1).max(40),neutral:e.string().min(1).max(40).optional(),supporting:e.array(e.string().min(1).max(40)).max(4).optional()}).optional(),imagePalette:e.object({background:e.string().min(1).max(40).optional(),foreground:e.string().min(1).max(40).optional(),card:e.string().min(1).max(40).optional(),muted:e.string().min(1).max(40).optional(),border:e.string().min(1).max(40).optional()}).optional()}),Ye=e.object({protocol:e.enum(["phone","form","download","route","external"]),ctaLabel:e.string().min(1).max(40),ctaTarget:e.string().min(1).max(200).optional(),requiresOwnerDetail:e.boolean().optional()}),Ve=e.enum(["material","reference","brief","industry"]),La=e.object({market:e.object({value:e.string().min(1).max(200),source:Ve}),customer:e.object({value:e.string().min(1).max(200),source:Ve}),purpose:e.object({options:e.array(e.string().min(1).max(60)).min(2).max(4),selected:e.string().min(1).max(60),source:Ve})}),Ua=e.enum(["text-options","motion-slider","positioning"]),Xe=e.enum(["none","subtle","moderate","expressive"]),Ka=e.enum(["compact","comfortable","editorial"]),Ga=Xe,xn=e.object({skill_name:e.string().min(1),rationale:e.string().min(4).max(200),confidence:e.enum(["high","medium","low"]).optional(),displayName:e.object({zh:e.string().min(1),en:e.string().min(1)}).partial().optional()}),Fa=e.object({value:e.string(),label:e.string(),desc:e.string().optional(),impact:e.string().optional(),isRecommended:e.boolean().optional(),preselect:e.boolean().optional(),visualHints:$e.optional(),conversionHints:Ye.optional()}),Ba=e.object({id:e.string(),type:Ua,question:e.string(),tag:e.string(),aiThinking:e.string(),options:e.array(Fa),source:e.enum(["ai-detected","always-ask"]),sourceDetail:e.string(),positioning:La.optional()}),Qe=e.object({questions:e.array(Ba).min(1).max(6)}),hl=e.object({tenant_id:e.string().min(1),site_id:e.string().min(1),brief_id:e.string().min(1),brief:e.string().min(20).max(1e3),site_default_locale:q.optional(),owner_locale:q.optional(),input_context:e.object({facts:e.array(pe).max(120),conflicts:e.array(ue).max(20),reference:de.optional(),sources:e.array(e.object({type:Pe,title:e.string().max(120).optional(),status:ve})).max(16).optional()}).optional()}),In=e.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),Sl=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("skill.selecting"),category:e.literal("page-generation"),available:e.array(e.object({id:e.string().min(1),name:e.string().min(1)})).max(20),at:e.string().min(1)}),e.object({type:e.literal("skill.selected"),category:e.literal("page-generation"),selected:e.object({id:e.string().min(1),name:e.string().min(1),reason:e.string().min(1).max(200)}),at:e.string().min(1)}),e.object({type:e.literal("clarify.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("clarify.archetype_proposals"),proposals:e.array(xn).min(1).max(5),at:e.string().min(1)}),e.object({type:e.literal("clarify.finished"),questions_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),error_category:In.optional(),retryable:e.boolean().optional(),attempts:e.number().int().positive().optional(),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),at:e.string().min(1)})]),qa=e.enum(["draft","brief_submitted","clarifying","sitemap_ready","workspace_ready","deployed","archived","error"]),Wa={draft:["brief_submitted","archived","error"],brief_submitted:["clarifying","archived","error"],clarifying:["sitemap_ready","archived","error"],sitemap_ready:["workspace_ready","archived","error"],workspace_ready:["deployed","archived","error"],deployed:["workspace_ready","archived","error"],archived:[],error:["draft","brief_submitted","clarifying","sitemap_ready"]};function _l(t,n){if(!Wa[t].includes(n))throw new Error(`Invalid site status transition: ${t} -> ${n}`);return n}var Ha=e.enum(["planning","initial_generation_running","generated"]),Va={planning:["initial_generation_running"],initial_generation_running:["generated","planning"],generated:[]};function bl(t,n){if(t===n)return n;if(!Va[t].includes(n))throw new Error(`Invalid site generation state transition: ${t} -> ${n}`);return n}function yl(t){if(t.agent_type!=="workspace"||t.current_state==="generated")return null;switch(t.event_type){case"run.started":return t.current_state==="planning"?"initial_generation_running":null;case"run.finished":return t.current_state==="initial_generation_running"?"generated":null;case"run.failed":return t.current_state==="initial_generation_running"?t.has_current_snapshot?"generated":"planning":null;default:return null}}var fl="SITE_PLANNING_INPUT_FROZEN",El="SITE_PLANNING_LOCKED",xl=e.object({tenant_id:e.string().min(1),owner_user_id:e.string().min(1),name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),Il=e.object({name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),Rl=e.object({name:e.string().min(1).max(120)}),Tl=e.object({name:e.string().min(1).max(120),default_locale:q.optional()}),kl=e.object({body:e.string().min(20).max(1e3)}),Al=e.object({body:e.string().min(20).max(1e3)}),Ze=e.string().url().refine(t=>{try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}},{message:"URL must use http or https protocol"}),Pl=e.object({tenant_id:e.string().min(1),site_url:Ze,site_name:e.string().trim().min(1).max(255).optional()}),B=t=>e.object({code:e.number().int(),data:t,message:e.string()}),vl=B(It),Cl=B(Rt),Nl=B(e.object({site_id:e.string().min(1),site_url:Ze})),jl=B(cn),Dl=B(mn),wl=B(ln),Ol=B(pn),Ml=B(dn),Ll=B(rn),Q=e.object({id:e.string().min(1),tenant_id:e.string().min(1),owner_user_id:e.string().min(1).nullable(),name:e.string().min(1),slug:e.string().min(1),status:qa,generation_state:Ha,planning_locked_at:e.string().min(1).nullable(),current_sitemap_id:e.string().min(1).nullable(),current_snapshot_id:e.string().min(1).nullable(),deployed_url:e.string().url().nullable(),default_locale:q,owner_locale:q.optional(),cms_site_id:e.string().nullable().optional(),cms_site_url:Ze.nullable().optional(),schema_version:e.literal(1),created_at:e.string().min(1),updated_at:e.string().min(1)}),Je=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),body:e.string().min(1),source:e.enum(["user","import","system"]),created_at:e.string().min(1),updated_at:e.string().min(1)}),Ul=e.object({site:Q,brief:Je,next_step:e.literal("clarify")}),Kl=e.object({site:Q,brief:Je}),Gl=e.object({brief:Je}),za=e.enum(["queued","running","succeeded","failed","cancelled"]),Rn=e.enum(["clarify","sitemap","workspace"]),Tn=e.enum(["clarify","sitemap","initial_generation","iteration"]),kn=e.enum(["clarify","sitemap","workspace","summarize"]),H=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),agent_type:Rn,run_kind:Tn,status:za,model_route:kn,started_at:e.string().min(1).nullable(),finished_at:e.string().min(1).nullable(),error_code:e.string().min(1).nullable(),created_at:e.string().min(1)}),Fl=e.object({run_id:e.string().min(1).optional(),site_id:e.string().min(1),agent_type:Rn,run_kind:Tn.optional(),model_route:kn,input:e.record(e.string(),e.unknown()).optional()}).superRefine((t,n)=>{me(t.input)&&n.addIssue({code:"custom",path:["input"],message:"Agent run input must not contain secrets"})}),Bl=e.object({agent_run:H,next_step:e.literal("stream_events")}),et=e.enum(["draft","candidate","current","failed"]),le=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),version:e.number().int().positive(),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),reason:e.enum(["initial_generation","workspace_edit","pre_deploy","manual_save","rollback"]),status:et,created_at:e.string().min(1)}),ql=e.object({snapshot_id:e.string().min(1).optional(),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),reason:le.shape.reason,status:et.default("candidate")}),Wl=e.object({site:Q,snapshot:le,next_step:e.literal("workspace")}),Hl=e.object({site:Q,snapshot:le,next_step:e.literal("workspace")}),Vl=e.object({status:e.literal("deleted"),snapshot_id:e.string().min(1)}),tt=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),snapshot_id:e.string().min(1),version:e.number().int().positive(),accepted_commit:e.string().min(1),source_run_id:e.string().min(1).nullable(),created_at:e.string().min(1)}),$a=tt.extend({reason:le.shape.reason,status:et}),zl=e.object({accepted_commit:e.string().min(1),source_run_id:e.string().min(1).optional()}),$l=e.object({site_version:tt,next_step:e.literal("workspace")}),Yl=e.object({site_versions:e.array($a)}),Xl=e.object({site:Q,snapshot:le,site_version:tt,next_step:e.literal("workspace")}),Ql=e.object({snapshot_id:e.string().min(1),force_rehydrate:e.boolean().optional()}),Zl=e.object({status:e.enum(["ready","failed"]),preview_url:e.string().min(1).optional(),code:e.string().min(1).optional(),message:e.string().min(1).optional(),retryable:e.boolean().optional()}),Jl="DEPLOYMENT_ENTITLEMENT_REQUIRED",nt=e.enum(pt),Re=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),snapshot_id:e.string().min(1),version:e.number().int().positive(),status:nt,provider:e.enum(["cloudflare"]),url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),ep=e.object({snapshot_id:e.string().min(1).optional()}).default({}),tp=e.object({deployment:Re}),np=e.object({deployment:Re.nullable()}),ip=e.object({deployment:Re}),bn=e.object({id:e.string().min(1),status:nt,url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable()}),sp=e.object({current:bn.nullable(),latest_released:bn.nullable()}),Ya=e.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),X=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),deployment_id:e.string().min(1),seq:e.number().int().positive(),sent_at:e.string().min(1)}),xe=e.object({deployment:Re}),ap=e.discriminatedUnion("type",[X.extend({type:e.literal("deployment.snapshot"),payload:xe}),X.extend({type:e.literal("deployment.status.changed"),payload:xe}),X.extend({type:e.literal("deployment.finished"),payload:xe}),X.extend({type:e.literal("deployment.failed"),payload:xe}),X.extend({type:e.literal("deployment.realtime.recovered"),payload:e.object({action:e.literal("refresh")})}),X.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})})]),op=e.object({tenant_id:e.string().min(1),site_id:e.string().min(1),deployment_id:e.string().min(1),status:nt,updated_at:e.string().min(1)}),Xa="vcp:deployments",rp={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:Xa,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...Ya.options]},Qa=e.object({error:e.object({code:e.string().min(1),message:e.string().min(1),details:e.unknown().optional(),request_id:e.string().min(1).optional(),retryable:e.boolean().default(!1)})}),cp=e.object({error:Qa.shape.error.extend({code:e.literal("AGENT_RUN_IN_FLIGHT"),details:e.object({code:e.literal("AGENT_RUN_IN_FLIGHT"),message:e.string().min(1),agent_run:H})})}),mp=e.object({colors:e.record(e.string(),e.string()).default({}),typography:e.record(e.string(),e.string()).default({}),spacing:e.record(e.string(),e.string()).default({}),motion:e.record(e.string(),e.string()).default({})}),Za=e.object({theme_id:e.string().min(1),paletteIntent:e.string().min(1),tone:e.string().min(1),mediaMood:e.string().min(1),motionLevel:Xe.optional(),userVisualHints:$e.optional()}),Ja=e.object({question:e.string().min(1),answer:e.string().min(1)}),lp=e.object({query:e.string().min(1),keywords:e.array(e.string()).default([]),orientation:e.enum(["landscape","portrait","square"]).optional(),role:e.enum(["hero","section","card","gallery","testimonial","decorative"]),altHint:e.string().min(1)}),pp=e.object({id:e.string().min(1),role:e.enum(["site_background","nav_background","footer_background"]),query:e.string().min(1),keywords:e.array(e.string()).default([]),treatment:e.enum(["cover","fixed-cover","subtle-texture"]),altHint:e.string().optional()}),eo=e.object({provider:e.enum(["unsplash","pexels"]),providerLabel:e.enum(["Unsplash","Pexels"]),providerHref:e.string().url(),photoHref:e.string().url().optional(),photographerName:e.string().optional(),photographerHref:e.string().url().optional(),requiresAttribution:e.boolean()}),dp=e.object({src:e.string().min(1),alt:e.string().min(1),width:e.number().int().positive().optional(),height:e.number().int().positive().optional(),provider:e.enum(["unsplash","pexels","placeholder"]).optional(),providerId:e.string().optional(),photoUrl:e.string().url().optional(),photographer:e.string().optional(),photographerUrl:e.string().url().optional(),credit:e.string().optional(),dominantColor:e.string().optional(),attribution:eo.optional()}),to=e.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),Z=e.object({id:e.string().min(1),name:e.string().min(1),category:e.literal("page-generation"),version:e.string().min(1).optional(),reason:e.string().min(1).max(200),source:to.default("system_recommended")}),f=e.string().min(1).max(2e3),yn=e.string().min(1).max(120),An=e.object({visualDirection:f,brandFeeling:f,paletteIntent:f,typographyIntent:f,density:Ka,motionLevel:Ga,mediaStrategy:f,compositionRules:e.array(f).max(20),avoidPatterns:e.array(f).max(20),fonts:e.object({heading:e.string().min(1),body:e.string().min(1)}).optional(),colorSeeds:e.object({primary:e.string().min(1).max(40),accent:e.string().min(1).max(40),neutral:e.string().min(1).max(40).optional(),supporting:e.array(e.string().min(1).max(40)).max(4).optional()}).optional(),surfaceMode:e.enum(["light","dark"]).optional(),radius:e.enum(["none","sm","md","lg","xl"]).optional(),imagePalette:e.object({background:e.string().min(1).max(40).optional(),foreground:e.string().min(1).max(40).optional(),card:e.string().min(1).max(40).optional(),muted:e.string().min(1).max(40).optional(),border:e.string().min(1).max(40).optional()}).optional()}),it=160,Pn=e.object({routeGoal:f,narrativeArc:f,firstViewportIntent:f,visualContinuity:f,sectionRhythm:f,avoidPatterns:e.array(f).max(20),displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(it).optional(),metaTitle:e.string().min(1).max(120).optional(),metaDescription:e.string().min(1).max(320).optional()}),vn=e.enum(["model_call","validation","repair","preview","worker_group"]),W=e.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),Cn=e.object({sectionRole:f,contentIntent:f,layoutIntent:f,visualIntent:f,mediaIntent:f,motionIntent:f,copyTone:f,displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(it).optional(),ctaIntent:f.optional(),continuityWithPrevious:f.optional(),avoidRepeating:e.array(f).max(20).optional(),industryRecipeRefs:e.array(yn).max(12).optional(),templateRecipeRefs:e.array(yn).max(12).optional()}),Nn=e.object({siteName:e.string().min(1).max(120),tagline:e.string().min(1).max(200).optional(),primaryCta:e.object({label:e.string().min(1).max(60),target:e.string().min(1).max(200)}).optional(),trustSignals:e.array(e.string().min(1).max(60)).max(6).optional(),industry:e.string().min(1).max(40).optional()}),no=e.enum(["solid","floating"]),io=e.enum(["background","card","primary","frosted"]),so=e.enum(["sticky","hide-on-scroll","static"]),ao=e.enum(["bar","island"]),oo=e.object({variant:no,surface:io.optional(),behavior:so.optional(),shape:ao.optional()}),ro=e.object({form:f,layoutIntent:f,scrollBehavior:f,shell:oo.optional(),avoidPatterns:e.array(f).max(10).optional()}),co=e.enum(["background","card","primary","inverse"]),mo=e.object({surface:co}),lo=e.object({form:f,composition:f,shell:mo.optional(),avoidPatterns:e.array(f).max(10).optional()}),po=e.object({pattern:f,intent:f}),jn=e.object({header:ro,footer:lo,mobileNav:po}),Dn=e.object({schemaVersion:e.literal(1).default(1),siteDesignContext:An,routeCards:e.record(e.string().min(1),Pn),blockContexts:e.record(e.string().min(1),Cn),selectedSkillPacks:e.array(Z).max(3).optional(),branding:Nn.optional(),chromeDesign:jn.optional()}),up=e.object({siteDesignContext:An.omit({imagePalette:!0}).optional(),routeCards:e.record(e.string().min(1),Pn).optional(),blockContexts:e.record(e.string().min(1),Cn).optional(),branding:Nn.optional(),chromeDesign:jn.optional()}),uo=e.object({id:e.string(),type:e.string(),variant:e.string().optional(),order:e.number(),props:e.record(e.string(),e.unknown()),enabled:e.boolean(),meta:e.object({aiGenerated:e.boolean(),userEdited:e.boolean(),lastEditedAt:e.string(),lastEditedBy:e.enum(["ai","user"]),userInstruction:e.string().optional()}).optional()}).strict(),go=e.string().regex(ee,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),ho=new RegExp(`^/(?:${$}(?:/${$})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),So=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,_o=e.union([e.string().regex(ho),e.string().regex(So)]),fn=e.object({label:e.string(),href:_o}),bo=e.object({primaryLinks:e.array(fn),footerLinks:e.array(fn)}),wn=e.object({id:e.string(),slug:go,title:e.string(),blocks:e.array(uo).min(1),layout:e.enum(["default","centered","fullwidth"]).optional(),navigation:e.object({showInHeader:e.boolean(),showInFooter:e.boolean(),order:e.number()})}).strict(),yo=wn.extend({slug:e.string().min(1)}),En=e.object({label:e.string(),href:e.string().min(1)}),fo=e.object({primaryLinks:e.array(En),footerLinks:e.array(En)}),On=e.object({site_name:e.string().min(1).max(80).optional(),version:e.number().int().positive(),pages:e.array(wn).min(1),navigation:bo,integrations:e.object({cms:e.unknown().optional(),analytics:e.unknown().optional()}).optional(),meta:e.object({generatedAt:e.string(),generatedBy:e.literal("sitemap-agent"),source_brief_id:e.string().optional(),source_answer_ids:e.array(e.string()).optional()}),skillSelection:Z,visualTheme:Za.optional(),userChoices:e.array(Ja).optional(),confirmedChoices:e.object({conversion:Ye.optional()}).optional()}).strict(),Te=On.superRefine((t,n)=>{let a=new Map,c=0;t.pages.forEach((r,m)=>{r.slug==="/"&&(c+=1);let S=a.get(r.slug);S!==void 0?n.addIssue({code:"custom",path:["pages",m,"slug"],message:`Duplicate page slug '${r.slug}' (first used at pages.${S}.slug).`}):a.set(r.slug,m)}),(c!==1||t.pages[0]?.slug!=="/")&&n.addIssue({code:"custom",path:["pages"],message:"Sitemap must contain exactly one home page at pages[0] with slug '/'."})}),gp=On.omit({skillSelection:!0,visualTheme:!0,userChoices:!0,confirmedChoices:!0}).extend({site_name:e.string().min(1).max(80),pages:e.array(yo).min(1),navigation:fo}),Eo=e.enum(["ai","user"]),J=e.object({site_id:e.string().min(1),page_id:e.string().min(1),edited_by:Eo.default("ai"),source_agent_run_id:e.string().min(1).optional()}),hp=J.extend({block_id:e.string().min(1),target_index:e.number().int().min(0)}),xo=J.extend({block_id:e.string().min(1)}),Io=J.extend({block_id:e.string().min(1),instruction:e.string()}),Sp=J.extend({block_id:e.string().min(1),variant:e.string().min(1).nullable()}),_p=J.extend({block_id:e.string().min(1),props:e.record(e.string(),e.unknown()),mode:e.enum(["replace","merge"]).default("replace")}),bp=J.extend({block:e.object({id:e.string().min(1),type:e.string().min(1),variant:e.string().min(1).optional(),props:e.record(e.string(),e.unknown()).default({}),insert_index:e.number().int().min(0).optional()})}),Ro=e.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),yp=e.discriminatedUnion("operation",[e.object({operation:e.literal("delete_block"),input:xo}).strict(),e.object({operation:e.literal("update_block_instruction"),input:Io}).strict()]),To=e.enum(["SITEMAP_EDIT_INVALID","SITEMAP_API_NOT_CONFIGURED","SITEMAP_NOT_FOUND","SITEMAP_PAGE_NOT_FOUND","SITEMAP_BLOCK_NOT_FOUND","SITEMAP_BLOCK_ALREADY_EXISTS","SITEMAP_EDIT_FAILED"]),ko=e.object({status:e.literal("updated"),operation:Ro,site_id:e.string().min(1),sitemap_id:e.string().min(1),version:e.number().int().positive(),changed_pages:e.array(e.string().min(1)).min(1),requires_code_patch:e.literal(!0)}),Ao=e.object({status:e.literal("failed"),code:To,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),fp=e.discriminatedUnion("status",[ko,Ao]),st=e.object({question_id:e.string().min(1),value:e.string().min(1),label:e.string().min(1).optional(),question:e.string().min(1).optional(),option_label:e.string().min(1).optional(),motion_level:Xe.optional(),visual_tonality:$e.optional(),conversion:Ye.optional(),positioning:e.object({market:e.string().min(1).max(200),customer:e.string().min(1).max(200),purpose:e.string().min(1).max(60)}).optional()}),Ep=e.object({tenant_id:e.string().min(1),site_id:e.string().min(1),brief_id:e.string().min(1),brief:e.string().min(20).max(1e3),answers:e.array(st).min(1).max(10),skillSelection:Z,site_default_locale:q.optional(),owner_locale:q.optional(),reference:de.optional(),input_context:e.object({facts:e.array(pe).max(120),conflicts:e.array(ue).max(20)}).optional()}),Mn=e.enum(["planning","generating","validating","ready"]),Po=e.enum(["salvaged","deterministic_fallback"]),vo=e.enum(["model_exception_settled_prefix","model_exception_safe_root"]),Ln={outcome:Po.optional(),reason:vo.optional(),attempts:e.number().int().positive().optional()};function Un(t,n){if(t.type!=="sitemap.generated")return;let a=t.outcome!==void 0,c=t.reason!==void 0;a!==c&&n.addIssue({code:"custom",path:[a?"reason":"outcome"],message:"sitemap.generated outcome and reason must be provided together"})}var Co=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:Mn,message:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generated"),sitemap_id:e.string().min(1),sitemap:Te,...Ln,at:e.string().min(1)}),e.object({type:e.literal("sitemap.clamped"),reason:e.enum(["page_early_stop","finalize_best_effort"]),original_page_count:e.number().int().nonnegative().optional(),final_page_count:e.number().int().nonnegative().optional(),original_enabled_block_count:e.number().int().nonnegative().optional(),final_enabled_block_count:e.number().int().nonnegative().optional(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.started"),slot_count:e.number().int().nonnegative(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.finished"),slot_count:e.number().int().nonnegative(),provider_counts:e.object({unsplash:e.number().int().nonnegative(),pexels:e.number().int().nonnegative(),placeholder:e.number().int().nonnegative()}),fallback_count:e.number().int().nonnegative(),error_codes:e.array(e.string()),at:e.string().min(1)}),e.object({type:e.literal("snapshot.created"),snapshot_id:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),snapshot_id:e.string().min(1).optional(),at:e.string().min(1)})]),xp=Co.superRefine(Un),No=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),version:e.number().int().positive(),sitemap:Te,source_agent_run_id:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Ip=e.object({sitemap_id:e.string().min(1).optional(),sitemap:Te,source_agent_run_id:e.string().min(1).optional()}),Rp=e.object({site:Q,sitemap:No,next_step:e.literal("workspace")}),jo=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),brief_id:e.string().min(1),questions:Qe,answers:e.array(st),selected_archetype:Z.optional(),completed_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Tp=e.object({answers:e.array(st).min(1),questions:Qe,selected_archetype:Z.optional()}),kp=e.object({clarify_session:jo}),Ap=e.object({questions:Qe,selected_archetype:Z}),Do=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),version:e.number().int().positive(),design_plan:Dn,source_agent_run_id:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Pp=e.object({design_plan_id:e.string().min(1).optional(),design_plan:Dn,source_agent_run_id:e.string().min(1).optional()}),vp=e.object({design_plan:Do}),ke=e.enum(["initial_generation","iteration"]),wo=e.object({label:e.string().min(1).max(48),prompt:e.string().min(1).max(160)}).strict(),Oo=e.enum(["model","derived","mixed","advisor"]),Kn=e.object({suggestions:e.array(wo).min(1).max(4),source:Oo}).strict(),Mo=e.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),Lo=e.enum(["generation_succeeded","entry_slots_omitted","quality_gate_exhausted","schema_gate_exhausted","stream_schema_mismatch","stream_generation_error","generation_error","fallback_compiler_error","legacy_result_missing_metadata"]),Gn=e.enum(["run.started","message.delta","user.message","plan.updated","clarify.partial","clarify.archetype_proposals","clarify.finished","sitemap.generating","sitemap.partial","sitemap.generated","sitemap.clamped","sitemap.updated","sitemap.resync.failed","sitemap.resync.warning","block.changed","tool.started","tool.finished","workspace.plan.created","workspace.worker.updated","workspace.task.updated","workspace.degraded","workspace.design_plan.outcome","workspace.suggestions","file.changed","snapshot.created","snapshot.finalized","preview.preparing","preview.ready","preview.build.started","preview.build.succeeded","preview.build.failed","run.failed","run.finished","media_resolution.started","media_resolution.finished","skill.selecting","skill.selected","activity.started","activity.updated","activity.finished","activity.failed"]),Uo=e.object({id:e.string().min(1),title:e.string().min(1),status:e.enum(["pending","running","completed","failed"])}),z=e.enum(["pending","running","completed","completed_with_skips","failed","skipped"]),at=e.enum(["style_media","chrome","sections","layout","pages","detect_typecheck","repair","finalize","sitemap_resync","preview"]),ot=e.object({code:e.string().min(1),message:e.string().min(1),path:e.string().min(1).optional(),task_id:e.string().min(1).optional(),details:e.record(e.string(),e.unknown()).optional()}),O=e.string().min(1).refine(t=>Qn(t),{message:"Snapshot file paths must be safe relative POSIX paths without traversal."}),rt=e.object({deduped_paths:e.array(O),skipped_tasks:e.array(e.string().min(1)),failed_tasks:e.array(e.string().min(1)),fallback_files:e.array(e.string().min(1)),applied_paths:e.array(O)}),ct=e.object({group_id:e.string().min(1),phase:at,title:e.string().min(1),status:z,task_ids:e.array(e.string().min(1)),depends_on_groups:e.array(e.string().min(1)),target_paths:e.array(O)}),Ko=e.enum(["style","media","chrome","section","layout","page"]),mt=e.object({task_id:e.string().min(1),group_id:e.string().min(1),kind:Ko,target_path:O,block_id:e.string().min(1).optional(),block_type:e.string().min(1).optional(),block_variant:e.string().min(1).optional(),block_order:e.number().int().nonnegative().optional(),user_instruction:e.string().min(1).optional(),page_id:e.string().min(1).optional(),page_slug:e.string().min(1).optional(),page_title:e.string().min(1).optional(),title:e.string().min(1).max(60).optional(),description:e.string().min(1).max(it).optional(),status:z,required_reads:e.array(O).optional()}),lt=e.object({from_group_id:e.string().min(1),to_group_id:e.string().min(1),reason:e.enum(["style_media","chrome","sections","layout","page_composition","quality_gate"])}),Cp=e.object({plan_id:e.string().min(1),run_kind:ke,model_route:e.object({planner:e.literal("workspace_planner"),worker:e.literal("workspace")}),groups:e.array(ct),tasks:e.array(mt),dependencies:e.array(lt),expected_outputs:e.array(O),diagnostics:rt}),Np=e.object({task_id:e.string().min(1),patch:e.unknown().optional(),snapshot_id:e.string().min(1).optional(),read_files:e.array(O),diagnostics:e.array(ot),status:z}),Fn=e.object({worker_count:e.number().int().nonnegative(),task_count:e.number().int().nonnegative(),group_count:e.number().int().nonnegative()}),Bn=e.object({pending:e.number().int().nonnegative(),running:e.number().int().nonnegative(),completed:e.number().int().nonnegative(),completed_with_skips:e.number().int().nonnegative(),failed:e.number().int().nonnegative(),skipped:e.number().int().nonnegative()}),Go=e.object({type:e.literal("text"),text:e.string(),state:e.enum(["streaming","done"]).optional()}),Fo=e.object({type:e.literal("reasoning"),text:e.string(),state:e.enum(["streaming","done"]).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),Bo=e.object({type:e.literal("file"),mediaType:e.string().min(1),filename:e.string().min(1).optional(),url:e.string().min(1)}),qo=e.object({type:e.literal("source-url"),sourceId:e.string().min(1),url:e.string().min(1),title:e.string().min(1).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),Wo=e.object({type:e.literal("source-document"),sourceId:e.string().min(1),mediaType:e.string().min(1),title:e.string().min(1),filename:e.string().min(1).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),Ho=e.object({type:e.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:e.string().min(1).optional(),data:e.unknown()}),Vo=e.object({type:e.string().regex(/^tool-[a-zA-Z0-9_-]+$/),toolCallId:e.string().min(1),state:e.enum(["input-streaming","input-available","output-available","output-error"]),input:e.unknown().optional(),output:e.unknown().optional(),errorText:e.string().min(1).optional()}),zo=e.object({type:e.literal("error"),errorText:e.string().min(1)}),$o=e.object({type:e.literal("step-start")}),Ie=e.union([Go,Fo,Bo,qo,Wo,Ho,Vo,zo,$o]),Yo=e.string().min(1).max(512).refine(t=>Qn(t)&&!/^[A-Za-z]:\//.test(t),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),Xo=e.array(Yo).min(1).max(64),Qo=e.array(e.string().min(1).max(120)).min(1).max(64),Zo=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("message.delta"),text:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("user.message"),client_message_id:e.string().min(1),message_id:e.string().min(1),parts:e.array(Ie).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("plan.updated"),steps:e.array(Uo),at:e.string().min(1)}),e.object({type:e.literal("clarify.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("clarify.archetype_proposals"),proposals:e.array(xn).min(1).max(5),at:e.string().min(1)}),e.object({type:e.literal("clarify.finished"),questions_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:Mn,message:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generated"),sitemap_id:e.string().min(1),sitemap:Te,...Ln,at:e.string().min(1)}),e.object({type:e.literal("sitemap.clamped"),reason:e.enum(["page_early_stop","finalize_best_effort"]),original_page_count:e.number().int().nonnegative().optional(),final_page_count:e.number().int().nonnegative().optional(),original_enabled_block_count:e.number().int().nonnegative().optional(),final_enabled_block_count:e.number().int().nonnegative().optional(),at:e.string().min(1)}).strict(),e.object({type:e.literal("sitemap.updated"),sitemap_id:e.string().min(1),version:e.number().int().positive(),reason:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.resync.failed"),error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),diagnostics:e.unknown().optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.resync.warning"),code:e.string().min(1),message:e.string().min(1),diagnostics:e.unknown().optional(),at:e.string().min(1)}),e.object({type:e.literal("block.changed"),block_id:e.string().min(1),change_type:e.enum(["add","update","delete","move"]),at:e.string().min(1)}),e.object({type:e.literal("tool.started"),tool_call_id:e.string().min(1),name:e.string().min(1),summary:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("tool.finished"),tool_call_id:e.string().min(1),name:e.string().min(1),result_summary:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("workspace.plan.created"),plan_id:e.string().min(1),run_kind:ke,groups:e.array(ct),tasks:e.array(mt),dependencies:e.array(lt),expected_outputs:e.array(O),diagnostics:rt,summary:Fn,at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.worker.updated"),group_id:e.string().min(1),phase:at,status:z,task_counts:Bn,target_paths:e.array(O),diagnostics:e.array(e.string().min(1)),at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.task.updated"),task_id:e.string().min(1),group_id:e.string().min(1),status:z,target_path:O,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(ot).optional(),at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.degraded"),reason:e.enum(["block_placeholder","form_placeholder","patch_protected_dropped","preview_health_degraded","design_plan_fallback","generated_code_rescue"]),degraded_block_ids:e.array(e.string().min(1)).min(1).optional(),dropped_files:e.array(e.string().min(1)).min(1).optional(),degraded_file_paths:Xo.optional(),degraded_page_ids:Qo.optional(),snapshot_id:e.string().min(1).optional(),code:e.string().min(1).optional(),message:e.string().min(1).optional(),diagnostics:e.string().min(1).optional(),retryable:e.boolean().optional(),at:e.string().min(1)}).strict().superRefine((t,n)=>{if(!(t.reason==="generated_code_rescue")){for(let c of["degraded_file_paths","degraded_page_ids"])t[c]!==void 0&&n.addIssue({code:"custom",path:[c],message:`${c} is only allowed for generated_code_rescue`});return}t.degraded_file_paths===void 0&&n.addIssue({code:"custom",path:["degraded_file_paths"],message:"generated_code_rescue requires degraded_file_paths"});for(let c of["degraded_block_ids","dropped_files","snapshot_id","code","message","diagnostics","retryable"])t[c]!==void 0&&n.addIssue({code:"custom",path:[c],message:`${c} is not allowed for generated_code_rescue`})}),e.object({type:e.literal("workspace.design_plan.outcome"),design_plan_outcome:Mo,reason:Lo,at:e.string().min(1)}).strict(),Kn.extend({type:e.literal("workspace.suggestions"),at:e.string().min(1)}).strict(),e.object({type:e.literal("file.changed"),path:e.string().min(1),change_type:e.enum(["create","update","delete"]),diff:e.string().optional(),at:e.string().min(1)}),e.object({type:e.literal("snapshot.created"),snapshot_id:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("snapshot.finalized"),snapshot_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("preview.preparing"),at:e.string().min(1)}),e.object({type:e.literal("preview.ready"),url:e.string().url(),at:e.string().min(1)}),e.object({type:e.literal("preview.build.started"),snapshot_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("preview.build.succeeded"),snapshot_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("preview.build.failed"),snapshot_id:e.string().min(1),message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean(),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),error_category:In.optional(),retryable:e.boolean().optional(),attempts:e.number().int().positive().optional(),outcome:e.literal("retained_previous").optional(),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),snapshot_id:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.started"),slot_count:e.number().int().nonnegative(),at:e.string().datetime()}),e.object({type:e.literal("media_resolution.finished"),slot_count:e.number().int().nonnegative(),provider_counts:e.object({unsplash:e.number().int().nonnegative(),pexels:e.number().int().nonnegative(),placeholder:e.number().int().nonnegative()}),fallback_count:e.number().int().nonnegative(),error_codes:e.array(e.string()),at:e.string().datetime()}),e.object({type:e.literal("skill.selecting"),category:e.literal("page-generation"),available:e.array(e.object({id:e.string().min(1),name:e.string().min(1)})).max(20),at:e.string().min(1)}),e.object({type:e.literal("skill.selected"),category:e.literal("page-generation"),selected:e.object({id:e.string().min(1),name:e.string().min(1),reason:e.string().min(1).max(200)}),at:e.string().min(1)}),e.object({type:e.literal("activity.started"),activity_id:e.string().min(1),parent_activity_id:e.string().min(1).optional(),kind:vn,title:e.string().min(1).max(200),detail:e.string().max(360).optional(),title_code:W.optional(),detail_code:W.optional(),locks_input:e.boolean(),at:e.string().min(1)}),e.object({type:e.literal("activity.updated"),activity_id:e.string().min(1),title:e.string().min(1).max(200).optional(),detail:e.string().max(360).optional(),title_code:W.optional(),detail_code:W.optional(),at:e.string().min(1)}),e.object({type:e.literal("activity.finished"),activity_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("activity.failed"),activity_id:e.string().min(1),detail:e.string().max(360).optional(),at:e.string().min(1)})]),qn=Zo.superRefine(Un),ze=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),agent_run_id:e.string().min(1),sequence:e.number().int().positive(),event_type:Gn,payload:qn,created_at:e.string().min(1)}),jp=e.object({event_type:Gn,payload:qn}).superRefine((t,n)=>{t.event_type!==t.payload.type&&n.addIssue({code:"custom",path:["payload","type"],message:"payload.type must match event_type"}),me(t.payload)&&n.addIssue({code:"custom",path:["payload"],message:"AgentEvent payload must not contain secrets"})}),Dp=e.discriminatedUnion("status",[e.object({status:e.literal("appended"),agent_run:H,event:ze,next_cursor:e.number().int().nonnegative()}),e.object({status:e.literal("duplicate_ignored"),agent_run:H,event:ze,next_cursor:e.number().int().nonnegative()})]),wp=e.object({events:e.array(ze),next_cursor:e.number().int().nonnegative().optional()}),Op=e.object({after_sequence:e.coerce.number().int().nonnegative().default(0)}),Mp=e.enum(["implemented","skeleton","planned"]),Lp=e.enum(["GET","POST","PUT","PATCH","DELETE"]),Up=[{method:"GET",path:"/health",tag:"system",summary:"API health check.",status:"implemented",response_schema:"ApiHealth"},{method:"POST",path:"/sites",tag:"sites",summary:"Create a site and Step 1 brief in the current dev context.",status:"implemented",request_body_schema:"CreateSiteBriefRequestSchema",response_schema:"CreateSiteBriefResponseSchema"},{method:"POST",path:"/sites/drafts",tag:"sites",summary:"Create a draft site without a brief in the current tenant so /s/:site_id can collect Step 1 later.",status:"implemented",request_body_schema:"CreateSiteDraftRequestSchema",response_schema:"SiteRecordSchema"},{method:"GET",path:"/sites",tag:"sites",summary:"List current tenant sites.",status:"implemented",response_schema:"SiteRecordSchema[]"},{method:"GET",path:"/sites/by-cms/:cms_site_id",tag:"sites",summary:"Resolve an external CMS site id to one tenant-scoped VCP site.",status:"implemented",response_schema:"SiteRecordSchema",notes:["Used by the browser /d/:cms_site_id handoff route; lookup is scoped by current request tenant and returns 404 when the CMS site has not been synchronized."]},{method:"GET",path:"/sites/:site_id",tag:"sites",summary:"Get one tenant-scoped site.",status:"implemented",response_schema:"SiteRecordSchema"},{method:"GET",path:"/sites/:site_id/designer/component-library/categories",tag:"designer-component-library",summary:"List the fixed insert-new-component category tree for a site.",status:"implemented",response_schema:"ListDesignerComponentCategoriesResponseSchema",notes:["The server validates site ownership and fixes category_group_key to insertNewComponent."]},{method:"GET",path:"/sites/:site_id/designer/component-library/resources",tag:"designer-component-library",summary:"List component resources from the fixed designer catalog group.",status:"implemented",query_schema:"ListDesignerComponentsQuerySchema",response_schema:"ListDesignerComponentsResponseSchema",notes:["The server fixes resource type to component and does not expose resource-platform secrets, internal hosts, or product-line selection."]},{method:"PATCH",path:"/sites/:site_id",tag:"sites",summary:"Update site display name and optional generated-site locale for the current tenant.",status:"implemented",request_body_schema:"UpdateSiteRequestSchema",response_schema:"SiteRecordSchema"},{method:"DELETE",path:"/sites/:site_id",tag:"sites",summary:"Archive a site so it no longer appears in the tenant site list.",status:"implemented",response_schema:"SiteRecordSchema"},{method:"GET",path:"/sites/:site_id/plan",tag:"publish-entitlements",summary:"Get the current site plan and custom-domain entitlement.",status:"implemented",query_schema:"locale",response_schema:"GetSitePlanResponseSchema"},{method:"GET",path:"/sites/:site_id/workspace/source-files",tag:"sites",summary:"List source files available in the ready preview sandbox.",status:"implemented",response_schema:"WorkspaceSourceFileListItemSchema[]"},{method:"GET",path:"/sites/:site_id/workspace/source-file",tag:"sites",summary:"Read a source file from the ready preview sandbox.",status:"implemented",query_schema:"WorkspaceSourceFilePathQuerySchema",response_schema:"WorkspaceSourceFileResponseSchema"},{method:"POST",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Persist generated sitemap and advance the site to sitemap_ready.",status:"implemented",request_body_schema:"PersistSiteSitemapRequestSchema",response_schema:"PersistSiteSitemapResponseSchema"},{method:"GET",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Read the current sitemap for a site.",status:"implemented",response_schema:"SitemapRecordSchema"},{method:"POST",path:"/sites/:site_id/clarify/answers",tag:"clarify",summary:"Persist the Step 2 clarify answers (and the answered questions) into the site's clarify session.",status:"implemented",request_body_schema:"PersistClarifyAnswersRequestSchema",response_schema:"PersistClarifyAnswersResponseSchema"},{method:"PATCH",path:"/sites/:site_id/clarify/archetype",tag:"clarify",summary:"Switch the Step 2 industry archetype (user_picked) into the site's clarify session via an idempotent upsert.",status:"implemented",request_body_schema:"UpdateClarifyArchetypeRequestSchema",response_schema:"PersistClarifyAnswersResponseSchema",notes:["Independent of generate: materializes a clarify_sessions row when none exists (using the supplied questions) or updates only selected_archetype; never writes answers/completed_at. Forces source=user_picked."]},{method:"POST",path:"/internal/sites/:site_id/design-plan",tag:"design-plans",summary:"Persist a generated design plan version for a site (internal agent-only write).",status:"implemented",request_body_schema:"PersistSiteDesignPlanRequestSchema",response_schema:"PersistSiteDesignPlanResponseSchema",notes:["Guarded by the internal agent token; only the Workspace/Sitemap agent writes design plans."]},{method:"GET",path:"/internal/sites/:site_id/design-plan",tag:"design-plans",summary:"Read the current (latest version) design plan for a site (internal agent-only read).",status:"implemented",response_schema:"DesignPlanRecordSchema",notes:["Guarded by the internal agent token; only the Workspace/Sitemap agent reads design plans."]},{method:"GET",path:"/sites/:site_id/design-plan",tag:"design-plans",summary:"Read the current (latest version) design plan for a site so Workspace UI can inspect the generated design contract.",status:"implemented",response_schema:"DesignPlanRecordSchema"},{method:"GET",path:"/sites/:site_id/brief",tag:"briefs",summary:"Read the persisted Step 1 brief for a site so the Workspace Agent can seed first full-site generation without a new write surface.",status:"implemented",response_schema:"BriefRecordSchema"},{method:"PUT",path:"/sites/:site_id/brief/draft",tag:"briefs",summary:"Save a draft site's Step 1 brief without advancing the workflow.",status:"implemented",request_body_schema:"SaveBriefDraftRequestSchema",response_schema:"SaveBriefDraftResponseSchema",notes:["Only draft sites with generation_state=planning are writable; the brief row is upserted idempotently while site status, generation state, locale, and workflow stage remain unchanged."]},{method:"PATCH",path:"/sites/:site_id/brief",tag:"briefs",summary:"Create or update a draft site's Step 1 brief and advance it to Clarify without allowing later workflow states to roll back.",status:"implemented",request_body_schema:"UpdateBriefRequestSchema",response_schema:"UpdateBriefResponseSchema",notes:["Only draft sites with generation_state=planning are writable; missing brief rows are created on first save; identical retries after brief_submitted are idempotent."]},{method:"POST",path:"/internal/sites/:cms_site_id/external-sync",tag:"sites",summary:"Synchronize a trusted external CMS site URL into VCP by tenant_id + cms_site_id, creating a draft VCP site on first sync.",status:"implemented",request_body_schema:"ExternalSyncSiteRequestSchema",response_schema:"ExternalSyncSiteResponseSchema",notes:["This trusted external entry does not require browser login or internal bearer auth; tenant_id is written directly to tenants.id and the response uses the internal { code, data, message } success envelope."]},{method:"POST",path:"/sites/:site_id/snapshots",tag:"snapshots",summary:"Persist snapshot metadata without changing the current site snapshot.",status:"implemented",request_body_schema:"PersistSiteSnapshotRequestSchema",response_schema:"PersistSiteSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/promote",tag:"snapshots",summary:"Promote a site snapshot as the current workspace version.",status:"implemented",response_schema:"PromoteSiteSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/snapshots/:snapshot_id",tag:"snapshots",summary:"Read one tenant-scoped snapshot metadata record for a site.",status:"implemented",response_schema:"SnapshotRecordSchema"},{method:"DELETE",path:"/sites/:site_id/snapshots/:snapshot_id",tag:"snapshots",summary:"Delete a candidate snapshot (cleanup of superseded intermediate snapshots; refuses non-candidate/current/referenced).",status:"implemented",response_schema:"DeleteSiteSnapshotResponseSchema"},{method:"POST",path:"/agent-runs",tag:"agent-runs",summary:"Create an agent run for event persistence and replay.",status:"implemented",request_body_schema:"CreateAgentRunRequestSchema",response_schema:"CreateAgentRunResponseSchema"},{method:"POST",path:"/agent-runs/:run_id/events",tag:"agent-runs",summary:"Append one normalized AgentEvent to a run.",status:"implemented",request_body_schema:"AppendAgentEventRequestSchema",response_schema:"AppendAgentEventResponseSchema",notes:["Internal-only write surface: only internal-service callers may append, except browser (oidc) contexts may append run.failed (the WS connect-stage unlock path, equivalent to POST /agent-runs/workspace/cancel). All other oidc appends \u2014 run.finished, run.started, tool/system/progress, file/snapshot \u2014 are rejected with 403 FORBIDDEN. The browser sends user messages over the Workspace WebSocket (recorded server-side as user.message) and otherwise only reads the GET replay."]},{method:"GET",path:"/agent-runs/:run_id/events",tag:"agent-runs",summary:"Replay AgentEvents after a run-local sequence cursor.",status:"implemented",response_schema:"ListAgentEventsResponseSchema"},{method:"POST",path:"/internal/agent-runs/fail-stale-in-flight",tag:"agent-runs",summary:"Fail stale in-flight workspace runs (internal maintenance, cross-tenant sweep).",status:"implemented",response_schema:"FailStaleInFlightWorkspaceRunsResponseSchema",notes:["Internal maintenance endpoint guarded by InternalAgentAuthGuard (Bearer VCP_AGENT_INTERNAL_TOKEN, production fail-closed); the /internal/** prefix is exempt from browser auth middleware so the guard is the sole trust boundary. Not exposed to the browser via agent-proxy; called by an external admin cron / controlled ops script."]},{method:"GET",path:"/briefs",tag:"briefs",summary:"Brief resource summary endpoint until concrete brief APIs land.",status:"skeleton"},{method:"GET",path:"/clarify",tag:"clarify",summary:"Clarify resource summary endpoint; persisted answers write through POST /sites/:site_id/clarify/answers.",status:"skeleton"},{method:"GET",path:"/sitemaps",tag:"sitemaps",summary:"Sitemap resource summary endpoint until collection APIs land.",status:"skeleton"},{method:"GET",path:"/snapshots",tag:"snapshots",summary:"Snapshot resource summary endpoint until collection APIs land.",status:"skeleton"},{method:"GET",path:"/sandbox-sessions",tag:"sandbox-sessions",summary:"Sandbox session resource summary endpoint until preview APIs land.",status:"skeleton"},{method:"GET",path:"/deployments",tag:"deployments",summary:"Deployment resource summary endpoint until publish APIs land.",status:"skeleton"},{method:"GET",path:"/usage",tag:"usage",summary:"Usage resource summary endpoint until cost summaries land.",status:"skeleton"},{method:"GET",path:"/audit",tag:"audit",summary:"Audit resource summary endpoint until audit queries land.",status:"skeleton"},{method:"POST",path:"/sites/:site_id/workspace/runs",tag:"workspace",summary:"Start an asynchronous Workspace Agent run from the current snapshot.",status:"implemented",request_body_schema:"StartWorkspaceRunRequestSchema",response_schema:"StartWorkspaceRunResponseSchema",notes:["Long-running work must be event-driven and must not block API transactions."]},{method:"GET",path:"/sites/:site_id/workspace/runs/latest",tag:"workspace",summary:"Look up the latest workspace Agent run for a site so Step 4 re-entry can replay persisted events without re-triggering the model.",status:"implemented",response_schema:"LatestWorkspaceRunResponseSchema"},{method:"POST",path:"/sites/:site_id/preview-sessions",tag:"sandbox-sessions",summary:"Persist or update an on-demand preview session for a site.",status:"implemented",request_body_schema:"PersistPreviewSessionRequestSchema",response_schema:"PersistPreviewSessionResponseSchema"},{method:"GET",path:"/sites/:site_id/preview-sessions/current",tag:"sandbox-sessions",summary:"Read the latest tenant-scoped preview session for a site.",status:"implemented",response_schema:"SandboxSessionSchema"},{method:"POST",path:"/sites/:site_id/deployments",tag:"deployments",summary:"Queue an explicit user-confirmed deployment from a snapshot.",status:"implemented",request_body_schema:"CreateDeploymentRequestSchema",response_schema:"CreateDeploymentResponseSchema",notes:["Before creating any deployment record or queue job, the API verifies the site's active subscription; an inactive subscription returns 403 DEPLOYMENT_ENTITLEMENT_REQUIRED, while an unavailable entitlement source prevents deployment creation.","The API returns after creating the deployment record and queue job; worker-service claims deployment_jobs for build and Cloudflare publish."]},{method:"GET",path:"/sites/:site_id/deployments/current",tag:"deployments",summary:"Read the latest deployment for workspace refresh recovery.",status:"implemented",response_schema:"CurrentDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/status",tag:"deployments",summary:"Read current in-flight deployment and latest released deployment.",status:"implemented",response_schema:"GetDeploymentsStatusResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/:deployment_id",tag:"deployments",summary:"Read one tenant-scoped deployment for status polling.",status:"implemented",response_schema:"GetDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/cms/collections",tag:"cms",summary:"List CMS collections for a site.",status:"planned"},{method:"POST",path:"/sites/:site_id/cms/collections",tag:"cms",summary:"Create a CMS collection bound to generated content.",status:"planned"},{method:"GET",path:"/sites/:site_id/cms/collections/:collection_id/entries",tag:"cms",summary:"List CMS entries for a collection.",status:"planned"},{method:"POST",path:"/sites/:site_id/cms/collections/:collection_id/entries",tag:"cms",summary:"Create a CMS entry.",status:"planned"},{method:"PATCH",path:"/sites/:site_id/cms/collections/:collection_id/entries/:entry_id",tag:"cms",summary:"Update a CMS entry.",status:"planned"},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/version-record",tag:"versions",summary:"Record the sandbox accepted git commit for a promoted snapshot version.",status:"implemented",request_body_schema:"RecordSnapshotVersionRequestSchema",response_schema:"RecordSnapshotVersionResponseSchema"},{method:"GET",path:"/sites/:site_id/versions",tag:"versions",summary:"List snapshot-backed site versions.",status:"implemented",response_schema:"ListSiteVersionsResponseSchema"},{method:"POST",path:"/sites/:site_id/versions/:snapshot_id/restore",tag:"versions",summary:"Restore a site to an earlier snapshot version.",status:"implemented",response_schema:"RestoreSiteSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/domains",tag:"custom-domains",summary:"List the site default domain and custom domains.",status:"implemented",response_schema:"ListSiteDomainsResponseSchema"},{method:"POST",path:"/sites/:site_id/domains",tag:"custom-domains",summary:"Bind a custom domain for site publishing.",status:"implemented",request_body_schema:"BindSiteDomainRequestSchema",response_schema:"BindSiteDomainResponseSchema",notes:["Returns 403 CUSTOM_DOMAIN_ENTITLEMENT_REQUIRED and never calls the downstream bind API when the site has no active subscription or subscription status cannot be confirmed."]},{method:"GET",path:"/sites/:site_id/domains/:hostname",tag:"custom-domains",summary:"Get DNS verification detail for a custom domain.",status:"implemented",response_schema:"GetSiteDomainDetailResponseSchema"},{method:"POST",path:"/sites/:site_id/domains/:hostname/verify",tag:"custom-domains",summary:"Refresh DNS verification status for a custom domain.",status:"implemented",response_schema:"VerifySiteDomainResponseSchema"},{method:"DELETE",path:"/sites/:site_id/domains/:hostname",tag:"custom-domains",summary:"Delete a non-primary custom domain.",status:"implemented",response_schema:"DeleteSiteDomainResponseSchema"},{method:"GET",path:"/admin/tenants",tag:"admin",summary:"Admin tenant listing.",status:"planned"},{method:"GET",path:"/usage/summary",tag:"usage",summary:"Summarize tenant usage and cost controls.",status:"planned"}],Kp=[{method:"POST",path:"/v1/agent/clarify/:site_id",tag:"clarify",summary:"Stream Step 2 clarify questions as SSE; event_order includes optional skill.selecting, skill.selected, clarify.archetype_proposals, and run.failed on errors.",status:"implemented",request_body_schema:"ClarifyRunInputSchema without tenant_id/site_id",event_schema:"ClarifyStreamEventSchema",event_order:["run.started","skill.selecting","skill.selected","clarify.partial","clarify.archetype_proposals","clarify.finished","run.failed"]},{method:"POST",path:"/v1/agent/sitemap/:site_id",tag:"sitemap",summary:"Stream Step 3 sitemap generation as SSE; event_order includes sitemap.partial and run.failed on errors.",status:"implemented",request_body_schema:"SitemapRunInputSchema public body without server-injected fields",event_schema:"SitemapStreamEventSchema",event_order:["run.started","sitemap.generating","sitemap.partial","sitemap.generated","sitemap.clamped","run.failed"]}],Jo=e.object({id:e.string().min(1),role:e.enum(["system","user","assistant"]),metadata:e.unknown().optional(),parts:e.array(Ie).min(1)}),Wn=Jo.extend({role:e.literal("user")}),Gp=e.object({base_snapshot_id:e.string().min(1).optional(),message:Wn.optional(),client_run_key:e.string().min(1).max(200).optional()}).superRefine((t,n)=>{me(t.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),er=e.object({path:e.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:e.string().min(1),base_snapshot_id:e.string().min(1),run_kind:ke}),Fp=e.object({agent_run:H,websocket:er,next_step:e.literal("workspace_socket")}),Bp=e.object({agent_run:H}),qp=e.object({agent_type:e.enum(["clarify","sitemap","workspace"])}),Wp=e.object({agent_run:H}),Hp=e.enum(["client.message.create","client.run.cancel","client.tool.approve","server.run.started","server.user.message","server.assistant.delta","server.tool.started","server.tool.completed","server.workspace.suggestions","workspace.plan.created","workspace.worker.updated","workspace.task.updated","server.patch.applied","server.sitemap.updated","server.snapshot.created","server.snapshot.finalized","server.preview.invalidated","preview.build.started","preview.build.succeeded","preview.build.failed","server.run.finished","server.run.failed","server.error","server.activity.started","server.activity.updated","server.activity.finished","server.activity.failed"]),x=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),run_id:e.string().min(1).optional(),correlation_id:e.string().min(1).optional(),seq:e.number().int().positive().optional(),sent_at:e.string().min(1)}),tr=e.object({key:e.string().min(1),label:e.string().min(1),source_file:e.string().min(1).optional(),component_name:e.string().min(1).optional(),opening_element_range:e.object({start_line:e.number().int().positive(),start_column:e.number().int().nonnegative(),end_line:e.number().int().positive(),end_column:e.number().int().nonnegative()}).optional(),structural_path:e.string().min(1).optional(),text_preview:e.string().min(1).optional()}),nr=e.discriminatedUnion("type",[x.extend({type:e.literal("client.message.create"),payload:e.object({client_message_id:e.string().min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),selected_component:tr.optional(),message:Wn,base_snapshot_id:e.string().min(1).optional()})}),x.extend({type:e.literal("client.run.cancel"),payload:e.object({run_id:e.string().min(1),reason:e.string().min(1).optional()})}),x.extend({type:e.literal("client.tool.approve"),payload:e.object({tool_call_id:e.string().min(1),decision:e.enum(["approve","reject"]),reason:e.string().min(1).optional()})})]),ir=e.discriminatedUnion("type",[x.extend({type:e.literal("server.run.started"),payload:e.object({run_id:e.string().min(1),agent_type:e.literal("workspace")})}),x.extend({type:e.literal("server.user.message"),payload:e.object({client_message_id:e.string().min(1),message_id:e.string().min(1),parts:e.array(Ie).min(1),in_reply_to_tool_call_id:e.string().min(1).optional()})}),x.extend({type:e.literal("server.assistant.delta"),payload:e.object({message_id:e.string().min(1),parts:e.array(Ie).min(1),status:e.enum(["streaming","ready"])})}),x.extend({type:e.literal("server.tool.started"),payload:e.object({tool_call_id:e.string().min(1),name:e.string().min(1),summary:e.string().min(1)})}),x.extend({type:e.literal("server.tool.completed"),payload:e.object({tool_call_id:e.string().min(1),name:e.string().min(1),result_summary:e.string().min(1)})}),x.extend({type:e.literal("server.workspace.suggestions"),payload:Kn.extend({run_id:e.string().min(1)}).strict()}),x.extend({type:e.literal("workspace.plan.created"),payload:e.object({plan_id:e.string().min(1),run_kind:ke,groups:e.array(ct),tasks:e.array(mt),dependencies:e.array(lt),expected_outputs:e.array(O),diagnostics:rt,summary:Fn})}),x.extend({type:e.literal("workspace.worker.updated"),payload:e.object({group_id:e.string().min(1),phase:at,status:z,task_counts:Bn,target_paths:e.array(O),diagnostics:e.array(e.string().min(1))})}),x.extend({type:e.literal("workspace.task.updated"),payload:e.object({task_id:e.string().min(1),group_id:e.string().min(1),status:z,target_path:O,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(ot).optional()})}),x.extend({type:e.literal("server.patch.applied"),payload:e.object({patch_batch_id:e.string().min(1),changed_files:e.array(e.string().min(1)),sitemap_resync_queued:e.boolean()})}),x.extend({type:e.literal("server.sitemap.updated"),payload:e.object({sitemap_id:e.string().min(1),version:e.number().int().positive(),reason:e.string().min(1)})}),x.extend({type:e.literal("server.snapshot.created"),payload:e.object({snapshot_id:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/)})}),x.extend({type:e.literal("server.snapshot.finalized"),payload:e.object({snapshot_id:e.string().min(1)})}),x.extend({type:e.literal("server.preview.invalidated"),payload:e.object({reason:e.string().min(1),next_preview_url:e.string().url().optional()})}),x.extend({type:e.literal("preview.build.started"),payload:e.object({snapshot_id:e.string().min(1)})}),x.extend({type:e.literal("preview.build.succeeded"),payload:e.object({snapshot_id:e.string().min(1)})}),x.extend({type:e.literal("preview.build.failed"),payload:e.object({snapshot_id:e.string().min(1),message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean()})}),x.extend({type:e.literal("server.run.finished"),payload:e.object({run_id:e.string().min(1),snapshot_id:e.string().min(1)})}),x.extend({type:e.literal("server.run.failed"),payload:e.object({run_id:e.string().min(1),error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),outcome:e.literal("retained_previous").optional()})}),x.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})}),x.extend({type:e.literal("server.activity.started"),payload:e.object({activity_id:e.string().min(1),parent_activity_id:e.string().min(1).optional(),kind:vn,title:e.string().min(1).max(200),title_code:W.optional(),detail:e.string().max(360).optional(),detail_code:W.optional(),locks_input:e.boolean()})}),x.extend({type:e.literal("server.activity.updated"),payload:e.object({activity_id:e.string().min(1),title:e.string().min(1).max(200).optional(),title_code:W.optional(),detail:e.string().max(360).optional(),detail_code:W.optional()})}),x.extend({type:e.literal("server.activity.finished"),payload:e.object({activity_id:e.string().min(1)})}),x.extend({type:e.literal("server.activity.failed"),payload:e.object({activity_id:e.string().min(1),detail:e.string().max(360).optional()})})]),Vp=e.union([nr,ir]),zp={path:"/v1/workspace/sites/:site_id/socket",protocol:"ws",status:"implemented",inbound_message_schema:"WorkspaceClientMessageSchema",outbound_message_schema:"WorkspaceServerMessageSchema",query_parameters:[{name:"run_id",required:!1,schema:"string",summary:"Workspace run id returned by the API run-start response."},{name:"run_kind",required:!1,schema:"WorkspaceRunKindSchema",summary:"Workspace run mode; initial_generation can auto-start when base_snapshot_id is present."},{name:"base_snapshot_id",required:!1,schema:"string",summary:"Authoritative base snapshot id for this workspace run."}],ai_sdk_ui_compatible:!0,notes:["Assistant UI output is carried as AI SDK UIMessage parts, including text, data-*, and tool-* parts.","Operational AgentEvents remain persisted separately for replay and audit."]},Hn=e.string().regex(/^sha256:[a-f0-9]{64}$/),sr=e.enum(["create","update","delete","str_replace"]),Vn=e.enum(["sitemap_resync","smoke_test","prepare_preview"]),ar=e.object({old_string:e.string().min(1).describe("Exact text to find in the current file. Must match the file uniquely; include enough surrounding context (usually 2-4 adjacent lines)."),new_string:e.string().describe("Replacement text. May be empty to delete the matched text."),replace_all:e.boolean().optional()}).strict(),or=e.object({path:O,operation:sr,expected_hash:Hn.optional(),full_content:e.string().describe("Complete file content for create/update patches. It is passed as a JSON string, so every double quote in source code must be valid JSON; avoid ASCII double quotes inside JSX attribute values and use corner quotes like \u300C\u751F\u65E5\u5FEB\u4E50\u300D for visitor-facing quoted examples.").optional(),edits:e.array(ar).min(1).max(20).optional()}).strict().superRefine((t,n)=>{let a=t.full_content!==void 0;if(t.operation==="delete"){a&&n.addIssue({code:"custom",path:["full_content"],message:"delete patches must not include full_content"}),t.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"});return}if(br(t.path)||n.addIssue({code:"custom",path:["path"],message:"Static App Router page paths must use lowercase ASCII kebab-case public segments."}),t.operation==="str_replace"){t.full_content!==void 0&&n.addIssue({code:"custom",path:["full_content"],message:"str_replace patches must not include full_content"}),(!t.edits||t.edits.length===0)&&n.addIssue({code:"custom",path:["edits"],message:"str_replace patches must include a non-empty edits array"});return}a||n.addIssue({code:"custom",path:["full_content"],message:"create/update patches must include full_content"}),t.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"})}),rr=e.object({kind:e.enum(["block","page","site","chrome"]),id:e.string().min(1).max(120)}),cr=e.object({base_key:e.string().min(1).max(120).regex(/^[A-Za-z0-9._:-]+$/).refine(t=>!t.includes(".."),{message:"base_key must not contain '..'"}),owner:rr,count:e.number().int().min(1).max(12),query:e.string().min(1).max(400),role:e.enum(["hero","section","card","gallery","testimonial","decorative","site_background","nav_background","footer_background"]),orientation:e.enum(["landscape","portrait","square"]).optional(),altHint:e.string().min(1).max(300)}),zn=e.object({site_id:e.string().min(1),base_snapshot_id:e.string().min(1),reason:e.string().min(1),patches:e.array(or).min(1),media_requests:e.array(cr).max(24).optional(),post_actions:e.array(Vn).optional()});function $n(t,n){let a=new Set;for(let[c,r]of t.patches.entries())a.has(r.path)&&n.addIssue({code:"custom",path:["patches",c,"path"],message:`Duplicate patch path: ${r.path}`}),a.add(r.path)}var $p=zn.superRefine($n),Yp=zn.omit({base_snapshot_id:!0}).extend({site_id:e.string().min(1).optional()}).superRefine($n),mr=M,lr=e.object({path:mr,operation:e.enum(["upsert","delete"]).optional()}),Xp=e.object({files:e.array(lr).min(1)}).strict(),pr=e.enum(["BASE_SNAPSHOT_NOT_FOUND","PATCH_TARGET_NOT_FOUND","PATCH_TARGET_ALREADY_EXISTS","PATCH_EXPECTED_HASH_MISMATCH","PATCH_DIFF_UNSUPPORTED","PATCH_PROTECTED_FILE","PATCH_VALIDATION_FAILED","PATCH_MEDIA_REFERENCE_NOT_DECLARED","PATCH_BATCH_INVALID","PATCH_BATCH_FAILED","PATCH_BATCH_TOO_LARGE","STR_REPLACE_NOT_FOUND","STR_REPLACE_NOT_UNIQUE","STR_REPLACE_BINARY_FILE","STR_REPLACE_REQUIRES_READ"]),dr=e.object({status:e.literal("applied"),patch_batch_id:e.string().min(1),site_id:e.string().min(1),base_snapshot_id:e.string().min(1),snapshot_id:e.string().min(1),manifest_hash:Hn,object_key:e.string().min(1),changed_files:e.array(O).min(1),post_actions_queued:e.array(Vn),dropped_protected_files:e.array(e.string().min(1)).min(1).optional()}),ur=e.object({status:e.literal("failed"),code:pr,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),Qp=e.discriminatedUnion("status",[dr,ur]),Zp=e.object({ok:e.literal(!0)}),Yn=M,gr=e.enum(["text","binary"]),Xn=e.object({path:Yn,kind:gr,language:e.string().min(1).nullable(),size_bytes:e.number().int().nonnegative()}),Jp=e.object({path:Yn}),hr=Xn.extend({kind:e.literal("text"),language:e.string().min(1),content:e.string()}),Sr=Xn.extend({kind:e.literal("binary"),language:e.null(),mime_type:e.string().min(1),content_base64:e.string().min(1)}),ed=e.union([hr,Sr]);function me(t){return typeof t=="string"?/authorization\s*:|bearer\s+|token\s*=|secret\s*=|api[_-]?key\s*=|access[_\s-]?key\s*=|\bsk-[a-z0-9_-]{20,}|eyJ[a-z0-9_-]{10,}\.[a-z0-9_-]{10,}\.[a-z0-9_-]{10,}/i.test(t):!t||typeof t!="object"?!1:Array.isArray(t)?t.some(n=>me(n)):Object.entries(t).some(([n,a])=>_r(n)||me(a))}function _r(t){let n=t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/\s+/g,"_").toLowerCase();return/(^|[_-])(authorization|token|secret|api[_-]?key|apikey|access[_-]?key|accesskey)([_-]|$)/.test(n)}function Qn(t){let n=t.split("/");return t.length>0&&!t.startsWith("/")&&!t.includes("\\")&&n.every(a=>a!==""&&a!=="."&&a!=="..")}function br(t){let n=/^app\/(?:(.*)\/)?page\.(?:tsx|jsx)$/.exec(t);if(!n)return!0;let c=(n[1]??"").split("/").filter(m=>m.length>0);return c.some(m=>m.startsWith("_"))?!0:c.filter(m=>!m.startsWith("@")&&!/^\(.+\)$/.test(m)).map(m=>m.replace(/^\((?:\.|\.\.|\.\.\.)\)/,"")).filter(m=>m.length>0).every(m=>/^\[.*\]$/.test(m)||ee.test(`/${m}`))}var Zn=e.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),yr=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),sandbox_id:e.string().min(1).nullable(),status:Zn,source_snapshot_id:e.string().min(1).nullable(),last_snapshot_id:e.string().min(1).nullable(),preview_url:e.string().url().nullable(),last_activity_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),td=e.object({session_id:e.string().min(1).optional(),sandbox_id:e.string().min(1).optional(),source_snapshot_id:e.string().min(1).optional(),last_snapshot_id:e.string().min(1),status:Zn,preview_url:e.string().url().optional()}),nd=e.object({preview_session:yr,next_step:e.literal("preview")}),id=e.object({failed_count:e.number().int().nonnegative()}),sd=e.object({site_id:e.string().min(1)}),ad=e.object({status:e.enum(["cancelled","no_active_run"]),agent_run:H.nullable()});export{vn as ActivityKindSchema,W as ActivityTitleCodeSchema,In as AgentErrorCategorySchema,ze as AgentEventRecordSchema,qn as AgentEventSchema,Gn as AgentEventTypeSchema,kn as AgentModelRouteSchema,Uo as AgentPlanStepSchema,Tn as AgentRunKindSchema,H as AgentRunRecordSchema,za as AgentRunStatusSchema,Rn as AgentRunTypeSchema,Ho as AiSdkUiDataPartSchema,zo as AiSdkUiErrorPartSchema,Bo as AiSdkUiFilePartSchema,Ie as AiSdkUiMessagePartSchema,Jo as AiSdkUiMessageSchema,Fo as AiSdkUiReasoningPartSchema,Wo as AiSdkUiSourceDocumentPartSchema,qo as AiSdkUiSourceUrlPartSchema,$o as AiSdkUiStepStartPartSchema,Go as AiSdkUiTextPartSchema,Vo as AiSdkUiToolPartSchema,Mp as ApiContractStatusSchema,Qa as ApiErrorEnvelopeSchema,B as ApiResponseSchema,jp as AppendAgentEventRequestSchema,Dp as AppendAgentEventResponseSchema,pr as ApplyPatchBatchErrorCodeSchema,ur as ApplyPatchBatchFailureSchema,$p as ApplyPatchBatchInputSchema,or as ApplyPatchBatchPatchSchema,Vn as ApplyPatchBatchPostActionSchema,Qp as ApplyPatchBatchResultSchema,dr as ApplyPatchBatchSuccessSchema,Yp as ApplyPatchBatchToolInputSchema,ar as ApplyPatchEditSchema,sr as ApplyPatchOperationSchema,xn as ArchetypeProposalSchema,ua as BINDING_STATUSES,mn as BindSiteDomainDataSchema,el as BindSiteDomainRequestSchema,Dl as BindSiteDomainResponseSchema,Cn as BlockGenerationContextSchema,lp as BlockMediaIntentSchema,uo as BlockSchema,Nn as BrandingSchema,Je as BriefRecordSchema,Cm as CHAT_COPY,vm as CLARIFICATION_COPY,sn as CURRENT_EDIT_ENGINE_VERSION,Jm as CUSTOM_DOMAIN_ENTITLEMENT_REQUIRED_ERROR_CODE,_a as CUSTOM_DOMAIN_STATUSES,sd as CancelActiveWorkspaceRunRequestSchema,ad as CancelActiveWorkspaceRunResponseSchema,jn as ChromeDesignSchema,lo as ChromeFooterDesignSchema,mo as ChromeFooterShellSchema,ro as ChromeHeaderDesignSchema,oo as ChromeHeaderShellSchema,po as ChromeMobileNavDesignSchema,Fa as ClarifyQuestionOptionSchema,Ba as ClarifyQuestionSchema,Ua as ClarifyQuestionTypeSchema,Qe as ClarifyQuestionsSchema,hl as ClarifyRunInputSchema,jo as ClarifySessionRecordSchema,Sl as ClarifyStreamEventSchema,Vm as CmsCollectionBindingSchema,Km as ConnectDynamicCollectionInputSchema,Bm as ConnectFormInputSchema,Ye as ConversionHintsSchema,cp as CreateAgentRunConflictResponseSchema,Fl as CreateAgentRunRequestSchema,Bl as CreateAgentRunResponseSchema,ep as CreateDeploymentRequestSchema,tp as CreateDeploymentResponseSchema,Pr as CreateDocumentUploadRequestSchema,wr as CreateImageUploadRequestSchema,Ir as CreateInputSourceRequestSchema,Il as CreateSiteBriefRequestSchema,Ul as CreateSiteBriefResponseSchema,Rl as CreateSiteDraftRequestSchema,xl as CreateSiteInputSchema,si as CreateTextInputSourceRequestSchema,ai as CreateUrlInputSourceRequestSchema,np as CurrentDeploymentResponseSchema,ya as CustomDomainDnsRecordPurposeSchema,Ea as CustomDomainDnsRecordSchema,fa as CustomDomainDnsRecordStatusSchema,ba as CustomDomainStatusSchema,Ia as DEFAULT_FONTS,Pi as DEFAULT_SITE_LOCALE,Jl as DEPLOYMENT_ENTITLEMENT_REQUIRED_ERROR_CODE,Xa as DEPLOYMENT_REALTIME_CHANNEL,pt as DEPLOYMENT_STATUSES,rp as DEPLOYMENT_WEBSOCKET_CONTRACT,Qr as DESIGNER_COMPONENT_LIBRARY_ERROR_CODES,Rr as DOCUMENT_EXTENSION_WHITELIST,Tr as DOCUMENT_MIME_WHITELIST,xa as DefaultPublishDomainSchema,dn as DeleteSiteDomainDataSchema,Ml as DeleteSiteDomainResponseSchema,Vl as DeleteSiteSnapshotResponseSchema,Re as DeploymentRecordSchema,op as DeploymentRedisPubSubEventSchema,nt as DeploymentStatusSchema,bn as DeploymentStatusSummarySchema,ap as DeploymentWsServerMessageSchema,Ya as DeploymentWsServerMessageTypeSchema,Mo as DesignPlanGenerationOutcomeSchema,Lo as DesignPlanGenerationReasonSchema,up as DesignPlanPatchSchema,Do as DesignPlanRecordSchema,Dn as DesignPlanSchema,mp as DesignTokensSchema,Ci as DesignerComponentCatalogItemSchema,It as DesignerComponentCategoriesDataSchema,xt as DesignerComponentCategoryNodeSchema,Rt as DesignerComponentsDataSchema,jm as EDIT_ENGINE_VERSION_HEADER,Dm as EDIT_ENGINE_VERSION_SOURCE_HEADER,Am as ERROR_COPY,We as EditEngineVersionParseError,Pl as ExternalSyncSiteRequestSchema,Nl as ExternalSyncSiteResponseSchema,ti as ExtractedFactKindSchema,pe as ExtractedFactSchema,ma as FIELD_TYPES,Da as FONT_PAIRINGS,la as FORM_FIELD_TYPES,id as FailStaleInFlightWorkspaceRunsResponseSchema,an as FieldDeclSchema,co as FooterShellSurfaceSchema,pa as FormFieldDeclSchema,ip as GetDeploymentResponseSchema,sp as GetDeploymentsStatusResponseSchema,pn as GetSiteDomainDetailDataSchema,Ol as GetSiteDomainDetailResponseSchema,rn as GetSitePlanDataSchema,Ll as GetSitePlanResponseSchema,so as HeaderShellBehaviorSchema,ao as HeaderShellShapeSchema,io as HeaderShellSurfaceSchema,no as HeaderShellVariantSchema,Cr as IMAGE_EXTENSION_WHITELIST,Nr as IMAGE_MIME_WHITELIST,Et as INSERT_NEW_COMPONENT_CATEGORY_GROUP_KEY,vi as ISO_639_3_TO_SITE_LOCALE,oi as ImageRoleSchema,Wn as InboundUserMessageSchema,ei as InputBundleStatusSchema,ue as InputConflictSchema,Or as InputContextBundleSchema,ii as InputSourceSchema,ve as InputSourceStatusSchema,Pe as InputSourceTypeSchema,Ii as LEGACY_SITE_LOCALE_CODES,qp as LatestAgentRunQuerySchema,Wp as LatestAgentRunResponseSchema,Bp as LatestWorkspaceRunResponseSchema,Op as ListAgentEventsQuerySchema,wp as ListAgentEventsResponseSchema,vl as ListDesignerComponentCategoriesResponseSchema,Zr as ListDesignerComponentsQuerySchema,Cl as ListDesignerComponentsResponseSchema,cn as ListSiteDomainsDataSchema,jl as ListSiteDomainsResponseSchema,Yl as ListSiteVersionsResponseSchema,Ar as MAX_DOCUMENT_SOURCES_PER_SITE,kr as MAX_DOCUMENT_UPLOAD_BYTES,Dr as MAX_IMAGE_SOURCES_PER_SITE,jr as MAX_IMAGE_UPLOAD_BYTES,dp as MediaAssetSchema,eo as MediaAttributionSchema,rr as MediaRequestOwnerSchema,Xe as MotionLevelSchema,Aa as NEXT_FONT_DISPLAY_NAMES,ce as NEXT_FONT_REGISTRY,ee as PAGE_SLUG_PATTERN,$ as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,wn as PageSchema,go as PageSlugSchema,Tp as PersistClarifyAnswersRequestSchema,kp as PersistClarifyAnswersResponseSchema,td as PersistPreviewSessionRequestSchema,nd as PersistPreviewSessionResponseSchema,Pp as PersistSiteDesignPlanRequestSchema,vp as PersistSiteDesignPlanResponseSchema,Ip as PersistSiteSitemapRequestSchema,Rp as PersistSiteSitemapResponseSchema,ql as PersistSiteSnapshotRequestSchema,Wl as PersistSiteSnapshotResponseSchema,La as PositioningPrefillSchema,Ve as PositioningSourceSchema,Ql as PrepareVersionPreviewRequestSchema,Zl as PrepareVersionPreviewResponseSchema,Hl as PromoteSiteSnapshotResponseSchema,Sa as PublishEntitlementSchema,ga as PublishPlanFeatureSnapshotSchema,ha as PublishPlanSchema,Pm as REFUSAL_COPY,Up as REST_API_ENDPOINTS,zl as RecordSnapshotVersionRequestSchema,$l as RecordSnapshotVersionResponseSchema,ni as ReferencePagePatternSchema,de as ReferenceSignalsSchema,Um as ResolvedFieldSchema,qm as ResolvedFormFieldSchema,Lp as RestApiMethodSchema,Xl as RestoreSiteSnapshotResponseSchema,Pn as RouteGenerationCardSchema,ft as SELECTABLE_SITE_LOCALE_CODES,Hc as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,Fi as SITE_EDIT_MATERIALIZATION_MAX_FILE_CONTENT_BYTES,Gi as SITE_EDIT_MATERIALIZATION_MAX_FILE_COUNT,Bi as SITE_EDIT_MATERIALIZATION_MAX_TOTAL_CONTENT_BYTES,Lt as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,Tc as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,Zs as SITE_EDIT_RUNTIME_CONTAINER_TAGS,Js as SITE_EDIT_RUNTIME_TEXT_TAGS,Qs as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,_c as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,ci as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,dt as SITE_EDIT_SOURCE_ALLOWED_DIRS,ri as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,Ce as SITE_EDIT_SOURCE_DELETE_CAPABILITY,mi as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,Ri as SITE_LOCALE_CODES,fl as SITE_PLANNING_FROZEN_ERROR_CODE,El as SITE_PLANNING_LOCKED_ERROR_CODE,Kp as SSE_STREAMS,Hr as SUPPORTED_SITE_LOCALES,yr as SandboxSessionSchema,Zn as SandboxSessionStatusSchema,Al as SaveBriefDraftRequestSchema,Gl as SaveBriefDraftResponseSchema,re as SiteCustomDomainSchema,An as SiteDesignContextSchema,Ka as SiteDesignDensitySchema,Ga as SiteDesignMotionLevelSchema,Se as SiteEditBoundaryKindSchema,Oi as SiteEditCapabilityConstraintSchema,Di as SiteEditCapabilityModeSchema,he as SiteEditCapabilityModeViewSchema,Ui as SiteEditClassNameSourceDiagnosticSchema,V as SiteEditClassNameSourceRangeSchema,Ct as SiteEditClassNameSourceSchema,cc as SiteEditClassNameSourceStyleContextSchema,vt as SiteEditClassNameSourceStylesheetSchema,Oe as SiteEditClassNameSourceWriteIntentSchema,sc as SiteEditCommandDiagnosticSchema,Mi as SiteEditCommandErrorSchema,wi as SiteEditConstraintKindSchema,Bs as SiteEditDynamicConfidenceSchema,Ws as SiteEditDynamicDataBindingSchema,Qt as SiteEditDynamicDataDetailSchema,Zt as SiteEditDynamicDataSummarySchema,qs as SiteEditDynamicEvidenceSchema,Xt as SiteEditDynamicSourceKindSchema,Gs as SiteEditDynamicSourceTypeSchema,Fs as SiteEditDynamicTargetKindSchema,zs as SiteEditEffectiveWriteTargetSchema,Me as SiteEditElementPropertySchema,Bc as SiteEditEventSchema,Ge as SiteEditExternalSourceKindSchema,lc as SiteEditGetClassNameSourceCommandResultSchema,mc as SiteEditGetClassNameSourceResultSchema,vs as SiteEditHistoryReadOnlyRecoveryStatusSchema,Ts as SiteEditHistoryRecoveryCodeSchema,ks as SiteEditHistoryRecoveryDiagnosticSchema,Vc as SiteEditHistoryStatusModeSchema,zc as SiteEditHistoryStatusSchema,As as SiteEditHistoryUnavailableReasonSchema,Cs as SiteEditHistoryUnavailableStatusSchema,Ps as SiteEditHistoryWritableStatusSchema,Tm as SiteEditInitializeSessionInputSchema,Es as SiteEditInsertNodeSpecSchema,$i as SiteEditMaterializationDataRequirementsSchema,zi as SiteEditMaterializationEntrySchema,Vi as SiteEditMaterializationExportSchema,Hi as SiteEditMaterializationFileSchema,Nt as SiteEditMaterializationPathTemplateSchema,jt as SiteEditMaterializationSchema,Gt as SiteEditMoveTargetSchema,te as SiteEditMutationContextSchema,_e as SiteEditNodeCapabilitySnapshotSchema,um as SiteEditObjectCapabilitiesSchema,hm as SiteEditObjectDetailSchema,_m as SiteEditObjectEditContextSchema,bm as SiteEditObjectStyleDetailSchema,Sm as SiteEditObjectSummarySchema,Lc as SiteEditOperationCommandResultSchema,Ht as SiteEditOperationErrorCodeSchema,Vt as SiteEditOperationErrorSchema,xs as SiteEditOperationParamsSchema,fe as SiteEditOperationPayloadSchema,Is as SiteEditOperationRequestSchema,zt as SiteEditOperationSelectionRefSchema,Ks as SiteEditOperationSummarySchema,Ft as SiteEditOperationTargetSchema,se as SiteEditOperationTypeSchema,Kt as SiteEditOperationValueSchema,kc as SiteEditPageCompositionAnyVersionSchema,as as SiteEditPageCompositionAtomicKindSchema,ms as SiteEditPageCompositionBoundaryModeSchema,Zi as SiteEditPageCompositionBusinessMemberSchema,Xi as SiteEditPageCompositionContainerSchema,ie as SiteEditPageCompositionDiagnosticSchema,ye as SiteEditPageCompositionErrorCodeSchema,Ot as SiteEditPageCompositionPlacementTargetSchema,Ji as SiteEditPageCompositionPlacementUnitSchema,is as SiteEditPageCompositionRuntimeRefSchema,ns as SiteEditPageCompositionSchema,ss as SiteEditPageCompositionSourceMemberKindSchema,Qi as SiteEditPageCompositionSourceMemberSchema,Ut as SiteEditPageCompositionSourceRangeSchema,es as SiteEditPageCompositionSupportedSchema,ts as SiteEditPageCompositionUnsupportedSchema,cs as SiteEditPageCompositionV2BusinessMemberSchema,os as SiteEditPageCompositionV2ContainerSchema,ps as SiteEditPageCompositionV2PlacementRelationSchema,us as SiteEditPageCompositionV2PlacementSchema,ls as SiteEditPageCompositionV2PlacementUnitSchema,_s as SiteEditPageCompositionV2Schema,rs as SiteEditPageCompositionV2SourceMemberSchema,hs as SiteEditPageCompositionV2SupportedSchema,Ss as SiteEditPageCompositionV2UnsupportedSchema,ds as SiteEditPageCompositionV2WriteModeSchema,gs as SiteEditPageCompositionVisualAnchorSchema,wt as SiteEditPagePlacementOptionSchema,Ue as SiteEditPagePlacementSchema,Mt as SiteEditPageUnitTargetSchema,Ds as SiteEditPatchPlanPatchSchema,Xc as SiteEditPatchPlanSchema,oe as SiteEditProvenanceChainSchema,$s as SiteEditProvenanceHopSchema,dm as SiteEditRenderDocumentSchema,ae as SiteEditRenderEntryRefSchema,Hs as SiteEditRenderEntrySchema,Yt as SiteEditRenderPageCompositionSchema,Ls as SiteEditRenderPageCompositionSupportedSchema,Us as SiteEditRenderPageCompositionUnsupportedSchema,Ms as SiteEditRenderPagePlacementSchema,bc as SiteEditRequiredMutationContextEnvelopeSchema,bi as SiteEditResolveSourceLocationInputSchema,en as SiteEditSemanticSourceSchema,Mc as SiteEditSignedOperationRequestSchema,ut as SiteEditSourceDeleteCapabilitySchema,pi as SiteEditSourceDirectoryPathSchema,Si as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,_i as SiteEditSourceFileBinaryResponseSchema,Ur as SiteEditSourceFileKindSchema,di as SiteEditSourceFileListItemSchema,Gr as SiteEditSourceFileResponseSchema,hi as SiteEditSourceFileTextResponseSchema,Le as SiteEditSourceIdentitySchema,yi as SiteEditSourceLocationRangeSchema,Fr as SiteEditSourceLocationSchema,Xs as SiteEditSourceLocatorRangeSchema,Be as SiteEditSourceLocatorSchema,M as SiteEditSourcePathSchema,gt as SiteEditSourceTreeNodeSchema,Kr as SiteEditSourceTreeResponseSchema,ui as SiteEditSourceTreeTruncationReasonSchema,gi as SiteEditSourceTreeTruncationSchema,Wt as SiteEditStyleBreakpointSchema,gm as SiteEditStyleModelSchema,Bt as SiteEditStylePropertySchema,tn as SiteEditStyleSourceSchema,qt as SiteEditStyleStateModeSchema,Fe as SiteEditTextSegmentSchema,Jt as SiteEditTextSourceSchema,Vs as SiteEditWriteTargetSchema,Ha as SiteGenerationStateSchema,q as SiteLocaleSchema,pp as SiteMediaIntentSchema,Q as SiteRecordSchema,qa as SiteStatusSchema,$a as SiteVersionListItemSchema,tt as SiteVersionRecordSchema,bp as SitemapAddBlockInputSchema,st as SitemapAnswerSchema,Sp as SitemapChangeBlockVariantInputSchema,xo as SitemapDeleteBlockInputSchema,Eo as SitemapEditActorSchema,To as SitemapEditErrorCodeSchema,Ao as SitemapEditFailureSchema,Ro as SitemapEditOperationSchema,fp as SitemapEditResultSchema,ko as SitemapEditSuccessSchema,Po as SitemapGenerationOutcomeSchema,vo as SitemapGenerationReasonSchema,Mn as SitemapGenerationStageSchema,gp as SitemapModelOutputSchema,yo as SitemapModelPageSchema,hp as SitemapMoveBlockInputSchema,_o as SitemapNavigationHrefSchema,No as SitemapRecordSchema,Ep as SitemapRunInputSchema,Te as SitemapSchema,xp as SitemapStreamEventSchema,Io as SitemapUpdateBlockInstructionInputSchema,_p as SitemapUpdateBlockPropsInputSchema,Ja as SitemapUserChoiceSchema,Z as SkillSelectionSchema,to as SkillSelectionSourceSchema,Hn as SnapshotContentHashSchema,O as SnapshotFilePathSchema,le as SnapshotRecordSchema,et as SnapshotStatusSchema,Gp as StartWorkspaceRunRequestSchema,Fp as StartWorkspaceRunResponseSchema,wa as THEME_PRESETS,kl as UpdateBriefRequestSchema,Kl as UpdateBriefResponseSchema,Ap as UpdateClarifyArchetypeRequestSchema,Tl as UpdateSiteRequestSchema,ln as VerifySiteDomainDataSchema,wl as VerifySiteDomainResponseSchema,$e as VisualHintsSchema,Za as VisualThemeSchema,zp as WORKSPACE_WEBSOCKET_CONTRACT,nr as WorkspaceClientMessageSchema,Oa as WorkspaceDesignApplyRequestSchema,Ma as WorkspaceDesignApplyResponseSchema,ot as WorkspaceDiagnosticSchema,lr as WorkspaceDirectEditFileSchema,mr as WorkspaceDirectEditPathSchema,Xp as WorkspaceDirectEditRequestSchema,Zp as WorkspaceDirectEditResponseSchema,rt as WorkspaceExecutionDiagnosticsSchema,Cp as WorkspaceExecutionPlanSchema,cr as WorkspaceMediaRequestSchema,lt as WorkspacePlanDependencySchema,Fn as WorkspacePlanSummarySchema,Ko as WorkspacePlanTaskKindSchema,mt as WorkspacePlanTaskSchema,ke as WorkspaceRunKindSchema,tr as WorkspaceSelectedComponentSchema,ir as WorkspaceServerMessageSchema,yp as WorkspaceSitemapEditRequestSchema,er as WorkspaceSocketDescriptorSchema,Sr as WorkspaceSourceFileBinaryResponseSchema,gr as WorkspaceSourceFileKindSchema,Xn as WorkspaceSourceFileListItemSchema,Jp as WorkspaceSourceFilePathQuerySchema,ed as WorkspaceSourceFileResponseSchema,hr as WorkspaceSourceFileTextResponseSchema,Yn as WorkspaceSourcePathSchema,wo as WorkspaceSuggestionSchema,Kn as WorkspaceSuggestionsSchema,Oo as WorkspaceSuggestionsSourceSchema,Bn as WorkspaceTaskCountsSchema,Vp as WorkspaceWebSocketMessageSchema,Hp as WorkspaceWebSocketMessageTypeSchema,ct as WorkspaceWorkerGroupSchema,at as WorkspaceWorkerPhaseSchema,Np as WorkspaceWorkerResultSchema,z as WorkspaceWorkerStatusSchema,bl as assertSiteGenerationStateTransition,_l as assertSiteStatusTransition,At as canonicalizePageSlug,Zc as composeSiteEditRepeatInstanceKey,Yi as computeSiteEditSourceIdentityKey,me as containsSensitiveData,Li as createSiteEditCommandFailureSchema,Pt as createSiteEditCommandResultSchema,we as createSiteEditCommandSuccessSchema,He as fontStack,je as getSiteEditSourceDeleteProtectionReason,Tt as isCanonicalPageSlug,vr as isConsentGranted,ra as isExactEditEngineVersion,Wi as isSiteEditMaterializationPathTemplate,sa as isSiteEditRuntimeContainerTag,aa as isSiteEditRuntimeTextTag,fm as isSiteEditRuntimeVoidElementTag,Br as isSiteEditSourceDeleteProtectedPath,fi as isSiteEditSourceDirectoryPath,ht as isSiteEditSourcePath,Ne as isSiteEditTextSourcePath,ws as makeSiteEditRepeatInstanceKey,$m as normalizeCmsPublicApiBase,ji as pageSlugToRouteFilePath,ca as parseExactEditEngineVersion,Os as parseSiteEditRepeatInstanceKey,Ec as parseSiteEditSourceIdentityKey,Ra as resolveFont,ka as resolveFontDisplayName,yl as resolveGenerationStateForRunLifecycle,fr as resolveRedisConnectionConfig,wm as resolveRequestedEditEngineVersion,Vr as resolveSelectableSiteLocale,Em as resolveSiteEditRuntimeOperationSummary,$r as resolveSiteLocaleFromIso6393,zr as resolveSiteTextDirection,Om as resolveSystemCurrentEditEngineVersion,ja as siteFontVariables,Jc as stripSiteEditRepeatInstanceKeys,kt as tryCanonicalizeAsciiPageSlug};
1
+ import{z as e}from"zod";var Zt=["queued","preparing_source","building","artifact_ready","deploying","released","lock_failed","source_prepare_failed","build_failed","artifact_fetch_failed","artifact_validation_failed","deploy_failed","cleanup_failed"];function Bm(t){let n=t.VCP_REDIS_URL??t.REDIS_URL;if(n){let i=new URL(n);return{url:n,host:i.hostname,port:i.port?Number(i.port):6379,password:i.password?decodeURIComponent(i.password):void 0}}return{host:t.VCP_REDIS_HOST??"127.0.0.1",port:bs(t.VCP_REDIS_PORT,56379)}}function bs(t,n){if(!t)return n;let i=Number(t);return Number.isInteger(i)&&i>0?i:n}import{z as _}from"zod";var st=_.enum(["text","url","document","image"]),at=_.enum(["pending","ready","failed"]),fs=_.enum(["pending","ready","failed"]),ys=_.enum(["product","price","contact","copy","audience","other"]),je=_.object({fact:_.string().min(1).max(300),kind:ys,source_id:_.string().min(1),quote:_.string().min(1).max(500),trust:_.enum(["verbatim","ocr"]).default("verbatim")}),Es=_.object({page_type:_.string().min(1).max(40),sections:_.array(_.string().min(1).max(40)).max(12)}),Oe=_.object({source_id:_.string().min(1),nav_structure:_.array(_.string().min(1).max(30)).max(12),page_patterns:_.array(Es).max(10),tone:_.array(_.string().min(1).max(20)).max(8),screenshot_ref:_.string().optional()}),xs=_.object({source_id:_.string().min(1),type:st,status:at,title:_.string().max(120).optional(),original_ref:_.string().min(1),source_metadata:_.record(_.string(),_.unknown()),error_code:_.string().optional(),submitted:_.boolean().optional()}),we=_.object({topic:_.string().min(1).max(80),variants:_.array(_.object({value:_.string().min(1).max(300),source_id:_.string().min(1)})).min(2)}),Is=_.object({type:_.literal("text"),content:_.string().min(20).max(1e4),title:_.string().min(1).max(120).optional()}).strict(),Rs=_.object({type:_.literal("url"),url:_.string().url().max(2048),rights_ack:_.boolean().optional(),title:_.string().min(1).max(120).optional()}).strict(),Vm=_.discriminatedUnion("type",[Is,Rs]),Hm=[".docx",".html",".md",".txt"],$m=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],Ym=10*1024*1024,Zm=2,Xm=_.object({consent_cross_border:_.union([_.literal(!0),_.literal("true")]),consent_text_version:_.string().min(1).max(120),title:_.string().min(1).max(120).optional()}).strict();function Qm(t){return t===!0||t==="true"}var Jm=[".png",".jpg",".jpeg",".webp"],ep=["image/png","image/jpeg","image/webp","application/octet-stream"],tp=8*1024*1024,np=10,Ts=_.enum(["asset","reference"]),ip=_.object({image_role:Ts,title:_.string().min(1).max(120).optional()}).strict(),sp=_.object({version:_.literal(1),site_id:_.string().min(1),tenant_id:_.string().min(1),user_prompt:_.string(),status:fs,sources:_.array(xs).max(16),facts:_.array(je).max(120),reference:Oe.optional(),conflicts:_.array(we).max(20)}).superRefine((t,n)=>{let i=new Map(t.sources.map(o=>[o.source_id,o]));for(let[o,r]of t.facts.entries()){let m=i.get(r.source_id);(!m||m.type==="url")&&n.addIssue({code:"custom",path:["facts",o,"source_id"],message:"facts must reference a text/document/image source (never url)"})}if(t.reference){let o=i.get(t.reference.source_id),r=o?.type==="image"&&o.source_metadata.image_role==="reference";(!o||o.type!=="url"&&!r)&&n.addIssue({code:"custom",path:["reference","source_id"],message:"reference must point at a url source or reference image source"})}});import{z as S}from"zod";var ks=["design.md","DESIGN.md"],Xt=["components/site","src/components/site","lib/generated","src/lib/generated","public"],Ps=["app/globals.css","src/app/globals.css"],As=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],Cs=new Set(As),ot="source-delete",Qt=S.literal(ot),K=S.string().min(1).refine(en,"Invalid site edit source path"),Ds=S.string().min(1).refine(Fs,"Invalid site edit source directory path"),rp=S.enum(["text","binary"]),Me=S.object({path:K,language:S.string().min(1).nullable(),sizeBytes:S.number().int().nonnegative(),contentHash:S.string().min(1).optional()}),vs=S.discriminatedUnion("kind",[Me.extend({kind:S.literal("text"),language:S.string().min(1),readonly:S.boolean().default(!1)}),Me.extend({kind:S.literal("binary"),language:S.null(),mimeType:S.string().min(1).optional(),readonly:S.literal(!0)})]),Jt=S.lazy(()=>S.discriminatedUnion("kind",[S.object({kind:S.literal("directory"),name:S.string().min(1),path:Ds,children:S.array(Jt)}),S.object({kind:S.literal("file"),name:S.string().min(1),path:K,file:vs}).superRefine((t,n)=>{t.path!==t.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),Ns=S.enum(["max-files","max-depth","max-total-bytes"]),js=S.object({reasons:S.array(Ns).min(1),maxFiles:S.number().int().positive(),maxDepth:S.number().int().positive(),maxTotalBytes:S.number().int().positive()}),cp=S.object({nodes:S.array(Jt),defaultPath:K.optional(),totalFiles:S.number().int().nonnegative(),truncated:js.optional()}),Os=Me.extend({kind:S.literal("text"),language:S.string().min(1),readonly:S.boolean().default(!1),content:S.string()}),ws=S.enum(["too-large","unsupported-mime","bytes-unavailable"]),Ms=Me.extend({kind:S.literal("binary"),language:S.null(),readonly:S.literal(!0),mimeType:S.string().min(1),contentBase64:S.string().min(1).optional(),previewUnavailableReason:ws.optional()}),mp=S.discriminatedUnion("kind",[Os,Ms]),Ls=S.object({key:S.string().min(1),routeId:S.string().min(1).optional()}),Us=S.object({startLine:S.number().int().positive(),startColumn:S.number().int().nonnegative(),endLine:S.number().int().positive(),endColumn:S.number().int().nonnegative()}),pp=Ls.extend({sourceFile:K,componentName:S.string().min(1),openingElementRange:Us,structuralPath:S.string().min(1),textPreview:S.string().min(1).optional()});function en(t){return!an(t)||sn(t)?!1:mt(t)||nn(t)||tn(t)||Xt.some(n=>t===n||t.startsWith(`${n}/`))}function rt(t){return mt(t)||Cs.has(Ks(t))}function Fs(t){return!an(t)||sn(t)?!1:t==="app"||t.startsWith("app/")||t==="src"||t==="src/app"||t.startsWith("src/app/")||Xt.some(n=>t===n||t.startsWith(`${n}/`)||n.startsWith(`${t}/`))}function ct(t){return en(t)?mt(t)?"design-document":tn(t)?"route-entry":nn(t)?"app-global-style":t.toLowerCase()==="lib/generated/media-assets.ts"||t.toLowerCase()==="src/lib/generated/media-assets.ts"?"generated-media-manifest":null:null}function dp(t){return ct(t)!==null}function tn(t){return/^(?:src\/)?app\/(?:.*\/)?page\.[cm]?[jt]sx?$/.test(t.toLowerCase())}function nn(t){return Ps.some(n=>n.toLowerCase()===t.toLowerCase())}function Ks(t){let n=t.split("/").at(-1)??t,i=n.lastIndexOf(".");return i>0?n.slice(i).toLowerCase():""}function mt(t){return!t.includes("/")&&ks.some(n=>n.toLowerCase()===t.toLowerCase())}function sn(t){let n=t.toLowerCase(),i=n.split("/"),r=(i.at(-1)??n).replace(/\.[^.]+$/,"");return/^(?:src\/)?app\/api(?:\/|$)/.test(n)||/^(?:src\/)?app\/(?:.*\/)?route\.[cm]?[jt]sx?$/.test(n)||/^(?:src\/)?app\/(?:.*\/)?(?:action|actions)\.[cm]?[jt]sx?$/.test(n)||/(^|\/)[^/]+\.server\.[cm]?[jt]sx?$/.test(n)||n==="lib/server"||n.startsWith("lib/server")||n==="src/lib/server"||n.startsWith("src/lib/server")||n==="lib/db"||n.startsWith("lib/db")||n==="src/lib/db"||n.startsWith("src/lib/db")||n==="lib/cms"||n.startsWith("lib/cms/")||n==="src/lib/cms"||n.startsWith("src/lib/cms/")?!0:r==="server"||r==="db"||r==="database"||r==="auth"||r==="secret"||r==="secrets"||r==="token"||r==="tokens"||r==="credential"||r==="credentials"||i.includes("server")||i.includes("secrets")}function an(t){return!t||t.startsWith("/")||t.includes("\\")?!1:t.split("/").every(n=>!(n.length===0||n==="."||n===".."||n.startsWith(".")||n==="package.json"||n==="node_modules"||n==="recipes"||n.startsWith(".env")))}import{z as Gs}from"zod";var Se=["zh-CN","zh-HK","zh-TW","en-US","en-GB","ja-JP","ko-KR","es-ES","fr-FR","de-DE","pt-PT","ru-RU","ar-SA","id-ID","vi-VN","th-TH","it-IT","nl-NL","tr-TR","pl-PL","uk-UA","cs-CZ","sk-SK","hu-HU","ro-RO","el-GR","sv-SE","da-DK","fi-FI","hr-HR","lt-LT","lv-LV","et-EE","ga-IE","mt-MT","ka-GE","fa-IR","bn-BD","ta-IN","si-LK","ms-MY","fil-PH","my-MM","km-KH","lo-LA","mn-MN","kk-KZ"],qs=["en","ja","es","fr","de","ko","pt","pt-BR","it","ru","ar","hi","id","vi","th","tr","nl","pl","uk","sv","da","fi","no","cs","el","hu","ro","he","ms","fil","bn","ta","ca","sk","hr","bg","lt","lv","et","fa","sw","sr","is"],Bs=[...Se,...qs],zs=new Set(["ar","fa","he"]),gp=[{code:"zh-CN",label:"\u7B80\u4F53\u4E2D\u6587",englishName:"Chinese (Simplified)"},{code:"zh-HK",label:"\u7E41\u9AD4\u4E2D\u6587\uFF08\u9999\u6E2F\uFF09",englishName:"Chinese (Traditional, Hong Kong)"},{code:"zh-TW",label:"\u7E41\u9AD4\u4E2D\u6587\uFF08\u53F0\u7063\uFF09",englishName:"Chinese (Traditional, Taiwan)"},{code:"en-US",label:"English (US)",englishName:"English (United States)",common:!0},{code:"en-GB",label:"English (UK)",englishName:"English (United Kingdom)",common:!0},{code:"ja-JP",label:"\u65E5\u672C\u8A9E",englishName:"Japanese"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4",englishName:"Korean"},{code:"es-ES",label:"Espa\xF1ol",englishName:"Spanish"},{code:"fr-FR",label:"Fran\xE7ais",englishName:"French"},{code:"de-DE",label:"Deutsch",englishName:"German"},{code:"pt-PT",label:"Portugu\xEAs",englishName:"Portuguese"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",englishName:"Russian"},{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",englishName:"Arabic"},{code:"id-ID",label:"Bahasa Indonesia",englishName:"Indonesian"},{code:"vi-VN",label:"Ti\u1EBFng Vi\u1EC7t",englishName:"Vietnamese"},{code:"th-TH",label:"\u0E44\u0E17\u0E22",englishName:"Thai"},{code:"it-IT",label:"Italiano",englishName:"Italian"},{code:"nl-NL",label:"Nederlands",englishName:"Dutch"},{code:"tr-TR",label:"T\xFCrk\xE7e",englishName:"Turkish"},{code:"pl-PL",label:"Polski",englishName:"Polish"},{code:"uk-UA",label:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430",englishName:"Ukrainian"},{code:"cs-CZ",label:"\u010Ce\u0161tina",englishName:"Czech"},{code:"sk-SK",label:"Sloven\u010Dina",englishName:"Slovak"},{code:"hu-HU",label:"Magyar",englishName:"Hungarian"},{code:"ro-RO",label:"Rom\xE2n\u0103",englishName:"Romanian"},{code:"el-GR",label:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC",englishName:"Greek"},{code:"sv-SE",label:"Svenska",englishName:"Swedish"},{code:"da-DK",label:"Dansk",englishName:"Danish"},{code:"fi-FI",label:"Suomi",englishName:"Finnish"},{code:"hr-HR",label:"Hrvatski",englishName:"Croatian"},{code:"lt-LT",label:"Lietuvi\u0173",englishName:"Lithuanian"},{code:"lv-LV",label:"Latvie\u0161u",englishName:"Latvian"},{code:"et-EE",label:"Eesti",englishName:"Estonian"},{code:"ga-IE",label:"Gaeilge",englishName:"Irish"},{code:"mt-MT",label:"Malti",englishName:"Maltese"},{code:"ka-GE",label:"\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8",englishName:"Georgian"},{code:"fa-IR",label:"\u0641\u0627\u0631\u0633\u06CC",englishName:"Persian"},{code:"bn-BD",label:"\u09AC\u09BE\u0982\u09B2\u09BE",englishName:"Bengali"},{code:"ta-IN",label:"\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD",englishName:"Tamil"},{code:"si-LK",label:"\u0DC3\u0DD2\u0D82\u0DC4\u0DBD",englishName:"Sinhala"},{code:"ms-MY",label:"Bahasa Melayu",englishName:"Malay"},{code:"fil-PH",label:"Filipino",englishName:"Filipino"},{code:"my-MM",label:"\u1019\u103C\u1014\u103A\u1019\u102C",englishName:"Burmese"},{code:"km-KH",label:"\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A",englishName:"Khmer"},{code:"lo-LA",label:"\u0EA5\u0EB2\u0EA7",englishName:"Lao"},{code:"mn-MN",label:"\u041C\u043E\u043D\u0433\u043E\u043B",englishName:"Mongolian"},{code:"kk-KZ",label:"\u049A\u0430\u0437\u0430\u049B",englishName:"Kazakh"}],Ws={en:"en-US",ja:"ja-JP",es:"es-ES",fr:"fr-FR",de:"de-DE",ko:"ko-KR",pt:"pt-PT",it:"it-IT",ru:"ru-RU",ar:"ar-SA",id:"id-ID",vi:"vi-VN",th:"th-TH",tr:"tr-TR",nl:"nl-NL",pl:"pl-PL",uk:"uk-UA",sv:"sv-SE",da:"da-DK",fi:"fi-FI",cs:"cs-CZ",el:"el-GR",hu:"hu-HU",ro:"ro-RO",ms:"ms-MY",fil:"fil-PH",bn:"bn-BD",ta:"ta-IN",sk:"sk-SK",hr:"hr-HR",lt:"lt-LT",lv:"lv-LV",et:"et-EE",fa:"fa-IR"},Vs=new Set(Se);function on(t){return Vs.has(t)?t:Ws[t]}var Hs="en";function hp(t){let n=t.toLowerCase().split("-",1)[0]??"";return zs.has(n)?"rtl":"ltr"}var $s={cmn:"zh-CN",eng:"en",jpn:"ja",spa:"es",fra:"fr",deu:"de",kor:"ko",por:"pt",ita:"it",rus:"ru",arb:"ar",ara:"ar",hin:"hi",ind:"id",vie:"vi",tha:"th",tur:"tr",nld:"nl",pol:"pl",ukr:"uk",swe:"sv",dan:"da",fin:"fi",nob:"no",nor:"no",ces:"cs",ell:"el",hun:"hu",ron:"ro",heb:"he",msa:"ms",zsm:"ms",tgl:"fil",ben:"bn",tam:"ta",cat:"ca",slk:"sk",hrv:"hr",bul:"bg",lit:"lt",lav:"lv",est:"et",pes:"fa",fas:"fa",swh:"sw",swa:"sw",srp:"sr",isl:"is"};function _p(t){return $s[t]??Hs}var W=Gs.enum(Bs);import{z as Ys}from"zod";var V=Ys.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/);function fp(t,n){let i=V.safeParse(t),o=V.safeParse(n);if(!i.success||!o.success)return null;let r=rn(i.data),m=rn(o.data);for(let c=0;c<3;c+=1){let u=cn(r.release[c],m.release[c]);if(u!==0)return u}if(!r.prerelease&&!m.prerelease)return 0;if(!r.prerelease)return 1;if(!m.prerelease)return-1;let l=Math.max(r.prerelease.length,m.prerelease.length);for(let c=0;c<l;c+=1){let u=r.prerelease[c],E=m.prerelease[c];if(u===void 0)return-1;if(E===void 0)return 1;if(u===E)continue;let h=/^\d+$/u.test(u),b=/^\d+$/u.test(E);return h&&b?cn(BigInt(u),BigInt(E)):h?-1:b?1:Zs(u,E)}return 0}function rn(t){let n=t.indexOf("+"),i=n===-1?t:t.slice(0,n),o=i.indexOf("-"),r=o===-1?i:i.slice(0,o),m=o===-1?void 0:i.slice(o+1),[l,c,u]=r.split(".");return{release:[BigInt(l),BigInt(c),BigInt(u)],...m?{prerelease:m.split(".")}:{}}}function cn(t,n){return t<n?-1:t>n?1:0}function Zs(t,n){return t<n?-1:t>n?1:0}import{z as y}from"zod";import{z as M}from"zod";var Xs=64,Qs=512*1024,Js=4*1024*1024,ea=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function ta(t){return ea.test(t)}var mn=M.string().min(1).refine(ta,{message:"Materialization pathTemplate must be a safe relative path."}),na=M.object({pathTemplate:mn,content:M.string(),role:M.string().min(1).optional()}).strict(),ia=M.union([M.object({kind:M.literal("default")}).strict(),M.object({kind:M.literal("named"),name:M.string().min(1)}).strict()]),sa=M.object({pathTemplate:mn,export:ia}).strict(),aa=M.array(M.never()).optional(),se=M.object({instanceBaseName:M.string().min(1),files:M.array(na).min(1).max(Xs),entry:sa,dataRequirements:aa}).strict().superRefine((t,n)=>{let i=new Set,o=t.entry.pathTemplate,r=0;for(let[m,l]of t.files.entries()){i.has(l.pathTemplate)&&n.addIssue({code:"custom",path:["files",m,"pathTemplate"],message:`Duplicate materialization pathTemplate: ${l.pathTemplate}`}),i.add(l.pathTemplate);let c=new TextEncoder().encode(l.content).length;c>Qs&&n.addIssue({code:"custom",path:["files",m,"content"],message:"Materialization file content exceeds the per-file byte limit."}),r+=c}i.has(o)||n.addIssue({code:"custom",path:["entry","pathTemplate"],message:"Materialization entry pathTemplate must match a file."}),r>Js&&n.addIssue({code:"custom",path:["files"],message:"Materialization exceeds the total content byte limit."})});var pn="insertNewComponent",Tp={categoryGroupMissing:"DESIGNER_COMPONENT_CATEGORY_GROUP_MISSING",unavailable:"DESIGNER_COMPONENT_LIBRARY_UNAVAILABLE",timeout:"DESIGNER_COMPONENT_LIBRARY_TIMEOUT",invalidResponse:"DESIGNER_COMPONENT_LIBRARY_INVALID_RESPONSE",incompatibleResource:"DESIGNER_COMPONENT_RESOURCE_INCOMPATIBLE"},dn=y.lazy(()=>y.object({id:y.string().uuid(),key:y.string().min(1),name:y.string(),children:y.array(dn)}).strict()),ln=y.object({category_group_key:y.literal(pn),categories:y.array(dn)}).strict(),oa=y.object({resource_id:y.string().min(1),name:y.string(),description:y.string().nullable(),thumbnail_url:y.string().nullable(),resolved_version:y.string().min(1),category_id:y.string().uuid().nullable()}).strict(),un=y.object({category_group_key:y.literal(pn),items:y.array(oa),next_cursor:y.string().min(1).nullable()}).strict(),kp=y.object({resource_id:y.string().min(1),resolved_version:y.string().min(1),anchor_block_id:y.string().min(1),placement:y.enum(["before","after"])}).strict(),Pp=y.object({status:y.literal("mock_acknowledged")}).strict(),Ap=y.object({category_id:y.string().uuid().optional(),include_descendants:y.enum(["true","false"]).optional().transform(t=>t==="true"),limit:y.coerce.number().int().min(1).max(100).optional().default(20),cursor:y.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),ra=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/,be=y.string().regex(ra),Cp=y.object({version:be}).strict(),gn=y.object({resource_id:y.string().min(1),resolved_version:be,revision_id:y.string().uuid(),digest_sha256:y.string().regex(/^[a-f0-9]{64}$/),materialization:se}).strict();import{z as g}from"zod";var hn="insertNewPage",Op={categoryGroupMissing:"DESIGNER_PAGE_CATEGORY_GROUP_MISSING",unavailable:"DESIGNER_PAGE_LIBRARY_UNAVAILABLE",timeout:"DESIGNER_PAGE_LIBRARY_TIMEOUT",invalidResponse:"DESIGNER_PAGE_LIBRARY_INVALID_RESPONSE",incompatibleResource:"DESIGNER_PAGE_RESOURCE_INCOMPATIBLE"},re=g.enum(["page","pages"]),_n=g.lazy(()=>g.object({id:g.string().uuid(),key:g.string().min(1),name:g.string(),children:g.array(_n)}).strict()),Sn=g.object({category_group_key:g.literal(hn),categories:g.array(_n)}).strict(),ca=g.object({resource_id:g.string().min(1),resource_type:re,name:g.string(),description:g.string().nullable(),thumbnail_url:g.string().nullable(),resolved_version:be,category_id:g.string().uuid().nullable()}).strict(),bn=g.object({category_group_key:g.literal(hn),items:g.array(ca),next_cursor:g.string().min(1).nullable()}).strict(),wp=g.object({category_id:g.string().uuid().optional(),include_descendants:g.enum(["true","false"]).optional().transform(t=>t==="true"),limit:g.coerce.number().int().min(1).max(100).optional().default(20),cursor:g.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),fe=be,Le=g.string().regex(/^\/[a-z0-9]+(?:-[a-z0-9]+)*$/),ma=g.string().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),pa=g.object({template_page_id:g.string().min(1),title:g.string().trim().min(1).max(120),final_route:Le}).strict(),da=g.object({template_page_id:g.string().min(1),title:g.string().trim().min(1).max(120),route:g.object({input:g.string(),append_random_suffix:g.boolean().optional(),random_suffix_length:g.number().int().min(4).max(16).optional(),final:Le}).strict()}).strict(),Mp=g.object({resource_id:g.string().min(1),resource_type:re,resolved_version:fe,pages:g.array(da).min(1)}).strict().superRefine((t,n)=>{Ue(t,n),J(t.pages.map(i=>i.template_page_id),"pages",n),J(t.pages.map(i=>i.route.final),"routes",n)});function Ue(t,n){t.resource_type==="page"&&t.pages.length!==1&&n.addIssue({code:"custom",path:["pages"],message:"page resources must contain exactly one page"}),t.resource_type==="pages"&&t.pages.length<2&&n.addIssue({code:"custom",path:["pages"],message:"pages resources must contain at least two pages"})}function J(t,n,i){let o=new Set;for(let[r,m]of t.entries())o.has(m)&&i.addIssue({code:"custom",path:[n,r],message:`Duplicate ${n} identifier: ${m}`}),o.add(m)}var Lp=g.object({resource_type:re,version:fe,pages:g.array(pa).min(1)}).strict().superRefine((t,n)=>{Ue(t,n),J(t.pages.map(i=>i.template_page_id),"pages",n),J(t.pages.map(i=>i.final_route),"routes",n)}),la=g.object({instance_id:g.string().min(1),component_id:g.string().min(1)}).strict(),ua=g.object({component_id:g.string().min(1),materialization:se}).strict(),ga=g.object({template_page_id:g.string().min(1),title:g.string().trim().min(1).max(120),final_route:Le,materialization:se,components:g.array(la)}).strict(),pt=g.object({resource_id:g.string().min(1),resource_type:re,resolved_version:fe,revision_id:g.string().uuid(),digest_sha256:g.string().regex(/^[a-f0-9]{64}$/),components:g.array(ua),pages:g.array(ga).min(1),project_dependencies:g.record(g.string(),g.never()).optional()}).strict().superRefine((t,n)=>{Ue(t,n);let i=t.components.map(r=>r.component_id),o=new Set(i);J(i,"components",n),J(t.pages.map(r=>r.template_page_id),"pages",n),J(t.pages.map(r=>r.final_route),"routes",n);for(let[r,m]of t.pages.entries()){let l=new Set;for(let[c,u]of m.components.entries())o.has(u.component_id)||n.addIssue({code:"custom",path:["pages",r,"components",c,"component_id"],message:`Unknown component reference: ${u.component_id}`}),l.has(u.instance_id)&&n.addIssue({code:"custom",path:["pages",r,"components",c,"instance_id"],message:`Duplicate component instance identifier within page: ${u.instance_id}`}),l.add(u.instance_id)}}),fn=pt,yn=g.object({template_page_id:g.string().min(1),title:g.string().trim().min(1).max(120),final_route:Le,route_file_path:g.string().regex(/^app\/[a-z0-9]+(?:-[a-z0-9]+)*\/page\.tsx$/)}).strict(),ha=g.object({template_page_id:g.string().min(1),title:g.string().trim().min(1).max(120)}).strict(),En=g.object({resource_id:g.string().min(1),resource_type:re,resolved_version:fe,pages:g.array(ha).min(1)}).strict().superRefine((t,n)=>{Ue(t,n),J(t.pages.map(i=>i.template_page_id),"pages",n)}),Up=g.object({resource_type:re,version:fe}).strict(),_a=g.object({title:g.string().trim().min(1).max(120),route_id:ma}).strict(),xn=g.object({items:g.array(_a)}).strict(),In=g.object({candidate:g.record(g.string(),g.unknown())}).strict();var ce="[a-z0-9]+(?:-[a-z0-9]+)*",ye=new RegExp(`^/(?:${ce}(?:/${ce})*)?$`);function Sa(t){return t.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Rn(t){return typeof t=="string"&&ye.test(t)}function Tn(t){if(typeof t!="string")return null;let n=t.trim();if(/[^\x00-\x7F]/.test(n))return null;let i=n.replace(/^\/+|\/+$/g,"");if(i==="")return"/";let o=i.split("/");if(o.some(c=>c==="."||c===".."))return null;let r=i.toLowerCase();if(r==="index"||r==="home")return"/";let m=o.map(Sa).filter(c=>c.length>0);if(m.length===0)return null;let l=`/${m.join("/")}`;return Rn(l)?l:null}function kn(t){let n=Tn(t);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function ba(t){let n=kn(t);return n==="/"?"app/page.tsx":`app/${n.slice(1)}/page.tsx`}import{z as fa}from"zod";var qp=".i18n.json",Fe="translation",Pn=new Set(["__proto__","constructor","prototype"]);function Cn(t){if(!Ke(t)||Object.keys(t).length===0)return ee("I18N_ROOT_INVALID","Component i18n resources must be a non-empty object.",[]);for(let[n,i]of Object.entries(t)){if(Pn.has(n))return An([n]);if(!ya(n))return ee("I18N_LOCALE_INVALID",`Component i18n locale must be canonical BCP-47: ${n}`,[n]);if(!Ke(i))return ee("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let o=Object.keys(i);if(o.length!==1||o[0]!==Fe)return ee("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let r=i[Fe];if(!Ke(r))return ee("I18N_RESOURCE_TREE_INVALID",`Component i18n translation namespace for ${n} must be an object.`,[n,Fe]);let m=[{value:r,path:[n,Fe]}];for(;m.length>0;){let l=m.pop();for(let[c,u]of Object.entries(l.value)){let E=[...l.path,c];if(Pn.has(c))return An(E);if(typeof u!="string"){if(!Ke(u))return ee("I18N_RESOURCE_TREE_INVALID","Component i18n resource leaves must be strings.",E);m.push({value:u,path:E})}}}}return{success:!0,data:t}}function Bp(t){let n;try{n=JSON.parse(t)}catch{return ee("I18N_JSON_INVALID","Component i18n resource file must contain valid JSON.",[])}return Cn(n)}var zp=fa.custom(t=>Cn(t).success,"Invalid component i18n resources.");function ya(t){try{let n=Intl.getCanonicalLocales(t);return n.length===1&&n[0]===t}catch{return!1}}function Ke(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null}function An(t){return ee("I18N_RESOURCE_KEY_FORBIDDEN",`Component i18n resource key is forbidden: ${t.at(-1)??""}`,t)}function ee(t,n,i){return{success:!1,error:{code:t,message:n,path:i}}}import{z as G}from"zod";var qe=G.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),Ea=G.enum(["direct","proxy","upstream","readonly","unsupported"]),xa=G.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),Ge=G.object({mode:Ea,reasonCode:G.string().min(1).optional()}),Ia=G.object({kind:xa,message:G.string().min(1)}),Be=G.object({key:G.string().min(1),canUpdateText:G.boolean(),canInsertChild:G.boolean(),canMove:G.boolean(),canRemove:G.boolean(),editModes:G.object({updateText:Ge.optional(),insertChild:Ge.optional(),move:Ge.optional(),remove:Ge.optional()}).optional(),constraints:G.array(Ia)});import{z as k}from"zod";import{z}from"zod";var Ra=z.object({code:z.string().min(1),message:z.string().min(1)}),Yp=z.object({code:z.string().min(1),message:z.string().min(1)});function dt(t){return z.object({ok:z.literal(!0),data:t})}function Ta(t){let n={ok:z.literal(!1),error:Ra.extend({code:t.codeSchema})};return t.currentSchema&&(n.current=t.currentSchema.optional()),t.diagnosticsSchema&&(n.diagnostics=z.array(t.diagnosticsSchema).optional()),t.dataSchema&&(n.data=t.dataSchema.optional()),z.object(n)}function Dn(t){return z.discriminatedUnion("ok",[dt(t.dataSchema),Ta({codeSchema:t.codeSchema,currentSchema:t.currentSchema,diagnosticsSchema:t.diagnosticsSchema,dataSchema:t.failureDataSchema})])}var ae=k.object({start:k.number().int().nonnegative(),end:k.number().int().nonnegative()}).superRefine((t,n)=>{t.end<t.start&&n.addIssue({code:"custom",path:["end"],message:"end must be greater than or equal to start"})}),ka=k.object({code:k.enum(["missing-class-name","unsupported-attribute-name","source-locator-warning","invalid-new-attr","version-conflict","write-failed"]),message:k.string().min(1)}),vn=k.object({path:k.string().min(1),content:k.string(),hash:k.string().min(1).optional()}),Jp=k.object({revision:k.string().min(1),entryCss:vn,stylesheets:k.array(vn).default([])}),Nn=k.object({key:k.string().min(1),routeId:k.string().min(1),filePath:k.string().min(1),componentName:k.string().min(1),sourceKind:k.enum(["missing","stringLiteral","expression"]),attrRaw:k.string().min(1).nullable(),valueRaw:k.string().min(1).nullable(),attrRange:ae.nullable(),openingElementRange:ae,version:k.object({documentVersion:k.number().int().nonnegative(),contentHash:k.string().min(1)}),diagnostics:k.array(ka),computedStyle:k.record(k.string(),k.string()).optional()}).superRefine((t,n)=>{if(t.sourceKind==="missing"){(t.attrRaw!==null||t.valueRaw!==null||t.attrRange!==null)&&n.addIssue({code:"custom",message:"missing className source must not include attr raw or range"});return}(t.attrRaw===null||t.valueRaw===null||t.attrRange===null)&&n.addIssue({code:"custom",message:"present className source must include attr raw and ranges"})}),ed=Nn,td=dt(Nn),lt=k.object({source:k.enum(["style-panel","class-source-editor"]),operation:k.enum(["replace-static-classname","replace-expression","create-attribute","remove-attribute"])});import{z as Pa}from"zod";var ut=Pa.enum(["src","alt","poster","href","width","height"]);import{z as I}from"zod";import{z as d}from"zod";import{z as me}from"zod";var Ee=me.object({editingSessionId:me.string().min(1),lockId:me.string().min(1),ownerId:me.string().min(1),leaseAssertion:me.string().min(1)}).strict(),od="signed-designer-mutations-v1",rd=me.object({mutationContext:Ee}).strict();import{z as p}from"zod";import{z as xe}from"zod";var ze="::",gt=xe.object({file:xe.string().min(1),component:xe.string().min(1),structuralPath:xe.string().min(1),key:xe.string().min(1)}).superRefine((t,n)=>{let i=Aa(t.file,t.component,t.structuralPath);t.key!==i&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function Aa(t,n,i){return`${t}${ze}${n}${ze}${i}`}function pd(t){let[n,i,...o]=t.split(ze);return!n||!i||o.length===0?null:{file:n,component:i,structuralPath:o.join(ze)}}var We=p.enum(["VERSION_STALE","RECOVERY_REQUIRED","MULTIPLE_PAGE_RETURNS","INDIRECT_RETURN_ONLY","PAGE_CONTAINER_AMBIGUOUS","NO_SAFE_PAGE_PLACEMENT","MEMBER_NOT_INDEPENDENT","UNSUPPORTED_ROUTE_STRUCTURE","RUNTIME_ANCHOR_UNRESOLVED","ROUTE_RETURN_NOT_FOUND"]),Ie=p.object({code:p.string().min(1),message:p.string().min(1)}).strict(),Ca=p.union([p.object({kind:p.literal("virtual-route-root"),key:p.string().min(1)}).strict(),p.object({kind:p.literal("jsx-container"),key:p.string().min(1),sourceMemberKey:p.string().min(1),sourceFile:p.string().min(1),componentName:p.string().min(1).optional()}).strict(),p.object({kind:p.literal("starter-placeholder"),key:p.string().min(1),sourceFile:p.string().min(1).optional()}).strict()]),Da=p.object({key:p.string().min(1),kind:p.enum(["jsx-element","jsx-fragment","jsx-expression","null-return","starter-placeholder"]),containerKey:p.string().min(1),label:p.string().min(1),sourceFile:p.string().min(1).optional(),isAtomic:p.boolean()}).strict(),va=p.object({key:p.string().min(1),sourceMemberKey:p.string().min(1),containerKey:p.string().min(1),label:p.string().min(1),isIndependent:p.boolean()}).strict(),Na=p.object({key:p.string().min(1),containerKey:p.string().min(1),businessMemberKeys:p.array(p.string().min(1)),isMultiMember:p.boolean()}).strict(),ht=p.object({kind:p.literal("page-composition"),placementKey:p.string().min(1),documentVersion:p.number().int().nonnegative()}).strict(),On=ht.extend({routeId:p.string().min(1),placementUnitKey:p.string().min(1),relation:p.enum(["before","after","prepend","append"])}).strict(),wn=On,Mn=p.object({kind:p.literal("page-unit"),routeId:p.string().min(1),placementUnitKey:p.string().min(1)}).strict();function X(t,n,i,o,r){let m=new Set;for(let[l,c]of t.entries()){let u=o(c);m.has(u)&&n.addIssue({code:"custom",path:[i,l,r],message:`Duplicate ${i} key: ${u}`}),m.add(u)}}var ja=p.object({status:p.literal("supported"),version:p.number().int().nonnegative(),routeId:p.string().min(1),container:Ca,sourceMembers:p.array(Da),businessMembers:p.array(va),placementUnits:p.array(Na),placements:p.array(On)}).strict().superRefine((t,n)=>{X(t.sourceMembers,n,"sourceMembers",c=>c.key,"key"),X(t.businessMembers,n,"businessMembers",c=>c.key,"key"),X(t.placementUnits,n,"placementUnits",c=>c.key,"key"),X(t.placements,n,"placements",c=>c.placementKey,"placementKey");let i=new Set(t.sourceMembers.map(c=>c.key)),o=new Set(t.placementUnits.map(c=>c.key)),r=new Map(t.sourceMembers.map(c=>[c.key,c])),m=new Map(t.businessMembers.map(c=>[c.key,c]));for(let[c,u]of t.sourceMembers.entries()){u.containerKey!==t.container.key&&!i.has(u.containerKey)&&n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member parent must reference the page container or another source member."}),u.containerKey===u.key&&n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member cannot contain itself."});let E=new Set([u.key]),h=u.containerKey;for(;h!==t.container.key;){if(E.has(h)){n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member hierarchy must be acyclic."});break}E.add(h);let b=r.get(h);if(!b)break;h=b.containerKey}}t.container.kind==="jsx-container"&&!i.has(t.container.sourceMemberKey)&&n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."});for(let[c,u]of t.businessMembers.entries())i.has(u.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",c,"sourceMemberKey"],message:"Business member must reference a source member."}),o.has(u.containerKey)||n.addIssue({code:"custom",path:["businessMembers",c,"containerKey"],message:"Business member must reference a placement unit container."});for(let[c,u]of t.placementUnits.entries()){let E=r.get(u.containerKey);E?E.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",c,"containerKey"],message:"Placement unit must reference a direct child of the page container."}):n.addIssue({code:"custom",path:["placementUnits",c,"containerKey"],message:"Placement unit containerKey must reference a source member."});let h=new Set;for(let[b,D]of u.businessMemberKeys.entries()){let N=m.get(D);if(!N){n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",b],message:"Placement unit must reference existing business members."});continue}h.has(D)&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",b],message:"Placement unit cannot reference the same business member twice."}),h.add(D),N.containerKey!==u.key&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",b],message:"Business member containerKey must match its placement unit."});let F=N.sourceMemberKey,Y=new Set;for(;F&&F!==u.containerKey&&!Y.has(F);)Y.add(F),F=r.get(F)?.containerKey;F!==u.containerKey&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",b],message:"Placement unit business members must belong to its source subtree."})}}for(let[c,u]of t.businessMembers.entries())t.placementUnits.find(h=>h.key===u.containerKey)?.businessMemberKeys.includes(u.key)||n.addIssue({code:"custom",path:["businessMembers",c,"containerKey"],message:"Business member must be listed by its placement unit container."});let l=new Map;for(let c of t.placementUnits)l.set(c.containerKey,(l.get(c.containerKey)??0)+1);for(let[c,u]of t.sourceMembers.entries())u.containerKey===t.container.key&&l.get(u.key)!==1&&n.addIssue({code:"custom",path:["sourceMembers",c,"key"],message:"Every direct source member must be owned by exactly one placement unit."});for(let[c,u]of t.placements.entries())u.routeId!==t.routeId&&n.addIssue({code:"custom",path:["placements",c,"routeId"],message:"Page placement routeId must match page composition routeId."}),u.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",c,"documentVersion"],message:"Page placement version must match page composition version."}),o.has(u.placementUnitKey)||n.addIssue({code:"custom",path:["placements",c,"placementUnitKey"],message:"Placement option must reference an existing placement unit."})}),Oa=p.object({status:p.literal("unsupported"),version:p.number().int().nonnegative(),routeId:p.string().min(1),reason:We,diagnostics:p.array(Ie)}).strict(),wa=p.discriminatedUnion("status",[ja,Oa]),Ln=2,gd="page-composition-v2",Un=p.object({start:p.number().int().nonnegative(),end:p.number().int().nonnegative(),startLine:p.number().int().positive().optional(),startColumn:p.number().int().nonnegative().optional(),endLine:p.number().int().positive().optional(),endColumn:p.number().int().nonnegative().optional()}).strict().superRefine((t,n)=>{t.end<t.start&&n.addIssue({code:"custom",path:["end"],message:"Source range end must be greater than or equal to start."});let i=[t.startLine,t.startColumn,t.endLine,t.endColumn],o=i.some(m=>m!==void 0),r=i.every(m=>m!==void 0);o&&!r&&n.addIssue({code:"custom",path:["startLine"],message:"Source line and column locations must be provided together."}),t.startLine!==void 0&&t.endLine!==void 0&&t.endLine<t.startLine&&n.addIssue({code:"custom",path:["endLine"],message:"Source range endLine must not precede startLine."}),t.startLine!==void 0&&t.endLine===t.startLine&&t.startColumn!==void 0&&t.endColumn!==void 0&&t.endColumn<t.startColumn&&n.addIssue({code:"custom",path:["endColumn"],message:"Source range endColumn must not precede startColumn."})}),Ma=p.object({key:p.string().min(1),instanceIndex:p.number().int().nonnegative().optional(),instanceCount:p.number().int().positive().optional(),textSegmentIndex:p.number().int().nonnegative().optional()}).strict().superRefine((t,n)=>{t.instanceIndex!==void 0&&t.instanceCount!==void 0&&t.instanceIndex>=t.instanceCount&&n.addIssue({code:"custom",path:["instanceIndex"],message:"instanceIndex must be lower than instanceCount."})}),La=p.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),Ua=p.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),Fa=p.discriminatedUnion("kind",[p.object({kind:p.literal("virtual-route-root"),key:p.null(),routeReturn:p.object({sourceIdentity:gt,sourceRange:Un}).strict()}).strict(),p.object({kind:p.literal("jsx-container"),key:p.string().min(1),sourceMemberKey:p.string().min(1)}).strict(),p.object({kind:p.literal("starter-placeholder"),key:p.string().min(1),sourceMemberKey:p.string().min(1),replacementMode:p.literal("replace")}).strict()]),Ka=p.object({key:p.string().min(1),kind:La,parentKey:p.string().min(1).nullable(),childKeys:p.array(p.string().min(1)),order:p.number().int().nonnegative(),label:p.string().min(1),sourceIdentity:gt,sourceRange:Un.nullable(),atomicKind:Ua}).strict().superRefine((t,n)=>{let i=t.kind==="component-call"||t.kind==="native-jsx"?"none":t.kind;t.atomicKind!==i&&n.addIssue({code:"custom",path:["atomicKind"],message:`atomicKind must be ${i} for ${t.kind}.`});let o=new Set;for(let[r,m]of t.childKeys.entries())o.has(m)&&n.addIssue({code:"custom",path:["childKeys",r],message:`Duplicate child source member key: ${m}`}),o.add(m)}),Ga=p.object({key:p.string().min(1),sourceMemberKey:p.string().min(1),placementUnitKey:p.string().min(1),label:p.string().min(1),isIndependent:p.boolean()}).strict(),qa=p.enum(["independent","atomic","container"]),Ba=p.object({key:p.string().min(1),containerKey:p.string().min(1).nullable(),sourceMemberKeys:p.array(p.string().min(1)).min(1),businessMemberKeys:p.array(p.string().min(1)),order:p.number().int().nonnegative(),boundaryMode:qa,isIndependent:p.boolean(),isMultiMember:p.boolean()}).strict().superRefine((t,n)=>{jn(t.sourceMemberKeys,n,"sourceMemberKeys","source member"),jn(t.businessMemberKeys,n,"businessMemberKeys","business member");let i=t.sourceMemberKeys.length>1||t.businessMemberKeys.length>1;t.isMultiMember!==i&&n.addIssue({code:"custom",path:["isMultiMember"],message:"isMultiMember must reflect the source and business member cardinality."});let o=t.boundaryMode==="independent";t.isIndependent!==o&&n.addIssue({code:"custom",path:["isIndependent"],message:"isIndependent must match boundaryMode."})}),za=p.enum(["before","after","prepend","append","replace"]),Wa=p.enum(["insert-sibling","insert-child","replace-placeholder"]),Va=p.object({kind:p.literal("page-composition"),placementKey:p.string().min(1),documentVersion:p.number().int().nonnegative(),routeId:p.string().min(1),placementUnitKey:p.string().min(1),containerKey:p.string().min(1).nullable(),relation:za,writeMode:Wa}).strict().superRefine((t,n)=>{let i=t.relation==="before"||t.relation==="after"?"insert-sibling":t.relation==="prepend"||t.relation==="append"?"insert-child":"replace-placeholder";t.writeMode!==i&&n.addIssue({code:"custom",path:["writeMode"],message:`writeMode must be ${i} for ${t.relation}.`})}),Ha=p.object({key:p.string().min(1),placementUnitKey:p.string().min(1),runtimeRefs:p.array(Ma).min(1)}).strict(),$a=p.object({schemaVersion:p.literal(Ln),status:p.literal("supported"),version:p.number().int().nonnegative(),routeId:p.string().min(1),container:Fa,sourceMembers:p.array(Ka),businessMembers:p.array(Ga),placementUnits:p.array(Ba),placements:p.array(Va),visualAnchors:p.array(Ha).optional(),diagnostics:p.array(Ie)}).strict().superRefine((t,n)=>{Xa(t,n)}),Ya=p.object({schemaVersion:p.literal(Ln),status:p.literal("unsupported"),version:p.number().int().nonnegative(),routeId:p.string().min(1),reason:We,diagnostics:p.array(Ie)}).strict(),Za=p.discriminatedUnion("status",[$a,Ya]),hd=p.union([Za,wa]);function jn(t,n,i,o){let r=new Set;for(let[m,l]of t.entries())r.has(l)&&n.addIssue({code:"custom",path:[i,m],message:`Duplicate ${o} key: ${l}`}),r.add(l)}function Xa(t,n){X(t.sourceMembers,n,"sourceMembers",h=>h.key,"key"),X(t.businessMembers,n,"businessMembers",h=>h.key,"key"),X(t.placementUnits,n,"placementUnits",h=>h.key,"key"),X(t.placements,n,"placements",h=>h.placementKey,"placementKey"),X(t.visualAnchors??[],n,"visualAnchors",h=>h.key,"key"),Qa(t,n);let i=new Map(t.sourceMembers.map(h=>[h.key,h])),o=new Map(t.businessMembers.map(h=>[h.key,h])),r=new Map(t.placementUnits.map(h=>[h.key,h]));Ja(t,i,n),t.container.kind!=="virtual-route-root"&&(i.has(t.container.sourceMemberKey)||n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."}));let m=new Map,l=new Map,c=new Set;for(let[h,b]of t.placementUnits.entries()){b.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",h,"containerKey"],message:"Placement unit containerKey must match the page container."});let D=`${b.containerKey??"<virtual>"}:${b.order}`;c.has(D)&&n.addIssue({code:"custom",path:["placementUnits",h,"order"],message:"Placement unit order must be unique within its container."}),c.add(D);for(let[N,F]of b.sourceMemberKeys.entries()){i.has(F)||n.addIssue({code:"custom",path:["placementUnits",h,"sourceMemberKeys",N],message:"Placement unit must reference existing source members."});let Y=m.get(F);Y&&Y!==b.key&&n.addIssue({code:"custom",path:["placementUnits",h,"sourceMemberKeys",N],message:`Source member is already assigned to ${Y}.`}),m.set(F,b.key)}for(let[N,F]of b.businessMemberKeys.entries()){let Y=o.get(F);if(!Y){n.addIssue({code:"custom",path:["placementUnits",h,"businessMemberKeys",N],message:"Placement unit must reference existing business members."});continue}Y.placementUnitKey!==b.key&&n.addIssue({code:"custom",path:["placementUnits",h,"businessMemberKeys",N],message:"Placement unit and business member must reference each other."}),b.sourceMemberKeys.includes(Y.sourceMemberKey)||n.addIssue({code:"custom",path:["placementUnits",h,"businessMemberKeys",N],message:"Business member sourceMemberKey must belong to the placement unit."});let it=l.get(F);it&&it!==b.key&&n.addIssue({code:"custom",path:["placementUnits",h,"businessMemberKeys",N],message:`Business member is already assigned to ${it}.`}),l.set(F,b.key)}}for(let[h,b]of t.businessMembers.entries()){i.has(b.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",h,"sourceMemberKey"],message:"Business member must reference a source member."});let D=r.get(b.placementUnitKey);if(!D){n.addIssue({code:"custom",path:["businessMembers",h,"placementUnitKey"],message:"Business member must reference a placement unit."});continue}D.businessMemberKeys.includes(b.key)||n.addIssue({code:"custom",path:["businessMembers",h,"placementUnitKey"],message:"Business member and placement unit must reference each other."}),D.sourceMemberKeys.includes(b.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",h,"sourceMemberKey"],message:"Business member sourceMemberKey must belong to its placement unit."});let N=D.isIndependent&&D.businessMemberKeys.length===1;b.isIndependent!==N&&n.addIssue({code:"custom",path:["businessMembers",h,"isIndependent"],message:"Business member independence must match its placement unit boundary."})}let u=new Set;for(let[h,b]of t.placements.entries()){b.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",h,"documentVersion"],message:"Page placement version must match page composition version."}),b.routeId!==t.routeId&&n.addIssue({code:"custom",path:["placements",h,"routeId"],message:"Page placement routeId must match page composition routeId."});let D=r.get(b.placementUnitKey);D?b.containerKey!==D.containerKey&&n.addIssue({code:"custom",path:["placements",h,"containerKey"],message:"Placement containerKey must match its placement unit."}):n.addIssue({code:"custom",path:["placements",h,"placementUnitKey"],message:"Placement option must reference a placement unit."});let N=`${b.placementUnitKey}:${b.relation}`;u.has(N)&&n.addIssue({code:"custom",path:["placements",h,"relation"],message:"A placement unit cannot expose the same relation more than once."}),u.add(N),b.relation==="replace"&&t.container.kind!=="starter-placeholder"&&n.addIssue({code:"custom",path:["placements",h,"relation"],message:"replace is only valid for a starter placeholder container."}),t.container.kind==="starter-placeholder"&&b.relation!=="replace"&&n.addIssue({code:"custom",path:["placements",h,"relation"],message:"Starter placeholder placements must use replace."})}let E=new Set;for(let[h,b]of(t.visualAnchors??[]).entries())r.has(b.placementUnitKey)||n.addIssue({code:"custom",path:["visualAnchors",h,"placementUnitKey"],message:"Visual anchor must reference a placement unit."}),E.has(b.placementUnitKey)&&n.addIssue({code:"custom",path:["visualAnchors",h,"placementUnitKey"],message:"A placement unit may expose only one visual anchor."}),E.add(b.placementUnitKey)}function Qa(t,n){let i=[];t.container.key!==null&&i.push({key:t.container.key,path:["container","key"],namespace:"container"});for(let[r,m]of t.sourceMembers.entries())i.push({key:m.key,path:["sourceMembers",r,"key"],namespace:"source member"});for(let[r,m]of t.businessMembers.entries())i.push({key:m.key,path:["businessMembers",r,"key"],namespace:"business member"});for(let[r,m]of t.placementUnits.entries())i.push({key:m.key,path:["placementUnits",r,"key"],namespace:"placement unit"});for(let[r,m]of(t.visualAnchors??[]).entries())i.push({key:m.key,path:["visualAnchors",r,"key"],namespace:"visual anchor"});let o=new Map;for(let r of i){let m=o.get(r.key);m?n.addIssue({code:"custom",path:r.path,message:`${r.namespace} key collides with ${m}: ${r.key}`}):o.set(r.key,r.namespace)}}function Ja(t,n,i){let o=new Set;for(let[r,m]of t.sourceMembers.entries()){let l=`${m.parentKey??"<root>"}:${m.order}`;if(o.has(l)&&i.addIssue({code:"custom",path:["sourceMembers",r,"order"],message:"Source member order must be unique among siblings."}),o.add(l),m.parentKey===m.key&&i.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source member cannot be its own parent."}),m.parentKey!==null){let E=n.get(m.parentKey);E?E.childKeys.includes(m.key)||i.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source parent and child references must be bidirectional."}):i.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source member parentKey must reference a source member."})}for(let[E,h]of m.childKeys.entries()){if(h===m.key){i.addIssue({code:"custom",path:["sourceMembers",r,"childKeys",E],message:"Source member cannot be its own child."});continue}let b=n.get(h);b?b.parentKey!==m.key&&i.addIssue({code:"custom",path:["sourceMembers",r,"childKeys",E],message:"Source parent and child references must be bidirectional."}):i.addIssue({code:"custom",path:["sourceMembers",r,"childKeys",E],message:"Source child key must reference a source member."})}let c=new Set,u=m;for(;u;){if(c.has(u.key)){i.addIssue({code:"custom",path:["sourceMembers",r,"parentKey"],message:"Source member graph must be acyclic."});break}c.add(u.key),u=u.parentKey===null?void 0:n.get(u.parentKey)}}}var Re=d.enum(["update-text","update-array-item","remove-node","insert-child","move-node","set-class-name-source","set-props","apply-style-draft","source-edit","insert-page-resource"]),Fn=d.lazy(()=>d.union([d.string(),d.number(),d.boolean(),d.null(),d.array(Fn),d.record(d.string(),Fn)])),Gn=d.discriminatedUnion("kind",[d.object({kind:d.literal("node"),key:d.string().min(1)}),Mn,d.object({kind:d.literal("route"),routeId:d.string().min(1)}),d.object({kind:d.literal("source-file"),path:K}),d.object({kind:d.literal("source-batch"),paths:d.array(K).min(1)}).superRefine((t,n)=>{let i=new Set;for(let[o,r]of t.paths.entries())i.has(r)&&n.addIssue({code:"custom",path:["paths",o],message:`Duplicate source target path: ${r}`}),i.add(r)}),d.object({kind:d.literal("project")}).strict()]),qn=d.enum(["display","position","top","right","bottom","left","zIndex","flexDirection","flexWrap","flexGrow","flexShrink","flexBasis","order","gridTemplateColumns","gridTemplateRows","columns","gridColumn","gridRow","gap","gapX","gapY","spaceX","spaceY","alignItems","justifyContent","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","width","height","minWidth","minHeight","maxWidth","maxHeight","overflow","fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","textAlign","textTransform","textDecoration","textOverflow","textIndent","writingMode","whiteSpace","wordBreak","lineClamp","fontVariantNumeric","screenReaderOnly","color","backgroundColor","backgroundImage","backgroundRepeat","backgroundSize","backgroundPosition","backgroundAttachment","backgroundClip","backgroundOrigin","borderStyle","borderWidth","borderRadius","borderColor","objectFit","objectPosition","aspectRatio","opacity","boxShadow","transform","transformOrigin","transitionProperty","transitionDuration","transitionTimingFunction","animation","pointerEvents","cursor","userSelect","fontStyle","textUnderlineOffset","scrollMarginTop","alignSelf","flex","outlineStyle","resize","ringWidth","ringColor","backdropFilter","overscrollBehavior","divideWidth","divideColor"]),Bn=d.enum(["hover","active","focus","disabled"]),zn=d.enum(["sm","md","lg","xl","2xl"]),Kn=d.union([d.object({relation:d.enum(["before","after"]),anchorKey:d.string().min(1)}),d.object({relation:d.enum(["prepend","append"]),parentKey:d.string().min(1)}),wn]),eo=d.union([d.object({kind:d.literal("native-tag"),tag:d.string().min(1),text:d.string().optional()}),d.object({kind:d.literal("component-call"),component:d.object({source:d.string().min(1),exportName:d.string().min(1)}),materialization:d.never().optional(),props:d.record(d.string(),d.unknown()).optional()}).strict(),d.object({kind:d.literal("component-call"),component:d.never().optional(),materialization:se,props:d.record(d.string(),d.never()).optional()}).strict()]),to=d.discriminatedUnion("kind",[d.object({kind:d.literal("update-text"),segmentIndex:d.number().int().min(0),value:d.string()}),d.object({kind:d.literal("update-array-item"),segmentIndex:d.number().int().min(0),index:d.number().int().min(0),value:d.string()}),d.object({kind:d.literal("remove-node")}),d.object({kind:d.literal("insert-child"),node:eo,position:d.union([Kn,ht])}),d.object({kind:d.literal("move-node"),target:Kn,preserveBindings:d.boolean().optional()}),d.object({kind:d.literal("set-class-name-source"),routeId:d.string().min(1).optional(),filePath:d.string().min(1),expectedVersion:d.object({documentVersion:d.number().int().nonnegative(),contentHash:d.string().min(1)}),oldAttrRaw:d.string().min(1).nullable(),oldAttrRange:ae.nullable(),openingElementRange:ae,newAttrRaw:d.string().min(1).nullable(),intent:lt}),d.object({kind:d.literal("set-props"),props:d.partialRecord(ut,d.string())}),d.object({kind:d.literal("apply-style-draft"),className:d.object({routeId:d.string().min(1).optional(),filePath:d.string().min(1),expectedVersion:d.object({documentVersion:d.number().int().nonnegative(),contentHash:d.string().min(1)}),oldAttrRaw:d.string().min(1).nullable(),oldAttrRange:ae.nullable(),openingElementRange:ae,newAttrRaw:d.string().min(1).nullable(),intent:lt}).optional(),props:d.partialRecord(ut,d.string()).optional()}).superRefine((t,n)=>{!t.className&&!t.props&&n.addIssue({code:"custom",message:"apply-style-draft requires className or props"})}),d.object({kind:d.literal("source-edit"),conflictPolicy:d.enum(["compare-and-swap","overwrite"]),edits:d.array(d.discriminatedUnion("operation",[d.object({operation:d.literal("upsert"),path:K,content:d.string(),baseContentHash:d.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{rt(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit upsert only accepts allowlisted text source files"}),t.content.includes("\0")&&n.addIssue({code:"custom",path:["content"],message:"source-edit content must be valid text"})}),d.object({operation:d.literal("delete"),path:K,capability:Qt,confirmDelete:d.literal(!0),confirmPath:K,baseContentHash:d.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{t.capability!==ot&&n.addIssue({code:"custom",path:["capability"],message:"delete requires source-delete capability"}),t.confirmPath!==t.path&&n.addIssue({code:"custom",path:["confirmPath"],message:"delete confirmation path must match edit path"}),rt(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit delete only accepts allowlisted text source files"});let i=ct(t.path);i&&n.addIssue({code:"custom",path:["path"],message:`Protected source file cannot be deleted: ${t.path} (${i})`})})])).min(1),reason:d.string().min(1).optional()}).strict().superRefine((t,n)=>{let i=new Set;for(let[o,r]of t.edits.entries())i.has(r.path)&&n.addIssue({code:"custom",path:["edits",o,"path"],message:`Duplicate source edit path: ${r.path}`}),i.add(r.path),t.conflictPolicy==="compare-and-swap"&&r.baseContentHash===void 0&&n.addIssue({code:"custom",path:["edits",o,"baseContentHash"],message:"source-edit compare-and-swap requires baseContentHash for every edit"})}),d.object({kind:d.literal("insert-page-resource"),artifact:pt}).strict()]),Wn=d.enum(["NODE_NOT_FOUND","ROUTE_NOT_FOUND","CAPABILITY_REJECTED","CONSTRAINT_VIOLATED","INVALID_PARAMS","PLAN_FAILED","TRANSACTION_PREFLIGHT_FAILED","ROUTE_REBUILD_FAILED","HISTORY_COMMIT_FAILED","MATERIALIZATION_CONFLICT","MATERIALIZATION_REJECTED","MUTATION_ASSERTION_REQUIRED","MUTATION_ASSERTION_INVALID","VERSION_STALE","AST_PARSE_ERROR","UNSUPPORTED_OPERATION","LOCATOR_FAILED","INVALID_TARGET","WRITE_IO_ERROR","CONCURRENT_MODIFIED","ROLLBACK_FAILED","RECOVERY_REQUIRED","RECOVERY_PERSIST_FAILED","MUTATION_SESSION_REQUIRED","LEASE_ASSERTION_INVALID","LEASE_ASSERTION_EXPIRED","LEASE_ASSERTION_SCOPE_MISMATCH","CROSS_PAGE_MOVE_UNSUPPORTED","INTERNAL_ERROR"]),Vn=d.object({code:Wn,message:d.string().min(1),details:d.record(d.string(),d.unknown()).optional()}),Hn=d.object({key:d.string().min(1),instanceIndex:d.number().int().nonnegative().optional(),instanceCount:d.number().int().positive().optional()}),no=d.object({id:d.string().min(1),siteId:d.string().min(1),baseSnapshotId:d.string().min(1),routeId:d.string().min(1).optional(),kind:Re,target:Gn,documentVersion:d.number().int().nonnegative(),selectionRef:Hn.optional(),mutationContext:Ee.optional(),params:to}).superRefine((t,n)=>{if(t.kind!==t.params.kind&&n.addIssue({code:"custom",path:["params","kind"],message:"params.kind must match operation kind"}),t.kind==="source-edit"){if(t.target.kind!=="source-file"&&t.target.kind!=="source-batch")n.addIssue({code:"custom",path:["target","kind"],message:"source-edit requires a source-file or source-batch target"});else if(t.params.kind==="source-edit"){let i=t.params.edits.map(r=>r.path),o=t.target.kind==="source-file"?[t.target.path]:t.target.paths;ao(i,o)||n.addIssue({code:"custom",path:["target"],message:"source-edit target paths must match edit paths"})}}else(t.target.kind==="source-file"||t.target.kind==="source-batch")&&n.addIssue({code:"custom",path:["target","kind"],message:"source targets are only valid for source-edit"});t.target.kind==="page-unit"&&(t.kind!=="insert-child"&&t.kind!=="move-node"&&t.kind!=="remove-node"&&n.addIssue({code:"custom",path:["target","kind"],message:"page-unit target is only valid for page-level operations"}),t.kind==="move-node"&&t.params.kind==="move-node"&&(!("kind"in t.params.target)||t.params.target.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","target","kind"],message:"page-unit move-node target requires page-composition placement"})),t.params.kind==="insert-child"&&"kind"in t.params.position&&t.params.position.kind==="page-composition"&&t.target.kind!=="page-unit"&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-composition position requires page-unit target"}),t.kind==="insert-page-resource"?t.target.kind!=="project"&&n.addIssue({code:"custom",path:["target","kind"],message:`${t.kind} requires a project target`}):t.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project target is only valid for insert-page-resource"}),t.kind==="insert-child"&&t.target.kind==="page-unit"&&t.params.kind==="insert-child"&&(!("kind"in t.params.position)||t.params.position.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-unit target requires page-composition position"})}),kd=no,io=d.object({kind:d.literal("insert-page-resource"),package_instance_id:d.string().min(1),pages:d.array(yn).min(1)}).strict().superRefine((t,n)=>{let i=new Set,o=new Set;for(let[r,m]of t.pages.entries())i.has(m.template_page_id)&&n.addIssue({code:"custom",path:["pages",r,"template_page_id"],message:`Duplicate template page route mapping: ${m.template_page_id}`}),o.has(m.final_route)&&n.addIssue({code:"custom",path:["pages",r,"final_route"],message:`Duplicate final route mapping: ${m.final_route}`}),i.add(m.template_page_id),o.add(m.final_route)}),so=d.discriminatedUnion("kind",[io]),$n=d.object({requestId:d.string().min(1),kind:Re,target:Gn,resultVersion:d.number().int().nonnegative(),affectedFiles:d.array(d.string().min(1)).optional(),selectionRef:Hn.optional(),output:so.optional()}),_t=$n.superRefine((t,n)=>{let i=t.kind==="insert-page-resource";i&&t.target.kind!=="project"?n.addIssue({code:"custom",path:["target","kind"],message:`${t.kind} result requires a project target`}):!i&&t.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project result target requires a project operation"}),i&&!t.output&&n.addIssue({code:"custom",path:["output"],message:`${t.kind} result requires typed output`}),t.output&&t.output.kind!==t.kind&&n.addIssue({code:"custom",path:["output","kind"],message:"output.kind must match operation kind"})}),Pd=Dn({dataSchema:_t,codeSchema:Wn,failureDataSchema:$n.partial()});function ao(t,n){return t.length===n.length&&t.every((i,o)=>i===n[o])}var Nd=I.discriminatedUnion("type",[I.object({type:I.literal("site-edit.document.changed"),siteId:I.string().min(1),snapshotId:I.string().min(1),routeId:I.string().min(1),version:I.number().int().nonnegative(),at:I.string().min(1)}),I.object({type:I.literal("site-edit.operation.planned"),siteId:I.string().min(1),operationId:I.string().min(1),baseSnapshotId:I.string().min(1),changedFiles:I.array(I.string().min(1)),at:I.string().min(1)}),I.object({type:I.literal("site-edit.operation.completed"),siteId:I.string().min(1),result:_t,at:I.string().min(1)}),I.object({type:I.literal("site-edit.operation.failed"),siteId:I.string().min(1),requestId:I.string().min(1),error:Vn,at:I.string().min(1)}),I.object({type:I.literal("site-edit.capability.changed"),siteId:I.string().min(1),routeId:I.string().min(1),keys:I.array(I.string().min(1)),at:I.string().min(1)})]);import{z as A}from"zod";var wd="durable-history-v1",Md=A.enum(["writable","read-only-recovery","unavailable"]),oo=A.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),ro=A.object({code:oo,message:A.string().min(1),occurredAt:A.iso.datetime().optional()}).strict(),co=A.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),Yn={revision:A.number().int().nonnegative(),undoDepth:A.number().int().nonnegative(),redoDepth:A.number().int().nonnegative()},mo=A.object({mode:A.literal("writable"),...Yn,canUndo:A.boolean(),canRedo:A.boolean()}).strict().superRefine((t,n)=>{t.canUndo!==t.undoDepth>0&&n.addIssue({code:"custom",path:["canUndo"],message:"canUndo must reflect undoDepth."}),t.canRedo!==t.redoDepth>0&&n.addIssue({code:"custom",path:["canRedo"],message:"canRedo must reflect redoDepth."})}),po=A.object({mode:A.literal("read-only-recovery"),...Yn,canUndo:A.literal(!1),canRedo:A.literal(!1),recoveryDiagnostic:ro}).strict(),lo=A.object({mode:A.literal("unavailable"),revision:A.literal(0),undoDepth:A.literal(0),redoDepth:A.literal(0),canUndo:A.literal(!1),canRedo:A.literal(!1),reason:co}).strict(),Ld=A.discriminatedUnion("mode",[mo,po,lo]);import{z as O}from"zod";var uo=O.string().min(1).refine(t=>!t.startsWith("/")&&!t.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),go=O.string().regex(/^sha256:[a-f0-9]{64}$/),ho=O.object({path:uo,operation:O.enum(["create","update","delete"]),expectedHash:go.optional(),fullContent:O.string().optional()}).superRefine((t,n)=>{t.operation==="delete"&&t.fullContent!==void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"delete patches must not include fullContent"}),t.operation!=="delete"&&t.fullContent===void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"create/update patches must include fullContent"})}),Kd=O.object({siteId:O.string().min(1),baseSnapshotId:O.string().min(1),operationId:O.string().min(1),reason:O.string().min(1),patches:O.array(ho).min(1),changedRouteIds:O.array(O.string().min(1)),diagnostics:O.array(O.object({code:O.string().min(1),message:O.string().min(1),path:O.string().min(1).optional()})).default([])}).superRefine((t,n)=>{let i=new Set;for(let[o,r]of t.patches.entries())i.has(r.path)&&n.addIssue({code:"custom",path:["patches",o,"path"],message:`Duplicate patch path: ${r.path}`}),i.add(r.path)});var St="::repeat-item#";function _o(t,n){return`${t}${St}${n}`}function qd(t,n){return n.reduce((i,o)=>_o(i,o),t)}function So(t){if(typeof t!="string"||t.length===0)return null;let n=[],i=t;for(;;){let o=i.lastIndexOf(St);if(o<0)break;let r=Number(i.slice(o+St.length));if(!Number.isInteger(r)||r<0)return null;n.unshift({repeatIndex:r}),i=i.slice(0,o)}return!i||n.length===0?null:{baseKey:i,parts:n}}function Bd(t){return So(t)?.baseKey??t??null}import{z as s}from"zod";import{z as q}from"zod";var bo=q.object({placementKey:q.string().min(1),placementUnitKey:q.string().min(1),relation:q.enum(["before","after","prepend","append"])}).strict(),fo=q.object({status:q.literal("supported"),containerKey:q.string().min(1),hasBusinessMembers:q.boolean(),placementUnitKeys:q.array(q.string().min(1)),placements:q.array(bo)}).strict().superRefine((t,n)=>{let i=new Set(t.placementUnitKeys);i.size!==t.placementUnitKeys.length&&n.addIssue({code:"custom",path:["placementUnitKeys"],message:"Render page composition placement unit keys must be unique."});let o=new Set;t.placements.forEach((r,m)=>{o.has(r.placementKey)&&n.addIssue({code:"custom",path:["placements",m,"placementKey"],message:"Render page composition placement keys must be unique."}),o.add(r.placementKey),i.has(r.placementUnitKey)||n.addIssue({code:"custom",path:["placements",m,"placementUnitKey"],message:"Render page composition placement must reference a projected unit."})})}),yo=q.object({status:q.literal("unsupported"),reason:We,diagnostics:q.array(Ie)}).strict(),Zn=q.discriminatedUnion("status",[fo,yo]);var Eo=s.object({canUpdateText:s.boolean(),canInsertChild:s.boolean(),canMove:s.boolean(),canRemove:s.boolean()}),Xn=s.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),xo=s.enum(["cms-field","api-field"]),Io=s.enum(["text","attribute","richtext","repeat-region","component-prop"]),Ro=s.enum(["exact","safe-derived","partial","unknown"]),To=s.object({file:s.string().min(1),symbol:s.string().min(1).optional(),reason:s.string().min(1)}),ko=s.object({sourceKind:Xn,sourceType:xo,endpointPattern:s.string().min(1).optional(),operation:s.string().min(1).optional(),collection:s.string().min(1).optional(),fieldPath:s.string().min(1).optional(),valuePath:s.string().min(1).optional(),targetKind:Io,targetName:s.string().min(1),confidence:Ro,readonly:s.literal(!0),evidence:s.array(To)}),Qn=s.object({hasDynamicData:s.boolean(),bindings:s.array(ko)}),Jn=s.object({hasDynamicData:s.boolean(),sourceKinds:s.array(Xn),primaryEndpoint:s.string().min(1).optional(),primaryCollection:s.string().min(1).optional(),primaryFieldPath:s.string().min(1).optional()}),Po=s.object({key:s.string().min(1),pageCompositionUnitKey:s.string().min(1).optional(),operationSummary:Eo,dynamicDataSummary:Jn.optional()}).strict(),nl=s.object({siteId:s.string().min(1),snapshotId:s.string().min(1),routeId:s.string().min(1),version:s.number().int().nonnegative(),entries:s.array(Po),pageComposition:Zn}).strict(),bt=s.enum(["api-field","cms-field","i18n-message","config-entry"]),ei=s.object({kind:s.enum(["literal","binding","imported-binding","repeat-template"]),file:s.string().min(1),expression:s.string().min(1),bindingName:s.string().min(1).optional(),path:s.array(s.union([s.string(),s.number()])).optional()}),ft=s.object({index:s.number().int().min(0),value:s.string(),editable:s.boolean(),source:ei.nullable()}),Te=s.object({key:s.string().min(1),label:s.string().min(1),tag:s.string().min(1)}),il=s.object({key:s.string().min(1),canUpdateText:s.boolean(),canInsertChild:s.boolean(),canMove:s.boolean(),canRemove:s.boolean(),boundaryKind:qe.nullable(),isOpaque:s.boolean()}),Ao=s.object({kind:s.enum(["jsx-node","component-proxy","value-binding","route-export"]),file:s.string().min(1),componentName:s.string().min(1),isProxy:s.boolean()}),Co=s.object({kind:s.enum(["jsx-node","value-path","route-export","external-entry"]),file:s.string().min(1).optional(),isProxy:s.boolean(),displayPath:s.string().min(1).optional(),sourceType:bt.optional(),sourceId:s.string().min(1).optional()}),ti=s.object({kind:s.union([s.enum(["jsx-literal","component-prop","binding","imported-binding","object-field","array-item","repeat-template","conditional-branch"]),bt]),file:s.string().min(1),displayPath:s.string().min(1),externalSource:s.object({sourceType:bt,sourceId:s.string().min(1),adapterId:s.string().min(1).optional()}).optional()}),Do=s.object({kind:ti.shape.kind,file:s.string().min(1),displayName:s.string().min(1),canEditHere:s.boolean()}),ke=s.object({finalSource:ti.nullable(),chain:s.array(Do),confidence:s.enum(["exact","safe-derived","partial","unknown"]),editMode:s.enum(["direct","proxy","upstream","readonly","unsupported"]),diagnostics:s.array(s.object({code:s.string().min(1),message:s.string().min(1)}))}),vo=s.object({kind:s.literal("css-style-model"),properties:s.array(s.object({property:qn,value:s.union([s.string(),s.number(),s.boolean(),s.null()]),resolvedValue:s.union([s.string(),s.number(),s.boolean(),s.null()]).optional(),breakpoint:zn.optional(),state:Bn.optional(),variants:s.array(s.string().min(1)).optional(),options:s.array(s.union([s.string(),s.number()])).optional(),editable:s.boolean(),diagnostics:s.array(s.object({code:s.string().min(1),message:s.string().min(1)})).optional(),operationBoundary:s.array(Re).optional()}))}),sl=s.union([s.record(s.string(),s.unknown()),vo]),ni=s.object({kind:s.literal("class-name-source"),className:s.string(),sourceKind:s.enum(["missing","static-attribute","static-expression","dynamic-expression"]),editable:s.boolean(),operationBoundary:s.array(Re),sourcePath:s.string().min(1).optional(),diagnostics:s.array(s.object({code:s.enum(["missing-class-name","dynamic-binding","non-string-binding"]),message:s.string().min(1)})).optional()}),No=s.object({startLine:s.number().int().positive(),startColumn:s.number().int().nonnegative(),endLine:s.number().int().positive(),endColumn:s.number().int().nonnegative()}),yt=s.object({sourceFile:s.string().min(1),componentName:s.string().min(1),openingElementRange:No,structuralPath:s.string().min(1),textPreview:s.string().min(1).optional()}),al=s.object({key:s.string().min(1),tag:s.string().min(1),componentName:s.string().min(1),sourceFile:s.string().min(1),sourceLocator:yt.optional(),label:s.string().min(1),capabilities:Be,writeTarget:Ao,effectiveWriteTarget:Co.optional(),provenanceChain:ke.optional(),componentSemantic:s.record(s.string(),s.unknown()).optional(),contentModel:s.record(s.string(),s.unknown()).optional(),mediaModel:s.record(s.string(),s.unknown()).optional(),styleSource:ni.optional(),conditional:s.record(s.string(),s.unknown()).optional(),dynamicData:Qn.optional(),textSegments:s.array(ft),boundaryKind:qe.nullable(),isOpaque:s.boolean(),ancestors:s.array(Te),children:s.array(Te),siblings:s.array(Te)}),ol=s.object({key:s.string().min(1),tag:s.string().min(1),label:s.string().min(1),sourceLocator:yt.optional(),capabilities:s.object({constraints:Be.shape.constraints}),isOpaque:s.boolean(),provenanceChain:s.object({editMode:ke.shape.editMode,diagnostics:ke.shape.diagnostics}).optional(),dynamicDataSummary:Jn.optional(),ancestors:s.array(Te)}),rl=s.object({key:s.string().min(1),tag:s.string().min(1),label:s.string().min(1),sourceLocator:yt.optional(),isOpaque:s.boolean(),ancestors:s.array(Te),componentName:s.string().min(1),sourceFile:s.string().min(1),capabilities:Be,provenanceChain:s.object({editMode:ke.shape.editMode,diagnostics:ke.shape.diagnostics}).optional(),textSegments:s.array(s.object({index:ft.shape.index,editable:ft.shape.editable,sourceKind:ei.shape.kind.nullable()})),dynamicData:Qn.optional(),boundaryKind:qe.nullable()}),cl=s.object({key:s.string().min(1),mediaModel:s.record(s.string(),s.unknown()).optional(),styleSource:ni.optional()});var jo=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Oo=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],wo=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],Mo=new Set(jo),Lo=new Set(Oo),Uo=new Set(wo),Fo={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function pl(t){return Mo.has(Et(t))}function Ko(t){return Lo.has(Et(t))}function Go(t){return Uo.has(Et(t))}function dl(t){let{operationSummary:n}=t;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:t.fallbackMode!=="preview"?{...Fo}:{canUpdateText:Go(t.tagName),canInsertChild:Ko(t.tagName),canMove:!1,canRemove:!1}}function Et(t){return t?.trim().toLowerCase()??""}import{z as ii}from"zod";var hl=ii.object({routeId:ii.string().min(1),mutationContext:Ee.optional()}).strict();var Sl={PATCH_VALIDATION_FAILED:"The code didn't pass validation. Try describing the change more specifically.",PATCH_BATCH_FAILED:"The site code couldn't be generated. Please regenerate the site.",PATCH_BATCH_INVALID:"The change couldn't be applied. Try simpler instructions.",VALIDATION_FAILED:"Your message couldn't be sent as written. Please edit it and try again.",WORKSPACE_MESSAGE_CONTAINS_SECRET:"Your message looks like it contains a secret or token, so it wasn't sent. Remove it and try again.",WORKSPACE_TOOL_RESULT_INVALID:"This change couldn't be completed and was rolled back. Please try again.",WORKSPACE_TOOL_FAILED:"A tool step failed. Please try again.",WORKSPACE_TOOL_RESULT_MISSING:"The tool didn't return a usable result. Please try again.",WORKSPACE_MODEL_STREAM_FAILED:"The model stream ended unexpectedly. Please try again.",WORKSPACE_MODEL_STREAM_ABORTED:"Generation was interrupted before finishing. Please try again.",MODEL_OUTPUT_TRUNCATED:"The response was too long and was cut off before any change was applied. Try again, or split the request into smaller changes.",WORKSPACE_EDIT_NOT_APPLIED:"No change was applied. Try describing the change differently.",WORKSPACE_INITIAL_EXECUTION_FAILED:"Initial generation failed. Please retry from the brief.",WORKSPACE_INITIAL_GENERATION_CHECK_FAILED:"Initial generation could not be verified. Please retry.",WORKSPACE_INITIAL_GENERATION_FINALIZE_FAILED:"Initial generation could not finalize. Please retry.",WORKSPACE_INITIAL_GENERATION_QUALITY_GATE_FAILED:"Initial generation failed quality checks. Please regenerate the site.",WORKSPACE_ITERATION_QUALITY_GATE_FAILED:"Quality check failed. The change was rolled back; try a smaller or more specific request.",WORKSPACE_SOCKET_DEAD:"The workspace connection was lost. Please retry.",WORKSPACE_RUN_CANCELLED:"The run was cancelled.",WORKSPACE_RUN_ABANDONED:"This run was interrupted and did not finish. Please try again.",WORKSPACE_RUN_REQUEST_FAILED:"Couldn't start the workspace. Please try again.",WORKSPACE_RUN_BAD_RESPONSE:"The server response was malformed. Please try again.",WORKSPACE_SOCKET_UNAVAILABLE:"Workspace connection unavailable. Please try again.",WORKSPACE_SOCKET_ERROR:"The workspace connection had an error. Please try again.",WORKSPACE_SOCKET_CLOSED:"The workspace connection closed. Please try again.",WORKSPACE_SOCKET_OPEN_TIMEOUT:"Couldn't reach the workspace in time. Please try again.",WORKSPACE_CLIENT_MESSAGE_ID_MISSING:"Something went wrong sending your message. Please try again.",SITE_SNAPSHOT_REQUIRED:"This site has no usable snapshot yet. Complete Step 3 first.",AGENT_TIMEOUT:"That took longer than expected. Try breaking the change into smaller pieces.",SANDBOX_NOT_AVAILABLE:"The preview environment isn't ready. Your edits have still been saved.",PREVIEW_BUILD_FAILED:"Preview is available, but the production build failed. Fix the reported build error before deploying.",PREVIEW_BUILD_NOT_CONFIGURED:"Preview is available, but the production build check is not configured.",PREVIEW_BUILD_SANDBOX_NOT_FOUND:"Preview is available, but the build check could not find the active preview sandbox.",WS_CONNECTION_ERROR:"Connection lost. Reconnecting\u2026",USER_MESSAGE_PERSIST_FAILED:"Your message wasn't saved. Please send it again.",CLARIFICATION_REPLY_STALE:"That question has expired. Please tell me what you'd like to do now.",CLARIFY_MODEL_FAILED:"Clarify couldn't finish generating questions. Please try again.",WORKSPACE_RUN_IN_FLIGHT:"Another session is already running. Please try again in a moment.",SITE_OPERATION_LOCKED:"Another change is already running for this site. Wait for it to finish, then try again.",EDIT_ENGINE_VERSION_INVALID:"Invalid editor version. Refresh the page and try again.",SANDBOX_DEPENDENCY_SYNC_FAILED:"The preview runtime could not be prepared. Please try again.",SANDBOX_PREVIEW_FAILED:"The site preview failed to start. Please try again.",SANDBOX_DEPENDENCY_VERSION_MISMATCH:"The preview runtime could not be verified. Please try again.",SANDBOX_RUNTIME_NOT_READY:"The preview needs to be refreshed before this change can be applied. Refresh the preview and try again.",GENERIC:"Something went wrong. Please try again."},bl={UNDO_OR_ROLLBACK:"I can't roll back from chat. Use the version history at the top right to pick a restore point.",HISTORY_RECALL:"Tell me what you'd like to change now\u2014I'll work from the current page state.",OUT_OF_SCOPE:"That's outside what I can do from chat. Try the corresponding panel on the right."},fl={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},yl={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var si="0.6.7",xl="x-vcp-edit-engine-version",Il="x-vcp-edit-engine-version-source",xt=class extends Error{constructor(n="Invalid edit-engine version."){super(n),this.code="EDIT_ENGINE_VERSION_INVALID",this.name="EditEngineVersionParseError"}},qo=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/;function Bo(t){return qo.test(t)}function zo(t){if(typeof t!="string"||!Bo(t))throw new xt;return t}function Rl(t){return t==null?{version:si,source:"fallback_current"}:{version:zo(t),source:"explicit"}}function Tl(){return{version:si,source:"system_current"}}import{z as v}from"zod";var Wo=v.enum(["active","paused","blocked"]),ai=v.enum(["typecheck_failed","health_failed","validation_failed"]),Vo={status:Wo,attempts:v.number().int().nonnegative(),attempted_template_version:V.nullable(),last_error_code:ai.nullable()},pe=v.object(Vo).strict(),Ve=v.object({template_id:v.string().trim().min(1),target_template_version:V}).strict(),Cl=Ve,Ho=v.discriminatedUnion("action",[v.object({action:v.literal("proceed"),state:pe.extend({status:v.literal("active")})}).strict(),v.object({action:v.literal("skip_not_newer"),state:pe.extend({status:v.literal("active")})}).strict(),v.object({action:v.literal("skip_paused"),state:pe.extend({status:v.literal("paused")})}).strict(),v.object({action:v.literal("skip_blocked"),state:pe.extend({status:v.literal("blocked")})}).strict()]),Dl=Ve,vl=Ho,Nl=Ve.extend({error_code:ai}),jl=v.object({state:pe}).strict(),Ol=Ve,wl=v.object({state:pe}).strict();import{z as f}from"zod";var $o=744*60*60*1e3,Yo=f.enum(["eligible","fast_path","upgraded","skipped","lock_skipped","cas_aborted","validation_failed","blocked","paused"]),Zo=f.enum(["typecheck","build","health","validation"]),Xo=f.enum(["not_attempted","promoted","aborted"]),Fl=f.object({template_id:f.string().trim().min(1).max(128),from_version:V.nullable(),to_version:V,outcome:Yo,attempt:f.number().int().nonnegative().max(2147483647),duration_ms:f.number().int().nonnegative().max(2147483647),replaced_group_count:f.number().int().nonnegative().max(2147483647),skipped_group_count:f.number().int().nonnegative().max(2147483647),validation_stage:Zo.nullable(),cas_outcome:Xo.nullable()}).strict(),Kl=f.object({recorded:f.literal(!0)}).strict(),oi=f.object({from:f.iso.datetime(),to:f.iso.datetime()}).strict().refine(({from:t,to:n})=>Date.parse(t)<Date.parse(n),{message:"from must be earlier than to",path:["to"]}).refine(({from:t,to:n})=>Date.parse(n)-Date.parse(t)<=$o,{message:"report window must not exceed 31 days",path:["to"]}),Gl=oi,Qo=f.object({eligible:f.number().int().nonnegative(),fast_path:f.number().int().nonnegative(),upgraded:f.number().int().nonnegative(),skipped:f.number().int().nonnegative(),lock_skipped:f.number().int().nonnegative(),cas_aborted:f.number().int().nonnegative(),validation_failed:f.number().int().nonnegative(),blocked:f.number().int().nonnegative(),paused:f.number().int().nonnegative()}).strict(),ql=f.object({window:oi,outcome_counts:Qo,current_state_counts:f.object({blocked:f.number().int().nonnegative(),paused:f.number().int().nonnegative()}).strict(),duration_ms:f.object({p50:f.number().int().nonnegative().nullable(),p95:f.number().int().nonnegative().nullable(),sample_count:f.number().int().nonnegative()}).strict()}).strict(),Bl=f.object({older_than:f.iso.datetime(),limit:f.coerce.number().int().min(1).max(200).default(50),include_candidates:f.enum(["true","false"]).default("false").transform(t=>t==="true")}).strict(),Jo=f.object({site_id:f.string().min(1),snapshot_id:f.string().min(1),status:f.enum(["candidate","deleting"]),created_at:f.iso.datetime()}).strict(),zl=f.object({snapshots:f.array(Jo)}).strict();import{z as R}from"zod";var er=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],ri=R.object({name:R.string().min(1).max(100),type:R.enum(er),label:R.string().min(1).max(255),required:R.boolean().optional(),options:R.array(R.string()).optional()}),Hl=R.object({name:R.string(),cms_type:R.string(),label:R.string().optional(),required:R.boolean().optional(),value_shape:R.string().optional(),front_display:R.enum(["visible","internal","forbidden"]).optional(),choices:R.array(R.object({value:R.union([R.string(),R.number()]),label:R.string()})).optional()}),$l=R.object({route_file_path:R.string().min(1),target_component_path:R.string().min(1),content_type_hint:R.string().min(1),required_fields:R.array(ri).optional(),mode:R.enum(["bind_existing","provision"]),list_mode:R.enum(["page","embedded"]).optional(),fields:R.array(ri).optional(),seed_records:R.array(R.record(R.string(),R.unknown())).optional()});import{z as j}from"zod";var Pe=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number"],tr=j.object({name:j.string().min(1).max(100),type:j.enum(Pe),label:j.string().min(1).max(255),required:j.boolean().optional(),options:j.array(j.string()).optional()}),nr=j.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),Xl=j.object({mode:j.enum(["bind_existing","provision"],{error:'mode is required. Use {"mode":"bind_existing","form_hint":"<exact form code or name>"} or {"mode":"provision","name":"<confirmed form name>","component_slug":"<ascii-kebab>","fields":[...]}. Never call connect_form with {}.'}),form_hint:j.string().min(1).optional(),name:j.string().min(1).max(255).optional(),component_slug:nr,description:j.string().min(1).max(1e3).optional(),fields:j.array(tr).optional()}).superRefine((t,n)=>{t.mode==="bind_existing"&&!t.form_hint?.trim()&&n.addIssue({code:"custom",path:["form_hint"],message:"form_hint is required for bind_existing"}),t.mode==="provision"&&!t.name?.trim()&&n.addIssue({code:"custom",path:["name"],message:"name is required for provision"})}),Ql=j.object({name:j.string(),label:j.string(),cms_type:j.string(),required:j.boolean()});import{z as a}from"zod";var Ae=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,le=/^[A-Za-z][A-Za-z0-9_-]{0,127}$/,He=/^[A-Za-z][A-Za-z0-9_]{0,99}$/,pi=/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/,di=/^[a-z][a-z0-9-]{0,99}$/,li=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,ci=2,$e=a.string().regex(Ae),ir=a.string().regex(Ae),Rt=a.string().regex(Ae),Ce=a.string().regex(He),Tt=a.string().regex(pi),sr=a.discriminatedUnion("status",[a.object({status:a.literal("unbound"),form_code:a.null()}).strict(),a.object({status:a.literal("bound"),form_code:a.string().regex(le)}).strict(),a.object({status:a.literal("missing"),form_code:a.string().regex(le)}).strict()]),ar=a.object({value:Tt,label:a.string().trim().min(1).max(255)}).strict(),or=a.object({kind:a.literal("field"),field_name:Ce,type:a.enum(Pe),label:a.string().trim().min(1).max(255),required:a.boolean(),span:a.enum(["full","half"]),options:a.array(ar).max(100)}).strict(),rr=a.object({kind:a.literal("step-break"),step_id:a.string().regex(Ae)}).strict(),cr=a.discriminatedUnion("kind",[or,rr]),mr=a.object({field_name:Ce,type:a.enum(Pe),last_label:a.string().max(255)}).strict(),pr=a.object({field_name:Ce,value:Tt,last_label:a.string().max(255)}).strict(),dr=a.discriminatedUnion("kind",[a.object({kind:a.literal("custom")}).strict(),a.object({kind:a.literal("template"),slug:a.string().regex(di),version:a.string().regex(li)}).strict()]),ui=new Set(["select","radio","multiselect"]);function Z(t){return t.toLowerCase()}function de(t,n){return`${Z(t)}\0${n}`}function L(t,n,i,o){let r=new Set;for(let m of t){if(r.has(m)){o.addIssue({code:"custom",path:n,message:i});return}r.add(m)}}function kt(t,n,i,o){t&&n===0?o.addIssue({code:"custom",path:i,message:"choice fields require at least one option"}):!t&&n>0&&o.addIssue({code:"custom",path:i,message:"non-choice fields must use an empty options array"})}var Pt=a.object({schema_version:a.literal(1),min_runtime_version:a.number().int().positive(),form_definition_id:$e,binding:sr,content_locale:W,features:a.object({multistep:a.boolean()}).strict(),copy:a.object({title:a.string().max(255),description:a.string().max(1e3),submit_button:a.string().trim().min(1).max(100),success_message:a.string().trim().min(1).max(500),error_message:a.string().trim().min(1).max(500)}).strict(),layout:a.object({columns:a.enum(["one","two"])}).strict(),nodes:a.array(cr).min(1).max(200),source:dr,retired:a.object({fields:a.array(mr).max(1e3),options:a.array(pr).max(5e3)}).strict(),compatibility:a.object({standardization_version:a.number().int().positive(),diagnostics:a.array(a.string().trim().min(1).max(500)).max(100)}).strict()}).strict().superRefine((t,n)=>{let i=t.nodes.filter(l=>l.kind==="field");i.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"at least one field node is required"});let o=t.nodes.filter(l=>l.kind==="step-break");!t.features.multistep&&o.length>0&&n.addIssue({code:"custom",path:["nodes"],message:"step-break requires the multistep feature"}),t.features.multistep&&(t.min_runtime_version<ci&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`multistep requires runtime version ${ci}`}),o.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"multistep requires at least one step-break"}));for(let[l,c]of t.nodes.entries())c.kind==="step-break"&&(l===0||l===t.nodes.length-1||t.nodes[l-1]?.kind==="step-break"||t.nodes[l+1]?.kind==="step-break")&&n.addIssue({code:"custom",path:["nodes",l],message:"step-break must separate two non-empty steps"});L(o.map(l=>l.step_id),["nodes"],"step_id must be unique",n),L(i.map(l=>Z(l.field_name)),["nodes"],"field_name must be unique",n),L(t.retired.fields.map(l=>Z(l.field_name)),["retired","fields"],"retired field_name must be unique",n);let r=new Set(t.retired.fields.map(l=>Z(l.field_name)));for(let[l,c]of i.entries())r.has(Z(c.field_name))&&n.addIssue({code:"custom",path:["nodes",l,"field_name"],message:"retired field_name cannot be reused"}),kt(ui.has(c.type),c.options.length,["nodes",l,"options"],n),L(c.options.map(u=>u.value),["nodes",l,"options"],"option value must be unique within a field",n),L(c.options.map(u=>u.label),["nodes",l,"options"],"option label must be unique within a field",n);L(t.retired.options.map(l=>de(l.field_name,l.value)),["retired","options"],"retired option identity must be unique",n);let m=new Set(t.retired.options.map(l=>de(l.field_name,l.value)));for(let[l,c]of i.entries())for(let[u,E]of c.options.entries())m.has(de(c.field_name,E.value))&&n.addIssue({code:"custom",path:["nodes",l,"options",u,"value"],message:"retired option value cannot be reused"})});function su(t,n){let i=[],o=t.nodes.filter(c=>c.kind==="field"),r=new Map(n.nodes.filter(c=>c.kind==="field").map(c=>[Z(c.field_name),c])),m=new Map(n.retired.fields.map(c=>[Z(c.field_name),c])),l=new Map(n.retired.options.map(c=>[de(c.field_name,c.value),c]));for(let c of o){let u=Z(c.field_name),E=r.get(u),h=m.get(u);E&&E.field_name!==c.field_name&&i.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),E&&E.type!==c.type&&i.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),!E&&h&&h.field_name!==c.field_name&&i.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),!E&&h&&h.type!==c.type&&i.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),!E&&!m.has(u)&&i.push({code:"FIELD_RETIREMENT_MISSING",field_name:c.field_name});let b=new Set(E?.options.map(D=>D.value)??[]);for(let D of c.options){let N=l.get(de(c.field_name,D.value));!b.has(D.value)&&N&&N.field_name!==c.field_name&&i.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),!b.has(D.value)&&!N&&i.push({code:"OPTION_RETIREMENT_MISSING",field_name:c.field_name,value:D.value})}}for(let c of t.retired.fields){let u=m.get(Z(c.field_name));u&&u.field_name!==c.field_name&&i.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),u&&u.type!==c.type&&i.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),u||i.push({code:"FIELD_RETIREMENT_MISSING",field_name:c.field_name})}for(let c of t.retired.options){let u=l.get(de(c.field_name,c.value));u&&u.field_name!==c.field_name&&i.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),u||i.push({code:"OPTION_RETIREMENT_MISSING",field_name:c.field_name,value:c.value})}return i}var lr=a.enum(Se),te=a.object({english:a.string().max(1e3),translations:a.partialRecord(lr,a.string().max(1e3)).optional()}).strict(),ur=a.object({template_option_key:a.string().regex(pi),label:te}).strict(),gr=a.object({template_field_key:a.string().regex(He),type:a.enum(Pe),label:te,required:a.boolean(),span:a.enum(["full","half"]),options:a.array(ur).max(100)}).strict(),hr=a.object({template_step_key:a.string().regex(He),after_field_key:a.string().regex(He)}).strict(),gi=["lead-generation","trial-and-samples","quote-and-commerce","appointments-and-visits","resources-and-subscriptions","service-and-channel"],_r=[1,1,1,1,1,1],hi=a.enum(gi),Sr=a.object({schema_version:a.literal(1),slug:hi,name:te,template_count:a.number().int().min(0).max(1)}).strict().superRefine((t,n)=>{t.name.english.trim()===""&&n.addIssue({code:"custom",path:["name","english"],message:"English category name is required"})}),br=a.object({schema_version:a.literal(1),slug:a.string().regex(di),version:a.string().regex(li),category:hi,copy:a.object({title:te,description:te,submit_button:te,success_message:te,error_message:te}).strict(),layout:a.object({columns:a.enum(["one","two"])}).strict(),fields:a.array(gr).min(1).max(200),step_breaks:a.array(hr).max(20).optional()}).strict().superRefine((t,n)=>{for(let m of["title","description","submit_button","success_message","error_message"])t.copy[m].english.trim()===""&&n.addIssue({code:"custom",path:["copy",m,"english"],message:"English baseline text is required"});L(t.fields.map(m=>m.template_field_key),["fields"],"template_field_key must be unique",n);let i=new Map(t.fields.map((m,l)=>[m.template_field_key,l])),o=t.step_breaks??[];L(o.map(m=>m.template_step_key),["step_breaks"],"template_step_key must be unique",n),L(o.map(m=>m.after_field_key),["step_breaks"],"step breaks must not share an anchor field",n);let r=-1;for(let[m,l]of o.entries()){let c=i.get(l.after_field_key);c===void 0||c>=t.fields.length-1?n.addIssue({code:"custom",path:["step_breaks",m,"after_field_key"],message:"step break must follow an existing non-final field"}):c<=r&&n.addIssue({code:"custom",path:["step_breaks",m,"after_field_key"],message:"step breaks must follow field order"}),r=c??r}t.fields.length+o.length>200&&n.addIssue({code:"custom",path:["step_breaks"],message:"template fields and step breaks must not exceed 200 nodes"});for(let[m,l]of t.fields.entries()){l.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",m,"label","english"],message:"English field label is required"}),kt(ui.has(l.type),l.options.length,["fields",m,"options"],n),L(l.options.map(c=>c.template_option_key),["fields",m,"options"],"template_option_key must be unique within a field",n),L(l.options.map(c=>c.label.english.trim().toLowerCase()),["fields",m,"options"],"English option labels must be unique within a field",n);for(let[c,u]of l.options.entries())u.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",m,"options",c,"label","english"],message:"English option label is required"})}}),au=a.object({schema_version:a.literal(1),visibility:a.enum(["internal","public"]),categories:a.array(Sr).length(6),templates:a.array(br).length(6)}).strict().superRefine((t,n)=>{let i=(o,r)=>{let m=Se.filter(l=>!o.translations?.[l]?.trim());m.length>0&&n.addIssue({code:"custom",path:[...r,"translations"],message:`public template copy is missing locales: ${m.join(", ")}`})};L(t.categories.map(o=>o.slug),["categories"],"template category slug must be unique",n);for(let[o,r]of gi.entries()){let m=t.categories[o];m?.slug!==r&&n.addIssue({code:"custom",path:["categories",o,"slug"],message:`template category order must contain ${r}`});let l=t.templates.filter(u=>u.category===r).length,c=_r[o];l!==c&&n.addIssue({code:"custom",path:["templates"],message:`${r} must contain exactly ${c} templates`}),m?.template_count!==l&&n.addIssue({code:"custom",path:["categories",o,"template_count"],message:"template_count must match catalog templates"})}if(L(t.templates.map(o=>o.slug),["templates"],"template slug must be unique",n),t.visibility==="public"){for(let[o,r]of t.categories.entries())i(r.name,["categories",o,"name"]);for(let[o,r]of t.templates.entries()){for(let[m,l]of Object.entries(r.copy))i(l,["templates",o,"copy",m]);for(let[m,l]of r.fields.entries()){i(l.label,["templates",o,"fields",m,"label"]);for(let[c,u]of l.options.entries())i(u.label,["templates",o,"fields",m,"options",c,"label"])}}}});function ou(t,n){let i=on(n),o=i?t.translations?.[i]:void 0;return o!==void 0&&o.trim()!==""?o:t.english}var fr=["Text","Summary","Email","Phone","DropdownSelection","RadioButton","Checkbox","Boolean","Date","Num"],yr={text:"Text",textarea:"Summary",email:"Email",phone:"Phone",select:"DropdownSelection",radio:"RadioButton",multiselect:"Checkbox",boolean:"Boolean",date:"Date",number:"Num"},Er=a.object({value:Tt,label:a.string().trim().min(1).max(255)}).strict(),xr=a.object({field_name:Ce,field_type:a.enum(fr),field_label:a.string().trim().min(1).max(255),is_required:a.boolean(),sort_order:a.number().int().nonnegative(),options:a.array(Er).max(100)}).strict(),Ir=new Set(["DropdownSelection","RadioButton","Checkbox"]),_i=a.object({version:a.literal(1),locale:W,fields:a.array(xr).min(1).max(200)}).strict().superRefine((t,n)=>{L(t.fields.map(i=>Z(i.field_name)),["fields"],"field_name must be unique",n);for(let[i,o]of t.fields.entries())kt(Ir.has(o.field_type),o.options.length,["fields",i,"options"],n),L(o.options.map(r=>r.value),["fields",i,"options"],"option value must be unique within a field",n)});function ru(t){let n=t.nodes.filter(i=>i.kind==="field").map((i,o)=>({field_name:i.field_name,field_type:yr[i.type],field_label:i.label,is_required:i.required,sort_order:o,options:i.options.map(r=>({...r}))}));return _i.parse({version:1,locale:t.content_locale,fields:n})}var C=a.string().regex(/^sha256:[0-9a-f]{64}$/),Rr=a.object({path:K,content_hash:C.nullable()}).strict(),Tr=a.array(Rr).min(1).max(500).superRefine((t,n)=>{L(t.map(i=>i.path),[],"affected file paths must be unique",n)}),At=a.object({grade:a.enum(["standard","A","B","C"]),required:a.boolean(),pending_confirmations:a.array(a.object({item_id:a.string().regex(Ae),field_name:Ce.optional(),kind:a.enum(["form_copy","layout","field_label","field_type","field_required","field_options"]),message:a.string().trim().min(1).max(500)}).strict().superRefine((t,n)=>{t.kind.startsWith("field_")&&!t.field_name&&n.addIssue({code:"custom",path:["field_name"],message:"field confirmation items require field_name"})})).max(200)}).strict().superRefine((t,n)=>{let i=t.grade==="standard";i===t.required&&n.addIssue({code:"custom",path:["required"],message:i?"standard forms do not require standardization confirmation":"legacy forms require standardization confirmation"}),t.grade==="C"&&t.pending_confirmations.length===0&&n.addIssue({code:"custom",path:["pending_confirmations"],message:"grade C requires at least one pending confirmation"}),t.grade!=="C"&&t.pending_confirmations.length>0&&n.addIssue({code:"custom",path:["pending_confirmations"],message:"only grade C can contain pending confirmations"})}),kr=a.object({site_id:a.string().min(1),form_definition_id:$e,base_snapshot_id:a.string().min(1).max(128),expected_form_spec_hash:C,expected_cms_schema_hash:C.nullable(),draft_form_spec_hash:C,desired_cms_schema_hash:C,affected_files_hash:C,shared_reference_hash:C,shared_reference_count:a.number().int().positive(),confirm_shared_update:a.boolean(),recreate_missing_binding:a.boolean(),standardization:At,confirm_standardization:a.boolean()}).strict(),Si=a.object({reference_hash:C,page_count:a.number().int().positive(),block_count:a.number().int().positive()}).strict().refine(t=>t.page_count<=t.block_count,{message:"page_count cannot exceed block_count"}),cu=a.object({site_id:a.string().min(1),form_block_id:ir,base_snapshot_id:a.string().min(1).max(128),form_spec:Pt,runtime_upgrade_required:a.boolean(),expected_form_spec_hash:C,expected_cms_schema_hash:C.nullable(),affected_files_hash:C,shared_impact:Si,standardization:At}).strict(),Pr=a.object({operation_id:Rt,operation_fingerprint:C,site_id:a.string().min(1),form_definition_id:$e,base_snapshot_id:a.string().min(1).max(128),expected_form_spec_hash:C,expected_cms_schema_hash:C.nullable(),draft_form_spec:Pt,draft_form_spec_hash:C,desired_cms_schema_hash:C,affected_files_hash:C,shared_impact:Si,confirm_shared_update:a.boolean(),recreate_missing_binding:a.boolean(),standardization:At,confirm_standardization:a.boolean()}).strict().superRefine((t,n)=>{t.form_definition_id!==t.draft_form_spec.form_definition_id&&n.addIssue({code:"custom",path:["form_definition_id"],message:"form_definition_id must match draft_form_spec"}),t.shared_impact.block_count>1&&!t.confirm_shared_update&&n.addIssue({code:"custom",path:["confirm_shared_update"],message:"shared definition updates require explicit confirmation"});let i=t.draft_form_spec.binding.status==="missing";i!==t.recreate_missing_binding&&n.addIssue({code:"custom",path:["recreate_missing_binding"],message:i?"missing bindings require explicit recreation confirmation":"only missing bindings can be recreated"});let o=t.draft_form_spec.binding.status==="bound",r=o&&t.standardization.required&&(t.standardization.grade==="B"||t.standardization.grade==="C");(o&&!r&&t.expected_cms_schema_hash===null||!o&&t.expected_cms_schema_hash!==null)&&n.addIssue({code:"custom",path:["expected_cms_schema_hash"],message:o?"bound standard forms require the current CMS schema hash":"unbound or missing forms cannot claim a current CMS schema hash"}),t.confirm_standardization!==t.standardization.required&&n.addIssue({code:"custom",path:["confirm_standardization"],message:t.standardization.required?"legacy standardization requires explicit confirmation":"standard forms cannot claim legacy standardization confirmation"})}),Ar=["created","validated","binding_reserved","candidate_ready","cms_applied","snapshot_promoted","committed","compensating","recovery_required","failed"],Ct=a.enum(Ar),Cr=["pending","running","succeeded","failed","recovery_required"],bi=a.enum(Cr),Dr=["candidate_abandon","snapshot_reconcile","cms_restore"],fi=a.enum(Dr),vr=["FORM_DESIGN_INVALID","FORM_DESIGN_UNSUPPORTED","FORM_DESIGN_STANDARDIZATION_AGENT_REQUIRED","FORM_DESIGN_STANDARDIZATION_UNSUPPORTED","FORM_DESIGN_FEATURE_NOT_ENABLED","FORM_DESIGN_PERMISSION_DENIED","FORM_DESIGN_LOCKED","FORM_DESIGN_CODE_CONFLICT","FORM_DESIGN_CMS_CONFLICT","FORM_DESIGN_CMS_SCHEMA_MISMATCH","FORM_DESIGN_CMS_NOT_FOUND","FORM_DESIGN_BINDING_MISSING","FORM_DESIGN_OPERATION_CONFLICT","FORM_DESIGN_CMS_UNAVAILABLE","FORM_DESIGN_PATCH_FAILED","FORM_DESIGN_COMPENSATION_FAILED","FORM_DESIGN_RECOVERY_REQUIRED"],Dt=a.enum(vr),yi=a.enum(["wait","resume","retry_new_operation","manual_recovery","none"]),Ei=a.enum(["not_started","pending","succeeded","failed"]),xi=a.object({operation_id:Rt,operation_fingerprint:C,site_id:a.string().min(1),form_definition_id:$e,stage:Ct,status:bi,base_snapshot_id:a.string().min(1).max(128),candidate_snapshot_id:a.string().min(1).max(128).nullable(),before_form_code:a.string().regex(le).nullable(),materialized_form_code:a.string().regex(le).nullable(),expected_form_spec_hash:C,draft_form_spec_hash:C,materialized_form_spec_hash:C.nullable(),expected_cms_schema_hash:C.nullable(),desired_cms_schema_hash:C,retry_count:a.number().int().nonnegative(),failure_stage:fi.nullable(),last_error_code:Dt.nullable(),retryable:a.boolean(),next_action:yi,preview_refresh_status:Ei,created_at:a.string().datetime({offset:!0}),updated_at:a.string().datetime({offset:!0})}).strict().superRefine((t,n)=>{if(!(t.stage!=="committed"&&t.status!=="succeeded")){(t.stage!=="committed"||t.status!=="succeeded")&&n.addIssue({code:"custom",path:["status"],message:"committed stage and succeeded status must be reported together"});for(let i of["candidate_snapshot_id","materialized_form_code","materialized_form_spec_hash"])t[i]===null&&n.addIssue({code:"custom",path:[i],message:`${i} is required for a committed success`});(t.failure_stage!==null||t.last_error_code!==null||t.retryable||t.next_action!=="none")&&n.addIssue({code:"custom",path:["next_action"],message:"a committed success cannot retain an error or retry action"})}}),vt=a.object({operation:xi}).strict(),mu=vt,pu=vt,du=a.object({operation_fingerprint:C}).strict(),lu=vt,Nr=a.preprocess(t=>!t||typeof t!="object"||Array.isArray(t)||"standardization"in t||"confirm_standardization"in t?t:{...t,standardization:{grade:"standard",required:!1,pending_confirmations:[]},confirm_standardization:!1},Pr),uu=a.object({operation:xi,request:Nr,cms_replace_result:a.unknown().nullable()}).strict(),jr=a.object({stage:Ct.optional(),status:bi.optional(),candidate_snapshot_id:a.string().min(1).max(128).nullable().optional(),before_form_code:a.string().regex(le).nullable().optional(),materialized_form_code:a.string().regex(le).nullable().optional(),materialized_form_spec_hash:C.nullable().optional(),retry_count:a.number().int().nonnegative().optional(),failure_stage:fi.nullable().optional(),last_error_code:Dt.nullable().optional(),retryable:a.boolean().optional(),next_action:yi.optional(),preview_refresh_status:Ei.optional()}).strict(),gu=a.object({expected_updated_at:a.string().datetime({offset:!0}),operation:jr,cms_replace_result:a.unknown().nullable().optional()}).strict().refine(t=>Object.keys(t.operation).length>0||Object.hasOwn(t,"cms_replace_result"),{message:"transition must change operation state or CMS result"}),hu=a.object({code:Dt,message:a.string().trim().min(1).max(500),retryable:a.boolean(),operation_id:Rt.optional(),stage:Ct.optional()}).strict();function Or(t){return kr.parse({site_id:t.site_id,form_definition_id:t.form_definition_id,base_snapshot_id:t.base_snapshot_id,expected_form_spec_hash:t.expected_form_spec_hash,expected_cms_schema_hash:t.expected_cms_schema_hash,draft_form_spec_hash:t.draft_form_spec_hash,desired_cms_schema_hash:t.desired_cms_schema_hash,affected_files_hash:t.affected_files_hash,shared_reference_hash:t.shared_impact.reference_hash,shared_reference_count:t.shared_impact.block_count,confirm_shared_update:t.confirm_shared_update,recreate_missing_binding:t.recreate_missing_binding,standardization:t.standardization,confirm_standardization:t.confirm_standardization})}function mi(t){for(let n=0;n<t.length;n+=1){let i=t.charCodeAt(n);if(i>=55296&&i<=56319){let o=t.charCodeAt(n+1);if(n+1>=t.length||o<56320||o>57343)throw new TypeError("canonical JSON cannot contain a lone surrogate");n+=1}else if(i>=56320&&i<=57343)throw new TypeError("canonical JSON cannot contain a lone surrogate")}}function It(t,n){if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="number"){if(!Number.isFinite(t))throw new TypeError("canonical JSON numbers must be finite");return JSON.stringify(t)}if(typeof t=="string")return mi(t),JSON.stringify(t);if(typeof t!="object")throw new TypeError("value is not valid JSON");if(n.has(t))throw new TypeError("canonical JSON cannot contain cycles");n.add(t);try{if(Array.isArray(t)){let m=[];for(let l=0;l<t.length;l+=1){if(!(l in t))throw new TypeError("canonical JSON cannot contain sparse arrays");m.push(It(t[l],n))}return`[${m.join(",")}]`}let i=Object.getPrototypeOf(t);if(i!==Object.prototype&&i!==null)throw new TypeError("canonical JSON objects must be plain records");let o=t;return`{${Object.keys(o).sort().map(m=>(mi(m),`${JSON.stringify(m)}:${It(o[m],n)}`)).join(",")}}`}finally{n.delete(t)}}function wr(t){return It(t,new Set)}async function Ye(t){let n=wr(t),i=await globalThis.crypto.subtle.digest("SHA-256",new TextEncoder().encode(n));return`sha256:${Array.from(new Uint8Array(i),r=>r.toString(16).padStart(2,"0")).join("")}`}async function _u(t){return Ye(Pt.parse(t))}async function Su(t){return Ye(_i.parse(t))}async function bu(t){let n=Tr.parse(t).map(i=>({...i})).sort((i,o)=>i.path<o.path?-1:i.path>o.path?1:0);return Ye({version:1,files:n})}async function fu(t){return Ye(Or(t))}import{z as H}from"zod";var Mr=["provisioning","cms_app_created","seeded","ready","failed"],xu=H.object({tenant_id:H.string().min(1),site_id:H.string().min(1),collection_slug:H.string().min(1),cms_collection_id:H.string().min(1).nullable(),status:H.enum(Mr),owned_by_vcp:H.boolean(),run_id:H.string().min(1).nullable(),last_error:H.string().nullable(),created_at:H.string().datetime(),updated_at:H.string().datetime()});var Ii="/vibe/v1";function Ru(t){let n=t?.trim().replace(/\/+$/,"");if(!n)return null;try{let i=new URL(n),o=i.pathname.replace(/\/+$/,"");return i.search="",i.hash="",i.pathname=o.endsWith(Ii)?o:Ii,i.href.replace(/\/+$/,"")}catch{return n}}import{z as w}from"zod";var Lr=w.object({maxSites:w.number().int().nullable().optional(),maxStorageMb:w.number().int().nullable().optional(),customDomains:w.boolean().nullable().optional()}).passthrough().superRefine((t,n)=>{for(let i of Object.keys(t))i.includes("_")&&n.addIssue({code:"custom",path:[i],message:"Public plan feature fields must use camelCase."})}),Ur=w.object({subscriptionId:w.string().min(1),planId:w.string().min(1),locale:w.enum(["en","zh_CN"]).or(w.string().min(1)),currentPeriodEnd:w.string().nullable(),servicePeriodEnd:w.string().nullable(),featureSnapshot:Lr.nullable(),code:w.string().nullable(),level:w.number().int().nullable(),name:w.string().nullable()}).strict(),Fr=w.object({hasActiveSubscription:w.boolean()}).strict(),Ri=w.object({plan:Ur.nullable(),entitlement:Fr}).strict();import{z as x}from"zod";var Kr=["pending_dns","active"],Cu="CUSTOM_DOMAIN_ENTITLEMENT_REQUIRED",Gr=x.enum(Kr),qr=x.enum(["ownershipVerification","certificateValidation","traffic","unknown"]),Br=x.enum(["pending","matched"]),zr=x.object({id:x.string().min(1),type:x.string().min(1),name:x.string().min(1),value:x.string().min(1),purpose:qr,required:x.boolean(),status:Br.optional()}).strict(),De=x.object({id:x.string().min(1),domainId:x.string().min(1).optional(),hostname:x.string().min(1),displayHostname:x.string().min(1),asciiHostname:x.string().min(1),status:Gr,isPrimary:x.boolean(),deletable:x.boolean(),dnsRecords:x.array(zr),createdAt:x.string().datetime().nullable(),checkedAt:x.string().datetime().nullable()}).strict(),Wr=x.object({hostname:x.string().min(1),url:x.string().url(),status:x.literal("ready")}).strict(),Ti=x.object({defaultDomain:Wr,currentDomain:De.nullable(),customDomains:x.array(De)}).strict(),Du=x.object({hostname:x.string().min(1),isPrimary:x.boolean().optional()}).strict(),ki=x.object({domain:De}).strict(),Pi=x.object({domain:De}).strict(),Ai=x.object({domain:De}).strict(),Ci=x.object({deleted:x.boolean()}).strict();var ve={Inter:{import:"Inter"},"Inter Tight":{import:"Inter_Tight"},"DM Sans":{import:"DM_Sans"},"Source Sans 3":{import:"Source_Sans_3"},"Libre Franklin":{import:"Libre_Franklin"},Montserrat:{import:"Montserrat"},Archivo:{import:"Archivo"},"Space Grotesk":{import:"Space_Grotesk"},Manrope:{import:"Manrope"},"IBM Plex Sans":{import:"IBM_Plex_Sans"},Oswald:{import:"Oswald"},"Roboto Condensed":{import:"Roboto_Condensed"},"Bebas Neue":{import:"Bebas_Neue",weights:["400"]},"Playfair Display":{import:"Playfair_Display"},Lora:{import:"Lora"},Fraunces:{import:"Fraunces"},"Cormorant Garamond":{import:"Cormorant_Garamond"},"JetBrains Mono":{import:"JetBrains_Mono"},"IBM Plex Mono":{import:"IBM_Plex_Mono"},"Noto Sans SC":{import:"Noto_Sans_SC",download:!1},"Noto Serif SC":{import:"Noto_Serif_SC",download:!1}},Vr={heading:"Inter",body:"Inter"},Di=ve.Inter;function Ze(t){return t.trim().replace(/\s+/g,"_").toLowerCase()}var Oi=(()=>{let t=new Map;for(let[n,i]of Object.entries(ve))t.set(Ze(n),i),t.set(Ze(i.import),i);return t})();function Hr(t){return typeof t!="string"||t.trim().length===0?Di:Oi.get(Ze(t))??Di}var $r=(()=>{let t=new Map;for(let[n,i]of Object.entries(ve))t.set(i.import,n);return t})();function Yr(t){if(typeof t!="string"||t.trim().length===0)return"Inter";let n=Oi.get(Ze(t));return n?$r.get(n.import)??"Inter":"Inter"}var Zr=Object.keys(ve),vi='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',Ni='Georgia, "Times New Roman", serif',ji='"SFMono-Regular", Consolas, monospace',Xr=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),Qr=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(t=>t.toLowerCase())),Jr=new Set(["JetBrains Mono","IBM Plex Mono"].map(t=>t.toLowerCase()));function ec(t){let n=t.toLowerCase();return Jr.has(n)||n.includes("mono")?"mono":Qr.has(n)||n.includes("serif")?"serif":"sans"}function Nt(t,n){let i=u=>(u??"").trim().replace(/^['"]|['"]$/g,"").replace(/[^A-Za-z0-9 _-]+/g,"").trim().slice(0,60),o=i(t),r=i(n),m=u=>Xr.has(u.toLowerCase());if(o&&m(o)){let u=o.toLowerCase();return u.includes("mono")?ji:u.includes("serif")?Ni:vi}let l=o;l||(l=m(r)?"":r),l||(l="Inter");let c=ec(l);return c==="mono"?`"${l}", ${ji}`:c==="serif"?`"${l}", ${Ni}`:`"${l}", ${vi}`}function tc(t){return{"--site-font-sans":Nt(t?.body,"Inter"),"--site-font-heading":Nt(t?.heading,t?.body??"Inter")}}var nc=[{id:"archivo-inter",heading:"Archivo",body:"Inter"},{id:"playfair-source-sans",heading:"Playfair Display",body:"Source Sans 3"},{id:"space-grotesk-manrope",heading:"Space Grotesk",body:"Manrope"},{id:"fraunces-libre-franklin",heading:"Fraunces",body:"Libre Franklin"},{id:"noto-serif-sc-noto-sans-sc",heading:"Noto Serif SC",body:"Noto Sans SC"},{id:"noto-sans-sc",heading:"Noto Sans SC",body:"Noto Sans SC"}];var ic=[{id:"ocean",colorSeeds:{primary:"#1e3a5f",accent:"#2563eb"}},{id:"forest",colorSeeds:{primary:"#14532d",accent:"#16a34a"}},{id:"clay",colorSeeds:{primary:"#7c2d12",accent:"#ea580c"}},{id:"violet",colorSeeds:{primary:"#3b0764",accent:"#7c3aed"}},{id:"graphite",colorSeeds:{primary:"#1f2937",accent:"#0d9488"}},{id:"crimson",colorSeeds:{primary:"#7f1d1d",accent:"#dc2626"}}];import{z as $}from"zod";var sc=$.object({colorSeeds:$.object({primary:$.string().min(1).max(40),accent:$.string().min(1).max(40)}).strict().optional(),fonts:$.object({heading:$.string().min(1).max(60),body:$.string().min(1).max(60)}).strict().optional()}).strict().refine(t=>t.colorSeeds!==void 0||t.fonts!==void 0,{message:"colorSeeds or fonts is required"}),ac=$.object({ok:$.literal(!0),design_plan_version:$.number().int().positive(),snapshot_id:$.string().min(1)});var wt=e.object({heading:e.string().min(1).max(160).optional(),body:e.string().min(1).max(160).optional(),paletteIntent:e.string().min(1).max(400).optional(),surfaceMode:e.enum(["light","dark"]).optional(),radius:e.enum(["none","sm","md","lg","xl"]).optional(),density:e.enum(["compact","comfortable","editorial"]).optional(),colorSeeds:e.object({primary:e.string().min(1).max(40),accent:e.string().min(1).max(40),neutral:e.string().min(1).max(40).optional(),supporting:e.array(e.string().min(1).max(40)).max(4).optional()}).optional(),imagePalette:e.object({background:e.string().min(1).max(40).optional(),foreground:e.string().min(1).max(40).optional(),card:e.string().min(1).max(40).optional(),muted:e.string().min(1).max(40).optional(),border:e.string().min(1).max(40).optional()}).optional()}),Mt=e.object({protocol:e.enum(["phone","form","download","route","external"]),ctaLabel:e.string().min(1).max(40),ctaTarget:e.string().min(1).max(200).optional(),requiresOwnerDetail:e.boolean().optional()}),jt=e.enum(["material","reference","brief","industry"]),oc=e.object({market:e.object({value:e.string().min(1).max(200),source:jt}),customer:e.object({value:e.string().min(1).max(200),source:jt}),purpose:e.object({options:e.array(e.string().min(1).max(60)).min(2).max(4),selected:e.string().min(1).max(60),source:jt})}),rc=e.enum(["text-options","motion-slider","positioning"]),Lt=e.enum(["none","subtle","moderate","expressive"]),cc=e.enum(["compact","comfortable","editorial"]),mc=Lt,Fi=e.object({skill_name:e.string().min(1),rationale:e.string().min(4).max(200),confidence:e.enum(["high","medium","low"]).optional(),displayName:e.object({zh:e.string().min(1),en:e.string().min(1)}).partial().optional()}),pc=e.object({value:e.string(),label:e.string(),desc:e.string().optional(),impact:e.string().optional(),isRecommended:e.boolean().optional(),preselect:e.boolean().optional(),visualHints:wt.optional(),conversionHints:Mt.optional()}),dc=e.object({id:e.string(),type:rc,question:e.string(),tag:e.string(),aiThinking:e.string(),options:e.array(pc),source:e.enum(["ai-detected","always-ask"]),sourceDetail:e.string(),positioning:oc.optional()}),Ut=e.object({questions:e.array(dc).min(1).max(6)}),Hu=e.object({tenant_id:e.string().min(1),site_id:e.string().min(1),brief_id:e.string().min(1),brief:e.string().min(20).max(1e3),site_default_locale:W.optional(),owner_locale:W.optional(),input_context:e.object({facts:e.array(je).max(120),conflicts:e.array(we).max(20),reference:Oe.optional(),sources:e.array(e.object({type:st,title:e.string().max(120).optional(),status:at})).max(16).optional()}).optional()}),Ki=e.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),$u=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("skill.selecting"),category:e.literal("page-generation"),available:e.array(e.object({id:e.string().min(1),name:e.string().min(1)})).max(20),at:e.string().min(1)}),e.object({type:e.literal("skill.selected"),category:e.literal("page-generation"),selected:e.object({id:e.string().min(1),name:e.string().min(1),reason:e.string().min(1).max(200)}),at:e.string().min(1)}),e.object({type:e.literal("clarify.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("clarify.archetype_proposals"),proposals:e.array(Fi).min(1).max(5),at:e.string().min(1)}),e.object({type:e.literal("clarify.finished"),questions_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),error_category:Ki.optional(),retryable:e.boolean().optional(),attempts:e.number().int().positive().optional(),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),at:e.string().min(1)})]),lc=e.enum(["draft","brief_submitted","clarifying","sitemap_ready","workspace_ready","deployed","archived","error"]),uc={draft:["brief_submitted","archived","error"],brief_submitted:["clarifying","archived","error"],clarifying:["sitemap_ready","archived","error"],sitemap_ready:["workspace_ready","archived","error"],workspace_ready:["deployed","archived","error"],deployed:["workspace_ready","archived","error"],archived:[],error:["draft","brief_submitted","clarifying","sitemap_ready"]};function Yu(t,n){if(!uc[t].includes(n))throw new Error(`Invalid site status transition: ${t} -> ${n}`);return n}var gc=e.enum(["planning","initial_generation_running","generated"]),hc={planning:["initial_generation_running"],initial_generation_running:["generated","planning"],generated:[]};function Zu(t,n){if(t===n)return n;if(!hc[t].includes(n))throw new Error(`Invalid site generation state transition: ${t} -> ${n}`);return n}function Xu(t){if(t.agent_type!=="workspace"||t.current_state==="generated")return null;switch(t.event_type){case"run.started":return t.current_state==="planning"?"initial_generation_running":null;case"run.finished":return t.current_state==="initial_generation_running"?"generated":null;case"run.failed":return t.current_state==="initial_generation_running"?t.has_current_snapshot?"generated":"planning":null;default:return null}}var Qu="SITE_PLANNING_INPUT_FROZEN",Ju="SITE_PLANNING_LOCKED",eg=e.object({tenant_id:e.string().min(1),owner_user_id:e.string().min(1),name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),tg=e.object({name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),ng=e.object({name:e.string().min(1).max(120)}),ig=e.object({name:e.string().min(1).max(120),default_locale:W.optional()}),sg=e.object({body:e.string().min(20).max(1e3)}),ag=e.object({body:e.string().min(20).max(1e3)}),Ft=e.string().url().refine(t=>{try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}},{message:"URL must use http or https protocol"}),og=e.object({tenant_id:e.string().min(1),site_url:Ft,site_name:e.string().trim().min(1).max(255).optional()}),U=t=>e.object({code:e.number().int(),data:t,message:e.string()}),rg=U(ln),cg=U(un),mg=U(gn),pg=U(Sn),dg=U(bn),lg=U(fn),ug=U(En),gg=U(xn),hg=U(In),_g=U(e.object({site_id:e.string().min(1),site_url:Ft})),Sg=U(Ti),bg=U(ki),fg=U(Pi),yg=U(Ai),Eg=U(Ci),xg=U(Ri),ge=e.object({id:e.string().min(1),tenant_id:e.string().min(1),owner_user_id:e.string().min(1).nullable(),name:e.string().min(1),slug:e.string().min(1),status:lc,generation_state:gc,planning_locked_at:e.string().min(1).nullable(),current_sitemap_id:e.string().min(1).nullable(),current_snapshot_id:e.string().min(1).nullable(),deployed_url:e.string().url().nullable(),default_locale:W,owner_locale:W.optional(),cms_site_id:e.string().nullable().optional(),cms_site_url:Ft.nullable().optional(),schema_version:e.literal(1),created_at:e.string().min(1),updated_at:e.string().min(1)}),Kt=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),body:e.string().min(1),source:e.enum(["user","import","system"]),created_at:e.string().min(1),updated_at:e.string().min(1)}),Ig=e.object({site:ge,brief:Kt,next_step:e.literal("clarify")}),Rg=e.object({site:ge,brief:Kt}),Tg=e.object({brief:Kt}),_c=e.enum(["queued","running","succeeded","failed","cancelled"]),Gi=e.enum(["clarify","sitemap","workspace"]),qi=e.enum(["clarify","sitemap","initial_generation","iteration"]),Bi=e.enum(["clarify","sitemap","workspace","summarize"]),ie=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),agent_type:Gi,run_kind:qi,status:_c,model_route:Bi,started_at:e.string().min(1).nullable(),finished_at:e.string().min(1).nullable(),error_code:e.string().min(1).nullable(),created_at:e.string().min(1)}),kg=e.object({run_id:e.string().min(1).optional(),site_id:e.string().min(1),agent_type:Gi,run_kind:qi.optional(),model_route:Bi,input:e.record(e.string(),e.unknown()).optional()}).superRefine((t,n)=>{Ne(t.input)&&n.addIssue({code:"custom",path:["input"],message:"Agent run input must not contain secrets"})}),Pg=e.object({agent_run:ie,next_step:e.literal("stream_events")}),zi=e.enum(["draft","candidate","deleting","current","failed"]),Q=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),version:e.number().int().positive(),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),template_version:V.nullable().optional(),reason:e.enum(["initial_generation","workspace_edit","pre_deploy","manual_save","rollback","template_upgrade"]),status:zi,created_at:e.string().min(1)}),Ag=e.object({snapshot_id:e.string().min(1).optional(),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),template_version:V.optional(),reason:Q.shape.reason,status:e.enum(["draft","candidate","current","failed"]).default("candidate"),source_run_id:e.string().min(1).optional()}),Cg=e.object({site:ge,snapshot:Q,next_step:e.literal("workspace")}),Dg=e.object({expected_manifest_hash:Q.shape.manifest_hash,manifest_hash:Q.shape.manifest_hash,object_key:Q.shape.object_key}).strict(),vg=e.union([e.object({base_snapshot_id:e.string().min(1).nullable(),source_run_id:e.string().min(1).optional()}).strict(),e.object({skip_base_check:e.literal(!0)}).strict()]),Sc=e.object({site:ge,snapshot:Q,next_step:e.literal("workspace")}),Ng=e.object({snapshot:Q}),jg=e.object({status:e.literal("deleting"),snapshot_id:e.string().min(1),object_key:e.string().min(1)}),Og=e.object({status:e.literal("deleted"),snapshot_id:e.string().min(1)}),Je=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),snapshot_id:e.string().min(1),version:e.number().int().positive(),accepted_commit:e.string().min(1),source_run_id:e.string().min(1).nullable(),created_at:e.string().min(1)}),bc=Je.extend({reason:Q.shape.reason,status:zi}),wg=e.object({accepted_commit:e.string().min(1),source_run_id:e.string().min(1).optional()}),Mg=e.object({site_version:Je,next_step:e.literal("workspace")}),Lg=e.object({owner_id:e.string().min(1)}).strict(),Ug=e.discriminatedUnion("acquired",[e.object({acquired:e.literal(!0)}).strict(),e.object({acquired:e.literal(!1)}).strict()]),Fg=e.object({owner_id:e.string().min(1)}).strict(),Kg=e.object({released:e.literal(!0)}).strict(),Gg="TEMPLATE_UPGRADE_LOCK_LOST",qg=e.object({base_snapshot_id:e.string().min(1),accepted_commit:Je.shape.accepted_commit,owner_id:e.string().min(1)}).strict(),Bg=Sc.strict(),zg=e.object({site_versions:e.array(bc)}),Wg=e.object({site:ge,snapshot:Q,site_version:Je,next_step:e.literal("workspace")}),Vg=e.object({snapshot_id:e.string().min(1),force_rehydrate:e.boolean().optional()}),Hg=e.discriminatedUnion("status",[e.object({status:e.literal("ready"),snapshot_id:e.string().min(1),preview_url:e.string().min(1)}),e.object({status:e.literal("failed"),code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})]),$g="DEPLOYMENT_ENTITLEMENT_REQUIRED",Gt=e.enum(Zt),et=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),snapshot_id:e.string().min(1),version:e.number().int().positive(),status:Gt,provider:e.enum(["cloudflare"]),url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Yg=e.object({snapshot_id:e.string().min(1).optional()}).default({}),Zg=e.object({deployment:et}),Xg=e.object({deployment:et.nullable()}),Qg=e.object({deployment:et}),wi=e.object({id:e.string().min(1),status:Gt,url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable()}),Jg=e.object({current:wi.nullable(),latest_released:wi.nullable()}),fc=e.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),ue=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),deployment_id:e.string().min(1),seq:e.number().int().positive(),sent_at:e.string().min(1)}),Xe=e.object({deployment:et}),eh=e.discriminatedUnion("type",[ue.extend({type:e.literal("deployment.snapshot"),payload:Xe}),ue.extend({type:e.literal("deployment.status.changed"),payload:Xe}),ue.extend({type:e.literal("deployment.finished"),payload:Xe}),ue.extend({type:e.literal("deployment.failed"),payload:Xe}),ue.extend({type:e.literal("deployment.realtime.recovered"),payload:e.object({action:e.literal("refresh")})}),ue.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})})]),th=e.object({tenant_id:e.string().min(1),site_id:e.string().min(1),deployment_id:e.string().min(1),status:Gt,updated_at:e.string().min(1)}),yc="vcp:deployments",nh={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:yc,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...fc.options]},Ec=e.object({error:e.object({code:e.string().min(1),message:e.string().min(1),details:e.unknown().optional(),request_id:e.string().min(1).optional(),retryable:e.boolean().default(!1)})}),ih=e.object({error:Ec.shape.error.extend({code:e.literal("AGENT_RUN_IN_FLIGHT"),details:e.object({code:e.literal("AGENT_RUN_IN_FLIGHT"),message:e.string().min(1),agent_run:ie})})}),sh=e.object({colors:e.record(e.string(),e.string()).default({}),typography:e.record(e.string(),e.string()).default({}),spacing:e.record(e.string(),e.string()).default({}),motion:e.record(e.string(),e.string()).default({})}),xc=e.object({theme_id:e.string().min(1),paletteIntent:e.string().min(1),tone:e.string().min(1),mediaMood:e.string().min(1),motionLevel:Lt.optional(),userVisualHints:wt.optional()}),Ic=e.object({question:e.string().min(1),answer:e.string().min(1)}),ah=e.object({query:e.string().min(1),keywords:e.array(e.string()).default([]),orientation:e.enum(["landscape","portrait","square"]).optional(),role:e.enum(["hero","section","card","gallery","testimonial","decorative"]),altHint:e.string().min(1)}),oh=e.object({id:e.string().min(1),role:e.enum(["site_background","nav_background","footer_background"]),query:e.string().min(1),keywords:e.array(e.string()).default([]),treatment:e.enum(["cover","fixed-cover","subtle-texture"]),altHint:e.string().optional()}),Rc=e.object({provider:e.enum(["unsplash","pexels"]),providerLabel:e.enum(["Unsplash","Pexels"]),providerHref:e.string().url(),photoHref:e.string().url().optional(),photographerName:e.string().optional(),photographerHref:e.string().url().optional(),requiresAttribution:e.boolean()}),rh=e.object({src:e.string().min(1),alt:e.string().min(1),width:e.number().int().positive().optional(),height:e.number().int().positive().optional(),provider:e.enum(["unsplash","pexels","placeholder"]).optional(),providerId:e.string().optional(),photoUrl:e.string().url().optional(),photographer:e.string().optional(),photographerUrl:e.string().url().optional(),credit:e.string().optional(),dominantColor:e.string().optional(),attribution:Rc.optional()}),Tc=e.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),he=e.object({id:e.string().min(1),name:e.string().min(1),category:e.literal("page-generation"),version:e.string().min(1).optional(),reason:e.string().min(1).max(200),source:Tc.default("system_recommended")}),T=e.string().min(1).max(2e3),Mi=e.string().min(1).max(120),Wi=e.object({visualDirection:T,brandFeeling:T,paletteIntent:T,typographyIntent:T,density:cc,motionLevel:mc,mediaStrategy:T,compositionRules:e.array(T).max(20),avoidPatterns:e.array(T).max(20),fonts:e.object({heading:e.string().min(1),body:e.string().min(1)}).optional(),colorSeeds:e.object({primary:e.string().min(1).max(40),accent:e.string().min(1).max(40),neutral:e.string().min(1).max(40).optional(),supporting:e.array(e.string().min(1).max(40)).max(4).optional()}).optional(),surfaceMode:e.enum(["light","dark"]).optional(),radius:e.enum(["none","sm","md","lg","xl"]).optional(),imagePalette:e.object({background:e.string().min(1).max(40).optional(),foreground:e.string().min(1).max(40).optional(),card:e.string().min(1).max(40).optional(),muted:e.string().min(1).max(40).optional(),border:e.string().min(1).max(40).optional()}).optional()}),qt=160,Vi=e.object({routeGoal:T,narrativeArc:T,firstViewportIntent:T,visualContinuity:T,sectionRhythm:T,avoidPatterns:e.array(T).max(20),displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(qt).optional(),metaTitle:e.string().min(1).max(120).optional(),metaDescription:e.string().min(1).max(320).optional()}),Hi=e.enum(["model_call","validation","repair","preview","worker_group"]),ne=e.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),$i=e.object({sectionRole:T,contentIntent:T,layoutIntent:T,visualIntent:T,mediaIntent:T,motionIntent:T,copyTone:T,displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(qt).optional(),ctaIntent:T.optional(),continuityWithPrevious:T.optional(),avoidRepeating:e.array(T).max(20).optional(),industryRecipeRefs:e.array(Mi).max(12).optional(),templateRecipeRefs:e.array(Mi).max(12).optional()}),Yi=e.object({siteName:e.string().min(1).max(120),tagline:e.string().min(1).max(200).optional(),primaryCta:e.object({label:e.string().min(1).max(60),target:e.string().min(1).max(200)}).optional(),trustSignals:e.array(e.string().min(1).max(60)).max(6).optional(),industry:e.string().min(1).max(40).optional()}),kc=e.enum(["solid","floating"]),Pc=e.enum(["background","card","primary","frosted"]),Ac=e.enum(["sticky","hide-on-scroll","static"]),Cc=e.enum(["bar","island"]),Dc=e.object({variant:kc,surface:Pc.optional(),behavior:Ac.optional(),shape:Cc.optional()}),vc=e.object({form:T,layoutIntent:T,scrollBehavior:T,shell:Dc.optional(),avoidPatterns:e.array(T).max(10).optional()}),Nc=e.enum(["background","card","primary","inverse"]),jc=e.object({surface:Nc}),Oc=e.object({form:T,composition:T,shell:jc.optional(),avoidPatterns:e.array(T).max(10).optional()}),wc=e.object({pattern:T,intent:T}),Zi=e.object({header:vc,footer:Oc,mobileNav:wc}),Xi=e.object({schemaVersion:e.literal(1).default(1),siteDesignContext:Wi,routeCards:e.record(e.string().min(1),Vi),blockContexts:e.record(e.string().min(1),$i),selectedSkillPacks:e.array(he).max(3).optional(),branding:Yi.optional(),chromeDesign:Zi.optional()}),ch=e.object({siteDesignContext:Wi.omit({imagePalette:!0}).optional(),routeCards:e.record(e.string().min(1),Vi).optional(),blockContexts:e.record(e.string().min(1),$i).optional(),branding:Yi.optional(),chromeDesign:Zi.optional()}),Mc=e.object({id:e.string(),type:e.string(),variant:e.string().optional(),order:e.number(),props:e.record(e.string(),e.unknown()),enabled:e.boolean(),meta:e.object({aiGenerated:e.boolean(),userEdited:e.boolean(),lastEditedAt:e.string(),lastEditedBy:e.enum(["ai","user"]),userInstruction:e.string().optional()}).optional()}).strict(),Lc=e.string().regex(ye,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),Uc=new RegExp(`^/(?:${ce}(?:/${ce})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),Fc=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,Kc=e.union([e.string().regex(Uc),e.string().regex(Fc)]),Li=e.object({label:e.string(),href:Kc}),Gc=e.object({primaryLinks:e.array(Li),footerLinks:e.array(Li)}),Qi=e.object({id:e.string(),slug:Lc,title:e.string(),blocks:e.array(Mc).min(1),layout:e.enum(["default","centered","fullwidth"]).optional(),navigation:e.object({showInHeader:e.boolean(),showInFooter:e.boolean(),order:e.number()})}).strict(),qc=Qi.extend({slug:e.string().min(1)}),Ui=e.object({label:e.string(),href:e.string().min(1)}),Bc=e.object({primaryLinks:e.array(Ui),footerLinks:e.array(Ui)}),Ji=e.object({site_name:e.string().min(1).max(80).optional(),version:e.number().int().positive(),pages:e.array(Qi).min(1),navigation:Gc,integrations:e.object({cms:e.unknown().optional(),analytics:e.unknown().optional()}).optional(),meta:e.object({generatedAt:e.string(),generatedBy:e.literal("sitemap-agent"),source_brief_id:e.string().optional(),source_answer_ids:e.array(e.string()).optional()}),skillSelection:he,visualTheme:xc.optional(),userChoices:e.array(Ic).optional(),confirmedChoices:e.object({conversion:Mt.optional()}).optional()}).strict(),tt=Ji.superRefine((t,n)=>{let i=new Map,o=0;t.pages.forEach((r,m)=>{r.slug==="/"&&(o+=1);let l=i.get(r.slug);l!==void 0?n.addIssue({code:"custom",path:["pages",m,"slug"],message:`Duplicate page slug '${r.slug}' (first used at pages.${l}.slug).`}):i.set(r.slug,m)}),(o!==1||t.pages[0]?.slug!=="/")&&n.addIssue({code:"custom",path:["pages"],message:"Sitemap must contain exactly one home page at pages[0] with slug '/'."})}),mh=Ji.omit({skillSelection:!0,visualTheme:!0,userChoices:!0,confirmedChoices:!0}).extend({site_name:e.string().min(1).max(80),pages:e.array(qc).min(1),navigation:Bc}),zc=e.enum(["ai","user"]),_e=e.object({site_id:e.string().min(1),page_id:e.string().min(1),edited_by:zc.default("ai"),source_agent_run_id:e.string().min(1).optional()}),ph=_e.extend({block_id:e.string().min(1),target_index:e.number().int().min(0)}),Wc=_e.extend({block_id:e.string().min(1)}),Vc=_e.extend({block_id:e.string().min(1),instruction:e.string()}),dh=_e.extend({block_id:e.string().min(1),variant:e.string().min(1).nullable()}),lh=_e.extend({block_id:e.string().min(1),props:e.record(e.string(),e.unknown()),mode:e.enum(["replace","merge"]).default("replace")}),uh=_e.extend({block:e.object({id:e.string().min(1),type:e.string().min(1),variant:e.string().min(1).optional(),props:e.record(e.string(),e.unknown()).default({}),insert_index:e.number().int().min(0).optional()})}),Hc=e.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),gh=e.discriminatedUnion("operation",[e.object({operation:e.literal("delete_block"),input:Wc}).strict(),e.object({operation:e.literal("update_block_instruction"),input:Vc}).strict()]),$c=e.enum(["SITEMAP_EDIT_INVALID","SITEMAP_API_NOT_CONFIGURED","SITEMAP_NOT_FOUND","SITEMAP_PAGE_NOT_FOUND","SITEMAP_BLOCK_NOT_FOUND","SITEMAP_BLOCK_ALREADY_EXISTS","SITEMAP_EDIT_FAILED"]),Yc=e.object({status:e.literal("updated"),operation:Hc,site_id:e.string().min(1),sitemap_id:e.string().min(1),version:e.number().int().positive(),changed_pages:e.array(e.string().min(1)).min(1),requires_code_patch:e.literal(!0)}),Zc=e.object({status:e.literal("failed"),code:$c,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),hh=e.discriminatedUnion("status",[Yc,Zc]),Bt=e.object({question_id:e.string().min(1),value:e.string().min(1),label:e.string().min(1).optional(),question:e.string().min(1).optional(),option_label:e.string().min(1).optional(),motion_level:Lt.optional(),visual_tonality:wt.optional(),conversion:Mt.optional(),positioning:e.object({market:e.string().min(1).max(200),customer:e.string().min(1).max(200),purpose:e.string().min(1).max(60)}).optional()}),_h=e.object({tenant_id:e.string().min(1),site_id:e.string().min(1),brief_id:e.string().min(1),brief:e.string().min(20).max(1e3),answers:e.array(Bt).min(1).max(10),skillSelection:he,site_default_locale:W.optional(),owner_locale:W.optional(),reference:Oe.optional(),input_context:e.object({facts:e.array(je).max(120),conflicts:e.array(we).max(20)}).optional()}),es=e.enum(["planning","generating","validating","ready"]),Xc=e.enum(["salvaged","deterministic_fallback"]),Qc=e.enum(["model_exception_settled_prefix","model_exception_safe_root"]),ts={outcome:Xc.optional(),reason:Qc.optional(),attempts:e.number().int().positive().optional()};function ns(t,n){if(t.type!=="sitemap.generated")return;let i=t.outcome!==void 0,o=t.reason!==void 0;i!==o&&n.addIssue({code:"custom",path:[i?"reason":"outcome"],message:"sitemap.generated outcome and reason must be provided together"})}var Jc=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:es,message:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generated"),sitemap_id:e.string().min(1),sitemap:tt,...ts,at:e.string().min(1)}),e.object({type:e.literal("sitemap.clamped"),reason:e.enum(["page_early_stop","finalize_best_effort"]),original_page_count:e.number().int().nonnegative().optional(),final_page_count:e.number().int().nonnegative().optional(),original_enabled_block_count:e.number().int().nonnegative().optional(),final_enabled_block_count:e.number().int().nonnegative().optional(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.started"),slot_count:e.number().int().nonnegative(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.finished"),slot_count:e.number().int().nonnegative(),provider_counts:e.object({unsplash:e.number().int().nonnegative(),pexels:e.number().int().nonnegative(),placeholder:e.number().int().nonnegative()}),fallback_count:e.number().int().nonnegative(),error_codes:e.array(e.string()),at:e.string().min(1)}),e.object({type:e.literal("snapshot.created"),snapshot_id:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),snapshot_id:e.string().min(1).optional(),at:e.string().min(1)})]),Sh=Jc.superRefine(ns),em=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),version:e.number().int().positive(),sitemap:tt,source_agent_run_id:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),bh=e.object({sitemap_id:e.string().min(1).optional(),sitemap:tt,source_agent_run_id:e.string().min(1).optional()}),fh=e.object({site:ge,sitemap:em,next_step:e.literal("workspace")}),tm=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),brief_id:e.string().min(1),questions:Ut,answers:e.array(Bt),selected_archetype:he.optional(),completed_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),yh=e.object({answers:e.array(Bt).min(1),questions:Ut,selected_archetype:he.optional()}),Eh=e.object({clarify_session:tm}),xh=e.object({questions:Ut,selected_archetype:he}),nm=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),version:e.number().int().positive(),design_plan:Xi,source_agent_run_id:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Ih=e.object({design_plan_id:e.string().min(1).optional(),design_plan:Xi,source_agent_run_id:e.string().min(1).optional()}),Rh=e.object({design_plan:nm}),nt=e.enum(["initial_generation","iteration"]),im=e.object({label:e.string().min(1).max(48),prompt:e.string().min(1).max(160)}).strict(),sm=e.enum(["model","derived","mixed","advisor"]),is=e.object({suggestions:e.array(im).min(1).max(4),source:sm}).strict(),am=e.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),om=e.enum(["generation_succeeded","entry_slots_omitted","quality_gate_exhausted","schema_gate_exhausted","stream_schema_mismatch","stream_generation_error","generation_error","fallback_compiler_error","legacy_result_missing_metadata"]),ss=e.enum(["run.started","message.delta","user.message","plan.updated","clarify.partial","clarify.archetype_proposals","clarify.finished","sitemap.generating","sitemap.partial","sitemap.generated","sitemap.clamped","sitemap.updated","sitemap.resync.failed","sitemap.resync.warning","block.changed","tool.started","tool.finished","workspace.plan.created","workspace.worker.updated","workspace.task.updated","workspace.degraded","workspace.design_plan.outcome","workspace.suggestions","file.changed","snapshot.created","snapshot.finalized","preview.preparing","preview.ready","preview.build.started","preview.build.succeeded","preview.build.failed","run.failed","run.finished","media_resolution.started","media_resolution.finished","skill.selecting","skill.selected","activity.started","activity.updated","activity.finished","activity.failed"]),rm=e.object({id:e.string().min(1),title:e.string().min(1),status:e.enum(["pending","running","completed","failed"])}),oe=e.enum(["pending","running","completed","completed_with_skips","failed","skipped"]),zt=e.enum(["style_media","chrome","sections","layout","pages","detect_typecheck","repair","finalize","sitemap_resync","preview"]),Wt=e.object({code:e.string().min(1),message:e.string().min(1),path:e.string().min(1).optional(),task_id:e.string().min(1).optional(),details:e.record(e.string(),e.unknown()).optional()}),B=e.string().min(1).refine(t=>_s(t),{message:"Snapshot file paths must be safe relative POSIX paths without traversal."}),Vt=e.object({deduped_paths:e.array(B),skipped_tasks:e.array(e.string().min(1)),failed_tasks:e.array(e.string().min(1)),fallback_files:e.array(e.string().min(1)),applied_paths:e.array(B)}),Ht=e.object({group_id:e.string().min(1),phase:zt,title:e.string().min(1),status:oe,task_ids:e.array(e.string().min(1)),depends_on_groups:e.array(e.string().min(1)),target_paths:e.array(B)}),cm=e.enum(["style","media","chrome","section","layout","page"]),$t=e.object({task_id:e.string().min(1),group_id:e.string().min(1),kind:cm,target_path:B,block_id:e.string().min(1).optional(),block_type:e.string().min(1).optional(),block_variant:e.string().min(1).optional(),block_order:e.number().int().nonnegative().optional(),user_instruction:e.string().min(1).optional(),page_id:e.string().min(1).optional(),page_slug:e.string().min(1).optional(),page_title:e.string().min(1).optional(),title:e.string().min(1).max(60).optional(),description:e.string().min(1).max(qt).optional(),status:oe,required_reads:e.array(B).optional()}),Yt=e.object({from_group_id:e.string().min(1),to_group_id:e.string().min(1),reason:e.enum(["style_media","chrome","sections","layout","page_composition","quality_gate"])}),Th=e.object({plan_id:e.string().min(1),run_kind:nt,model_route:e.object({planner:e.literal("workspace_planner"),worker:e.literal("workspace")}),groups:e.array(Ht),tasks:e.array($t),dependencies:e.array(Yt),expected_outputs:e.array(B),diagnostics:Vt}),kh=e.object({task_id:e.string().min(1),patch:e.unknown().optional(),snapshot_id:e.string().min(1).optional(),read_files:e.array(B),diagnostics:e.array(Wt),status:oe}),as=e.object({worker_count:e.number().int().nonnegative(),task_count:e.number().int().nonnegative(),group_count:e.number().int().nonnegative()}),os=e.object({pending:e.number().int().nonnegative(),running:e.number().int().nonnegative(),completed:e.number().int().nonnegative(),completed_with_skips:e.number().int().nonnegative(),failed:e.number().int().nonnegative(),skipped:e.number().int().nonnegative()}),mm=e.object({type:e.literal("text"),text:e.string(),state:e.enum(["streaming","done"]).optional()}),pm=e.object({type:e.literal("reasoning"),text:e.string(),state:e.enum(["streaming","done"]).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),dm=e.object({type:e.literal("file"),mediaType:e.string().min(1),filename:e.string().min(1).optional(),url:e.string().min(1)}),lm=e.object({type:e.literal("source-url"),sourceId:e.string().min(1),url:e.string().min(1),title:e.string().min(1).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),um=e.object({type:e.literal("source-document"),sourceId:e.string().min(1),mediaType:e.string().min(1),title:e.string().min(1),filename:e.string().min(1).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),gm=e.object({type:e.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:e.string().min(1).optional(),data:e.unknown()}),hm=e.object({type:e.string().regex(/^tool-[a-zA-Z0-9_-]+$/),toolCallId:e.string().min(1),state:e.enum(["input-streaming","input-available","output-available","output-error"]),input:e.unknown().optional(),output:e.unknown().optional(),errorText:e.string().min(1).optional()}),_m=e.object({type:e.literal("error"),errorText:e.string().min(1)}),Sm=e.object({type:e.literal("step-start")}),Qe=e.union([mm,pm,dm,lm,um,gm,hm,_m,Sm]),bm=e.string().min(1).max(512).refine(t=>_s(t)&&!/^[A-Za-z]:\//.test(t),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),fm=e.array(bm).min(1).max(64),ym=e.array(e.string().min(1).max(120)).min(1).max(64),Em=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("message.delta"),text:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("user.message"),client_message_id:e.string().min(1),message_id:e.string().min(1),parts:e.array(Qe).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("plan.updated"),steps:e.array(rm),at:e.string().min(1)}),e.object({type:e.literal("clarify.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("clarify.archetype_proposals"),proposals:e.array(Fi).min(1).max(5),at:e.string().min(1)}),e.object({type:e.literal("clarify.finished"),questions_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:es,message:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generated"),sitemap_id:e.string().min(1),sitemap:tt,...ts,at:e.string().min(1)}),e.object({type:e.literal("sitemap.clamped"),reason:e.enum(["page_early_stop","finalize_best_effort"]),original_page_count:e.number().int().nonnegative().optional(),final_page_count:e.number().int().nonnegative().optional(),original_enabled_block_count:e.number().int().nonnegative().optional(),final_enabled_block_count:e.number().int().nonnegative().optional(),at:e.string().min(1)}).strict(),e.object({type:e.literal("sitemap.updated"),sitemap_id:e.string().min(1),version:e.number().int().positive(),reason:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.resync.failed"),error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),diagnostics:e.unknown().optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.resync.warning"),code:e.string().min(1),message:e.string().min(1),diagnostics:e.unknown().optional(),at:e.string().min(1)}),e.object({type:e.literal("block.changed"),block_id:e.string().min(1),change_type:e.enum(["add","update","delete","move"]),at:e.string().min(1)}),e.object({type:e.literal("tool.started"),tool_call_id:e.string().min(1),name:e.string().min(1),summary:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("tool.finished"),tool_call_id:e.string().min(1),name:e.string().min(1),result_summary:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("workspace.plan.created"),plan_id:e.string().min(1),run_kind:nt,groups:e.array(Ht),tasks:e.array($t),dependencies:e.array(Yt),expected_outputs:e.array(B),diagnostics:Vt,summary:as,at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.worker.updated"),group_id:e.string().min(1),phase:zt,status:oe,task_counts:os,target_paths:e.array(B),diagnostics:e.array(e.string().min(1)),at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.task.updated"),task_id:e.string().min(1),group_id:e.string().min(1),status:oe,target_path:B,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(Wt).optional(),at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.degraded"),reason:e.enum(["block_placeholder","form_placeholder","patch_protected_dropped","preview_health_degraded","design_plan_fallback","generated_code_rescue"]),degraded_block_ids:e.array(e.string().min(1)).min(1).optional(),dropped_files:e.array(e.string().min(1)).min(1).optional(),degraded_file_paths:fm.optional(),degraded_page_ids:ym.optional(),snapshot_id:e.string().min(1).optional(),code:e.string().min(1).optional(),message:e.string().min(1).optional(),diagnostics:e.string().min(1).optional(),retryable:e.boolean().optional(),at:e.string().min(1)}).strict().superRefine((t,n)=>{if(!(t.reason==="generated_code_rescue")){for(let o of["degraded_file_paths","degraded_page_ids"])t[o]!==void 0&&n.addIssue({code:"custom",path:[o],message:`${o} is only allowed for generated_code_rescue`});return}t.degraded_file_paths===void 0&&n.addIssue({code:"custom",path:["degraded_file_paths"],message:"generated_code_rescue requires degraded_file_paths"});for(let o of["degraded_block_ids","dropped_files","snapshot_id","code","message","diagnostics","retryable"])t[o]!==void 0&&n.addIssue({code:"custom",path:[o],message:`${o} is not allowed for generated_code_rescue`})}),e.object({type:e.literal("workspace.design_plan.outcome"),design_plan_outcome:am,reason:om,at:e.string().min(1)}).strict(),is.extend({type:e.literal("workspace.suggestions"),at:e.string().min(1)}).strict(),e.object({type:e.literal("file.changed"),path:e.string().min(1),change_type:e.enum(["create","update","delete"]),diff:e.string().optional(),at:e.string().min(1)}),e.object({type:e.literal("snapshot.created"),snapshot_id:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("snapshot.finalized"),snapshot_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("preview.preparing"),at:e.string().min(1)}),e.object({type:e.literal("preview.ready"),url:e.string().url(),at:e.string().min(1)}),e.object({type:e.literal("preview.build.started"),snapshot_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("preview.build.succeeded"),snapshot_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("preview.build.failed"),snapshot_id:e.string().min(1),message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean(),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),error_category:Ki.optional(),retryable:e.boolean().optional(),attempts:e.number().int().positive().optional(),outcome:e.literal("retained_previous").optional(),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),snapshot_id:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.started"),slot_count:e.number().int().nonnegative(),at:e.string().datetime()}),e.object({type:e.literal("media_resolution.finished"),slot_count:e.number().int().nonnegative(),provider_counts:e.object({unsplash:e.number().int().nonnegative(),pexels:e.number().int().nonnegative(),placeholder:e.number().int().nonnegative()}),fallback_count:e.number().int().nonnegative(),error_codes:e.array(e.string()),at:e.string().datetime()}),e.object({type:e.literal("skill.selecting"),category:e.literal("page-generation"),available:e.array(e.object({id:e.string().min(1),name:e.string().min(1)})).max(20),at:e.string().min(1)}),e.object({type:e.literal("skill.selected"),category:e.literal("page-generation"),selected:e.object({id:e.string().min(1),name:e.string().min(1),reason:e.string().min(1).max(200)}),at:e.string().min(1)}),e.object({type:e.literal("activity.started"),activity_id:e.string().min(1),parent_activity_id:e.string().min(1).optional(),kind:Hi,title:e.string().min(1).max(200),detail:e.string().max(360).optional(),title_code:ne.optional(),detail_code:ne.optional(),locks_input:e.boolean(),at:e.string().min(1)}),e.object({type:e.literal("activity.updated"),activity_id:e.string().min(1),title:e.string().min(1).max(200).optional(),detail:e.string().max(360).optional(),title_code:ne.optional(),detail_code:ne.optional(),at:e.string().min(1)}),e.object({type:e.literal("activity.finished"),activity_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("activity.failed"),activity_id:e.string().min(1),detail:e.string().max(360).optional(),at:e.string().min(1)})]),rs=Em.superRefine(ns),Ot=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),agent_run_id:e.string().min(1),sequence:e.number().int().positive(),event_type:ss,payload:rs,created_at:e.string().min(1)}),Ph=e.object({event_type:ss,payload:rs}).superRefine((t,n)=>{t.event_type!==t.payload.type&&n.addIssue({code:"custom",path:["payload","type"],message:"payload.type must match event_type"}),Ne(t.payload)&&n.addIssue({code:"custom",path:["payload"],message:"AgentEvent payload must not contain secrets"})}),Ah=e.discriminatedUnion("status",[e.object({status:e.literal("appended"),agent_run:ie,event:Ot,next_cursor:e.number().int().nonnegative()}),e.object({status:e.literal("duplicate_ignored"),agent_run:ie,event:Ot,next_cursor:e.number().int().nonnegative()})]),Ch=e.object({events:e.array(Ot),next_cursor:e.number().int().nonnegative().optional()}),Dh=e.object({after_sequence:e.coerce.number().int().nonnegative().default(0)}),vh=e.enum(["implemented","skeleton","planned"]),Nh=e.enum(["GET","POST","PUT","PATCH","DELETE"]),jh=[{method:"PATCH",path:"/internal/sites/:site_id/snapshots/:snapshot_id/manifest",tag:"snapshots",summary:"Compare-and-set the manifest hash for the active current snapshot after an in-place object replacement.",status:"implemented",request_body_schema:"UpdateCurrentSnapshotManifestRequestSchema",response_schema:"SnapshotRecordSchema",notes:["Internal Agent authentication is required. The update succeeds only when site current_snapshot_id, snapshot status, object key, and expected manifest hash still match."]},{method:"GET",path:"/health",tag:"system",summary:"API health check.",status:"implemented",response_schema:"ApiHealth"},{method:"POST",path:"/sites",tag:"sites",summary:"Create a site and Step 1 brief in the current dev context.",status:"implemented",request_body_schema:"CreateSiteBriefRequestSchema",response_schema:"CreateSiteBriefResponseSchema"},{method:"POST",path:"/sites/drafts",tag:"sites",summary:"Create a draft site without a brief in the current tenant so /s/:site_id can collect Step 1 later.",status:"implemented",request_body_schema:"CreateSiteDraftRequestSchema",response_schema:"SiteRecordSchema"},{method:"GET",path:"/sites",tag:"sites",summary:"List current tenant sites.",status:"implemented",response_schema:"SiteRecordSchema[]"},{method:"GET",path:"/sites/by-cms/:cms_site_id",tag:"sites",summary:"Resolve an external CMS site id to one tenant-scoped VCP site.",status:"implemented",response_schema:"SiteRecordSchema",notes:["Used by the browser /d/:cms_site_id handoff route; lookup is scoped by current request tenant and returns 404 when the CMS site has not been synchronized."]},{method:"GET",path:"/sites/:site_id",tag:"sites",summary:"Get one tenant-scoped site.",status:"implemented",response_schema:"SiteRecordSchema"},{method:"GET",path:"/sites/:site_id/designer/component-library/categories",tag:"designer-component-library",summary:"List the fixed insert-new-component category tree for a site.",status:"implemented",response_schema:"ListDesignerComponentCategoriesResponseSchema",notes:["The server validates site ownership and fixes category_group_key to insertNewComponent."]},{method:"GET",path:"/sites/:site_id/designer/component-library/resources",tag:"designer-component-library",summary:"List component resources from the fixed designer catalog group.",status:"implemented",query_schema:"ListDesignerComponentsQuerySchema",response_schema:"ListDesignerComponentsResponseSchema",notes:["The server fixes resource type to component and does not expose resource-platform secrets, internal hosts, or product-line selection."]},{method:"POST",path:"/sites/:site_id/designer/component-library/resources/:resource_id/install",tag:"designer-component-library",summary:"Install one exact component version and return a strict SiteEditEngine materialization.",status:"implemented",request_body_schema:"InstallDesignerComponentBodySchema",response_schema:"InstallDesignerComponentResponseSchema",notes:["The server downloads the resource ZIP with the configured secret, validates main.json identity and compatibility, and returns only the strict materialization plus immutable revision metadata."]},{method:"GET",path:"/sites/:site_id/designer/page-library/categories",tag:"designer-page-library",summary:"List the fixed insert-new-page category tree for a site.",status:"implemented",response_schema:"ListDesignerPageCategoriesResponseSchema",notes:["The server validates site ownership and fixes category_group_key to insertNewPage."]},{method:"GET",path:"/sites/:site_id/designer/page-library/resources",tag:"designer-page-library",summary:"List page and pages resources from the fixed designer catalog.",status:"implemented",query_schema:"ListDesignerPagesQuerySchema",response_schema:"ListDesignerPagesResponseSchema",notes:["The server fixes resource types to page and pages and does not expose resource-platform credentials or internal routing."]},{method:"POST",path:"/sites/:site_id/designer/page-library/resources/:resource_id/prepare",tag:"designer-page-library",summary:"Resolve one exact page resource version for designer-side draft configuration.",status:"implemented",request_body_schema:"PrepareDesignerPageBodySchema",response_schema:"PrepareDesignerPageResponseSchema"},{method:"POST",path:"/sites/:site_id/designer/page-library/resources/:resource_id/install",tag:"designer-page-library",summary:"Install one exact page resource version and return a strict PageResourceArtifact.",status:"implemented",request_body_schema:"InstallDesignerPageBodySchema",response_schema:"InstallDesignerPageResponseSchema",notes:["The server validates the explicit resource type, immutable package identity, page selections, materializations, and package-local references."]},{method:"GET",path:"/sites/:site_id/designer/pages",tag:"designer-page-library",summary:"List designer pages from the stable first-phase fixture source.",status:"implemented",response_schema:"ListDesignerSitePagesResponseSchema"},{method:"POST",path:"/sites/:site_id/designer/page-resources/enhance",tag:"designer-page-library",summary:"Echo a designer page-resource candidate without model execution or normalization.",status:"implemented",request_body_schema:"EnhanceDesignerPageResourceBodySchema",response_schema:"EnhanceDesignerPageResourceResponseSchema"},{method:"POST",path:"/sites/:site_id/designer/page-resources/blank",tag:"designer-page-library",summary:"Create the deterministic built-in blank page artifact for one configured route.",status:"implemented",request_body_schema:"InstallDesignerPageBodySchema",response_schema:"InstallDesignerPageResponseSchema"},{method:"PATCH",path:"/sites/:site_id",tag:"sites",summary:"Update site display name and optional generated-site locale for the current tenant.",status:"implemented",request_body_schema:"UpdateSiteRequestSchema",response_schema:"SiteRecordSchema"},{method:"DELETE",path:"/sites/:site_id",tag:"sites",summary:"Archive a site so it no longer appears in the tenant site list.",status:"implemented",response_schema:"SiteRecordSchema"},{method:"GET",path:"/sites/:site_id/plan",tag:"publish-entitlements",summary:"Get the current site plan and custom-domain entitlement.",status:"implemented",query_schema:"locale",response_schema:"GetSitePlanResponseSchema"},{method:"GET",path:"/sites/:site_id/workspace/source-files",tag:"sites",summary:"List source files available in the ready preview sandbox.",status:"implemented",response_schema:"WorkspaceSourceFileListItemSchema[]"},{method:"GET",path:"/sites/:site_id/workspace/source-file",tag:"sites",summary:"Read a source file from the ready preview sandbox.",status:"implemented",query_schema:"WorkspaceSourceFilePathQuerySchema",response_schema:"WorkspaceSourceFileResponseSchema"},{method:"POST",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Persist generated sitemap and advance the site to sitemap_ready.",status:"implemented",request_body_schema:"PersistSiteSitemapRequestSchema",response_schema:"PersistSiteSitemapResponseSchema"},{method:"GET",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Read the current sitemap for a site.",status:"implemented",response_schema:"SitemapRecordSchema"},{method:"POST",path:"/sites/:site_id/clarify/answers",tag:"clarify",summary:"Persist the Step 2 clarify answers (and the answered questions) into the site's clarify session.",status:"implemented",request_body_schema:"PersistClarifyAnswersRequestSchema",response_schema:"PersistClarifyAnswersResponseSchema"},{method:"PATCH",path:"/sites/:site_id/clarify/archetype",tag:"clarify",summary:"Switch the Step 2 industry archetype (user_picked) into the site's clarify session via an idempotent upsert.",status:"implemented",request_body_schema:"UpdateClarifyArchetypeRequestSchema",response_schema:"PersistClarifyAnswersResponseSchema",notes:["Independent of generate: materializes a clarify_sessions row when none exists (using the supplied questions) or updates only selected_archetype; never writes answers/completed_at. Forces source=user_picked."]},{method:"POST",path:"/internal/sites/:site_id/design-plan",tag:"design-plans",summary:"Persist a generated design plan version for a site (internal agent-only write).",status:"implemented",request_body_schema:"PersistSiteDesignPlanRequestSchema",response_schema:"PersistSiteDesignPlanResponseSchema",notes:["Guarded by the internal agent token; only the Workspace/Sitemap agent writes design plans."]},{method:"GET",path:"/internal/sites/:site_id/design-plan",tag:"design-plans",summary:"Read the current (latest version) design plan for a site (internal agent-only read).",status:"implemented",response_schema:"DesignPlanRecordSchema",notes:["Guarded by the internal agent token; only the Workspace/Sitemap agent reads design plans."]},{method:"GET",path:"/sites/:site_id/design-plan",tag:"design-plans",summary:"Read the current (latest version) design plan for a site so Workspace UI can inspect the generated design contract.",status:"implemented",response_schema:"DesignPlanRecordSchema"},{method:"GET",path:"/sites/:site_id/brief",tag:"briefs",summary:"Read the persisted Step 1 brief for a site so the Workspace Agent can seed first full-site generation without a new write surface.",status:"implemented",response_schema:"BriefRecordSchema"},{method:"PUT",path:"/sites/:site_id/brief/draft",tag:"briefs",summary:"Save a draft site's Step 1 brief without advancing the workflow.",status:"implemented",request_body_schema:"SaveBriefDraftRequestSchema",response_schema:"SaveBriefDraftResponseSchema",notes:["Only draft sites with generation_state=planning are writable; the brief row is upserted idempotently while site status, generation state, locale, and workflow stage remain unchanged."]},{method:"PATCH",path:"/sites/:site_id/brief",tag:"briefs",summary:"Create or update a draft site's Step 1 brief and advance it to Clarify without allowing later workflow states to roll back.",status:"implemented",request_body_schema:"UpdateBriefRequestSchema",response_schema:"UpdateBriefResponseSchema",notes:["Only draft sites with generation_state=planning are writable; missing brief rows are created on first save; identical retries after brief_submitted are idempotent."]},{method:"POST",path:"/internal/sites/:cms_site_id/external-sync",tag:"sites",summary:"Synchronize a trusted external CMS site URL into VCP by tenant_id + cms_site_id, creating a draft VCP site on first sync.",status:"implemented",request_body_schema:"ExternalSyncSiteRequestSchema",response_schema:"ExternalSyncSiteResponseSchema",notes:["This trusted external entry does not require browser login or internal bearer auth; tenant_id is written directly to tenants.id and the response uses the internal { code, data, message } success envelope."]},{method:"POST",path:"/sites/:site_id/snapshots",tag:"snapshots",summary:"Persist snapshot metadata without changing the current site snapshot.",status:"implemented",request_body_schema:"PersistSiteSnapshotRequestSchema",response_schema:"PersistSiteSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/promote",tag:"snapshots",summary:"Promote a site snapshot as the current workspace version.",status:"implemented",request_body_schema:"PromoteSiteSnapshotRequestSchema",response_schema:"PromoteSiteSnapshotResponseSchema"},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/lock/try-acquire",tag:"snapshots",summary:"Try to acquire the short-lived template-upgrade site lock.",status:"implemented",request_body_schema:"TryAcquireTemplateUpgradeLockRequestSchema",response_schema:"TryAcquireTemplateUpgradeLockResponseSchema",notes:["Internal agent-only endpoint; lock contention returns acquired=false instead of a user-facing conflict."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/lock/release",tag:"snapshots",summary:"Release the calling template-upgrade attempt's site lock.",status:"implemented",request_body_schema:"ReleaseTemplateUpgradeLockRequestSchema",response_schema:"ReleaseTemplateUpgradeLockResponseSchema",notes:["Internal agent-only endpoint; release is scoped by tenant, site, operation type, and owner."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/snapshots/:snapshot_id/promote",tag:"snapshots",summary:"CAS-promote a validated template-upgrade candidate and bind its accepted commit atomically.",status:"implemented",request_body_schema:"PromoteTemplateUpgradeSnapshotRequestSchema",response_schema:"PromoteTemplateUpgradeSnapshotResponseSchema",notes:["Internal agent-only endpoint; accepted_commit is never part of the public promote request or response."]},{method:"GET",path:"/internal/sites/:site_id/template-upgrade/state",tag:"snapshots",summary:"Inspect the projected tenant-scoped template-upgrade state without mutation.",status:"implemented",query_schema:"InspectTemplateUpgradeStateRequestSchema",response_schema:"InspectTemplateUpgradeStateResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and the repository path is read-only."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/state/prepare",tag:"snapshots",summary:"Prepare the tenant-scoped template-upgrade retry state for a target version.",status:"implemented",request_body_schema:"PrepareTemplateUpgradeStateRequestSchema",response_schema:"PrepareTemplateUpgradeStateResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and is never accepted in the request body."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/state/failure",tag:"snapshots",summary:"Record a finite validation failure for the prepared template-upgrade target.",status:"implemented",request_body_schema:"RecordTemplateUpgradeFailureRequestSchema",response_schema:"RecordTemplateUpgradeFailureResponseSchema",notes:["Internal agent-only endpoint; accepts a finite error code and never raw validation output."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/state/success",tag:"snapshots",summary:"Reset retry state after the prepared template-upgrade target succeeds.",status:"implemented",request_body_schema:"RecordTemplateUpgradeSuccessRequestSchema",response_schema:"RecordTemplateUpgradeSuccessResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and is never accepted in the request body."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/events",tag:"snapshots",summary:"Record one bounded template-upgrade observability event.",status:"implemented",request_body_schema:"RecordTemplateUpgradeEventRequestSchema",response_schema:"RecordTemplateUpgradeEventResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and the strict request excludes raw errors, source content, and file paths."]},{method:"GET",path:"/internal/template-upgrades/report",tag:"snapshots",summary:"Read tenant-scoped template-upgrade outcome, state, and duration aggregates.",status:"implemented",query_schema:"GetTemplateUpgradeReportQuerySchema",response_schema:"GetTemplateUpgradeReportResponseSchema",notes:["Internal endpoint; tenant identity is derived from trusted request context and all aggregates are tenant-scoped."]},{method:"GET",path:"/internal/template-upgrades/snapshot-deletions/pending",tag:"snapshots",summary:"List tenant-scoped stale template-upgrade snapshot deletions for dry-run or reconciliation.",status:"implemented",query_schema:"ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema",response_schema:"ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema",notes:["Defaults to retrying deleting tombstones. Including candidate snapshots is an explicit maintenance action and should use a conservative age threshold."]},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/abandon",tag:"snapshots",summary:"Mark an unpromoted candidate snapshot as failed.",status:"implemented",response_schema:"AbandonSiteSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/snapshots/:snapshot_id",tag:"snapshots",summary:"Read one tenant-scoped snapshot metadata record for a site.",status:"implemented",response_schema:"SnapshotRecordSchema"},{method:"DELETE",path:"/sites/:site_id/snapshots/:snapshot_id",tag:"snapshots",summary:"Prepare two-phase deletion of a candidate snapshot and return its object key; refuses non-candidate/current/referenced snapshots.",status:"implemented",response_schema:"DeleteSiteSnapshotResponseSchema",notes:["Internal Agent authentication is required. This endpoint only creates a deleting tombstone; object removal and completion are separate steps."]},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/deletion/complete",tag:"snapshots",summary:"Complete deletion after the snapshot object has been removed; only accepts deleting snapshots.",status:"implemented",response_schema:"CompleteSiteSnapshotDeletionResponseSchema",notes:["Internal Agent authentication is required; callers must remove the object before completing the DB deletion."]},{method:"POST",path:"/agent-runs",tag:"agent-runs",summary:"Create an agent run for event persistence and replay.",status:"implemented",request_body_schema:"CreateAgentRunRequestSchema",response_schema:"CreateAgentRunResponseSchema"},{method:"POST",path:"/agent-runs/:run_id/events",tag:"agent-runs",summary:"Append one normalized AgentEvent to a run.",status:"implemented",request_body_schema:"AppendAgentEventRequestSchema",response_schema:"AppendAgentEventResponseSchema",notes:["Internal-only write surface: only internal-service callers may append, except browser (oidc) contexts may append run.failed (the WS connect-stage unlock path, equivalent to POST /agent-runs/workspace/cancel). All other oidc appends \u2014 run.finished, run.started, tool/system/progress, file/snapshot \u2014 are rejected with 403 FORBIDDEN. The browser sends user messages over the Workspace WebSocket (recorded server-side as user.message) and otherwise only reads the GET replay."]},{method:"GET",path:"/agent-runs/:run_id/events",tag:"agent-runs",summary:"Replay AgentEvents after a run-local sequence cursor.",status:"implemented",response_schema:"ListAgentEventsResponseSchema"},{method:"POST",path:"/internal/agent-runs/fail-stale-in-flight",tag:"agent-runs",summary:"Fail stale in-flight workspace runs (internal maintenance, cross-tenant sweep).",status:"implemented",response_schema:"FailStaleInFlightWorkspaceRunsResponseSchema",notes:["Internal maintenance endpoint guarded by InternalAgentAuthGuard (Bearer VCP_AGENT_INTERNAL_TOKEN, production fail-closed); the /internal/** prefix is exempt from browser auth middleware so the guard is the sole trust boundary. Not exposed to the browser via agent-proxy; called by an external admin cron / controlled ops script."]},{method:"GET",path:"/briefs",tag:"briefs",summary:"Brief resource summary endpoint until concrete brief APIs land.",status:"skeleton"},{method:"GET",path:"/clarify",tag:"clarify",summary:"Clarify resource summary endpoint; persisted answers write through POST /sites/:site_id/clarify/answers.",status:"skeleton"},{method:"GET",path:"/sitemaps",tag:"sitemaps",summary:"Sitemap resource summary endpoint until collection APIs land.",status:"skeleton"},{method:"GET",path:"/snapshots",tag:"snapshots",summary:"Snapshot resource summary endpoint until collection APIs land.",status:"skeleton"},{method:"GET",path:"/sandbox-sessions",tag:"sandbox-sessions",summary:"Sandbox session resource summary endpoint until preview APIs land.",status:"skeleton"},{method:"GET",path:"/deployments",tag:"deployments",summary:"Deployment resource summary endpoint until publish APIs land.",status:"skeleton"},{method:"GET",path:"/usage",tag:"usage",summary:"Usage resource summary endpoint until cost summaries land.",status:"skeleton"},{method:"GET",path:"/audit",tag:"audit",summary:"Audit resource summary endpoint until audit queries land.",status:"skeleton"},{method:"POST",path:"/sites/:site_id/workspace/runs",tag:"workspace",summary:"Start an asynchronous Workspace Agent run from the current snapshot.",status:"implemented",request_body_schema:"StartWorkspaceRunRequestSchema",response_schema:"StartWorkspaceRunResponseSchema",notes:["Long-running work must be event-driven and must not block API transactions."]},{method:"POST",path:"/v1/agent/workspace/:site_id/form-design-operations",tag:"agent/workspace",summary:"Create or replay a deterministic FORM_SPEC save operation.",status:"implemented",request_body_schema:"FormDesignSaveRequestSchema",response_schema:"FormDesignOperationResponseSchema"},{method:"GET",path:"/v1/agent/workspace/:site_id/form-design-operations/:operation_id",tag:"agent/workspace",summary:"Read a persisted FORM_SPEC save operation.",status:"implemented",response_schema:"FormDesignOperationResponseSchema"},{method:"POST",path:"/v1/agent/workspace/:site_id/form-design-operations/:operation_id/resume",tag:"agent/workspace",summary:"Resume a recoverable FORM_SPEC save with its original fingerprint.",status:"implemented",request_body_schema:"FormDesignResumeRequestSchema",response_schema:"FormDesignOperationResponseSchema"},{method:"GET",path:"/sites/:site_id/workspace/runs/latest",tag:"workspace",summary:"Look up the latest workspace Agent run for a site so Step 4 re-entry can replay persisted events without re-triggering the model.",status:"implemented",response_schema:"LatestWorkspaceRunResponseSchema"},{method:"POST",path:"/sites/:site_id/preview-sessions",tag:"sandbox-sessions",summary:"Persist or update an on-demand preview session; optional expected_current_snapshot_id enables current-snapshot CAS.",status:"implemented",request_body_schema:"PersistPreviewSessionRequestSchema",response_schema:"PersistPreviewSessionResponseSchema"},{method:"GET",path:"/sites/:site_id/preview-sessions/current",tag:"sandbox-sessions",summary:"Read the latest tenant-scoped preview session for a site.",status:"implemented",response_schema:"SandboxSessionSchema"},{method:"POST",path:"/sites/:site_id/deployments",tag:"deployments",summary:"Queue an explicit user-confirmed deployment from a snapshot.",status:"implemented",request_body_schema:"CreateDeploymentRequestSchema",response_schema:"CreateDeploymentResponseSchema",notes:["Before creating any deployment record or queue job, the API verifies the site's active subscription; an inactive subscription returns 403 DEPLOYMENT_ENTITLEMENT_REQUIRED, while an unavailable entitlement source prevents deployment creation.","The API returns after creating the deployment record and queue job; worker-service claims deployment_jobs for build and Cloudflare publish."]},{method:"GET",path:"/sites/:site_id/deployments/current",tag:"deployments",summary:"Read the latest deployment for workspace refresh recovery.",status:"implemented",response_schema:"CurrentDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/status",tag:"deployments",summary:"Read current in-flight deployment and latest released deployment.",status:"implemented",response_schema:"GetDeploymentsStatusResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/:deployment_id",tag:"deployments",summary:"Read one tenant-scoped deployment for status polling.",status:"implemented",response_schema:"GetDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/cms/collections",tag:"cms",summary:"List CMS collections for a site.",status:"planned"},{method:"POST",path:"/sites/:site_id/cms/collections",tag:"cms",summary:"Create a CMS collection bound to generated content.",status:"planned"},{method:"GET",path:"/sites/:site_id/cms/collections/:collection_id/entries",tag:"cms",summary:"List CMS entries for a collection.",status:"planned"},{method:"POST",path:"/sites/:site_id/cms/collections/:collection_id/entries",tag:"cms",summary:"Create a CMS entry.",status:"planned"},{method:"PATCH",path:"/sites/:site_id/cms/collections/:collection_id/entries/:entry_id",tag:"cms",summary:"Update a CMS entry.",status:"planned"},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/version-record",tag:"versions",summary:"Record the sandbox accepted git commit for a promoted snapshot version.",status:"implemented",request_body_schema:"RecordSnapshotVersionRequestSchema",response_schema:"RecordSnapshotVersionResponseSchema"},{method:"GET",path:"/sites/:site_id/versions",tag:"versions",summary:"List snapshot-backed site versions.",status:"implemented",response_schema:"ListSiteVersionsResponseSchema"},{method:"POST",path:"/sites/:site_id/versions/:snapshot_id/restore",tag:"versions",summary:"Restore a site to an earlier snapshot version.",status:"implemented",response_schema:"RestoreSiteSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/domains",tag:"custom-domains",summary:"List the site default domain and custom domains.",status:"implemented",response_schema:"ListSiteDomainsResponseSchema"},{method:"POST",path:"/sites/:site_id/domains",tag:"custom-domains",summary:"Bind a custom domain for site publishing.",status:"implemented",request_body_schema:"BindSiteDomainRequestSchema",response_schema:"BindSiteDomainResponseSchema",notes:["Returns 403 CUSTOM_DOMAIN_ENTITLEMENT_REQUIRED and never calls the downstream bind API when the site has no active subscription or subscription status cannot be confirmed."]},{method:"GET",path:"/sites/:site_id/domains/:hostname",tag:"custom-domains",summary:"Get DNS verification detail for a custom domain.",status:"implemented",response_schema:"GetSiteDomainDetailResponseSchema"},{method:"POST",path:"/sites/:site_id/domains/:hostname/verify",tag:"custom-domains",summary:"Refresh DNS verification status for a custom domain.",status:"implemented",response_schema:"VerifySiteDomainResponseSchema"},{method:"DELETE",path:"/sites/:site_id/domains/:hostname",tag:"custom-domains",summary:"Delete a non-primary custom domain.",status:"implemented",response_schema:"DeleteSiteDomainResponseSchema"},{method:"GET",path:"/admin/tenants",tag:"admin",summary:"Admin tenant listing.",status:"planned"},{method:"GET",path:"/usage/summary",tag:"usage",summary:"Summarize tenant usage and cost controls.",status:"planned"}],Oh=[{method:"POST",path:"/v1/agent/clarify/:site_id",tag:"clarify",summary:"Stream Step 2 clarify questions as SSE; event_order includes optional skill.selecting, skill.selected, clarify.archetype_proposals, and run.failed on errors.",status:"implemented",request_body_schema:"ClarifyRunInputSchema without tenant_id/site_id",event_schema:"ClarifyStreamEventSchema",event_order:["run.started","skill.selecting","skill.selected","clarify.partial","clarify.archetype_proposals","clarify.finished","run.failed"]},{method:"POST",path:"/v1/agent/sitemap/:site_id",tag:"sitemap",summary:"Stream Step 3 sitemap generation as SSE; event_order includes sitemap.partial and run.failed on errors.",status:"implemented",request_body_schema:"SitemapRunInputSchema public body without server-injected fields",event_schema:"SitemapStreamEventSchema",event_order:["run.started","sitemap.generating","sitemap.partial","sitemap.generated","sitemap.clamped","run.failed"]}],xm=e.object({id:e.string().min(1),role:e.enum(["system","user","assistant"]),metadata:e.unknown().optional(),parts:e.array(Qe).min(1)}),cs=xm.extend({role:e.literal("user")}),wh=e.object({base_snapshot_id:e.string().min(1).optional(),message:cs.optional(),client_run_key:e.string().min(1).max(200).optional()}).superRefine((t,n)=>{Ne(t.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),Im=e.object({path:e.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:e.string().min(1),base_snapshot_id:e.string().min(1),run_kind:nt}),Mh=e.object({agent_run:ie,websocket:Im,next_step:e.literal("workspace_socket")}),Lh=e.object({agent_run:ie}),Uh=e.object({agent_type:e.enum(["clarify","sitemap","workspace"])}),Fh=e.object({agent_run:ie}),Kh=e.enum(["client.message.create","client.run.cancel","client.tool.approve","server.run.started","server.user.message","server.assistant.delta","server.tool.started","server.tool.completed","server.workspace.suggestions","workspace.plan.created","workspace.worker.updated","workspace.task.updated","server.patch.applied","server.sitemap.updated","server.snapshot.created","server.snapshot.finalized","server.preview.invalidated","preview.build.started","preview.build.succeeded","preview.build.failed","server.run.finished","server.run.failed","server.error","server.activity.started","server.activity.updated","server.activity.finished","server.activity.failed"]),P=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),run_id:e.string().min(1).optional(),correlation_id:e.string().min(1).optional(),seq:e.number().int().positive().optional(),sent_at:e.string().min(1)}),Rm=e.object({key:e.string().min(1),label:e.string().min(1),source_file:e.string().min(1).optional(),component_name:e.string().min(1).optional(),opening_element_range:e.object({start_line:e.number().int().positive(),start_column:e.number().int().nonnegative(),end_line:e.number().int().positive(),end_column:e.number().int().nonnegative()}).optional(),structural_path:e.string().min(1).optional(),text_preview:e.string().min(1).optional()}),Tm=e.discriminatedUnion("type",[P.extend({type:e.literal("client.message.create"),payload:e.object({client_message_id:e.string().min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),selected_component:Rm.optional(),message:cs,base_snapshot_id:e.string().min(1).optional()})}),P.extend({type:e.literal("client.run.cancel"),payload:e.object({run_id:e.string().min(1),reason:e.string().min(1).optional()})}),P.extend({type:e.literal("client.tool.approve"),payload:e.object({tool_call_id:e.string().min(1),decision:e.enum(["approve","reject"]),reason:e.string().min(1).optional()})})]),km=e.discriminatedUnion("type",[P.extend({type:e.literal("server.run.started"),payload:e.object({run_id:e.string().min(1),agent_type:e.literal("workspace")})}),P.extend({type:e.literal("server.user.message"),payload:e.object({client_message_id:e.string().min(1),message_id:e.string().min(1),parts:e.array(Qe).min(1),in_reply_to_tool_call_id:e.string().min(1).optional()})}),P.extend({type:e.literal("server.assistant.delta"),payload:e.object({message_id:e.string().min(1),parts:e.array(Qe).min(1),status:e.enum(["streaming","ready"])})}),P.extend({type:e.literal("server.tool.started"),payload:e.object({tool_call_id:e.string().min(1),name:e.string().min(1),summary:e.string().min(1)})}),P.extend({type:e.literal("server.tool.completed"),payload:e.object({tool_call_id:e.string().min(1),name:e.string().min(1),result_summary:e.string().min(1)})}),P.extend({type:e.literal("server.workspace.suggestions"),payload:is.extend({run_id:e.string().min(1)}).strict()}),P.extend({type:e.literal("workspace.plan.created"),payload:e.object({plan_id:e.string().min(1),run_kind:nt,groups:e.array(Ht),tasks:e.array($t),dependencies:e.array(Yt),expected_outputs:e.array(B),diagnostics:Vt,summary:as})}),P.extend({type:e.literal("workspace.worker.updated"),payload:e.object({group_id:e.string().min(1),phase:zt,status:oe,task_counts:os,target_paths:e.array(B),diagnostics:e.array(e.string().min(1))})}),P.extend({type:e.literal("workspace.task.updated"),payload:e.object({task_id:e.string().min(1),group_id:e.string().min(1),status:oe,target_path:B,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(Wt).optional()})}),P.extend({type:e.literal("server.patch.applied"),payload:e.object({patch_batch_id:e.string().min(1),changed_files:e.array(e.string().min(1)),sitemap_resync_queued:e.boolean()})}),P.extend({type:e.literal("server.sitemap.updated"),payload:e.object({sitemap_id:e.string().min(1),version:e.number().int().positive(),reason:e.string().min(1)})}),P.extend({type:e.literal("server.snapshot.created"),payload:e.object({snapshot_id:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/)})}),P.extend({type:e.literal("server.snapshot.finalized"),payload:e.object({snapshot_id:e.string().min(1)})}),P.extend({type:e.literal("server.preview.invalidated"),payload:e.object({reason:e.string().min(1),next_preview_url:e.string().url().optional()})}),P.extend({type:e.literal("preview.build.started"),payload:e.object({snapshot_id:e.string().min(1)})}),P.extend({type:e.literal("preview.build.succeeded"),payload:e.object({snapshot_id:e.string().min(1)})}),P.extend({type:e.literal("preview.build.failed"),payload:e.object({snapshot_id:e.string().min(1),message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean()})}),P.extend({type:e.literal("server.run.finished"),payload:e.object({run_id:e.string().min(1),snapshot_id:e.string().min(1)})}),P.extend({type:e.literal("server.run.failed"),payload:e.object({run_id:e.string().min(1),error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),outcome:e.literal("retained_previous").optional()})}),P.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})}),P.extend({type:e.literal("server.activity.started"),payload:e.object({activity_id:e.string().min(1),parent_activity_id:e.string().min(1).optional(),kind:Hi,title:e.string().min(1).max(200),title_code:ne.optional(),detail:e.string().max(360).optional(),detail_code:ne.optional(),locks_input:e.boolean()})}),P.extend({type:e.literal("server.activity.updated"),payload:e.object({activity_id:e.string().min(1),title:e.string().min(1).max(200).optional(),title_code:ne.optional(),detail:e.string().max(360).optional(),detail_code:ne.optional()})}),P.extend({type:e.literal("server.activity.finished"),payload:e.object({activity_id:e.string().min(1)})}),P.extend({type:e.literal("server.activity.failed"),payload:e.object({activity_id:e.string().min(1),detail:e.string().max(360).optional()})})]),Gh=e.union([Tm,km]),qh={path:"/v1/workspace/sites/:site_id/socket",protocol:"ws",status:"implemented",inbound_message_schema:"WorkspaceClientMessageSchema",outbound_message_schema:"WorkspaceServerMessageSchema",query_parameters:[{name:"run_id",required:!1,schema:"string",summary:"Workspace run id returned by the API run-start response."},{name:"run_kind",required:!1,schema:"WorkspaceRunKindSchema",summary:"Workspace run mode; initial_generation can auto-start when base_snapshot_id is present."},{name:"base_snapshot_id",required:!1,schema:"string",summary:"Authoritative base snapshot id for this workspace run."}],ai_sdk_ui_compatible:!0,notes:["Assistant UI output is carried as AI SDK UIMessage parts, including text, data-*, and tool-* parts.","Operational AgentEvents remain persisted separately for replay and audit."]},ms=e.string().regex(/^sha256:[a-f0-9]{64}$/),Pm=e.enum(["create","update","delete","str_replace"]),ps=e.enum(["sitemap_resync","smoke_test","prepare_preview"]),Am=e.object({old_string:e.string().min(1).describe("Exact text to find in the current file. Must match the file uniquely; include enough surrounding context (usually 2-4 adjacent lines)."),new_string:e.string().describe("Replacement text. May be empty to delete the matched text."),replace_all:e.boolean().optional()}).strict(),Cm=e.object({path:B,operation:Pm,expected_hash:ms.optional(),full_content:e.string().describe("Complete file content for create/update patches. It is passed as a JSON string, so every double quote in source code must be valid JSON; avoid ASCII double quotes inside JSX attribute values and use corner quotes like \u300C\u751F\u65E5\u5FEB\u4E50\u300D for visitor-facing quoted examples.").optional(),edits:e.array(Am).min(1).max(20).optional()}).strict().superRefine((t,n)=>{let i=t.full_content!==void 0;if(t.operation==="delete"){i&&n.addIssue({code:"custom",path:["full_content"],message:"delete patches must not include full_content"}),t.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"});return}if(Gm(t.path)||n.addIssue({code:"custom",path:["path"],message:"Static App Router page paths must use lowercase ASCII kebab-case public segments."}),t.operation==="str_replace"){t.full_content!==void 0&&n.addIssue({code:"custom",path:["full_content"],message:"str_replace patches must not include full_content"}),(!t.edits||t.edits.length===0)&&n.addIssue({code:"custom",path:["edits"],message:"str_replace patches must include a non-empty edits array"});return}i||n.addIssue({code:"custom",path:["full_content"],message:"create/update patches must include full_content"}),t.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"})}),Dm=e.object({kind:e.enum(["block","page","site","chrome"]),id:e.string().min(1).max(120)}),vm=e.object({base_key:e.string().min(1).max(120).regex(/^[A-Za-z0-9._:-]+$/).refine(t=>!t.includes(".."),{message:"base_key must not contain '..'"}),owner:Dm,count:e.number().int().min(1).max(12),query:e.string().min(1).max(400),role:e.enum(["hero","section","card","gallery","testimonial","decorative","site_background","nav_background","footer_background"]),orientation:e.enum(["landscape","portrait","square"]).optional(),altHint:e.string().min(1).max(300)}),ds=e.object({site_id:e.string().min(1),base_snapshot_id:e.string().min(1),reason:e.string().min(1),patches:e.array(Cm).min(1),media_requests:e.array(vm).max(24).optional(),post_actions:e.array(ps).optional()});function ls(t,n){let i=new Set;for(let[o,r]of t.patches.entries())i.has(r.path)&&n.addIssue({code:"custom",path:["patches",o,"path"],message:`Duplicate patch path: ${r.path}`}),i.add(r.path)}var Bh=ds.superRefine(ls),zh=ds.omit({base_snapshot_id:!0}).extend({site_id:e.string().min(1).optional()}).superRefine(ls),Nm=K,jm=e.object({path:Nm,operation:e.enum(["upsert","delete"]).optional()}),us=e.enum(["sync_cms_pages","sync_cms_navigation"]),Wh=e.object({files:e.array(jm).min(1),post_actions:e.array(us).optional()}).strict().overwrite(t=>t.post_actions?{...t,post_actions:[...new Set(t.post_actions)]}:t),Om=e.enum(["BASE_SNAPSHOT_NOT_FOUND","PATCH_TARGET_NOT_FOUND","PATCH_TARGET_ALREADY_EXISTS","PATCH_EXPECTED_HASH_MISMATCH","PATCH_DIFF_UNSUPPORTED","PATCH_PROTECTED_FILE","PATCH_VALIDATION_FAILED","PATCH_MEDIA_REFERENCE_NOT_DECLARED","PATCH_BATCH_INVALID","PATCH_BATCH_FAILED","PATCH_BATCH_TOO_LARGE","STR_REPLACE_NOT_FOUND","STR_REPLACE_NOT_UNIQUE","STR_REPLACE_BINARY_FILE","STR_REPLACE_REQUIRES_READ"]),wm=e.object({status:e.literal("applied"),patch_batch_id:e.string().min(1),site_id:e.string().min(1),base_snapshot_id:e.string().min(1),snapshot_id:e.string().min(1),manifest_hash:ms,object_key:e.string().min(1),changed_files:e.array(B).min(1),post_actions_queued:e.array(ps),dropped_protected_files:e.array(e.string().min(1)).min(1).optional()}),Mm=e.object({status:e.literal("failed"),code:Om,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),Vh=e.discriminatedUnion("status",[wm,Mm]),Hh=e.object({ok:e.literal(!0),post_actions:e.array(e.object({action:us,status:e.enum(["succeeded","failed"])}).strict()).default([])}),gs=K,Lm=e.enum(["text","binary"]),hs=e.object({path:gs,kind:Lm,language:e.string().min(1).nullable(),size_bytes:e.number().int().nonnegative()}),$h=e.object({path:gs}),Um=hs.extend({kind:e.literal("text"),language:e.string().min(1),content:e.string()}),Fm=hs.extend({kind:e.literal("binary"),language:e.null(),mime_type:e.string().min(1),content_base64:e.string().min(1)}),Yh=e.union([Um,Fm]);function Ne(t){return typeof t=="string"?/authorization\s*:|bearer\s+|token\s*=|secret\s*=|api[_-]?key\s*=|access[_\s-]?key\s*=|\bsk-[a-z0-9_-]{20,}|eyJ[a-z0-9_-]{10,}\.[a-z0-9_-]{10,}\.[a-z0-9_-]{10,}/i.test(t):!t||typeof t!="object"?!1:Array.isArray(t)?t.some(n=>Ne(n)):Object.entries(t).some(([n,i])=>Km(n)||Ne(i))}function Km(t){let n=t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/\s+/g,"_").toLowerCase();return/(^|[_-])(authorization|token|secret|api[_-]?key|apikey|access[_-]?key|accesskey)([_-]|$)/.test(n)}function _s(t){let n=t.split("/");return t.length>0&&!t.startsWith("/")&&!t.includes("\\")&&n.every(i=>i!==""&&i!=="."&&i!=="..")}function Gm(t){let n=/^app\/(?:(.*)\/)?page\.(?:tsx|jsx)$/.exec(t);if(!n)return!0;let o=(n[1]??"").split("/").filter(m=>m.length>0);return o.some(m=>m.startsWith("_"))?!0:o.filter(m=>!m.startsWith("@")&&!/^\(.+\)$/.test(m)).map(m=>m.replace(/^\((?:\.|\.\.|\.\.\.)\)/,"")).filter(m=>m.length>0).every(m=>/^\[.*\]$/.test(m)||ye.test(`/${m}`))}var Ss=e.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),qm=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:e.string().min(1),sandbox_id:e.string().min(1).nullable(),status:Ss,source_snapshot_id:e.string().min(1).nullable(),last_snapshot_id:e.string().min(1).nullable(),preview_url:e.string().url().nullable(),last_activity_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Zh=e.object({session_id:e.string().min(1).optional(),sandbox_id:e.string().min(1).optional(),source_snapshot_id:e.string().min(1).optional(),last_snapshot_id:e.string().min(1),expected_current_snapshot_id:e.string().min(1).optional(),expected_ready_session_id:e.string().min(1).optional(),status:Ss,preview_url:e.string().url().optional()}),Xh=e.object({preview_session:qm,next_step:e.literal("preview")}),Qh=e.object({failed_count:e.number().int().nonnegative()}),Jh=e.object({site_id:e.string().min(1)}),e_=e.object({status:e.enum(["cancelled","no_active_run"]),agent_run:ie.nullable()});export{Ng as AbandonSiteSnapshotResponseSchema,Hi as ActivityKindSchema,ne as ActivityTitleCodeSchema,Ki as AgentErrorCategorySchema,Ot as AgentEventRecordSchema,rs as AgentEventSchema,ss as AgentEventTypeSchema,Bi as AgentModelRouteSchema,rm as AgentPlanStepSchema,qi as AgentRunKindSchema,ie as AgentRunRecordSchema,_c as AgentRunStatusSchema,Gi as AgentRunTypeSchema,gm as AiSdkUiDataPartSchema,_m as AiSdkUiErrorPartSchema,dm as AiSdkUiFilePartSchema,Qe as AiSdkUiMessagePartSchema,xm as AiSdkUiMessageSchema,pm as AiSdkUiReasoningPartSchema,um as AiSdkUiSourceDocumentPartSchema,lm as AiSdkUiSourceUrlPartSchema,Sm as AiSdkUiStepStartPartSchema,mm as AiSdkUiTextPartSchema,hm as AiSdkUiToolPartSchema,vh as ApiContractStatusSchema,Ec as ApiErrorEnvelopeSchema,U as ApiResponseSchema,Ph as AppendAgentEventRequestSchema,Ah as AppendAgentEventResponseSchema,Om as ApplyPatchBatchErrorCodeSchema,Mm as ApplyPatchBatchFailureSchema,Bh as ApplyPatchBatchInputSchema,Cm as ApplyPatchBatchPatchSchema,ps as ApplyPatchBatchPostActionSchema,Vh as ApplyPatchBatchResultSchema,wm as ApplyPatchBatchSuccessSchema,zh as ApplyPatchBatchToolInputSchema,Am as ApplyPatchEditSchema,Pm as ApplyPatchOperationSchema,Fi as ArchetypeProposalSchema,Mr as BINDING_STATUSES,ki as BindSiteDomainDataSchema,Du as BindSiteDomainRequestSchema,bg as BindSiteDomainResponseSchema,$i as BlockGenerationContextSchema,ah as BlockMediaIntentSchema,Mc as BlockSchema,Yi as BrandingSchema,Kt as BriefRecordSchema,yl as CHAT_COPY,fl as CLARIFICATION_COPY,fr as CMS_FORM_FIELD_TYPES,qp as COMPONENT_I18N_FILE_SUFFIX,Fe as COMPONENT_I18N_NAMESPACE,si as CURRENT_EDIT_ENGINE_VERSION,Cu as CUSTOM_DOMAIN_ENTITLEMENT_REQUIRED_ERROR_CODE,Kr as CUSTOM_DOMAIN_STATUSES,Jh as CancelActiveWorkspaceRunRequestSchema,e_ as CancelActiveWorkspaceRunResponseSchema,Zi as ChromeDesignSchema,Oc as ChromeFooterDesignSchema,jc as ChromeFooterShellSchema,vc as ChromeHeaderDesignSchema,Dc as ChromeHeaderShellSchema,wc as ChromeMobileNavDesignSchema,pc as ClarifyQuestionOptionSchema,dc as ClarifyQuestionSchema,rc as ClarifyQuestionTypeSchema,Ut as ClarifyQuestionsSchema,Hu as ClarifyRunInputSchema,tm as ClarifySessionRecordSchema,$u as ClarifyStreamEventSchema,xu as CmsCollectionBindingSchema,_i as CmsFormSchemaProjectionSchema,Og as CompleteSiteSnapshotDeletionResponseSchema,zp as ComponentI18nResourcesSchema,$l as ConnectDynamicCollectionInputSchema,Xl as ConnectFormInputSchema,Mt as ConversionHintsSchema,ih as CreateAgentRunConflictResponseSchema,kg as CreateAgentRunRequestSchema,Pg as CreateAgentRunResponseSchema,Yg as CreateDeploymentRequestSchema,Zg as CreateDeploymentResponseSchema,Xm as CreateDocumentUploadRequestSchema,ip as CreateImageUploadRequestSchema,Vm as CreateInputSourceRequestSchema,tg as CreateSiteBriefRequestSchema,Ig as CreateSiteBriefResponseSchema,ng as CreateSiteDraftRequestSchema,eg as CreateSiteInputSchema,Is as CreateTextInputSourceRequestSchema,Rs as CreateUrlInputSourceRequestSchema,Xg as CurrentDeploymentResponseSchema,qr as CustomDomainDnsRecordPurposeSchema,zr as CustomDomainDnsRecordSchema,Br as CustomDomainDnsRecordStatusSchema,Gr as CustomDomainStatusSchema,Vr as DEFAULT_FONTS,Hs as DEFAULT_SITE_LOCALE,$g as DEPLOYMENT_ENTITLEMENT_REQUIRED_ERROR_CODE,yc as DEPLOYMENT_REALTIME_CHANNEL,Zt as DEPLOYMENT_STATUSES,nh as DEPLOYMENT_WEBSOCKET_CONTRACT,Tp as DESIGNER_COMPONENT_LIBRARY_ERROR_CODES,Op as DESIGNER_PAGE_LIBRARY_ERROR_CODES,Hm as DOCUMENT_EXTENSION_WHITELIST,$m as DOCUMENT_MIME_WHITELIST,Wr as DefaultPublishDomainSchema,Ci as DeleteSiteDomainDataSchema,Eg as DeleteSiteDomainResponseSchema,jg as DeleteSiteSnapshotResponseSchema,et as DeploymentRecordSchema,th as DeploymentRedisPubSubEventSchema,Gt as DeploymentStatusSchema,wi as DeploymentStatusSummarySchema,eh as DeploymentWsServerMessageSchema,fc as DeploymentWsServerMessageTypeSchema,am as DesignPlanGenerationOutcomeSchema,om as DesignPlanGenerationReasonSchema,ch as DesignPlanPatchSchema,nm as DesignPlanRecordSchema,Xi as DesignPlanSchema,sh as DesignTokensSchema,oa as DesignerComponentCatalogItemSchema,ln as DesignerComponentCategoriesDataSchema,dn as DesignerComponentCategoryNodeSchema,be as DesignerComponentExactVersionSchema,gn as DesignerComponentInstallDataSchema,un as DesignerComponentsDataSchema,ca as DesignerPageCatalogItemSchema,Sn as DesignerPageCategoriesDataSchema,_n as DesignerPageCategoryNodeSchema,fe as DesignerPageExactVersionSchema,fn as DesignerPageInstallDataSchema,En as DesignerPageResourcePreparationDataSchema,ha as DesignerPageResourceTemplateSchema,re as DesignerPageResourceTypeSchema,bn as DesignerPagesDataSchema,_a as DesignerSitePageSchema,xn as DesignerSitePagesDataSchema,ma as DesignerSiteRouteIdSchema,xl as EDIT_ENGINE_VERSION_HEADER,Il as EDIT_ENGINE_VERSION_SOURCE_HEADER,Sl as ERROR_COPY,xt as EditEngineVersionParseError,In as EnhanceDesignerPageResourceBodySchema,hg as EnhanceDesignerPageResourceResponseSchema,og as ExternalSyncSiteRequestSchema,_g as ExternalSyncSiteResponseSchema,ys as ExtractedFactKindSchema,je as ExtractedFactSchema,er as FIELD_TYPES,nc as FONT_PAIRINGS,vr as FORM_DESIGN_ERROR_CODES,Dr as FORM_DESIGN_FAILURE_STAGES,Ar as FORM_DESIGN_OPERATION_STAGES,Cr as FORM_DESIGN_OPERATION_STATUSES,Pe as FORM_FIELD_TYPES,yr as FORM_SPEC_FIELD_TYPE_TO_CMS,ci as FORM_SPEC_MULTISTEP_MIN_RUNTIME_VERSION,_r as FORM_TEMPLATE_CATEGORY_COUNTS,gi as FORM_TEMPLATE_CATEGORY_SLUGS,Qh as FailStaleInFlightWorkspaceRunsResponseSchema,ri as FieldDeclSchema,Nc as FooterShellSurfaceSchema,ir as FormBlockIdSchema,$e as FormDefinitionIdSchema,Tr as FormDesignAffectedFilesSchema,Dt as FormDesignErrorCodeSchema,hu as FormDesignErrorSchema,fi as FormDesignFailureStageSchema,C as FormDesignHashSchema,cu as FormDesignOpenResponseSchema,kr as FormDesignOperationFingerprintInputSchema,Rt as FormDesignOperationIdSchema,yi as FormDesignOperationNextActionSchema,uu as FormDesignOperationRecordSchema,vt as FormDesignOperationResponseSchema,xi as FormDesignOperationSchema,Ct as FormDesignOperationStageSchema,bi as FormDesignOperationStatusSchema,gu as FormDesignOperationTransitionRequestSchema,Ei as FormDesignPreviewRefreshStatusSchema,pu as FormDesignQueryResponseSchema,du as FormDesignResumeRequestSchema,lu as FormDesignResumeResponseSchema,Pr as FormDesignSaveRequestSchema,mu as FormDesignSaveResponseSchema,Si as FormDesignSharedImpactSchema,At as FormDesignStandardizationSchema,tr as FormFieldDeclSchema,Ce as FormFieldNameSchema,Tt as FormOptionValueSchema,sr as FormSpecBindingSchema,or as FormSpecFieldNodeSchema,cr as FormSpecNodeSchema,ar as FormSpecOptionSchema,rr as FormSpecStepBreakNodeSchema,Pt as FormSpecV1Schema,au as FormTemplateCatalogResponseSchema,hi as FormTemplateCategorySlugSchema,Sr as FormTemplateCategoryV1Schema,te as FormTemplateTextSchema,br as FormTemplateV1Schema,Qg as GetDeploymentResponseSchema,Jg as GetDeploymentsStatusResponseSchema,Ai as GetSiteDomainDetailDataSchema,yg as GetSiteDomainDetailResponseSchema,Ri as GetSitePlanDataSchema,xg as GetSitePlanResponseSchema,Gl as GetTemplateUpgradeReportQuerySchema,ql as GetTemplateUpgradeReportResponseSchema,Ac as HeaderShellBehaviorSchema,Cc as HeaderShellShapeSchema,Pc as HeaderShellSurfaceSchema,kc as HeaderShellVariantSchema,Jm as IMAGE_EXTENSION_WHITELIST,ep as IMAGE_MIME_WHITELIST,pn as INSERT_NEW_COMPONENT_CATEGORY_GROUP_KEY,hn as INSERT_NEW_PAGE_CATEGORY_GROUP_KEY,$s as ISO_639_3_TO_SITE_LOCALE,Ts as ImageRoleSchema,cs as InboundUserMessageSchema,fs as InputBundleStatusSchema,we as InputConflictSchema,sp as InputContextBundleSchema,xs as InputSourceSchema,at as InputSourceStatusSchema,st as InputSourceTypeSchema,Dl as InspectTemplateUpgradeStateRequestSchema,vl as InspectTemplateUpgradeStateResponseSchema,Cp as InstallDesignerComponentBodySchema,mg as InstallDesignerComponentResponseSchema,Lp as InstallDesignerPageBodySchema,lg as InstallDesignerPageResponseSchema,qs as LEGACY_SITE_LOCALE_CODES,Uh as LatestAgentRunQuerySchema,Fh as LatestAgentRunResponseSchema,Lh as LatestWorkspaceRunResponseSchema,Dh as ListAgentEventsQuerySchema,Ch as ListAgentEventsResponseSchema,rg as ListDesignerComponentCategoriesResponseSchema,Ap as ListDesignerComponentsQuerySchema,cg as ListDesignerComponentsResponseSchema,pg as ListDesignerPageCategoriesResponseSchema,wp as ListDesignerPagesQuerySchema,dg as ListDesignerPagesResponseSchema,gg as ListDesignerSitePagesResponseSchema,Ti as ListSiteDomainsDataSchema,Sg as ListSiteDomainsResponseSchema,zg as ListSiteVersionsResponseSchema,Bl as ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema,zl as ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema,Zm as MAX_DOCUMENT_SOURCES_PER_SITE,Ym as MAX_DOCUMENT_UPLOAD_BYTES,np as MAX_IMAGE_SOURCES_PER_SITE,tp as MAX_IMAGE_UPLOAD_BYTES,rh as MediaAssetSchema,Rc as MediaAttributionSchema,Dm as MediaRequestOwnerSchema,Pp as MockDesignerComponentInsertDataSchema,kp as MockDesignerComponentInsertRequestSchema,Lt as MotionLevelSchema,Zr as NEXT_FONT_DISPLAY_NAMES,ve as NEXT_FONT_REGISTRY,ye as PAGE_SLUG_PATTERN,ce as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,pt as PageResourceArtifactSchema,la as PageResourceComponentReferenceSchema,ua as PageResourceComponentSchema,da as PageResourceDraftPageSchema,Mp as PageResourceDraftSchema,Le as PageResourceFinalRouteSchema,ga as PageResourcePageSchema,pa as PageResourcePageSelectionSchema,yn as PageResourceRouteMappingSchema,Qi as PageSchema,Lc as PageSlugSchema,yh as PersistClarifyAnswersRequestSchema,Eh as PersistClarifyAnswersResponseSchema,Zh as PersistPreviewSessionRequestSchema,Xh as PersistPreviewSessionResponseSchema,Ih as PersistSiteDesignPlanRequestSchema,Rh as PersistSiteDesignPlanResponseSchema,bh as PersistSiteSitemapRequestSchema,fh as PersistSiteSitemapResponseSchema,Ag as PersistSiteSnapshotRequestSchema,Cg as PersistSiteSnapshotResponseSchema,oc as PositioningPrefillSchema,jt as PositioningSourceSchema,Up as PrepareDesignerPageBodySchema,ug as PrepareDesignerPageResponseSchema,Cl as PrepareTemplateUpgradeStateRequestSchema,Ho as PrepareTemplateUpgradeStateResponseSchema,Vg as PrepareVersionPreviewRequestSchema,Hg as PrepareVersionPreviewResponseSchema,vg as PromoteSiteSnapshotRequestSchema,Sc as PromoteSiteSnapshotResponseSchema,qg as PromoteTemplateUpgradeSnapshotRequestSchema,Bg as PromoteTemplateUpgradeSnapshotResponseSchema,Fr as PublishEntitlementSchema,Lr as PublishPlanFeatureSnapshotSchema,Ur as PublishPlanSchema,bl as REFUSAL_COPY,jh as REST_API_ENDPOINTS,wg as RecordSnapshotVersionRequestSchema,Mg as RecordSnapshotVersionResponseSchema,Fl as RecordTemplateUpgradeEventRequestSchema,Kl as RecordTemplateUpgradeEventResponseSchema,Nl as RecordTemplateUpgradeFailureRequestSchema,jl as RecordTemplateUpgradeFailureResponseSchema,Ol as RecordTemplateUpgradeSuccessRequestSchema,wl as RecordTemplateUpgradeSuccessResponseSchema,Es as ReferencePagePatternSchema,Oe as ReferenceSignalsSchema,Fg as ReleaseTemplateUpgradeLockRequestSchema,Kg as ReleaseTemplateUpgradeLockResponseSchema,Hl as ResolvedFieldSchema,Ql as ResolvedFormFieldSchema,Nh as RestApiMethodSchema,Wg as RestoreSiteSnapshotResponseSchema,Vi as RouteGenerationCardSchema,Se as SELECTABLE_SITE_LOCALE_CODES,wd as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,Qs as SITE_EDIT_MATERIALIZATION_MAX_FILE_CONTENT_BYTES,Xs as SITE_EDIT_MATERIALIZATION_MAX_FILE_COUNT,Js as SITE_EDIT_MATERIALIZATION_MAX_TOTAL_CONTENT_BYTES,Ln as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,gd as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,Oo as SITE_EDIT_RUNTIME_CONTAINER_TAGS,wo as SITE_EDIT_RUNTIME_TEXT_TAGS,jo as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,od as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,Ps as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,Xt as SITE_EDIT_SOURCE_ALLOWED_DIRS,ks as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,ot as SITE_EDIT_SOURCE_DELETE_CAPABILITY,As as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,Bs as SITE_LOCALE_CODES,Qu as SITE_PLANNING_FROZEN_ERROR_CODE,Ju as SITE_PLANNING_LOCKED_ERROR_CODE,Oh as SSE_STREAMS,gp as SUPPORTED_SITE_LOCALES,qm as SandboxSessionSchema,Ss as SandboxSessionStatusSchema,ag as SaveBriefDraftRequestSchema,Tg as SaveBriefDraftResponseSchema,De as SiteCustomDomainSchema,Wi as SiteDesignContextSchema,cc as SiteDesignDensitySchema,mc as SiteDesignMotionLevelSchema,qe as SiteEditBoundaryKindSchema,Ia as SiteEditCapabilityConstraintSchema,Ea as SiteEditCapabilityModeSchema,Ge as SiteEditCapabilityModeViewSchema,ka as SiteEditClassNameSourceDiagnosticSchema,ae as SiteEditClassNameSourceRangeSchema,Nn as SiteEditClassNameSourceSchema,Jp as SiteEditClassNameSourceStyleContextSchema,vn as SiteEditClassNameSourceStylesheetSchema,lt as SiteEditClassNameSourceWriteIntentSchema,Yp as SiteEditCommandDiagnosticSchema,Ra as SiteEditCommandErrorSchema,xa as SiteEditConstraintKindSchema,Ro as SiteEditDynamicConfidenceSchema,ko as SiteEditDynamicDataBindingSchema,Qn as SiteEditDynamicDataDetailSchema,Jn as SiteEditDynamicDataSummarySchema,To as SiteEditDynamicEvidenceSchema,Xn as SiteEditDynamicSourceKindSchema,xo as SiteEditDynamicSourceTypeSchema,Io as SiteEditDynamicTargetKindSchema,Co as SiteEditEffectiveWriteTargetSchema,ut as SiteEditElementPropertySchema,Nd as SiteEditEventSchema,bt as SiteEditExternalSourceKindSchema,td as SiteEditGetClassNameSourceCommandResultSchema,ed as SiteEditGetClassNameSourceResultSchema,po as SiteEditHistoryReadOnlyRecoveryStatusSchema,oo as SiteEditHistoryRecoveryCodeSchema,ro as SiteEditHistoryRecoveryDiagnosticSchema,Md as SiteEditHistoryStatusModeSchema,Ld as SiteEditHistoryStatusSchema,co as SiteEditHistoryUnavailableReasonSchema,lo as SiteEditHistoryUnavailableStatusSchema,mo as SiteEditHistoryWritableStatusSchema,hl as SiteEditInitializeSessionInputSchema,eo as SiteEditInsertNodeSpecSchema,io as SiteEditInsertPageResourceOutputSchema,aa as SiteEditMaterializationDataRequirementsSchema,sa as SiteEditMaterializationEntrySchema,ia as SiteEditMaterializationExportSchema,na as SiteEditMaterializationFileSchema,mn as SiteEditMaterializationPathTemplateSchema,se as SiteEditMaterializationSchema,Kn as SiteEditMoveTargetSchema,Ee as SiteEditMutationContextSchema,Be as SiteEditNodeCapabilitySnapshotSchema,il as SiteEditObjectCapabilitiesSchema,al as SiteEditObjectDetailSchema,rl as SiteEditObjectEditContextSchema,cl as SiteEditObjectStyleDetailSchema,ol as SiteEditObjectSummarySchema,Pd as SiteEditOperationCommandResultSchema,Wn as SiteEditOperationErrorCodeSchema,Vn as SiteEditOperationErrorSchema,so as SiteEditOperationOutputSchema,to as SiteEditOperationParamsSchema,_t as SiteEditOperationPayloadSchema,no as SiteEditOperationRequestSchema,Hn as SiteEditOperationSelectionRefSchema,Eo as SiteEditOperationSummarySchema,Gn as SiteEditOperationTargetSchema,Re as SiteEditOperationTypeSchema,Fn as SiteEditOperationValueSchema,hd as SiteEditPageCompositionAnyVersionSchema,Ua as SiteEditPageCompositionAtomicKindSchema,qa as SiteEditPageCompositionBoundaryModeSchema,va as SiteEditPageCompositionBusinessMemberSchema,Ca as SiteEditPageCompositionContainerSchema,Ie as SiteEditPageCompositionDiagnosticSchema,We as SiteEditPageCompositionErrorCodeSchema,wn as SiteEditPageCompositionPlacementTargetSchema,Na as SiteEditPageCompositionPlacementUnitSchema,Ma as SiteEditPageCompositionRuntimeRefSchema,wa as SiteEditPageCompositionSchema,La as SiteEditPageCompositionSourceMemberKindSchema,Da as SiteEditPageCompositionSourceMemberSchema,Un as SiteEditPageCompositionSourceRangeSchema,ja as SiteEditPageCompositionSupportedSchema,Oa as SiteEditPageCompositionUnsupportedSchema,Ga as SiteEditPageCompositionV2BusinessMemberSchema,Fa as SiteEditPageCompositionV2ContainerSchema,za as SiteEditPageCompositionV2PlacementRelationSchema,Va as SiteEditPageCompositionV2PlacementSchema,Ba as SiteEditPageCompositionV2PlacementUnitSchema,Za as SiteEditPageCompositionV2Schema,Ka as SiteEditPageCompositionV2SourceMemberSchema,$a as SiteEditPageCompositionV2SupportedSchema,Ya as SiteEditPageCompositionV2UnsupportedSchema,Wa as SiteEditPageCompositionV2WriteModeSchema,Ha as SiteEditPageCompositionVisualAnchorSchema,On as SiteEditPagePlacementOptionSchema,ht as SiteEditPagePlacementSchema,Mn as SiteEditPageUnitTargetSchema,ho as SiteEditPatchPlanPatchSchema,Kd as SiteEditPatchPlanSchema,ke as SiteEditProvenanceChainSchema,Do as SiteEditProvenanceHopSchema,nl as SiteEditRenderDocumentSchema,Te as SiteEditRenderEntryRefSchema,Po as SiteEditRenderEntrySchema,Zn as SiteEditRenderPageCompositionSchema,fo as SiteEditRenderPageCompositionSupportedSchema,yo as SiteEditRenderPageCompositionUnsupportedSchema,bo as SiteEditRenderPagePlacementSchema,rd as SiteEditRequiredMutationContextEnvelopeSchema,Ls as SiteEditResolveSourceLocationInputSchema,ti as SiteEditSemanticSourceSchema,kd as SiteEditSignedOperationRequestSchema,Qt as SiteEditSourceDeleteCapabilitySchema,Ds as SiteEditSourceDirectoryPathSchema,ws as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,Ms as SiteEditSourceFileBinaryResponseSchema,rp as SiteEditSourceFileKindSchema,vs as SiteEditSourceFileListItemSchema,mp as SiteEditSourceFileResponseSchema,Os as SiteEditSourceFileTextResponseSchema,gt as SiteEditSourceIdentitySchema,Us as SiteEditSourceLocationRangeSchema,pp as SiteEditSourceLocationSchema,No as SiteEditSourceLocatorRangeSchema,yt as SiteEditSourceLocatorSchema,K as SiteEditSourcePathSchema,Jt as SiteEditSourceTreeNodeSchema,cp as SiteEditSourceTreeResponseSchema,Ns as SiteEditSourceTreeTruncationReasonSchema,js as SiteEditSourceTreeTruncationSchema,zn as SiteEditStyleBreakpointSchema,sl as SiteEditStyleModelSchema,qn as SiteEditStylePropertySchema,ni as SiteEditStyleSourceSchema,Bn as SiteEditStyleStateModeSchema,ft as SiteEditTextSegmentSchema,ei as SiteEditTextSourceSchema,Ao as SiteEditWriteTargetSchema,gc as SiteGenerationStateSchema,W as SiteLocaleSchema,oh as SiteMediaIntentSchema,ge as SiteRecordSchema,lc as SiteStatusSchema,bc as SiteVersionListItemSchema,Je as SiteVersionRecordSchema,uh as SitemapAddBlockInputSchema,Bt as SitemapAnswerSchema,dh as SitemapChangeBlockVariantInputSchema,Wc as SitemapDeleteBlockInputSchema,zc as SitemapEditActorSchema,$c as SitemapEditErrorCodeSchema,Zc as SitemapEditFailureSchema,Hc as SitemapEditOperationSchema,hh as SitemapEditResultSchema,Yc as SitemapEditSuccessSchema,Xc as SitemapGenerationOutcomeSchema,Qc as SitemapGenerationReasonSchema,es as SitemapGenerationStageSchema,mh as SitemapModelOutputSchema,qc as SitemapModelPageSchema,ph as SitemapMoveBlockInputSchema,Kc as SitemapNavigationHrefSchema,em as SitemapRecordSchema,_h as SitemapRunInputSchema,tt as SitemapSchema,Sh as SitemapStreamEventSchema,Vc as SitemapUpdateBlockInstructionInputSchema,lh as SitemapUpdateBlockPropsInputSchema,Ic as SitemapUserChoiceSchema,he as SkillSelectionSchema,Tc as SkillSelectionSourceSchema,ms as SnapshotContentHashSchema,B as SnapshotFilePathSchema,Q as SnapshotRecordSchema,zi as SnapshotStatusSchema,wh as StartWorkspaceRunRequestSchema,Mh as StartWorkspaceRunResponseSchema,Gg as TEMPLATE_UPGRADE_LOCK_LOST_ERROR_CODE,ic as THEME_PRESETS,Xo as TemplateUpgradeCasOutcomeSchema,ai as TemplateUpgradeErrorCodeSchema,Qo as TemplateUpgradeOutcomeCountsSchema,Yo as TemplateUpgradeOutcomeSchema,Jo as TemplateUpgradeSnapshotDeletionCandidateSchema,pe as TemplateUpgradeStateSchema,Wo as TemplateUpgradeStatusSchema,Zo as TemplateUpgradeValidationStageSchema,V as TemplateVersionSchema,Lg as TryAcquireTemplateUpgradeLockRequestSchema,Ug as TryAcquireTemplateUpgradeLockResponseSchema,sg as UpdateBriefRequestSchema,Rg as UpdateBriefResponseSchema,xh as UpdateClarifyArchetypeRequestSchema,Dg as UpdateCurrentSnapshotManifestRequestSchema,ig as UpdateSiteRequestSchema,Pi as VerifySiteDomainDataSchema,fg as VerifySiteDomainResponseSchema,wt as VisualHintsSchema,xc as VisualThemeSchema,qh as WORKSPACE_WEBSOCKET_CONTRACT,Tm as WorkspaceClientMessageSchema,sc as WorkspaceDesignApplyRequestSchema,ac as WorkspaceDesignApplyResponseSchema,Wt as WorkspaceDiagnosticSchema,jm as WorkspaceDirectEditFileSchema,Nm as WorkspaceDirectEditPathSchema,us as WorkspaceDirectEditPostActionSchema,Wh as WorkspaceDirectEditRequestSchema,Hh as WorkspaceDirectEditResponseSchema,Vt as WorkspaceExecutionDiagnosticsSchema,Th as WorkspaceExecutionPlanSchema,vm as WorkspaceMediaRequestSchema,Yt as WorkspacePlanDependencySchema,as as WorkspacePlanSummarySchema,cm as WorkspacePlanTaskKindSchema,$t as WorkspacePlanTaskSchema,nt as WorkspaceRunKindSchema,Rm as WorkspaceSelectedComponentSchema,km as WorkspaceServerMessageSchema,gh as WorkspaceSitemapEditRequestSchema,Im as WorkspaceSocketDescriptorSchema,Fm as WorkspaceSourceFileBinaryResponseSchema,Lm as WorkspaceSourceFileKindSchema,hs as WorkspaceSourceFileListItemSchema,$h as WorkspaceSourceFilePathQuerySchema,Yh as WorkspaceSourceFileResponseSchema,Um as WorkspaceSourceFileTextResponseSchema,gs as WorkspaceSourcePathSchema,im as WorkspaceSuggestionSchema,is as WorkspaceSuggestionsSchema,sm as WorkspaceSuggestionsSourceSchema,os as WorkspaceTaskCountsSchema,Gh as WorkspaceWebSocketMessageSchema,Kh as WorkspaceWebSocketMessageTypeSchema,Ht as WorkspaceWorkerGroupSchema,zt as WorkspaceWorkerPhaseSchema,kh as WorkspaceWorkerResultSchema,oe as WorkspaceWorkerStatusSchema,Zu as assertSiteGenerationStateTransition,Yu as assertSiteStatusTransition,wr as canonicalizeFormDesignJson,kn as canonicalizePageSlug,fp as compareTemplateVersions,qd as composeSiteEditRepeatInstanceKey,fu as computeFormDesignOperationFingerprint,Aa as computeSiteEditSourceIdentityKey,Ne as containsSensitiveData,Ta as createSiteEditCommandFailureSchema,Dn as createSiteEditCommandResultSchema,dt as createSiteEditCommandSuccessSchema,Nt as fontStack,Or as formDesignOperationFingerprintInput,ct as getSiteEditSourceDeleteProtectionReason,bu as hashAffectedFormDesignFiles,Su as hashCmsFormSchemaProjection,Ye as hashFormDesignJson,_u as hashFormSpec,Rn as isCanonicalPageSlug,Qm as isConsentGranted,Bo as isExactEditEngineVersion,ta as isSiteEditMaterializationPathTemplate,Ko as isSiteEditRuntimeContainerTag,Go as isSiteEditRuntimeTextTag,pl as isSiteEditRuntimeVoidElementTag,dp as isSiteEditSourceDeleteProtectedPath,Fs as isSiteEditSourceDirectoryPath,en as isSiteEditSourcePath,rt as isSiteEditTextSourcePath,_o as makeSiteEditRepeatInstanceKey,Ru as normalizeCmsPublicApiBase,ba as pageSlugToRouteFilePath,Bp as parseComponentI18nResourcesJson,zo as parseExactEditEngineVersion,So as parseSiteEditRepeatInstanceKey,pd as parseSiteEditSourceIdentityKey,ru as projectFormSpecToCmsSchema,Hr as resolveFont,Yr as resolveFontDisplayName,ou as resolveFormTemplateText,Xu as resolveGenerationStateForRunLifecycle,Bm as resolveRedisConnectionConfig,Rl as resolveRequestedEditEngineVersion,on as resolveSelectableSiteLocale,dl as resolveSiteEditRuntimeOperationSummary,_p as resolveSiteLocaleFromIso6393,hp as resolveSiteTextDirection,Tl as resolveSystemCurrentEditEngineVersion,tc as siteFontVariables,Bd as stripSiteEditRepeatInstanceKeys,Tn as tryCanonicalizeAsciiPageSlug,Cn as validateComponentI18nResources,su as validateFormSpecIdentityTransition};