@vcp-dev/contracts 0.7.2 → 0.8.0
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";import{z as ym}from"zod";var G=ym.uuidv7(),ss=G,Kb=G,zb=G,Bb=G,Wb=G,Vb=G,$b=G,I=G,ut=G,$i=G,ke=G,is=G,x=G,Hi=G,V=G,Yi=G,pn=G,Fe=G,Hb=G,Yb=G,Xi=G,Oe=G,Zi=G,Xb=G,Zb=G,Qb=G,nt=G,Jb=G,ey=G,ty=G;import{z as dn}from"zod";var Qi=dn.object({primary_products:dn.string().trim().min(1).max(1e3).optional(),current_markets:dn.string().trim().min(1).max(1e3).optional(),qualifications:dn.string().trim().min(1).max(1e3).optional()}).strict();function iy(t){return Object.values(t).some(n=>typeof n=="string"&&n.trim().length>0)}import{z as vt}from"zod";import{z as as}from"zod";var M=t=>as.object({code:as.number().int(),data:t,message:as.string()});var gt=2e3,xm=vt.object({note:vt.string().trim().max(gt),updated_at:vt.string().min(1)}).strict(),ly=vt.object({note:vt.string().trim().max(gt)}).strict(),py=M(xm.nullable());import{z as Ct}from"zod";var Em=40,st=Ct.object({protocol:Ct.enum(["phone","form","download","route","external"]),ctaLabel:Ct.string().min(1).max(Em),ctaTarget:Ct.string().min(1).max(200).optional(),requiresOwnerDetail:Ct.boolean().optional()});var _t=["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 _y(t){let n=t.VCP_REDIS_URL??t.REDIS_URL;if(n){let s=new URL(n);return{url:n,host:s.hostname,port:s.port?Number(s.port):6379,password:s.password?decodeURIComponent(s.password):void 0}}return{host:t.VCP_REDIS_HOST??"127.0.0.1",port:Im(t.VCP_REDIS_PORT,56379)}}function Im(t,n){if(!t)return n;let s=Number(t);return Number.isInteger(s)&&s>0?s:n}import{z as H}from"zod";var ea=G,Ji=200,Rm=4e3,ta=H.enum(["succeeded","degraded","no_changes","failed"]),Dt=H.enum(["typecheck_unresolved","step_cap_reached","partial_apply_gave_up","patch_protected_dropped","preview_build_failed","preview_runtime_degraded","build_not_verified","external_blocked","cms_reconcile_failed","run_expired","sandbox_unavailable"]),Tm=["sandbox_unavailable"];function by(t){return t!=null&&Tm.includes(t)}var km=H.enum(["pending","delivered","failed"]),Pm=H.enum(["running","succeeded","degraded","no_changes","failed"]),yy=H.object({site_id:I,external_run_id:H.string().min(1).max(Ji),external_thread_id:H.string().min(1).max(Ji),prompt:H.string().min(1).max(Rm)}).strict(),na=H.object({id:ea,site_id:I,external_run_id:H.string().min(1),external_thread_id:H.string().min(1),status:Pm,outcome:ta.nullable(),degraded_reason:Dt.nullable(),vcp_run_id:V.nullable(),base_snapshot_id:x,snapshot_id:x.nullable(),preview_url:H.string().url().nullable(),summary:H.string().nullable(),error_code:H.string().nullable(),build_verified:H.boolean().nullable(),callback_status:km,created_at:H.string().min(1),started_at:H.string().min(1).nullable(),finished_at:H.string().min(1).nullable()}).strict(),xy=H.object({task:na}).strict(),Ey=H.object({task:na}).strict(),Iy=H.object({task_id:ea,external_run_id:H.string().min(1),external_thread_id:H.string().min(1),site_id:I,vcp_run_id:V.nullable(),outcome:ta,degraded_reason:Dt.nullable(),snapshot_id:x.nullable(),preview_url:H.string().url().nullable(),summary:H.string().nullable(),error_code:H.string().nullable(),build_verified:H.boolean().nullable(),retryable:H.boolean(),finished_at:H.string().min(1)}).strict(),Ry=H.object({received:H.literal(!0)}).strict();import{z as D}from"zod";var os=D.enum(["text","url","document","image"]),rs=D.enum(["pending","ready","failed"]),wm=D.enum(["pending","ready","failed"]),Am=D.enum(["product","price","contact","copy","audience","other"]),un=D.object({fact:D.string().min(1).max(300),kind:Am,source_id:nt,quote:D.string().min(1).max(500),trust:D.enum(["verbatim","ocr"]).default("verbatim")}),vm=D.object({page_type:D.string().min(1).max(40),sections:D.array(D.string().min(1).max(40)).max(12)}),gn=D.object({source_id:nt,nav_structure:D.array(D.string().min(1).max(30)).max(12),page_patterns:D.array(vm).max(10),tone:D.array(D.string().min(1).max(20)).max(8),screenshot_ref:D.string().optional()}),Cm=D.object({source_id:nt,type:os,status:rs,title:D.string().max(120).optional(),original_ref:D.string().min(1),source_metadata:D.record(D.string(),D.unknown()),error_code:D.string().optional(),submitted:D.boolean().optional()}),_n=D.object({topic:D.string().min(1).max(80),variants:D.array(D.object({value:D.string().min(1).max(300),source_id:nt})).min(2)}),Dm=D.object({type:D.literal("text"),content:D.string().min(20).max(1e4),title:D.string().min(1).max(120).optional()}).strict(),jm=D.object({type:D.literal("url"),url:D.string().url().max(2048),rights_ack:D.boolean().optional(),title:D.string().min(1).max(120).optional()}).strict(),wy=D.discriminatedUnion("type",[Dm,jm]),Ay=[".docx",".html",".md",".txt"],vy=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],Cy=10*1024*1024,Dy=2,jy=D.object({consent_cross_border:D.union([D.literal(!0),D.literal("true")]),consent_text_version:D.string().min(1).max(120),title:D.string().min(1).max(120).optional()}).strict();function Oy(t){return t===!0||t==="true"}var Ny=[".png",".jpg",".jpeg",".webp"],Ly=["image/png","image/jpeg","image/webp","application/octet-stream"],My=8*1024*1024,Uy=10,Om=D.enum(["asset","reference"]),Fy=D.object({image_role:Om,title:D.string().min(1).max(120).optional()}).strict(),qy=D.object({version:D.literal(1),site_id:I,tenant_id:D.string().min(1),user_prompt:D.string(),status:wm,sources:D.array(Cm).max(16),facts:D.array(un).max(120),reference:gn.optional(),conflicts:D.array(_n).max(20)}).superRefine((t,n)=>{let s=new Map(t.sources.map(a=>[a.source_id,a]));for(let[a,i]of t.facts.entries()){let r=s.get(i.source_id);(!r||r.type==="url")&&n.addIssue({code:"custom",path:["facts",a,"source_id"],message:"facts must reference a text/document/image source (never url)"})}if(t.reference){let a=s.get(t.reference.source_id),i=a?.type==="image"&&a.source_metadata.image_role==="reference";(!a||a.type!=="url"&&!i)&&n.addIssue({code:"custom",path:["reference","source_id"],message:"reference must point at a url source or reference image source"})}});function Gy(t){for(let n of t.sources)if(n.type==="image"&&n.status==="ready"&&n.source_metadata?.image_role==="reference")return{source_id:n.source_id};return t.reference?.screenshot_ref?{source_id:t.reference.source_id}:null}import{z as A}from"zod";import{z as Sn}from"zod";import{z as Y}from"zod";var Ie=Y.string().min(1),hn=Y.string().min(1).refine(t=>t.startsWith("/")&&!t.includes("?")&&!t.includes("#"),{message:"page_path must start with / and must not contain ? or #"}),Nm=Y.object({template_id:Ie,safe_name:Y.string().min(1),entry_file:Y.string().min(1),kind:Y.enum(["default","additional"])}).strict(),Wy=Y.object({schema_version:Y.literal(1),route_id:Y.string().min(1),canonical_entry_file:Y.string().min(1),route_key:Y.string().min(1),default_template_id:Ie,templates:Y.array(Nm).min(1)}).strict().superRefine((t,n)=>{let s=new Set,a,i=0;for(let[r,_]of t.templates.entries())s.has(_.template_id)&&n.addIssue({code:"custom",path:["templates",r,"template_id"],message:`Duplicate template_id: ${_.template_id}`}),s.add(_.template_id),_.kind==="default"&&(i+=1,a=_.template_id);i!==1?n.addIssue({code:"custom",path:["templates"],message:"templates must contain exactly one default item"}):a!==t.default_template_id&&n.addIssue({code:"custom",path:["default_template_id"],message:"default_template_id must match the default template"})}),Vy=Y.object({page_path:hn,template_id:Ie,instruction:Y.string().min(1)}).strict(),sa=t=>[...new Set(t)],$y=Y.object({page_path:hn,template_id:Ie,exit_template_ids:Y.array(Ie).default([]).transform(sa)}).strict(),Hy=Y.object({page_path:hn,template_ids:Y.array(Ie).min(1).transform(sa)}).strict(),cs={ok:Y.literal(!0),site_id:I,page_path:hn,route_id:Y.string().min(1),default_template_id:Ie,snapshot_id:x,route_mode:Y.literal("delegated")},Yy=Y.object({...cs,template_id:Ie,status:Y.literal("created")}).strict(),Xy=Y.object({...cs,promoted_template_id:Ie,deleted_template_ids:Y.array(Ie),status:Y.literal("promoted")}).strict(),Zy=Y.object({...cs,deleted_template_ids:Y.array(Ie),status:Y.literal("cleaned")}).strict(),Qy=Y.enum(["PAGE_TEMPLATE_REQUEST_INVALID","PAGE_TEMPLATE_PAGE_NOT_FOUND","PAGE_TEMPLATE_NOT_FOUND","PAGE_TEMPLATE_ALREADY_EXISTS","PAGE_TEMPLATE_ID_COLLISION","PAGE_TEMPLATE_MANAGED_SOURCE_INVALID","PAGE_TEMPLATE_DEFAULT_PROTECTED","PAGE_TEMPLATE_DEFAULT_ALREADY_ACTIVE","PAGE_TEMPLATE_ASSET_IN_USE","PAGE_TEMPLATE_SNAPSHOT_CONFLICT","PAGE_TEMPLATE_DYNAMIC_ROUTE_UNSUPPORTED","PAGE_TEMPLATE_SOURCE_UNSUPPORTED","PAGE_TEMPLATE_GENERATION_FAILED","PAGE_TEMPLATE_PATCH_FAILED"]);var se=Sn.object({routeId:Sn.string().min(1),templateId:Ie.optional()}).strict(),L=Sn.object({routeId:Sn.string().min(1),effectiveTemplateId:Ie.optional()}).strict();function ms(t){return JSON.stringify([t.routeId,t.effectiveTemplateId??null])}function nx(t){let n;try{n=JSON.parse(t)}catch{return null}if(!Array.isArray(n)||n.length!==2)return null;let[s,a]=n,i=L.safeParse(a===null?{routeId:s}:{routeId:s,effectiveTemplateId:a});return i.success?i.data:null}var Lm=["design.md","DESIGN.md"],ia=["components/site","src/components/site","lib/generated","src/lib/generated","public"],Mm=["app/globals.css","src/app/globals.css"],Um=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],Fm=new Set(Um),ls="source-delete",aa=A.literal(ls),le=A.string().min(1).refine(ra,"Invalid site edit source path"),qm=A.string().min(1).refine(Hm,"Invalid site edit source directory path"),ox=A.enum(["text","binary"]),fn=A.object({composition:L,path:le,language:A.string().min(1).nullable(),sizeBytes:A.number().int().nonnegative(),contentHash:A.string().min(1).optional()}).strict(),Gm=A.discriminatedUnion("kind",[fn.extend({kind:A.literal("text"),language:A.string().min(1),readonly:A.boolean().default(!1)}),fn.extend({kind:A.literal("binary"),language:A.null(),mimeType:A.string().min(1).optional(),readonly:A.literal(!0)})]),oa=A.lazy(()=>A.discriminatedUnion("kind",[A.object({kind:A.literal("directory"),name:A.string().min(1),path:qm,children:A.array(oa)}),A.object({kind:A.literal("file"),name:A.string().min(1),path:le,file:Gm}).superRefine((t,n)=>{t.path!==t.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),Km=A.enum(["max-files","max-depth","max-total-bytes"]),zm=A.object({reasons:A.array(Km).min(1),maxFiles:A.number().int().positive(),maxDepth:A.number().int().positive(),maxTotalBytes:A.number().int().positive()}),rx=A.object({composition:L,nodes:A.array(oa),defaultPath:le.optional(),totalFiles:A.number().int().nonnegative(),truncated:zm.optional()}).strict(),cx=A.object({composition:se}).strict(),mx=A.object({path:le,composition:se}).strict(),Bm=fn.extend({kind:A.literal("text"),language:A.string().min(1),readonly:A.boolean().default(!1),content:A.string()}),Wm=A.enum(["too-large","unsupported-mime","bytes-unavailable"]),Vm=fn.extend({kind:A.literal("binary"),language:A.null(),readonly:A.literal(!0),mimeType:A.string().min(1),contentBase64:A.string().min(1).optional(),previewUnavailableReason:Wm.optional()}),lx=A.discriminatedUnion("kind",[Bm,Vm]),px=A.object({key:A.string().min(1),composition:se}).strict(),$m=A.object({startLine:A.number().int().positive(),startColumn:A.number().int().nonnegative(),endLine:A.number().int().positive(),endColumn:A.number().int().nonnegative()}),dx=A.object({key:A.string().min(1),composition:L,sourceFile:le,componentName:A.string().min(1),openingElementRange:$m,structuralPath:A.string().min(1),textPreview:A.string().min(1).optional()}).strict();function ra(t){return!pa(t)||la(t)?!1:us(t)||ma(t)||ca(t)||ia.some(n=>t===n||t.startsWith(`${n}/`))}function ps(t){return us(t)||Fm.has(Ym(t))}function Hm(t){return!pa(t)||la(t)?!1:t==="app"||t.startsWith("app/")||t==="src"||t==="src/app"||t.startsWith("src/app/")||ia.some(n=>t===n||t.startsWith(`${n}/`)||n.startsWith(`${t}/`))}function ds(t){return ra(t)?us(t)?"design-document":ca(t)?"route-entry":ma(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 ux(t){return ds(t)!==null}function ca(t){return/^(?:src\/)?app\/(?:.*\/)?page\.[cm]?[jt]sx?$/.test(t.toLowerCase())}function ma(t){return Mm.some(n=>n.toLowerCase()===t.toLowerCase())}function Ym(t){let n=t.split("/").at(-1)??t,s=n.lastIndexOf(".");return s>0?n.slice(s).toLowerCase():""}function us(t){return!t.includes("/")&&Lm.some(n=>n.toLowerCase()===t.toLowerCase())}function la(t){let n=t.toLowerCase(),s=n.split("/"),i=(s.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:i==="server"||i==="db"||i==="database"||i==="auth"||i==="secret"||i==="secrets"||i==="token"||i==="tokens"||i==="credential"||i==="credentials"||s.includes("server")||s.includes("secrets")}function pa(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 Xm}from"zod";var jt=["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"],Zm=["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"],Qm=[...jt,...Zm],Jm=new Set(["ar","fa","he"]),hx=[{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"}],el={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"},tl=new Set(jt);function da(t){return tl.has(t)?t:el[t]}var nl="en";function Sx(t){let n=t.toLowerCase().split("-",1)[0]??"";return Jm.has(n)?"rtl":"ltr"}var sl={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 fx(t){return sl[t]??nl}var il=["zh-CN","zh-HK","zh-TW","ja-JP","ja","ko-KR","ko","ru-RU","ru","uk-UA","uk","bg","sr","mn-MN","kk-KZ","ar-SA","ar","fa-IR","fa","he","hi","th-TH","th","el-GR","el","ka-GE","bn-BD","bn","ta-IN","ta","si-LK","my-MM","km-KH","lo-LA"],al=new Set(il);function bx(t){return al.has(t)}var pe=Xm.enum(Qm);import{z as ol}from"zod";var ua=ol.string().uuid();import{z as o}from"zod";var de=o.string().trim().min(1).max(128),Ot=o.string().trim().min(1).max(200),_s=o.string().trim().min(1).max(2e3),hs=o.string().trim().max(200),Nt=o.string().regex(/^[a-f0-9]{64}$/),Ss=o.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),it=["market","persona","product","brand","competition","structure","language","seogeo","content","conversion","risk"],fe=it.length,yn=o.enum(it),xn=yn,ha=["recommended","conservative","focused"],ht=o.enum(ha),gs=o.object({id:ht,label:Ot,note:_s,impact:o.string().trim().max(500).nullish(),set_value:o.string().trim().max(500).nullish(),site_locale:pe.nullish()}).loose(),rl=o.object({lead:o.string().trim().min(1).max(500),title:Ot,columns:o.array(o.string().trim().min(1).max(80)).min(1).max(8),rows:o.array(o.array(o.string().trim().max(500)).min(1).max(8)).max(100)}).strict().superRefine((t,n)=>{t.rows.forEach((s,a)=>{s.length!==t.columns.length&&n.addIssue({code:"custom",path:["rows",a],message:"Each Step5 plan row must match the column count."})})}),cl=o.object({source_type:o.enum(["step2","step3"]),source_id:de,field_path:o.string().trim().max(300).nullish()}).strict(),ml=o.enum(["ready","disabled","empty","timeout","rate_limited","quota_exhausted","failed"]),Sa=o.enum(["INFORMATIONAL","NAVIGATIONAL","COMMERCIAL","TRANSACTIONAL"]),ll=o.object({id:de,term:o.string().trim().min(1).max(255),source_type:o.enum(["step2","step3","step5"]),source_id:de,field_path:o.string().trim().min(1).max(300),source_field:o.string().trim().min(1).max(300).optional(),source_evidence:o.string().trim().min(1).max(2e3).optional(),business_subject:o.string().trim().min(1).max(255).optional(),reason:o.string().trim().min(1).max(1e3).optional()}).strict(),pl=o.object({keyword:o.string().trim().min(1).max(255),normalized_keyword:o.string().trim().min(1).max(255),intents:o.array(Sa).min(1).max(4),search_volume:o.number().int().min(50),keyword_difficulty:o.number().min(0).max(45),cpc:o.number().nonnegative().nullish(),trend:o.array(o.number().int().min(0).max(100)).length(12),serp_features:o.array(o.string().trim().min(1).max(80)).max(64),fit:o.object({seo:o.number().int().min(0).max(100),geo:o.number().int().min(0).max(100),buyer:o.number().int().min(0).max(100)}).strict(),recommended_channel:o.enum(["SEO","GEO","DUAL"]),priority:o.enum(["P0","P1","P2","P3"]),already_in_plan:o.boolean(),page_level:o.union([o.literal(1),o.literal(2)]).default(1)}).strict(),dl=o.object({id:de,intent:Sa,title:Ot,landing_page_type:o.enum(["blog","product","category","landing"]),keywords:o.array(pl).min(1).max(100)}).strict(),ul=o.enum(["NO_SEEDS","NO_PROVIDER_CANDIDATES","NO_METRIC_ELIGIBLE_CANDIDATES","NO_COMMERCIAL_INTENT_CANDIDATES","NO_FIT_ELIGIBLE_CANDIDATES"]),gl=o.object({fetched_count:o.number().int().nonnegative(),unique_count:o.number().int().nonnegative(),metric_gate_pass_count:o.number().int().nonnegative(),commercial_intent_pass_count:o.number().int().nonnegative(),fit_pass_count:o.number().int().nonnegative(),selected_count:o.number().int().nonnegative()}).strict().superRefine((t,n)=>{let s=[t.fetched_count,t.unique_count,t.metric_gate_pass_count,t.commercial_intent_pass_count,t.fit_pass_count,t.selected_count];s.some((a,i)=>i>0&&a>s[i-1])&&n.addIssue({code:"custom",message:"Semrush selection counts must be monotonically non-increasing."})}),_l=o.object({schema_version:o.literal(1),provider:o.literal("semrush"),api_version:o.literal("v4"),database:o.string().trim().regex(/^[A-Z]{2}$/),country:o.string().trim().regex(/^[A-Z]{2}$/),fetched_at:o.string().datetime({offset:!0}),context_hash:Nt,status:ml,seeds:o.array(ll).max(20),intent_groups:o.array(dl).max(16),selection_summary:gl.optional(),empty_reason_code:ul.nullish(),error_code:o.string().trim().regex(/^[A-Z0-9_]+$/).max(64).nullish()}).strict().superRefine((t,n)=>{if(t.database!==t.country&&n.addIssue({code:"custom",path:["database"],message:"Semrush database must match the ISO country code."}),t.status==="ready"&&t.intent_groups.length===0&&n.addIssue({code:"custom",path:["intent_groups"],message:"Ready Semrush recommendations require an intent group."}),t.status==="ready"&&t.error_code&&n.addIssue({code:"custom",path:["error_code"],message:"Ready Semrush recommendations cannot contain an error code."}),t.empty_reason_code&&t.status!=="empty"&&n.addIssue({code:"custom",path:["empty_reason_code"],message:"Semrush empty reason is only valid for an empty snapshot."}),t.selection_summary){let s=t.intent_groups.reduce((a,i)=>a+i.keywords.length,0);t.selection_summary.selected_count!==s&&n.addIssue({code:"custom",path:["selection_summary","selected_count"],message:"Semrush selected count must match the persisted keywords."})}}),ga=1,Tx=o.object({seed_keyword:o.string().trim().min(1).max(255),database:o.string().trim().toLowerCase().regex(/^[a-z]{2}$/).default("us"),limit:o.number().int().min(1).max(100).default(20),offset:o.number().int().nonnegative().default(0),min_search_volume:o.number().int().nonnegative().default(50),max_keyword_difficulty:o.number().finite().min(0).max(100).default(45),min_relevance_score:o.literal(ga).default(ga)}).strict(),hl=o.object({keyword:o.string().trim().min(1).max(255),search_volume:o.number().int().nonnegative().nullable(),keyword_difficulty:o.number().nonnegative().nullable(),cpc:o.number().nonnegative().nullable(),competition:o.number().nonnegative().nullable(),result_count:o.number().int().nonnegative().nullable(),intent:o.string().trim().max(64).nullable(),trend:o.array(o.string()).nullable(),serp_features:o.array(o.string()).nullable(),fit:o.number().finite().min(0).max(10),currency:o.string().trim().regex(/^[A-Z]{3}$/).nullable()}).strict(),Sl=o.object({request_id:o.string().trim().min(1).max(128),snapshot_id:o.string().uuid(),seed_keyword:o.string().trim().min(1).max(255),database:o.string().trim().min(1).max(16),limit:o.number().int().min(1).max(100),offset:o.number().int().nonnegative(),freshness:o.enum(["live","cached","historical"]),collected_at:o.string().datetime({offset:!0}),items:o.array(hl).max(100),result_count:o.number().int().nonnegative()}).strict(),kx=o.object({code:o.literal(0),message:o.string(),data:Sl}).strict(),Px=o.object({snapshot_id:o.string().uuid(),selected_keywords:o.array(o.string().trim().min(2).max(160)).min(1).max(50)}).strict(),fl=o.object({candidate_id:de,keyword:o.string().trim().min(2).max(160),classification_status:o.string().trim().min(1).max(64),selection_status:o.string().trim().min(1).max(64),selected_at:o.string().datetime({offset:!0})}).strict(),bl=o.object({selection_batch_id:de,snapshot_id:o.string().uuid(),selected_count:o.number().int().nonnegative(),created_count:o.number().int().nonnegative(),updated_count:o.number().int().nonnegative(),deselected_count:o.number().int().nonnegative(),items:o.array(fl).max(50)}).strict().superRefine((t,n)=>{t.selected_count!==t.items.length&&n.addIssue({code:"custom",path:["selected_count"],message:"selected_count must equal items.length."})}),wx=o.object({code:o.literal(0),message:o.string(),data:bl}).strict(),yl=o.enum(["ok","degraded"]),fs=o.object({key:xn,position:o.number().int().min(1).max(fe),category:Ot,title:Ot,summary:_s,rationale:_s,parameter:o.string().trim().max(500).nullish(),options:o.tuple([gs,gs,gs]),plan:rl.nullish(),note_tips:o.array(o.string().trim().min(1).max(200)).max(6),note_placeholder:o.string().trim().min(1).max(300),evidence_refs:o.array(cl).min(1).max(8),semrush_recommendations:_l.nullish(),seo_payload:o.lazy(()=>bs).nullish(),generation_status:yl.optional()}).loose().superRefine((t,n)=>{let s=it.indexOf(t.key)+1;t.position!==s&&n.addIssue({code:"custom",path:["position"],message:`Step5 strategy ${t.key} uses an invalid position.`}),t.options.forEach((a,i)=>{a.id!==ha[i]&&n.addIssue({code:"custom",path:["options",i,"id"],message:"Step5 strategy options must use the canonical order."})}),t.semrush_recommendations&&t.key!=="seogeo"&&n.addIssue({code:"custom",path:["semrush_recommendations"],message:"Semrush recommendations are only valid for the seogeo item."}),t.seo_payload&&t.key!=="seogeo"&&n.addIssue({code:"custom",path:["seo_payload"],message:"SEO payloads are only valid for the seogeo item."})}),bn=9,fa=o.object({id:de,type:o.union([o.literal(1),o.literal(2)]).default(1),cells:o.tuple([o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500)])}).strict(),xl=2,El=1,Ax=20,Il=50,ba=o.object({id:de,keyword:o.string().trim().min(1).max(500),intent_code:o.string().trim().min(1).max(16),intent_type:o.string().trim().min(1).max(200),strength:o.enum(["high","medium"]),search_volume:o.number().int().nonnegative().nullable(),cpc:o.number().finite().nonnegative().nullable()}).strict(),Rl=ba.superRefine((t,n)=>{t.intent_code!=="C"&&t.intent_code!=="T"&&n.addIssue({code:"custom",path:["intent_code"],message:"New legacy SEO keyword selections must use commercial or transactional intent."})}),En=o.object({id:de,keyword:o.string().trim().min(2).max(160),normalized_keyword:o.string().trim().min(2).max(160),intc:o.enum(["I","N","C","T"]),keyword_type:o.string().trim().min(1).max(80),intent_strength:o.enum(["high","medium","low"]),monthly_volume:o.number().int().nonnegative().nullable(),keyword_difficulty:o.number().finite().min(0).max(100).nullable(),fit:o.number().finite().min(0).max(10).nullable(),sem_cpc:o.number().finite().nonnegative().nullable(),currency:o.string().trim().regex(/^[A-Z]{3}$/).nullable(),landing_page:o.string().trim().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*)?$/),content_format:o.string().trim().min(1).max(80),priority:o.enum(["P0","P1","P2","P3"]),source:o.enum(["step5_generation","semrush"]),source_market:o.string().trim().toLowerCase().regex(/^[a-z]{2,8}$/),metric_timestamp:o.string().datetime({offset:!0}).nullable()}).strict().superRefine((t,n)=>{let s=Ea(t.keyword);t.normalized_keyword!==s&&n.addIssue({code:"custom",path:["normalized_keyword"],message:"normalized_keyword must match the canonical keyword form."}),/^[\x20-\x7E]+$/.test(t.keyword)||n.addIssue({code:"custom",path:["keyword"],message:"Step5 SEO keywords must be English ASCII text."})}),Tl=o.object({request_id:o.string().trim().min(1).max(128),snapshot_id:de,selected_keywords:o.array(o.string().trim().min(2).max(160)).min(1).max(50)}).strict(),bs=o.object({schema_version:o.literal(xl),seo_keywords:o.array(En).min(El).max(Il),semrush_snapshot_refs:o.array(Tl).max(20).optional()}).strict().superRefine(Ml),kl=bs.superRefine((t,n)=>{t.seo_keywords.forEach((s,a)=>{s.intc!=="C"&&s.intc!=="T"&&n.addIssue({code:"custom",path:["seo_keywords",a,"intc"],message:"New SEO keyword selections must use commercial or transactional intent."})})}),Pl=o.object({rows:o.array(fa).max(100).optional(),seo_keywords:o.array(ba).max(100).optional()}).strict(),wl=o.object({rows:o.array(fa).max(100).optional(),seo_keywords:o.array(Rl).max(100).optional()}).strict(),Al=o.union([bs,Pl]),ya=o.union([kl,wl]),vl=o.object({item_key:yn,selected_option_id:ht,note:hs,custom_payload:ya.optional()}).strict().superRefine((t,n)=>{t.item_key==="seogeo"&&t.custom_payload&&!("schema_version"in t.custom_payload)&&Ll(t.custom_payload,n)}),ys=o.object({item_key:yn,selected_option_id:ht,note:hs,custom_payload:Al.optional(),selected_value:o.unknown().nullable(),accepted_at:o.string().datetime({offset:!0})}).loose(),Cl=o.enum(["running","succeeded","failed"]),Dl=o.object({schema_version:o.literal(1),source_job_id:de,site_id:de,output_locale:Ss.optional(),items:o.array(fs).length(fe),decisions:o.array(ys).length(fe)}).loose(),jl=o.object({strategy_version_id:de,site_id:de,source_job_id:de,output_locale:Ss.optional(),version:o.number().int().positive(),checksum:Nt,snapshot:Dl,committed_at:o.string().datetime({offset:!0})}).loose(),xa=o.object({job_id:de,site_id:de,output_locale:Ss.optional(),status:Cl,revision:o.number().int().nonnegative(),items:o.array(fs).max(fe),decisions:o.array(ys).max(fe),output_checksum:Nt.nullish(),error_code:o.string().trim().max(64).nullish(),error_message:o.string().trim().max(500).nullish(),committed_version:jl.nullish()}).loose().superRefine((t,n)=>{let s=t.items.map(i=>i.key);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["items"],message:"Step5 job items must have unique keys."});let a=t.decisions.map(i=>i.item_key);new Set(a).size!==a.length&&n.addIssue({code:"custom",path:["decisions"],message:"Step5 job decisions must have unique item keys."})}),vx=o.object({force_refresh:o.boolean().optional().default(!1)}).strict(),Cx=xa.extend({cached:o.boolean()}).strict(),Dx=o.object({expected_revision:o.number().int().nonnegative()}).strict(),jx=o.object({expected_revision:o.number().int().nonnegative(),selected_option_id:ht,note:hs,custom_payload:ya.optional()}).strict(),Ox=o.object({revision:o.number().int().positive(),decision:ys}).strict(),Nx=o.object({idempotency_key:o.string().trim().min(8).max(128),expected_revision:o.number().int().nonnegative(),decisions:o.array(vl).length(fe)}).strict().superRefine((t,n)=>{let s=t.decisions.map(a=>a.item_key);new Set(s).size!==it.length&&n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit must contain ${fe} unique decisions.`}),it.forEach(a=>{s.includes(a)||n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit is missing ${a}.`})})}),Lx=o.object({strategy_version_id:de,version:o.number().int().positive(),checksum:Nt,next_path:o.string().trim().min(1).max(500)}).strict(),Ol=xa.extend({completed:o.number().int().min(0).max(fe),total:o.literal(fe)}).loose(),Nl=["snapshot","strategy_item_start","strategy_item_done","strategy_items_invalidated","strategy_generation_done","failed"];function Mx(t){return typeof t=="string"&&Nl.includes(t)}var Ux=o.discriminatedUnion("event",[o.object({id:o.number().int().nonnegative(),event:o.literal("snapshot"),data:Ol}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_item_start"),data:o.object({key:yn,position:o.number().int().min(1).max(fe)}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_item_done"),data:o.object({item:fs}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_items_invalidated"),data:o.object({after_position:o.number().int().min(0).max(fe)}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_generation_done"),data:o.object({item_count:o.literal(fe),schema_version:o.literal(1),checksum:Nt}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("failed"),data:o.object({code:o.string().trim().min(1).max(64),message:o.string().trim().min(1).max(500),retryable:o.boolean(),item_key:xn.optional()}).loose()}).loose()]);function _a(t){let n=t.trim().toLocaleLowerCase();return n===""||n==="/"?"/":`/${n.replace(/^\/+|\/+$/g,"")}`}function Ll(t,n){let s=(t.rows??[]).filter(i=>i.type===1);t.rows&&s.length===0&&n.addIssue({code:"custom",path:["custom_payload","rows"],message:"SEO/GEO plans must keep at least one primary page."});let a=s.some(i=>_a(i.cells[3])==="/");s.length+(a?0:1)>bn&&n.addIssue({code:"custom",path:["custom_payload","rows"],message:`Initial generation supports at most ${bn} primary pages including home.`}),s.forEach((i,r)=>{/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/.test(_a(i.cells[3]))||n.addIssue({code:"custom",path:["custom_payload","rows",r,"cells",3],message:"Primary intent pages must use root or one-segment kebab-case paths."})})}function Ea(t){return t.normalize("NFKC").trim().replace(/\s+/g," ").toLowerCase()}function Ml(t,n){let s=new Set;t.seo_keywords.forEach((i,r)=>{s.has(i.normalized_keyword)&&n.addIssue({code:"custom",path:["seo_keywords",r,"normalized_keyword"],message:"SEO keywords must be unique after Unicode normalization."}),s.add(i.normalized_keyword),(i.monthly_volume===null||i.monthly_volume<50)&&n.addIssue({code:"custom",path:["seo_keywords",r,"monthly_volume"],message:"Selected SEO keywords require monthly_volume >= 50."}),(i.keyword_difficulty===null||i.keyword_difficulty>45)&&n.addIssue({code:"custom",path:["seo_keywords",r,"keyword_difficulty"],message:"Selected SEO keywords require keyword_difficulty <= 45."}),(i.fit===null||i.fit<7)&&n.addIssue({code:"custom",path:["seo_keywords",r,"fit"],message:"Selected SEO keywords require fit >= 7.0."})});let a=new Set((t.semrush_snapshot_refs??[]).flatMap(i=>i.selected_keywords.map(Ea)));t.seo_keywords.forEach((i,r)=>{i.source==="semrush"&&!a.has(i.normalized_keyword)&&n.addIssue({code:"custom",path:["seo_keywords",r,"source"],message:"Semrush keywords must reference a persisted Semrush snapshot selection."})})}import{z as Ul}from"zod";var De=Ul.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 Gx(t,n){let s=De.safeParse(t),a=De.safeParse(n);if(!s.success||!a.success)return null;let i=Ia(s.data),r=Ia(a.data);for(let c=0;c<3;c+=1){let g=Ra(i.release[c],r.release[c]);if(g!==0)return g}if(!i.prerelease&&!r.prerelease)return 0;if(!i.prerelease)return 1;if(!r.prerelease)return-1;let _=Math.max(i.prerelease.length,r.prerelease.length);for(let c=0;c<_;c+=1){let g=i.prerelease[c],j=r.prerelease[c];if(g===void 0)return-1;if(j===void 0)return 1;if(g===j)continue;let E=/^\d+$/u.test(g),O=/^\d+$/u.test(j);return E&&O?Ra(BigInt(g),BigInt(j)):E?-1:O?1:Fl(g,j)}return 0}function Ia(t){let n=t.indexOf("+"),s=n===-1?t:t.slice(0,n),a=s.indexOf("-"),i=a===-1?s:s.slice(0,a),r=a===-1?void 0:s.slice(a+1),[_,c,g]=i.split(".");return{release:[BigInt(_),BigInt(c),BigInt(g)],...r?{prerelease:r.split(".")}:{}}}function Ra(t,n){return t<n?-1:t>n?1:0}function Fl(t,n){return t<n?-1:t>n?1:0}import{z as K}from"zod";import{z as be}from"zod";var xs=64,ql=512*1024,Es=4*1024*1024,Gl=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function Kl(t){return Gl.test(t)}var Ta=be.string().min(1).refine(Kl,{message:"Materialization pathTemplate must be a safe relative path."}),zl=be.object({pathTemplate:Ta,content:be.string(),role:be.string().min(1).optional()}).strict(),Bl=be.union([be.object({kind:be.literal("default")}).strict(),be.object({kind:be.literal("named"),name:be.string().min(1)}).strict()]),Wl=be.object({pathTemplate:Ta,export:Bl}).strict(),Vl=be.array(be.never()).optional(),at=be.object({instanceBaseName:be.string().min(1),files:be.array(zl).min(1).max(xs),entry:Wl,dataRequirements:Vl}).strict().superRefine((t,n)=>{let s=new Set,a=t.entry.pathTemplate,i=0;for(let[r,_]of t.files.entries()){s.has(_.pathTemplate)&&n.addIssue({code:"custom",path:["files",r,"pathTemplate"],message:`Duplicate materialization pathTemplate: ${_.pathTemplate}`}),s.add(_.pathTemplate);let c=new TextEncoder().encode(_.content).length;c>ql&&n.addIssue({code:"custom",path:["files",r,"content"],message:"Materialization file content exceeds the per-file byte limit."}),i+=c}s.has(a)||n.addIssue({code:"custom",path:["entry","pathTemplate"],message:"Materialization entry pathTemplate must match a file."}),i>Es&&n.addIssue({code:"custom",path:["files"],message:"Materialization exceeds the total content byte limit."})});var ka="insertNewComponent",$x={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"},Is=K.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),Pa=K.lazy(()=>K.object({id:K.string().uuid(),key:K.string().min(1),name:K.string(),children:K.array(Pa)}).strict()),wa=K.object({category_group_key:K.literal(ka),categories:K.array(Pa)}).strict(),$l=K.object({resource_id:K.string().min(1),name:K.string(),description:K.string().nullable(),thumbnail_url:K.string().nullable(),resolved_version:Is,category_id:K.string().uuid().nullable()}).strict(),Aa=K.object({category_group_key:K.literal(ka),items:K.array($l),next_cursor:K.string().min(1).nullable()}).strict(),Hx=K.object({resource_id:K.string().min(1),resolved_version:Is,anchor_block_id:K.string().min(1),placement:K.enum(["before","after"])}).strict(),Yx=K.object({status:K.literal("mock_acknowledged")}).strict(),Xx=K.object({category_id:K.string().uuid().optional(),include_descendants:K.enum(["true","false"]).optional().transform(t=>t==="true"),limit:K.coerce.number().int().min(1).max(100).optional().default(20),cursor:K.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),ot=Is,Zx=K.object({version:ot}).strict(),va=K.object({resource_id:K.string().min(1),resolved_version:ot,revision_id:K.string().uuid().optional(),digest_sha256:K.string().regex(/^[a-f0-9]{64}$/),materialization:at}).strict();import{z as b}from"zod";import{z as y}from"zod";var Da="/",ja=255,Hl=5e3,Yl=64;function Xl(t){if(!t.startsWith("/")||t.includes("//")||/[?#\\\s\u0000-\u001f\u007f]/u.test(t))return!1;try{let n=decodeURIComponent(t);return n.includes("//")||/[?#\\\s\u0000-\u001f\u007f]/u.test(n)||n.split("/").length!==t.split("/").length||/%25/iu.test(t)?!1:n.split("/").every(s=>![".",".."].includes(s))}catch{return!1}}var Rn=y.string().min(1).max(ja).refine(Xl,"url_path must be a safe site-relative path"),ks=y.string().max(ja),In=y.preprocess(t=>t===0?!1:t===1?!0:t,y.boolean()),Lt=y.union([y.url(),Rn]),Oa=y.enum(["landing_page","general_page","detail_page"]),Ps=y.enum([...Oa.options,"list_page","category_page","tag_page","author_page","search_page","date_page"]),Na=y.lazy(()=>y.object({cms_page_id:y.number().int().positive(),title:y.string().trim().min(1).max(255),url_path:ks,url:Lt.nullable(),page_type:Ps,vcp_managed:In,children:y.array(Na)}).strict()),Zl=y.object({group_id:y.string().min(1),title:y.string().trim().min(1).max(255),pages:y.array(Na)}).strict(),Ca=y.object({groups:y.array(Zl)}).strict(),La=y.lazy(()=>y.object({id:y.number().int().positive(),title:y.string().trim().min(1).max(120),url_path:ks,parent_id:y.number().int().nonnegative(),group_type:y.string().min(1),page_type:Ps,plugin_id:y.number().int().nonnegative(),is_default:In,is_published:In,url:Lt.nullable(),vcp_managed:In,children:y.array(La)})),Ql=y.object({plugin_id:y.number().int().nonnegative(),slug:y.string(),group_name:y.string().trim().min(1).max(255),pages:y.array(La)}).passthrough(),Jl=y.array(Ql);function Ma(t){return{cms_page_id:t.id,title:t.title,url_path:t.url_path,url:t.url,page_type:t.page_type,vcp_managed:t.vcp_managed,children:t.children.map(n=>Ma(n))}}function tE(t){if(!ep(t))return null;let n=Ca.safeParse(t);if(n.success)return n.data;let s=Jl.safeParse(t);if(!s.success)return null;let a=Ca.safeParse({groups:s.data.map(i=>({group_id:String(i.plugin_id),title:i.group_name,pages:i.pages.map(Ma)}))});return a.success?a.data:null}function ep(t){let n=Array.isArray(t)?t:Rs(t)&&Array.isArray(t.groups)?t.groups:[],s=[];for(let i of n)if(!(!Rs(i)||!Array.isArray(i.pages)))for(let r of i.pages)s.push({node:r,depth:1});let a=0;for(;s.length>0;){let i=s.pop();if(a+=1,a>Hl||i.depth>Yl)return!1;if(!(!Rs(i.node)||!Array.isArray(i.node.children)))for(let r of i.node.children)s.push({node:r,depth:i.depth+1})}return!0}function Rs(t){return typeof t=="object"&&t!==null}var tp=y.enum(["invalid_url_path","missing_url","not_vcp_managed","unsupported_page_type"]),np=y.enum(["home_page","invalid_url_path","not_selectable","not_vcp_managed","page_has_children","last_selectable_page","cms_unbound","unsupported_page_type"]),Ua=y.lazy(()=>y.object({cms_page_id:y.number().int().positive().nullable(),title:y.string().trim().min(1).max(255),url_path:ks,url:Lt.nullable(),page_type:Ps,vcp_managed:y.boolean(),selectable:y.boolean(),disabled_reason:tp.nullable(),can_delete:y.boolean(),delete_block_reason:np.nullable(),has_cms_children:y.boolean(),children:y.array(Ua)}).strict()),Fa=y.object({group_id:y.string().min(1),title:y.string().trim().min(1).max(255),pages:y.array(Ua)}).strict(),nE=y.object({base_snapshot_id:x,expected_url_path:Rn}).strict(),sp=y.enum(["succeeded","failed"]),ip=y.object({url_path:Rn,phase:y.enum(["ensure","binding","delete"]),code:y.string().min(1),message:y.string().min(1)}).strict(),qa=y.object({status:sp,checked_count:y.number().int().nonnegative(),ensured_count:y.number().int().nonnegative(),deleted_count:y.number().int().nonnegative(),already_absent_count:y.number().int().nonnegative(),failed_pages:y.array(ip),warnings:y.array(y.string().min(1))}).strict(),ap=y.object({result_snapshot_id:x,deleted_files:y.array(y.string().min(1)),updated_files:y.array(y.string().min(1)),preserved_shared_files:y.array(y.string().min(1)),warnings:y.array(y.string().min(1)),next_url:Lt.nullable(),previous_url:Lt.nullable(),cms_reconcile_result:qa}).strict(),sE=y.object({code:y.literal(0),message:y.string(),data:ap}).strict(),iE=y.object({source_committed:y.boolean(),result_snapshot_id:x.optional(),cms_reconcile_result:qa.optional()}).strict().superRefine((t,n)=>{t.source_committed&&!t.result_snapshot_id&&n.addIssue({code:"custom",path:["result_snapshot_id"],message:"committed source requires result_snapshot_id"})}),op=Oa,Ga=y.object({url_path:Rn,title:y.string().trim().min(1).max(255),kind:op,route_file:y.string().min(1),collection_id:y.string().trim().min(1).optional()}).strict().superRefine((t,n)=>{t.kind==="detail_page"&&!t.collection_id&&n.addIssue({code:"custom",path:["collection_id"],message:"detail_page target requires collection_id"}),t.kind!=="detail_page"&&t.collection_id&&n.addIssue({code:"custom",path:["collection_id"],message:`${t.kind} target cannot have collection_id`}),t.kind==="landing_page"!=(t.url_path===Da)&&n.addIssue({code:"custom",path:["kind"],message:"The home target must be the only landing_page target."})}),rp=y.object({complete:y.literal(!0),targets:y.array(Ga)}).strict().superRefine((t,n)=>{t.targets.length<1&&n.addIssue({code:"too_small",minimum:1,inclusive:!0,origin:"array",path:["targets"],message:"A complete page target set must contain at least one page."}),t.targets.filter(a=>a.url_path===Da).length!==1&&n.addIssue({code:"custom",path:["targets"],message:"A complete page target set must contain exactly one home page."})}),aE=y.discriminatedUnion("complete",[rp,y.object({complete:y.literal(!1),targets:y.array(Ga),errors:y.array(y.string().min(1)).min(1)}).strict()]),Ts=y.string().regex(/^sha256:[0-9a-f]{64}$/),oE=y.object({projection_hash:Ts.nullable()}).strict(),rE=y.object({expected_projection_hash:Ts.nullable(),projection_hash:Ts}).strict();var Ka="insertNewPage",uE={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"},rt=b.enum(["page","pages"]),cp=b.object({resource_id:b.string().min(1),resource_type:rt,resolved_version:ot,template_page_id:b.string().min(1)}).strict(),za=b.lazy(()=>b.object({id:b.string().uuid(),key:b.string().min(1),name:b.string(),children:b.array(za)}).strict()),Ba=b.object({category_group_key:b.literal(Ka),categories:b.array(za)}).strict(),mp=b.object({resource_id:b.string().min(1),resource_type:rt,name:b.string(),description:b.string().nullable(),thumbnail_url:b.string().nullable(),resolved_version:ot,category_id:b.string().uuid().nullable()}).strict(),Wa=b.object({category_group_key:b.literal(Ka),items:b.array(mp),next_cursor:b.string().min(1).nullable()}).strict(),gE=b.object({category_id:b.string().uuid().optional(),include_descendants:b.enum(["true","false"]).optional().transform(t=>t==="true"),limit:b.coerce.number().int().min(1).max(100).optional().default(20),cursor:b.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),Mt=ot,Tn=b.string().regex(/^\/[a-z0-9]+(?:-[a-z0-9]+)*$/),_E=b.string().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),lp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:Tn}).strict(),pp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),source:cp.optional(),blocks:b.array(b.discriminatedUnion("kind",[b.object({kind:b.literal("package-component"),instance_id:b.string().min(1),component_id:b.string().min(1),label:b.string().trim().min(1).max(120)}).strict(),b.object({kind:b.literal("component-resource"),instance_id:b.string().min(1),resource_id:b.string().min(1),resolved_version:ot,label:b.string().trim().min(1).max(120)}).strict()])).optional(),route:b.object({input:b.string(),append_random_suffix:b.boolean().optional(),random_suffix_length:b.number().int().min(4).max(16).optional(),final:Tn}).strict()}).strict(),dp=b.object({resource_id:b.string().min(1),resource_type:rt,resolved_version:Mt,pages:b.array(pp).min(1)}).strict().superRefine((t,n)=>{Ve(t.pages.map(s=>s.template_page_id),"pages",n),Ve(t.pages.map(s=>s.route.final),"routes",n);for(let[s,a]of t.pages.entries()){if(!a.blocks)continue;let i=new Set;for(let[r,_]of a.blocks.entries())i.has(_.instance_id)&&n.addIssue({code:"custom",path:["pages",s,"blocks",r,"instance_id"],message:`Duplicate block instance identifier within page: ${_.instance_id}`}),i.add(_.instance_id)}});function ws(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 Ve(t,n,s){let a=new Set;for(let[i,r]of t.entries())a.has(r)&&s.addIssue({code:"custom",path:[n,i],message:`Duplicate ${n} identifier: ${r}`}),a.add(r)}var hE=b.object({resource_type:rt,version:Mt,pages:b.array(lp).min(1)}).strict().superRefine((t,n)=>{ws(t,n),Ve(t.pages.map(s=>s.template_page_id),"pages",n),Ve(t.pages.map(s=>s.final_route),"routes",n)}),up=b.object({instance_id:b.string().min(1),component_id:b.string().min(1)}).strict(),gp=b.object({component_id:b.string().min(1),materialization:at}).strict(),_p=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:Tn,materialization:at,components:b.array(up)}).strict(),As=b.object({resource_id:b.string().min(1),resource_type:rt,resolved_version:Mt,revision_id:b.string().uuid().optional(),digest_sha256:b.string().regex(/^[a-f0-9]{64}$/),components:b.array(gp),pages:b.array(_p).min(1),project_dependencies:b.record(b.string(),b.never()).optional()}).strict().superRefine((t,n)=>{ws(t,n);let s=t.components.map(i=>i.component_id),a=new Set(s);Ve(s,"components",n),Ve(t.pages.map(i=>i.template_page_id),"pages",n),Ve(t.pages.map(i=>i.final_route),"routes",n);for(let[i,r]of t.pages.entries()){let _=new Set;for(let[c,g]of r.components.entries())a.has(g.component_id)||n.addIssue({code:"custom",path:["pages",i,"components",c,"component_id"],message:`Unknown component reference: ${g.component_id}`}),_.has(g.instance_id)&&n.addIssue({code:"custom",path:["pages",i,"components",c,"instance_id"],message:`Duplicate component instance identifier within page: ${g.instance_id}`}),_.add(g.instance_id)}}),Va=As,$a=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:Tn,route_file_path:b.string().regex(/^app\/[a-z0-9]+(?:-[a-z0-9]+)*\/page\.tsx$/)}).strict(),hp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),composition_supported:b.boolean(),blocks:b.array(b.object({instance_id:b.string().min(1),component_id:b.string().min(1),label:b.string().trim().min(1).max(120)}).strict())}).strict(),Ha=b.object({resource_id:b.string().min(1),resource_type:rt,resolved_version:Mt,pages:b.array(hp).min(1)}).strict().superRefine((t,n)=>{ws(t,n),Ve(t.pages.map(s=>s.template_page_id),"pages",n)}),SE=b.object({resource_type:rt,version:Mt}).strict(),fE=b.object({draft:dp}).strict(),Ya=b.object({groups:b.array(Fa)}).strict(),Xa=b.object({candidate:b.record(b.string(),b.unknown())}).strict();var St="[a-z0-9]+(?:-[a-z0-9]+)*",Ut=new RegExp(`^/(?:${St}(?:/${St})*)?$`),Za=["/privacy","/cookie-policy"],Sp=Za.map(t=>`app/${t.slice(1)}/page.tsx`);function fp(t){return t.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Qa(t){return typeof t=="string"&&Ut.test(t)}function Ja(t){if(typeof t!="string")return null;let n=t.trim();if(/[^\x00-\x7F]/.test(n))return null;let s=n.replace(/^\/+|\/+$/g,"");if(s==="")return"/";let a=s.split("/");if(a.some(c=>c==="."||c===".."))return null;let i=s.toLowerCase();if(i==="index"||i==="home")return"/";let r=a.map(fp).filter(c=>c.length>0);if(r.length===0)return null;let _=`/${r.join("/")}`;return Qa(_)?_:null}function eo(t){let n=Ja(t);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function bp(t){let n=eo(t);return n==="/"?"app/page.tsx":`app/${n.slice(1)}/page.tsx`}import{z as X}from"zod";import{z as p}from"zod";import{z as we}from"zod";var yp=we.object({code:we.string().min(1),message:we.string().min(1)}),IE=we.object({code:we.string().min(1),message:we.string().min(1)});function vs(t){return we.object({ok:we.literal(!0),composition:L,data:t}).strict()}function xp(t){let n={ok:we.literal(!1),composition:L,error:yp.extend({code:t.codeSchema})};return t.currentSchema&&(n.current=t.currentSchema.optional()),t.diagnosticsSchema&&(n.diagnostics=we.array(t.diagnosticsSchema).optional()),t.dataSchema&&(n.data=t.dataSchema.optional()),we.object(n).strict()}function to(t){return we.discriminatedUnion("ok",[vs(t.dataSchema),xp({codeSchema:t.codeSchema,currentSchema:t.currentSchema,diagnosticsSchema:t.diagnosticsSchema,dataSchema:t.failureDataSchema})])}import{z as B}from"zod";var ct=B.object({start:B.number().int().nonnegative(),end:B.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"})}),Ep=B.object({code:B.enum(["missing-class-name","unsupported-attribute-name","source-locator-warning","invalid-new-attr","version-conflict","write-failed"]),message:B.string().min(1)}),no=B.object({path:B.string().min(1),content:B.string(),hash:B.string().min(1).optional()}),wE=B.object({composition:L,revision:B.string().min(1),entryCss:no,stylesheets:B.array(no).default([])}).strict(),AE=B.object({composition:se}).strict(),vE=B.object({key:B.string().min(1),composition:se}).strict(),so=B.object({key:B.string().min(1),composition:L,filePath:B.string().min(1),componentName:B.string().min(1),sourceKind:B.enum(["missing","stringLiteral","expression"]),attrRaw:B.string().min(1).nullable(),valueRaw:B.string().min(1).nullable(),attrRange:ct.nullable(),openingElementRange:ct,version:B.object({documentVersion:B.number().int().nonnegative(),contentHash:B.string().min(1)}),diagnostics:B.array(Ep),computedStyle:B.record(B.string(),B.string()).optional()}).strict().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"})}),CE=so,DE=vs(so),Cs=B.object({source:B.enum(["style-panel","class-source-editor"]),operation:B.enum(["replace-static-classname","replace-expression","create-attribute","remove-attribute"])});import{z as Ip}from"zod";var Ds=Ip.enum(["src","alt","poster","href","width","height"]);import{z as ft}from"zod";var Ft=ft.object({editingSessionId:ft.string().min(1),lockId:ft.string().min(1),ownerId:ft.string().min(1),leaseAssertion:ft.string().min(1)}).strict(),ME="signed-designer-mutations-v1",UE=ft.object({mutationContext:Ft}).strict();import{z as d}from"zod";import{z as qt}from"zod";var kn="::",js=qt.object({file:qt.string().min(1),component:qt.string().min(1),structuralPath:qt.string().min(1),key:qt.string().min(1)}).superRefine((t,n)=>{let s=Rp(t.file,t.component,t.structuralPath);t.key!==s&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function Rp(t,n,s){return`${t}${kn}${n}${kn}${s}`}function GE(t){let[n,s,...a]=t.split(kn);return!n||!s||a.length===0?null:{file:n,component:s,structuralPath:a.join(kn)}}var Pn=d.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"]),Gt=d.object({code:d.string().min(1),message:d.string().min(1)}).strict(),Tp=d.union([d.object({kind:d.literal("virtual-route-root"),key:d.string().min(1)}).strict(),d.object({kind:d.literal("jsx-container"),key:d.string().min(1),sourceMemberKey:d.string().min(1),sourceFile:d.string().min(1),componentName:d.string().min(1).optional()}).strict(),d.object({kind:d.literal("starter-placeholder"),key:d.string().min(1),sourceFile:d.string().min(1).optional()}).strict()]),kp=d.object({key:d.string().min(1),kind:d.enum(["jsx-element","jsx-fragment","jsx-expression","null-return","starter-placeholder"]),containerKey:d.string().min(1),label:d.string().min(1),sourceFile:d.string().min(1).optional(),isAtomic:d.boolean()}).strict(),Pp=d.object({key:d.string().min(1),sourceMemberKey:d.string().min(1),containerKey:d.string().min(1),label:d.string().min(1),isIndependent:d.boolean()}).strict(),wp=d.object({key:d.string().min(1),containerKey:d.string().min(1),businessMemberKeys:d.array(d.string().min(1)),isMultiMember:d.boolean()}).strict(),ao=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:se}).strict(),Ap=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:L,placementUnitKey:d.string().min(1),relation:d.enum(["before","after","prepend","append"])}).strict(),oo=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:se,placementUnitKey:d.string().min(1),relation:d.enum(["before","after","prepend","append"])}).strict(),ro=d.object({kind:d.literal("page-unit"),composition:se,placementUnitKey:d.string().min(1)}).strict(),co=d.object({kind:d.literal("page-unit"),composition:L,placementUnitKey:d.string().min(1)}).strict();function qe(t,n,s,a,i){let r=new Set;for(let[_,c]of t.entries()){let g=a(c);r.has(g)&&n.addIssue({code:"custom",path:[s,_,i],message:`Duplicate ${s} key: ${g}`}),r.add(g)}}var vp=d.object({status:d.literal("supported"),version:d.number().int().nonnegative(),composition:L,container:Tp,sourceMembers:d.array(kp),businessMembers:d.array(Pp),placementUnits:d.array(wp),placements:d.array(Ap)}).strict().superRefine((t,n)=>{qe(t.sourceMembers,n,"sourceMembers",c=>c.key,"key"),qe(t.businessMembers,n,"businessMembers",c=>c.key,"key"),qe(t.placementUnits,n,"placementUnits",c=>c.key,"key"),qe(t.placements,n,"placements",c=>c.placementKey,"placementKey");let s=new Set(t.sourceMembers.map(c=>c.key)),a=new Set(t.placementUnits.map(c=>c.key)),i=new Map(t.sourceMembers.map(c=>[c.key,c])),r=new Map(t.businessMembers.map(c=>[c.key,c]));for(let[c,g]of t.sourceMembers.entries()){g.containerKey!==t.container.key&&!s.has(g.containerKey)&&n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member parent must reference the page container or another source member."}),g.containerKey===g.key&&n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member cannot contain itself."});let j=new Set([g.key]),E=g.containerKey;for(;E!==t.container.key;){if(j.has(E)){n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member hierarchy must be acyclic."});break}j.add(E);let O=i.get(E);if(!O)break;E=O.containerKey}}t.container.kind==="jsx-container"&&!s.has(t.container.sourceMemberKey)&&n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."});for(let[c,g]of t.businessMembers.entries())s.has(g.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",c,"sourceMemberKey"],message:"Business member must reference a source member."}),a.has(g.containerKey)||n.addIssue({code:"custom",path:["businessMembers",c,"containerKey"],message:"Business member must reference a placement unit container."});for(let[c,g]of t.placementUnits.entries()){let j=i.get(g.containerKey);j?j.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 E=new Set;for(let[O,F]of g.businessMemberKeys.entries()){let q=r.get(F);if(!q){n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Placement unit must reference existing business members."});continue}E.has(F)&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Placement unit cannot reference the same business member twice."}),E.add(F),q.containerKey!==g.key&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Business member containerKey must match its placement unit."});let J=q.sourceMemberKey,ne=new Set;for(;J&&J!==g.containerKey&&!ne.has(J);)ne.add(J),J=i.get(J)?.containerKey;J!==g.containerKey&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Placement unit business members must belong to its source subtree."})}}for(let[c,g]of t.businessMembers.entries())t.placementUnits.find(E=>E.key===g.containerKey)?.businessMemberKeys.includes(g.key)||n.addIssue({code:"custom",path:["businessMembers",c,"containerKey"],message:"Business member must be listed by its placement unit container."});let _=new Map;for(let c of t.placementUnits)_.set(c.containerKey,(_.get(c.containerKey)??0)+1);for(let[c,g]of t.sourceMembers.entries())g.containerKey===t.container.key&&_.get(g.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,g]of t.placements.entries())po(g.composition,t.composition)||n.addIssue({code:"custom",path:["placements",c,"composition"],message:"Page placement composition must match page composition."}),g.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",c,"documentVersion"],message:"Page placement version must match page composition version."}),a.has(g.placementUnitKey)||n.addIssue({code:"custom",path:["placements",c,"placementUnitKey"],message:"Placement option must reference an existing placement unit."})}),Cp=d.object({status:d.literal("unsupported"),version:d.number().int().nonnegative(),composition:L,reason:Pn,diagnostics:d.array(Gt)}).strict(),Dp=d.discriminatedUnion("status",[vp,Cp]),mo=2,VE="page-composition-v2",lo=d.object({start:d.number().int().nonnegative(),end:d.number().int().nonnegative(),startLine:d.number().int().positive().optional(),startColumn:d.number().int().nonnegative().optional(),endLine:d.number().int().positive().optional(),endColumn:d.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 s=[t.startLine,t.startColumn,t.endLine,t.endColumn],a=s.some(r=>r!==void 0),i=s.every(r=>r!==void 0);a&&!i&&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."})}),jp=d.object({key:d.string().min(1),instanceIndex:d.number().int().nonnegative().optional(),instanceCount:d.number().int().positive().optional(),textSegmentIndex:d.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."})}),Op=d.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),Np=d.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),Lp=d.discriminatedUnion("kind",[d.object({kind:d.literal("virtual-route-root"),key:d.null(),routeReturn:d.object({sourceIdentity:js,sourceRange:lo}).strict()}).strict(),d.object({kind:d.literal("jsx-container"),key:d.string().min(1),sourceMemberKey:d.string().min(1)}).strict(),d.object({kind:d.literal("starter-placeholder"),key:d.string().min(1),sourceMemberKey:d.string().min(1),replacementMode:d.literal("replace")}).strict()]),Mp=d.object({key:d.string().min(1),kind:Op,parentKey:d.string().min(1).nullable(),childKeys:d.array(d.string().min(1)),order:d.number().int().nonnegative(),label:d.string().min(1),sourceIdentity:js,sourceRange:lo.nullable(),atomicKind:Np}).strict().superRefine((t,n)=>{let s=t.kind==="component-call"||t.kind==="native-jsx"?"none":t.kind;t.atomicKind!==s&&n.addIssue({code:"custom",path:["atomicKind"],message:`atomicKind must be ${s} for ${t.kind}.`});let a=new Set;for(let[i,r]of t.childKeys.entries())a.has(r)&&n.addIssue({code:"custom",path:["childKeys",i],message:`Duplicate child source member key: ${r}`}),a.add(r)}),Up=d.object({key:d.string().min(1),sourceMemberKey:d.string().min(1),placementUnitKey:d.string().min(1),label:d.string().min(1),isIndependent:d.boolean()}).strict(),Fp=d.enum(["independent","atomic","container"]),qp=d.object({key:d.string().min(1),containerKey:d.string().min(1).nullable(),sourceMemberKeys:d.array(d.string().min(1)).min(1),businessMemberKeys:d.array(d.string().min(1)),order:d.number().int().nonnegative(),boundaryMode:Fp,isIndependent:d.boolean(),isMultiMember:d.boolean()}).strict().superRefine((t,n)=>{io(t.sourceMemberKeys,n,"sourceMemberKeys","source member"),io(t.businessMemberKeys,n,"businessMemberKeys","business member");let s=t.sourceMemberKeys.length>1||t.businessMemberKeys.length>1;t.isMultiMember!==s&&n.addIssue({code:"custom",path:["isMultiMember"],message:"isMultiMember must reflect the source and business member cardinality."});let a=t.boundaryMode==="independent";t.isIndependent!==a&&n.addIssue({code:"custom",path:["isIndependent"],message:"isIndependent must match boundaryMode."})}),Gp=d.enum(["before","after","prepend","append","replace"]),Kp=d.enum(["insert-sibling","insert-child","replace-placeholder"]),zp=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:L,placementUnitKey:d.string().min(1),containerKey:d.string().min(1).nullable(),relation:Gp,writeMode:Kp}).strict().superRefine((t,n)=>{let s=t.relation==="before"||t.relation==="after"?"insert-sibling":t.relation==="prepend"||t.relation==="append"?"insert-child":"replace-placeholder";t.writeMode!==s&&n.addIssue({code:"custom",path:["writeMode"],message:`writeMode must be ${s} for ${t.relation}.`})}),Bp=d.object({key:d.string().min(1),placementUnitKey:d.string().min(1),runtimeRefs:d.array(jp).min(1)}).strict(),Wp=d.object({schemaVersion:d.literal(mo),status:d.literal("supported"),version:d.number().int().nonnegative(),composition:L,container:Lp,sourceMembers:d.array(Mp),businessMembers:d.array(Up),placementUnits:d.array(qp),placements:d.array(zp),visualAnchors:d.array(Bp).optional(),diagnostics:d.array(Gt)}).strict().superRefine((t,n)=>{Hp(t,n)}),Vp=d.object({schemaVersion:d.literal(mo),status:d.literal("unsupported"),version:d.number().int().nonnegative(),composition:L,reason:Pn,diagnostics:d.array(Gt)}).strict(),$p=d.discriminatedUnion("status",[Wp,Vp]),$E=d.union([$p,Dp]);function io(t,n,s,a){let i=new Set;for(let[r,_]of t.entries())i.has(_)&&n.addIssue({code:"custom",path:[s,r],message:`Duplicate ${a} key: ${_}`}),i.add(_)}function po(t,n){return ms(t)===ms(n)}function Hp(t,n){qe(t.sourceMembers,n,"sourceMembers",E=>E.key,"key"),qe(t.businessMembers,n,"businessMembers",E=>E.key,"key"),qe(t.placementUnits,n,"placementUnits",E=>E.key,"key"),qe(t.placements,n,"placements",E=>E.placementKey,"placementKey"),qe(t.visualAnchors??[],n,"visualAnchors",E=>E.key,"key"),Yp(t,n);let s=new Map(t.sourceMembers.map(E=>[E.key,E])),a=new Map(t.businessMembers.map(E=>[E.key,E])),i=new Map(t.placementUnits.map(E=>[E.key,E]));Xp(t,s,n),t.container.kind!=="virtual-route-root"&&(s.has(t.container.sourceMemberKey)||n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."}));let r=new Map,_=new Map,c=new Set;for(let[E,O]of t.placementUnits.entries()){O.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",E,"containerKey"],message:"Placement unit containerKey must match the page container."});let F=`${O.containerKey??"<virtual>"}:${O.order}`;c.has(F)&&n.addIssue({code:"custom",path:["placementUnits",E,"order"],message:"Placement unit order must be unique within its container."}),c.add(F);for(let[q,J]of O.sourceMemberKeys.entries()){s.has(J)||n.addIssue({code:"custom",path:["placementUnits",E,"sourceMemberKeys",q],message:"Placement unit must reference existing source members."});let ne=r.get(J);ne&&ne!==O.key&&n.addIssue({code:"custom",path:["placementUnits",E,"sourceMemberKeys",q],message:`Source member is already assigned to ${ne}.`}),r.set(J,O.key)}for(let[q,J]of O.businessMemberKeys.entries()){let ne=a.get(J);if(!ne){n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",q],message:"Placement unit must reference existing business members."});continue}ne.placementUnitKey!==O.key&&n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",q],message:"Placement unit and business member must reference each other."}),O.sourceMemberKeys.includes(ne.sourceMemberKey)||n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",q],message:"Business member sourceMemberKey must belong to the placement unit."});let At=_.get(J);At&&At!==O.key&&n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",q],message:`Business member is already assigned to ${At}.`}),_.set(J,O.key)}}for(let[E,O]of t.businessMembers.entries()){s.has(O.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",E,"sourceMemberKey"],message:"Business member must reference a source member."});let F=i.get(O.placementUnitKey);if(!F){n.addIssue({code:"custom",path:["businessMembers",E,"placementUnitKey"],message:"Business member must reference a placement unit."});continue}F.businessMemberKeys.includes(O.key)||n.addIssue({code:"custom",path:["businessMembers",E,"placementUnitKey"],message:"Business member and placement unit must reference each other."}),F.sourceMemberKeys.includes(O.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",E,"sourceMemberKey"],message:"Business member sourceMemberKey must belong to its placement unit."});let q=F.isIndependent&&F.businessMemberKeys.length===1;O.isIndependent!==q&&n.addIssue({code:"custom",path:["businessMembers",E,"isIndependent"],message:"Business member independence must match its placement unit boundary."})}let g=new Set;for(let[E,O]of t.placements.entries()){O.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",E,"documentVersion"],message:"Page placement version must match page composition version."}),po(O.composition,t.composition)||n.addIssue({code:"custom",path:["placements",E,"composition"],message:"Page placement composition must match page composition."});let F=i.get(O.placementUnitKey);F?O.containerKey!==F.containerKey&&n.addIssue({code:"custom",path:["placements",E,"containerKey"],message:"Placement containerKey must match its placement unit."}):n.addIssue({code:"custom",path:["placements",E,"placementUnitKey"],message:"Placement option must reference a placement unit."});let q=`${O.placementUnitKey}:${O.relation}`;g.has(q)&&n.addIssue({code:"custom",path:["placements",E,"relation"],message:"A placement unit cannot expose the same relation more than once."}),g.add(q),O.relation==="replace"&&t.container.kind!=="starter-placeholder"&&n.addIssue({code:"custom",path:["placements",E,"relation"],message:"replace is only valid for a starter placeholder container."}),t.container.kind==="starter-placeholder"&&O.relation!=="replace"&&n.addIssue({code:"custom",path:["placements",E,"relation"],message:"Starter placeholder placements must use replace."})}let j=new Set;for(let[E,O]of(t.visualAnchors??[]).entries())i.has(O.placementUnitKey)||n.addIssue({code:"custom",path:["visualAnchors",E,"placementUnitKey"],message:"Visual anchor must reference a placement unit."}),j.has(O.placementUnitKey)&&n.addIssue({code:"custom",path:["visualAnchors",E,"placementUnitKey"],message:"A placement unit may expose only one visual anchor."}),j.add(O.placementUnitKey)}function Yp(t,n){let s=[];t.container.key!==null&&s.push({key:t.container.key,path:["container","key"],namespace:"container"});for(let[i,r]of t.sourceMembers.entries())s.push({key:r.key,path:["sourceMembers",i,"key"],namespace:"source member"});for(let[i,r]of t.businessMembers.entries())s.push({key:r.key,path:["businessMembers",i,"key"],namespace:"business member"});for(let[i,r]of t.placementUnits.entries())s.push({key:r.key,path:["placementUnits",i,"key"],namespace:"placement unit"});for(let[i,r]of(t.visualAnchors??[]).entries())s.push({key:r.key,path:["visualAnchors",i,"key"],namespace:"visual anchor"});let a=new Map;for(let i of s){let r=a.get(i.key);r?n.addIssue({code:"custom",path:i.path,message:`${i.namespace} key collides with ${r}: ${i.key}`}):a.set(i.key,i.namespace)}}function Xp(t,n,s){let a=new Set;for(let[i,r]of t.sourceMembers.entries()){let _=`${r.parentKey??"<root>"}:${r.order}`;if(a.has(_)&&s.addIssue({code:"custom",path:["sourceMembers",i,"order"],message:"Source member order must be unique among siblings."}),a.add(_),r.parentKey===r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member cannot be its own parent."}),r.parentKey!==null){let j=n.get(r.parentKey);j?j.childKeys.includes(r.key)||s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member parentKey must reference a source member."})}for(let[j,E]of r.childKeys.entries()){if(E===r.key){s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source member cannot be its own child."});continue}let O=n.get(E);O?O.parentKey!==r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source child key must reference a source member."})}let c=new Set,g=r;for(;g;){if(c.has(g.key)){s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member graph must be acyclic."});break}c.add(g.key),g=g.parentKey===null?void 0:n.get(g.parentKey)}}}var Kt=p.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","delete-page-source"]),uo=p.lazy(()=>p.union([p.string(),p.number(),p.boolean(),p.null(),p.array(uo),p.record(p.string(),uo)])),Zp=p.discriminatedUnion("kind",[p.object({kind:p.literal("node"),key:p.string().min(1)}).strict(),ro,p.object({kind:p.literal("route"),composition:se}).strict(),p.object({kind:p.literal("source-file"),path:le}).strict(),p.object({kind:p.literal("source-batch"),paths:p.array(le).min(1)}).superRefine((t,n)=>{let s=new Set;for(let[a,i]of t.paths.entries())s.has(i)&&n.addIssue({code:"custom",path:["paths",a],message:`Duplicate source target path: ${i}`}),s.add(i)}).strict(),p.object({kind:p.literal("project")}).strict()]),Qp=p.discriminatedUnion("kind",[p.object({kind:p.literal("node"),key:p.string().min(1)}).strict(),co,p.object({kind:p.literal("route"),composition:L}).strict(),p.object({kind:p.literal("source-file"),path:le}).strict(),p.object({kind:p.literal("source-batch"),paths:p.array(le).min(1)}).strict(),p.object({kind:p.literal("project")}).strict()]),_o=p.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"]),ho=p.enum(["hover","active","focus","disabled"]),So=p.enum(["sm","md","lg","xl","2xl"]),go=p.union([p.object({relation:p.enum(["before","after"]),anchorKey:p.string().min(1)}),p.object({relation:p.enum(["prepend","append"]),parentKey:p.string().min(1)}),oo]),Jp=p.union([p.object({kind:p.literal("native-tag"),tag:p.string().min(1),text:p.string().optional()}),p.object({kind:p.literal("component-call"),component:p.object({source:p.string().min(1),exportName:p.string().min(1)}),materialization:p.never().optional(),props:p.record(p.string(),p.unknown()).optional()}).strict(),p.object({kind:p.literal("component-call"),component:p.never().optional(),materialization:at,props:p.record(p.string(),p.never()).optional()}).strict()]),ed=p.discriminatedUnion("kind",[p.object({kind:p.literal("update-text"),segmentIndex:p.number().int().min(0),value:p.string()}),p.object({kind:p.literal("update-array-item"),segmentIndex:p.number().int().min(0),index:p.number().int().min(0),value:p.string()}),p.object({kind:p.literal("remove-node")}),p.object({kind:p.literal("insert-child"),node:Jp,position:p.union([go,ao])}),p.object({kind:p.literal("move-node"),target:go,preserveBindings:p.boolean().optional()}),p.object({kind:p.literal("set-class-name-source"),filePath:p.string().min(1),expectedVersion:p.object({documentVersion:p.number().int().nonnegative(),contentHash:p.string().min(1)}),oldAttrRaw:p.string().min(1).nullable(),oldAttrRange:ct.nullable(),openingElementRange:ct,newAttrRaw:p.string().min(1).nullable(),intent:Cs}),p.object({kind:p.literal("set-props"),props:p.partialRecord(Ds,p.string())}),p.object({kind:p.literal("apply-style-draft"),className:p.object({filePath:p.string().min(1),expectedVersion:p.object({documentVersion:p.number().int().nonnegative(),contentHash:p.string().min(1)}),oldAttrRaw:p.string().min(1).nullable(),oldAttrRange:ct.nullable(),openingElementRange:ct,newAttrRaw:p.string().min(1).nullable(),intent:Cs}).optional(),props:p.partialRecord(Ds,p.string()).optional()}).superRefine((t,n)=>{!t.className&&!t.props&&n.addIssue({code:"custom",message:"apply-style-draft requires className or props"})}),p.object({kind:p.literal("source-edit"),conflictPolicy:p.enum(["compare-and-swap","overwrite"]),edits:p.array(p.discriminatedUnion("operation",[p.object({operation:p.literal("upsert"),path:le,content:p.string(),baseContentHash:p.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{ps(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"})}),p.object({operation:p.literal("delete"),path:le,capability:aa,confirmDelete:p.literal(!0),confirmPath:le,baseContentHash:p.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{t.capability!==ls&&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"}),ps(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit delete only accepts allowlisted text source files"});let s=ds(t.path);s&&n.addIssue({code:"custom",path:["path"],message:`Protected source file cannot be deleted: ${t.path} (${s})`})})])).min(1),reason:p.string().min(1).optional()}).strict().superRefine((t,n)=>{let s=new Set;for(let[a,i]of t.edits.entries())s.has(i.path)&&n.addIssue({code:"custom",path:["edits",a,"path"],message:`Duplicate source edit path: ${i.path}`}),s.add(i.path),t.conflictPolicy==="compare-and-swap"&&i.baseContentHash===void 0&&n.addIssue({code:"custom",path:["edits",a,"baseContentHash"],message:"source-edit compare-and-swap requires baseContentHash for every edit"})}),p.object({kind:p.literal("insert-page-resource"),artifact:As}).strict(),p.object({kind:p.literal("delete-page-source"),expectedUrlPath:p.string().startsWith("/")}).strict()]),fo=p.enum(["NODE_NOT_FOUND","HOME_PAGE_LOCKED","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"]),bo=p.object({code:fo,message:p.string().min(1),details:p.record(p.string(),p.unknown()).optional()}),yo=p.object({key:p.string().min(1),instanceIndex:p.number().int().nonnegative().optional(),instanceCount:p.number().int().positive().optional()}),Os=p.object({id:p.string().min(1),siteId:I,baseSnapshotId:x,composition:se,kind:Kt,target:Zp,documentVersion:p.number().int().nonnegative(),selectionRef:yo.optional(),mutationContext:Ft.optional(),params:ed}).strict().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 s=t.params.edits.map(i=>i.path),a=t.target.kind==="source-file"?[t.target.path]:t.target.paths;id(s,a)||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.kind==="delete-page-source"?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 or delete-page-source"}),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"})}),oI=Os,td=p.object({kind:p.literal("insert-page-resource"),package_instance_id:p.string().min(1),pages:p.array($a).min(1)}).strict().superRefine((t,n)=>{let s=new Set,a=new Set;for(let[i,r]of t.pages.entries())s.has(r.template_page_id)&&n.addIssue({code:"custom",path:["pages",i,"template_page_id"],message:`Duplicate template page route mapping: ${r.template_page_id}`}),a.has(r.final_route)&&n.addIssue({code:"custom",path:["pages",i,"final_route"],message:`Duplicate final route mapping: ${r.final_route}`}),s.add(r.template_page_id),a.add(r.final_route)}),nd=p.object({kind:p.literal("delete-page-source"),deleted_files:p.array(p.string().min(1)),updated_files:p.array(p.string().min(1)),preserved_shared_files:p.array(p.string().min(1)),warnings:p.array(p.string().min(1))}).strict(),sd=p.discriminatedUnion("kind",[td,nd]),xo=p.object({requestId:p.string().min(1),kind:Kt,composition:L,target:Qp,resultVersion:p.number().int().nonnegative(),affectedFiles:p.array(p.string().min(1)).optional(),selectionRef:yo.optional(),output:sd.optional()}).strict(),Ns=xo.superRefine((t,n)=>{let s=t.kind==="insert-page-resource"||t.kind==="delete-page-source";s&&t.target.kind!=="project"?n.addIssue({code:"custom",path:["target","kind"],message:`${t.kind} result requires a project target`}):!s&&t.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project result target requires a project operation"}),s&&!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"})}),rI=to({dataSchema:Ns,codeSchema:fo,failureDataSchema:xo.partial()});function id(t,n){return t.length===n.length&&t.every((s,a)=>s===n[a])}var ad=X.enum(["component","page","pages"]),od=X.object({resource_kind:ad,resource_name:X.string().trim().min(1).max(200),file_count:X.number().int().min(1).max(64),total_bytes:X.number().int().min(0).max(4*1024*1024),content_digest:X.string().regex(/^sha256:[a-f0-9]{64}$/),custom_prompt:X.string().trim().min(1).max(4e3).optional(),final_routes:X.array(X.string().min(1)).max(64)}).strict(),rd=X.discriminatedUnion("kind",[X.object({kind:X.literal("none")}).strict(),X.object({kind:X.literal("primary"),items:X.array(X.object({label:X.string().trim().min(1).max(120),href:X.string().startsWith("/").max(200)}).strict()).min(1).max(64)}).strict().superRefine((t,n)=>{let s=new Set;for(let[a,i]of t.items.entries())s.has(i.href)&&n.addIssue({code:"custom",path:["items",a,"href"],message:`Duplicate navigation href: ${i.href}`}),s.add(i.href)})]),cd=X.object({base_snapshot_id:X.string().min(1),operation:Os,navigation_selection:rd.optional()}).strict().superRefine((t,n)=>{t.base_snapshot_id!==t.operation.baseSnapshotId&&n.addIssue({code:"custom",path:["operation","baseSnapshotId"],message:"Resource operation baseSnapshotId must match base_snapshot_id."})});function md(t){return t.kind==="insert-child"&&t.params.kind==="insert-child"&&t.params.node.kind==="component-call"&&"materialization"in t.params.node&&t.params.node.materialization?[t.params.node.materialization]:t.kind==="insert-page-resource"&&t.params.kind==="insert-page-resource"?[...t.params.artifact.components.map(n=>n.materialization),...t.params.artifact.pages.map(n=>n.materialization)]:[]}var Eo=X.object({id:X.string().min(1),tenant_id:X.string().min(1),site_id:X.string().min(1),run_id:X.string().min(1).optional(),correlation_id:X.string().min(1).optional(),sent_at:X.string().min(1),type:X.literal("client.resource.operation.create"),payload:X.object({client_message_id:X.string().min(1),display:od,transient_resource_input:cd}).strict()}).strict().superRefine((t,n)=>{let{display:s,transient_resource_input:a}=t.payload;t.site_id!==a.operation.siteId&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","siteId"],message:"Resource operation siteId must match envelope site_id."});let i=s.resource_kind==="component"?"insert-child":"insert-page-resource";a.operation.kind!==i&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","kind"],message:`${s.resource_kind} resources require ${i}.`});let _=md(a.operation).flatMap(g=>g.files),c=_.reduce((g,j)=>g+new TextEncoder().encode(j.content).byteLength,0);if(_.length>xs&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate file count limit."}),c>Es&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate content byte limit."}),s.file_count!==_.length&&n.addIssue({code:"custom",path:["payload","display","file_count"],message:"Resource summary file_count must match the transient operation."}),s.total_bytes!==c&&n.addIssue({code:"custom",path:["payload","display","total_bytes"],message:"Resource summary total_bytes must match the transient operation."}),a.operation.kind==="insert-page-resource"&&a.operation.params.kind==="insert-page-resource"){let g=a.operation.params.artifact;g.resource_type!==s.resource_kind&&n.addIssue({code:"custom",path:["payload","display","resource_kind"],message:"Resource summary kind must match the page artifact resource_type."});let j=g.pages.map(E=>E.final_route);(j.length!==s.final_routes.length||j.some((E,O)=>E!==s.final_routes[O]))&&n.addIssue({code:"custom",path:["payload","display","final_routes"],message:"Resource summary final_routes must match the page artifact routes."})}if(a.navigation_selection?.kind==="primary"){let g=new Set(s.final_routes);for(let[j,E]of a.navigation_selection.items.entries())g.has(E.href)||n.addIssue({code:"custom",path:["payload","transient_resource_input","navigation_selection","items",j,"href"],message:"Navigation selection href must reference a final resource route."})}});import{z as T}from"zod";var ld=["with_website","without_website"],wn=T.enum(ld),Ls=T.string().trim().url().refine(t=>{let n=new URL(t).protocol;return n==="http:"||n==="https:"},{message:"Website must use the http or https protocol."}),pd=["welcome","website_scan","customer_materials","analysis","diagnosis","strategy","structure_planning","preview_personalization","publishing"],zt=T.enum(pd),dd=["company_info","website_crawl","website_basic_info_extract","website_metrics_evaluate","intelligent_analysis","strategy_recommendation"],Ro=T.enum(dd),ud=["started","running","succeeded","failed","invalidated"],To=T.enum(ud),gd=["draft","structure_saved","generating","workspace_ready"],Ms=T.enum(gd),_d=["not_deployed","deploying","deployed"],Us=T.enum(_d),hd=["active","completed"],Sd=T.enum(hd),fd=["completed","current","locked"],bd=T.enum(fd),ko={draft:10,structure_saved:20,generating:30,workspace_ready:40},Po={not_deployed:10,deploying:20,deployed:30},wo={active:10,completed:20},Ao={started:10,running:20,succeeded:30,failed:40,invalidated:50};function An(t){return new Map(Object.entries(t).map(([n,s])=>[s,n]))}var yd=An(ko),xd=An(Po),Ed=An(wo),Id=An(Ao);function SI(t){let n=yd.get(t);if(!n)throw new Error(`Unknown site build status code: ${t}`);return n}function fI(t){let n=xd.get(t);if(!n)throw new Error(`Unknown site deployment status code: ${t}`);return n}function bI(t){let n=Ed.get(t);if(!n)throw new Error(`Unknown site workflow status code: ${t}`);return n}function yI(t){let n=Id.get(t);if(!n)throw new Error(`Unknown task execution status code: ${t}`);return n}function xI(t){return ko[t]}function EI(t){return Po[t]}function II(t){return wo[t]}function RI(t){return Ao[t]}var Fs=[{definition_version:1,published:!0,required_client_capability:null,definitions:{with_website:[{id:"01900000-0000-7000-8000-000000000001",node_code:"welcome",label:"\u6B22\u8FCE\u542F\u52A8",sort_order:1,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000002",node_code:"website_scan",label:"\u521D\u59CB\u5316\u9700\u6C42\u4E0E\u5B98\u7F51\u626B\u63CF",sort_order:2,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000003",node_code:"analysis",label:"\u667A\u80FD\u5206\u6790",sort_order:3,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000004",node_code:"diagnosis",label:"\u8BCA\u65AD\u62A5\u544A",sort_order:4,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000005",node_code:"strategy",label:"\u7B56\u7565\u4E0E\u5EFA\u8BAE",sort_order:5,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000014",node_code:"structure_planning",label:"\u7ED3\u6784\u89C4\u5212",sort_order:6,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000015",node_code:"preview_personalization",label:"\u9884\u89C8\u4E0E\u4E2A\u6027\u5316",sort_order:7,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000016",node_code:"publishing",label:"\u7F51\u7AD9\u53D1\u5E03",sort_order:8,is_enabled:!0}],without_website:[{id:"01900000-0000-7000-8000-00000000000b",node_code:"welcome",label:"\u6B22\u8FCE\u542F\u52A8",sort_order:1,is_enabled:!0},{id:"01900000-0000-7000-8000-00000000000c",node_code:"customer_materials",label:"\u5BA2\u6237\u8D44\u6599\u63D0\u4F9B",sort_order:2,is_enabled:!0},{id:"01900000-0000-7000-8000-00000000000d",node_code:"analysis",label:"\u667A\u80FD\u5206\u6790",sort_order:3,is_enabled:!0},{id:"01900000-0000-7000-8000-00000000000e",node_code:"strategy",label:"\u7B56\u7565\u4E0E\u5EFA\u8BAE",sort_order:4,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000017",node_code:"structure_planning",label:"\u7ED3\u6784\u89C4\u5212",sort_order:5,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000018",node_code:"preview_personalization",label:"\u9884\u89C8\u4E0E\u4E2A\u6027\u5316",sort_order:6,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000019",node_code:"publishing",label:"\u7F51\u7AD9\u53D1\u5E03",sort_order:7,is_enabled:!0}]}}],TI=Fs[0].definitions,vo=T.number().int().min(1),Rd=T.object({id:G,flow_type:wn,definition_version:vo,node_code:zt,label:T.string().min(1),sort_order:T.number().int().min(1),is_enabled:T.boolean(),state:bd}),Co=T.object({id:Zi,tenant_id:T.string().min(1),site_id:I,workflow_id:Oe,node_code:zt,task_type:Ro,external_task_id:T.string().min(1),execution_status:To,idempotency_key:T.string().min(1),attempt_no:T.number().int().min(1),superseded_at:T.string().min(1).nullable(),created_at:T.string().min(1),updated_at:T.string().min(1)}),Td=T.object({id:Oe,tenant_id:T.string().min(1),site_id:I,flow_type:wn,website:Ls.nullable(),definition_version:vo,current_node_code:zt,status:Sd,started_at:T.string().min(1),completed_at:T.string().min(1).nullable(),created_at:T.string().min(1),updated_at:T.string().min(1)}),qs=T.object({workflow:Td,menu:T.array(Rd),task_refs:T.array(Co),site:T.object({default_locale:pe.optional(),status:Ms,deployment_status:Us,archived_at:T.string().min(1).nullable(),current_sitemap_id:T.string().nullable().optional(),current_sitemap_version:T.number().int().positive().nullable().optional(),confirmed_sitemap_id:T.string().nullable().optional(),confirmed_sitemap_version:T.number().int().positive().nullable().optional(),structure_confirmed_at:T.string().min(1).nullable().optional(),current_snapshot_id:T.string().nullable(),deployed_url:T.string().url().nullable(),cms_site_id:T.string().min(1).nullish()})}),kI=M(qs),PI=M(Co),Io=T.array(T.string().min(1).max(64)).max(16).optional(),wI=T.discriminatedUnion("flow_type",[T.object({flow_type:T.literal("with_website"),website:Ls,client_capabilities:Io}).strict(),T.object({flow_type:T.literal("without_website"),website:T.null().optional(),client_capabilities:Io}).strict()]),AI=T.object({expected_current_node:T.literal("website_scan"),website:Ls}).strict(),vI=T.object({expected_current_node:zt}).strict(),CI=T.object({expected_current_node:T.literal("publishing")}).strict(),kd=T.object({node_code:zt,task_type:Ro,external_task_id:T.string().min(1).max(255),idempotency_key:T.string().min(1).max(255)}),DI=kd.extend({workflow_id:Oe}).strict(),jI=T.object({external_task_id:T.string().min(1).max(255),execution_status:To}),Pd=T.object({previous_external_task_id:T.string().min(1).max(255),external_task_id:T.string().min(1).max(255),idempotency_key:T.string().min(1).max(255)}),OI=Pd.extend({workflow_id:Oe}).strict(),wd=T.object({previous_external_task_id:T.string().min(1).max(255),external_task_id:T.string().min(1).max(255),idempotency_key:T.string().min(1).max(255)}),NI=wd.extend({workflow_id:Oe}).strict(),LI=T.object({}).strict();function Ad(t,n,s){return t.find(a=>a.definition_version===s)?.definitions[n]}function vd(t,n){return Ad(Fs,t,n)}function Cd(t,n=1){let s=vd(t,n);if(!s)throw new Error(`Unknown workflow definition: ${t} v${n}.`);return s}function Dd(t,n,s){let a=new Set(s);return t.filter(i=>i.published&&(i.required_client_capability===null||a.has(i.required_client_capability))).sort((i,r)=>r.definition_version-i.definition_version).map(i=>({definition_version:i.definition_version,items:i.definitions[n]}))[0]}function MI(t,n){return Dd(Fs,t,n)}function UI(t,n){return Cd(t).findIndex(s=>s.node_code===n)}function FI(t,n){return t==="website_scan"?n==="website_crawl"||n==="website_basic_info_extract"||n==="website_metrics_evaluate":t==="customer_materials"?n==="company_info":t==="analysis"?n==="intelligent_analysis":t==="strategy"?n==="strategy_recommendation":!1}function qI(t,n){if(t===n)return n;if(!{started:["running","succeeded","failed","invalidated"],running:["succeeded","failed","invalidated"],succeeded:["invalidated"],failed:["invalidated"],invalidated:[]}[t].includes(n))throw new Error(`Invalid task execution status transition: ${t} -> ${n}`);return n}function GI(t,n){if(t===n)return n;if(!{draft:["structure_saved"],structure_saved:["generating","draft"],generating:["workspace_ready","structure_saved"],workspace_ready:[]}[t].includes(n))throw new Error(`Invalid site build status transition: ${t} -> ${n}`);return n}import{z as f}from"zod";var Gs=f.string().min(1).max(120).regex(/^[a-z][a-z0-9_-]*$/),Re=f.string().min(1).max(120).regex(/^[A-Za-z_][A-Za-z0-9_]*$/),jd=f.enum(["text","select","multi_select","tags","category_list","boolean","number"]),Bt=f.string().min(1).max(512).regex(/^\/(?:[^?#]*)$/),Od=f.object({minimum:f.number().finite(),maximum:f.number().finite(),step:f.number().finite().positive()}).strict().refine(t=>t.minimum<t.maximum,{message:"minimum must be less than maximum"}),Nd=f.string().trim().min(1).max(100),jo=f.array(Nd).max(5).refine(t=>new Set(t.map(n=>n.toLowerCase())).size===t.length,{message:"popular_terms must be unique ignoring case"}),WI=f.array(f.string()).max(20).transform(t=>{let n=new Set;return t.map(s=>s.trim()).filter(s=>{if(s.length===0||s.length>100)return!1;let a=s.toLowerCase();return n.has(a)?!1:(n.add(a),!0)}).slice(0,5)}),Oo=f.object({filter_enabled:f.boolean(),selected_fields:f.array(Re).max(64),selected_card_fields:f.array(Re).max(64).default([]),popular_terms_enabled:f.boolean().default(!1),popular_terms:jo.optional()}).strict(),Ld=f.object({app_slug:Gs}).extend(Oo.shape).strict(),Ks=f.object({kind:f.literal("product_search_confirmation"),baseline_snapshot_id:x,target_route_id:Bt,applications:f.array(f.object({app_slug:Gs,label:f.string().min(1).max(200),popular_terms:jo.default([]),current_config:Oo.nullable().default(null),affected_routes:f.array(Bt).max(64).default([]),fields:f.array(f.object({field_name:Re,label:f.string().min(1).max(200),value_shape:jd,option_count:f.number().int().nonnegative().optional(),filter_meta:Od.optional()}).strict()).max(64)}).strict()).min(1).max(12),current_config:Ld.nullable().optional(),affected_routes:f.array(Bt).min(1).max(64).optional()}).strict(),Md=f.object({kind:f.literal("product_search_confirmation"),action:f.enum(["confirm","modify"]),app_slug:Gs,filter_enabled:f.boolean(),popular_terms_enabled:f.boolean().default(!1),selected_fields:f.array(Re).max(64),selected_card_fields:f.array(Re).max(64).default([])}).strict().superRefine((t,n)=>{t.filter_enabled&&t.selected_fields.length===0&&n.addIssue({code:"custom",path:["selected_fields"],message:"selected_fields must not be empty while filters are enabled"}),new Set(t.selected_fields).size!==t.selected_fields.length&&n.addIssue({code:"custom",path:["selected_fields"],message:"selected_fields must be unique"}),new Set(t.selected_card_fields).size!==t.selected_card_fields.length&&n.addIssue({code:"custom",path:["selected_card_fields"],message:"selected_card_fields must be unique"})}),vn=f.union([Md,f.object({kind:f.literal("product_search_confirmation"),action:f.literal("cancel")}).strict()]),Wt=f.union([f.string().max(255),f.number().finite(),f.boolean()]),Ud=f.object({values:f.array(Wt).min(1).max(20).refine(t=>new Set(t.map(n=>`${typeof n}:${String(n)}`)).size===t.length,{message:"values must be unique"})}).strict(),Fd=f.object({min:f.number().finite().optional(),max:f.number().finite().optional(),include_unlabeled:f.boolean().optional()}).strict().refine(t=>t.min!==void 0||t.max!==void 0||t.include_unlabeled===!0,{message:"a numeric boundary or include_unlabeled is required"}).refine(t=>t.min===void 0||t.max===void 0||t.min<=t.max,{message:"min must not be greater than max"}),qd=f.object({q:f.string().max(200),page:f.number().int().min(1).max(500),page_size:f.union([f.literal(9),f.literal(20)]),sort:f.enum(["published_at_desc","published_at_asc","product_name_asc","product_name_desc"]),filters:f.record(Re,f.union([Ud,Fd])).superRefine((t,n)=>{Object.keys(t).length>12&&n.addIssue({code:"custom",message:"filters must contain at most 12 fields"})}),display_fields:f.array(Re).max(64).default([]),missing_count_fields:f.array(Re).max(12).default([]),relaxation_count_fields:f.array(Re).max(12).default([]),facets:f.array(f.object({field:Re,query:f.string().max(100),page:f.number().int().min(1).max(100),page_size:f.literal(10),include_values:f.array(Wt).max(20)}).strict()).max(8)}).strict(),Do=f.object({value:Wt,label:f.string().max(200),count:f.number().int().nonnegative()}).strict(),Gd=f.union([Wt,f.array(Wt).max(50)]),Kd=f.object({items:f.array(f.object({id:f.number().int().positive(),thumbnail:f.string().max(2048).nullable(),title:f.string().max(300),summary:f.string().max(2e3),category:f.string().max(300).nullable(),field_values:f.record(Re,Gd).default({}),url:f.string().min(1).max(2048)}).strict()).max(20),page:f.object({total:f.number().int().nonnegative(),page:f.number().int().positive(),page_size:f.union([f.literal(9),f.literal(20)])}).strict(),facets:f.array(f.object({field:Re,total:f.number().int().nonnegative(),page:f.number().int().positive(),page_size:f.literal(10),values:f.array(Do).max(10),selected_values:f.array(Do).max(20)}).strict()).max(8),missing_counts:f.record(Re,f.number().int().nonnegative()).default({}),relaxation_counts:f.record(Re,f.number().int().nonnegative()).default({})}).strict(),VI=f.object({contract_version:f.literal(1),request:qd,response:Kd}).strict();import{z as Vt}from"zod";var zd=["deployment_queued","prepare_source","build_artifact","publish_site","site_released","cleanup_release"],Bd=Vt.enum(zd),Wd=Vt.enum(["running","succeeded","failed"]),Vd=Vt.object({code:Bd,status:Wd,message:Vt.string().trim().min(1)}).strict(),No=Vt.array(Vd);import{z as R}from"zod";var $d=R.enum(["pending","running","succeeded","failed"]),Hd=R.object({task_id:R.string().uuid(),site_url:R.string().url(),crawler_task_id:R.string().min(1).max(255).nullable(),page_count:R.number().int().min(0).max(20),status:$d,error:R.string().nullable(),created_at:R.string().min(1),updated_at:R.string().min(1)}),QI=M(Hd),zs=R.enum(["existing_site","new_site"]),Lo=R.enum(["google_indexing","ai_recommendation","qualification_verifiability","content_freshness","inquiry_form","inquiry_response","privacy_compliance","prohibited_content"]),Bs=R.object({label:R.string().trim(),value:R.union([R.string(),R.number(),R.boolean(),R.null()]),summary:R.string().trim(),tone:R.enum(["good","warn","bad","unknown"]),status:R.enum(["ok","unknown"])}),Cn=R.object({key:R.string().trim().min(1).max(100),label:R.string().trim().min(1).max(100),value:R.union([R.string().max(1e3),R.number(),R.boolean(),R.null()]),tone:R.enum(["good","warn","bad","unknown"]),status:R.enum(["ok","unknown"]),evidence:R.string().trim().max(2e3).optional()}).strict(),Yd=R.object({url:R.string().url().max(2048),title:R.string().trim().max(300),words:R.number().int().nonnegative().max(1e7)}).strict(),Xd=R.object({site_url:R.string().url().max(2048),scanned_at:R.string().datetime({offset:!0}),reach:R.array(Cn).max(64),trust:R.array(Cn).max(64),convert:R.array(Cn).max(64),safe:R.array(Cn).max(64),pages:R.array(Yd).max(100)}).strict(),Dn=R.object({company_task_id:R.string().min(1).max(128),scan_task_id:R.string().min(1).max(128),type:zs,result:R.object({company_name:R.string(),website:R.string().url().optional(),primary_product:R.string(),current_market:R.string(),qualifications:R.string(),scan_cards:R.record(R.string(),Bs),scan_result:Xd.optional()})}),Zd=R.object({saved:R.literal(!0),company_task_id:R.string().min(1).max(128),scan_task_id:R.string().min(1).max(128)}),JI=M(Zd),Qd=R.enum(["snapshot","task"]),Jd=Dn.shape.result.extend({type:zs,structured_facts:R.unknown().optional()}).extend({company_name:R.string(),primary_product:R.string(),current_market:R.string(),qualifications:R.string()}),eu=R.object({site_id:R.string().min(1).max(128),company_task_id:R.string().min(1).max(128),scan_task_id:R.string().min(1).max(128),type:zs,data_source:Qd,result:Jd}),eR=M(eu.nullable());import{z as ue}from"zod";var $e=ue.enum(["company","product_service","case_qualification","market","contact_inquiry","privacy_compliance","news_freshness"]),tu=ue.object({ordinal:ue.number().int().min(1).max(1e4),path:ue.string().min(1).max(2048).refine(t=>!iu(t),{message:"path must be a site-relative path, not an absolute URL"}),last_modified:ue.string().max(64).nullable()}).strict(),sR=ue.object({candidates:ue.array(tu).min(1).max(1e4),selection_limit:ue.number().int().min(1).max(19)}).strict().superRefine((t,n)=>{let s=t.candidates.map(a=>a.ordinal).sort((a,i)=>a-i);for(let[a,i]of s.entries())if(i!==a+1){n.addIssue({code:"custom",path:["candidates"],message:"candidates ordinals must be unique and consecutive from 1"});return}}),nu=ue.object({ordinal:ue.number().int().positive().max(1e4),roles:ue.array($e).min(1).max(7)}).strict(),su=ue.object({role:$e,status:ue.enum(["selected","not_found"]),selected_ordinals:ue.array(ue.number().int().positive().max(1e4)).max(19)}).strict(),iR=ue.object({selections:ue.array(nu).max(19),coverage:ue.array(su).length(7)}).strict().superRefine((t,n)=>{let s=new Set;for(let[i,r]of t.coverage.entries())s.has(r.role)&&n.addIssue({code:"custom",path:["coverage",i,"role"],message:"coverage roles must be unique"}),s.add(r.role);for(let i of $e.options)s.has(i)||n.addIssue({code:"custom",path:["coverage"],message:`coverage must include every page role (missing ${i})`});let a=new Map;for(let i of t.selections)for(let r of i.roles){let _=a.get(r)??new Set;_.add(i.ordinal),a.set(r,_)}for(let[i,r]of t.coverage.entries()){let _=a.get(r.role);r.selected_ordinals.some(g=>!_?.has(g))&&n.addIssue({code:"custom",path:["coverage",i,"selected_ordinals"],message:"selected_ordinals must reference selections carrying the same role"})}});function iu(t){let n=t.toLowerCase();return n.startsWith("http://")||n.startsWith("https://")||t.startsWith("//")}import{z as h}from"zod";var cR=h.object({force_refresh:h.boolean().optional()}),Uo=h.enum(["running","succeeded","failed"]),au=h.object({agent_id:h.string().min(1),name:h.string().min(1),icon:h.string().min(1),capability:h.string().min(1),data_source:h.string().min(1),output_topics:h.string().min(1)}),ou=h.object({site_mode:h.enum(["existing_site","new_site"]),scan_required:h.boolean(),scheduled_agent_ids:h.array(h.string().min(1)),omitted_agent_ids:h.array(h.string().min(1)),next_stage:h.enum(["diagnostic_report","strategy"])}),ru=h.object({t:h.string(),d:h.string(),evidence:h.object({from:h.string(),url:h.string().nullable().optional(),value:h.string().nullable().optional()})}),cu=h.enum(["complete","partial","insufficient_data","failed"]),mu=h.enum(["ok","failed","insufficient_data"]),Ws=h.object({agent_id:h.string().min(1),name:h.string().min(1),icon:h.string().min(1),status:mu,topics:h.array(h.object({topic_id:h.string().min(1),status:cu,evidence_refs:h.array(h.string())})).length(3),findings:h.array(ru).max(3),elapsed_ms:h.number().nonnegative(),note:h.string().optional(),error:h.string().optional()}),Fo=h.object({total:h.number().int().nonnegative(),ok:h.number().int().nonnegative(),degraded:h.number().int().nonnegative(),total_findings:h.number().int().nonnegative(),elapsed_ms:h.number().nonnegative(),site_mode:h.enum(["existing_site","new_site"]).optional(),scheduled_agent_ids:h.array(h.string()).optional(),omitted_agent_ids:h.array(h.string()).optional(),scheduled:h.number().int().nonnegative().optional(),complete:h.number().int().nonnegative().optional(),partial:h.number().int().nonnegative().optional(),insufficient:h.number().int().nonnegative().optional(),failed:h.number().int().nonnegative().optional(),next_stage:h.enum(["diagnostic_report","strategy"]).optional()}),lu=h.object({agents_done:h.boolean(),analysis:h.record(h.string(),Ws),step4_scoring_input:h.unknown().optional(),summary:Fo}),qo=h.object({job_id:h.string().min(1),site_id:h.string().min(1),model_version:h.string().min(1),output_locale:h.string().min(2),cached:h.boolean().optional(),status:Uo,result:lu.nullable().optional(),error:h.string().nullable().optional()}),mR=M(h.array(au)),lR=M(ou),pR=M(qo),dR=M(qo.nullable()),Ge=h.object({id:h.union([h.number().int().nonnegative(),h.string().regex(/^(0|[1-9]\d*)$/u).transform(Number)]).pipe(h.number().int().nonnegative())}),Mo=h.object({percent:h.number().int().min(0).max(100),phase:h.enum(["preparing","analyzing","finalizing","completed","failed"]),stage:h.enum(["queued","baseline_ready","source_pages_ready","external_evidence_ready","knowledge_evidence_ready","page_evidence_ready","analysis_context_ready","preparation_saved","workflow_ready","agent_started","agent_completed","workflow_completed","scoring_input_ready","red_texts_ready","result_ready","result_persisted","completed","failed"]),agents_done:h.number().int().nonnegative(),agents_total:h.number().int().nonnegative(),agent_id:h.string().min(1).optional()}),uR=h.discriminatedUnion("event",[Ge.extend({event:h.literal("snapshot"),data:h.object({job_id:h.string().min(1),status:Uo,done:h.number().int().nonnegative(),total:h.number().int().nonnegative(),results:h.array(Ws),progress:Mo.optional()})}),Ge.extend({event:h.literal("progress"),data:Mo}),Ge.extend({event:h.literal("preparing_started"),data:h.object({stage:h.literal("baseline")})}),Ge.extend({event:h.literal("preparing_progress"),data:h.object({stage:h.enum(["context","external_evidence"])})}),Ge.extend({event:h.literal("preparing_done"),data:h.object({evidence_count:h.number().int().nonnegative(),rule_count:h.number().int().nonnegative(),degraded_capabilities:h.array(h.string())})}),Ge.extend({event:h.literal("agent_start"),data:h.object({agent_id:h.string().min(1),name:h.string().min(1),icon:h.string().min(1)})}),Ge.extend({event:h.literal("agent_done"),data:Ws}),Ge.extend({event:h.literal("done"),data:h.object({agents_done:h.literal(!0),summary:Fo})}),Ge.extend({event:h.literal("failed"),data:h.object({message:h.string().min(1)})})]);import{z as v}from"zod";var $s=v.enum(["reach","trust","convert","safe"]),ye=v.number().finite(),pu=v.number().finite().positive(),Vs=["reach","trust","convert","safe"],du=17,uu=v.enum(["passed","partial","failed"]),gu=v.object({landing_page_mode:v.enum(["intent_dynamic","static","none"]),ab_test_enabled:v.boolean()}).strict(),_u=v.union([v.boolean(),v.number().finite(),uu,gu]).nullable(),hu=v.union([v.boolean(),v.number().finite()]).nullable(),Su=v.object({competitor_avg:v.number().finite(),score_items:v.record(v.string(),_u),penalty_items:v.record(v.string(),hu),red_texts:v.array(v.string())}).strict(),fu=v.record($s,Su),bu=v.object({key:$s,score:ye,pass_score:ye,gap:ye}),yu=v.object({key:v.string(),title:v.string(),is_redline_option:v.boolean().optional(),score:ye,max_score:pu,pass_score:ye,passed:v.boolean(),description:v.string()}),xu=v.object({key:$s,title:v.string(),alias:v.string(),slogan:v.string(),score:ye,max_score:v.literal(100),pass_score:ye,competitor_average:ye,status:v.enum(["reached","near","not_reached"]),status_name:v.enum(["\u8FBE\u6807","\u63A5\u8FD1","\u672A\u8FBE\u6807"]),summary:v.string(),sub_dimensions:v.array(yu),red_texts:v.array(v.string()),redline_hit:v.boolean().optional()}),Eu=v.object({id:v.number().int().positive(),task_code:v.string().min(1).max(128),is_sync:v.literal(0),status:v.literal("succeeded"),rules:fu,scores_list:v.object({overview:v.object({pass_scores:v.object({reach:ye,trust:ye,convert:ye,safe:ye}),total_score:ye,total_pass_score:ye,score_gap:ye,competitor_average_score:ye,scoring_criteria_text:v.string().min(1),gap_dimensions:v.array(bu).max(4),overall_passed:v.boolean(),all_scores_passed:v.boolean(),diagnosis_passed:v.boolean(),commitment_eligible:v.boolean(),safe_redline_hit:v.boolean()}),dimensions:v.array(xu).length(4)}),created_at:v.string().datetime({offset:!0}),updated_at:v.string().datetime({offset:!0})}).superRefine((t,n)=>{Iu(t.scores_list.dimensions)||n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include each canonical score dimension."}),t.scores_list.dimensions.reduce((a,i)=>a+i.sub_dimensions.length,0)!==du&&n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include 17 subdimensions in total."});for(let[a,i]of t.scores_list.dimensions.entries()){if(i.redline_hit===void 0)continue;let r=i.sub_dimensions.findIndex(_=>_.is_redline_option===void 0);r!==-1&&n.addIssue({code:"custom",path:["scores_list","dimensions",a,"sub_dimensions",r,"is_redline_option"],message:"subdimensions must define is_redline_option when redline_hit is defined."})}}),SR=M(Eu);function Iu(t){let n=t.map(s=>s.key);return n.length===Vs.length&&new Set(n).size===Vs.length&&Vs.every(s=>n.includes(s))}var He={queued:["preparing_source","lock_failed","deploy_failed"],preparing_source:["building","source_prepare_failed","deploy_failed"],building:["artifact_ready","build_failed","artifact_fetch_failed","artifact_validation_failed","deploy_failed"],artifact_ready:["deploying","deploy_failed"],deploying:["released","deploy_failed"],released:[],lock_failed:[],source_prepare_failed:[],build_failed:[],artifact_fetch_failed:[],artifact_validation_failed:[],deploy_failed:[],cleanup_failed:[]};for(let t of Object.values(He))Object.freeze(t);Object.freeze(He);var yR=Object.freeze(_t.filter(t=>He[t].length>0)),xR=Object.freeze(_t.filter(t=>He[t].length===0)),Ru=Object.freeze(["preparing_source","building","artifact_ready","deploying","released"]),Tu="DEPLOYMENT_TRANSITION_INVALID",Hs=class extends Error{constructor(n,s){super(`Invalid deployment transition: ${n} -> ${s}`),this.currentStatus=n,this.nextStatus=s,this.code=Tu,this.name="DeploymentTransitionError"}};function ER(t){return He[t]}function IR(t){return _t.filter(n=>He[n].some(s=>s===t))}function ku(t){return He[t].length>0}function RR(t){return!ku(t)}function TR(t,n){if(!He[t].some(s=>s===n))throw new Hs(t,n);return n}function kR(){return Ru}import{z as Pu}from"zod";var AR=".i18n.json",jn="translation",Go=new Set(["__proto__","constructor","prototype"]);function zo(t){if(!On(t)||Object.keys(t).length===0)return Ye("I18N_ROOT_INVALID","Component i18n resources must be a non-empty object.",[]);for(let[n,s]of Object.entries(t)){if(Go.has(n))return Ko([n]);if(!wu(n))return Ye("I18N_LOCALE_INVALID",`Component i18n locale must be canonical BCP-47: ${n}`,[n]);if(!On(s))return Ye("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let a=Object.keys(s);if(a.length!==1||a[0]!==jn)return Ye("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let i=s[jn];if(!On(i))return Ye("I18N_RESOURCE_TREE_INVALID",`Component i18n translation namespace for ${n} must be an object.`,[n,jn]);let r=[{value:i,path:[n,jn]}];for(;r.length>0;){let _=r.pop();for(let[c,g]of Object.entries(_.value)){let j=[..._.path,c];if(Go.has(c))return Ko(j);if(typeof g!="string"){if(!On(g))return Ye("I18N_RESOURCE_TREE_INVALID","Component i18n resource leaves must be strings.",j);r.push({value:g,path:j})}}}}return{success:!0,data:t}}function vR(t){let n;try{n=JSON.parse(t)}catch{return Ye("I18N_JSON_INVALID","Component i18n resource file must contain valid JSON.",[])}return zo(n)}var CR=Pu.custom(t=>zo(t).success,"Invalid component i18n resources.");function wu(t){try{let n=Intl.getCanonicalLocales(t);return n.length===1&&n[0]===t}catch{return!1}}function On(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null}function Ko(t){return Ye("I18N_RESOURCE_KEY_FORBIDDEN",`Component i18n resource key is forbidden: ${t.at(-1)??""}`,t)}function Ye(t,n,s){return{success:!1,error:{code:t,message:n,path:s}}}var Ke="products",Au=`/${Ke}`,jR=Au,OR=`${Ke} detail`,NR="cms_collection_view",LR="list",MR="detail",Ne={zhHans:{pageTitle:"\u4EA7\u54C1\u4E2D\u5FC3",blockLabel:"\u4EA7\u54C1\u6982\u89C8",detailBlockLabel:"\u4EA7\u54C1\u8BE6\u60C5",heroBlockLabel:"\u4EA7\u54C1\u7B80\u4ECB",homeLabel:"\u9996\u9875"},zhHant:{pageTitle:"\u7522\u54C1\u4E2D\u5FC3",blockLabel:"\u7522\u54C1\u6982\u89BD",detailBlockLabel:"\u7522\u54C1\u8A73\u60C5",heroBlockLabel:"\u7522\u54C1\u7C21\u4ECB",homeLabel:"\u9996\u9801"},en:{pageTitle:"Products",blockLabel:"Products overview",detailBlockLabel:"Product details",heroBlockLabel:"Products Introduction",homeLabel:"Home"},de:{pageTitle:"Produkte",blockLabel:"Produkt\xFCbersicht",detailBlockLabel:"Produktdetails",heroBlockLabel:"Produkteinf\xFChrung",homeLabel:"Startseite"},fr:{pageTitle:"Produits",blockLabel:"Aper\xE7u des produits",detailBlockLabel:"D\xE9tails du produit",heroBlockLabel:"Pr\xE9sentation des produits",homeLabel:"Accueil"},es:{pageTitle:"Productos",blockLabel:"Resumen de productos",detailBlockLabel:"Detalles del producto",heroBlockLabel:"Introducci\xF3n de productos",homeLabel:"Inicio"},ja:{pageTitle:"\u88FD\u54C1",blockLabel:"\u88FD\u54C1\u6982\u8981",detailBlockLabel:"\u88FD\u54C1\u8A73\u7D30",heroBlockLabel:"\u88FD\u54C1\u7D39\u4ECB",homeLabel:"\u30DB\u30FC\u30E0"},ko:{pageTitle:"\uC81C\uD488",blockLabel:"\uC81C\uD488 \uAC1C\uC694",detailBlockLabel:"\uC81C\uD488 \uC0C1\uC138",heroBlockLabel:"\uC81C\uD488 \uC18C\uAC1C",homeLabel:"\uD648"}},vu=new Set(Object.values(Ne).map(t=>t.pageTitle)),Cu=new Set(Object.values(Ne).flatMap(t=>[t.blockLabel,t.detailBlockLabel,t.heroBlockLabel]));function UR(t){let n=t?.trim().toLowerCase()??"";if(n==="zh-tw"||n==="zh-hk"||n==="zh-mo")return Ne.zhHant;if(n.startsWith("zh"))return Ne.zhHans;switch(n.split("-")[0]){case"de":return Ne.de;case"fr":return Ne.fr;case"es":return Ne.es;case"ja":return Ne.ja;case"ko":return Ne.ko;case"en":default:return Ne.en}}function FR(t){return vu.has(t.trim())}function qR(t){return Cu.has(t.trim())}import{z as ge}from"zod";var BR=ge.object({key:ge.string().min(1),composition:se}).strict(),Ln=ge.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),Du=ge.enum(["direct","proxy","upstream","readonly","unsupported"]),ju=ge.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),Nn=ge.object({mode:Du,reasonCode:ge.string().min(1).optional()}),Ou=ge.object({kind:ju,message:ge.string().min(1)}),Mn=ge.object({composition:L,key:ge.string().min(1),canUpdateText:ge.boolean(),canInsertChild:ge.boolean(),canMove:ge.boolean(),canRemove:ge.boolean(),editModes:ge.object({updateText:Nn.optional(),insertChild:Nn.optional(),move:Nn.optional(),remove:Nn.optional()}).optional(),constraints:ge.array(Ou)}).strict();import{z}from"zod";var ZR=z.discriminatedUnion("type",[z.object({type:z.literal("site-edit.document.changed"),siteId:I,snapshotId:x,composition:L,version:z.number().int().nonnegative(),at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.operation.planned"),siteId:I,operationId:z.string().min(1),baseSnapshotId:x,composition:L,changedFiles:z.array(z.string().min(1)),at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.operation.completed"),siteId:I,composition:L,result:Ns,at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.operation.failed"),siteId:I,composition:L,requestId:z.string().min(1),error:bo,at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.capability.changed"),siteId:I,composition:L,keys:z.array(z.string().min(1)),at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.graph.invalidated"),siteId:I,composition:L,at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.graph.ready"),siteId:I,composition:L,version:z.number().int().nonnegative(),at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.graph.error"),siteId:I,composition:L,message:z.string().min(1),at:z.string().min(1)}).strict()]);import{z as Z}from"zod";var tT="durable-history-v1",Un=Z.object({initiatingComposition:L.optional(),affectedCompositions:Z.array(L)}).strict(),nT=Z.enum(["writable","read-only-recovery","unavailable"]),Nu=Z.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),Lu=Z.object({code:Nu,message:Z.string().min(1),occurredAt:Z.iso.datetime().optional()}).strict(),Mu=Z.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),Bo={revision:Z.number().int().nonnegative(),undoDepth:Z.number().int().nonnegative(),redoDepth:Z.number().int().nonnegative()},Uu=Z.object({mode:Z.literal("writable"),composition:L,...Bo,canUndo:Z.boolean(),canRedo:Z.boolean(),provenance:Un.optional()}).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."})}),Fu=Z.object({mode:Z.literal("read-only-recovery"),composition:L,...Bo,canUndo:Z.literal(!1),canRedo:Z.literal(!1),recoveryDiagnostic:Lu,provenance:Un.optional()}).strict(),qu=Z.object({mode:Z.literal("unavailable"),composition:L,revision:Z.literal(0),undoDepth:Z.literal(0),redoDepth:Z.literal(0),canUndo:Z.literal(!1),canRedo:Z.literal(!1),reason:Mu,provenance:Un.optional()}).strict(),Gu=Z.discriminatedUnion("mode",[Uu,Fu,qu]),sT=Z.object({composition:L,status:Gu,provenance:Un}).strict();import{z as _e}from"zod";var Ku=_e.string().min(1).refine(t=>!t.startsWith("/")&&!t.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),zu=_e.string().regex(/^sha256:[a-f0-9]{64}$/),Bu=_e.object({path:Ku,operation:_e.enum(["create","update","delete"]),expectedHash:zu.optional(),fullContent:_e.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"})}),Wu=_e.object({siteId:I,baseSnapshotId:x,operationId:_e.string().min(1),reason:_e.string().min(1),patches:_e.array(Bu).min(1),changedCompositions:_e.array(L),changedRouteIds:_e.array(_e.string().min(1)).optional(),diagnostics:_e.array(_e.object({code:_e.string().min(1),message:_e.string().min(1),path:_e.string().min(1).optional()})).default([])}).strict().superRefine((t,n)=>{let s=new Set;for(let[i,r]of t.patches.entries())s.has(r.path)&&n.addIssue({code:"custom",path:["patches",i,"path"],message:`Duplicate patch path: ${r.path}`}),s.add(r.path);let a=[...new Set(t.changedCompositions.map(i=>i.routeId))];t.changedRouteIds!==void 0&&(t.changedRouteIds.length!==a.length||t.changedRouteIds.some((i,r)=>i!==a[r]))&&n.addIssue({code:"custom",path:["changedRouteIds"],message:"changedRouteIds must be the stable deduplicated route projection of changedCompositions."})}),cT=Wu.transform(t=>({...t,changedRouteIds:[...new Set(t.changedCompositions.map(n=>n.routeId))]}));var Ys="::repeat-item#";function Vu(t,n){return`${t}${Ys}${n}`}function lT(t,n){return n.reduce((s,a)=>Vu(s,a),t)}function $u(t){if(typeof t!="string"||t.length===0)return null;let n=[],s=t;for(;;){let a=s.lastIndexOf(Ys);if(a<0)break;let i=Number(s.slice(a+Ys.length));if(!Number.isInteger(i)||i<0)return null;n.unshift({repeatIndex:i}),s=s.slice(0,a)}return!s||n.length===0?null:{baseKey:s,parts:n}}function pT(t){return $u(t)?.baseKey??t??null}import{z as m}from"zod";import{z as Ee}from"zod";var Hu=Ee.object({placementKey:Ee.string().min(1),placementUnitKey:Ee.string().min(1),relation:Ee.enum(["before","after","prepend","append"])}).strict(),Yu=Ee.object({status:Ee.literal("supported"),containerKey:Ee.string().min(1),hasBusinessMembers:Ee.boolean(),placementUnitKeys:Ee.array(Ee.string().min(1)),placements:Ee.array(Hu)}).strict().superRefine((t,n)=>{let s=new Set(t.placementUnitKeys);s.size!==t.placementUnitKeys.length&&n.addIssue({code:"custom",path:["placementUnitKeys"],message:"Render page composition placement unit keys must be unique."});let a=new Set;t.placements.forEach((i,r)=>{a.has(i.placementKey)&&n.addIssue({code:"custom",path:["placements",r,"placementKey"],message:"Render page composition placement keys must be unique."}),a.add(i.placementKey),s.has(i.placementUnitKey)||n.addIssue({code:"custom",path:["placements",r,"placementUnitKey"],message:"Render page composition placement must reference a projected unit."})})}),Xu=Ee.object({status:Ee.literal("unsupported"),reason:Pn,diagnostics:Ee.array(Gt)}).strict(),Wo=Ee.discriminatedUnion("status",[Yu,Xu]);var Zu=m.object({canUpdateText:m.boolean(),canInsertChild:m.boolean(),canMove:m.boolean(),canRemove:m.boolean()}),Vo=m.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),Qu=m.enum(["cms-field","api-field"]),Ju=m.enum(["text","attribute","richtext","repeat-region","component-prop"]),eg=m.enum(["exact","safe-derived","partial","unknown"]),tg=m.object({file:m.string().min(1),symbol:m.string().min(1).optional(),reason:m.string().min(1)}),ng=m.object({sourceKind:Vo,sourceType:Qu,endpointPattern:m.string().min(1).optional(),operation:m.string().min(1).optional(),collection:m.string().min(1).optional(),fieldPath:m.string().min(1).optional(),valuePath:m.string().min(1).optional(),targetKind:Ju,targetName:m.string().min(1),confidence:eg,readonly:m.literal(!0),evidence:m.array(tg)}),$o=m.object({hasDynamicData:m.boolean(),bindings:m.array(ng)}),Ho=m.object({hasDynamicData:m.boolean(),sourceKinds:m.array(Vo),primaryEndpoint:m.string().min(1).optional(),primaryCollection:m.string().min(1).optional(),primaryFieldPath:m.string().min(1).optional()}),sg=m.object({key:m.string().min(1),pageCompositionUnitKey:m.string().min(1).optional(),operationSummary:Zu,dynamicDataSummary:Ho.optional()}).strict(),kT=m.object({composition:se}).strict(),PT=m.object({key:m.string().min(1),composition:se}).strict(),wT=m.object({siteId:I,snapshotId:x,composition:L,version:m.number().int().nonnegative(),entries:m.array(sg),pageComposition:Wo}).strict(),Xs=m.enum(["api-field","cms-field","i18n-message","config-entry"]),Yo=m.object({kind:m.enum(["literal","binding","imported-binding","repeat-template"]),file:m.string().min(1),expression:m.string().min(1),bindingName:m.string().min(1).optional(),path:m.array(m.union([m.string(),m.number()])).optional()}),Zs=m.object({index:m.number().int().min(0),value:m.string(),editable:m.boolean(),source:Yo.nullable()}),$t=m.object({key:m.string().min(1),label:m.string().min(1),tag:m.string().min(1)}),AT=m.object({composition:L,key:m.string().min(1),canUpdateText:m.boolean(),canInsertChild:m.boolean(),canMove:m.boolean(),canRemove:m.boolean(),boundaryKind:Ln.nullable(),isOpaque:m.boolean()}).strict(),ig=m.object({kind:m.enum(["jsx-node","component-proxy","value-binding","route-export"]),file:m.string().min(1),componentName:m.string().min(1),isProxy:m.boolean()}),ag=m.object({kind:m.enum(["jsx-node","value-path","route-export","external-entry"]),file:m.string().min(1).optional(),isProxy:m.boolean(),displayPath:m.string().min(1).optional(),sourceType:Xs.optional(),sourceId:m.string().min(1).optional()}),Xo=m.object({kind:m.union([m.enum(["jsx-literal","component-prop","binding","imported-binding","object-field","array-item","repeat-template","conditional-branch"]),Xs]),file:m.string().min(1),displayPath:m.string().min(1),externalSource:m.object({sourceType:Xs,sourceId:m.string().min(1),adapterId:m.string().min(1).optional()}).optional()}),og=m.object({kind:Xo.shape.kind,file:m.string().min(1),displayName:m.string().min(1),canEditHere:m.boolean()}),Ht=m.object({finalSource:Xo.nullable(),chain:m.array(og),confidence:m.enum(["exact","safe-derived","partial","unknown"]),editMode:m.enum(["direct","proxy","upstream","readonly","unsupported"]),diagnostics:m.array(m.object({code:m.string().min(1),message:m.string().min(1)}))}),rg=m.object({kind:m.literal("css-style-model"),properties:m.array(m.object({property:_o,value:m.union([m.string(),m.number(),m.boolean(),m.null()]),resolvedValue:m.union([m.string(),m.number(),m.boolean(),m.null()]).optional(),breakpoint:So.optional(),state:ho.optional(),variants:m.array(m.string().min(1)).optional(),options:m.array(m.union([m.string(),m.number()])).optional(),editable:m.boolean(),diagnostics:m.array(m.object({code:m.string().min(1),message:m.string().min(1)})).optional(),operationBoundary:m.array(Kt).optional()}))}),vT=m.union([m.record(m.string(),m.unknown()),rg]),Zo=m.object({kind:m.literal("class-name-source"),className:m.string(),sourceKind:m.enum(["missing","static-attribute","static-expression","dynamic-expression"]),editable:m.boolean(),operationBoundary:m.array(Kt),sourcePath:m.string().min(1).optional(),diagnostics:m.array(m.object({code:m.enum(["missing-class-name","dynamic-binding","non-string-binding"]),message:m.string().min(1)})).optional()}),cg=m.object({startLine:m.number().int().positive(),startColumn:m.number().int().nonnegative(),endLine:m.number().int().positive(),endColumn:m.number().int().nonnegative()}),Qs=m.object({sourceFile:m.string().min(1),componentName:m.string().min(1),openingElementRange:cg,structuralPath:m.string().min(1),textPreview:m.string().min(1).optional()}),CT=m.object({composition:L,key:m.string().min(1),tag:m.string().min(1),componentName:m.string().min(1),sourceFile:m.string().min(1),sourceLocator:Qs.optional(),label:m.string().min(1),capabilities:Mn,writeTarget:ig,effectiveWriteTarget:ag.optional(),provenanceChain:Ht.optional(),componentSemantic:m.record(m.string(),m.unknown()).optional(),contentModel:m.record(m.string(),m.unknown()).optional(),mediaModel:m.record(m.string(),m.unknown()).optional(),styleSource:Zo.optional(),conditional:m.record(m.string(),m.unknown()).optional(),dynamicData:$o.optional(),textSegments:m.array(Zs),boundaryKind:Ln.nullable(),isOpaque:m.boolean(),ancestors:m.array($t),children:m.array($t),siblings:m.array($t)}).strict(),DT=m.object({composition:L,key:m.string().min(1),tag:m.string().min(1),label:m.string().min(1),sourceLocator:Qs.optional(),capabilities:m.object({constraints:Mn.shape.constraints}),isOpaque:m.boolean(),provenanceChain:m.object({editMode:Ht.shape.editMode,diagnostics:Ht.shape.diagnostics}).optional(),dynamicDataSummary:Ho.optional(),ancestors:m.array($t)}).strict(),jT=m.object({composition:L,key:m.string().min(1),tag:m.string().min(1),label:m.string().min(1),sourceLocator:Qs.optional(),isOpaque:m.boolean(),ancestors:m.array($t),componentName:m.string().min(1),sourceFile:m.string().min(1),capabilities:Mn,provenanceChain:m.object({editMode:Ht.shape.editMode,diagnostics:Ht.shape.diagnostics}).optional(),textSegments:m.array(m.object({index:Zs.shape.index,editable:Zs.shape.editable,sourceKind:Yo.shape.kind.nullable()})),dynamicData:$o.optional(),boundaryKind:Ln.nullable()}).strict(),OT=m.object({composition:L,key:m.string().min(1),mediaModel:m.record(m.string(),m.unknown()).optional(),styleSource:Zo.optional()}).strict();var mg=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],lg=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],pg=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],dg=new Set(mg),ug=new Set(lg),gg=new Set(pg),_g={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function LT(t){return dg.has(Js(t))}function hg(t){return ug.has(Js(t))}function Sg(t){return gg.has(Js(t))}function MT(t){let{operationSummary:n}=t;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:t.fallbackMode!=="preview"?{..._g}:{canUpdateText:Sg(t.tagName),canInsertChild:hg(t.tagName),canMove:!1,canRemove:!1}}function Js(t){return t?.trim().toLowerCase()??""}import{z as fg}from"zod";var KT=fg.object({composition:se,mutationContext:Ft.optional()}).strict();var BT={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.",PRODUCT_SEARCH_APPLY_NOT_AVAILABLE:"Product search changes aren't available yet. Please try again later.",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."},WT={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."},VT={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},$T={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var Qo="0.7.2",YT="x-vcp-edit-engine-version",XT="x-vcp-edit-engine-version-source",ei=class extends Error{constructor(n="Invalid edit-engine version."){super(n),this.code="EDIT_ENGINE_VERSION_INVALID",this.name="EditEngineVersionParseError"}},bg=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/;function yg(t){return bg.test(t)}function xg(t){if(typeof t!="string"||!yg(t))throw new ei;return t}function ZT(t){return t==null?{version:Qo,source:"fallback_current"}:{version:xg(t),source:"explicit"}}function QT(){return{version:Qo,source:"system_current"}}import{z as je}from"zod";var Eg=200,Ig=200;function Rg(t){let n=t.indexOf(":");if(n<=0)return null;let s=t.slice(0,n).trim(),a=t.slice(n+1).trim();return s.length===0||a.length===0?null:{source:s,target:a}}var Tg=je.string().min(3).max(Eg).refine(t=>Rg(t)!==null,{message:'glossary entries must be "source:target" pairs split on a half-width colon, e.g. "\u7C73:Rice"'}),tk=je.array(Tg).max(Ig),nk=je.object({website_name:je.string().min(1).max(200),website_industry:je.string().min(1).max(200).optional(),website_description:je.string().min(1).max(1e3).optional()}),kg=je.enum(["regional","fonts_only"]),Fn=je.string().regex(/^#[0-9a-fA-F]{6}$/,'color must be a "#rrggbb" value'),Pg=je.object({primary:Fn.optional(),accent:Fn.optional(),foreground:Fn.optional(),neutral:Fn.optional()}),wg=600,sk=je.object({mode:kg.default("regional"),seeds:Pg.optional(),note:je.string().min(1).max(wg).optional()}),ik={mode:"regional"};function ak(t){return t===void 0?!1:Object.values(t).some(n=>typeof n=="string"&&n.length>0)}import{z as Te}from"zod";var Ag=Te.string().trim().min(1),bt=Te.string().uuid(),vg=Te.string().min(1).max(2048).refine(t=>t.startsWith("/")||t.includes("\\")?!1:t.split("/").every(n=>n.length>0&&n!=="."&&n!==".."),"object_key must be a relative snapshot store path without empty, '.' or '..' segments"),Jo=Te.object({snapshot_id:bt,object_key:vg}),ck=Te.object({tenant_id:Ag,parent_site_id:bt,subsite_site_id:bt,base:Jo,target:Jo}),mk=Te.object({subsite_site_id:bt,pending_pages:Te.array(Te.string().min(1)),hash_diverged_count:Te.number().int().nonnegative(),child_only_count:Te.number().int().nonnegative(),base_snapshot_id:bt,target_snapshot_id:bt}),Cg=Te.enum(["SUBSITE_DIFF_REQUEST_INVALID","SUBSITE_DIFF_STORE_NOT_CONFIGURED","SUBSITE_DIFF_MANIFEST_MISSING","SUBSITE_DIFF_MANIFEST_INVALID"]),lk=Te.object({error_code:Cg,message:Te.string().min(1),side:Te.enum(["base","target"]).optional()});import{z as re}from"zod";var gk=re.object({tenant_id:re.string().min(1),site_id:I,snapshot_id:x,manifest_hash:re.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:re.string().min(1).max(2048),page_slug:re.string().max(512).optional()}),_k=re.object({site_id:I,snapshot_id:x,unit_count:re.number().int().nonnegative(),file_count:re.number().int().nonnegative(),markdown:re.string().min(1),page_slug:re.string().optional(),page_file:re.string().optional(),entries:re.array(re.object({id:re.string().min(1),file_path:re.string().min(1),line:re.number().int().nullable(),kind:re.string().min(1),text:re.string(),media_key:re.string().optional()})).optional()});import{z as Dg}from"zod";var jg=/^\/[a-z0-9][a-z0-9-]{0,30}$/,Og=Object.freeze(["api","_next","assets","static","robots.txt","sitemap.xml",".well-known"]),Ng=new Set(Og);function Lg(t){return Ng.has(t)}var fk=Dg.string().regex(jg).refine(t=>!Lg(t.slice(1)),{message:"mount_path must not use a reserved segment (api, _next, assets, static, robots.txt, sitemap.xml, .well-known)"});import{z as ie}from"zod";var Mg=ie.enum(["active","paused","blocked"]),er=ie.enum(["typecheck_failed","health_failed","validation_failed"]),Ug={status:Mg,attempts:ie.number().int().nonnegative(),attempted_template_version:De.nullable(),last_error_code:er.nullable()},yt=ie.object(Ug).strict(),qn=ie.object({template_id:ie.string().trim().min(1),target_template_version:De}).strict(),Ek=qn,Fg=ie.discriminatedUnion("action",[ie.object({action:ie.literal("proceed"),state:yt.extend({status:ie.literal("active")})}).strict(),ie.object({action:ie.literal("skip_not_newer"),state:yt.extend({status:ie.literal("active")})}).strict(),ie.object({action:ie.literal("skip_paused"),state:yt.extend({status:ie.literal("paused")})}).strict(),ie.object({action:ie.literal("skip_blocked"),state:yt.extend({status:ie.literal("blocked")})}).strict()]),Ik=qn,Rk=Fg,Tk=qn.extend({error_code:er}),kk=ie.object({state:yt}).strict(),Pk=qn,wk=ie.object({state:yt}).strict();import{z as U}from"zod";var qg=744*60*60*1e3,Gg=U.enum(["eligible","fast_path","upgraded","skipped","lock_skipped","cas_aborted","validation_failed","blocked","paused"]),Kg=U.enum(["typecheck","build","health","validation"]),zg=U.enum(["not_attempted","promoted","aborted"]),jk=U.object({template_id:U.string().trim().min(1).max(128),from_version:De.nullable(),to_version:De,outcome:Gg,attempt:U.number().int().nonnegative().max(2147483647),duration_ms:U.number().int().nonnegative().max(2147483647),replaced_group_count:U.number().int().nonnegative().max(2147483647),skipped_group_count:U.number().int().nonnegative().max(2147483647),validation_stage:Kg.nullable(),cas_outcome:zg.nullable()}).strict(),Ok=U.object({recorded:U.literal(!0)}).strict(),tr=U.object({from:U.iso.datetime(),to:U.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)<=qg,{message:"report window must not exceed 31 days",path:["to"]}),Nk=tr,Bg=U.object({eligible:U.number().int().nonnegative(),fast_path:U.number().int().nonnegative(),upgraded:U.number().int().nonnegative(),skipped:U.number().int().nonnegative(),lock_skipped:U.number().int().nonnegative(),cas_aborted:U.number().int().nonnegative(),validation_failed:U.number().int().nonnegative(),blocked:U.number().int().nonnegative(),paused:U.number().int().nonnegative()}).strict(),Lk=U.object({window:tr,outcome_counts:Bg,current_state_counts:U.object({blocked:U.number().int().nonnegative(),paused:U.number().int().nonnegative()}).strict(),duration_ms:U.object({p50:U.number().int().nonnegative().nullable(),p95:U.number().int().nonnegative().nullable(),sample_count:U.number().int().nonnegative()}).strict()}).strict(),Mk=U.object({older_than:U.iso.datetime(),limit:U.coerce.number().int().min(1).max(200).default(50),include_candidates:U.enum(["true","false"]).default("false").transform(t=>t==="true")}).strict(),Wg=U.object({site_id:I,snapshot_id:x,status:U.enum(["candidate","deleting"]),created_at:U.iso.datetime()}).strict(),Uk=U.object({snapshots:U.array(Wg)}).strict();import{z as ze}from"zod";var Vg=ze.enum(["PREVIEW_SESSION_NOT_FOUND","PREVIEW_SESSION_INVALID","PREVIEW_SESSION_STALE","PREVIEW_SESSION_LOOKUP_FAILED","PREVIEW_SANDBOX_NOT_FOUND","PREVIEW_SANDBOX_CONNECT_FAILED","PREVIEW_SANDBOX_OWNERSHIP_MISMATCH","PREVIEW_ACTIVATION_TIMEOUT","PREVIEW_PREFLIGHT_FAILED","PREVIEW_ENV_LOOKUP_FAILED","PREVIEW_SERVER_START_FAILED","PREVIEW_HEALTH_CHECK_FAILED","SANDBOX_NOT_CONFIGURED"]),$g=ze.object({status:ze.literal("ready"),preview_url:ze.string().url()}).strict(),Hg=ze.object({status:ze.literal("failed"),code:Vg,message:ze.string().min(1),retryable:ze.boolean()}).strict(),Gk=ze.discriminatedUnion("status",[$g,Hg]);import{z as oe}from"zod";var $k="build-context.json",Hk=2e5,nr=oe.string().regex(/^sha256:[a-f0-9]{64}$/u),sr=1e3;function Yg(t){return Array.from(t).length<=sr}var Xg=oe.object({kind:oe.enum(["customer_materials","website_scan_diagnosis","committed_strategy"]),digest:nr}).strict(),Zg=oe.object({schema_version:oe.literal(1),flow_type:wn,sources:oe.array(Xg).min(2).max(2)}).strict().superRefine((t,n)=>{let s=new Set(t.sources.map(i=>i.kind)),a=t.flow_type==="with_website"?["website_scan_diagnosis","committed_strategy"]:["customer_materials","committed_strategy"];(s.size!==a.length||a.some(i=>!s.has(i)))&&n.addIssue({code:"custom",path:["sources"],message:"Site-build provenance sources must match the persisted workflow flow."})}),Qg=oe.object({schema_version:oe.literal(1),seed:nr.optional(),cms_settings:oe.object({main_products:oe.string().trim().min(1).refine(Yg,{message:`main_products must contain at most ${sr} characters`}).optional()}).strict().optional(),provenance:Zg.optional()}).strict(),Jg=oe.object({schema_version:oe.literal(1),site_id:I,workflow_id:Oe,brief:oe.string().min(1),source:oe.enum(["business_provider","mock"]),payload:Qg}).strict().superRefine((t,n)=>{t.source==="business_provider"&&!t.payload.provenance&&n.addIssue({code:"custom",path:["payload","provenance"],message:"Business site-build context requires persisted provenance."})}),Yk=oe.object({source_snapshot_id:x,source_run_id:V,build_context:Jg,page_slugs:oe.array(oe.string().min(1)).optional()}).strict(),Xk=oe.object({disposition:oe.enum(["reused","rebased"]),snapshot_id:x}).strict(),e_=oe.object({snapshot:qs,workspace_run_id:V.nullable()}).strict(),Zk=M(e_);import{z as Le}from"zod";import{z as Ae}from"zod";import{z as ae}from"zod";import{z as t_}from"zod";var n_=["company_profile","product_manual","product_list","customer_case","product_help","qualification","industry_material"],ir=t_.enum(n_);var ar=ae.enum(["pending","running","ready","failed","missing"]),s_=ae.object({task_id:ae.string().min(1).max(500),status:ar}).strict(),s1=ae.object({items:ae.array(s_).max(100)}).strict(),Yt=ae.string().trim().min(1).max(255),i1=ae.object({knowledge_site_id:Yt,source_ids:ae.array(Yt).min(1).max(200)}).strict().superRefine((t,n)=>{new Set(t.source_ids).size!==t.source_ids.length&&n.addIssue({code:"custom",message:"Knowledge source IDs must be unique.",path:["source_ids"]})}),i_=ae.object({source_file_id:Yt,category_code:ir.nullable(),category_confirmed:ae.boolean(),status:ar}).strict(),a1=ae.object({ready:ae.boolean(),files:ae.array(i_),counts:ae.object({total:ae.number().int().nonnegative(),pending:ae.number().int().nonnegative(),running:ae.number().int().nonnegative(),ready:ae.number().int().nonnegative(),failed:ae.number().int().nonnegative(),missing:ae.number().int().nonnegative(),unclassified:ae.number().int().nonnegative()}).strict()}).strict();var ce=t=>Ae.string().trim().max(t),or=Ae.array(Ae.string().trim().min(1).max(120)).max(20),ti=Ae.object({company_name:Ae.string().trim().min(1).max(200),brand_name:ce(200),primary_products:Ae.string().trim().min(1).max(1e3),industry:ce(200),applications:ce(1e3),business_summary:ce(2e3),registered_capital:ce(200).default(""),legal_representative:ce(200).default(""),target_markets:or,customer_industries:ce(1e3),customer_roles:ce(1e3),buying_scenarios:ce(2e3),differentiators:ce(2e3),competitors:ce(1e3),trust_proof:ce(2e3),customer_cases:ce(3e3),channels:or,expected_domain:ce(255),brand_tone:ce(500),contact_name:ce(200),contact_info:ce(500),timezone:ce(100),launch_timing:ce(200),input_source_ids:Ae.array(Yt).max(50)}).strict(),a_=Ae.enum(["draft","submitted"]),ni=ti.extend({id:G,tenant_id:Ae.string().min(1),site_id:I,workflow_id:Oe,status:a_,submitted_at:Ae.string().min(1).nullable(),created_at:Ae.string().min(1),updated_at:Ae.string().min(1)}).strict(),p1=M(ni),d1=M(ni),u1=M(ni.nullable());var f1=Dn.extend({expected_current_node:Le.literal("website_scan"),type:Le.literal("existing_site"),result:Dn.shape.result.extend({website:Le.string().url(),scan_cards:Le.partialRecord(Lo,Bs).refine(t=>Object.keys(t).length>0,{message:"At least one recognized scan card is required."})}).strict()}).strict(),b1=Le.object({expected_current_node:Le.literal("customer_materials"),materials:ti}).strict(),y1=Le.object({expected_current_node:Le.literal("diagnosis")}).strict(),x1=Le.object({expected_current_node:Le.literal("strategy")}).strict();import{z as k}from"zod";var Xt={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}},o_={heading:"Inter",body:"Inter"},rr=Xt.Inter;function Gn(t){return t.trim().replace(/\s+/g,"_").toLowerCase()}var pr=(()=>{let t=new Map;for(let[n,s]of Object.entries(Xt))t.set(Gn(n),s),t.set(Gn(s.import),s);return t})();function r_(t){return typeof t!="string"||t.trim().length===0?rr:pr.get(Gn(t))??rr}var c_=(()=>{let t=new Map;for(let[n,s]of Object.entries(Xt))t.set(s.import,n);return t})();function m_(t){if(typeof t!="string"||t.trim().length===0)return"Inter";let n=pr.get(Gn(t));return n?c_.get(n.import)??"Inter":"Inter"}var l_=Object.keys(Xt),cr='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',mr='Georgia, "Times New Roman", serif',lr='"SFMono-Regular", Consolas, monospace',p_=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),d_=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(t=>t.toLowerCase())),u_=new Set(["JetBrains Mono","IBM Plex Mono"].map(t=>t.toLowerCase()));function g_(t){let n=t.toLowerCase();return u_.has(n)||n.includes("mono")?"mono":d_.has(n)||n.includes("serif")?"serif":"sans"}function si(t,n){let s=g=>(g??"").trim().replace(/^['"]|['"]$/g,"").replace(/[^A-Za-z0-9 _-]+/g,"").trim().slice(0,60),a=s(t),i=s(n),r=g=>p_.has(g.toLowerCase());if(a&&r(a)){let g=a.toLowerCase();return g.includes("mono")?lr:g.includes("serif")?mr:cr}let _=a;_||(_=r(i)?"":i),_||(_="Inter");let c=g_(_);return c==="mono"?`"${_}", ${lr}`:c==="serif"?`"${_}", ${mr}`:`"${_}", ${cr}`}function __(t){return{"--site-font-sans":si(t?.body,"Inter"),"--site-font-heading":si(t?.heading,t?.body??"Inter")}}var ii=["archivo-inter","playfair-source-sans","space-grotesk-manrope","fraunces-libre-franklin","noto-serif-sc-noto-sans-sc","noto-sans-sc"],dr=[{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"}];function ur(t){let n=dr.find(s=>s.id===t);if(!n)throw new Error(`Unknown font pairing: ${t}`);return n}var ai=["compact","comfortable","airy"],gr=["none","sm","md","lg","xl"],_r="lg",oi=["subtle","moderate","expressive"],h_=[{id:"subtle",motionLevel:"subtle"},{id:"moderate",motionLevel:"moderate"},{id:"expressive",motionLevel:"expressive"}];function hr(t){let n=h_.find(s=>s.id===t);if(!n)throw new Error(`Unknown motion preset: ${t}`);return n}var Sr=["ocean","forest","clay","violet","graphite","crimson"],fr=["ai-forest","ai-navy","ai-steel"],br=/^gen-[0-9a-f]{8}$/,ri=[{id:"ai-forest",name:"\u5DE5\u4E1A\u58A8\u7EFF \xB7 Industrial Teal",description:"\u6C89\u7A33\u4E13\u4E1A\uFF0C\u7A81\u51FA\u7CBE\u5BC6\u4E0E\u53EF\u4FE1\u3002",fallbackReason:"\u7A33\u5B9A\u4E13\u4E1A\u7684\u9ED8\u8BA4\u9009\u62E9\u3002",colorSeeds:{primary:"#0E7C6F",accent:"#2F6FED",foreground:"#0F1B2D"},surfaceMode:"light",radius:"sm"},{id:"ai-navy",name:"\u79D1\u6280\u6DF1\u84DD \xB7 Deep Tech Blue",description:"\u7406\u6027\u79D1\u6280\u611F\uFF0C\u5F3A\u8C03\u6280\u672F\u5B9E\u529B\u4E0E\u6570\u636E\u53EF\u4FE1\u3002",fallbackReason:"\u6280\u672F\u8868\u8FBE\u7684\u5907\u9009\u3002",colorSeeds:{primary:"#1E3A8A",accent:"#2F6FED",foreground:"#0F1B2D"},surfaceMode:"light",radius:"md"},{id:"ai-steel",name:"\u7CBE\u5BC6\u94F6\u7070 \xB7 Precision Steel",description:"\u514B\u5236\u6E05\u6670\uFF0C\u9002\u5408\u53C2\u6570\u4E0E\u5DE5\u7A0B\u7EC6\u8282\u8868\u8FBE\u3002",fallbackReason:"\u53C2\u6570\u4FE1\u606F\u8F83\u591A\u65F6\u7684\u5907\u9009\u3002",colorSeeds:{primary:"#475569",accent:"#94A3B8",foreground:"#111827"},surfaceMode:"light",radius:"none"}],ci=[{id:"ocean",colorSeeds:{primary:"#1e3a5f",accent:"#2563eb",foreground:"#0f172a"},surfaceMode:"light",radius:"md"},{id:"forest",colorSeeds:{primary:"#14532d",accent:"#16a34a",foreground:"#0f172a"},surfaceMode:"light",radius:"lg"},{id:"clay",colorSeeds:{primary:"#7c2d12",accent:"#ea580c",foreground:"#1c1917"},surfaceMode:"light",radius:"xl"},{id:"violet",colorSeeds:{primary:"#3b0764",accent:"#7c3aed",foreground:"#18181b"},surfaceMode:"light",radius:"lg"},{id:"graphite",colorSeeds:{primary:"#1f2937",accent:"#0d9488",foreground:"#111827"},surfaceMode:"light",radius:"none"},{id:"crimson",colorSeeds:{primary:"#7f1d1d",accent:"#dc2626",foreground:"#1f1012"},surfaceMode:"light",radius:"sm"}];function T1(t){let n=ci.find(s=>s.id===t);if(!n)throw new Error(`Unknown theme preset: ${t}`);return n}function yr(t){return ci.find(n=>n.id===t)?.radius??ri.find(n=>n.id===t)?.radius}var mi=k.string().regex(/^#[0-9A-F]{6}$/i),Zt=k.string().trim().min(1).max(500),xr=k.string().datetime({offset:!0}),S_=k.enum(Sr),f_=k.enum(fr),b_=k.string().regex(br),Qt=k.union([S_,f_,b_]),Jt=k.enum(ii),en=k.enum(oi),tn=k.enum(ai),Kn=k.enum(gr),Er=300,y_=k.string().trim().min(1).max(Er),zn=k.object({primary:mi,accent:mi,foreground:mi}).strict(),x_=k.object({id:Qt,rank:k.number().int().min(1).max(3),name:k.string().trim().min(1).max(120),description:k.string().trim().min(1).max(240),color_seeds:zn,surface_mode:k.enum(["light","dark"]),radius:Kn,font_pairing_id:Jt,motion_preset_id:en,density:tn,reason:Zt}).strict(),Ir=k.object({name:k.string().trim().min(1).max(120),description:k.string().trim().min(1).max(240),reason:Zt,color_seeds:zn,surface_mode:k.enum(["light","dark"]),radius:Kn,font_pairing_id:Jt,motion_preset_id:en,density:tn}).strict(),Rr=k.object({version:k.number().int().min(1),recommendation_id:k.string().uuid(),theme_preset_id:Qt,color_seeds:zn,surface_mode:k.enum(["light","dark"]),font_pairing_id:Jt,motion_preset_id:en,density:tn,radius:Kn.optional(),aesthetic_note:y_.optional(),updated_at:xr}).strict(),E_=k.object({id:k.string().uuid(),version:k.number().int().min(1),catalog_version:k.string().trim().min(1).max(80),source:k.object({mode:k.enum(["ai","fallback"]),fallback_reason:k.string().trim().min(1).max(80).nullable()}).strict(),inputs:k.object({industry:k.string().trim().min(1).max(160).optional(),site_language:k.string().trim().min(2).max(35),owner_locale:pe.optional(),strategy_version:k.number().int().min(1),input_digest:k.string().regex(/^sha256:[a-f0-9]{64}$/)}).strict(),theme:k.object({recommended_id:Qt,candidate_ids:k.array(Qt).length(3),candidates:k.array(x_).length(3)}).strict().superRefine((t,n)=>{t.recommended_id!==t.candidate_ids[0]&&n.addIssue({code:"custom",path:["recommended_id"],message:"recommended_id must be the first candidate"}),t.candidates.some((s,a)=>s.id!==t.candidate_ids[a]||s.rank!==a+1)&&n.addIssue({code:"custom",path:["candidates"],message:"Candidates must follow candidate_ids order."})}),font:k.object({recommended_id:Jt,reason:Zt}).strict(),motion:k.object({recommended_id:en,reason:Zt}).strict(),density:k.object({recommended_id:tn,reason:Zt}).strict(),conversion:st.optional(),generated_at:xr}).strict(),L1=k.object({force_refresh:k.boolean().optional()}).strict(),M1=k.object({request_id:k.string().trim().min(1).max(160),site_id:I,cached:k.boolean(),recommendation:E_,selection:Rr}).strict(),U1=k.object({recommendation_id:k.string().uuid(),expected_version:k.number().int().min(1),theme_preset_id:Qt,color_seeds:zn,surface_mode:k.enum(["light","dark"]),font_pairing_id:Jt,motion_preset_id:en,density:tn,radius:Kn.optional(),aesthetic_note:k.string().trim().max(Er).optional()}).strict(),F1=k.object({selection:Rr}).strict(),q1=k.object({tenant_id:k.string().trim().min(1).max(160),site_id:I,site_language:k.string().trim().min(2).max(35),owner_locale:pe,industry:k.string().trim().min(1).max(160).optional(),strategy_version_id:k.string().uuid(),strategy_version:k.number().int().min(1),strategy_checksum:k.string().regex(/^[a-f0-9]{64}$/),strategy_summary:k.array(k.string().trim().min(1).max(500)).min(1).max(fe),reference_image_source_id:nt.optional(),owner_whole_site_request:k.string().trim().min(1).max(gt).optional()}).strict(),G1=k.object({theme_candidates:k.array(Ir).length(3),conversion:st.optional()}).strict().superRefine((t,n)=>{let s=new Set;t.theme_candidates.forEach((a,i)=>{let r=JSON.stringify(a.color_seeds).toUpperCase();s.has(r)&&n.addIssue({code:"custom",path:["theme_candidates",i,"color_seeds"],message:"Theme candidates must have pairwise distinct color_seeds"}),s.add(r)})});function K1(){return ri.map(t=>Ir.parse({name:t.name,description:t.description,reason:t.fallbackReason,color_seeds:t.colorSeeds,surface_mode:t.surfaceMode,radius:t.radius,font_pairing_id:ii[0],motion_preset_id:oi[0],density:ai[1]}))}function I_(t){return t.radius??yr(t.theme_preset_id)??"lg"}function z1(t){let n=ur(t.font_pairing_id),s=hr(t.motion_preset_id);return{colorSeeds:t.color_seeds,surfaceMode:t.surface_mode,fonts:{heading:n.heading,body:n.body},density:t.density,motionLevel:s.motionLevel,motionPreset:s.id,radius:I_(t)}}function B1(t,n){let s=t.theme.candidates[0];return{version:1,recommendation_id:t.id,theme_preset_id:s.id,color_seeds:s.color_seeds,surface_mode:s.surface_mode,font_pairing_id:t.font.recommended_id,motion_preset_id:t.motion.recommended_id,density:t.density.recommended_id,radius:s.radius,updated_at:n.toISOString()}}import{z as Xe}from"zod";var H1=Xe.object({site_id:I,site_language:Xe.string().trim().min(2).max(35),business_facts:Xe.array(Xe.string().trim().min(1).max(1e3)).min(1).max(8)}).strict(),R_=Xe.enum(["high","medium","low"]),Y1=Xe.object({skill_name:Xe.string().trim().min(1).max(80).nullable(),confidence:R_,reason:Xe.string().trim().min(1).max(240)}).strict();import{z as W}from"zod";var T_=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],Tr=W.object({name:W.string().min(1).max(100),type:W.enum(T_),label:W.string().min(1).max(255),required:W.boolean().optional(),options:W.array(W.string()).optional()}),Q1=W.object({name:W.string(),cms_type:W.string(),label:W.string().optional(),required:W.boolean().optional(),value_shape:W.string().optional(),front_display:W.enum(["visible","internal","forbidden"]).optional(),choices:W.array(W.object({value:W.union([W.string(),W.number()]),label:W.string()})).optional()}),J1=W.object({route_file_path:W.string().min(1),target_component_path:W.string().min(1),content_type_hint:W.string().min(1),collection_purpose:W.enum(["generic","product"]).optional(),required_fields:W.array(Tr).optional(),mode:W.enum(["bind_existing","provision"]),list_mode:W.enum(["page","embedded"]).optional(),fields:W.array(Tr).optional(),seed_records:W.array(W.record(W.string(),W.unknown())).optional()});import{z as me}from"zod";var nn=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number","file"],k_=me.object({name:me.string().min(1).max(100),type:me.enum(nn),label:me.string().min(1).max(255),required:me.boolean().optional(),options:me.array(me.string()).optional()}),P_=me.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),n0=me.object({mode:me.enum(["bind_existing","provision"],{error:'mode is required. Use "bind_existing" or "provision". Never call connect_form with {}.'}),form_hint:me.string().min(1).optional(),name:me.string().min(1).max(255).optional(),component_slug:P_,description:me.string().min(1).max(1e3).optional(),fields:me.array(k_).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"})}),s0=me.object({name:me.string(),label:me.string(),cms_type:me.string(),required:me.boolean()});import{z as l}from"zod";var sn=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,Et=/^[A-Za-z][A-Za-z0-9_-]{0,127}$/,Bn=/^[A-Za-z][A-Za-z0-9_]{0,99}$/,Ar=/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/,pi=/^[a-z][a-z0-9-]{0,99}$/,vr=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,kr=2,Pr=3,Wn=l.string().regex(sn),w_=l.string().regex(sn),di=l.string().regex(sn),an=l.string().regex(Bn),ui=l.string().regex(Ar),A_=l.discriminatedUnion("status",[l.object({status:l.literal("unbound"),form_code:l.null()}).strict(),l.object({status:l.literal("bound"),form_code:l.string().regex(Et)}).strict(),l.object({status:l.literal("missing"),form_code:l.string().regex(Et)}).strict()]),v_=l.object({value:ui,label:l.string().trim().min(1).max(255)}).strict(),C_=l.object({kind:l.literal("field"),field_name:an,type:l.enum(nn),label:l.string().trim().min(1).max(255),required:l.boolean(),span:l.enum(["full","half"]),options:l.array(v_).max(100),max_files:l.number().int().min(1).max(5).optional()}).strict(),D_=l.object({kind:l.literal("step-break"),step_id:l.string().regex(sn)}).strict(),j_=l.discriminatedUnion("kind",[C_,D_]),O_=l.object({field_name:an,type:l.enum(nn),last_label:l.string().max(255)}).strict(),N_=l.object({field_name:an,value:ui,last_label:l.string().max(255)}).strict(),L_=l.discriminatedUnion("kind",[l.object({kind:l.literal("custom")}).strict(),l.object({kind:l.literal("template"),slug:l.string().regex(pi),version:l.string().regex(vr)}).strict()]),M_={select:2,radio:2,multiselect:1,DropdownSelection:2,RadioButton:2,Checkbox:1};function Me(t){return t.toLowerCase()}function Cr(t,n){return t.trim().toLocaleLowerCase(n)}function xt(t,n){return`${Me(t)}\0${n}`}function he(t,n,s,a){let i=new Set;for(let r of t){if(i.has(r)){a.addIssue({code:"custom",path:n,message:s});return}i.add(r)}}function gi(t,n,s,a){let i=M_[t]??0;i>0&&n<i?a.addIssue({code:"custom",path:s,message:`choice field requires at least ${i} option${i===1?"":"s"}`}):i===0&&n>0&&a.addIssue({code:"custom",path:s,message:"non-choice fields must use an empty options array"})}var _i=l.object({schema_version:l.literal(1),min_runtime_version:l.number().int().positive(),form_definition_id:Wn,binding:A_,content_locale:pe,features:l.object({multistep:l.boolean()}).strict(),copy:l.object({title:l.string().max(255),description:l.string().max(1e3),submit_button:l.string().trim().min(1).max(100),success_message:l.string().trim().min(1).max(500),error_message:l.string().max(500)}).strict(),layout:l.object({columns:l.enum(["one","two"])}).strict(),nodes:l.array(j_).min(1).max(200),source:L_,retired:l.object({fields:l.array(O_).max(1e3),options:l.array(N_).max(5e3)}).strict(),compatibility:l.object({standardization_version:l.number().int().positive(),diagnostics:l.array(l.string().trim().min(1).max(500)).max(100)}).strict()}).strict().superRefine((t,n)=>{let s=t.nodes.flatMap((c,g)=>c.kind==="field"?[[g,c]]:[]),a=s.map(([,c])=>c);a.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"at least one field node is required"});let i=t.nodes.filter(c=>c.kind==="step-break");!t.features.multistep&&i.length>0&&n.addIssue({code:"custom",path:["nodes"],message:"step-break requires the multistep feature"}),t.features.multistep&&(t.min_runtime_version<kr&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`multistep requires runtime version ${kr}`}),i.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"multistep requires at least one step-break"}));for(let[c,g]of t.nodes.entries())g.kind==="step-break"&&(c===0||c===t.nodes.length-1||t.nodes[c-1]?.kind==="step-break"||t.nodes[c+1]?.kind==="step-break")&&n.addIssue({code:"custom",path:["nodes",c],message:"step-break must separate two non-empty steps"});he(i.map(c=>c.step_id),["nodes"],"step_id must be unique",n),he(a.map(c=>Me(c.field_name)),["nodes"],"field_name must be unique",n),he(t.retired.fields.map(c=>Me(c.field_name)),["retired","fields"],"retired field_name must be unique",n);let r=new Set(t.retired.fields.map(c=>Me(c.field_name)));for(let[c,g]of s)r.has(Me(g.field_name))&&n.addIssue({code:"custom",path:["nodes",c,"field_name"],message:"retired field_name cannot be reused"}),gi(g.type,g.options.length,["nodes",c,"options"],n),g.type==="file"?t.min_runtime_version<Pr&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`file fields require runtime version ${Pr}`}):g.max_files!==void 0&&n.addIssue({code:"custom",path:["nodes",c,"max_files"],message:"max_files is only valid for file fields"}),he(g.options.map(j=>j.value),["nodes",c,"options"],"option value must be unique within a field",n),he(g.options.map(j=>Cr(j.label,t.content_locale)),["nodes",c,"options"],"option label must be unique within a field",n);he(t.retired.options.map(c=>xt(c.field_name,c.value)),["retired","options"],"retired option identity must be unique",n);let _=new Set(t.retired.options.map(c=>xt(c.field_name,c.value)));for(let[c,g]of s)for(let[j,E]of g.options.entries())_.has(xt(g.field_name,E.value))&&n.addIssue({code:"custom",path:["nodes",c,"options",j,"value"],message:"retired option value cannot be reused"})}),U_=["copy.title","copy.description","copy.submit_button","copy.success_message","copy.error_message","nodes.*.label","nodes.*.options.*.label"],F_=new Set(U_);function l0(t){let n=t.map(s=>typeof s=="number"||/^\d+$/.test(s)?"*":s).join(".");return F_.has(n)}function p0(t,n){let s=[],a=t.nodes.filter(c=>c.kind==="field"),i=new Map(n.nodes.filter(c=>c.kind==="field").map(c=>[Me(c.field_name),c])),r=new Map(n.retired.fields.map(c=>[Me(c.field_name),c])),_=new Map(n.retired.options.map(c=>[xt(c.field_name,c.value),c]));for(let c of a){let g=Me(c.field_name),j=i.get(g),E=r.get(g);j&&j.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),j&&j.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),!j&&E&&E.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),!j&&E&&E.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),!j&&!r.has(g)&&s.push({code:"FIELD_RETIREMENT_MISSING",field_name:c.field_name});let O=new Set(j?.options.map(F=>F.value)??[]);for(let F of c.options){let q=_.get(xt(c.field_name,F.value));!O.has(F.value)&&q&&q.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),!O.has(F.value)&&!q&&s.push({code:"OPTION_RETIREMENT_MISSING",field_name:c.field_name,value:F.value})}}for(let c of t.retired.fields){let g=r.get(Me(c.field_name));g&&g.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),g&&g.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),g||s.push({code:"FIELD_RETIREMENT_MISSING",field_name:c.field_name})}for(let c of t.retired.options){let g=_.get(xt(c.field_name,c.value));g&&g.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),g||s.push({code:"OPTION_RETIREMENT_MISSING",field_name:c.field_name,value:c.value})}return s}var q_=l.enum(jt),Ze=l.object({english:l.string().max(1e3),translations:l.partialRecord(q_,l.string().max(1e3)).optional()}).strict(),G_=l.object({template_option_key:l.string().regex(Ar),label:Ze}).strict(),K_=l.object({template_field_key:l.string().regex(Bn),type:l.enum(nn),label:Ze,required:l.boolean(),span:l.enum(["full","half"]),options:l.array(G_).max(100)}).strict(),z_=l.object({template_step_key:l.string().regex(Bn),after_field_key:l.string().regex(Bn)}).strict(),d0=["lead-generation","trial-and-samples","quote-and-commerce","appointments-and-visits","resources-and-subscriptions","service-and-channel"],u0=[1,1,1,1,1,1],Dr=l.string().regex(pi),B_=l.object({schema_version:l.literal(1),slug:Dr,name:Ze,template_count:l.number().int().min(0).max(500)}).strict().superRefine((t,n)=>{t.name.english.trim()===""&&n.addIssue({code:"custom",path:["name","english"],message:"English category name is required"})}),W_=l.object({schema_version:l.literal(1),slug:l.string().regex(pi),version:l.string().regex(vr),category:Dr,copy:l.object({title:Ze,description:Ze,submit_button:Ze,success_message:Ze,error_message:Ze}).strict(),layout:l.object({columns:l.enum(["one","two"])}).strict(),fields:l.array(K_).min(1).max(200),step_breaks:l.array(z_).max(20).optional()}).strict().superRefine((t,n)=>{for(let r of["title","description","submit_button","success_message","error_message"])t.copy[r].english.trim()===""&&n.addIssue({code:"custom",path:["copy",r,"english"],message:"English baseline text is required"});he(t.fields.map(r=>r.template_field_key),["fields"],"template_field_key must be unique",n);let s=new Map(t.fields.map((r,_)=>[r.template_field_key,_])),a=t.step_breaks??[];he(a.map(r=>r.template_step_key),["step_breaks"],"template_step_key must be unique",n),he(a.map(r=>r.after_field_key),["step_breaks"],"step breaks must not share an anchor field",n);let i=-1;for(let[r,_]of a.entries()){let c=s.get(_.after_field_key);c===void 0||c>=t.fields.length-1?n.addIssue({code:"custom",path:["step_breaks",r,"after_field_key"],message:"step break must follow an existing non-final field"}):c<=i&&n.addIssue({code:"custom",path:["step_breaks",r,"after_field_key"],message:"step breaks must follow field order"}),i=c??i}t.fields.length+a.length>200&&n.addIssue({code:"custom",path:["step_breaks"],message:"template fields and step breaks must not exceed 200 nodes"});for(let[r,_]of t.fields.entries()){_.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",r,"label","english"],message:"English field label is required"}),gi(_.type,_.options.length,["fields",r,"options"],n),he(_.options.map(c=>c.template_option_key),["fields",r,"options"],"template_option_key must be unique within a field",n),he(_.options.map(c=>c.label.english.trim().toLowerCase()),["fields",r,"options"],"English option labels must be unique within a field",n);for(let[c,g]of _.options.entries())g.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",r,"options",c,"label","english"],message:"English option label is required"})}}),g0=l.object({schema_version:l.literal(1),visibility:l.enum(["internal","public"]),categories:l.array(B_).max(500),templates:l.array(W_).max(500)}).strict().superRefine((t,n)=>{let s=(i,r)=>{let _=jt.filter(c=>!i.translations?.[c]?.trim());_.length>0&&n.addIssue({code:"custom",path:[...r,"translations"],message:`public template copy is missing locales: ${_.join(", ")}`})};he(t.categories.map(i=>i.slug),["categories"],"template category slug must be unique",n);let a=new Set(t.categories.map(i=>i.slug));for(let[i,r]of t.categories.entries()){let _=t.templates.filter(c=>c.category===r.slug).length;r.template_count!==_&&n.addIssue({code:"custom",path:["categories",i,"template_count"],message:"template_count must match catalog templates"})}he(t.templates.map(i=>i.slug),["templates"],"template slug must be unique",n);for(let[i,r]of t.templates.entries())a.has(r.category)||n.addIssue({code:"custom",path:["templates",i,"category"],message:"template category must exist in catalog categories"});if(t.visibility==="public"){for(let[i,r]of t.categories.entries())s(r.name,["categories",i,"name"]);for(let[i,r]of t.templates.entries()){for(let[_,c]of Object.entries(r.copy))s(c,["templates",i,"copy",_]);for(let[_,c]of r.fields.entries()){s(c.label,["templates",i,"fields",_,"label"]);for(let[g,j]of c.options.entries())s(j.label,["templates",i,"fields",_,"options",g,"label"])}}}});function _0(t,n){let s=da(n),a=s?t.translations?.[s]:void 0;return a!==void 0&&a.trim()!==""?a:t.english}var V_=["Text","Summary","Email","Phone","DropdownSelection","RadioButton","Checkbox","Boolean","Date","Num","MultipleFile","SpecificFile"],$_={text:"Text",textarea:"Summary",email:"Email",phone:"Phone",select:"DropdownSelection",radio:"RadioButton",multiselect:"Checkbox",boolean:"Boolean",date:"Date",number:"Num",file:"MultipleFile"},H_=l.object({value:ui,label:l.string().trim().min(1).max(255)}).strict(),Y_=l.object({field_name:an,field_type:l.enum(V_),field_label:l.string().trim().min(1).max(255),is_required:l.boolean(),sort_order:l.number().int().nonnegative(),options:l.array(H_).max(100)}).strict(),jr=l.object({version:l.literal(1),locale:pe,fields:l.array(Y_).min(1).max(200)}).strict().superRefine((t,n)=>{he(t.fields.map(s=>Me(s.field_name)),["fields"],"field_name must be unique",n);for(let[s,a]of t.fields.entries())gi(a.field_type,a.options.length,["fields",s,"options"],n),he(a.options.map(i=>i.value),["fields",s,"options"],"option value must be unique within a field",n),he(a.options.map(i=>Cr(i.label,t.locale)),["fields",s,"options"],"option label must be unique within a field",n)});function h0(t){let n=t.nodes.filter(s=>s.kind==="field").map((s,a)=>({field_name:s.field_name,field_type:s.type==="file"&&s.max_files===1?"SpecificFile":$_[s.type],field_label:s.label,is_required:s.required,sort_order:a,options:s.options.map(i=>({...i}))}));return jr.parse({version:1,locale:t.content_locale,fields:n})}var ee=l.string().regex(/^sha256:[0-9a-f]{64}$/),X_=l.union([le,l.enum(["app/api/forms/[code]/route.ts","hooks/use-cms-form-submit.ts","lib/cms/forms.ts","lib/cms/client.ts"])]),Z_=l.object({path:X_,content_hash:ee.nullable()}).strict(),Q_=l.array(Z_).min(1).max(500).superRefine((t,n)=>{he(t.map(s=>s.path),[],"affected file paths must be unique",n)}),hi=l.object({grade:l.enum(["standard","A","B","C"]),required:l.boolean(),pending_confirmations:l.array(l.object({item_id:l.string().regex(sn),field_name:an.optional(),kind:l.enum(["form_copy","layout","field_label","field_type","field_required","field_options"]),message:l.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 s=t.grade==="standard";s===t.required&&n.addIssue({code:"custom",path:["required"],message:s?"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"})}),J_=l.object({site_id:I,form_definition_id:Wn,base_snapshot_id:x,expected_form_spec_hash:ee,expected_cms_schema_hash:ee.nullable(),draft_form_spec_hash:ee,desired_cms_schema_hash:ee,affected_files_hash:ee,shared_reference_hash:ee,shared_reference_count:l.number().int().positive(),confirm_shared_update:l.boolean(),recreate_missing_binding:l.boolean(),standardization:hi,confirm_standardization:l.boolean()}).strict(),Or=l.object({reference_hash:ee,page_count:l.number().int().positive(),block_count:l.number().int().positive()}).strict().refine(t=>t.page_count<=t.block_count,{message:"page_count cannot exceed block_count"}),S0=l.object({site_id:I,form_block_id:w_,base_snapshot_id:x,form_spec:_i,runtime_upgrade_required:l.boolean(),expected_form_spec_hash:ee,expected_cms_schema_hash:ee.nullable(),affected_files_hash:ee,shared_impact:Or,standardization:hi}).strict(),eh=l.object({operation_id:di,operation_fingerprint:ee,site_id:I,form_definition_id:Wn,base_snapshot_id:x,expected_form_spec_hash:ee,expected_cms_schema_hash:ee.nullable(),draft_form_spec:_i,draft_form_spec_hash:ee,desired_cms_schema_hash:ee,affected_files_hash:ee,shared_impact:Or,confirm_shared_update:l.boolean(),recreate_missing_binding:l.boolean(),standardization:hi,confirm_standardization:l.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 s=t.draft_form_spec.binding.status==="missing";s!==t.recreate_missing_binding&&n.addIssue({code:"custom",path:["recreate_missing_binding"],message:s?"missing bindings require explicit recreation confirmation":"only missing bindings can be recreated"});let a=t.draft_form_spec.binding.status==="bound",i=a&&t.standardization.required&&(t.standardization.grade==="B"||t.standardization.grade==="C");(a&&!i&&t.expected_cms_schema_hash===null||!a&&t.expected_cms_schema_hash!==null)&&n.addIssue({code:"custom",path:["expected_cms_schema_hash"],message:a?"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"})}),th=["created","validated","binding_reserved","candidate_ready","cms_applied","snapshot_promoted","committed","compensating","recovery_required","failed"],Si=l.enum(th),nh=["pending","running","succeeded","failed","recovery_required"],Nr=l.enum(nh),sh=["candidate_abandon","snapshot_reconcile","cms_restore"],Lr=l.enum(sh),ih=["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"],fi=l.enum(ih),Mr=l.enum(["wait","resume","retry_new_operation","manual_recovery","none"]),Ur=l.enum(["not_started","pending","succeeded","failed"]),Fr=l.object({operation_id:di,operation_fingerprint:ee,site_id:I,form_definition_id:Wn,stage:Si,status:Nr,base_snapshot_id:x,candidate_snapshot_id:x.nullable(),before_form_code:l.string().regex(Et).nullable(),materialized_form_code:l.string().regex(Et).nullable(),expected_form_spec_hash:ee,draft_form_spec_hash:ee,materialized_form_spec_hash:ee.nullable(),expected_cms_schema_hash:ee.nullable(),desired_cms_schema_hash:ee,retry_count:l.number().int().nonnegative(),failure_stage:Lr.nullable(),last_error_code:fi.nullable(),retryable:l.boolean(),next_action:Mr,preview_refresh_status:Ur,created_at:l.string().datetime({offset:!0}),updated_at:l.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 s of["candidate_snapshot_id","materialized_form_code","materialized_form_spec_hash"])t[s]===null&&n.addIssue({code:"custom",path:[s],message:`${s} 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"})}}),bi=l.object({operation:Fr}).strict(),f0=bi,b0=bi,y0=l.object({operation_fingerprint:ee}).strict(),x0=bi,ah=l.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},eh),E0=l.object({operation:Fr,request:ah,cms_replace_result:l.unknown().nullable()}).strict(),oh=l.object({stage:Si.optional(),status:Nr.optional(),candidate_snapshot_id:x.nullable().optional(),before_form_code:l.string().regex(Et).nullable().optional(),materialized_form_code:l.string().regex(Et).nullable().optional(),materialized_form_spec_hash:ee.nullable().optional(),retry_count:l.number().int().nonnegative().optional(),failure_stage:Lr.nullable().optional(),last_error_code:fi.nullable().optional(),retryable:l.boolean().optional(),next_action:Mr.optional(),preview_refresh_status:Ur.optional()}).strict(),I0=l.object({expected_updated_at:l.string().datetime({offset:!0}),operation:oh,cms_replace_result:l.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"}),R0=l.object({code:fi,message:l.string().trim().min(1).max(500),retryable:l.boolean(),operation_id:di.optional(),stage:Si.optional()}).strict();function rh(t){return J_.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 wr(t){for(let n=0;n<t.length;n+=1){let s=t.charCodeAt(n);if(s>=55296&&s<=56319){let a=t.charCodeAt(n+1);if(n+1>=t.length||a<56320||a>57343)throw new TypeError("canonical JSON cannot contain a lone surrogate");n+=1}else if(s>=56320&&s<=57343)throw new TypeError("canonical JSON cannot contain a lone surrogate")}}function li(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 wr(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 r=[];for(let _=0;_<t.length;_+=1){if(!(_ in t))throw new TypeError("canonical JSON cannot contain sparse arrays");r.push(li(t[_],n))}return`[${r.join(",")}]`}let s=Object.getPrototypeOf(t);if(s!==Object.prototype&&s!==null)throw new TypeError("canonical JSON objects must be plain records");let a=t;return`{${Object.keys(a).sort().map(r=>(wr(r),`${JSON.stringify(r)}:${li(a[r],n)}`)).join(",")}}`}finally{n.delete(t)}}function yi(t){return li(t,new Set)}async function Vn(t){let n=yi(t),s=new TextEncoder().encode(n),a=globalThis.crypto?.subtle?new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",s)):(await import("@noble/hashes/sha256")).sha256(s);return`sha256:${Array.from(a,r=>r.toString(16).padStart(2,"0")).join("")}`}async function T0(t){return Vn(_i.parse(t))}async function k0(t){return Vn(jr.parse(t))}async function P0(t){let n=Q_.parse(t).map(s=>({...s})).sort((s,a)=>s.path<a.path?-1:s.path>a.path?1:0);return Vn({version:1,files:n})}async function w0(t){return Vn(rh(t))}import{z as P}from"zod";var C0=["page-seo","root-layout-metadata","nav-items"],D0=P.object({path:P.string(),title:P.string(),description:P.string().optional(),keywords:P.string().optional(),meta_tags_json:P.record(P.string(),P.record(P.string(),P.string())).nullish(),schema_json:P.union([P.record(P.string(),P.unknown()),P.array(P.record(P.string(),P.unknown())),P.string()]).nullish(),breadcrumbs_json:P.array(P.object({name:P.string().optional(),text:P.string().optional(),url:P.string().nullish()})).nullish()}),j0=P.object({metadataBase:P.string().optional(),title:P.union([P.string(),P.object({default:P.string().optional(),template:P.string().optional(),absolute:P.string().optional()})]).optional(),description:P.string().optional(),keywords:P.string().optional(),openGraph:P.object({title:P.string().optional(),description:P.string().optional(),type:P.string().optional(),siteName:P.string().optional(),url:P.string().optional(),locale:P.string().optional(),images:P.array(P.union([P.string(),P.object({url:P.string(),alt:P.string().optional()})])).optional()}).optional(),twitter:P.object({card:P.string().optional(),title:P.string().optional(),description:P.string().optional(),images:P.array(P.string()).optional()}).optional(),alternates:P.object({canonical:P.string().optional()}).optional()}),qr=()=>P.object({label:P.string(),href:P.string().optional(),targetType:P.enum(["page","anchor","external","email","phone","file","group"]).optional(),role:P.enum(["link","cta"]).optional(),openInNewTab:P.boolean().optional(),nofollow:P.boolean().optional(),description:P.string().optional(),badge:P.string().optional(),iconKey:P.string().optional()}),O0=qr().extend({children:P.array(qr()).optional()}),ch=["title","description","keywords","breadcrumbs_json.*.name","breadcrumbs_json.*.text"],mh=["path","meta_tags_json.**","schema_json.**","breadcrumbs_json.*.url"],lh=["title","title.default","title.template","title.absolute","description","keywords","openGraph.title","openGraph.description","openGraph.siteName","openGraph.images.*.alt","twitter.title","twitter.description"],ph=["metadataBase","openGraph.type","openGraph.url","openGraph.locale","openGraph.images.*","openGraph.images.*.url","twitter.card","twitter.images.*","alternates.canonical"],dh=["label","description","badge"],uh=["href","targetType","role","iconKey"],Gr={"page-seo":{localizable:ch,machine:mh},"root-layout-metadata":{localizable:lh,machine:ph},"nav-items":{localizable:dh,machine:uh}},Kr="*",zr="**",gh="children";function _h(t){return typeof t=="number"||/^\d+$/.test(t)?Kr:t}function Br(t,n){let s=n.map(_h);return t!=="nav-items"?s:s.filter(a=>a!==Kr&&a!==gh)}function Wr(t,n){let s=t.split(".");for(let a=0;a<s.length;a+=1){if(s[a]===zr)return!0;if(a>=n.length||s[a]!==n[a])return!1}return s.length===n.length}function hh(t,n){let s=t.split(".");if(n.length>=s.length)return!1;for(let a=0;a<n.length;a+=1){if(s[a]===zr)return!0;if(s[a]!==n[a])return!1}return!0}function N0(t,n){let s=Br(t,n);return s.length===0?!1:Gr[t].localizable.some(a=>Wr(a,s))}function L0(t,n){let s=Br(t,n);if(s.length===0)return!0;let{localizable:a,machine:i}=Gr[t];return[...a,...i].some(r=>Wr(r,s)||hh(r,s))}var F0=["product-search","migration-products","standard-form","form-submission-infrastructure"],Sh=[{path:"app/search/page.tsx",materializer:"product-search"},{path:"components/site/generated/product-search/entry.tsx",materializer:"product-search"},{path:"components/site/generated/product-search/results.tsx",materializer:"product-search"},{path:"app/api/product-search/facets/route.ts",materializer:"product-search"},{path:"lib/cms/product-search.ts",materializer:"product-search"},{path:"lib/generated/product-search-value-codec.ts",materializer:"product-search"},{path:"lib/generated/product-search-config.json",materializer:"product-search"},{path:`lib/cms/generated/${Ke}.ts`,materializer:"migration-products"},{path:`components/site/generated/${Ke}-list.tsx`,materializer:"migration-products"},{path:`components/site/generated/${Ke}-list-view.tsx`,materializer:"migration-products"},{path:`components/site/generated/${Ke}-detail-view.tsx`,materializer:"migration-products"},{path:`app/${Ke}/[slug]/page.tsx`,materializer:"migration-products"},{path:`components/site/generated/${Ke}-breadcrumb.tsx`,materializer:"migration-products"},{path:"components/site/generated/forms/vcp-form-runtime.tsx",materializer:"standard-form"},{path:"app/api/forms/[code]/route.ts",materializer:"form-submission-infrastructure"},{path:"hooks/use-cms-form-submit.ts",materializer:"form-submission-infrastructure"},{path:"lib/cms/forms.ts",materializer:"form-submission-infrastructure"}],fh=[{prefix:"components/site/generated/forms/form-",suffix:".tsx",materializer:"standard-form"}],q0=[{path:"lib/cms/client.ts",reason:"\u4E0D\u662F\u7269\u5316\u4EA7\u7269\uFF1A\u6A21\u677F\u81EA\u5E26\u7684 CMS \u4F20\u8F93\u5C42\uFF0C\u7269\u5316\u5668\u53EA\u5BF9\u5B83\u505A\u5B9A\u70B9\u5B57\u7B26\u4E32\u5347\u7EA7\uFF08\u591A\u90E8\u5206\u8868\u5355\u63D0\u4EA4\u3001no-store \u8BFB\uFF09\uFF0C\u6574\u4EFD\u8986\u5199\u53CD\u800C\u4F1A\u62B9\u6389\u7AD9\u70B9\u4FA7\u7684\u5176\u4ED6\u5347\u7EA7\u3002"},{path:"components/site/generated/forms/form-<id>.spec.ts",reason:"\u8DEF\u5F84\u5F52\u5E73\u53F0\u3001\u5185\u5BB9\u5F52\u7AD9\u70B9\uFF1A\u8868\u5355\u8BBE\u8BA1\u5668\u5199\u7684\u5B57\u6BB5\u6587\u6848\uFF0C\u5F52 FORM_SPEC_LOCALIZABLE_FIELD_PATHS \u7684\u5B57\u6BB5\u7EA7\u6E05\u5355\u7BA1\u8F96\u3002"}];function bh(t){return t.length>0&&!t.includes("/")&&!t.includes(".")}function G0(t){return Sh.some(n=>n.path===t)?!0:fh.some(n=>!t.startsWith(n.prefix)||!t.endsWith(n.suffix)?!1:bh(t.slice(n.prefix.length,t.length-n.suffix.length)))}import{z as Be}from"zod";var yh=["provisioning","cms_app_created","seeded","ready","failed"],W0=Be.object({tenant_id:Be.string().min(1),site_id:I,collection_slug:Be.string().min(1),cms_collection_id:Be.string().min(1).nullable(),status:Be.enum(yh),owned_by_vcp:Be.boolean(),run_id:V.nullable(),last_error:Be.string().nullable(),created_at:Be.string().datetime(),updated_at:Be.string().datetime()});var Vr="/vibe/v1";function $0(t){let n=t?.trim().replace(/\/+$/,"");if(!n)return null;try{let s=new URL(n),a=s.pathname.replace(/\/+$/,"");return s.search="",s.hash="",s.pathname=a.endsWith(Vr)?a:Vr,s.href.replace(/\/+$/,"")}catch{return n}}import{z as u}from"zod";var $n=u.string().url().refine(qh,{message:"URL must use http or https"}),$r=u.string().trim().pipe($n),xh=u.object({task_type:u.literal("home_url"),task_url:$r,planned_num:u.number().int().min(1).max(20).optional()}).strict(),Eh=u.object({task_type:u.literal("url_list"),urls:u.array($n).min(1).max(1e4)}).strict(),Z0=u.discriminatedUnion("task_type",[xh,Eh]),Q0=u.object({page:u.coerce.number().int().positive().default(1),page_size:u.coerce.number().int().min(1).max(20).default(20)}).strict(),J0=u.object({home_url:$r}).strict(),mt=u.string().uuid(),It=u.string().uuid(),eP=u.object({task_uuid:mt}).strict(),Hr=u.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]),Ih=u.object({task_uuid:mt,status:u.literal("NOT_STARTED"),total:u.literal(0)}).strict(),Rh=u.object({task_uuid:mt,status:u.literal("PROCESSING"),total:u.literal(0)}).strict(),tP=u.enum(["no_suitable_page_candidate","page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"]),Th=u.discriminatedUnion("status",[u.object({role:$e,status:u.literal("selected"),reason_code:u.null()}).strict(),u.object({role:$e,status:u.literal("not_found"),reason_code:u.literal("no_suitable_page_candidate")}).strict(),u.object({role:$e,status:u.literal("unknown"),reason_code:u.enum(["page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"])}).strict()]),Yr=u.array(Th).length(7).superRefine((t,n)=>{let s=new Set(t.map(a=>a.role));s.size!==t.length&&n.addIssue({code:"custom",message:"discovery coverage roles must be unique"});for(let a of $e.options)s.has(a)||n.addIssue({code:"custom",message:`discovery coverage is missing role ${a}`})}),kh=u.object({task_uuid:mt,status:u.literal("SUCCEEDED"),total:u.number().int().positive(),discovery_coverage:Yr.optional()}).strict(),Ph=u.enum(["TASK_FAILED","PROVIDER_CAPABILITY_LIMIT"]),wh=u.object({task_uuid:mt,status:u.literal("FAILED"),total:u.literal(0),error_code:Ph,error_message:u.string().min(1),failure_stage:Hr}).strict(),nP=u.discriminatedUnion("status",[Ih,Rh,kh,wh]),Ah=u.object({url:$n,raw_html:u.string().min(1)}).strict(),sP=u.object({task_uuid:mt,status:u.literal("SUCCEEDED"),page:u.number().int().positive(),page_size:u.number().int().min(1).max(20),total:u.number().int().positive(),total_pages:u.number().int().positive(),pages:u.array(Ah).max(20),discovery_coverage:Yr.optional()}).strict().superRefine((t,n)=>{t.total_pages!==Math.ceil(t.total/t.page_size)&&n.addIssue({code:"custom",path:["total_pages"],message:"total_pages must equal ceil(total / page_size)"}),t.pages.length>t.page_size&&n.addIssue({code:"custom",path:["pages"],message:"pages must not exceed page_size"})}),iP=u.object({task_code:It}).strict(),vh=u.object({task_code:It,status:u.literal("NOT_STARTED")}).strict(),Ch=u.object({task_code:It,status:u.literal("PROCESSING")}).strict(),Dh=u.object({task_code:It,status:u.literal("SUCCEEDED"),urls:u.array($n)}).strict(),jh=u.literal("SITEMAP_DISCOVERY_FAILED"),Oh=u.object({task_code:It,status:u.literal("FAILED"),error_code:jh,error_message:u.string().min(1)}).strict(),aP=u.discriminatedUnion("status",[vh,Ch,Dh,Oh]),oP=u.object({company_name:u.string().regex(/\S/u)}).strict(),Nh=u.object({company_name:u.string(),brand_name:u.string(),main_products:u.array(u.string()),industry:u.array(u.string()),subfields:u.array(u.string()),business_intro:u.string(),registered_capital:u.string(),legal_representative:u.string(),target_markets:u.array(u.string()),target_customer_industries:u.array(u.string()),target_customer_roles:u.array(u.string()),purchase_scenarios:u.string(),differentiators:u.array(u.string()),competitors:u.array(u.object({name:u.string(),official_url:u.string()}).strict()).max(3),qualifications:u.array(u.string()),representative_cases:u.array(u.string()),acquisition_channels:u.array(u.string()),desired_domain:u.string(),brand_tone:u.string(),timezone:u.string()}).strict(),Hn=u.object({company_uuid:u.string().uuid(),company_info:Nh,created_at:u.string().datetime(),updated_at:u.string().datetime()}),Lh=Hn.extend({status:u.literal("NOT_STARTED"),last_error_code:u.null(),last_error_message:u.null(),started_at:u.null(),completed_at:u.null()}).strict(),Mh=Hn.extend({status:u.literal("PROCESSING"),last_error_code:u.null(),last_error_message:u.null(),started_at:u.string().datetime(),completed_at:u.null()}).strict(),Xr=Hn.extend({status:u.literal("SUCCEEDED"),last_error_code:u.null(),last_error_message:u.null(),started_at:u.string().datetime(),completed_at:u.string().datetime()}).strict(),Zr=Hn.extend({status:u.literal("FAILED"),last_error_code:u.string().min(1),last_error_message:u.string().min(1),started_at:u.string().datetime(),completed_at:u.string().datetime()}).strict(),rP=u.discriminatedUnion("status",[Xr,Zr]),cP=u.discriminatedUnion("status",[Lh,Mh,Xr,Zr]),Uh=["BAD_REQUEST","NOT_FOUND","PAYLOAD_TOO_LARGE","INTERNAL_SERVER_ERROR","UNAUTHORIZED","FORBIDDEN","INVALID_TASK_TYPE","TASK_URL_REQUIRED","INVALID_PLANNED_NUM","URL_LIST_REQUIRED","URL_LIST_LIMIT_EXCEEDED","INVALID_URL_LIST","INVALID_PAGINATION","INVALID_TASK_CODE","INVALID_HOME_URL","TASK_CODE_HOME_URL_CONFLICT","SITEMAP_TASK_NOT_FOUND","SITEMAP_DISCOVERY_FAILED","TASK_NOT_FOUND","PROVIDER_CAPABILITY_LIMIT","TASK_FAILED","WEBSITE_UNREACHABLE"],Fh=u.enum(Uh),mP=u.object({error_code:Fh,error_message:u.string().min(1),failure_stage:Hr.optional(),task_uuid:mt.optional(),task_code:It.optional()}).strict();function qh(t){try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as N}from"zod";var ve=N.string().url().refine(zh,{message:"URL must use http or https"}),Qr=N.string().min(1).max(512),Yn=N.string().datetime({offset:!0}),Jr=N.enum(["scraping","completed","failed","expired"]),dP=N.object({url:ve,ignore_cache:N.boolean(),sitemap:N.enum(["include","skip"]),include_subdomains:N.boolean(),ignore_query_parameters:N.boolean(),limit:N.number().int().min(1).max(1e5)}).strict(),uP=N.object({links:N.array(ve).max(1e5)}).strict(),gP=N.object({url:ve,limit:N.number().int().min(1).max(1e5),max_discovery_depth:N.literal(1),crawl_entire_domain:N.literal(!1),allow_subdomains:N.literal(!0),sitemap:N.literal("skip")}).strict(),_P=N.object({crawl_id:Qr,expires_at:Yn.optional()}).strict(),hP=N.object({status:Jr,urls:N.array(ve).max(1e5),next:ve.optional(),expires_at:Yn}).strict(),SP=N.object({url:ve,formats:N.tuple([N.literal("rawHtml")]),only_main_content:N.literal(!1),max_age:N.number().int().nonnegative()}).strict(),fP=N.object({url:ve,raw_html:N.string().min(1),status_code:N.number().int().min(100).max(599).nullable()}).strict(),bP=N.object({urls:N.array(ve).min(1).max(1e4),formats:N.tuple([N.literal("rawHtml")]),ignore_invalid_urls:N.literal(!1),max_age:N.number().int().nonnegative(),max_concurrency:N.number().int().positive().optional()}).strict(),yP=N.object({batch_id:Qr,expires_at:Yn.optional()}).strict(),Gh=N.object({url:ve,raw_html:N.string().min(1)}).strict(),xP=N.object({status:Jr,total:N.number().int().nonnegative(),completed:N.number().int().nonnegative(),pages:N.array(Gh).max(1e4),next:ve.optional(),expires_at:Yn}).strict().superRefine((t,n)=>{t.completed>t.total&&n.addIssue({code:"custom",path:["completed"],message:"completed must not exceed total"})}),Kh=N.object({url:ve,error_message:N.string().min(1)}).strict(),EP=N.object({errors:N.array(Kh).max(1e4),robots_blocked:N.array(ve).max(1e4)}).strict(),IP=N.object({active:N.number().int().nonnegative(),waiting:N.number().int().nonnegative(),max_concurrency:N.number().int().positive()}).strict();function zh(t){try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as S}from"zod";var tc=S.lazy(()=>rn),Bh=S.enum(["page","block"]),Zn=S.enum(["component","page","pages"]),Wh=S.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),lt=Wh,nc=S.object({requested_locale:lt,resolved_locale:lt,fallback_used:S.boolean()}).strict(),on=S.object({id:S.string().uuid(),key:S.string().min(1),name:S.string().min(1)}).strict(),Xn=on.extend({color:S.string().nullable()}).strict(),wP=S.object({kind:Bh,category_id:S.string().uuid().optional(),tag_id:S.string().uuid().optional(),search:S.string().trim().min(1).max(200).optional(),limit:S.coerce.number().int().min(1).max(50).default(20),cursor:S.string().min(1).optional()}).strict(),Vh=S.object({stable_key:S.string().min(1),type:Zn,title:S.string().min(1).max(200),description:S.string().max(1e3),thumbnail_url:S.string().url().nullable(),resolved_version:S.number().int().positive(),content_schema_version:S.literal(3),category:on.nullable(),tags:S.array(Xn),page_count:S.number().int().nonnegative(),component_count:S.number().int().nonnegative(),locale:nc}).strict(),AP=S.object({items:S.array(Vh),facets:S.object({categories:S.array(on),tags:S.array(Xn)}).strict(),next_cursor:S.string().nullable()}).strict(),vP=S.object({operation_id:S.string().uuidv7(),resolved_version:S.number().int().positive(),base_sitemap_id:S.string().uuid(),base_sitemap_version:S.number().int().positive(),sitemap:tc,target_page_id:S.string().min(1).optional()}).strict(),CP=S.object({next_sitemap:tc,applied:S.object({stable_key:S.string().min(1),resolved_version:S.number().int().positive(),template_type:Zn,page_ids:S.array(S.string().min(1)),block_ids:S.array(S.string().min(1))}).strict(),locale:nc,warnings:S.array(S.string())}).strict(),sc=S.object({nodeId:S.string().uuid(),type:S.string().trim().min(1).max(100),label:S.string().trim().min(1).max(200),variant:S.string().trim().min(1).max(100).optional(),order:S.number().int().nonnegative(),props:S.record(S.string(),S.unknown()),thumbnail:S.string().url().optional(),source:S.unknown().optional()}).strict(),ec=S.object({nodeId:S.string().uuid().optional(),slug:S.string().regex(/^\/$|^\/[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*$/u),navigation:S.object({showInHeader:S.boolean(),showInFooter:S.boolean(),order:S.number().int().nonnegative()}).strict(),components:S.array(sc).min(1).max(100),thumbnail:S.string().url().optional(),source:S.unknown().optional()}).strict(),$h=S.union([sc,ec,S.object({pages:S.array(ec).min(1).max(50),thumbnail:S.string().url().optional(),source:S.unknown().optional()}).strict()]),Hh=S.object({title:S.string().min(1).max(200),description:S.string().min(1).max(1e3),prompt:S.string().min(1).max(8192)}).strict(),Yh=S.object({locale:lt,title:S.string().min(1).max(200),content:S.object({description:S.string().min(1).max(1e3),prompt:S.string().min(1).max(8192),nodes:S.record(S.string().uuid(),Hh)}).strict()}).strict(),DP=S.object({templateId:S.string().uuid(),stableKey:S.string().min(1),type:Zn,resolvedVersion:S.number().int().positive(),contentSchemaVersion:S.literal(3),structure:$h,requestedLocale:lt,resolvedLocale:lt,fallbackUsed:S.boolean(),contents:S.array(Yh).length(1)}).strict().superRefine((t,n)=>{(t.type==="component"&&!("type"in t.structure)||t.type==="page"&&!("components"in t.structure)||t.type==="pages"&&!("pages"in t.structure))&&n.addIssue({code:"custom",path:["structure"],message:"Template type and structure must match."});let s=Xh(t.structure),a=new Set(Object.keys(t.contents[0]?.content.nodes??{}));(s.size!==a.size||[...s].some(i=>!a.has(i)))&&n.addIssue({code:"custom",path:["contents",0,"content","nodes"],message:"Localized nodes must exactly match the structure nodes."}),t.contents[0]?.locale!==t.resolvedLocale&&n.addIssue({code:"custom",path:["contents"],message:"Resolved locale must match returned content."}),t.fallbackUsed!==(t.requestedLocale!==t.resolvedLocale)&&n.addIssue({code:"custom",path:["fallbackUsed"],message:"fallbackUsed must match locale resolution."})}),jP=S.object({items:S.array(S.object({stableKey:S.string().min(1),type:Zn,title:S.string().min(1).max(200),description:S.string().max(1e3),thumbnailUrl:S.string().url().nullable(),resolvedVersion:S.number().int().positive(),contentSchemaVersion:S.literal(3),category:on.nullable(),tags:S.array(Xn),pageCount:S.number().int().nonnegative(),componentCount:S.number().int().nonnegative(),requestedLocale:lt,resolvedLocale:lt,fallbackUsed:S.boolean()}).strict()),facets:S.object({categories:S.array(on),tags:S.array(Xn)}).strict(),nextCursor:S.string().nullable()}).strict().superRefine((t,n)=>{t.items.forEach((s,a)=>{s.fallbackUsed!==(s.requestedLocale!==s.resolvedLocale)&&n.addIssue({code:"custom",path:["items",a,"fallbackUsed"],message:"fallbackUsed must match locale resolution."})})});function Xh(t){if("type"in t)return new Set([t.nodeId]);let n="pages"in t?t.pages:[t];return new Set(n.flatMap(s=>[...s.nodeId?[s.nodeId]:[],...s.components.map(a=>a.nodeId)]))}function OP(t){return yi({tenant_id:t.tenant_id,site_id:t.site_id,stable_key:t.stable_key,resolved_version:t.request.resolved_version,base_sitemap_id:t.request.base_sitemap_id,base_sitemap_version:t.request.base_sitemap_version,sitemap:t.request.sitemap,target_page_id:t.request.target_page_id??null})}import{z as te}from"zod";var Zh=["pending_dns","active","failed","removing"],Qh=te.enum(Zh),Jh=["serve_site","redirect_301"],eS=te.enum(Jh),tS=["traffic","ownership","certificate_delegation"],nS=te.enum(tS),sS=["pending","verified"],iS=te.enum(sS),xi=te.enum(["prepare_configuration","apply_configuration","verify_dns"]),aS=te.enum(["accepted","running","succeeded","failed"]),oS=te.object({code:te.string().min(1),message:te.string().min(1)}).strict(),rS=te.object({purpose:nS,type:te.string().min(1),name:te.string().min(1),value:te.string().min(1),verificationStatus:iS}).strict(),ic=te.object({id:te.string().min(1),hostname:te.string().min(1),isPrimary:te.boolean(),routingMode:eS,observedStatus:Qh,lastVerifiedAt:te.string().datetime().nullable(),dnsRecords:te.array(rS)}).strict().superRefine((t,n)=>{cS(t.hostname)||n.addIssue({code:"custom",path:["hostname"],message:"hostname must be a canonical ASCII hostname"}),t.isPrimary&&t.routingMode!=="serve_site"&&n.addIssue({code:"custom",path:["routingMode"],message:"a primary domain must serve the site"}),!t.isPrimary&&t.routingMode!=="redirect_301"&&n.addIssue({code:"custom",path:["routingMode"],message:"a non-primary domain must redirect with 301"})}),ac=te.object({primaryDomain:ic.nullable(),redirectDomains:te.array(ic)}).strict().superRefine((t,n)=>{t.primaryDomain!==null&&(!t.primaryDomain.isPrimary||t.primaryDomain.routingMode!=="serve_site")&&n.addIssue({code:"custom",path:["primaryDomain"],message:"primaryDomain must be primary and serve the site"});for(let[a,i]of t.redirectDomains.entries())(i.isPrimary||i.routingMode!=="redirect_301")&&n.addIssue({code:"custom",path:["redirectDomains",a],message:"redirectDomains must be non-primary 301 redirects"});t.primaryDomain!==null&&t.redirectDomains.some(i=>i.hostname===t.primaryDomain?.hostname)&&n.addIssue({code:"custom",path:["redirectDomains"],message:"primaryDomain must not also be a redirect"});let s=[...t.primaryDomain===null?[]:[t.primaryDomain.hostname],...t.redirectDomains.map(a=>a.hostname)];new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["redirectDomains"],message:"domain hostnames must be unique"})}),Ei=te.object({id:te.string().min(1),type:xi,status:aS,error:oS.nullable()}).strict().superRefine((t,n)=>{t.status==="failed"&&t.error===null&&n.addIssue({code:"custom",path:["error"],message:"failed operations must include a stable error"}),t.status!=="failed"&&t.error!==null&&n.addIssue({code:"custom",path:["error"],message:"non-failed operations must not include an error"})});function cS(t){if(t!==t.trim()||t!==t.toLowerCase()||t.length>253||t.endsWith("."))return!1;let n=t.split(".");return n.length>=2&&n[n.length-1].length>=2&&n.every(s=>s.length>=1&&s.length<=63&&/^[a-z0-9-]+$/.test(s)&&!s.startsWith("-")&&!s.endsWith("-"))}import{z as cn}from"zod";import{z as C}from"zod";var mS=C.enum(["active","completed","canceled"]),lS=C.enum(["quality","domain","gsc","publish"]),Rt=C.enum(["pending","running","succeeded","failed"]),pS=C.enum(["calculating","passed","failed"]),dS=C.object({group_code:C.string().min(1),name:C.string().min(1),display_status:Rt,result_text:C.string()}).strict(),uS=C.object({dimension_code:C.enum(["reach","trust","convert","safe"]),name:C.string().min(1),alias_en:C.string().min(1),description:C.string(),tips:C.string(),display_status:Rt,problem_group_count:C.number().int().nonnegative(),groups:C.array(dS)}).strict(),gS=C.object({task_code:C.string().uuid(),status:Rt,remediation_items:C.record(C.string(),C.unknown()),summary:C.object({final_score:C.number().int().min(0).max(100),can_publish:pS,group_count:C.number().int().nonnegative(),problem_group_count:C.number().int().nonnegative()}).strict(),dimensions:C.array(uS)}).strict(),pt=C.object({id:Xi,tenant_id:C.string().min(1),site_id:I,status:mS,current_step:lS,sensitive_word_task_id:C.number().int().nonnegative(),sensitive_word_task_status:Rt,quality_task_code:C.string().uuid(),quality_task_status:Rt,task_id:C.string().min(1).nullable(),task_status:Rt,publish_deployment_id:Fe.nullable(),domain_hostname:C.string().min(1).nullable(),domain_operation_type:xi.nullable(),domain_operation_payload:C.record(C.string(),C.unknown()).nullable(),domain_preparation_operation_id:C.string().min(1).nullable(),domain_operation_id:C.string().min(1).nullable(),revision:C.number().int().positive(),created_at:C.string().min(1),updated_at:C.string().min(1),completed_at:C.string().min(1).nullable(),canceled_at:C.string().min(1).nullable()}).strict().superRefine((t,n)=>{if(t.task_id!==t.quality_task_code&&n.addIssue({code:"custom",path:["task_id"],message:"task_id must remain the read-only quality_task_code alias"}),t.task_status!==t.quality_task_status&&n.addIssue({code:"custom",path:["task_status"],message:"task_status must remain the read-only quality_task_status alias"}),t.domain_operation_type===null){t.domain_operation_payload!==null&&n.addIssue({code:"custom",path:["domain_operation_payload"],message:"domain_operation_payload must be null without an active domain operation"}),t.domain_operation_id!==null&&n.addIssue({code:"custom",path:["domain_operation_id"],message:"domain_operation_id must be null without an active domain operation"});return}t.domain_hostname===null&&n.addIssue({code:"custom",path:["domain_hostname"],message:"an active domain operation requires a hostname"}),t.domain_operation_payload===null&&n.addIssue({code:"custom",path:["domain_operation_payload"],message:"an active domain operation requires a payload"})}),zP=C.object({}).strict(),BP=C.object({}).strict(),WP=C.object({expected_revision:C.number().int().nonnegative(),current_step:C.enum(["domain","gsc","publish"]),skip_domain_binding:C.boolean().optional()}).strict(),VP=C.object({expected_revision:C.number().int().nonnegative()}).strict(),_S=C.object({workflow:pt.nullable(),can_cancel:C.boolean()}).strict(),$P=M(_S).strict(),hS=C.object({workflow:pt,can_cancel:C.boolean()}).strict(),HP=M(hS).strict(),SS=C.object({workflow:pt,deployment:C.lazy(()=>Qe)}).strict(),YP=M(SS).strict(),XP=C.object({workflow:pt,can_cancel:C.boolean(),quality_result:gS.optional(),message:C.string().min(1).optional()}).strict();var fS=cn.object({hostname:cn.string().min(1),expected_revision:cn.number().int().nonnegative()}).strict(),oc=cn.object({workflow:pt,operation:Ei}).strict(),bS=M(oc).strict(),rc=cn.object({workflow:pt,operation:Ei.nullable()}).strict(),yS=M(rc).strict(),nw=M(ac).strict(),sw=fS,iw=oc,aw=bS,ow=rc,rw=yS;import{z as Pe}from"zod";var xS=["started","success","failed","canceled"],Ii=Pe.enum(xS),ES=["inactive","pending_binding","active"],Ri=Pe.enum(ES),IS=["domain","url_prefix"],Ti=Pe.enum(IS),RS=["not_connected","authorizing","matching_property","ready","failed","canceled","domain_mismatch"],ki=Pe.enum(RS),Ue=Pe.string().nullable(),cc=Pe.object({}).strict(),Pi=Pe.object({authorize_url:Pe.string().url(),custom_domain:Ue}).strict(),mc=M(Pi),TS=Pe.object({auth_status:Ii,binding_status:Ri,credential_connected:Pe.boolean(),custom_domain:Ue,gsc_site_url:Ue,property_type:Ti.nullable(),auth_error_code:Ue,auth_error_message:Ue}).strict(),lc=Pe.object({auth_status:Ii,binding_status:Ri,credential_connected:Pe.boolean(),custom_domain:Ue,gsc_site_url:Ue,property_type:Ti.nullable(),auth_error_code:Ue,auth_error_message:Ue,current_domain:Ue,state:ki,ready:Pe.boolean()}).strict().superRefine((t,n)=>{let s=PS(t,t.current_domain),a=s==="ready";t.state!==s&&n.addIssue({code:"custom",path:["state"],message:`state must equal ${s} for the supplied GSC facts`}),t.ready!==a&&n.addIssue({code:"custom",path:["ready"],message:`ready must equal ${String(a)} for the supplied GSC facts`})}),kS=M(lc);function mn(t){let n=t?.trim()??"";if(!n)return"";let s=/^[a-z][a-z0-9+.-]*:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).hostname.replace(/\.+$/,"").toLowerCase()}catch{return n.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").split(/[/?#]/,1)[0].replace(/\.+$/,"").toLowerCase()}}function PS(t,n){let s=t.gsc_site_url?.trim()??"",a=mn(t.custom_domain),i=mn(n??("current_domain"in t?t.current_domain:void 0)),r=a.length>0&&i.length>0&&a===i,_=wS(s,t.property_type,i);return t.auth_status==="canceled"?"canceled":t.auth_status==="failed"?"failed":t.auth_status==="started"?"authorizing":!t.credential_connected||t.binding_status==="inactive"?"not_connected":s.length===0||t.property_type===null?"matching_property":!r||!_?"domain_mismatch":t.binding_status==="pending_binding"?"matching_property":t.auth_status==="success"&&t.binding_status==="active"&&t.credential_connected&&s.length>0&&r&&_?"ready":"failed"}function wS(t,n,s){let a=t?.trim()??"",i=mn(s);if(!a||!i||!n)return!1;if(n==="domain"){let r=/^sc-domain:(.+)$/i.exec(a);if(!r)return!1;let _=r[1].trim();return!_||/[/:?#]/.test(_)?!1:mn(_)===i}try{let r=new URL(a);return r.protocol!=="https:"||r.username||r.password||r.port||r.pathname!=="/"||r.search||r.hash?!1:mn(r.hostname)===i}catch{return!1}}var pw=cc,dw=Pi,uw=mc,gw=ki,_w=Ii,hw=Ri,Sw=Ti,fw=ki,bw=cc,yw=Pi,xw=mc,Ew=TS,Iw=lc,Rw=kS;var pc=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,dc="VCP_E2B_PREVIEW_PROXY_DOMAIN must be a valid hostname.";function AS(t){let n=t?.trim().toLowerCase()??"";if(!n)return null;if(n.length>253||!n.includes(".")||!n.split(".").every(s=>pc.test(s)))throw new Error(dc);return n}function kw(t){let n=AS(t.proxyDomain);if(!n)return null;let s=t.sandboxId.trim();if(!pc.test(s))throw new Error("sandboxId must be a valid DNS label.");if(`${s}.${n}`.length>253)throw new Error(dc);return`https://${s}.${n}/`}function vS(t,n,s=t){let a=new Map(t.map(c=>[c.slug,c])),i=new Map(s.map(c=>[c.id,c])),r=new Map(t.map(c=>{let g=i.get(c.id);return g&&g.slug!==null&&g.slug!==c.slug?[g.slug,c]:null}).filter(c=>c!==null)),_=new Set(s.map(c=>c.slug).filter(c=>c!==null&&!a.has(c)));return{primaryLinks:uc(n.primaryLinks,t,a,r,_,i,"showInHeader"),footerLinks:uc(n.footerLinks,t,a,r,_,i,"showInFooter")}}function uc(t,n,s,a,i,r,_){let c=new Set,g=[];for(let[F,q]of t.entries()){let J=CS(q.href),ne=J===null?void 0:s.get(J)??a.get(J);if(J!==null&&i.has(J)&&!s.has(J)&&!a.has(J))continue;if(!ne||ne.slug==="/"){g.push({kind:"independent",link:q});continue}if(!ne.navigation[_])continue;c.add(ne.slug);let At=r.get(ne.id),fm=q.label===(At?.title??ne.title)?ne.title:q.label,bm=J===ne.slug?q.href:DS(q.href,ne.slug);g.push({kind:"page",page:ne,link:{...q,label:fm,href:bm},index:F})}let j=g.filter(F=>F.kind==="page").sort((F,q)=>F.page.navigation.order-q.page.navigation.order||F.index-q.index),E=0,O=g.map(F=>F.kind==="page"?j[E++].link:F.link);for(let F of[...n].filter(q=>q.slug!=="/"&&q.navigation[_]).sort((q,J)=>q.navigation.order-J.navigation.order))c.has(F.slug)||O.push({label:F.title,href:F.slug});return O}function CS(t){if(!t.startsWith("/")||t.startsWith("//"))return null;let n=t.search(/[?#]/u);return n===-1?t:t.slice(0,n)}function DS(t,n){let s=t.search(/[?#]/u);return s===-1?n:`${n}${t.slice(s)}`}import{z as w}from"zod";var gc=20*1024*1024,jS=gc,_c=["jpg","jpeg","png","gif","webp","bmp"],hc=["mp4","avi","mov","webm","mkv"],Sc=["mp3","wav","aac","flac","ogg","wma","m4a"],fc=["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","md","csv"],bc=[...fc,"zip","rar","json","xmind","psd","ai","fig","sketch"],OS=[..._c,...hc,...Sc,...bc],yc=["image/jpeg","image/png","image/gif","image/webp","image/bmp"],xc=["video/mp4","video/x-msvideo","video/quicktime","video/webm","video/x-matroska"],Ec=["audio/mpeg","audio/wav","audio/x-wav","audio/vnd.wave","audio/aac","audio/flac","audio/x-flac","audio/ogg","audio/x-ms-wma","audio/mp4","audio/x-m4a"],NS=[...yc,...xc,...Ec],Ic=w.enum(["image","video","audio","file"]),Rc=w.enum(["external","ai_generated","unsplash"]),wi=w.object({resource_id:w.string().min(1),name:w.string().min(1).max(255),url:w.string().url(),thumbnail_url:w.union([w.string().url(),w.literal("")]),mime_type:w.string().trim().min(3).max(127),size:w.number().int().nonnegative(),width:w.number().int().positive().nullable(),height:w.number().int().positive().nullable(),source:Rc,created_at:w.string().min(1).nullable()}),LS=w.object({page:w.coerce.number().int().min(1).default(1),page_size:w.coerce.number().int().min(1).max(100).default(24),keyword:w.string().trim().max(100).optional(),file_type:Ic.default("image")}),MS=w.object({code:w.literal(0),message:w.string(),data:w.object({items:w.array(wi),page:w.number().int().min(1),page_size:w.number().int().min(1),total:w.number().int().nonnegative()})}),US=w.object({code:w.literal(0),message:w.string(),data:wi}),Tc=w.object({provider_id:w.string().min(1),url:w.string().url(),thumbnail_url:w.string().url(),width:w.number().int().positive(),height:w.number().int().positive(),alt:w.string(),photographer_name:w.string().min(1),photographer_url:w.string().url(),photo_url:w.string().url(),download_location:w.string().url(),dominant_color:w.string().nullable()}),FS=w.object({query:w.string().trim().min(1).max(100),page:w.coerce.number().int().min(1).default(1),page_size:w.coerce.number().int().min(1).max(30).default(18),orientation:w.enum(["landscape","portrait","squarish"]).optional()}),qS=w.object({code:w.literal(0),message:w.string(),data:w.object({items:w.array(Tc),page:w.number().int().min(1),page_size:w.number().int().min(1),total:w.number().int().nonnegative(),total_pages:w.number().int().nonnegative()})}),kc=w.string().url().refine(zS,{message:"download_location must be an official Unsplash download URL"}),GS=w.object({download_location:kc}),KS=w.object({code:w.literal(0),message:w.string(),data:w.object({reported:w.boolean()})});function zS(t){if(!URL.canParse(t))return!1;let n=new URL(t);return n.protocol==="https:"&&n.hostname==="api.unsplash.com"&&n.username===""&&n.password===""&&n.port===""&&n.hash===""&&/^\/photos\/[^/]+\/download$/.test(n.pathname)}import{z as Ce}from"zod";var BS=Ce.object({colorSeeds:Ce.object({primary:Ce.string().min(1).max(40),accent:Ce.string().min(1).max(40),foreground:Ce.string().min(1).max(40).optional()}).strict().optional(),surfaceMode:Ce.enum(["light","dark"]).optional(),fonts:Ce.object({heading:Ce.string().min(1).max(60),body:Ce.string().min(1).max(60)}).strict().optional()}).strict().refine(t=>t.colorSeeds!==void 0||t.surfaceMode!==void 0||t.fonts!==void 0,{message:"colorSeeds, surfaceMode, or fonts is required"}),WS=Ce.object({ok:Ce.literal(!0),design_plan_version:Ce.number().int().positive(),snapshot_id:x});var Ci=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","airy","editorial"]).optional(),motionPreset:e.enum(["subtle","moderate","expressive"]).optional(),colorSeeds:e.object({primary:e.string().min(1).max(40),accent:e.string().min(1).max(40),foreground:e.string().min(1).max(40).optional(),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(),themeId:e.string().min(1).max(60).optional(),themeDescription:e.string().min(1).max(400).optional(),aestheticNote:e.string().min(1).max(300).optional()}),Ai=e.enum(["material","reference","brief","industry"]),VS=e.object({market:e.object({value:e.string().min(1).max(200),source:Ai}),customer:e.object({value:e.string().min(1).max(200),source:Ai}),purpose:e.object({options:e.array(e.string().min(1).max(60)).min(2).max(4),selected:e.string().min(1).max(60),source:Ai})}),$S=e.enum(["text-options","motion-slider","positioning"]),Di=e.enum(["none","subtle","moderate","expressive"]),HS=e.enum(["compact","comfortable","airy","editorial"]),YS=Di,Cc=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()}),XS=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:Ci.optional(),conversionHints:st.optional()}),ZS=e.object({id:e.string(),type:$S,question:e.string(),tag:e.string(),aiThinking:e.string(),options:e.array(XS),source:e.enum(["ai-detected","always-ask"]),sourceDetail:e.string(),positioning:VS.optional()}),ji=e.object({questions:e.array(ZS).min(1).max(6)}),tA=e.object({tenant_id:e.string().min(1),site_id:I,brief_id:ut,brief:e.string().min(20).max(1e3),site_default_locale:pe.optional(),owner_locale:pe.optional(),input_context:e.object({facts:e.array(un).max(120),conflicts:e.array(_n).max(20),reference:gn.optional(),sources:e.array(e.object({type:os,title:e.string().max(120).optional(),status:rs})).max(16).optional()}).optional()}),Dc=e.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),nA=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:V,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(Cc).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:Dc.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)})]),sA="SITE_PLANNING_INPUT_FROZEN",iA="SITE_PLANNING_LOCKED",aA="SITE_STRUCTURE_CONFIRMATION_REQUIRED",oA="SITE_STRUCTURE_CONFIRMATION_STALE",rA=e.object({tenant_id:e.string().min(1),owner_user_id:ss,name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),cA=e.object({name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),mA=e.object({name:e.string().min(1).max(120)}),lA=e.object({name:e.string().min(1).max(120),default_locale:pe.optional()}),pA=e.object({body:e.string().min(20).max(1e3)}),dA=e.object({body:e.string().min(20).max(1e3)}),Oi=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"}),uA=e.object({tenant_id:e.string().min(1),site_id:I.optional(),site_url:Oi,site_name:e.string().trim().min(1).max(255).optional()}),gA=M(wa),_A=M(Aa),hA=M(va),SA=M(Ba),fA=M(Wa),bA=M(Va),yA=M(Ha),xA=M(Ya),EA=M(Xa),IA=M(e.object({site_id:I,site_url:Oi})),tt=e.object({id:I,tenant_id:e.string().min(1),owner_user_id:ss.nullable(),name:e.string().min(1),slug:e.string().min(1),status:Ms,deployment_status:Us,archived_at:e.string().min(1).nullable(),current_sitemap_id:ke.nullable(),confirmed_sitemap_id:ke.nullable().optional(),confirmed_sitemap_version:e.number().int().positive().nullable().optional(),structure_confirmed_at:e.string().min(1).nullable().optional(),migration_content_requested:e.boolean().optional(),current_snapshot_id:x.nullable(),published_deployment_id:Fe.nullable().optional(),deployed_url:e.string().url().nullable(),default_locale:pe,owner_locale:pe.optional(),cms_site_id:ua.nullable().optional(),cms_site_url:Oi.nullable().optional(),parent_site_id:I.nullable().optional(),mount_path:e.string().min(1).nullable().optional(),schema_version:e.literal(1),created_at:e.string().min(1),updated_at:e.string().min(1)}),Ni=e.object({id:ut,tenant_id:e.string().min(1),site_id:I,body:e.string().min(1),source:e.enum(["user","import","system"]),created_at:e.string().min(1),updated_at:e.string().min(1)}),RA=e.object({site:tt,brief:Ni,next_step:e.literal("clarify")}),TA=e.object({site:tt,brief:Ni}),kA=e.object({brief:Ni}),QS=e.enum(["queued","running","succeeded","failed","cancelled"]),jc=e.enum(["clarify","sitemap","workspace"]),Oc=e.enum(["clarify","sitemap","initial_generation","iteration"]),Nc=e.enum(["clarify","sitemap","workspace","summarize"]),et=e.object({id:V,tenant_id:e.string().min(1),site_id:I,agent_type:jc,run_kind:Oc,status:QS,model_route:Nc,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)}),PA=e.object({run_id:V.optional(),site_id:I,agent_type:jc,run_kind:Oc.optional(),model_route:Nc,input:e.record(e.string(),e.unknown()).optional()}).superRefine((t,n)=>{ln(t.input)&&n.addIssue({code:"custom",path:["input"],message:"Agent run input must not contain secrets"})}),wA=e.object({agent_run:et,next_step:e.literal("stream_events")}),Lc=e.enum(["draft","candidate","deleting","current","failed"]),We=e.object({id:x,tenant_id:e.string().min(1),site_id:I,version:e.number().int().positive(),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),template_version:De.nullable().optional(),reason:e.enum(["initial_generation","workspace_edit","pre_deploy","manual_save","rollback","template_upgrade","subsite_clone"]),status:Lc,created_at:e.string().min(1)}),AA=e.object({snapshot_id:x,creation_key:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),template_version:De.optional(),reason:We.shape.reason,status:e.enum(["draft","candidate","current","failed"]).default("candidate"),source_run_id:V.optional()}),vA=e.object({site:tt,snapshot:We,next_step:e.literal("workspace")}),CA=e.object({expected_manifest_hash:We.shape.manifest_hash,manifest_hash:We.shape.manifest_hash,object_key:We.shape.object_key}).strict(),DA=e.union([e.object({base_snapshot_id:x.nullable(),source_run_id:V.optional()}).strict(),e.object({skip_base_check:e.literal(!0)}).strict()]),JS=e.object({site:tt,snapshot:We,next_step:e.literal("workspace")}),jA=e.object({snapshot:We}),OA=e.object({status:e.literal("deleting"),snapshot_id:x,object_key:e.string().min(1)}),NA=e.object({status:e.literal("deleted"),snapshot_id:x}),ts=e.object({id:Hi,tenant_id:e.string().min(1),site_id:I,snapshot_id:x,version:e.number().int().positive(),accepted_commit:e.string().min(1),source_run_id:V.nullable(),created_at:e.string().min(1)}),ef=ts.extend({reason:We.shape.reason,status:Lc}),LA=e.object({accepted_commit:e.string().min(1),source_run_id:V.optional()}),MA=e.object({site_version:ts,next_step:e.literal("workspace")}),UA=e.object({owner_id:e.string().min(1)}).strict(),FA=e.discriminatedUnion("acquired",[e.object({acquired:e.literal(!0)}).strict(),e.object({acquired:e.literal(!1)}).strict()]),qA=e.object({owner_id:e.string().min(1)}).strict(),GA=e.object({released:e.literal(!0)}).strict(),KA="TEMPLATE_UPGRADE_LOCK_LOST",zA=e.object({base_snapshot_id:x,accepted_commit:ts.shape.accepted_commit,owner_id:e.string().min(1)}).strict(),BA=JS.strict(),WA=e.object({site_versions:e.array(ef)}),VA=e.object({site:tt,snapshot:We,site_version:ts,next_step:e.literal("workspace")}),$A=e.object({snapshot_id:x,force_rehydrate:e.boolean().optional()}),tf=e.discriminatedUnion("status",[e.object({status:e.literal("ready"),snapshot_id:x,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()})]),HA=e.object({tenant_id:e.string().min(1),site_id:I,snapshot_id:x}).strict(),YA=tf,Li=e.enum(_t),Mc=e.enum(["quality_check","publish"]),Qe=e.object({id:Fe,tenant_id:e.string().min(1),site_id:I,snapshot_id:x,type:Mc.default("publish"),version:e.number().int().positive(),status:Li,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)}),XA=e.object({tenant_id:e.string().min(1),site_id:I,expected_snapshot_id:x}).strict(),ZA=e.object({deployment:Qe}),QA=e.object({tenant_id:e.string().min(1),site_id:I,deployment_id:Fe}).strict(),JA=e.object({deployment:Qe}),ev=e.object({}).strict(),tv=e.object({snapshot_id:x.optional()}).strict(),nf=e.object({deployment:Qe}),nv=M(nf),sv=e.object({deployment:Qe.nullable()}),iv=e.object({deployment:Qe}),Pc=e.object({id:Fe,type:Mc.default("publish"),status:Li,url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable()}),sf=e.object({current:Pc.nullable(),latest_released:Pc.nullable()}),av=M(sf),af=e.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),Tt=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:I,deployment_id:Fe,seq:e.number().int().positive(),sent_at:e.string().min(1)}),Qn=e.object({deployment:Qe,steps:No.default([])}),ov=e.discriminatedUnion("type",[Tt.extend({type:e.literal("deployment.snapshot"),payload:Qn}),Tt.extend({type:e.literal("deployment.status.changed"),payload:Qn}),Tt.extend({type:e.literal("deployment.finished"),payload:Qn}),Tt.extend({type:e.literal("deployment.failed"),payload:Qn}),Tt.extend({type:e.literal("deployment.realtime.recovered"),payload:e.object({action:e.literal("refresh")})}),Tt.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})})]),rv=e.object({tenant_id:e.string().min(1),site_id:I,deployment_id:Fe,status:Li,updated_at:e.string().min(1)}),of="vcp:deployments",cv={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:of,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...af.options]},rf=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)})}),mv=e.object({error:rf.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:et})})}),lv=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({})}),cf=e.object({theme_id:e.string().min(1),paletteIntent:e.string().min(1),tone:e.string().min(1),mediaMood:e.string().min(1),motionLevel:Di.optional(),userVisualHints:Ci.optional()}),mf=e.object({question:e.string().min(1),answer:e.string().min(1)}),pv=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)}),dv=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()}),lf=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()}),uv=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:lf.optional()}),pf=e.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),kt=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:pf.default("system_recommended")}),$=e.string().min(1).max(2e3),wc=e.string().min(1).max(120),Uc=e.object({visualDirection:$,brandFeeling:$,paletteIntent:$,typographyIntent:$,density:HS,motionLevel:YS,motionPreset:e.enum(["subtle","moderate","expressive"]).optional(),mediaStrategy:$,compositionRules:e.array($).max(20),avoidPatterns:e.array($).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),foreground:e.string().min(1).max(40).optional(),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()}),Mi=160,Fc=e.object({routeGoal:$,narrativeArc:$,firstViewportIntent:$,visualContinuity:$,sectionRhythm:$,avoidPatterns:e.array($).max(20),displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(Mi).optional(),metaTitle:e.string().min(1).max(120).optional(),metaDescription:e.string().min(1).max(320).optional(),primaryKeyword:e.string().min(1).max(160).optional(),longTailKeywords:e.array(e.string().min(1).max(160)).max(3).optional()}),qc=e.enum(["model_call","validation","repair","preview","worker_group"]),Je=e.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),Gc=e.object({sectionRole:$,contentIntent:$,layoutIntent:$,visualIntent:$,mediaIntent:$,motionIntent:$,copyTone:$,displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(Mi).optional(),ctaIntent:$.optional(),continuityWithPrevious:$.optional(),avoidRepeating:e.array($).max(20).optional(),industryRecipeRefs:e.array(wc).max(12).optional(),templateRecipeRefs:e.array(wc).max(12).optional()}),Kc=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()}),df=e.enum(["solid","floating"]),uf=e.enum(["background","card","primary","frosted"]),gf=e.enum(["sticky","hide-on-scroll","static"]),_f=e.enum(["bar","island"]),hf=e.object({variant:df,surface:uf.optional(),behavior:gf.optional(),shape:_f.optional()}),Sf=e.object({form:$,layoutIntent:$,scrollBehavior:$,shell:hf.optional(),avoidPatterns:e.array($).max(10).optional()}),ff=e.enum(["background","card","primary","inverse"]),bf=e.object({surface:ff}),yf=e.object({form:$,composition:$,shell:bf.optional(),avoidPatterns:e.array($).max(10).optional()}),xf=e.object({pattern:$,intent:$}),zc=e.object({header:Sf,footer:yf,mobileNav:xf}),Bc=e.object({schemaVersion:e.literal(1).default(1),siteDesignContext:Uc,routeCards:e.record(e.string().min(1),Fc),blockContexts:e.record(e.string().min(1),Gc),selectedSkillPacks:e.array(kt).max(3).optional(),branding:Kc.optional(),chromeDesign:zc.optional()}),gv=e.object({siteDesignContext:Uc.omit({imagePalette:!0}).optional(),routeCards:e.record(e.string().min(1),Fc).optional(),blockContexts:e.record(e.string().min(1),Gc).optional(),branding:Kc.optional(),chromeDesign:zc.optional()}),xe=e.string().trim().min(1),Ui=e.object({id:xe,label:e.string().trim().min(1),type:e.string(),variant:e.string().optional(),order:e.number(),props:e.record(e.string(),e.unknown()),meta:e.object({aiGenerated:e.boolean(),userEdited:e.boolean(),lastEditedAt:e.string(),lastEditedBy:e.enum(["ai","user"]),userInstruction:e.string().optional()}).optional()}).strict(),Wc=e.string().regex(Ut,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),Ef=new RegExp(`^/(?:${St}(?:/${St})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),If=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,Rf=e.union([e.string().regex(Ef),e.string().regex(If)]),Ac=e.object({label:e.string(),href:Rf}).passthrough(),Tf=e.object({primaryLinks:e.array(Ac),footerLinks:e.array(Ac)}),Vc=e.object({showInHeader:e.boolean(),showInFooter:e.boolean(),order:e.number()}).strict(),Fi=e.object({id:xe,slug:Wc,title:e.string().trim().min(1),blocks:e.array(Ui).min(1),navigation:Vc}).strict(),kf=Ui.extend({type:e.string().nullable()}).strict(),Pf=Fi.extend({slug:Wc.nullable(),navigation:Vc.extend({showInHeader:e.boolean().nullable(),showInFooter:e.boolean().nullable()}).strict(),blocks:e.array(kf).min(1)}).strict(),wf=Ui.extend({id:e.string()}),Af=Fi.extend({id:e.string(),slug:e.string().min(1),blocks:e.array(wf).min(1)}),vc=e.object({label:e.string(),href:e.string().min(1)}),vf=e.object({primaryLinks:e.array(vc),footerLinks:e.array(vc)}),Cf=e.discriminatedUnion("kind",[e.object({kind:e.literal("brief_clarify"),brief_id:ut,answer_ids:e.array(e.string().min(1)).max(10)}).strict(),e.object({kind:e.literal("step5_strategy"),strategy_version_id:e.string().uuid(),strategy_version:e.number().int().positive(),strategy_checksum:e.string().regex(/^[a-f0-9]{64}$/)}).strict()]),Jn=e.object({site_name:e.string().min(1).max(80).optional(),version:e.number().int().positive(),pages:e.array(Fi).min(1),navigation:Tf,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(),source:Cf.optional()}),skillSelection:kt,visualTheme:cf.optional(),userChoices:e.array(mf).optional(),confirmedChoices:e.object({conversion:st.optional()}).optional(),seoKeywords:e.array(En).min(1).max(50).optional()}).strict(),Pt=Jn.superRefine((t,n)=>{Yc(t.pages,n)}),rn=Jn.extend({pages:e.array(Pf).min(1)}).strict().superRefine((t,n)=>{Yc(t.pages,n)}),Df=e.enum(["slug","showInHeader","showInFooter"]),jf=e.object({page_id:xe,fields:e.array(Df).min(1).max(3)}).strict(),Of=e.object({page_id:xe,block_id:xe,fields:e.tuple([e.literal("type")])}).strict(),$c=100,Hc=500,Nf=e.object({pages:e.array(jf).max($c),blocks:e.array(Of).max(Hc)}).strict().superRefine((t,n)=>{let s=new Set;t.pages.forEach((i,r)=>{s.has(i.page_id)&&n.addIssue({code:"custom",path:["pages",r,"page_id"],message:`Duplicate page target '${i.page_id}'.`}),s.add(i.page_id),new Set(i.fields).size!==i.fields.length&&n.addIssue({code:"custom",path:["pages",r,"fields"],message:"Page target fields must be unique."})});let a=new Set;t.blocks.forEach((i,r)=>{let _=`${i.page_id}\0${i.block_id}`;a.has(_)&&n.addIssue({code:"custom",path:["blocks",r],message:`Duplicate block target '${i.page_id}/${i.block_id}'.`}),a.add(_)})}),_v=e.object({sitemap:rn,targets:Nf}).strict(),hv=e.object({pages:e.array(e.object({page_id:xe,slug:e.string().min(1).optional(),show_in_header:e.boolean().optional(),show_in_footer:e.boolean().optional()}).strict()).max($c),blocks:e.array(e.object({page_id:xe,block_id:xe,type:e.string().trim().min(1)}).strict()).max(Hc)}).strict().superRefine((t,n)=>{let s=new Set;t.pages.forEach((i,r)=>{s.has(i.page_id)&&n.addIssue({code:"custom",path:["pages",r,"page_id"],message:`Duplicate page output '${i.page_id}'.`}),s.add(i.page_id)});let a=new Set;t.blocks.forEach((i,r)=>{let _=`${i.page_id}\0${i.block_id}`;a.has(_)&&n.addIssue({code:"custom",path:["blocks",r],message:`Duplicate block output '${i.page_id}/${i.block_id}'.`}),a.add(_)})}),Sv=e.object({sitemap:Pt}).strict();function Yc(t,n){let s=new Map,a=new Map,i=new Map,r=0;t.forEach((_,c)=>{let g=s.get(_.id);if(g!==void 0?n.addIssue({code:"custom",path:["pages",c,"id"],message:`Duplicate page id '${_.id}' (first used at pages.${g}.id).`}):s.set(_.id,c),_.blocks.forEach((E,O)=>{let F=a.get(E.id);F!==void 0?n.addIssue({code:"custom",path:["pages",c,"blocks",O,"id"],message:`Duplicate block id '${E.id}' (first used at pages.${F.pageIndex}.blocks.${F.blockIndex}.id).`}):a.set(E.id,{pageIndex:c,blockIndex:O})}),_.slug===null)return;_.slug==="/"&&(r+=1);let j=i.get(_.slug);j!==void 0?n.addIssue({code:"custom",path:["pages",c,"slug"],message:`Duplicate page slug '${_.slug}' (first used at pages.${j}.slug).`}):i.set(_.slug,c)}),(r!==1||t[0]?.slug!=="/")&&n.addIssue({code:"custom",path:["pages"],message:"Sitemap must contain exactly one home page at pages[0] with slug '/'."})}var fv=Jn.omit({skillSelection:!0,visualTheme:!0,userChoices:!0,confirmedChoices:!0,seoKeywords:!0}).extend({meta:Jn.shape.meta.omit({source:!0}),site_name:e.string().min(1).max(80),pages:e.array(Af).min(1),navigation:vf}),Lf=e.enum(["ai","user"]),wt=e.object({site_id:I,page_id:xe,edited_by:Lf.default("ai"),source_agent_run_id:V.optional()}),bv=wt.extend({block_id:xe,target_index:e.number().int().min(0)}),Mf=wt.extend({block_id:xe}),Uf=wt.extend({block_id:xe,instruction:e.string()}),yv=wt.extend({block_id:xe,variant:e.string().min(1).nullable()}),xv=wt.extend({block_id:xe,props:e.record(e.string(),e.unknown()),mode:e.enum(["replace","merge"]).default("replace")}),Ev=wt.extend({block:e.object({id:xe,label:e.string().trim().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()})}),Ff=e.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),Iv=e.discriminatedUnion("operation",[e.object({operation:e.literal("delete_block"),input:Mf}).strict(),e.object({operation:e.literal("update_block_instruction"),input:Uf}).strict()]),qf=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_LAST_BLOCK_DELETE_FORBIDDEN","SITEMAP_EDIT_FAILED"]),Gf=e.object({status:e.literal("updated"),operation:Ff,site_id:I,sitemap_id:ke,version:e.number().int().positive(),changed_pages:e.array(xe).min(1),requires_code_patch:e.literal(!0)}),Kf=e.object({status:e.literal("failed"),code:qf,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),Rv=e.discriminatedUnion("status",[Gf,Kf]),qi=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:Di.optional(),visual_tonality:Ci.optional(),conversion:st.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()}),zf=e.object({id:e.string().trim().min(1).max(128),type:e.literal(1),search_intent:e.string().trim().min(1).max(255),path:e.string().trim().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),channel:e.string().trim().min(1).max(80),content_format:e.string().trim().min(1).max(80),priority:e.enum(["P0","P1","P2","P3"])}).strict(),Tv=e.object({source:e.object({kind:e.literal("step5_strategy")}).strict()}).strict(),Bf=e.object({item_key:xn,title:e.string().trim().min(1).max(200),selected_option_id:ht,selected_label:e.string().trim().min(1).max(200),selected_value:e.string().trim().min(1).max(500),selected_description:e.string().trim().min(1).max(2e3),impact:e.string().trim().min(1).max(500).optional(),customer_note:e.string().trim().min(1).max(200).optional()}).strict(),Wf=e.object({kind:e.literal("step5_strategy"),site_name:e.string().trim().min(1).max(80).optional(),strategy_version_id:e.string().uuid(),strategy_version:e.number().int().positive(),strategy_checksum:e.string().regex(/^[a-f0-9]{64}$/),decisions:e.array(Bf).length(fe),seo_keywords:e.array(En).min(1).max(50).optional()}).strict().superRefine((t,n)=>{t.decisions.forEach((s,a)=>{s.item_key!==it[a]&&n.addIssue({code:"custom",path:["decisions",a,"item_key"],message:"Step5 sitemap decisions must use the canonical order."})})}),Xc=e.object({tenant_id:e.string().min(1),site_id:I,brief_id:ut,brief:e.string().min(20).max(1e3),answers:e.array(qi).min(1).max(10),skillSelection:kt,site_default_locale:pe.optional(),owner_locale:pe.optional(),cms_site_id:e.string().min(1).nullish(),intent_pages:e.array(zf).max(bn).optional(),reference:gn.optional(),input_context:e.object({facts:e.array(un).max(120),conflicts:e.array(_n).max(20)}).optional(),business_facts:Qi.optional(),extra_requirement:e.string().trim().min(1).max(gt).optional(),migration_products_enabled:e.boolean().optional()}),Vf=Xc.pick({tenant_id:!0,site_id:!0,skillSelection:!0,site_default_locale:!0,owner_locale:!0,cms_site_id:!0,reference:!0,input_context:!0,business_facts:!0,extra_requirement:!0,migration_products_enabled:!0}).partial({skillSelection:!0}).extend({source:Wf}).strict(),kv=e.union([Xc,Vf]),Zc=e.enum(["planning","generating","validating","ready"]),$f=e.enum(["salvaged","deterministic_fallback"]),Hf=e.enum(["model_exception_settled_prefix","model_exception_safe_root"]),Qc={outcome:$f.optional(),reason:Hf.optional(),attempts:e.number().int().positive().optional()};function Jc(t,n){if(t.type!=="sitemap.generated")return;let s=t.outcome!==void 0,a=t.reason!==void 0;s!==a&&n.addIssue({code:"custom",path:[s?"reason":"outcome"],message:"sitemap.generated outcome and reason must be provided together"})}var Yf=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:V,at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:Zc,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:ke,sitemap:Pt,...Qc,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_block_count:e.number().int().nonnegative().optional(),final_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:x,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:x.optional(),at:e.string().min(1)})]),Pv=Yf.superRefine(Jc),em=e.object({id:ke,tenant_id:e.string().min(1),site_id:I,version:e.number().int().positive(),source_agent_run_id:V.nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}).strict();function tm(t,n){t.version!==t.sitemap.version&&n.addIssue({code:"custom",path:["sitemap","version"],message:`Sitemap JSON version ${t.sitemap.version} must equal record version ${t.version}.`})}var nm=em.extend({sitemap:Pt}).superRefine(tm),Xf=em.extend({sitemap:rn}).superRefine(tm),wv=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:Pt,source_agent_run_id:V.optional()}),Av=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:rn,expected_current_sitemap_id:ke,expected_current_sitemap_version:e.number().int().positive(),migration_content_requested:e.boolean().optional()}),vv=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:Pt,source_agent_run_id:V}),Cv=e.object({site:tt,sitemap:nm,next_step:e.literal("workspace")}).strict(),Dv=e.object({site:tt,sitemap:Xf,next_step:e.literal("workspace")}).strict(),jv=e.object({site:tt,sitemap:nm,next_step:e.literal("sitemap_review")}).strict(),Zf=e.object({id:$i,tenant_id:e.string().min(1),site_id:I,brief_id:ut,questions:ji,answers:e.array(qi),selected_archetype:kt.optional(),completed_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Ov=e.object({answers:e.array(qi).min(1),questions:ji,selected_archetype:kt.optional()}),Nv=e.object({clarify_session:Zf}),Lv=e.object({questions:ji,selected_archetype:kt}),Qf=e.object({id:is,tenant_id:e.string().min(1),site_id:I,version:e.number().int().positive(),design_plan:Bc,source_agent_run_id:V.nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Mv=e.object({design_plan_id:is.optional(),design_plan:Bc,source_agent_run_id:V.optional()}),Uv=e.object({design_plan:Qf}),ns=e.enum(["initial_generation","iteration"]),Jf=e.object({label:e.string().min(1).max(48),prompt:e.string().min(1).max(160)}).strict(),eb=e.enum(["model","derived","mixed","advisor"]),sm=e.object({suggestions:e.array(Jf).min(1).max(4),source:eb}).strict(),tb=e.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),nb=e.enum(["generation_succeeded","entry_slots_omitted","quality_gate_exhausted","schema_gate_exhausted","generation_timeout","stream_schema_mismatch","stream_generation_error","generation_error","fallback_compiler_error","legacy_result_missing_metadata"]),sb=e.enum(["progress","assistant_final"]),im=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"]),ib=e.object({id:e.string().min(1),title:e.string().min(1),status:e.enum(["pending","running","completed","failed"])}),dt=e.enum(["pending","running","completed","completed_with_skips","failed","skipped"]),Gi=e.enum(["style_media","chrome","sections","layout","pages","detect_typecheck","repair","finalize","sitemap_resync","preview"]),Ki=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()}),Se=e.string().min(1).refine(t=>hm(t),{message:"Snapshot file paths must be safe relative POSIX paths without traversal."}),zi=e.object({deduped_paths:e.array(Se),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(Se)}),Bi=e.object({group_id:e.string().min(1),phase:Gi,title:e.string().min(1),status:dt,task_ids:e.array(e.string().min(1)),depends_on_groups:e.array(e.string().min(1)),target_paths:e.array(Se)}),ab=e.enum(["style","media","chrome","section","layout","page"]),Wi=e.object({task_id:e.string().min(1),group_id:e.string().min(1),kind:ab,target_path:Se,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(Mi).optional(),status:dt,required_reads:e.array(Se).optional(),search_params_sections:e.array(Se).optional(),standard_form_view:Se.optional()}),Vi=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"])}),Fv=e.object({plan_id:e.string().min(1),run_kind:ns,model_route:e.object({planner:e.literal("workspace_planner"),worker:e.literal("workspace")}),groups:e.array(Bi),tasks:e.array(Wi),dependencies:e.array(Vi),expected_outputs:e.array(Se),diagnostics:zi}),qv=e.object({task_id:e.string().min(1),patch:e.unknown().optional(),snapshot_id:x.optional(),read_files:e.array(Se),diagnostics:e.array(Ki),status:dt}),am=e.object({worker_count:e.number().int().nonnegative(),task_count:e.number().int().nonnegative(),group_count:e.number().int().nonnegative()}),om=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()}),ob=e.object({type:e.literal("text"),text:e.string(),state:e.enum(["streaming","done"]).optional()}),rb=e.object({type:e.literal("reasoning"),text:e.string(),state:e.enum(["streaming","done"]).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),cb=e.object({type:e.literal("file"),mediaType:e.string().min(1),filename:e.string().min(1).optional(),url:e.string().min(1)}),mb=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()}),lb=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()}),pb=e.object({type:e.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:e.string().min(1).optional(),data:e.unknown()}),db=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()}),ub=e.object({type:e.literal("error"),errorText:e.string().min(1)}),gb=e.object({type:e.literal("step-start")}),es=e.union([ob,rb,cb,mb,lb,pb,db,ub,gb]),_b=e.string().min(1).max(512).refine(t=>hm(t)&&!/^[A-Za-z]:\//.test(t),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),hb=e.array(_b).min(1).max(64),Sb=e.array(e.string().min(1).max(120)).min(1).max(64),fb=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:V,at:e.string().min(1)}),e.object({type:e.literal("message.delta"),text:e.string().min(1),history_purpose:sb.optional(),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(es).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),interaction_response:vn.optional(),at:e.string().min(1)}),e.object({type:e.literal("plan.updated"),steps:e.array(ib),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(Cc).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:Zc,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:ke,sitemap:Pt,...Qc,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_block_count:e.number().int().nonnegative().optional(),final_block_count:e.number().int().nonnegative().optional(),at:e.string().min(1)}).strict(),e.object({type:e.literal("sitemap.updated"),sitemap_id:ke,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),interaction_request:Ks.optional(),at:e.string().min(1)}),e.object({type:e.literal("workspace.plan.created"),plan_id:e.string().min(1),run_kind:ns,groups:e.array(Bi),tasks:e.array(Wi),dependencies:e.array(Vi),expected_outputs:e.array(Se),diagnostics:zi,summary:am,at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.worker.updated"),group_id:e.string().min(1),phase:Gi,status:dt,task_counts:om,target_paths:e.array(Se),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:dt,target_path:Se,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(Ki).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","cms_page_directory_degraded","form_prebuild_skipped","form_section_fallback","first_settings_sync_failed"]),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:hb.optional(),degraded_page_ids:Sb.optional(),snapshot_id:x.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 a of["degraded_file_paths","degraded_page_ids"])t[a]!==void 0&&n.addIssue({code:"custom",path:[a],message:`${a} 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 a of["degraded_block_ids","dropped_files","snapshot_id","code","message","diagnostics","retryable"])t[a]!==void 0&&n.addIssue({code:"custom",path:[a],message:`${a} is not allowed for generated_code_rescue`})}),e.object({type:e.literal("workspace.design_plan.outcome"),design_plan_outcome:tb,reason:nb,gate_diagnostics:e.object({gate:e.enum(["quality","schema"]),issue_codes:e.array(e.string().min(1)).max(20),issue_paths:e.array(e.string()).max(20),finish_reason:e.string().min(1).optional()}).strict().optional(),at:e.string().min(1)}).strict(),sm.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:x,manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("snapshot.finalized"),snapshot_id:x,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:x,at:e.string().min(1)}),e.object({type:e.literal("preview.build.succeeded"),snapshot_id:x,at:e.string().min(1)}),e.object({type:e.literal("preview.build.failed"),snapshot_id:x,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:Dc.optional(),retryable:e.boolean().optional(),attempts:e.number().int().positive().optional(),outcome:e.literal("retained_previous").optional(),details:e.record(e.string(),e.unknown()).optional(),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),snapshot_id:x.optional(),degraded_reason:Dt.optional(),build_verified:e.boolean().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:qc,title:e.string().min(1).max(200),detail:e.string().max(360).optional(),title_code:Je.optional(),detail_code:Je.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:Je.optional(),detail_code:Je.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)})]),rm=fb.superRefine(Jc).superRefine((t,n)=>{if(t.type==="user.message"&&t.interaction_response&&!t.in_reply_to_tool_call_id&&n.addIssue({code:"custom",path:["in_reply_to_tool_call_id"],message:"in_reply_to_tool_call_id is required for an interaction response"}),t.type!=="tool.finished")return;let s=t.name==="prepare_product_search_entry";s!==!!t.interaction_request&&n.addIssue({code:"custom",path:["interaction_request"],message:s?"prepare_product_search_entry requires interaction_request":"interaction_request is only valid for prepare_product_search_entry"})}),vi=e.object({id:Yi,tenant_id:e.string().min(1),site_id:I,agent_run_id:V,sequence:e.number().int().positive(),event_type:im,payload:rm,created_at:e.string().min(1)}),Gv=e.object({event_type:im,payload:rm}).superRefine((t,n)=>{t.event_type!==t.payload.type&&n.addIssue({code:"custom",path:["payload","type"],message:"payload.type must match event_type"}),ln(t.payload)&&n.addIssue({code:"custom",path:["payload"],message:"AgentEvent payload must not contain secrets"})}),Kv=e.discriminatedUnion("status",[e.object({status:e.literal("appended"),agent_run:et,event:vi,next_cursor:e.number().int().nonnegative()}),e.object({status:e.literal("duplicate_ignored"),agent_run:et,event:vi,next_cursor:e.number().int().nonnegative()})]),zv=e.object({events:e.array(vi),next_cursor:e.number().int().nonnegative().optional()}),Bv=e.object({after_sequence:e.coerce.number().int().nonnegative().default(0)}),Wv=e.enum(["implemented","skeleton","planned"]),Vv=e.enum(["GET","POST","PUT","PATCH","DELETE"]),$v=[{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:"POST",path:"/sites/:site_id/workflow",tag:"site-workflows",summary:"Create one version-bound site workflow from a published flow definition.",status:"implemented",request_body_schema:"CreateSiteWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/workflow",tag:"site-workflows",summary:"Read the current site workflow snapshot and derived menu state.",status:"implemented",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"PUT",path:"/sites/:site_id/workflow/website",tag:"site-workflows",summary:"Update the source website while website_scan is current.",status:"implemented",request_body_schema:"UpdateSiteWorkflowWebsiteRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/advance",tag:"site-workflows",summary:"Advance one non-terminal workflow node with an expected-current-node guard.",status:"implemented",request_body_schema:"AdvanceSiteWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/complete",tag:"site-workflows",summary:"Complete the workflow from its final publishing node after server-side release checks pass.",status:"implemented",request_body_schema:"CompleteSiteWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema",notes:["The browser supplies only the expected current node; the server verifies persisted release facts before completing the workflow."]},{method:"POST",path:"/sites/:site_id/workflow/tasks/register",tag:"site-workflows",summary:"Register a business-owned external task id and its idempotency key.",status:"implemented",request_body_schema:"RegisterWorkflowTaskCommandRequestSchema",response_schema:"SiteWorkflowTaskRefResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/step2-site-initialization/tasks",tag:"site-workflows/step2-site-initialization",summary:"Create or reuse the current workflow's Step2 website crawl task.",status:"implemented",response_schema:"Step2SiteInitializationTaskResponseSchema",notes:["The server derives tenantId, sessionId, and siteUrl from trusted request/workflow state; the browser cannot submit upstream scope fields."]},{method:"GET",path:"/sites/:site_id/workflow/step2-site-initialization/tasks/:task_id",tag:"site-workflows/step2-site-initialization",summary:"Poll the workflow-owned Step2 website crawl task.",status:"implemented",response_schema:"Step2SiteInitializationTaskResponseSchema",notes:["The task id must match the current non-superseded website_crawl task reference for the workflow."]},{method:"POST",path:"/sites/:site_id/workflow/tasks/:task_type/replace",tag:"site-workflows",summary:"Replace one task reference while retaining its superseded history.",status:"implemented",request_body_schema:"ReplaceWorkflowTaskCommandRequestSchema",response_schema:"SiteWorkflowTaskRefResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/tasks/website_crawl/replace-and-invalidate-dependents",tag:"site-workflows",summary:"Replace website crawl and invalidate basic-info and metrics dependents atomically.",status:"implemented",request_body_schema:"ReplaceCrawlWorkflowTaskCommandRequestSchema",response_schema:"SiteWorkflowTaskRefResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/build",tag:"site-workflows",summary:"Start the server-owned site build and workspace snapshot lifecycle.",status:"implemented",request_body_schema:"StartSiteBuildRequestSchema",response_schema:"StartSiteBuildResponseSchema",notes:["The browser may start or query the build, but cannot write site build or deployment summary status directly."]},{method:"GET",path:"/sites/:site_id/workflow/customer-materials",tag:"site-workflows",summary:"Read the persisted no-website customer materials draft.",status:"implemented",response_schema:"CustomerMaterialsNullableResponseSchema"},{method:"PUT",path:"/sites/:site_id/workflow/customer-materials",tag:"site-workflows",summary:"Save the no-website customer materials before submission.",status:"implemented",request_body_schema:"CustomerMaterialsDraftSchema",response_schema:"CustomerMaterialsResponseSchema",notes:["A submitted record is immutable and rejects later writes."]},{method:"POST",path:"/sites/:site_id/workflow/customer-materials/submit",tag:"site-workflows",summary:"Submit and freeze customer materials before analysis.",status:"implemented",request_body_schema:"CustomerMaterialsDraftSchema",response_schema:"CustomerMaterialsResponseSchema",notes:["Repeated submissions return 409; clients may retry only the separate workflow advance."]},{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/compose",tag:"designer-page-library",summary:"Compose exact page and component resources into one strict page artifact.",status:"implemented",request_body_schema:"ComposeDesignerPageResourceBodySchema",response_schema:"InstallDesignerPageResponseSchema",notes:["The server installs every immutable source, validates ordered page blocks, scopes component materializations, and returns one artifact without exposing resource-platform credentials."]},{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/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:"GET",path:"/sites/:site_id/media-assets",tag:"media-assets",summary:"List or search enterprise image assets through the CMS adapter.",status:"implemented",query_schema:"ListMediaLibraryAssetsQuerySchema",response_schema:"ListMediaLibraryAssetsResponseSchema"},{method:"POST",path:"/sites/:site_id/media-assets",tag:"media-assets",summary:"Upload one validated image and create its enterprise asset.",status:"implemented",response_schema:"UploadMediaLibraryAssetResponseSchema",notes:["Accepts one multipart field named file; only the image MIME allowlist is accepted and the maximum size is 20 MiB."]},{method:"GET",path:"/sites/:site_id/media-assets/unsplash/search",tag:"media-assets",summary:"Search Unsplash through the VCP server-side client.",status:"implemented",query_schema:"SearchUnsplashMediaQuerySchema",response_schema:"SearchUnsplashMediaResponseSchema",notes:["The browser never receives the Unsplash access key; CMS is not involved in search."]},{method:"POST",path:"/sites/:site_id/media-assets/unsplash/:provider_id/use",tag:"media-assets",summary:"Best-effort report that an Unsplash image was selected.",status:"implemented",request_body_schema:"UseUnsplashMediaRequestSchema",response_schema:"UseUnsplashMediaResponseSchema",notes:["CMS report failure returns reported=false and does not roll back the image replacement."]},{method:"POST",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Confirm the currently reviewed Sitemap Draft and advance the site to structure_saved.",status:"implemented",request_body_schema:"ConfirmSiteStructureRequestSchema",response_schema:"PersistSiteSitemapDraftResponseSchema"},{method:"POST",path:"/internal/sites/:site_id/sitemap-draft",tag:"sitemaps",summary:"Persist an agent-generated sitemap draft without confirming the structure.",status:"implemented",request_body_schema:"PersistGeneratedSitemapDraftRequestSchema",response_schema:"PersistGeneratedSitemapDraftResponseSchema"},{method:"GET",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Read the current Sitemap Draft for a site.",status:"implemented",response_schema:"SitemapDraftRecordSchema"},{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 sites in the editable build phase are writable; the brief row is upserted idempotently while site status, 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 sites in the editable build phase are writable; missing brief rows are created on first save; identical retries 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:"/internal/sites/:site_id/page-templates",tag:"page-templates",summary:"Create a private page template through the authenticated VCP internal service surface.",status:"implemented",request_body_schema:"PageTemplateCreateRequestSchema",response_schema:"PageTemplateCreateResponseSchema",notes:["Internal service endpoint; callers use the API bearer token plus trusted tenant/user headers. API delegates to Agent with its own AGENT_INTERNAL_TOKEN and never forwards caller Authorization."]},{method:"POST",path:"/internal/sites/:site_id/page-templates/promote",tag:"page-templates",summary:"Promote a private page template through the authenticated VCP internal service surface.",status:"implemented",request_body_schema:"PageTemplatePromoteRequestSchema",response_schema:"PageTemplatePromoteResponseSchema",notes:["Internal service endpoint; uses the same bearer + tenant/user context as create and delegates to Agent with API-owned credentials."]},{method:"POST",path:"/internal/sites/:site_id/page-templates/cleanup",tag:"page-templates",summary:"Clean up private page templates through the authenticated VCP internal service surface.",status:"implemented",request_body_schema:"PageTemplateCleanupRequestSchema",response_schema:"PageTemplateCleanupResponseSchema",notes:["Internal service endpoint; cleanup remains explicit and default-template protection is enforced by the Agent lifecycle service."]},{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:"/deployments",tag:"deployments",summary:"Deployment resource summary endpoint until publish APIs 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:"/internal/sites/:site_id/preview-sessions",tag:"sandbox-sessions",summary:"Persist or update an Agent-owned on-demand preview session; optional current/ready-session guards support current-snapshot CAS and guarded in-place snapshot advance.",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/preview/activate",tag:"site-preview",summary:"Activate the existing preview sandbox for a site.",status:"implemented",response_schema:"SitePreviewActivateResponseSchema"},{method:"POST",path:"/v1/agent/site-preview/:site_id/activate",tag:"agent/site-preview",summary:"Activate the existing preview sandbox for a site through Agent.",status:"implemented",response_schema:"SitePreviewActivateResponseSchema"},{method:"POST",path:"/sites/:site_id/deployments",tag:"deployments",summary:"Queue an explicit user-confirmed publish from the latest current snapshot.",status:"implemented",request_body_schema:"CreateDeploymentRequestSchema",response_schema:"CreateDeploymentResponseSchema",notes:["The server resolves the latest current snapshot and validates site and snapshot existence, in-flight deployment state, and site operation lock before creating the deployment record and queue job.","The API returns after creating the deployment record and queue job; worker-service claims deployment_jobs for build and Cloudflare publish."]},{method:"POST",path:"/sites/:site_id/deployments/quality-check",tag:"deployments",summary:"Queue a quality-check deployment from a snapshot.",status:"implemented",request_body_schema:"CreateQualityCheckDeploymentRequestSchema",response_schema:"CreateDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/quality-check/status",tag:"deployments",summary:"Read the latest quality-check deployment status.",status:"implemented",response_schema:"GetDeploymentsStatusResponseSchema"},{method:"POST",path:"/internal/site-deployments/quality-check",tag:"deployments",summary:"Queue a quality-check deployment for the current site through the internal Agent API.",status:"implemented",response_schema:"InternalCreateDeploymentResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id.","POST accepts no request body; VCP resolves the current snapshot. Quality-check and publish deployments are independent."]},{method:"GET",path:"/internal/site-deployments/quality-check/status",tag:"deployments",summary:"Read the latest internal quality-check deployment status for the current site.",status:"implemented",response_schema:"InternalGetDeploymentsStatusResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id."]},{method:"POST",path:"/internal/site-deployments/publish",tag:"deployments",summary:"Queue a publish deployment for the current site through the internal Agent API.",status:"implemented",response_schema:"InternalCreateDeploymentResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id.","POST accepts no request body; VCP resolves the latest current snapshot. Quality-check and publish deployments are independent."]},{method:"GET",path:"/internal/site-deployments/publish/status",tag:"deployments",summary:"Read the latest internal publish deployment status for the current site.",status:"implemented",response_schema:"InternalGetDeploymentsStatusResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id."]},{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/configuration",tag:"custom-domains",summary:"Read the authoritative site domain configuration.",status:"implemented",response_schema:"GetSiteDomainConfigurationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflows/:workflow_id/domain/check",tag:"publish-workflow",summary:"Check a publish workflow domain and start its operation.",status:"implemented",request_body_schema:"CheckSitePublishDomainRequestSchema",response_schema:"CheckSitePublishDomainResponseSchema"},{method:"GET",path:"/sites/:site_id/publish-workflows/:workflow_id/domain/operation",tag:"publish-workflow",summary:"Poll the current publish workflow domain operation.",status:"implemented",response_schema:"GetSitePublishDomainOperationResponseSchema"},{method:"POST",path:"/sites/:site_id/integrations/gsc/auth/start",tag:"gsc",summary:"Start Google Search Console authorization for a site.",status:"implemented",request_body_schema:"StartGscAuthRequestSchema",response_schema:"StartGscAuthResponseSchema"},{method:"GET",path:"/sites/:site_id/integrations/gsc/status",tag:"gsc",summary:"Read Google Search Console authorization and property status.",status:"implemented",response_schema:"GscStatusResponseSchema"},{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"},{method:"GET",path:"/sites/:site_id/publish-workflow/active",tag:"publish-workflow",summary:"Read the active site publish workflow.",status:"implemented",response_schema:"SitePublishWorkflowActiveResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/start",tag:"publish-workflow",summary:"Start or recover the site publish workflow.",status:"implemented",request_body_schema:"StartSitePublishWorkflowRequestSchema",response_schema:"SitePublishWorkflowMutationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/:workflow_id/retry",tag:"publish-workflow",summary:"Retry failed external publish quality tasks.",status:"implemented",request_body_schema:"SitePublishWorkflowRevisionRequestSchema",response_schema:"SitePublishWorkflowMutationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/:workflow_id/stream",tag:"publish-workflow",summary:"Stream updates for an existing site publish workflow.",status:"implemented",request_body_schema:"StreamSitePublishWorkflowRequestSchema",response_schema:"SitePublishWorkflowSseDataSchema"},{method:"PATCH",path:"/sites/:site_id/publish-workflow/:workflow_id/step",tag:"publish-workflow",summary:"Move the site publish workflow to an allowed step.",status:"implemented",request_body_schema:"UpdateSitePublishWorkflowStepRequestSchema",response_schema:"SitePublishWorkflowMutationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/:workflow_id/cancel",tag:"publish-workflow",summary:"Cancel a stable site publish workflow.",status:"implemented",request_body_schema:"SitePublishWorkflowRevisionRequestSchema",response_schema:"SitePublishWorkflowMutationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/:workflow_id/publish",tag:"publish-workflow",summary:"Start formal publishing for a site publish workflow.",status:"implemented",request_body_schema:"SitePublishWorkflowRevisionRequestSchema",response_schema:"SitePublishWorkflowPublishResponseSchema"}],Hv=[{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:"Step5SitemapStartRequestSchema (browser marker only; API injects committed Step5 strategy)",event_schema:"SitemapStreamEventSchema",event_order:["run.started","sitemap.generating","sitemap.partial","sitemap.generated","sitemap.clamped","run.failed"]}],bb=e.object({id:e.string().min(1),role:e.enum(["system","user","assistant"]),metadata:e.unknown().optional(),parts:e.array(es).min(1)}),cm=bb.extend({role:e.literal("user")}),Yv=e.object({base_snapshot_id:x.optional(),message:cm.optional(),client_run_key:e.string().min(1).max(200).optional()}).superRefine((t,n)=>{ln(t.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),yb=e.object({path:e.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:V,base_snapshot_id:x,run_kind:ns}),Xv=e.object({agent_run:et,websocket:yb,next_step:e.literal("workspace_socket")}),Zv=e.object({agent_run:et}),Qv=e.object({agent_type:e.enum(["clarify","sitemap","workspace"])}),Jv=e.object({agent_run:et}),eC=e.enum(["client.message.create","client.resource.operation.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"]),Q=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:I,run_id:V.optional(),correlation_id:e.string().min(1).optional(),seq:e.number().int().positive().optional(),sent_at:e.string().min(1)}),xb=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()}),Eb=e.discriminatedUnion("type",[Q.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(),current_route_id:Bt.optional(),interaction_response:vn.optional(),selected_component:xb.optional(),message:cm,base_snapshot_id:x.optional()}).superRefine((t,n)=>{t.interaction_response&&!t.in_reply_to_tool_call_id&&n.addIssue({code:"custom",path:["in_reply_to_tool_call_id"],message:"in_reply_to_tool_call_id is required for an interaction response"})})}),Q.extend({type:e.literal("client.run.cancel"),payload:e.object({run_id:V,reason:e.string().min(1).optional()})}),Q.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()})}),Eo]),Ib=e.discriminatedUnion("type",[Q.extend({type:e.literal("server.run.started"),payload:e.object({run_id:V,agent_type:e.literal("workspace")})}),Q.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(es).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),interaction_response:vn.optional()})}),Q.extend({type:e.literal("server.assistant.delta"),payload:e.object({message_id:e.string().min(1),parts:e.array(es).min(1),status:e.enum(["streaming","ready"])})}),Q.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)})}),Q.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),interaction_request:Ks.optional()})}),Q.extend({type:e.literal("server.workspace.suggestions"),payload:sm.extend({run_id:V}).strict()}),Q.extend({type:e.literal("workspace.plan.created"),payload:e.object({plan_id:e.string().min(1),run_kind:ns,groups:e.array(Bi),tasks:e.array(Wi),dependencies:e.array(Vi),expected_outputs:e.array(Se),diagnostics:zi,summary:am})}),Q.extend({type:e.literal("workspace.worker.updated"),payload:e.object({group_id:e.string().min(1),phase:Gi,status:dt,task_counts:om,target_paths:e.array(Se),diagnostics:e.array(e.string().min(1))})}),Q.extend({type:e.literal("workspace.task.updated"),payload:e.object({task_id:e.string().min(1),group_id:e.string().min(1),status:dt,target_path:Se,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(Ki).optional()})}),Q.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()})}),Q.extend({type:e.literal("server.sitemap.updated"),payload:e.object({sitemap_id:ke,version:e.number().int().positive(),reason:e.string().min(1)})}),Q.extend({type:e.literal("server.snapshot.created"),payload:e.object({snapshot_id:x,manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/)})}),Q.extend({type:e.literal("server.snapshot.finalized"),payload:e.object({snapshot_id:x})}),Q.extend({type:e.literal("server.preview.invalidated"),payload:e.object({reason:e.string().min(1),next_preview_url:e.string().url().optional()})}),Q.extend({type:e.literal("preview.build.started"),payload:e.object({snapshot_id:x})}),Q.extend({type:e.literal("preview.build.succeeded"),payload:e.object({snapshot_id:x})}),Q.extend({type:e.literal("preview.build.failed"),payload:e.object({snapshot_id:x,message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean()})}),Q.extend({type:e.literal("server.run.finished"),payload:e.object({run_id:V,snapshot_id:x,degraded_reason:Dt.optional(),build_verified:e.boolean().optional()})}),Q.extend({type:e.literal("server.run.failed"),payload:e.object({run_id:V,error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),outcome:e.literal("retained_previous").optional(),details:e.record(e.string(),e.unknown()).optional()})}),Q.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})}),Q.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:qc,title:e.string().min(1).max(200),title_code:Je.optional(),detail:e.string().max(360).optional(),detail_code:Je.optional(),locks_input:e.boolean()})}),Q.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:Je.optional(),detail:e.string().max(360).optional(),detail_code:Je.optional()})}),Q.extend({type:e.literal("server.activity.finished"),payload:e.object({activity_id:e.string().min(1)})}),Q.extend({type:e.literal("server.activity.failed"),payload:e.object({activity_id:e.string().min(1),detail:e.string().max(360).optional()})})]),Rb=Ib.superRefine((t,n)=>{if(t.type==="server.user.message"&&t.payload.interaction_response&&!t.payload.in_reply_to_tool_call_id&&n.addIssue({code:"custom",path:["payload","in_reply_to_tool_call_id"],message:"in_reply_to_tool_call_id is required for an interaction response"}),t.type!=="server.tool.completed")return;let s=t.payload.name==="prepare_product_search_entry";s!==!!t.payload.interaction_request&&n.addIssue({code:"custom",path:["payload","interaction_request"],message:s?"prepare_product_search_entry requires interaction_request":"interaction_request is only valid for prepare_product_search_entry"})}),tC=e.union([Eb,Rb]),nC={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."},{name:"unattended",required:!1,schema:'"1"',summary:"Unattended mode for machine-driven runs: interactive tools are withheld so the run cannot stall waiting for a human answer. Server-to-server only; the browser proxy strips it."}],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."]},mm=e.string().regex(/^sha256:[a-f0-9]{64}$/),Tb=e.enum(["create","update","delete","str_replace"]),lm=e.enum(["sitemap_resync","smoke_test","prepare_preview"]),kb=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(),Pb=e.object({path:Se,operation:Tb,expected_hash:mm.optional(),full_content:e.string().describe("Complete file content for create/update patches. Only this single field is a string value: every double quote inside the source code must be escaped so the field stays 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. The surrounding patch object and the patches array are ordinary JSON structures, not strings.").optional(),edits:e.array(kb).min(1).max(20).optional()}).strict().superRefine((t,n)=>{let s=t.full_content!==void 0;if(t.operation==="delete"){s&&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(Fb(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}s||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"})}),wb=e.object({kind:e.enum(["block","page","site","chrome"]),id:e.string().min(1).max(120)}),Ab=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:wb,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)}),pm=e.object({site_id:I,base_snapshot_id:x,reason:e.string().min(1),patches:e.array(Pb).min(1).describe("A real JSON array of patch objects. Never JSON.stringify this array, and never put an encoded JSON array inside a string \u2014 emit the array itself. Only full_content within a patch object is a string field."),media_requests:e.array(Ab).max(24).optional(),post_actions:e.array(lm).optional()});function dm(t,n){let s=new Set;for(let[a,i]of t.patches.entries())s.has(i.path)&&n.addIssue({code:"custom",path:["patches",a,"path"],message:`Duplicate patch path: ${i.path}`}),s.add(i.path)}var sC=pm.superRefine(dm),iC=pm.omit({base_snapshot_id:!0}).extend({site_id:I.optional()}).superRefine(dm),vb=le,Cb=e.object({path:vb,operation:e.enum(["upsert","delete"]).optional()}),um=e.enum(["sync_cms_pages","sync_cms_navigation"]),aC=e.object({files:e.array(Cb).min(1),post_actions:e.array(um).optional()}).strict().overwrite(t=>t.post_actions?{...t,post_actions:[...new Set(t.post_actions)]}:t),Db=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"]),jb=e.object({status:e.literal("applied"),patch_batch_id:e.string().min(1),site_id:I,base_snapshot_id:x,snapshot_id:x,manifest_hash:mm,object_key:e.string().min(1),changed_files:e.array(Se).min(1),post_actions_queued:e.array(lm),dropped_protected_files:e.array(e.string().min(1)).min(1).optional()}),Ob=e.object({status:e.literal("failed"),code:Db,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),oC=e.discriminatedUnion("status",[jb,Ob]),rC=e.object({ok:e.literal(!0),post_actions:e.array(e.object({action:um,status:e.enum(["succeeded","failed"])}).strict()).default([])}),gm=le,Nb=e.enum(["text","binary"]),_m=e.object({path:gm,kind:Nb,language:e.string().min(1).nullable(),size_bytes:e.number().int().nonnegative()}),cC=e.object({path:gm}),Lb=_m.extend({kind:e.literal("text"),language:e.string().min(1),content:e.string()}),Mb=_m.extend({kind:e.literal("binary"),language:e.null(),mime_type:e.string().min(1),content_base64:e.string().min(1)}),mC=e.union([Lb,Mb]);function ln(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=>ln(n)):Object.entries(t).some(([n,s])=>Ub(n)||ln(s))}function Ub(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 hm(t){let n=t.split("/");return t.length>0&&!t.startsWith("/")&&!t.includes("\\")&&n.every(s=>s!==""&&s!=="."&&s!=="..")}function Fb(t){let n=/^app\/(?:(.*)\/)?page\.(?:tsx|jsx)$/.exec(t);if(!n)return!0;let a=(n[1]??"").split("/").filter(r=>r.length>0);return a.some(r=>r.startsWith("_"))?!0:a.filter(r=>!r.startsWith("@")&&!/^\(.+\)$/.test(r)).map(r=>r.replace(/^\((?:\.|\.\.|\.\.\.)\)/,"")).filter(r=>r.length>0).every(r=>/^\[.*\]$/.test(r)||Ut.test(`/${r}`))}var Sm=e.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),qb=e.object({id:pn,tenant_id:e.string().min(1),site_id:I,sandbox_id:e.string().min(1).nullable(),status:Sm,source_snapshot_id:x.nullable(),last_snapshot_id:x.nullable(),preview_url:e.string().url().nullable(),browser_preview_url:e.string().url().nullable().optional(),last_activity_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),lC=e.object({session_id:pn.optional(),sandbox_id:e.string().min(1).optional(),source_snapshot_id:x.optional(),last_snapshot_id:x,expected_current_snapshot_id:x.optional(),expected_ready_session_id:pn.optional(),expected_ready_session_last_snapshot_id:x.optional(),status:Sm,preview_url:e.string().url().optional()}),pC=e.object({preview_session:qb,next_step:e.literal("preview")}),dC=e.object({failed_count:e.number().int().nonnegative()}),uC=e.object({site_id:I}),gC=e.object({status:e.enum(["cancelled","no_active_run"]),agent_run:et.nullable()});export{Er as AESTHETIC_NOTE_MAX_LENGTH,jA as AbandonSiteSnapshotResponseSchema,qc as ActivityKindSchema,Je as ActivityTitleCodeSchema,vI as AdvanceSiteWorkflowRequestSchema,Dc as AgentErrorCategorySchema,Yi as AgentEventIdSchema,vi as AgentEventRecordSchema,rm as AgentEventSchema,im as AgentEventTypeSchema,sb as AgentMessageHistoryPurposeSchema,Nc as AgentModelRouteSchema,ib as AgentPlanStepSchema,V as AgentRunIdSchema,Oc as AgentRunKindSchema,et as AgentRunRecordSchema,QS as AgentRunStatusSchema,jc as AgentRunTypeSchema,pb as AiSdkUiDataPartSchema,ub as AiSdkUiErrorPartSchema,cb as AiSdkUiFilePartSchema,es as AiSdkUiMessagePartSchema,bb as AiSdkUiMessageSchema,rb as AiSdkUiReasoningPartSchema,lb as AiSdkUiSourceDocumentPartSchema,mb as AiSdkUiSourceUrlPartSchema,gb as AiSdkUiStepStartPartSchema,ob as AiSdkUiTextPartSchema,db as AiSdkUiToolPartSchema,Wv as ApiContractStatusSchema,rf as ApiErrorEnvelopeSchema,M as ApiResponseSchema,Gv as AppendAgentEventRequestSchema,Kv as AppendAgentEventResponseSchema,Db as ApplyPatchBatchErrorCodeSchema,Ob as ApplyPatchBatchFailureSchema,sC as ApplyPatchBatchInputSchema,Pb as ApplyPatchBatchPatchSchema,lm as ApplyPatchBatchPostActionSchema,oC as ApplyPatchBatchResultSchema,jb as ApplyPatchBatchSuccessSchema,iC as ApplyPatchBatchToolInputSchema,kb as ApplyPatchEditSchema,Tb as ApplyPatchOperationSchema,Cc as ArchetypeProposalSchema,ey as AuditLogIdSchema,Kb as AuthIdentityIdSchema,Vb as AuthLoginCodeIdSchema,Wb as AuthOidcStateIdSchema,zb as AuthSessionIdSchema,Bb as AuthTokenIdSchema,$b as AuthWsTicketIdSchema,yh as BINDING_STATUSES,Gc as BlockGenerationContextSchema,pv as BlockMediaIntentSchema,Ui as BlockSchema,Kc as BrandingSchema,ut as BriefIdSchema,Ni as BriefRecordSchema,Qi as BusinessFactsSchema,$T as CHAT_COPY,VT as CLARIFICATION_COPY,V_ as CMS_FORM_FIELD_TYPES,sr as CMS_MAIN_PRODUCTS_MAX_LENGTH,Yl as CMS_PAGE_DIRECTORY_MAX_DEPTH,Hl as CMS_PAGE_DIRECTORY_MAX_NODES,ja as CMS_PAGE_URL_PATH_MAX_LENGTH,AR as COMPONENT_I18N_FILE_SUFFIX,jn as COMPONENT_I18N_NAMESPACE,Em as CONVERSION_CTA_LABEL_MAX_LENGTH,Uh as CRAWLER_INTERNAL_ERROR_CODES,Qo as CURRENT_EDIT_ENGINE_VERSION,uC as CancelActiveWorkspaceRunRequestSchema,gC as CancelActiveWorkspaceRunResponseSchema,oc as CheckSitePublishDomainDataSchema,fS as CheckSitePublishDomainRequestSchema,bS as CheckSitePublishDomainResponseSchema,zc as ChromeDesignSchema,yf as ChromeFooterDesignSchema,bf as ChromeFooterShellSchema,Sf as ChromeHeaderDesignSchema,hf as ChromeHeaderShellSchema,xf as ChromeMobileNavDesignSchema,XS as ClarifyQuestionOptionSchema,ZS as ClarifyQuestionSchema,$S as ClarifyQuestionTypeSchema,ji as ClarifyQuestionsSchema,tA as ClarifyRunInputSchema,$i as ClarifySessionIdSchema,Zf as ClarifySessionRecordSchema,nA as ClarifyStreamEventSchema,ty as CmsCollectionBindingIdSchema,W0 as CmsCollectionBindingSchema,jr as CmsFormSchemaProjectionSchema,Oa as CmsManagedPageTypeSchema,Zl as CmsPageDirectoryGroupSchema,Na as CmsPageDirectoryNodeSchema,Ca as CmsPageDirectorySchema,Ps as CmsPageTypeSchema,Rn as CmsPageUrlPathSchema,ua as CmsSiteIdSchema,Nh as CompanyInfoSchema,oP as CompanyInfoTaskCreateRequestSchema,rP as CompanyInfoTaskCreateResponseSchema,cP as CompanyInfoTaskResponseSchema,b1 as CompleteCustomerMaterialsRequestSchema,y1 as CompleteDiagnosisRequestSchema,NA as CompleteSiteSnapshotDeletionResponseSchema,CI as CompleteSiteWorkflowRequestSchema,x1 as CompleteStrategyRequestSchema,f1 as CompleteWebsiteScanRequestSchema,CR as ComponentI18nResourcesSchema,fE as ComposeDesignerPageResourceBodySchema,Av as ConfirmSiteStructureRequestSchema,J1 as ConnectDynamicCollectionInputSchema,n0 as ConnectFormInputSchema,st as ConversionHintsSchema,Fh as CrawlerInternalErrorCodeSchema,mP as CrawlerInternalErrorSchema,It as CrawlerTaskCodeSchema,Z0 as CrawlerTaskCreateRequestSchema,eP as CrawlerTaskCreateResponseSchema,Ph as CrawlerTaskFailureErrorCodeSchema,Hr as CrawlerTaskFailureStageSchema,Ah as CrawlerTaskPageSchema,Q0 as CrawlerTaskPagesQuerySchema,sP as CrawlerTaskPagesResponseSchema,nP as CrawlerTaskStatusResponseSchema,mt as CrawlerTaskUuidSchema,mv as CreateAgentRunConflictResponseSchema,PA as CreateAgentRunRequestSchema,wA as CreateAgentRunResponseSchema,ev as CreateDeploymentRequestSchema,nf as CreateDeploymentResponseSchema,jy as CreateDocumentUploadRequestSchema,yy as CreateExternalSiteEditRequestSchema,xy as CreateExternalSiteEditResponseSchema,Fy as CreateImageUploadRequestSchema,wy as CreateInputSourceRequestSchema,tv as CreateQualityCheckDeploymentRequestSchema,cA as CreateSiteBriefRequestSchema,RA as CreateSiteBriefResponseSchema,mA as CreateSiteDraftRequestSchema,rA as CreateSiteInputSchema,wI as CreateSiteWorkflowRequestSchema,Dm as CreateTextInputSourceRequestSchema,jm as CreateUrlInputSourceRequestSchema,sv as CurrentDeploymentResponseSchema,d1 as CustomerMaterialsDraftResponseSchema,ti as CustomerMaterialsDraftSchema,u1 as CustomerMaterialsNullableResponseSchema,ni as CustomerMaterialsRecordSchema,p1 as CustomerMaterialsResponseSchema,a_ as CustomerMaterialsStatusSchema,o_ as DEFAULT_FONTS,_r as DEFAULT_SITE_DESIGN_RADIUS_ID,nl as DEFAULT_SITE_LOCALE,ik as DEFAULT_SUBSITE_PALETTE,yR as DEPLOYMENT_ACTIVE_STATUSES,He as DEPLOYMENT_LIFECYCLE_TRANSITIONS,zd as DEPLOYMENT_PROGRESS_STEP_CODES,of as DEPLOYMENT_REALTIME_CHANNEL,_t as DEPLOYMENT_STATUSES,xR as DEPLOYMENT_TERMINAL_STATUSES,Tu as DEPLOYMENT_TRANSITION_ERROR_CODE,cv as DEPLOYMENT_WEBSOCKET_CONTRACT,$x as DESIGNER_COMPONENT_LIBRARY_ERROR_CODES,uE as DESIGNER_PAGE_LIBRARY_ERROR_CODES,Ay as DOCUMENT_EXTENSION_WHITELIST,vy as DOCUMENT_MIME_WHITELIST,tS as DOMAIN_DNS_PURPOSES,sS as DOMAIN_DNS_VERIFICATION_STATUSES,Zh as DOMAIN_OBSERVED_STATUSES,Jh as DOMAIN_ROUTING_MODES,iE as DeleteDesignerPageErrorDetailsSchema,nE as DeleteDesignerPageRequestSchema,sE as DeleteDesignerPageResponseSchema,ap as DeleteDesignerPageResultSchema,OA as DeleteSiteSnapshotResponseSchema,Fe as DeploymentIdSchema,Hb as DeploymentJobIdSchema,Bd as DeploymentProgressStepCodeSchema,Vd as DeploymentProgressStepSchema,Wd as DeploymentProgressStepStatusSchema,No as DeploymentProgressStepsSchema,Qe as DeploymentRecordSchema,rv as DeploymentRedisPubSubEventSchema,Li as DeploymentStatusSchema,Pc as DeploymentStatusSummarySchema,Hs as DeploymentTransitionError,Mc as DeploymentTypeSchema,Qn as DeploymentWsDeploymentPayloadSchema,ov as DeploymentWsServerMessageSchema,af as DeploymentWsServerMessageTypeSchema,tb as DesignPlanGenerationOutcomeSchema,nb as DesignPlanGenerationReasonSchema,is as DesignPlanIdSchema,gv as DesignPlanPatchSchema,Qf as DesignPlanRecordSchema,Bc as DesignPlanSchema,lv as DesignTokensSchema,$l as DesignerComponentCatalogItemSchema,wa as DesignerComponentCategoriesDataSchema,Pa as DesignerComponentCategoryNodeSchema,ot as DesignerComponentExactVersionSchema,va as DesignerComponentInstallDataSchema,Aa as DesignerComponentsDataSchema,mp as DesignerPageCatalogItemSchema,Ba as DesignerPageCategoriesDataSchema,za as DesignerPageCategoryNodeSchema,np as DesignerPageDeleteBlockReasonSchema,tp as DesignerPageDisabledReasonSchema,Mt as DesignerPageExactVersionSchema,Fa as DesignerPageGroupSchema,Va as DesignerPageInstallDataSchema,Ua as DesignerPageNodeSchema,Ha as DesignerPageResourcePreparationDataSchema,cp as DesignerPageResourceSourceSchema,hp as DesignerPageResourceTemplateSchema,rt as DesignerPageResourceTypeSchema,Wa as DesignerPagesDataSchema,Is as DesignerResourceVersionSchema,Ya as DesignerSitePagesDataSchema,_E as DesignerSiteRouteIdSchema,ac as DomainConfigurationSchema,nS as DomainDnsPurposeSchema,rS as DomainDnsRecordSchema,iS as DomainDnsVerificationStatusSchema,Qh as DomainObservedStatusSchema,oS as DomainOperationErrorSchema,Ei as DomainOperationSchema,aS as DomainOperationStatusSchema,xi as DomainOperationTypeSchema,ic as DomainRecordSchema,eS as DomainRoutingModeSchema,YT as EDIT_ENGINE_VERSION_HEADER,XT as EDIT_ENGINE_VERSION_SOURCE_HEADER,BT as ERROR_COPY,Tm as EXTERNAL_SITE_EDIT_INFRASTRUCTURE_REASONS,Rm as EXTERNAL_SITE_EDIT_PROMPT_MAX_LENGTH,ei as EditEngineVersionParseError,Xa as EnhanceDesignerPageResourceBodySchema,EA as EnhanceDesignerPageResourceResponseSchema,Ry as ExternalSiteEditCallbackAckSchema,Iy as ExternalSiteEditCallbackPayloadSchema,km as ExternalSiteEditCallbackStatusSchema,Dt as ExternalSiteEditDegradedReasonSchema,ta as ExternalSiteEditOutcomeSchema,ea as ExternalSiteEditTaskIdSchema,na as ExternalSiteEditTaskSchema,Pm as ExternalSiteEditTaskStatusSchema,uA as ExternalSyncSiteRequestSchema,IA as ExternalSyncSiteResponseSchema,Am as ExtractedFactKindSchema,un as ExtractedFactSchema,T_ as FIELD_TYPES,dr as FONT_PAIRINGS,ii as FONT_PAIRING_IDS,ih as FORM_DESIGN_ERROR_CODES,sh as FORM_DESIGN_FAILURE_STAGES,th as FORM_DESIGN_OPERATION_STAGES,nh as FORM_DESIGN_OPERATION_STATUSES,nn as FORM_FIELD_TYPES,$_ as FORM_SPEC_FIELD_TYPE_TO_CMS,Pr as FORM_SPEC_FILE_MIN_RUNTIME_VERSION,U_ as FORM_SPEC_LOCALIZABLE_FIELD_PATHS,kr as FORM_SPEC_MULTISTEP_MIN_RUNTIME_VERSION,u0 as FORM_TEMPLATE_CATEGORY_COUNTS,d0 as FORM_TEMPLATE_CATEGORY_SLUGS,dC as FailStaleInFlightWorkspaceRunsResponseSchema,Tr as FieldDeclSchema,bP as FirecrawlBatchCreateRequestSchema,yP as FirecrawlBatchCreatedResponseSchema,Kh as FirecrawlBatchErrorSchema,EP as FirecrawlBatchErrorsResponseSchema,Gh as FirecrawlBatchPageSchema,xP as FirecrawlBatchStatusResponseSchema,gP as FirecrawlCrawlCreateRequestSchema,_P as FirecrawlCrawlCreatedResponseSchema,hP as FirecrawlCrawlStatusResponseSchema,Jr as FirecrawlJobStatusSchema,dP as FirecrawlMapRequestSchema,uP as FirecrawlMapResponseSchema,IP as FirecrawlQueueStatusResponseSchema,SP as FirecrawlScrapeRequestSchema,fP as FirecrawlScrapeResponseSchema,ff as FooterShellSurfaceSchema,w_ as FormBlockIdSchema,Wn as FormDefinitionIdSchema,Q_ as FormDesignAffectedFilesSchema,fi as FormDesignErrorCodeSchema,R0 as FormDesignErrorSchema,Lr as FormDesignFailureStageSchema,ee as FormDesignHashSchema,S0 as FormDesignOpenResponseSchema,J_ as FormDesignOperationFingerprintInputSchema,di as FormDesignOperationIdSchema,Mr as FormDesignOperationNextActionSchema,Xb as FormDesignOperationRecordIdSchema,E0 as FormDesignOperationRecordSchema,bi as FormDesignOperationResponseSchema,Fr as FormDesignOperationSchema,Si as FormDesignOperationStageSchema,Nr as FormDesignOperationStatusSchema,I0 as FormDesignOperationTransitionRequestSchema,Ur as FormDesignPreviewRefreshStatusSchema,b0 as FormDesignQueryResponseSchema,y0 as FormDesignResumeRequestSchema,x0 as FormDesignResumeResponseSchema,eh as FormDesignSaveRequestSchema,f0 as FormDesignSaveResponseSchema,Or as FormDesignSharedImpactSchema,hi as FormDesignStandardizationSchema,k_ as FormFieldDeclSchema,an as FormFieldNameSchema,ui as FormOptionValueSchema,A_ as FormSpecBindingSchema,C_ as FormSpecFieldNodeSchema,j_ as FormSpecNodeSchema,v_ as FormSpecOptionSchema,D_ as FormSpecStepBreakNodeSchema,_i as FormSpecV1Schema,g0 as FormTemplateCatalogResponseSchema,Dr as FormTemplateCategorySlugSchema,B_ as FormTemplateCategoryV1Schema,Ze as FormTemplateTextSchema,W_ as FormTemplateV1Schema,xS as GSC_AUTH_STATUSES,ES as GSC_BINDING_STATUSES,IS as GSC_PROPERTY_TYPES,iv as GetDeploymentResponseSchema,sf as GetDeploymentsStatusResponseSchema,Ey as GetExternalSiteEditResponseSchema,nw as GetSiteDomainConfigurationResponseSchema,rc as GetSitePublishDomainOperationDataSchema,yS as GetSitePublishDomainOperationResponseSchema,Nk as GetTemplateUpgradeReportQuerySchema,Lk as GetTemplateUpgradeReportResponseSchema,yw as GoogleSearchConsoleAuthStartDataSchema,bw as GoogleSearchConsoleAuthStartRequestSchema,xw as GoogleSearchConsoleAuthStartResponseSchema,_w as GoogleSearchConsoleAuthStatusSchema,hw as GoogleSearchConsoleBindingStatusSchema,Sw as GoogleSearchConsolePropertyTypeSchema,fw as GoogleSearchConsoleStateSchema,Iw as GoogleSearchConsoleStatusDataSchema,Ew as GoogleSearchConsoleStatusInputSchema,Rw as GoogleSearchConsoleStatusResponseSchema,dw as GscAuthStartDataSchema,pw as GscAuthStartRequestSchema,uw as GscAuthStartResponseSchema,Ii as GscAuthStatusSchema,Ri as GscBindingStatusSchema,Ti as GscPropertyTypeSchema,TS as GscStateInputSchema,gw as GscStateSchema,lc as GscStatusDataSchema,kS as GscStatusResponseSchema,Da as HOME_PAGE_URL_PATH,gf as HeaderShellBehaviorSchema,_f as HeaderShellShapeSchema,uf as HeaderShellSurfaceSchema,df as HeaderShellVariantSchema,xh as HomeUrlCrawlerTaskCreateRequestSchema,Ls as HttpUrlSchema,Ny as IMAGE_EXTENSION_WHITELIST,Ly as IMAGE_MIME_WHITELIST,ka as INSERT_NEW_COMPONENT_CATEGORY_GROUP_KEY,Ka as INSERT_NEW_PAGE_CATEGORY_GROUP_KEY,sl as ISO_639_3_TO_SITE_LOCALE,Om as ImageRoleSchema,cm as InboundUserMessageSchema,H1 as IndustryClassificationRequestSchema,Y1 as IndustryClassificationResultSchema,R_ as IndustryConfidenceSchema,wm as InputBundleStatusSchema,_n as InputConflictSchema,qy as InputContextBundleSchema,nt as InputContextSourceIdSchema,Cm as InputSourceSchema,rs as InputSourceStatusSchema,os as InputSourceTypeSchema,Ik as InspectTemplateUpgradeStateRequestSchema,Rk as InspectTemplateUpgradeStateResponseSchema,Zx as InstallDesignerComponentBodySchema,hA as InstallDesignerComponentResponseSchema,hE as InstallDesignerPageBodySchema,bA as InstallDesignerPageResponseSchema,nv as InternalCreateDeploymentResponseSchema,XA as InternalEnsureSubsitePublishRequestSchema,ZA as InternalEnsureSubsitePublishResponseSchema,G as InternalEntityIdSchema,av as InternalGetDeploymentsStatusResponseSchema,QA as InternalGetSubsitePublishStatusRequestSchema,JA as InternalGetSubsitePublishStatusResponseSchema,HA as InternalPrepareSubsitePreviewRequestSchema,YA as InternalPrepareSubsitePreviewResponseSchema,n_ as KNOWLEDGE_CATEGORY_CODES,ir as KnowledgeCategoryCodeSchema,a1 as KnowledgeContextReadinessSchema,i_ as KnowledgeSourceReadinessSchema,ar as KnowledgeSourceReadinessStatusSchema,s1 as KnowledgeTaskStatusBatchSchema,s_ as KnowledgeTaskStatusSchema,Zm as LEGACY_SITE_LOCALE_CODES,Qv as LatestAgentRunQuerySchema,Jv as LatestAgentRunResponseSchema,Zv as LatestWorkspaceRunResponseSchema,vP as LauncherPromptTemplateApplyRequestSchema,CP as LauncherPromptTemplateApplyResponseSchema,Vh as LauncherPromptTemplateCatalogItemSchema,wP as LauncherPromptTemplateCatalogQuerySchema,AP as LauncherPromptTemplateCatalogSchema,Bh as LauncherPromptTemplateKindSchema,Wh as LauncherPromptTemplateLocaleSchema,Zn as LauncherPromptTemplateTypeSchema,Bv as ListAgentEventsQuerySchema,zv as ListAgentEventsResponseSchema,gA as ListDesignerComponentCategoriesResponseSchema,Xx as ListDesignerComponentsQuerySchema,_A as ListDesignerComponentsResponseSchema,SA as ListDesignerPageCategoriesResponseSchema,gE as ListDesignerPagesQuerySchema,fA as ListDesignerPagesResponseSchema,xA as ListDesignerSitePagesResponseSchema,LS as ListMediaLibraryAssetsQuerySchema,MS as ListMediaLibraryAssetsResponseSchema,WA as ListSiteVersionsResponseSchema,Mk as ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema,Uk as ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema,Dy as MAX_DOCUMENT_SOURCES_PER_SITE,Cy as MAX_DOCUMENT_UPLOAD_BYTES,Uy as MAX_IMAGE_SOURCES_PER_SITE,My as MAX_IMAGE_UPLOAD_BYTES,Sc as MEDIA_LIBRARY_AUDIO_EXTENSIONS,Ec as MEDIA_LIBRARY_AUDIO_MIME_TYPES,fc as MEDIA_LIBRARY_DOCUMENT_EXTENSIONS,OS as MEDIA_LIBRARY_EXTENSIONS,bc as MEDIA_LIBRARY_FILE_EXTENSIONS,_c as MEDIA_LIBRARY_IMAGE_EXTENSIONS,jS as MEDIA_LIBRARY_IMAGE_MAX_BYTES,yc as MEDIA_LIBRARY_IMAGE_MIME_TYPES,gc as MEDIA_LIBRARY_MAX_BYTES,NS as MEDIA_LIBRARY_MIME_TYPES,hc as MEDIA_LIBRARY_VIDEO_EXTENSIONS,xc as MEDIA_LIBRARY_VIDEO_MIME_TYPES,OR as MIGRATION_PRODUCTS_CMS_DETAIL_PAGE_TITLE,jR as MIGRATION_PRODUCTS_DETAIL_PREFIX,MR as MIGRATION_PRODUCTS_DETAIL_VIEW_VARIANT,LR as MIGRATION_PRODUCTS_LIST_VIEW_VARIANT,Au as MIGRATION_PRODUCTS_ROUTE,Ke as MIGRATION_PRODUCTS_SLUG,NR as MIGRATION_PRODUCTS_VIEW_BLOCK_TYPE,h_ as MOTION_PRESETS,oi as MOTION_PRESET_IDS,Wy as ManagedPageTemplateRouteManifestV1Schema,uv as MediaAssetSchema,lf as MediaAttributionSchema,wi as MediaLibraryAssetSchema,Ic as MediaLibraryFileTypeSchema,Rc as MediaLibrarySourceSchema,wb as MediaRequestOwnerSchema,Jb as MediaResolutionCacheIdSchema,Yx as MockDesignerComponentInsertDataSchema,Hx as MockDesignerComponentInsertRequestSchema,Di as MotionLevelSchema,dh as NAV_ITEMS_LOCALIZABLE_FIELD_PATHS,uh as NAV_ITEMS_MACHINE_FIELD_PATHS,l_ as NEXT_FONT_DISPLAY_NAMES,Xt as NEXT_FONT_REGISTRY,il as NON_LATIN_SITE_LOCALE_CODES,O0 as NavItemSchema,ch as PAGE_SEO_LOCALIZABLE_FIELD_PATHS,mh as PAGE_SEO_MACHINE_FIELD_PATHS,Ut as PAGE_SLUG_PATTERN,St as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,q0 as PLATFORM_MATERIALIZED_EXEMPTIONS,Sh as PLATFORM_MATERIALIZED_FILES,fh as PLATFORM_MATERIALIZED_FILE_PATTERNS,F0 as PLATFORM_MATERIALIZERS,Za as PLATFORM_OWNED_PAGE_SLUGS,Sp as PLATFORM_OWNED_ROUTE_FILE_PATHS,ip as PageDirectoryReconcileFailedPageSchema,qa as PageDirectoryReconcileResultSchema,oE as PageDirectoryReconcileStateSchema,sp as PageDirectoryReconcileStatusSchema,Th as PageDiscoveryCoverageEntrySchema,tP as PageDiscoveryCoverageReasonSchema,Yr as PageDiscoveryCoverageSchema,Vc as PageNavigationSchema,As as PageResourceArtifactSchema,up as PageResourceComponentReferenceSchema,gp as PageResourceComponentSchema,pp as PageResourceDraftPageSchema,dp as PageResourceDraftSchema,Tn as PageResourceFinalRouteSchema,_p as PageResourcePageSchema,lp as PageResourcePageSelectionSchema,$a as PageResourceRouteMappingSchema,Fi as PageSchema,D0 as PageSeoDeclSchema,Wc as PageSlugSchema,op as PageTargetKindSchema,Ts as PageTargetProjectionHashSchema,Ga as PageTargetSchema,aE as PageTargetSetSchema,Hy as PageTemplateCleanupRequestSchema,Zy as PageTemplateCleanupResponseSchema,Vy as PageTemplateCreateRequestSchema,Yy as PageTemplateCreateResponseSchema,Qy as PageTemplateErrorCodeSchema,Ie as PageTemplateIdSchema,hn as PageTemplatePagePathSchema,$y as PageTemplatePromoteRequestSchema,Xy as PageTemplatePromoteResponseSchema,Ov as PersistClarifyAnswersRequestSchema,Nv as PersistClarifyAnswersResponseSchema,vv as PersistGeneratedSitemapDraftRequestSchema,jv as PersistGeneratedSitemapDraftResponseSchema,lC as PersistPreviewSessionRequestSchema,pC as PersistPreviewSessionResponseSchema,Mv as PersistSiteDesignPlanRequestSchema,Uv as PersistSiteDesignPlanResponseSchema,Dv as PersistSiteSitemapDraftResponseSchema,wv as PersistSiteSitemapRequestSchema,Cv as PersistSiteSitemapResponseSchema,AA as PersistSiteSnapshotRequestSchema,vA as PersistSiteSnapshotResponseSchema,VS as PositioningPrefillSchema,Ai as PositioningSourceSchema,SE as PrepareDesignerPageBodySchema,yA as PrepareDesignerPageResponseSchema,Yk as PrepareSiteBuildInitialGenerationBaseRequestSchema,Xk as PrepareSiteBuildInitialGenerationBaseResultSchema,Ek as PrepareTemplateUpgradeStateRequestSchema,Fg as PrepareTemplateUpgradeStateResponseSchema,$A as PrepareVersionPreviewRequestSchema,tf as PrepareVersionPreviewResponseSchema,Oo as ProductSearchAppConfigDraftSchema,Gs as ProductSearchAppSlugSchema,VI as ProductSearchContractFixtureSchema,Ld as ProductSearchDraftConfigSchema,Re as ProductSearchFieldNameSchema,Od as ProductSearchFilterMetaSchema,Ks as ProductSearchInteractionRequestSchema,vn as ProductSearchInteractionResponseSchema,WI as ProductSearchPopularTermsReadSchema,jo as ProductSearchPopularTermsSchema,qd as ProductSearchRequestSchema,Kd as ProductSearchResponseSchema,Bt as ProductSearchRouteIdSchema,jd as ProductSearchValueShapeSchema,DA as PromoteSiteSnapshotRequestSchema,JS as PromoteSiteSnapshotResponseSchema,zA as PromoteTemplateUpgradeSnapshotRequestSchema,BA as PromoteTemplateUpgradeSnapshotResponseSchema,pS as PublishDecisionSchema,WT as REFUSAL_COPY,$v as REST_API_ENDPOINTS,lh as ROOT_LAYOUT_METADATA_LOCALIZABLE_FIELD_PATHS,ph as ROOT_LAYOUT_METADATA_MACHINE_FIELD_PATHS,LA as RecordSnapshotVersionRequestSchema,MA as RecordSnapshotVersionResponseSchema,jk as RecordTemplateUpgradeEventRequestSchema,Ok as RecordTemplateUpgradeEventResponseSchema,Tk as RecordTemplateUpgradeFailureRequestSchema,kk as RecordTemplateUpgradeFailureResponseSchema,Pk as RecordTemplateUpgradeSuccessRequestSchema,wk as RecordTemplateUpgradeSuccessResponseSchema,vm as ReferencePagePatternSchema,gn as ReferenceSignalsSchema,DI as RegisterWorkflowTaskCommandRequestSchema,kd as RegisterWorkflowTaskRequestSchema,qA as ReleaseTemplateUpgradeLockRequestSchema,GA as ReleaseTemplateUpgradeLockResponseSchema,NI as ReplaceCrawlWorkflowTaskCommandRequestSchema,wd as ReplaceCrawlWorkflowTaskRequestSchema,OI as ReplaceWorkflowTaskCommandRequestSchema,Pd as ReplaceWorkflowTaskRequestSchema,Q1 as ResolvedFieldSchema,s0 as ResolvedFormFieldSchema,Vv as RestApiMethodSchema,VA as RestoreSiteSnapshotResponseSchema,j0 as RootLayoutMetadataSchema,Fc as RouteGenerationCardSchema,fu as RuleEngineInputSchema,Eu as RuleEngineScoreRecordSchema,$s as RuleScoreDimensionKeySchema,xu as RuleScoreDimensionSchema,jt as SELECTABLE_SITE_LOCALE_CODES,Hc as SITEMAP_RESOLVER_MAX_BLOCK_TARGETS,$c as SITEMAP_RESOLVER_MAX_PAGE_TARGETS,$k as SITE_BUILD_CONTEXT_FILE_PATH,Hk as SITE_BUILD_CONTEXT_MAX_BYTES,gd as SITE_BUILD_STATUSES,ko as SITE_BUILD_STATUS_CODES,_d as SITE_DEPLOYMENT_STATUSES,Po as SITE_DEPLOYMENT_STATUS_CODES,ai as SITE_DESIGN_DENSITY_IDS,gr as SITE_DESIGN_RADIUS_IDS,tT as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,ql as SITE_EDIT_MATERIALIZATION_MAX_FILE_CONTENT_BYTES,xs as SITE_EDIT_MATERIALIZATION_MAX_FILE_COUNT,Es as SITE_EDIT_MATERIALIZATION_MAX_TOTAL_CONTENT_BYTES,mo as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,VE as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,lg as SITE_EDIT_RUNTIME_CONTAINER_TAGS,pg as SITE_EDIT_RUNTIME_TEXT_TAGS,mg as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,ME as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,Mm as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,ia as SITE_EDIT_SOURCE_ALLOWED_DIRS,Lm as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,ls as SITE_EDIT_SOURCE_DELETE_CAPABILITY,Um as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,gt as SITE_EXTRA_REQUIREMENT_MAX_LENGTH,Qm as SITE_LOCALE_CODES,C0 as SITE_LOCALIZATION_STRUCTURES,sA as SITE_PLANNING_FROZEN_ERROR_CODE,iA as SITE_PLANNING_LOCKED_ERROR_CODE,aA as SITE_STRUCTURE_CONFIRMATION_REQUIRED_ERROR_CODE,oA as SITE_STRUCTURE_CONFIRMATION_STALE_ERROR_CODE,hd as SITE_WORKFLOW_STATUSES,wo as SITE_WORKFLOW_STATUS_CODES,Hv as SSE_STREAMS,bn as STEP5_PRIMARY_INTENT_PAGE_LIMIT,ga as STEP5_SEMRUSH_MIN_RELEVANCE_SCORE,Ax as STEP5_SEO_KEYWORD_DEFAULT,Il as STEP5_SEO_KEYWORD_MAX,El as STEP5_SEO_KEYWORD_MIN,xl as STEP5_SEO_PAYLOAD_SCHEMA_VERSION,Nl as STEP5_SSE_EVENT_NAMES,fe as STEP5_STRATEGY_COUNT,it as STEP5_STRATEGY_KEYS,ha as STEP5_STRATEGY_OPTION_IDS,fr as STEP6_AI_THEME_IDS,ri as STEP6_AI_THEME_PRESETS,br as STEP6_GENERATED_THEME_ID_PATTERN,Eg as SUBSITE_GLOSSARY_ENTRY_MAX_CHARS,Ig as SUBSITE_GLOSSARY_MAX_ENTRIES,jg as SUBSITE_MOUNT_PATH_PATTERN,wg as SUBSITE_PALETTE_NOTE_MAX_CHARS,Og as SUBSITE_RESERVED_MOUNT_SEGMENTS,hx as SUPPORTED_SITE_LOCALES,pn as SandboxSessionIdSchema,qb as SandboxSessionSchema,Sm as SandboxSessionStatusSchema,dA as SaveBriefDraftRequestSchema,kA as SaveBriefDraftResponseSchema,ly as SaveSiteExtraRequirementRequestSchema,FS as SearchUnsplashMediaQuerySchema,qS as SearchUnsplashMediaResponseSchema,Jg as SiteBuildContextFileSchema,Qg as SiteBuildContextPayloadSchema,Zg as SiteBuildContextProvenanceSchema,Xg as SiteBuildContextProvenanceSourceSchema,Ms as SiteBuildStatusSchema,Us as SiteDeploymentStatusSchema,Uc as SiteDesignContextSchema,HS as SiteDesignDensitySchema,YS as SiteDesignMotionLevelSchema,Ln as SiteEditBoundaryKindSchema,Ou as SiteEditCapabilityConstraintSchema,Du as SiteEditCapabilityModeSchema,Nn as SiteEditCapabilityModeViewSchema,BR as SiteEditCapabilityReadRequestSchema,Ep as SiteEditClassNameSourceDiagnosticSchema,ct as SiteEditClassNameSourceRangeSchema,so as SiteEditClassNameSourceSchema,wE as SiteEditClassNameSourceStyleContextSchema,no as SiteEditClassNameSourceStylesheetSchema,Cs as SiteEditClassNameSourceWriteIntentSchema,IE as SiteEditCommandDiagnosticSchema,yp as SiteEditCommandErrorSchema,L as SiteEditCompositionContextSchema,se as SiteEditCompositionSelectorSchema,ju as SiteEditConstraintKindSchema,nd as SiteEditDeletePageSourceOutputSchema,eg as SiteEditDynamicConfidenceSchema,ng as SiteEditDynamicDataBindingSchema,$o as SiteEditDynamicDataDetailSchema,Ho as SiteEditDynamicDataSummarySchema,tg as SiteEditDynamicEvidenceSchema,Vo as SiteEditDynamicSourceKindSchema,Qu as SiteEditDynamicSourceTypeSchema,Ju as SiteEditDynamicTargetKindSchema,ag as SiteEditEffectiveWriteTargetSchema,Ds as SiteEditElementPropertySchema,ZR as SiteEditEventSchema,Xs as SiteEditExternalSourceKindSchema,DE as SiteEditGetClassNameSourceCommandResultSchema,vE as SiteEditGetClassNameSourceInputSchema,CE as SiteEditGetClassNameSourceResultSchema,kT as SiteEditGetDocumentInputSchema,PT as SiteEditGetObjectEditContextInputSchema,mx as SiteEditGetSourceFileInputSchema,cx as SiteEditGetSourceTreeInputSchema,AE as SiteEditGetStyleContextInputSchema,Un as SiteEditHistoryProvenanceSchema,Fu as SiteEditHistoryReadOnlyRecoveryStatusSchema,Nu as SiteEditHistoryRecoveryCodeSchema,Lu as SiteEditHistoryRecoveryDiagnosticSchema,sT as SiteEditHistoryResultSchema,nT as SiteEditHistoryStatusModeSchema,Gu as SiteEditHistoryStatusSchema,Mu as SiteEditHistoryUnavailableReasonSchema,qu as SiteEditHistoryUnavailableStatusSchema,Uu as SiteEditHistoryWritableStatusSchema,KT as SiteEditInitializeSessionInputSchema,Jp as SiteEditInsertNodeSpecSchema,td as SiteEditInsertPageResourceOutputSchema,Vl as SiteEditMaterializationDataRequirementsSchema,Wl as SiteEditMaterializationEntrySchema,Bl as SiteEditMaterializationExportSchema,zl as SiteEditMaterializationFileSchema,Ta as SiteEditMaterializationPathTemplateSchema,at as SiteEditMaterializationSchema,go as SiteEditMoveTargetSchema,Ft as SiteEditMutationContextSchema,Mn as SiteEditNodeCapabilitySnapshotSchema,AT as SiteEditObjectCapabilitiesSchema,CT as SiteEditObjectDetailSchema,jT as SiteEditObjectEditContextSchema,OT as SiteEditObjectStyleDetailSchema,DT as SiteEditObjectSummarySchema,rI as SiteEditOperationCommandResultSchema,fo as SiteEditOperationErrorCodeSchema,bo as SiteEditOperationErrorSchema,sd as SiteEditOperationOutputSchema,ed as SiteEditOperationParamsSchema,Ns as SiteEditOperationPayloadSchema,Os as SiteEditOperationRequestSchema,Qp as SiteEditOperationResultTargetSchema,yo as SiteEditOperationSelectionRefSchema,Zu as SiteEditOperationSummarySchema,Zp as SiteEditOperationTargetSchema,Kt as SiteEditOperationTypeSchema,uo as SiteEditOperationValueSchema,$E as SiteEditPageCompositionAnyVersionSchema,Np as SiteEditPageCompositionAtomicKindSchema,Fp as SiteEditPageCompositionBoundaryModeSchema,Pp as SiteEditPageCompositionBusinessMemberSchema,Tp as SiteEditPageCompositionContainerSchema,Gt as SiteEditPageCompositionDiagnosticSchema,Pn as SiteEditPageCompositionErrorCodeSchema,oo as SiteEditPageCompositionPlacementTargetSchema,wp as SiteEditPageCompositionPlacementUnitSchema,jp as SiteEditPageCompositionRuntimeRefSchema,Dp as SiteEditPageCompositionSchema,Op as SiteEditPageCompositionSourceMemberKindSchema,kp as SiteEditPageCompositionSourceMemberSchema,lo as SiteEditPageCompositionSourceRangeSchema,vp as SiteEditPageCompositionSupportedSchema,Cp as SiteEditPageCompositionUnsupportedSchema,Up as SiteEditPageCompositionV2BusinessMemberSchema,Lp as SiteEditPageCompositionV2ContainerSchema,Gp as SiteEditPageCompositionV2PlacementRelationSchema,zp as SiteEditPageCompositionV2PlacementSchema,qp as SiteEditPageCompositionV2PlacementUnitSchema,$p as SiteEditPageCompositionV2Schema,Mp as SiteEditPageCompositionV2SourceMemberSchema,Wp as SiteEditPageCompositionV2SupportedSchema,Vp as SiteEditPageCompositionV2UnsupportedSchema,Kp as SiteEditPageCompositionV2WriteModeSchema,Bp as SiteEditPageCompositionVisualAnchorSchema,Ap as SiteEditPagePlacementOptionSchema,ao as SiteEditPagePlacementSchema,co as SiteEditPageUnitResultTargetSchema,ro as SiteEditPageUnitTargetSchema,Bu as SiteEditPatchPlanPatchSchema,cT as SiteEditPatchPlanSchema,Ht as SiteEditProvenanceChainSchema,og as SiteEditProvenanceHopSchema,wT as SiteEditRenderDocumentSchema,$t as SiteEditRenderEntryRefSchema,sg as SiteEditRenderEntrySchema,Wo as SiteEditRenderPageCompositionSchema,Yu as SiteEditRenderPageCompositionSupportedSchema,Xu as SiteEditRenderPageCompositionUnsupportedSchema,Hu as SiteEditRenderPagePlacementSchema,UE as SiteEditRequiredMutationContextEnvelopeSchema,px as SiteEditResolveSourceLocationInputSchema,Xo as SiteEditSemanticSourceSchema,oI as SiteEditSignedOperationRequestSchema,aa as SiteEditSourceDeleteCapabilitySchema,qm as SiteEditSourceDirectoryPathSchema,Wm as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,Vm as SiteEditSourceFileBinaryResponseSchema,ox as SiteEditSourceFileKindSchema,Gm as SiteEditSourceFileListItemSchema,lx as SiteEditSourceFileResponseSchema,Bm as SiteEditSourceFileTextResponseSchema,js as SiteEditSourceIdentitySchema,$m as SiteEditSourceLocationRangeSchema,dx as SiteEditSourceLocationSchema,cg as SiteEditSourceLocatorRangeSchema,Qs as SiteEditSourceLocatorSchema,le as SiteEditSourcePathSchema,oa as SiteEditSourceTreeNodeSchema,rx as SiteEditSourceTreeResponseSchema,Km as SiteEditSourceTreeTruncationReasonSchema,zm as SiteEditSourceTreeTruncationSchema,So as SiteEditStyleBreakpointSchema,vT as SiteEditStyleModelSchema,_o as SiteEditStylePropertySchema,Zo as SiteEditStyleSourceSchema,ho as SiteEditStyleStateModeSchema,Zs as SiteEditTextSegmentSchema,Yo as SiteEditTextSourceSchema,ig as SiteEditWriteTargetSchema,py as SiteExtraRequirementResponseSchema,xm as SiteExtraRequirementSchema,I as SiteIdSchema,pe as SiteLocaleSchema,dv as SiteMediaIntentSchema,Yb as SiteOperationLockIdSchema,Vg as SitePreviewActivateErrorCodeSchema,Hg as SitePreviewActivateFailedSchema,$g as SitePreviewActivateReadySchema,Gk as SitePreviewActivateResponseSchema,iw as SitePublishDomainCheckDataSchema,sw as SitePublishDomainCheckRequestSchema,aw as SitePublishDomainCheckResponseSchema,ow as SitePublishDomainOperationDataSchema,rw as SitePublishDomainOperationResponseSchema,Rt as SitePublishQualityTaskStatusSchema,$P as SitePublishWorkflowActiveResponseSchema,Xi as SitePublishWorkflowIdSchema,hS as SitePublishWorkflowMutationDataSchema,HP as SitePublishWorkflowMutationResponseSchema,SS as SitePublishWorkflowPublishDataSchema,YP as SitePublishWorkflowPublishResponseSchema,pt as SitePublishWorkflowRecordSchema,VP as SitePublishWorkflowRevisionRequestSchema,XP as SitePublishWorkflowSseDataSchema,mS as SitePublishWorkflowStatusSchema,lS as SitePublishWorkflowStepSchema,tt as SiteRecordSchema,Zb as SiteTemplateUpgradeStateIdSchema,Hi as SiteVersionIdSchema,ef as SiteVersionListItemSchema,ts as SiteVersionRecordSchema,Oe as SiteWorkflowIdSchema,Td as SiteWorkflowRecordSchema,kI as SiteWorkflowSnapshotResponseSchema,qs as SiteWorkflowSnapshotSchema,Sd as SiteWorkflowStatusSchema,Zi as SiteWorkflowTaskRefIdSchema,PI as SiteWorkflowTaskRefResponseSchema,Co as SiteWorkflowTaskRefSchema,Ev as SitemapAddBlockInputSchema,qi as SitemapAnswerSchema,yv as SitemapChangeBlockVariantInputSchema,Mf as SitemapDeleteBlockInputSchema,kf as SitemapDraftBlockSchema,Pf as SitemapDraftPageSchema,Xf as SitemapDraftRecordSchema,rn as SitemapDraftSchema,Lf as SitemapEditActorSchema,qf as SitemapEditErrorCodeSchema,Kf as SitemapEditFailureSchema,Ff as SitemapEditOperationSchema,Rv as SitemapEditResultSchema,Gf as SitemapEditSuccessSchema,kv as SitemapGenerationInputSchema,$f as SitemapGenerationOutcomeSchema,Hf as SitemapGenerationReasonSchema,Zc as SitemapGenerationStageSchema,ke as SitemapIdSchema,zf as SitemapIntentPageSchema,fv as SitemapModelOutputSchema,Af as SitemapModelPageSchema,bv as SitemapMoveBlockInputSchema,Rf as SitemapNavigationHrefSchema,xe as SitemapNodeIdSchema,nm as SitemapRecordSchema,hv as SitemapResolverModelOutputSchema,_v as SitemapResolverRequestSchema,Sv as SitemapResolverResponseSchema,Nf as SitemapResolverTargetsSchema,Xc as SitemapRunInputSchema,Pt as SitemapSchema,Cf as SitemapSourceProvenanceSchema,Pv as SitemapStreamEventSchema,J0 as SitemapTaskCreateRequestSchema,iP as SitemapTaskCreateResponseSchema,jh as SitemapTaskFailureErrorCodeSchema,aP as SitemapTaskResponseSchema,Uf as SitemapUpdateBlockInstructionInputSchema,xv as SitemapUpdateBlockPropsInputSchema,mf as SitemapUserChoiceSchema,kt as SkillSelectionSchema,pf as SkillSelectionSourceSchema,mm as SnapshotContentHashSchema,Se as SnapshotFilePathSchema,x as SnapshotIdSchema,We as SnapshotRecordSchema,Lc as SnapshotStatusSchema,Pi as StartGscAuthDataSchema,cc as StartGscAuthRequestSchema,mc as StartGscAuthResponseSchema,LI as StartSiteBuildRequestSchema,Zk as StartSiteBuildResponseSchema,e_ as StartSiteBuildResultSchema,zP as StartSitePublishWorkflowRequestSchema,Yv as StartWorkspaceRunRequestSchema,Xv as StartWorkspaceRunResponseSchema,Qd as Step2FinalResultDataSourceSchema,Dn as Step2FinalResultRequestSchema,eR as Step2FinalResultResponseSchema,JI as Step2FinalResultSaveResponseSchema,Zd as Step2FinalResultSaveResultSchema,zs as Step2FinalResultTypeSchema,eu as Step2FinalResultViewSchema,Lo as Step2FinalScanCardKeySchema,Bs as Step2FinalScanCardSchema,Xd as Step2FinalScanResultSchema,Yt as Step2KnowledgeOpaqueIdSchema,i1 as Step2KnowledgeScopeSchema,$e as Step2PageRoleSchema,sR as Step2PageSelectionRequestSchema,iR as Step2PageSelectionResponseSchema,$d as Step2SiteInitializationStatusSchema,QI as Step2SiteInitializationTaskResponseSchema,Hd as Step2SiteInitializationTaskSchema,Ws as Step3AgentAnalysisSchema,ru as Step3AnalysisFindingSchema,pR as Step3AnalysisJobResponseSchema,qo as Step3AnalysisJobSchema,Uo as Step3AnalysisJobStatusSchema,dR as Step3AnalysisLatestResponseSchema,Mo as Step3AnalysisProgressSchema,lu as Step3AnalysisResultSchema,lR as Step3AnalysisScheduleResponseSchema,ou as Step3AnalysisScheduleSchema,uR as Step3AnalysisSseFrameSchema,cR as Step3AnalysisStartRequestSchema,Fo as Step3AnalysisSummarySchema,au as Step3AnalystSchema,mR as Step3AnalystsResponseSchema,SR as Step4DiagnosisResponseSchema,yn as Step5ActiveStrategyKeySchema,Nx as Step5CommitStrategyRequestSchema,Lx as Step5CommitStrategyResponseSchema,jl as Step5CommittedVersionSchema,ya as Step5DecisionCustomPayloadInputSchema,Al as Step5DecisionCustomPayloadSchema,cl as Step5EvidenceReferenceSchema,yl as Step5GenerationStatusSchema,Cl as Step5JobStatusSchema,wl as Step5LegacyDecisionCustomPayloadInputSchema,Pl as Step5LegacyDecisionCustomPayloadSchema,Rl as Step5LegacySeoKeywordInputSchema,ba as Step5LegacySeoKeywordSchema,Ss as Step5OutputLocaleSchema,Dx as Step5RegenerateItemRequestSchema,jx as Step5SaveDecisionRequestSchema,Ox as Step5SaveDecisionResponseSchema,ul as Step5SemrushEmptyReasonCodeSchema,dl as Step5SemrushIntentGroupSchema,hl as Step5SemrushKeywordCandidateSchema,Sl as Step5SemrushKeywordCandidateSearchDataSchema,Tx as Step5SemrushKeywordCandidateSearchRequestSchema,kx as Step5SemrushKeywordCandidateSearchResponseSchema,pl as Step5SemrushKeywordRecommendationSchema,bl as Step5SemrushKeywordSelectionDataSchema,fl as Step5SemrushKeywordSelectionItemSchema,Px as Step5SemrushKeywordSelectionRequestSchema,wx as Step5SemrushKeywordSelectionResponseSchema,ll as Step5SemrushRecommendationSeedSchema,_l as Step5SemrushRecommendationSnapshotSchema,ml as Step5SemrushRecommendationStatusSchema,Sa as Step5SemrushSearchIntentSchema,gl as Step5SemrushSelectionSummarySchema,Tl as Step5SemrushSnapshotRefSchema,fa as Step5SeoGeoPlanRowSchema,En as Step5SeoKeywordSchema,kl as Step5SeoPayloadV2InputSchema,bs as Step5SeoPayloadV2Schema,Bf as Step5SitemapDecisionSchema,Vf as Step5SitemapRunInputSchema,Wf as Step5SitemapSourceSchema,Tv as Step5SitemapStartRequestSchema,vx as Step5StartStrategyRequestSchema,Cx as Step5StartStrategyResponseSchema,vl as Step5StrategyDecisionInputSchema,ys as Step5StrategyDecisionSchema,fs as Step5StrategyItemSchema,xa as Step5StrategyJobSchema,xn as Step5StrategyKeySchema,ht as Step5StrategyOptionIdSchema,gs as Step5StrategyOptionSchema,rl as Step5StrategyPlanSchema,Ol as Step5StrategySnapshotDataSchema,Ux as Step5StrategySseFrameSchema,Dl as Step5StrategyVersionSnapshotSchema,x_ as Step6AiThemeCandidateSchema,zn as Step6ColorSeedsSchema,q1 as Step6DesignRecommendationGenerationInputSchema,G1 as Step6DesignRecommendationModelOutputSchema,E_ as Step6DesignRecommendationSchema,L1 as Step6DesignRecommendationsRequestSchema,M1 as Step6DesignRecommendationsResponseSchema,Rr as Step6DesignSelectionSchema,Ir as Step6GeneratedThemeCardSchema,BP as StreamSitePublishWorkflowRequestSchema,tk as SubsiteGlossariesSchema,Tg as SubsiteGlossaryEntrySchema,Fn as SubsiteHexColorSchema,fk as SubsiteMountPathSchema,sk as SubsitePaletteLocalizationSchema,kg as SubsitePaletteModeSchema,Pg as SubsitePaletteSeedsSchema,nk as SubsiteSiteInfoSchema,ck as SubsiteSyncDiffComputeRequestSchema,mk as SubsiteSyncDiffComputeResponseSchema,Cg as SubsiteSyncDiffErrorCodeSchema,lk as SubsiteSyncDiffErrorResponseSchema,gk as SubsiteVisibleTextExportRequestSchema,_k as SubsiteVisibleTextExportResponseSchema,ud as TASK_EXECUTION_STATUSES,Ao as TASK_EXECUTION_STATUS_CODES,KA as TEMPLATE_UPGRADE_LOCK_LOST_ERROR_CODE,ci as THEME_PRESETS,Sr as THEME_PRESET_IDS,To as TaskExecutionStatusSchema,zg as TemplateUpgradeCasOutcomeSchema,er as TemplateUpgradeErrorCodeSchema,Bg as TemplateUpgradeOutcomeCountsSchema,Gg as TemplateUpgradeOutcomeSchema,Wg as TemplateUpgradeSnapshotDeletionCandidateSchema,yt as TemplateUpgradeStateSchema,Mg as TemplateUpgradeStatusSchema,Kg as TemplateUpgradeValidationStageSchema,De as TemplateVersionSchema,UA as TryAcquireTemplateUpgradeLockRequestSchema,FA as TryAcquireTemplateUpgradeLockResponseSchema,kc as UnsplashDownloadLocationSchema,Tc as UnsplashMediaAssetSchema,pA as UpdateBriefRequestSchema,TA as UpdateBriefResponseSchema,Lv as UpdateClarifyArchetypeRequestSchema,CA as UpdateCurrentSnapshotManifestRequestSchema,rE as UpdatePageDirectoryReconcileStateRequestSchema,WP as UpdateSitePublishWorkflowStepRequestSchema,lA as UpdateSiteRequestSchema,AI as UpdateSiteWorkflowWebsiteRequestSchema,U1 as UpdateStep6DesignSelectionRequestSchema,F1 as UpdateStep6DesignSelectionResponseSchema,jI as UpdateWorkflowTaskStatusRequestSchema,US as UploadMediaLibraryAssetResponseSchema,jP as UpstreamPromptTemplateCatalogDataSchema,DP as UpstreamPromptTemplateConsumeDataSchema,Eh as UrlListCrawlerTaskCreateRequestSchema,Qb as UsageRecordIdSchema,GS as UseUnsplashMediaRequestSchema,KS as UseUnsplashMediaResponseSchema,ss as UserIdSchema,RS as VCP_GSC_STATES,ki as VcpGscStateSchema,gS as VcpQualityResultSchema,Ci as VisualHintsSchema,cf as VisualThemeSchema,TI as WORKFLOW_DEFINITIONS_V1,Fs as WORKFLOW_DEFINITION_REGISTRY,ld as WORKFLOW_FLOW_TYPES,fd as WORKFLOW_MENU_STATES,pd as WORKFLOW_NODE_CODES,dd as WORKFLOW_TASK_TYPES,nC as WORKSPACE_WEBSOCKET_CONTRACT,Io as WorkflowClientCapabilitiesSchema,vo as WorkflowDefinitionVersionSchema,wn as WorkflowFlowTypeSchema,Rd as WorkflowMenuItemSchema,bd as WorkflowMenuStateSchema,zt as WorkflowNodeCodeSchema,Ro as WorkflowTaskTypeSchema,Eb as WorkspaceClientMessageSchema,BS as WorkspaceDesignApplyRequestSchema,WS as WorkspaceDesignApplyResponseSchema,Ki as WorkspaceDiagnosticSchema,Cb as WorkspaceDirectEditFileSchema,vb as WorkspaceDirectEditPathSchema,um as WorkspaceDirectEditPostActionSchema,aC as WorkspaceDirectEditRequestSchema,rC as WorkspaceDirectEditResponseSchema,zi as WorkspaceExecutionDiagnosticsSchema,Fv as WorkspaceExecutionPlanSchema,Ab as WorkspaceMediaRequestSchema,Vi as WorkspacePlanDependencySchema,am as WorkspacePlanSummarySchema,ab as WorkspacePlanTaskKindSchema,Wi as WorkspacePlanTaskSchema,ad as WorkspaceResourceKindSchema,rd as WorkspaceResourceNavigationSelectionSchema,Eo as WorkspaceResourceOperationClientMessageSchema,od as WorkspaceResourceOperationSummarySchema,cd as WorkspaceResourceOperationTransientInputSchema,ns as WorkspaceRunKindSchema,xb as WorkspaceSelectedComponentSchema,Rb as WorkspaceServerMessageSchema,Iv as WorkspaceSitemapEditRequestSchema,yb as WorkspaceSocketDescriptorSchema,Mb as WorkspaceSourceFileBinaryResponseSchema,Nb as WorkspaceSourceFileKindSchema,_m as WorkspaceSourceFileListItemSchema,cC as WorkspaceSourceFilePathQuerySchema,mC as WorkspaceSourceFileResponseSchema,Lb as WorkspaceSourceFileTextResponseSchema,gm as WorkspaceSourcePathSchema,Jf as WorkspaceSuggestionSchema,sm as WorkspaceSuggestionsSchema,eb as WorkspaceSuggestionsSourceSchema,om as WorkspaceTaskCountsSchema,tC as WorkspaceWebSocketMessageSchema,eC as WorkspaceWebSocketMessageTypeSchema,Bi as WorkspaceWorkerGroupSchema,Gi as WorkspaceWorkerPhaseSchema,qv as WorkspaceWorkerResultSchema,dt as WorkspaceWorkerStatusSchema,TR as assertDeploymentTransition,GI as assertSiteBuildStatusTransition,qI as assertTaskExecutionStatusTransition,kw as buildE2bBrowserPreviewUrl,K1 as buildStep6FallbackThemeCards,yi as canonicalizeFormDesignJson,OP as canonicalizeLauncherPromptTemplateOperation,eo as canonicalizePageSlug,Gx as compareTemplateVersions,lT as composeSiteEditRepeatInstanceKey,w0 as computeFormDesignOperationFingerprint,ms as computeSiteEditCompositionKey,Rp as computeSiteEditSourceIdentityKey,ln as containsSensitiveData,xp as createSiteEditCommandFailureSchema,to as createSiteEditCommandResultSchema,vs as createSiteEditCommandSuccessSchema,B1 as defaultStep6Selection,PS as deriveVcpGscState,wS as doesGscPropertyMatchDomain,vd as findWorkflowDefinition,Ad as findWorkflowDefinitionInRegistry,si as fontStack,rh as formDesignOperationFingerprintInput,kR as getDeploymentHappyPathTransitions,IR as getDeploymentTransitionPredecessors,ER as getDeploymentTransitionTargets,ur as getFontPairing,hr as getMotionPreset,yr as getSiteDesignThemeRadius,ds as getSiteEditSourceDeleteProtectionReason,T1 as getThemePreset,Cd as getWorkflowDefinition,UI as getWorkflowNodeIndex,iy as hasAnyBusinessFact,ak as hasLockedSeeds,P0 as hashAffectedFormDesignFiles,k0 as hashCmsFormSchemaProjection,Vn as hashFormDesignJson,T0 as hashFormSpec,Qa as isCanonicalPageSlug,Yg as isCmsMainProductsWithinLimit,Oy as isConsentGranted,ku as isDeploymentActiveStatus,RR as isDeploymentTerminalStatus,yg as isExactEditEngineVersion,by as isExternalSiteEditInfrastructureReason,l0 as isFormSpecLocalizableFieldPath,Mx as isKnownStep5SseEventName,qR as isMigrationProductsPresetBlockLabel,FR as isMigrationProductsPresetPageTitle,bx as isNonLatinSiteLocale,G0 as isPlatformMaterializedFile,Lg as isReservedSubsiteMountSegment,Kl as isSiteEditMaterializationPathTemplate,hg as isSiteEditRuntimeContainerTag,Sg as isSiteEditRuntimeTextTag,LT as isSiteEditRuntimeVoidElementTag,ux as isSiteEditSourceDeleteProtectedPath,Hm as isSiteEditSourceDirectoryPath,ra as isSiteEditSourcePath,ps as isSiteEditTextSourcePath,L0 as isSiteStructureKnownFieldPath,N0 as isSiteStructureLocalizableFieldPath,FI as isWorkflowTaskTypeForNode,Vu as makeSiteEditRepeatInstanceKey,UR as migrationProductsCopyForLocale,$0 as normalizeCmsPublicApiBase,Cr as normalizeFormOptionLabelIdentity,mn as normalizeGscDomain,Ea as normalizeStep5SeoKeyword,bp as pageSlugToRouteFilePath,tE as parseCmsPageDirectory,vR as parseComponentI18nResourcesJson,AS as parseE2bPreviewProxyDomain,xg as parseExactEditEngineVersion,nx as parseSiteEditCompositionKey,$u as parseSiteEditRepeatInstanceKey,GE as parseSiteEditSourceIdentityKey,h0 as projectFormSpecToCmsSchema,vS as reconcileSitemapNavigation,r_ as resolveFont,m_ as resolveFontDisplayName,_0 as resolveFormTemplateText,MI as resolvePublishedWorkflowDefinition,_y as resolveRedisConnectionConfig,ZT as resolveRequestedEditEngineVersion,da as resolveSelectableSiteLocale,MT as resolveSiteEditRuntimeOperationSummary,fx as resolveSiteLocaleFromIso6393,Sx as resolveSiteTextDirection,I_ as resolveStep6RadiusId,QT as resolveSystemCurrentEditEngineVersion,Dd as selectPublishedWorkflowDefinition,Gy as selectReferenceVisualImage,SI as siteBuildStatusFromCode,xI as siteBuildStatusToCode,fI as siteDeploymentStatusFromCode,EI as siteDeploymentStatusToCode,__ as siteFontVariables,bI as siteWorkflowStatusFromCode,II as siteWorkflowStatusToCode,Rg as splitSubsiteGlossaryEntry,pT as stripSiteEditRepeatInstanceKeys,yI as taskExecutionStatusFromCode,RI as taskExecutionStatusToCode,z1 as toStep6GenerationVisualHints,Ja as tryCanonicalizeAsciiPageSlug,zo as validateComponentI18nResources,p0 as validateFormSpecIdentityTransition};
|
|
1
|
+
import{z as e}from"zod";import{z as ym}from"zod";var G=ym.uuidv7(),ss=G,zb=G,Bb=G,Wb=G,Vb=G,Hb=G,$b=G,I=G,ut=G,Hi=G,ke=G,is=G,x=G,$i=G,V=G,Yi=G,pn=G,Fe=G,Yb=G,Xb=G,Xi=G,Oe=G,Zi=G,Zb=G,Qb=G,Jb=G,nt=G,ey=G,ty=G,ny=G;import{z as dn}from"zod";var Qi=dn.object({primary_products:dn.string().trim().min(1).max(1e3).optional(),current_markets:dn.string().trim().min(1).max(1e3).optional(),qualifications:dn.string().trim().min(1).max(1e3).optional()}).strict();function ay(t){return Object.values(t).some(n=>typeof n=="string"&&n.trim().length>0)}import{z as vt}from"zod";import{z as as}from"zod";var M=t=>as.object({code:as.number().int(),data:t,message:as.string()});var gt=2e3,xm=vt.object({note:vt.string().trim().max(gt),updated_at:vt.string().min(1)}).strict(),py=vt.object({note:vt.string().trim().max(gt)}).strict(),dy=M(xm.nullable());import{z as Ct}from"zod";var Em=40,st=Ct.object({protocol:Ct.enum(["phone","form","download","route","external"]),ctaLabel:Ct.string().min(1).max(Em),ctaTarget:Ct.string().min(1).max(200).optional(),requiresOwnerDetail:Ct.boolean().optional()});var _t=["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 hy(t){let n=t.VCP_REDIS_URL??t.REDIS_URL;if(n){let s=new URL(n);return{url:n,host:s.hostname,port:s.port?Number(s.port):6379,password:s.password?decodeURIComponent(s.password):void 0}}return{host:t.VCP_REDIS_HOST??"127.0.0.1",port:Im(t.VCP_REDIS_PORT,56379)}}function Im(t,n){if(!t)return n;let s=Number(t);return Number.isInteger(s)&&s>0?s:n}import{z as $}from"zod";var ea=G,Ji=200,Rm=4e3,ta=$.enum(["succeeded","degraded","no_changes","failed"]),Dt=$.enum(["typecheck_unresolved","step_cap_reached","partial_apply_gave_up","patch_protected_dropped","preview_build_failed","preview_runtime_degraded","build_not_verified","external_blocked","cms_reconcile_failed","run_expired","sandbox_unavailable"]),Tm=["sandbox_unavailable"];function yy(t){return t!=null&&Tm.includes(t)}var km=$.enum(["pending","delivered","failed"]),Pm=$.enum(["running","succeeded","degraded","no_changes","failed"]),xy=$.object({site_id:I,external_run_id:$.string().min(1).max(Ji),external_thread_id:$.string().min(1).max(Ji),prompt:$.string().min(1).max(Rm)}).strict(),na=$.object({id:ea,site_id:I,external_run_id:$.string().min(1),external_thread_id:$.string().min(1),status:Pm,outcome:ta.nullable(),degraded_reason:Dt.nullable(),vcp_run_id:V.nullable(),base_snapshot_id:x,snapshot_id:x.nullable(),preview_url:$.string().url().nullable(),summary:$.string().nullable(),error_code:$.string().nullable(),build_verified:$.boolean().nullable(),callback_status:km,created_at:$.string().min(1),started_at:$.string().min(1).nullable(),finished_at:$.string().min(1).nullable()}).strict(),Ey=$.object({task:na}).strict(),Iy=$.object({task:na}).strict(),Ry=$.object({task_id:ea,external_run_id:$.string().min(1),external_thread_id:$.string().min(1),site_id:I,vcp_run_id:V.nullable(),outcome:ta,degraded_reason:Dt.nullable(),snapshot_id:x.nullable(),preview_url:$.string().url().nullable(),summary:$.string().nullable(),error_code:$.string().nullable(),build_verified:$.boolean().nullable(),retryable:$.boolean(),finished_at:$.string().min(1)}).strict(),Ty=$.object({received:$.literal(!0)}).strict();import{z as D}from"zod";var os=D.enum(["text","url","document","image"]),rs=D.enum(["pending","ready","failed"]),Am=D.enum(["pending","ready","failed"]),wm=D.enum(["product","price","contact","copy","audience","other"]),un=D.object({fact:D.string().min(1).max(300),kind:wm,source_id:nt,quote:D.string().min(1).max(500),trust:D.enum(["verbatim","ocr"]).default("verbatim")}),vm=D.object({page_type:D.string().min(1).max(40),sections:D.array(D.string().min(1).max(40)).max(12)}),gn=D.object({source_id:nt,nav_structure:D.array(D.string().min(1).max(30)).max(12),page_patterns:D.array(vm).max(10),tone:D.array(D.string().min(1).max(20)).max(8),screenshot_ref:D.string().optional()}),Cm=D.object({source_id:nt,type:os,status:rs,title:D.string().max(120).optional(),original_ref:D.string().min(1),source_metadata:D.record(D.string(),D.unknown()),error_code:D.string().optional(),submitted:D.boolean().optional()}),_n=D.object({topic:D.string().min(1).max(80),variants:D.array(D.object({value:D.string().min(1).max(300),source_id:nt})).min(2)}),Dm=D.object({type:D.literal("text"),content:D.string().min(20).max(1e4),title:D.string().min(1).max(120).optional()}).strict(),jm=D.object({type:D.literal("url"),url:D.string().url().max(2048),rights_ack:D.boolean().optional(),title:D.string().min(1).max(120).optional()}).strict(),wy=D.discriminatedUnion("type",[Dm,jm]),vy=[".docx",".html",".md",".txt"],Cy=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],Dy=10*1024*1024,jy=2,Oy=D.object({consent_cross_border:D.union([D.literal(!0),D.literal("true")]),consent_text_version:D.string().min(1).max(120),title:D.string().min(1).max(120).optional()}).strict();function Ny(t){return t===!0||t==="true"}var Ly=[".png",".jpg",".jpeg",".webp"],My=["image/png","image/jpeg","image/webp","application/octet-stream"],Uy=8*1024*1024,Fy=10,Om=D.enum(["asset","reference"]),qy=D.object({image_role:Om,title:D.string().min(1).max(120).optional()}).strict(),Gy=D.object({version:D.literal(1),site_id:I,tenant_id:D.string().min(1),user_prompt:D.string(),status:Am,sources:D.array(Cm).max(16),facts:D.array(un).max(120),reference:gn.optional(),conflicts:D.array(_n).max(20)}).superRefine((t,n)=>{let s=new Map(t.sources.map(a=>[a.source_id,a]));for(let[a,i]of t.facts.entries()){let r=s.get(i.source_id);(!r||r.type==="url")&&n.addIssue({code:"custom",path:["facts",a,"source_id"],message:"facts must reference a text/document/image source (never url)"})}if(t.reference){let a=s.get(t.reference.source_id),i=a?.type==="image"&&a.source_metadata.image_role==="reference";(!a||a.type!=="url"&&!i)&&n.addIssue({code:"custom",path:["reference","source_id"],message:"reference must point at a url source or reference image source"})}});function Ky(t){for(let n of t.sources)if(n.type==="image"&&n.status==="ready"&&n.source_metadata?.image_role==="reference")return{source_id:n.source_id};return t.reference?.screenshot_ref?{source_id:t.reference.source_id}:null}import{z as w}from"zod";import{z as Sn}from"zod";import{z as Y}from"zod";var Ie=Y.string().min(1),hn=Y.string().min(1).refine(t=>t.startsWith("/")&&!t.includes("?")&&!t.includes("#"),{message:"page_path must start with / and must not contain ? or #"}),Nm=Y.object({template_id:Ie,safe_name:Y.string().min(1),entry_file:Y.string().min(1),kind:Y.enum(["default","additional"])}).strict(),Vy=Y.object({schema_version:Y.literal(1),route_id:Y.string().min(1),canonical_entry_file:Y.string().min(1),route_key:Y.string().min(1),default_template_id:Ie,templates:Y.array(Nm).min(1)}).strict().superRefine((t,n)=>{let s=new Set,a,i=0;for(let[r,_]of t.templates.entries())s.has(_.template_id)&&n.addIssue({code:"custom",path:["templates",r,"template_id"],message:`Duplicate template_id: ${_.template_id}`}),s.add(_.template_id),_.kind==="default"&&(i+=1,a=_.template_id);i!==1?n.addIssue({code:"custom",path:["templates"],message:"templates must contain exactly one default item"}):a!==t.default_template_id&&n.addIssue({code:"custom",path:["default_template_id"],message:"default_template_id must match the default template"})}),Hy=Y.object({page_path:hn,template_id:Ie,instruction:Y.string().min(1)}).strict(),sa=t=>[...new Set(t)],$y=Y.object({page_path:hn,template_id:Ie,exit_template_ids:Y.array(Ie).default([]).transform(sa)}).strict(),Yy=Y.object({page_path:hn,template_ids:Y.array(Ie).min(1).transform(sa)}).strict(),cs={ok:Y.literal(!0),site_id:I,page_path:hn,route_id:Y.string().min(1),default_template_id:Ie,snapshot_id:x,route_mode:Y.literal("delegated")},Xy=Y.object({...cs,template_id:Ie,status:Y.literal("created")}).strict(),Zy=Y.object({...cs,promoted_template_id:Ie,deleted_template_ids:Y.array(Ie),status:Y.literal("promoted")}).strict(),Qy=Y.object({...cs,deleted_template_ids:Y.array(Ie),status:Y.literal("cleaned")}).strict(),Jy=Y.enum(["PAGE_TEMPLATE_REQUEST_INVALID","PAGE_TEMPLATE_PAGE_NOT_FOUND","PAGE_TEMPLATE_NOT_FOUND","PAGE_TEMPLATE_ALREADY_EXISTS","PAGE_TEMPLATE_ID_COLLISION","PAGE_TEMPLATE_MANAGED_SOURCE_INVALID","PAGE_TEMPLATE_DEFAULT_PROTECTED","PAGE_TEMPLATE_DEFAULT_ALREADY_ACTIVE","PAGE_TEMPLATE_ASSET_IN_USE","PAGE_TEMPLATE_SNAPSHOT_CONFLICT","PAGE_TEMPLATE_DYNAMIC_ROUTE_UNSUPPORTED","PAGE_TEMPLATE_SOURCE_UNSUPPORTED","PAGE_TEMPLATE_GENERATION_FAILED","PAGE_TEMPLATE_PATCH_FAILED"]);var se=Sn.object({routeId:Sn.string().min(1),templateId:Ie.optional()}).strict(),L=Sn.object({routeId:Sn.string().min(1),effectiveTemplateId:Ie.optional()}).strict();function ms(t){return JSON.stringify([t.routeId,t.effectiveTemplateId??null])}function sx(t){let n;try{n=JSON.parse(t)}catch{return null}if(!Array.isArray(n)||n.length!==2)return null;let[s,a]=n,i=L.safeParse(a===null?{routeId:s}:{routeId:s,effectiveTemplateId:a});return i.success?i.data:null}var Lm=["design.md","DESIGN.md"],ia=["components/site","src/components/site","lib/generated","src/lib/generated","public"],Mm=["app/globals.css","src/app/globals.css"],Um=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],Fm=new Set(Um),ls="source-delete",aa=w.literal(ls),le=w.string().min(1).refine(ra,"Invalid site edit source path"),qm=w.string().min(1).refine($m,"Invalid site edit source directory path"),rx=w.enum(["text","binary"]),fn=w.object({composition:L,path:le,language:w.string().min(1).nullable(),sizeBytes:w.number().int().nonnegative(),contentHash:w.string().min(1).optional()}).strict(),Gm=w.discriminatedUnion("kind",[fn.extend({kind:w.literal("text"),language:w.string().min(1),readonly:w.boolean().default(!1)}),fn.extend({kind:w.literal("binary"),language:w.null(),mimeType:w.string().min(1).optional(),readonly:w.literal(!0)})]),oa=w.lazy(()=>w.discriminatedUnion("kind",[w.object({kind:w.literal("directory"),name:w.string().min(1),path:qm,children:w.array(oa)}),w.object({kind:w.literal("file"),name:w.string().min(1),path:le,file:Gm}).superRefine((t,n)=>{t.path!==t.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),Km=w.enum(["max-files","max-depth","max-total-bytes"]),zm=w.object({reasons:w.array(Km).min(1),maxFiles:w.number().int().positive(),maxDepth:w.number().int().positive(),maxTotalBytes:w.number().int().positive()}),cx=w.object({composition:L,nodes:w.array(oa),defaultPath:le.optional(),totalFiles:w.number().int().nonnegative(),truncated:zm.optional()}).strict(),mx=w.object({composition:se}).strict(),lx=w.object({path:le,composition:se}).strict(),Bm=fn.extend({kind:w.literal("text"),language:w.string().min(1),readonly:w.boolean().default(!1),content:w.string()}),Wm=w.enum(["too-large","unsupported-mime","bytes-unavailable"]),Vm=fn.extend({kind:w.literal("binary"),language:w.null(),readonly:w.literal(!0),mimeType:w.string().min(1),contentBase64:w.string().min(1).optional(),previewUnavailableReason:Wm.optional()}),px=w.discriminatedUnion("kind",[Bm,Vm]),dx=w.object({key:w.string().min(1),composition:se}).strict(),Hm=w.object({startLine:w.number().int().positive(),startColumn:w.number().int().nonnegative(),endLine:w.number().int().positive(),endColumn:w.number().int().nonnegative()}),ux=w.object({key:w.string().min(1),composition:L,sourceFile:le,componentName:w.string().min(1),openingElementRange:Hm,structuralPath:w.string().min(1),textPreview:w.string().min(1).optional()}).strict();function ra(t){return!pa(t)||la(t)?!1:us(t)||ma(t)||ca(t)||ia.some(n=>t===n||t.startsWith(`${n}/`))}function ps(t){return us(t)||Fm.has(Ym(t))}function $m(t){return!pa(t)||la(t)?!1:t==="app"||t.startsWith("app/")||t==="src"||t==="src/app"||t.startsWith("src/app/")||ia.some(n=>t===n||t.startsWith(`${n}/`)||n.startsWith(`${t}/`))}function ds(t){return ra(t)?us(t)?"design-document":ca(t)?"route-entry":ma(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 gx(t){return ds(t)!==null}function ca(t){return/^(?:src\/)?app\/(?:.*\/)?page\.[cm]?[jt]sx?$/.test(t.toLowerCase())}function ma(t){return Mm.some(n=>n.toLowerCase()===t.toLowerCase())}function Ym(t){let n=t.split("/").at(-1)??t,s=n.lastIndexOf(".");return s>0?n.slice(s).toLowerCase():""}function us(t){return!t.includes("/")&&Lm.some(n=>n.toLowerCase()===t.toLowerCase())}function la(t){let n=t.toLowerCase(),s=n.split("/"),i=(s.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:i==="server"||i==="db"||i==="database"||i==="auth"||i==="secret"||i==="secrets"||i==="token"||i==="tokens"||i==="credential"||i==="credentials"||s.includes("server")||s.includes("secrets")}function pa(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 Xm}from"zod";var jt=["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"],Zm=["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"],Qm=[...jt,...Zm],Jm=new Set(["ar","fa","he"]),Sx=[{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"}],el={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"},tl=new Set(jt);function da(t){return tl.has(t)?t:el[t]}var nl="en";function fx(t){let n=t.toLowerCase().split("-",1)[0]??"";return Jm.has(n)?"rtl":"ltr"}var sl={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 bx(t){return sl[t]??nl}var il=["zh-CN","zh-HK","zh-TW","ja-JP","ja","ko-KR","ko","ru-RU","ru","uk-UA","uk","bg","sr","mn-MN","kk-KZ","ar-SA","ar","fa-IR","fa","he","hi","th-TH","th","el-GR","el","ka-GE","bn-BD","bn","ta-IN","ta","si-LK","my-MM","km-KH","lo-LA"],al=new Set(il);function yx(t){return al.has(t)}var pe=Xm.enum(Qm);import{z as ol}from"zod";var ua=ol.string().uuid();import{z as o}from"zod";var de=o.string().trim().min(1).max(128),Ot=o.string().trim().min(1).max(200),_s=o.string().trim().min(1).max(2e3),hs=o.string().trim().max(200),Nt=o.string().regex(/^[a-f0-9]{64}$/),Ss=o.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),it=["market","persona","product","brand","competition","structure","language","seogeo","content","conversion","risk"],fe=it.length,yn=o.enum(it),xn=yn,ha=["recommended","conservative","focused"],ht=o.enum(ha),gs=o.object({id:ht,label:Ot,note:_s,impact:o.string().trim().max(500).nullish(),set_value:o.string().trim().max(500).nullish(),site_locale:pe.nullish()}).loose(),rl=o.object({lead:o.string().trim().min(1).max(500),title:Ot,columns:o.array(o.string().trim().min(1).max(80)).min(1).max(8),rows:o.array(o.array(o.string().trim().max(500)).min(1).max(8)).max(100)}).strict().superRefine((t,n)=>{t.rows.forEach((s,a)=>{s.length!==t.columns.length&&n.addIssue({code:"custom",path:["rows",a],message:"Each Step5 plan row must match the column count."})})}),cl=o.object({source_type:o.enum(["step2","step3"]),source_id:de,field_path:o.string().trim().max(300).nullish()}).strict(),ml=o.enum(["ready","disabled","empty","timeout","rate_limited","quota_exhausted","failed"]),Sa=o.enum(["INFORMATIONAL","NAVIGATIONAL","COMMERCIAL","TRANSACTIONAL"]),ll=o.object({id:de,term:o.string().trim().min(1).max(255),source_type:o.enum(["step2","step3","step5"]),source_id:de,field_path:o.string().trim().min(1).max(300),source_field:o.string().trim().min(1).max(300).optional(),source_evidence:o.string().trim().min(1).max(2e3).optional(),business_subject:o.string().trim().min(1).max(255).optional(),reason:o.string().trim().min(1).max(1e3).optional()}).strict(),pl=o.object({keyword:o.string().trim().min(1).max(255),normalized_keyword:o.string().trim().min(1).max(255),intents:o.array(Sa).min(1).max(4),search_volume:o.number().int().min(50),keyword_difficulty:o.number().min(0).max(45),cpc:o.number().nonnegative().nullish(),trend:o.array(o.number().int().min(0).max(100)).length(12),serp_features:o.array(o.string().trim().min(1).max(80)).max(64),fit:o.object({seo:o.number().int().min(0).max(100),geo:o.number().int().min(0).max(100),buyer:o.number().int().min(0).max(100)}).strict(),recommended_channel:o.enum(["SEO","GEO","DUAL"]),priority:o.enum(["P0","P1","P2","P3"]),already_in_plan:o.boolean(),page_level:o.union([o.literal(1),o.literal(2)]).default(1)}).strict(),dl=o.object({id:de,intent:Sa,title:Ot,landing_page_type:o.enum(["blog","product","category","landing"]),keywords:o.array(pl).min(1).max(100)}).strict(),ul=o.enum(["NO_SEEDS","NO_PROVIDER_CANDIDATES","NO_METRIC_ELIGIBLE_CANDIDATES","NO_COMMERCIAL_INTENT_CANDIDATES","NO_FIT_ELIGIBLE_CANDIDATES"]),gl=o.object({fetched_count:o.number().int().nonnegative(),unique_count:o.number().int().nonnegative(),metric_gate_pass_count:o.number().int().nonnegative(),commercial_intent_pass_count:o.number().int().nonnegative(),fit_pass_count:o.number().int().nonnegative(),selected_count:o.number().int().nonnegative()}).strict().superRefine((t,n)=>{let s=[t.fetched_count,t.unique_count,t.metric_gate_pass_count,t.commercial_intent_pass_count,t.fit_pass_count,t.selected_count];s.some((a,i)=>i>0&&a>s[i-1])&&n.addIssue({code:"custom",message:"Semrush selection counts must be monotonically non-increasing."})}),_l=o.object({schema_version:o.literal(1),provider:o.literal("semrush"),api_version:o.literal("v4"),database:o.string().trim().regex(/^[A-Z]{2}$/),country:o.string().trim().regex(/^[A-Z]{2}$/),fetched_at:o.string().datetime({offset:!0}),context_hash:Nt,status:ml,seeds:o.array(ll).max(20),intent_groups:o.array(dl).max(16),selection_summary:gl.optional(),empty_reason_code:ul.nullish(),error_code:o.string().trim().regex(/^[A-Z0-9_]+$/).max(64).nullish()}).strict().superRefine((t,n)=>{if(t.database!==t.country&&n.addIssue({code:"custom",path:["database"],message:"Semrush database must match the ISO country code."}),t.status==="ready"&&t.intent_groups.length===0&&n.addIssue({code:"custom",path:["intent_groups"],message:"Ready Semrush recommendations require an intent group."}),t.status==="ready"&&t.error_code&&n.addIssue({code:"custom",path:["error_code"],message:"Ready Semrush recommendations cannot contain an error code."}),t.empty_reason_code&&t.status!=="empty"&&n.addIssue({code:"custom",path:["empty_reason_code"],message:"Semrush empty reason is only valid for an empty snapshot."}),t.selection_summary){let s=t.intent_groups.reduce((a,i)=>a+i.keywords.length,0);t.selection_summary.selected_count!==s&&n.addIssue({code:"custom",path:["selection_summary","selected_count"],message:"Semrush selected count must match the persisted keywords."})}}),ga=1,kx=o.object({seed_keyword:o.string().trim().min(1).max(255),database:o.string().trim().toLowerCase().regex(/^[a-z]{2}$/).default("us"),limit:o.number().int().min(1).max(100).default(20),offset:o.number().int().nonnegative().default(0),min_search_volume:o.number().int().nonnegative().default(50),max_keyword_difficulty:o.number().finite().min(0).max(100).default(45),min_relevance_score:o.literal(ga).default(ga)}).strict(),hl=o.object({keyword:o.string().trim().min(1).max(255),search_volume:o.number().int().nonnegative().nullable(),keyword_difficulty:o.number().nonnegative().nullable(),cpc:o.number().nonnegative().nullable(),competition:o.number().nonnegative().nullable(),result_count:o.number().int().nonnegative().nullable(),intent:o.string().trim().max(64).nullable(),trend:o.array(o.string()).nullable(),serp_features:o.array(o.string()).nullable(),fit:o.number().finite().min(0).max(10),currency:o.string().trim().regex(/^[A-Z]{3}$/).nullable()}).strict(),Sl=o.object({request_id:o.string().trim().min(1).max(128),snapshot_id:o.string().uuid(),seed_keyword:o.string().trim().min(1).max(255),database:o.string().trim().min(1).max(16),limit:o.number().int().min(1).max(100),offset:o.number().int().nonnegative(),freshness:o.enum(["live","cached","historical"]),collected_at:o.string().datetime({offset:!0}),items:o.array(hl).max(100),result_count:o.number().int().nonnegative()}).strict(),Px=o.object({code:o.literal(0),message:o.string(),data:Sl}).strict(),Ax=o.object({snapshot_id:o.string().uuid(),selected_keywords:o.array(o.string().trim().min(2).max(160)).min(1).max(50)}).strict(),fl=o.object({candidate_id:de,keyword:o.string().trim().min(2).max(160),classification_status:o.string().trim().min(1).max(64),selection_status:o.string().trim().min(1).max(64),selected_at:o.string().datetime({offset:!0})}).strict(),bl=o.object({selection_batch_id:de,snapshot_id:o.string().uuid(),selected_count:o.number().int().nonnegative(),created_count:o.number().int().nonnegative(),updated_count:o.number().int().nonnegative(),deselected_count:o.number().int().nonnegative(),items:o.array(fl).max(50)}).strict().superRefine((t,n)=>{t.selected_count!==t.items.length&&n.addIssue({code:"custom",path:["selected_count"],message:"selected_count must equal items.length."})}),wx=o.object({code:o.literal(0),message:o.string(),data:bl}).strict(),yl=o.enum(["ok","degraded"]),fs=o.object({key:xn,position:o.number().int().min(1).max(fe),category:Ot,title:Ot,summary:_s,rationale:_s,parameter:o.string().trim().max(500).nullish(),options:o.tuple([gs,gs,gs]),plan:rl.nullish(),note_tips:o.array(o.string().trim().min(1).max(200)).max(6),note_placeholder:o.string().trim().min(1).max(300),evidence_refs:o.array(cl).min(1).max(8),semrush_recommendations:_l.nullish(),seo_payload:o.lazy(()=>bs).nullish(),generation_status:yl.optional()}).loose().superRefine((t,n)=>{let s=it.indexOf(t.key)+1;t.position!==s&&n.addIssue({code:"custom",path:["position"],message:`Step5 strategy ${t.key} uses an invalid position.`}),t.options.forEach((a,i)=>{a.id!==ha[i]&&n.addIssue({code:"custom",path:["options",i,"id"],message:"Step5 strategy options must use the canonical order."})}),t.semrush_recommendations&&t.key!=="seogeo"&&n.addIssue({code:"custom",path:["semrush_recommendations"],message:"Semrush recommendations are only valid for the seogeo item."}),t.seo_payload&&t.key!=="seogeo"&&n.addIssue({code:"custom",path:["seo_payload"],message:"SEO payloads are only valid for the seogeo item."})}),bn=9,fa=o.object({id:de,type:o.union([o.literal(1),o.literal(2)]).default(1),cells:o.tuple([o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500)])}).strict(),xl=2,El=1,vx=20,Il=50,ba=o.object({id:de,keyword:o.string().trim().min(1).max(500),intent_code:o.string().trim().min(1).max(16),intent_type:o.string().trim().min(1).max(200),strength:o.enum(["high","medium"]),search_volume:o.number().int().nonnegative().nullable(),cpc:o.number().finite().nonnegative().nullable()}).strict(),Rl=ba.superRefine((t,n)=>{t.intent_code!=="C"&&t.intent_code!=="T"&&n.addIssue({code:"custom",path:["intent_code"],message:"New legacy SEO keyword selections must use commercial or transactional intent."})}),En=o.object({id:de,keyword:o.string().trim().min(2).max(160),normalized_keyword:o.string().trim().min(2).max(160),intc:o.enum(["I","N","C","T"]),keyword_type:o.string().trim().min(1).max(80),intent_strength:o.enum(["high","medium","low"]),monthly_volume:o.number().int().nonnegative().nullable(),keyword_difficulty:o.number().finite().min(0).max(100).nullable(),fit:o.number().finite().min(0).max(10).nullable(),sem_cpc:o.number().finite().nonnegative().nullable(),currency:o.string().trim().regex(/^[A-Z]{3}$/).nullable(),landing_page:o.string().trim().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*)?$/),content_format:o.string().trim().min(1).max(80),priority:o.enum(["P0","P1","P2","P3"]),source:o.enum(["step5_generation","semrush"]),source_market:o.string().trim().toLowerCase().regex(/^[a-z]{2,8}$/),metric_timestamp:o.string().datetime({offset:!0}).nullable()}).strict().superRefine((t,n)=>{let s=Ea(t.keyword);t.normalized_keyword!==s&&n.addIssue({code:"custom",path:["normalized_keyword"],message:"normalized_keyword must match the canonical keyword form."}),/^[\x20-\x7E]+$/.test(t.keyword)||n.addIssue({code:"custom",path:["keyword"],message:"Step5 SEO keywords must be English ASCII text."})}),Tl=o.object({request_id:o.string().trim().min(1).max(128),snapshot_id:de,selected_keywords:o.array(o.string().trim().min(2).max(160)).min(1).max(50)}).strict(),bs=o.object({schema_version:o.literal(xl),seo_keywords:o.array(En).min(El).max(Il),semrush_snapshot_refs:o.array(Tl).max(20).optional()}).strict().superRefine(Ml),kl=bs.superRefine((t,n)=>{t.seo_keywords.forEach((s,a)=>{s.intc!=="C"&&s.intc!=="T"&&n.addIssue({code:"custom",path:["seo_keywords",a,"intc"],message:"New SEO keyword selections must use commercial or transactional intent."})})}),Pl=o.object({rows:o.array(fa).max(100).optional(),seo_keywords:o.array(ba).max(100).optional()}).strict(),Al=o.object({rows:o.array(fa).max(100).optional(),seo_keywords:o.array(Rl).max(100).optional()}).strict(),wl=o.union([bs,Pl]),ya=o.union([kl,Al]),vl=o.object({item_key:yn,selected_option_id:ht,note:hs,custom_payload:ya.optional()}).strict().superRefine((t,n)=>{t.item_key==="seogeo"&&t.custom_payload&&!("schema_version"in t.custom_payload)&&Ll(t.custom_payload,n)}),ys=o.object({item_key:yn,selected_option_id:ht,note:hs,custom_payload:wl.optional(),selected_value:o.unknown().nullable(),accepted_at:o.string().datetime({offset:!0})}).loose(),Cl=o.enum(["running","succeeded","failed"]),Dl=o.object({schema_version:o.literal(1),source_job_id:de,site_id:de,output_locale:Ss.optional(),items:o.array(fs).length(fe),decisions:o.array(ys).length(fe)}).loose(),jl=o.object({strategy_version_id:de,site_id:de,source_job_id:de,output_locale:Ss.optional(),version:o.number().int().positive(),checksum:Nt,snapshot:Dl,committed_at:o.string().datetime({offset:!0})}).loose(),xa=o.object({job_id:de,site_id:de,output_locale:Ss.optional(),status:Cl,revision:o.number().int().nonnegative(),items:o.array(fs).max(fe),decisions:o.array(ys).max(fe),output_checksum:Nt.nullish(),error_code:o.string().trim().max(64).nullish(),error_message:o.string().trim().max(500).nullish(),committed_version:jl.nullish()}).loose().superRefine((t,n)=>{let s=t.items.map(i=>i.key);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["items"],message:"Step5 job items must have unique keys."});let a=t.decisions.map(i=>i.item_key);new Set(a).size!==a.length&&n.addIssue({code:"custom",path:["decisions"],message:"Step5 job decisions must have unique item keys."})}),Cx=o.object({force_refresh:o.boolean().optional().default(!1)}).strict(),Dx=xa.extend({cached:o.boolean()}).strict(),jx=o.object({expected_revision:o.number().int().nonnegative()}).strict(),Ox=o.object({expected_revision:o.number().int().nonnegative(),selected_option_id:ht,note:hs,custom_payload:ya.optional()}).strict(),Nx=o.object({revision:o.number().int().positive(),decision:ys}).strict(),Lx=o.object({idempotency_key:o.string().trim().min(8).max(128),expected_revision:o.number().int().nonnegative(),decisions:o.array(vl).length(fe)}).strict().superRefine((t,n)=>{let s=t.decisions.map(a=>a.item_key);new Set(s).size!==it.length&&n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit must contain ${fe} unique decisions.`}),it.forEach(a=>{s.includes(a)||n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit is missing ${a}.`})})}),Mx=o.object({strategy_version_id:de,version:o.number().int().positive(),checksum:Nt,next_path:o.string().trim().min(1).max(500)}).strict(),Ol=xa.extend({completed:o.number().int().min(0).max(fe),total:o.literal(fe)}).loose(),Nl=["snapshot","strategy_item_start","strategy_item_done","strategy_items_invalidated","strategy_generation_done","failed"];function Ux(t){return typeof t=="string"&&Nl.includes(t)}var Fx=o.discriminatedUnion("event",[o.object({id:o.number().int().nonnegative(),event:o.literal("snapshot"),data:Ol}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_item_start"),data:o.object({key:yn,position:o.number().int().min(1).max(fe)}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_item_done"),data:o.object({item:fs}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_items_invalidated"),data:o.object({after_position:o.number().int().min(0).max(fe)}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_generation_done"),data:o.object({item_count:o.literal(fe),schema_version:o.literal(1),checksum:Nt}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("failed"),data:o.object({code:o.string().trim().min(1).max(64),message:o.string().trim().min(1).max(500),retryable:o.boolean(),item_key:xn.optional()}).loose()}).loose()]);function _a(t){let n=t.trim().toLocaleLowerCase();return n===""||n==="/"?"/":`/${n.replace(/^\/+|\/+$/g,"")}`}function Ll(t,n){let s=(t.rows??[]).filter(i=>i.type===1);t.rows&&s.length===0&&n.addIssue({code:"custom",path:["custom_payload","rows"],message:"SEO/GEO plans must keep at least one primary page."});let a=s.some(i=>_a(i.cells[3])==="/");s.length+(a?0:1)>bn&&n.addIssue({code:"custom",path:["custom_payload","rows"],message:`Initial generation supports at most ${bn} primary pages including home.`}),s.forEach((i,r)=>{/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/.test(_a(i.cells[3]))||n.addIssue({code:"custom",path:["custom_payload","rows",r,"cells",3],message:"Primary intent pages must use root or one-segment kebab-case paths."})})}function Ea(t){return t.normalize("NFKC").trim().replace(/\s+/g," ").toLowerCase()}function Ml(t,n){let s=new Set;t.seo_keywords.forEach((i,r)=>{s.has(i.normalized_keyword)&&n.addIssue({code:"custom",path:["seo_keywords",r,"normalized_keyword"],message:"SEO keywords must be unique after Unicode normalization."}),s.add(i.normalized_keyword),(i.monthly_volume===null||i.monthly_volume<50)&&n.addIssue({code:"custom",path:["seo_keywords",r,"monthly_volume"],message:"Selected SEO keywords require monthly_volume >= 50."}),(i.keyword_difficulty===null||i.keyword_difficulty>45)&&n.addIssue({code:"custom",path:["seo_keywords",r,"keyword_difficulty"],message:"Selected SEO keywords require keyword_difficulty <= 45."}),(i.fit===null||i.fit<7)&&n.addIssue({code:"custom",path:["seo_keywords",r,"fit"],message:"Selected SEO keywords require fit >= 7.0."})});let a=new Set((t.semrush_snapshot_refs??[]).flatMap(i=>i.selected_keywords.map(Ea)));t.seo_keywords.forEach((i,r)=>{i.source==="semrush"&&!a.has(i.normalized_keyword)&&n.addIssue({code:"custom",path:["seo_keywords",r,"source"],message:"Semrush keywords must reference a persisted Semrush snapshot selection."})})}import{z as Ul}from"zod";var De=Ul.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 Kx(t,n){let s=De.safeParse(t),a=De.safeParse(n);if(!s.success||!a.success)return null;let i=Ia(s.data),r=Ia(a.data);for(let c=0;c<3;c+=1){let g=Ra(i.release[c],r.release[c]);if(g!==0)return g}if(!i.prerelease&&!r.prerelease)return 0;if(!i.prerelease)return 1;if(!r.prerelease)return-1;let _=Math.max(i.prerelease.length,r.prerelease.length);for(let c=0;c<_;c+=1){let g=i.prerelease[c],j=r.prerelease[c];if(g===void 0)return-1;if(j===void 0)return 1;if(g===j)continue;let E=/^\d+$/u.test(g),O=/^\d+$/u.test(j);return E&&O?Ra(BigInt(g),BigInt(j)):E?-1:O?1:Fl(g,j)}return 0}function Ia(t){let n=t.indexOf("+"),s=n===-1?t:t.slice(0,n),a=s.indexOf("-"),i=a===-1?s:s.slice(0,a),r=a===-1?void 0:s.slice(a+1),[_,c,g]=i.split(".");return{release:[BigInt(_),BigInt(c),BigInt(g)],...r?{prerelease:r.split(".")}:{}}}function Ra(t,n){return t<n?-1:t>n?1:0}function Fl(t,n){return t<n?-1:t>n?1:0}import{z as K}from"zod";import{z as be}from"zod";var xs=64,ql=512*1024,Es=4*1024*1024,Gl=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function Kl(t){return Gl.test(t)}var Ta=be.string().min(1).refine(Kl,{message:"Materialization pathTemplate must be a safe relative path."}),zl=be.object({pathTemplate:Ta,content:be.string(),role:be.string().min(1).optional()}).strict(),Bl=be.union([be.object({kind:be.literal("default")}).strict(),be.object({kind:be.literal("named"),name:be.string().min(1)}).strict()]),Wl=be.object({pathTemplate:Ta,export:Bl}).strict(),Vl=be.array(be.never()).optional(),at=be.object({instanceBaseName:be.string().min(1),files:be.array(zl).min(1).max(xs),entry:Wl,dataRequirements:Vl}).strict().superRefine((t,n)=>{let s=new Set,a=t.entry.pathTemplate,i=0;for(let[r,_]of t.files.entries()){s.has(_.pathTemplate)&&n.addIssue({code:"custom",path:["files",r,"pathTemplate"],message:`Duplicate materialization pathTemplate: ${_.pathTemplate}`}),s.add(_.pathTemplate);let c=new TextEncoder().encode(_.content).length;c>ql&&n.addIssue({code:"custom",path:["files",r,"content"],message:"Materialization file content exceeds the per-file byte limit."}),i+=c}s.has(a)||n.addIssue({code:"custom",path:["entry","pathTemplate"],message:"Materialization entry pathTemplate must match a file."}),i>Es&&n.addIssue({code:"custom",path:["files"],message:"Materialization exceeds the total content byte limit."})});var ka="insertNewComponent",$x={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"},Is=K.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),Pa=K.lazy(()=>K.object({id:K.string().uuid(),key:K.string().min(1),name:K.string(),children:K.array(Pa)}).strict()),Aa=K.object({category_group_key:K.literal(ka),categories:K.array(Pa)}).strict(),Hl=K.object({resource_id:K.string().min(1),name:K.string(),description:K.string().nullable(),thumbnail_url:K.string().nullable(),resolved_version:Is,category_id:K.string().uuid().nullable()}).strict(),wa=K.object({category_group_key:K.literal(ka),items:K.array(Hl),next_cursor:K.string().min(1).nullable()}).strict(),Yx=K.object({resource_id:K.string().min(1),resolved_version:Is,anchor_block_id:K.string().min(1),placement:K.enum(["before","after"])}).strict(),Xx=K.object({status:K.literal("mock_acknowledged")}).strict(),Zx=K.object({category_id:K.string().uuid().optional(),include_descendants:K.enum(["true","false"]).optional().transform(t=>t==="true"),limit:K.coerce.number().int().min(1).max(100).optional().default(20),cursor:K.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),ot=Is,Qx=K.object({version:ot}).strict(),va=K.object({resource_id:K.string().min(1),resolved_version:ot,revision_id:K.string().uuid().optional(),digest_sha256:K.string().regex(/^[a-f0-9]{64}$/),materialization:at}).strict();import{z as b}from"zod";import{z as y}from"zod";var Da="/",ja=255,$l=5e3,Yl=64;function Xl(t){if(!t.startsWith("/")||t.includes("//")||/[?#\\\s\u0000-\u001f\u007f]/u.test(t))return!1;try{let n=decodeURIComponent(t);return n.includes("//")||/[?#\\\s\u0000-\u001f\u007f]/u.test(n)||n.split("/").length!==t.split("/").length||/%25/iu.test(t)?!1:n.split("/").every(s=>![".",".."].includes(s))}catch{return!1}}var Rn=y.string().min(1).max(ja).refine(Xl,"url_path must be a safe site-relative path"),ks=y.string().max(ja),In=y.preprocess(t=>t===0?!1:t===1?!0:t,y.boolean()),Lt=y.union([y.url(),Rn]),Oa=y.enum(["landing_page","general_page","detail_page"]),Ps=y.enum([...Oa.options,"list_page","category_page","tag_page","author_page","search_page","date_page"]),Na=y.lazy(()=>y.object({cms_page_id:y.number().int().positive(),title:y.string().trim().min(1).max(255),url_path:ks,url:Lt.nullable(),page_type:Ps,vcp_managed:In,children:y.array(Na)}).strict()),Zl=y.object({group_id:y.string().min(1),title:y.string().trim().min(1).max(255),pages:y.array(Na)}).strict(),Ca=y.object({groups:y.array(Zl)}).strict(),La=y.lazy(()=>y.object({id:y.number().int().positive(),title:y.string().trim().min(1).max(120),url_path:ks,parent_id:y.number().int().nonnegative(),group_type:y.string().min(1),page_type:Ps,plugin_id:y.number().int().nonnegative(),is_default:In,is_published:In,url:Lt.nullable(),vcp_managed:In,children:y.array(La)})),Ql=y.object({plugin_id:y.number().int().nonnegative(),slug:y.string(),group_name:y.string().trim().min(1).max(255),pages:y.array(La)}).passthrough(),Jl=y.array(Ql);function Ma(t){return{cms_page_id:t.id,title:t.title,url_path:t.url_path,url:t.url,page_type:t.page_type,vcp_managed:t.vcp_managed,children:t.children.map(n=>Ma(n))}}function nE(t){if(!ep(t))return null;let n=Ca.safeParse(t);if(n.success)return n.data;let s=Jl.safeParse(t);if(!s.success)return null;let a=Ca.safeParse({groups:s.data.map(i=>({group_id:String(i.plugin_id),title:i.group_name,pages:i.pages.map(Ma)}))});return a.success?a.data:null}function ep(t){let n=Array.isArray(t)?t:Rs(t)&&Array.isArray(t.groups)?t.groups:[],s=[];for(let i of n)if(!(!Rs(i)||!Array.isArray(i.pages)))for(let r of i.pages)s.push({node:r,depth:1});let a=0;for(;s.length>0;){let i=s.pop();if(a+=1,a>$l||i.depth>Yl)return!1;if(!(!Rs(i.node)||!Array.isArray(i.node.children)))for(let r of i.node.children)s.push({node:r,depth:i.depth+1})}return!0}function Rs(t){return typeof t=="object"&&t!==null}var tp=y.enum(["invalid_url_path","missing_url","not_vcp_managed","unsupported_page_type"]),np=y.enum(["home_page","invalid_url_path","not_selectable","not_vcp_managed","page_has_children","last_selectable_page","cms_unbound","unsupported_page_type"]),Ua=y.lazy(()=>y.object({cms_page_id:y.number().int().positive().nullable(),title:y.string().trim().min(1).max(255),url_path:ks,url:Lt.nullable(),page_type:Ps,vcp_managed:y.boolean(),selectable:y.boolean(),disabled_reason:tp.nullable(),can_delete:y.boolean(),delete_block_reason:np.nullable(),has_cms_children:y.boolean(),children:y.array(Ua)}).strict()),Fa=y.object({group_id:y.string().min(1),title:y.string().trim().min(1).max(255),pages:y.array(Ua)}).strict(),sE=y.object({base_snapshot_id:x,expected_url_path:Rn}).strict(),sp=y.enum(["succeeded","failed"]),ip=y.object({url_path:Rn,phase:y.enum(["ensure","binding","delete"]),code:y.string().min(1),message:y.string().min(1)}).strict(),qa=y.object({status:sp,checked_count:y.number().int().nonnegative(),ensured_count:y.number().int().nonnegative(),deleted_count:y.number().int().nonnegative(),already_absent_count:y.number().int().nonnegative(),failed_pages:y.array(ip),warnings:y.array(y.string().min(1))}).strict(),ap=y.object({result_snapshot_id:x,deleted_files:y.array(y.string().min(1)),updated_files:y.array(y.string().min(1)),preserved_shared_files:y.array(y.string().min(1)),warnings:y.array(y.string().min(1)),next_url:Lt.nullable(),previous_url:Lt.nullable(),cms_reconcile_result:qa}).strict(),iE=y.object({code:y.literal(0),message:y.string(),data:ap}).strict(),aE=y.object({source_committed:y.boolean(),result_snapshot_id:x.optional(),cms_reconcile_result:qa.optional()}).strict().superRefine((t,n)=>{t.source_committed&&!t.result_snapshot_id&&n.addIssue({code:"custom",path:["result_snapshot_id"],message:"committed source requires result_snapshot_id"})}),op=Oa,Ga=y.object({url_path:Rn,title:y.string().trim().min(1).max(255),kind:op,route_file:y.string().min(1),collection_id:y.string().trim().min(1).optional()}).strict().superRefine((t,n)=>{t.kind==="detail_page"&&!t.collection_id&&n.addIssue({code:"custom",path:["collection_id"],message:"detail_page target requires collection_id"}),t.kind!=="detail_page"&&t.collection_id&&n.addIssue({code:"custom",path:["collection_id"],message:`${t.kind} target cannot have collection_id`}),t.kind==="landing_page"!=(t.url_path===Da)&&n.addIssue({code:"custom",path:["kind"],message:"The home target must be the only landing_page target."})}),rp=y.object({complete:y.literal(!0),targets:y.array(Ga)}).strict().superRefine((t,n)=>{t.targets.length<1&&n.addIssue({code:"too_small",minimum:1,inclusive:!0,origin:"array",path:["targets"],message:"A complete page target set must contain at least one page."}),t.targets.filter(a=>a.url_path===Da).length!==1&&n.addIssue({code:"custom",path:["targets"],message:"A complete page target set must contain exactly one home page."})}),oE=y.discriminatedUnion("complete",[rp,y.object({complete:y.literal(!1),targets:y.array(Ga),errors:y.array(y.string().min(1)).min(1)}).strict()]),Ts=y.string().regex(/^sha256:[0-9a-f]{64}$/),rE=y.object({projection_hash:Ts.nullable()}).strict(),cE=y.object({expected_projection_hash:Ts.nullable(),projection_hash:Ts}).strict();var Ka="insertNewPage",gE={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"},rt=b.enum(["page","pages"]),cp=b.object({resource_id:b.string().min(1),resource_type:rt,resolved_version:ot,template_page_id:b.string().min(1)}).strict(),za=b.lazy(()=>b.object({id:b.string().uuid(),key:b.string().min(1),name:b.string(),children:b.array(za)}).strict()),Ba=b.object({category_group_key:b.literal(Ka),categories:b.array(za)}).strict(),mp=b.object({resource_id:b.string().min(1),resource_type:rt,name:b.string(),description:b.string().nullable(),thumbnail_url:b.string().nullable(),resolved_version:ot,category_id:b.string().uuid().nullable()}).strict(),Wa=b.object({category_group_key:b.literal(Ka),items:b.array(mp),next_cursor:b.string().min(1).nullable()}).strict(),_E=b.object({category_id:b.string().uuid().optional(),include_descendants:b.enum(["true","false"]).optional().transform(t=>t==="true"),limit:b.coerce.number().int().min(1).max(100).optional().default(20),cursor:b.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),Mt=ot,Tn=b.string().regex(/^\/[a-z0-9]+(?:-[a-z0-9]+)*$/),hE=b.string().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),lp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:Tn}).strict(),pp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),source:cp.optional(),blocks:b.array(b.discriminatedUnion("kind",[b.object({kind:b.literal("package-component"),instance_id:b.string().min(1),component_id:b.string().min(1),label:b.string().trim().min(1).max(120)}).strict(),b.object({kind:b.literal("component-resource"),instance_id:b.string().min(1),resource_id:b.string().min(1),resolved_version:ot,label:b.string().trim().min(1).max(120)}).strict()])).optional(),route:b.object({input:b.string(),append_random_suffix:b.boolean().optional(),random_suffix_length:b.number().int().min(4).max(16).optional(),final:Tn}).strict()}).strict(),dp=b.object({resource_id:b.string().min(1),resource_type:rt,resolved_version:Mt,pages:b.array(pp).min(1)}).strict().superRefine((t,n)=>{Ve(t.pages.map(s=>s.template_page_id),"pages",n),Ve(t.pages.map(s=>s.route.final),"routes",n);for(let[s,a]of t.pages.entries()){if(!a.blocks)continue;let i=new Set;for(let[r,_]of a.blocks.entries())i.has(_.instance_id)&&n.addIssue({code:"custom",path:["pages",s,"blocks",r,"instance_id"],message:`Duplicate block instance identifier within page: ${_.instance_id}`}),i.add(_.instance_id)}});function As(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 Ve(t,n,s){let a=new Set;for(let[i,r]of t.entries())a.has(r)&&s.addIssue({code:"custom",path:[n,i],message:`Duplicate ${n} identifier: ${r}`}),a.add(r)}var SE=b.object({resource_type:rt,version:Mt,pages:b.array(lp).min(1)}).strict().superRefine((t,n)=>{As(t,n),Ve(t.pages.map(s=>s.template_page_id),"pages",n),Ve(t.pages.map(s=>s.final_route),"routes",n)}),up=b.object({instance_id:b.string().min(1),component_id:b.string().min(1)}).strict(),gp=b.object({component_id:b.string().min(1),materialization:at}).strict(),_p=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:Tn,materialization:at,components:b.array(up)}).strict(),ws=b.object({resource_id:b.string().min(1),resource_type:rt,resolved_version:Mt,revision_id:b.string().uuid().optional(),digest_sha256:b.string().regex(/^[a-f0-9]{64}$/),components:b.array(gp),pages:b.array(_p).min(1),project_dependencies:b.record(b.string(),b.never()).optional()}).strict().superRefine((t,n)=>{As(t,n);let s=t.components.map(i=>i.component_id),a=new Set(s);Ve(s,"components",n),Ve(t.pages.map(i=>i.template_page_id),"pages",n),Ve(t.pages.map(i=>i.final_route),"routes",n);for(let[i,r]of t.pages.entries()){let _=new Set;for(let[c,g]of r.components.entries())a.has(g.component_id)||n.addIssue({code:"custom",path:["pages",i,"components",c,"component_id"],message:`Unknown component reference: ${g.component_id}`}),_.has(g.instance_id)&&n.addIssue({code:"custom",path:["pages",i,"components",c,"instance_id"],message:`Duplicate component instance identifier within page: ${g.instance_id}`}),_.add(g.instance_id)}}),Va=ws,Ha=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:Tn,route_file_path:b.string().regex(/^app\/[a-z0-9]+(?:-[a-z0-9]+)*\/page\.tsx$/)}).strict(),hp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),composition_supported:b.boolean(),blocks:b.array(b.object({instance_id:b.string().min(1),component_id:b.string().min(1),label:b.string().trim().min(1).max(120)}).strict())}).strict(),$a=b.object({resource_id:b.string().min(1),resource_type:rt,resolved_version:Mt,pages:b.array(hp).min(1)}).strict().superRefine((t,n)=>{As(t,n),Ve(t.pages.map(s=>s.template_page_id),"pages",n)}),fE=b.object({resource_type:rt,version:Mt}).strict(),bE=b.object({draft:dp}).strict(),Ya=b.object({groups:b.array(Fa)}).strict(),Xa=b.object({candidate:b.record(b.string(),b.unknown())}).strict();var St="[a-z0-9]+(?:-[a-z0-9]+)*",Ut=new RegExp(`^/(?:${St}(?:/${St})*)?$`),Za=["/privacy","/cookie-policy"],Sp=Za.map(t=>`app/${t.slice(1)}/page.tsx`);function fp(t){return t.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Qa(t){return typeof t=="string"&&Ut.test(t)}function Ja(t){if(typeof t!="string")return null;let n=t.trim();if(/[^\x00-\x7F]/.test(n))return null;let s=n.replace(/^\/+|\/+$/g,"");if(s==="")return"/";let a=s.split("/");if(a.some(c=>c==="."||c===".."))return null;let i=s.toLowerCase();if(i==="index"||i==="home")return"/";let r=a.map(fp).filter(c=>c.length>0);if(r.length===0)return null;let _=`/${r.join("/")}`;return Qa(_)?_:null}function eo(t){let n=Ja(t);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function bp(t){let n=eo(t);return n==="/"?"app/page.tsx":`app/${n.slice(1)}/page.tsx`}import{z as X}from"zod";import{z as p}from"zod";import{z as Ae}from"zod";var yp=Ae.object({code:Ae.string().min(1),message:Ae.string().min(1)}),RE=Ae.object({code:Ae.string().min(1),message:Ae.string().min(1)});function vs(t){return Ae.object({ok:Ae.literal(!0),composition:L,data:t}).strict()}function xp(t){let n={ok:Ae.literal(!1),composition:L,error:yp.extend({code:t.codeSchema})};return t.currentSchema&&(n.current=t.currentSchema.optional()),t.diagnosticsSchema&&(n.diagnostics=Ae.array(t.diagnosticsSchema).optional()),t.dataSchema&&(n.data=t.dataSchema.optional()),Ae.object(n).strict()}function to(t){return Ae.discriminatedUnion("ok",[vs(t.dataSchema),xp({codeSchema:t.codeSchema,currentSchema:t.currentSchema,diagnosticsSchema:t.diagnosticsSchema,dataSchema:t.failureDataSchema})])}import{z as B}from"zod";var ct=B.object({start:B.number().int().nonnegative(),end:B.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"})}),Ep=B.object({code:B.enum(["missing-class-name","unsupported-attribute-name","source-locator-warning","invalid-new-attr","version-conflict","write-failed"]),message:B.string().min(1)}),no=B.object({path:B.string().min(1),content:B.string(),hash:B.string().min(1).optional()}),wE=B.object({composition:L,revision:B.string().min(1),entryCss:no,stylesheets:B.array(no).default([])}).strict(),vE=B.object({composition:se}).strict(),CE=B.object({key:B.string().min(1),composition:se}).strict(),so=B.object({key:B.string().min(1),composition:L,filePath:B.string().min(1),componentName:B.string().min(1),sourceKind:B.enum(["missing","stringLiteral","expression"]),attrRaw:B.string().min(1).nullable(),valueRaw:B.string().min(1).nullable(),attrRange:ct.nullable(),openingElementRange:ct,version:B.object({documentVersion:B.number().int().nonnegative(),contentHash:B.string().min(1)}),diagnostics:B.array(Ep),computedStyle:B.record(B.string(),B.string()).optional()}).strict().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"})}),DE=so,jE=vs(so),Cs=B.object({source:B.enum(["style-panel","class-source-editor"]),operation:B.enum(["replace-static-classname","replace-expression","create-attribute","remove-attribute"])});import{z as Ip}from"zod";var Ds=Ip.enum(["src","alt","poster","href","width","height"]);import{z as ft}from"zod";var Ft=ft.object({editingSessionId:ft.string().min(1),lockId:ft.string().min(1),ownerId:ft.string().min(1),leaseAssertion:ft.string().min(1)}).strict(),UE="signed-designer-mutations-v1",FE=ft.object({mutationContext:Ft}).strict();import{z as d}from"zod";import{z as qt}from"zod";var kn="::",js=qt.object({file:qt.string().min(1),component:qt.string().min(1),structuralPath:qt.string().min(1),key:qt.string().min(1)}).superRefine((t,n)=>{let s=Rp(t.file,t.component,t.structuralPath);t.key!==s&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function Rp(t,n,s){return`${t}${kn}${n}${kn}${s}`}function KE(t){let[n,s,...a]=t.split(kn);return!n||!s||a.length===0?null:{file:n,component:s,structuralPath:a.join(kn)}}var Pn=d.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"]),Gt=d.object({code:d.string().min(1),message:d.string().min(1)}).strict(),Tp=d.union([d.object({kind:d.literal("virtual-route-root"),key:d.string().min(1)}).strict(),d.object({kind:d.literal("jsx-container"),key:d.string().min(1),sourceMemberKey:d.string().min(1),sourceFile:d.string().min(1),componentName:d.string().min(1).optional()}).strict(),d.object({kind:d.literal("starter-placeholder"),key:d.string().min(1),sourceFile:d.string().min(1).optional()}).strict()]),kp=d.object({key:d.string().min(1),kind:d.enum(["jsx-element","jsx-fragment","jsx-expression","null-return","starter-placeholder"]),containerKey:d.string().min(1),label:d.string().min(1),sourceFile:d.string().min(1).optional(),isAtomic:d.boolean()}).strict(),Pp=d.object({key:d.string().min(1),sourceMemberKey:d.string().min(1),containerKey:d.string().min(1),label:d.string().min(1),isIndependent:d.boolean()}).strict(),Ap=d.object({key:d.string().min(1),containerKey:d.string().min(1),businessMemberKeys:d.array(d.string().min(1)),isMultiMember:d.boolean()}).strict(),ao=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:se}).strict(),wp=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:L,placementUnitKey:d.string().min(1),relation:d.enum(["before","after","prepend","append"])}).strict(),oo=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:se,placementUnitKey:d.string().min(1),relation:d.enum(["before","after","prepend","append"])}).strict(),ro=d.object({kind:d.literal("page-unit"),composition:se,placementUnitKey:d.string().min(1)}).strict(),co=d.object({kind:d.literal("page-unit"),composition:L,placementUnitKey:d.string().min(1)}).strict();function qe(t,n,s,a,i){let r=new Set;for(let[_,c]of t.entries()){let g=a(c);r.has(g)&&n.addIssue({code:"custom",path:[s,_,i],message:`Duplicate ${s} key: ${g}`}),r.add(g)}}var vp=d.object({status:d.literal("supported"),version:d.number().int().nonnegative(),composition:L,container:Tp,sourceMembers:d.array(kp),businessMembers:d.array(Pp),placementUnits:d.array(Ap),placements:d.array(wp)}).strict().superRefine((t,n)=>{qe(t.sourceMembers,n,"sourceMembers",c=>c.key,"key"),qe(t.businessMembers,n,"businessMembers",c=>c.key,"key"),qe(t.placementUnits,n,"placementUnits",c=>c.key,"key"),qe(t.placements,n,"placements",c=>c.placementKey,"placementKey");let s=new Set(t.sourceMembers.map(c=>c.key)),a=new Set(t.placementUnits.map(c=>c.key)),i=new Map(t.sourceMembers.map(c=>[c.key,c])),r=new Map(t.businessMembers.map(c=>[c.key,c]));for(let[c,g]of t.sourceMembers.entries()){g.containerKey!==t.container.key&&!s.has(g.containerKey)&&n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member parent must reference the page container or another source member."}),g.containerKey===g.key&&n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member cannot contain itself."});let j=new Set([g.key]),E=g.containerKey;for(;E!==t.container.key;){if(j.has(E)){n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member hierarchy must be acyclic."});break}j.add(E);let O=i.get(E);if(!O)break;E=O.containerKey}}t.container.kind==="jsx-container"&&!s.has(t.container.sourceMemberKey)&&n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."});for(let[c,g]of t.businessMembers.entries())s.has(g.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",c,"sourceMemberKey"],message:"Business member must reference a source member."}),a.has(g.containerKey)||n.addIssue({code:"custom",path:["businessMembers",c,"containerKey"],message:"Business member must reference a placement unit container."});for(let[c,g]of t.placementUnits.entries()){let j=i.get(g.containerKey);j?j.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 E=new Set;for(let[O,F]of g.businessMemberKeys.entries()){let q=r.get(F);if(!q){n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Placement unit must reference existing business members."});continue}E.has(F)&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Placement unit cannot reference the same business member twice."}),E.add(F),q.containerKey!==g.key&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Business member containerKey must match its placement unit."});let J=q.sourceMemberKey,ne=new Set;for(;J&&J!==g.containerKey&&!ne.has(J);)ne.add(J),J=i.get(J)?.containerKey;J!==g.containerKey&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Placement unit business members must belong to its source subtree."})}}for(let[c,g]of t.businessMembers.entries())t.placementUnits.find(E=>E.key===g.containerKey)?.businessMemberKeys.includes(g.key)||n.addIssue({code:"custom",path:["businessMembers",c,"containerKey"],message:"Business member must be listed by its placement unit container."});let _=new Map;for(let c of t.placementUnits)_.set(c.containerKey,(_.get(c.containerKey)??0)+1);for(let[c,g]of t.sourceMembers.entries())g.containerKey===t.container.key&&_.get(g.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,g]of t.placements.entries())po(g.composition,t.composition)||n.addIssue({code:"custom",path:["placements",c,"composition"],message:"Page placement composition must match page composition."}),g.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",c,"documentVersion"],message:"Page placement version must match page composition version."}),a.has(g.placementUnitKey)||n.addIssue({code:"custom",path:["placements",c,"placementUnitKey"],message:"Placement option must reference an existing placement unit."})}),Cp=d.object({status:d.literal("unsupported"),version:d.number().int().nonnegative(),composition:L,reason:Pn,diagnostics:d.array(Gt)}).strict(),Dp=d.discriminatedUnion("status",[vp,Cp]),mo=2,HE="page-composition-v2",lo=d.object({start:d.number().int().nonnegative(),end:d.number().int().nonnegative(),startLine:d.number().int().positive().optional(),startColumn:d.number().int().nonnegative().optional(),endLine:d.number().int().positive().optional(),endColumn:d.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 s=[t.startLine,t.startColumn,t.endLine,t.endColumn],a=s.some(r=>r!==void 0),i=s.every(r=>r!==void 0);a&&!i&&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."})}),jp=d.object({key:d.string().min(1),instanceIndex:d.number().int().nonnegative().optional(),instanceCount:d.number().int().positive().optional(),textSegmentIndex:d.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."})}),Op=d.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),Np=d.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),Lp=d.discriminatedUnion("kind",[d.object({kind:d.literal("virtual-route-root"),key:d.null(),routeReturn:d.object({sourceIdentity:js,sourceRange:lo}).strict()}).strict(),d.object({kind:d.literal("jsx-container"),key:d.string().min(1),sourceMemberKey:d.string().min(1)}).strict(),d.object({kind:d.literal("starter-placeholder"),key:d.string().min(1),sourceMemberKey:d.string().min(1),replacementMode:d.literal("replace")}).strict()]),Mp=d.object({key:d.string().min(1),kind:Op,parentKey:d.string().min(1).nullable(),childKeys:d.array(d.string().min(1)),order:d.number().int().nonnegative(),label:d.string().min(1),sourceIdentity:js,sourceRange:lo.nullable(),atomicKind:Np}).strict().superRefine((t,n)=>{let s=t.kind==="component-call"||t.kind==="native-jsx"?"none":t.kind;t.atomicKind!==s&&n.addIssue({code:"custom",path:["atomicKind"],message:`atomicKind must be ${s} for ${t.kind}.`});let a=new Set;for(let[i,r]of t.childKeys.entries())a.has(r)&&n.addIssue({code:"custom",path:["childKeys",i],message:`Duplicate child source member key: ${r}`}),a.add(r)}),Up=d.object({key:d.string().min(1),sourceMemberKey:d.string().min(1),placementUnitKey:d.string().min(1),label:d.string().min(1),isIndependent:d.boolean()}).strict(),Fp=d.enum(["independent","atomic","container"]),qp=d.object({key:d.string().min(1),containerKey:d.string().min(1).nullable(),sourceMemberKeys:d.array(d.string().min(1)).min(1),businessMemberKeys:d.array(d.string().min(1)),order:d.number().int().nonnegative(),boundaryMode:Fp,isIndependent:d.boolean(),isMultiMember:d.boolean()}).strict().superRefine((t,n)=>{io(t.sourceMemberKeys,n,"sourceMemberKeys","source member"),io(t.businessMemberKeys,n,"businessMemberKeys","business member");let s=t.sourceMemberKeys.length>1||t.businessMemberKeys.length>1;t.isMultiMember!==s&&n.addIssue({code:"custom",path:["isMultiMember"],message:"isMultiMember must reflect the source and business member cardinality."});let a=t.boundaryMode==="independent";t.isIndependent!==a&&n.addIssue({code:"custom",path:["isIndependent"],message:"isIndependent must match boundaryMode."})}),Gp=d.enum(["before","after","prepend","append","replace"]),Kp=d.enum(["insert-sibling","insert-child","replace-placeholder"]),zp=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:L,placementUnitKey:d.string().min(1),containerKey:d.string().min(1).nullable(),relation:Gp,writeMode:Kp}).strict().superRefine((t,n)=>{let s=t.relation==="before"||t.relation==="after"?"insert-sibling":t.relation==="prepend"||t.relation==="append"?"insert-child":"replace-placeholder";t.writeMode!==s&&n.addIssue({code:"custom",path:["writeMode"],message:`writeMode must be ${s} for ${t.relation}.`})}),Bp=d.object({key:d.string().min(1),placementUnitKey:d.string().min(1),runtimeRefs:d.array(jp).min(1)}).strict(),Wp=d.object({schemaVersion:d.literal(mo),status:d.literal("supported"),version:d.number().int().nonnegative(),composition:L,container:Lp,sourceMembers:d.array(Mp),businessMembers:d.array(Up),placementUnits:d.array(qp),placements:d.array(zp),visualAnchors:d.array(Bp).optional(),diagnostics:d.array(Gt)}).strict().superRefine((t,n)=>{$p(t,n)}),Vp=d.object({schemaVersion:d.literal(mo),status:d.literal("unsupported"),version:d.number().int().nonnegative(),composition:L,reason:Pn,diagnostics:d.array(Gt)}).strict(),Hp=d.discriminatedUnion("status",[Wp,Vp]),$E=d.union([Hp,Dp]);function io(t,n,s,a){let i=new Set;for(let[r,_]of t.entries())i.has(_)&&n.addIssue({code:"custom",path:[s,r],message:`Duplicate ${a} key: ${_}`}),i.add(_)}function po(t,n){return ms(t)===ms(n)}function $p(t,n){qe(t.sourceMembers,n,"sourceMembers",E=>E.key,"key"),qe(t.businessMembers,n,"businessMembers",E=>E.key,"key"),qe(t.placementUnits,n,"placementUnits",E=>E.key,"key"),qe(t.placements,n,"placements",E=>E.placementKey,"placementKey"),qe(t.visualAnchors??[],n,"visualAnchors",E=>E.key,"key"),Yp(t,n);let s=new Map(t.sourceMembers.map(E=>[E.key,E])),a=new Map(t.businessMembers.map(E=>[E.key,E])),i=new Map(t.placementUnits.map(E=>[E.key,E]));Xp(t,s,n),t.container.kind!=="virtual-route-root"&&(s.has(t.container.sourceMemberKey)||n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."}));let r=new Map,_=new Map,c=new Set;for(let[E,O]of t.placementUnits.entries()){O.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",E,"containerKey"],message:"Placement unit containerKey must match the page container."});let F=`${O.containerKey??"<virtual>"}:${O.order}`;c.has(F)&&n.addIssue({code:"custom",path:["placementUnits",E,"order"],message:"Placement unit order must be unique within its container."}),c.add(F);for(let[q,J]of O.sourceMemberKeys.entries()){s.has(J)||n.addIssue({code:"custom",path:["placementUnits",E,"sourceMemberKeys",q],message:"Placement unit must reference existing source members."});let ne=r.get(J);ne&&ne!==O.key&&n.addIssue({code:"custom",path:["placementUnits",E,"sourceMemberKeys",q],message:`Source member is already assigned to ${ne}.`}),r.set(J,O.key)}for(let[q,J]of O.businessMemberKeys.entries()){let ne=a.get(J);if(!ne){n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",q],message:"Placement unit must reference existing business members."});continue}ne.placementUnitKey!==O.key&&n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",q],message:"Placement unit and business member must reference each other."}),O.sourceMemberKeys.includes(ne.sourceMemberKey)||n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",q],message:"Business member sourceMemberKey must belong to the placement unit."});let wt=_.get(J);wt&&wt!==O.key&&n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",q],message:`Business member is already assigned to ${wt}.`}),_.set(J,O.key)}}for(let[E,O]of t.businessMembers.entries()){s.has(O.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",E,"sourceMemberKey"],message:"Business member must reference a source member."});let F=i.get(O.placementUnitKey);if(!F){n.addIssue({code:"custom",path:["businessMembers",E,"placementUnitKey"],message:"Business member must reference a placement unit."});continue}F.businessMemberKeys.includes(O.key)||n.addIssue({code:"custom",path:["businessMembers",E,"placementUnitKey"],message:"Business member and placement unit must reference each other."}),F.sourceMemberKeys.includes(O.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",E,"sourceMemberKey"],message:"Business member sourceMemberKey must belong to its placement unit."});let q=F.isIndependent&&F.businessMemberKeys.length===1;O.isIndependent!==q&&n.addIssue({code:"custom",path:["businessMembers",E,"isIndependent"],message:"Business member independence must match its placement unit boundary."})}let g=new Set;for(let[E,O]of t.placements.entries()){O.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",E,"documentVersion"],message:"Page placement version must match page composition version."}),po(O.composition,t.composition)||n.addIssue({code:"custom",path:["placements",E,"composition"],message:"Page placement composition must match page composition."});let F=i.get(O.placementUnitKey);F?O.containerKey!==F.containerKey&&n.addIssue({code:"custom",path:["placements",E,"containerKey"],message:"Placement containerKey must match its placement unit."}):n.addIssue({code:"custom",path:["placements",E,"placementUnitKey"],message:"Placement option must reference a placement unit."});let q=`${O.placementUnitKey}:${O.relation}`;g.has(q)&&n.addIssue({code:"custom",path:["placements",E,"relation"],message:"A placement unit cannot expose the same relation more than once."}),g.add(q),O.relation==="replace"&&t.container.kind!=="starter-placeholder"&&n.addIssue({code:"custom",path:["placements",E,"relation"],message:"replace is only valid for a starter placeholder container."}),t.container.kind==="starter-placeholder"&&O.relation!=="replace"&&n.addIssue({code:"custom",path:["placements",E,"relation"],message:"Starter placeholder placements must use replace."})}let j=new Set;for(let[E,O]of(t.visualAnchors??[]).entries())i.has(O.placementUnitKey)||n.addIssue({code:"custom",path:["visualAnchors",E,"placementUnitKey"],message:"Visual anchor must reference a placement unit."}),j.has(O.placementUnitKey)&&n.addIssue({code:"custom",path:["visualAnchors",E,"placementUnitKey"],message:"A placement unit may expose only one visual anchor."}),j.add(O.placementUnitKey)}function Yp(t,n){let s=[];t.container.key!==null&&s.push({key:t.container.key,path:["container","key"],namespace:"container"});for(let[i,r]of t.sourceMembers.entries())s.push({key:r.key,path:["sourceMembers",i,"key"],namespace:"source member"});for(let[i,r]of t.businessMembers.entries())s.push({key:r.key,path:["businessMembers",i,"key"],namespace:"business member"});for(let[i,r]of t.placementUnits.entries())s.push({key:r.key,path:["placementUnits",i,"key"],namespace:"placement unit"});for(let[i,r]of(t.visualAnchors??[]).entries())s.push({key:r.key,path:["visualAnchors",i,"key"],namespace:"visual anchor"});let a=new Map;for(let i of s){let r=a.get(i.key);r?n.addIssue({code:"custom",path:i.path,message:`${i.namespace} key collides with ${r}: ${i.key}`}):a.set(i.key,i.namespace)}}function Xp(t,n,s){let a=new Set;for(let[i,r]of t.sourceMembers.entries()){let _=`${r.parentKey??"<root>"}:${r.order}`;if(a.has(_)&&s.addIssue({code:"custom",path:["sourceMembers",i,"order"],message:"Source member order must be unique among siblings."}),a.add(_),r.parentKey===r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member cannot be its own parent."}),r.parentKey!==null){let j=n.get(r.parentKey);j?j.childKeys.includes(r.key)||s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member parentKey must reference a source member."})}for(let[j,E]of r.childKeys.entries()){if(E===r.key){s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source member cannot be its own child."});continue}let O=n.get(E);O?O.parentKey!==r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source child key must reference a source member."})}let c=new Set,g=r;for(;g;){if(c.has(g.key)){s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member graph must be acyclic."});break}c.add(g.key),g=g.parentKey===null?void 0:n.get(g.parentKey)}}}var Kt=p.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","delete-page-source"]),uo=p.lazy(()=>p.union([p.string(),p.number(),p.boolean(),p.null(),p.array(uo),p.record(p.string(),uo)])),Zp=p.discriminatedUnion("kind",[p.object({kind:p.literal("node"),key:p.string().min(1)}).strict(),ro,p.object({kind:p.literal("route"),composition:se}).strict(),p.object({kind:p.literal("source-file"),path:le}).strict(),p.object({kind:p.literal("source-batch"),paths:p.array(le).min(1)}).superRefine((t,n)=>{let s=new Set;for(let[a,i]of t.paths.entries())s.has(i)&&n.addIssue({code:"custom",path:["paths",a],message:`Duplicate source target path: ${i}`}),s.add(i)}).strict(),p.object({kind:p.literal("project")}).strict()]),Qp=p.discriminatedUnion("kind",[p.object({kind:p.literal("node"),key:p.string().min(1)}).strict(),co,p.object({kind:p.literal("route"),composition:L}).strict(),p.object({kind:p.literal("source-file"),path:le}).strict(),p.object({kind:p.literal("source-batch"),paths:p.array(le).min(1)}).strict(),p.object({kind:p.literal("project")}).strict()]),_o=p.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"]),ho=p.enum(["hover","active","focus","disabled"]),So=p.enum(["sm","md","lg","xl","2xl"]),go=p.union([p.object({relation:p.enum(["before","after"]),anchorKey:p.string().min(1)}),p.object({relation:p.enum(["prepend","append"]),parentKey:p.string().min(1)}),oo]),Jp=p.union([p.object({kind:p.literal("native-tag"),tag:p.string().min(1),text:p.string().optional()}),p.object({kind:p.literal("component-call"),component:p.object({source:p.string().min(1),exportName:p.string().min(1)}),materialization:p.never().optional(),props:p.record(p.string(),p.unknown()).optional()}).strict(),p.object({kind:p.literal("component-call"),component:p.never().optional(),materialization:at,props:p.record(p.string(),p.never()).optional()}).strict()]),ed=p.discriminatedUnion("kind",[p.object({kind:p.literal("update-text"),segmentIndex:p.number().int().min(0),value:p.string()}),p.object({kind:p.literal("update-array-item"),segmentIndex:p.number().int().min(0),index:p.number().int().min(0),value:p.string()}),p.object({kind:p.literal("remove-node")}),p.object({kind:p.literal("insert-child"),node:Jp,position:p.union([go,ao])}),p.object({kind:p.literal("move-node"),target:go,preserveBindings:p.boolean().optional()}),p.object({kind:p.literal("set-class-name-source"),filePath:p.string().min(1),expectedVersion:p.object({documentVersion:p.number().int().nonnegative(),contentHash:p.string().min(1)}),oldAttrRaw:p.string().min(1).nullable(),oldAttrRange:ct.nullable(),openingElementRange:ct,newAttrRaw:p.string().min(1).nullable(),intent:Cs}),p.object({kind:p.literal("set-props"),props:p.partialRecord(Ds,p.string())}),p.object({kind:p.literal("apply-style-draft"),className:p.object({filePath:p.string().min(1),expectedVersion:p.object({documentVersion:p.number().int().nonnegative(),contentHash:p.string().min(1)}),oldAttrRaw:p.string().min(1).nullable(),oldAttrRange:ct.nullable(),openingElementRange:ct,newAttrRaw:p.string().min(1).nullable(),intent:Cs}).optional(),props:p.partialRecord(Ds,p.string()).optional()}).superRefine((t,n)=>{!t.className&&!t.props&&n.addIssue({code:"custom",message:"apply-style-draft requires className or props"})}),p.object({kind:p.literal("source-edit"),conflictPolicy:p.enum(["compare-and-swap","overwrite"]),edits:p.array(p.discriminatedUnion("operation",[p.object({operation:p.literal("upsert"),path:le,content:p.string(),baseContentHash:p.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{ps(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"})}),p.object({operation:p.literal("delete"),path:le,capability:aa,confirmDelete:p.literal(!0),confirmPath:le,baseContentHash:p.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{t.capability!==ls&&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"}),ps(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit delete only accepts allowlisted text source files"});let s=ds(t.path);s&&n.addIssue({code:"custom",path:["path"],message:`Protected source file cannot be deleted: ${t.path} (${s})`})})])).min(1),reason:p.string().min(1).optional()}).strict().superRefine((t,n)=>{let s=new Set;for(let[a,i]of t.edits.entries())s.has(i.path)&&n.addIssue({code:"custom",path:["edits",a,"path"],message:`Duplicate source edit path: ${i.path}`}),s.add(i.path),t.conflictPolicy==="compare-and-swap"&&i.baseContentHash===void 0&&n.addIssue({code:"custom",path:["edits",a,"baseContentHash"],message:"source-edit compare-and-swap requires baseContentHash for every edit"})}),p.object({kind:p.literal("insert-page-resource"),artifact:ws}).strict(),p.object({kind:p.literal("delete-page-source"),expectedUrlPath:p.string().startsWith("/")}).strict()]),fo=p.enum(["NODE_NOT_FOUND","HOME_PAGE_LOCKED","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"]),bo=p.object({code:fo,message:p.string().min(1),details:p.record(p.string(),p.unknown()).optional()}),yo=p.object({key:p.string().min(1),instanceIndex:p.number().int().nonnegative().optional(),instanceCount:p.number().int().positive().optional()}),Os=p.object({id:p.string().min(1),siteId:I,baseSnapshotId:x,composition:se,kind:Kt,target:Zp,documentVersion:p.number().int().nonnegative(),selectionRef:yo.optional(),mutationContext:Ft.optional(),params:ed}).strict().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 s=t.params.edits.map(i=>i.path),a=t.target.kind==="source-file"?[t.target.path]:t.target.paths;id(s,a)||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.kind==="delete-page-source"?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 or delete-page-source"}),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"})}),rI=Os,td=p.object({kind:p.literal("insert-page-resource"),package_instance_id:p.string().min(1),pages:p.array(Ha).min(1)}).strict().superRefine((t,n)=>{let s=new Set,a=new Set;for(let[i,r]of t.pages.entries())s.has(r.template_page_id)&&n.addIssue({code:"custom",path:["pages",i,"template_page_id"],message:`Duplicate template page route mapping: ${r.template_page_id}`}),a.has(r.final_route)&&n.addIssue({code:"custom",path:["pages",i,"final_route"],message:`Duplicate final route mapping: ${r.final_route}`}),s.add(r.template_page_id),a.add(r.final_route)}),nd=p.object({kind:p.literal("delete-page-source"),deleted_files:p.array(p.string().min(1)),updated_files:p.array(p.string().min(1)),preserved_shared_files:p.array(p.string().min(1)),warnings:p.array(p.string().min(1))}).strict(),sd=p.discriminatedUnion("kind",[td,nd]),xo=p.object({requestId:p.string().min(1),kind:Kt,composition:L,target:Qp,resultVersion:p.number().int().nonnegative(),affectedFiles:p.array(p.string().min(1)).optional(),selectionRef:yo.optional(),output:sd.optional()}).strict(),Ns=xo.superRefine((t,n)=>{let s=t.kind==="insert-page-resource"||t.kind==="delete-page-source";s&&t.target.kind!=="project"?n.addIssue({code:"custom",path:["target","kind"],message:`${t.kind} result requires a project target`}):!s&&t.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project result target requires a project operation"}),s&&!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"})}),cI=to({dataSchema:Ns,codeSchema:fo,failureDataSchema:xo.partial()});function id(t,n){return t.length===n.length&&t.every((s,a)=>s===n[a])}var ad=X.enum(["component","page","pages"]),od=X.object({resource_kind:ad,resource_name:X.string().trim().min(1).max(200),file_count:X.number().int().min(1).max(64),total_bytes:X.number().int().min(0).max(4*1024*1024),content_digest:X.string().regex(/^sha256:[a-f0-9]{64}$/),custom_prompt:X.string().trim().min(1).max(4e3).optional(),final_routes:X.array(X.string().min(1)).max(64)}).strict(),rd=X.discriminatedUnion("kind",[X.object({kind:X.literal("none")}).strict(),X.object({kind:X.literal("primary"),items:X.array(X.object({label:X.string().trim().min(1).max(120),href:X.string().startsWith("/").max(200)}).strict()).min(1).max(64)}).strict().superRefine((t,n)=>{let s=new Set;for(let[a,i]of t.items.entries())s.has(i.href)&&n.addIssue({code:"custom",path:["items",a,"href"],message:`Duplicate navigation href: ${i.href}`}),s.add(i.href)})]),cd=X.object({base_snapshot_id:X.string().min(1),operation:Os,navigation_selection:rd.optional()}).strict().superRefine((t,n)=>{t.base_snapshot_id!==t.operation.baseSnapshotId&&n.addIssue({code:"custom",path:["operation","baseSnapshotId"],message:"Resource operation baseSnapshotId must match base_snapshot_id."})});function md(t){return t.kind==="insert-child"&&t.params.kind==="insert-child"&&t.params.node.kind==="component-call"&&"materialization"in t.params.node&&t.params.node.materialization?[t.params.node.materialization]:t.kind==="insert-page-resource"&&t.params.kind==="insert-page-resource"?[...t.params.artifact.components.map(n=>n.materialization),...t.params.artifact.pages.map(n=>n.materialization)]:[]}var Eo=X.object({id:X.string().min(1),tenant_id:X.string().min(1),site_id:X.string().min(1),run_id:X.string().min(1).optional(),correlation_id:X.string().min(1).optional(),sent_at:X.string().min(1),type:X.literal("client.resource.operation.create"),payload:X.object({client_message_id:X.string().min(1),display:od,transient_resource_input:cd}).strict()}).strict().superRefine((t,n)=>{let{display:s,transient_resource_input:a}=t.payload;t.site_id!==a.operation.siteId&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","siteId"],message:"Resource operation siteId must match envelope site_id."});let i=s.resource_kind==="component"?"insert-child":"insert-page-resource";a.operation.kind!==i&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","kind"],message:`${s.resource_kind} resources require ${i}.`});let _=md(a.operation).flatMap(g=>g.files),c=_.reduce((g,j)=>g+new TextEncoder().encode(j.content).byteLength,0);if(_.length>xs&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate file count limit."}),c>Es&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate content byte limit."}),s.file_count!==_.length&&n.addIssue({code:"custom",path:["payload","display","file_count"],message:"Resource summary file_count must match the transient operation."}),s.total_bytes!==c&&n.addIssue({code:"custom",path:["payload","display","total_bytes"],message:"Resource summary total_bytes must match the transient operation."}),a.operation.kind==="insert-page-resource"&&a.operation.params.kind==="insert-page-resource"){let g=a.operation.params.artifact;g.resource_type!==s.resource_kind&&n.addIssue({code:"custom",path:["payload","display","resource_kind"],message:"Resource summary kind must match the page artifact resource_type."});let j=g.pages.map(E=>E.final_route);(j.length!==s.final_routes.length||j.some((E,O)=>E!==s.final_routes[O]))&&n.addIssue({code:"custom",path:["payload","display","final_routes"],message:"Resource summary final_routes must match the page artifact routes."})}if(a.navigation_selection?.kind==="primary"){let g=new Set(s.final_routes);for(let[j,E]of a.navigation_selection.items.entries())g.has(E.href)||n.addIssue({code:"custom",path:["payload","transient_resource_input","navigation_selection","items",j,"href"],message:"Navigation selection href must reference a final resource route."})}});import{z as T}from"zod";var ld=["with_website","without_website"],An=T.enum(ld),Ls=T.string().trim().url().refine(t=>{let n=new URL(t).protocol;return n==="http:"||n==="https:"},{message:"Website must use the http or https protocol."}),pd=["welcome","website_scan","customer_materials","analysis","diagnosis","strategy","structure_planning","preview_personalization","publishing"],zt=T.enum(pd),dd=["company_info","website_crawl","website_basic_info_extract","website_metrics_evaluate","intelligent_analysis","strategy_recommendation"],Ro=T.enum(dd),ud=["started","running","succeeded","failed","invalidated"],To=T.enum(ud),gd=["draft","structure_saved","generating","workspace_ready"],Ms=T.enum(gd),_d=["not_deployed","deploying","deployed"],Us=T.enum(_d),hd=["active","completed"],Sd=T.enum(hd),fd=["completed","current","locked"],bd=T.enum(fd),ko={draft:10,structure_saved:20,generating:30,workspace_ready:40},Po={not_deployed:10,deploying:20,deployed:30},Ao={active:10,completed:20},wo={started:10,running:20,succeeded:30,failed:40,invalidated:50};function wn(t){return new Map(Object.entries(t).map(([n,s])=>[s,n]))}var yd=wn(ko),xd=wn(Po),Ed=wn(Ao),Id=wn(wo);function fI(t){let n=yd.get(t);if(!n)throw new Error(`Unknown site build status code: ${t}`);return n}function bI(t){let n=xd.get(t);if(!n)throw new Error(`Unknown site deployment status code: ${t}`);return n}function yI(t){let n=Ed.get(t);if(!n)throw new Error(`Unknown site workflow status code: ${t}`);return n}function xI(t){let n=Id.get(t);if(!n)throw new Error(`Unknown task execution status code: ${t}`);return n}function EI(t){return ko[t]}function II(t){return Po[t]}function RI(t){return Ao[t]}function TI(t){return wo[t]}var Fs=[{definition_version:1,published:!0,required_client_capability:null,definitions:{with_website:[{id:"01900000-0000-7000-8000-000000000001",node_code:"welcome",label:"\u6B22\u8FCE\u542F\u52A8",sort_order:1,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000002",node_code:"website_scan",label:"\u521D\u59CB\u5316\u9700\u6C42\u4E0E\u5B98\u7F51\u626B\u63CF",sort_order:2,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000003",node_code:"analysis",label:"\u667A\u80FD\u5206\u6790",sort_order:3,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000004",node_code:"diagnosis",label:"\u8BCA\u65AD\u62A5\u544A",sort_order:4,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000005",node_code:"strategy",label:"\u7B56\u7565\u4E0E\u5EFA\u8BAE",sort_order:5,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000014",node_code:"structure_planning",label:"\u7ED3\u6784\u89C4\u5212",sort_order:6,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000015",node_code:"preview_personalization",label:"\u9884\u89C8\u4E0E\u4E2A\u6027\u5316",sort_order:7,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000016",node_code:"publishing",label:"\u7F51\u7AD9\u53D1\u5E03",sort_order:8,is_enabled:!0}],without_website:[{id:"01900000-0000-7000-8000-00000000000b",node_code:"welcome",label:"\u6B22\u8FCE\u542F\u52A8",sort_order:1,is_enabled:!0},{id:"01900000-0000-7000-8000-00000000000c",node_code:"customer_materials",label:"\u5BA2\u6237\u8D44\u6599\u63D0\u4F9B",sort_order:2,is_enabled:!0},{id:"01900000-0000-7000-8000-00000000000d",node_code:"analysis",label:"\u667A\u80FD\u5206\u6790",sort_order:3,is_enabled:!0},{id:"01900000-0000-7000-8000-00000000000e",node_code:"strategy",label:"\u7B56\u7565\u4E0E\u5EFA\u8BAE",sort_order:4,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000017",node_code:"structure_planning",label:"\u7ED3\u6784\u89C4\u5212",sort_order:5,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000018",node_code:"preview_personalization",label:"\u9884\u89C8\u4E0E\u4E2A\u6027\u5316",sort_order:6,is_enabled:!0},{id:"01900000-0000-7000-8000-000000000019",node_code:"publishing",label:"\u7F51\u7AD9\u53D1\u5E03",sort_order:7,is_enabled:!0}]}}],kI=Fs[0].definitions,vo=T.number().int().min(1),Rd=T.object({id:G,flow_type:An,definition_version:vo,node_code:zt,label:T.string().min(1),sort_order:T.number().int().min(1),is_enabled:T.boolean(),state:bd}),Co=T.object({id:Zi,tenant_id:T.string().min(1),site_id:I,workflow_id:Oe,node_code:zt,task_type:Ro,external_task_id:T.string().min(1),execution_status:To,idempotency_key:T.string().min(1),attempt_no:T.number().int().min(1),superseded_at:T.string().min(1).nullable(),created_at:T.string().min(1),updated_at:T.string().min(1)}),Td=T.object({id:Oe,tenant_id:T.string().min(1),site_id:I,flow_type:An,website:Ls.nullable(),definition_version:vo,current_node_code:zt,status:Sd,started_at:T.string().min(1),completed_at:T.string().min(1).nullable(),created_at:T.string().min(1),updated_at:T.string().min(1)}),qs=T.object({workflow:Td,menu:T.array(Rd),task_refs:T.array(Co),site:T.object({default_locale:pe.optional(),status:Ms,deployment_status:Us,archived_at:T.string().min(1).nullable(),current_sitemap_id:T.string().nullable().optional(),current_sitemap_version:T.number().int().positive().nullable().optional(),confirmed_sitemap_id:T.string().nullable().optional(),confirmed_sitemap_version:T.number().int().positive().nullable().optional(),structure_confirmed_at:T.string().min(1).nullable().optional(),current_snapshot_id:T.string().nullable(),deployed_url:T.string().url().nullable(),cms_site_id:T.string().min(1).nullish()})}),PI=M(qs),AI=M(Co),Io=T.array(T.string().min(1).max(64)).max(16).optional(),wI=T.discriminatedUnion("flow_type",[T.object({flow_type:T.literal("with_website"),website:Ls,client_capabilities:Io}).strict(),T.object({flow_type:T.literal("without_website"),website:T.null().optional(),client_capabilities:Io}).strict()]),vI=T.object({expected_current_node:T.literal("website_scan"),website:Ls}).strict(),CI=T.object({expected_current_node:zt}).strict(),DI=T.object({expected_current_node:T.literal("publishing")}).strict(),kd=T.object({node_code:zt,task_type:Ro,external_task_id:T.string().min(1).max(255),idempotency_key:T.string().min(1).max(255)}),jI=kd.extend({workflow_id:Oe}).strict(),OI=T.object({external_task_id:T.string().min(1).max(255),execution_status:To}),Pd=T.object({previous_external_task_id:T.string().min(1).max(255),external_task_id:T.string().min(1).max(255),idempotency_key:T.string().min(1).max(255)}),NI=Pd.extend({workflow_id:Oe}).strict(),Ad=T.object({previous_external_task_id:T.string().min(1).max(255),external_task_id:T.string().min(1).max(255),idempotency_key:T.string().min(1).max(255)}),LI=Ad.extend({workflow_id:Oe}).strict(),MI=T.object({}).strict();function wd(t,n,s){return t.find(a=>a.definition_version===s)?.definitions[n]}function vd(t,n){return wd(Fs,t,n)}function Cd(t,n=1){let s=vd(t,n);if(!s)throw new Error(`Unknown workflow definition: ${t} v${n}.`);return s}function Dd(t,n,s){let a=new Set(s);return t.filter(i=>i.published&&(i.required_client_capability===null||a.has(i.required_client_capability))).sort((i,r)=>r.definition_version-i.definition_version).map(i=>({definition_version:i.definition_version,items:i.definitions[n]}))[0]}function UI(t,n){return Dd(Fs,t,n)}function FI(t,n){return Cd(t).findIndex(s=>s.node_code===n)}function qI(t,n){return t==="website_scan"?n==="website_crawl"||n==="website_basic_info_extract"||n==="website_metrics_evaluate":t==="customer_materials"?n==="company_info":t==="analysis"?n==="intelligent_analysis":t==="strategy"?n==="strategy_recommendation":!1}function GI(t,n){if(t===n)return n;if(!{started:["running","succeeded","failed","invalidated"],running:["succeeded","failed","invalidated"],succeeded:["invalidated"],failed:["invalidated"],invalidated:[]}[t].includes(n))throw new Error(`Invalid task execution status transition: ${t} -> ${n}`);return n}function KI(t,n){if(t===n)return n;if(!{draft:["structure_saved"],structure_saved:["generating","draft"],generating:["workspace_ready","structure_saved"],workspace_ready:[]}[t].includes(n))throw new Error(`Invalid site build status transition: ${t} -> ${n}`);return n}import{z as f}from"zod";var Gs=f.string().min(1).max(120).regex(/^[a-z][a-z0-9_-]*$/),Re=f.string().min(1).max(120).regex(/^[A-Za-z_][A-Za-z0-9_]*$/),jd=f.enum(["text","select","multi_select","tags","category_list","boolean","number"]),Bt=f.string().min(1).max(512).regex(/^\/(?:[^?#]*)$/),Od=f.object({minimum:f.number().finite(),maximum:f.number().finite(),step:f.number().finite().positive()}).strict().refine(t=>t.minimum<t.maximum,{message:"minimum must be less than maximum"}),Nd=f.string().trim().min(1).max(100),jo=f.array(Nd).max(5).refine(t=>new Set(t.map(n=>n.toLowerCase())).size===t.length,{message:"popular_terms must be unique ignoring case"}),VI=f.array(f.string()).max(20).transform(t=>{let n=new Set;return t.map(s=>s.trim()).filter(s=>{if(s.length===0||s.length>100)return!1;let a=s.toLowerCase();return n.has(a)?!1:(n.add(a),!0)}).slice(0,5)}),Oo=f.object({filter_enabled:f.boolean(),selected_fields:f.array(Re).max(64),selected_card_fields:f.array(Re).max(64).default([]),popular_terms_enabled:f.boolean().default(!1),popular_terms:jo.optional()}).strict(),Ld=f.object({app_slug:Gs}).extend(Oo.shape).strict(),Ks=f.object({kind:f.literal("product_search_confirmation"),baseline_snapshot_id:x,target_route_id:Bt,applications:f.array(f.object({app_slug:Gs,label:f.string().min(1).max(200),popular_terms:jo.default([]),current_config:Oo.nullable().default(null),affected_routes:f.array(Bt).max(64).default([]),fields:f.array(f.object({field_name:Re,label:f.string().min(1).max(200),value_shape:jd,option_count:f.number().int().nonnegative().optional(),filter_meta:Od.optional()}).strict()).max(64)}).strict()).min(1).max(12),current_config:Ld.nullable().optional(),affected_routes:f.array(Bt).min(1).max(64).optional()}).strict(),Md=f.object({kind:f.literal("product_search_confirmation"),action:f.enum(["confirm","modify"]),app_slug:Gs,filter_enabled:f.boolean(),popular_terms_enabled:f.boolean().default(!1),selected_fields:f.array(Re).max(64),selected_card_fields:f.array(Re).max(64).default([])}).strict().superRefine((t,n)=>{t.filter_enabled&&t.selected_fields.length===0&&n.addIssue({code:"custom",path:["selected_fields"],message:"selected_fields must not be empty while filters are enabled"}),new Set(t.selected_fields).size!==t.selected_fields.length&&n.addIssue({code:"custom",path:["selected_fields"],message:"selected_fields must be unique"}),new Set(t.selected_card_fields).size!==t.selected_card_fields.length&&n.addIssue({code:"custom",path:["selected_card_fields"],message:"selected_card_fields must be unique"})}),vn=f.union([Md,f.object({kind:f.literal("product_search_confirmation"),action:f.literal("cancel")}).strict()]),Wt=f.union([f.string().max(255),f.number().finite(),f.boolean()]),Ud=f.object({values:f.array(Wt).min(1).max(20).refine(t=>new Set(t.map(n=>`${typeof n}:${String(n)}`)).size===t.length,{message:"values must be unique"})}).strict(),Fd=f.object({min:f.number().finite().optional(),max:f.number().finite().optional(),include_unlabeled:f.boolean().optional()}).strict().refine(t=>t.min!==void 0||t.max!==void 0||t.include_unlabeled===!0,{message:"a numeric boundary or include_unlabeled is required"}).refine(t=>t.min===void 0||t.max===void 0||t.min<=t.max,{message:"min must not be greater than max"}),qd=f.object({q:f.string().max(200),page:f.number().int().min(1).max(500),page_size:f.union([f.literal(9),f.literal(20)]),sort:f.enum(["published_at_desc","published_at_asc","product_name_asc","product_name_desc"]),filters:f.record(Re,f.union([Ud,Fd])).superRefine((t,n)=>{Object.keys(t).length>12&&n.addIssue({code:"custom",message:"filters must contain at most 12 fields"})}),display_fields:f.array(Re).max(64).default([]),missing_count_fields:f.array(Re).max(12).default([]),relaxation_count_fields:f.array(Re).max(12).default([]),facets:f.array(f.object({field:Re,query:f.string().max(100),page:f.number().int().min(1).max(100),page_size:f.literal(10),include_values:f.array(Wt).max(20)}).strict()).max(8)}).strict(),Do=f.object({value:Wt,label:f.string().max(200),count:f.number().int().nonnegative()}).strict(),Gd=f.union([Wt,f.array(Wt).max(50)]),Kd=f.object({items:f.array(f.object({id:f.number().int().positive(),thumbnail:f.string().max(2048).nullable(),title:f.string().max(300),summary:f.string().max(2e3),category:f.string().max(300).nullable(),field_values:f.record(Re,Gd).default({}),url:f.string().min(1).max(2048)}).strict()).max(20),page:f.object({total:f.number().int().nonnegative(),page:f.number().int().positive(),page_size:f.union([f.literal(9),f.literal(20)])}).strict(),facets:f.array(f.object({field:Re,total:f.number().int().nonnegative(),page:f.number().int().positive(),page_size:f.literal(10),values:f.array(Do).max(10),selected_values:f.array(Do).max(20)}).strict()).max(8),missing_counts:f.record(Re,f.number().int().nonnegative()).default({}),relaxation_counts:f.record(Re,f.number().int().nonnegative()).default({})}).strict(),HI=f.object({contract_version:f.literal(1),request:qd,response:Kd}).strict();import{z as Vt}from"zod";var zd=["deployment_queued","prepare_source","build_artifact","publish_site","site_released","cleanup_release"],Bd=Vt.enum(zd),Wd=Vt.enum(["running","succeeded","failed"]),Vd=Vt.object({code:Bd,status:Wd,message:Vt.string().trim().min(1)}).strict(),No=Vt.array(Vd);import{z as R}from"zod";var Hd=R.enum(["pending","running","succeeded","failed"]),$d=R.enum(["TASK_FAILED","WEBSITE_UNREACHABLE"]),Yd=R.object({task_id:R.string().uuid(),site_url:R.string().url(),crawler_task_id:R.string().min(1).max(255).nullable(),crawler_error_code:$d.nullable().optional(),crawler_failure_stage:R.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]).nullable().optional(),page_count:R.number().int().min(0).max(20),status:Hd,error:R.string().nullable(),created_at:R.string().min(1),updated_at:R.string().min(1)}),JI=M(Yd),zs=R.enum(["existing_site","new_site"]),Lo=R.enum(["google_indexing","ai_recommendation","qualification_verifiability","content_freshness","inquiry_form","inquiry_response","privacy_compliance","prohibited_content"]),Bs=R.object({label:R.string().trim(),value:R.union([R.string(),R.number(),R.boolean(),R.null()]),summary:R.string().trim(),tone:R.enum(["good","warn","bad","unknown"]),status:R.enum(["ok","unknown"])}),Cn=R.object({key:R.string().trim().min(1).max(100),label:R.string().trim().min(1).max(100),value:R.union([R.string().max(1e3),R.number(),R.boolean(),R.null()]),tone:R.enum(["good","warn","bad","unknown"]),status:R.enum(["ok","unknown"]),evidence:R.string().trim().max(2e3).optional()}).strict(),Xd=R.object({url:R.string().url().max(2048),title:R.string().trim().max(300),words:R.number().int().nonnegative().max(1e7)}).strict(),Zd=R.object({site_url:R.string().url().max(2048),scanned_at:R.string().datetime({offset:!0}),reach:R.array(Cn).max(64),trust:R.array(Cn).max(64),convert:R.array(Cn).max(64),safe:R.array(Cn).max(64),pages:R.array(Xd).max(100)}).strict(),Dn=R.object({company_task_id:R.string().min(1).max(128),scan_task_id:R.string().min(1).max(128),type:zs,result:R.object({company_name:R.string(),website:R.string().url().optional(),primary_product:R.string(),current_market:R.string(),qualifications:R.string(),scan_cards:R.record(R.string(),Bs),scan_result:Zd.optional()})}),Qd=R.object({saved:R.literal(!0),company_task_id:R.string().min(1).max(128),scan_task_id:R.string().min(1).max(128)}),eR=M(Qd),Jd=R.enum(["snapshot","task"]),eu=Dn.shape.result.extend({type:zs,structured_facts:R.unknown().optional()}).extend({company_name:R.string(),primary_product:R.string(),current_market:R.string(),qualifications:R.string()}),tu=R.object({site_id:R.string().min(1).max(128),company_task_id:R.string().min(1).max(128),scan_task_id:R.string().min(1).max(128),type:zs,data_source:Jd,result:eu}),tR=M(tu.nullable());import{z as ue}from"zod";var He=ue.enum(["company","product_service","case_qualification","market","contact_inquiry","privacy_compliance","news_freshness"]),nu=ue.object({ordinal:ue.number().int().min(1).max(1e4),path:ue.string().min(1).max(2048).refine(t=>!au(t),{message:"path must be a site-relative path, not an absolute URL"}),last_modified:ue.string().max(64).nullable()}).strict(),iR=ue.object({candidates:ue.array(nu).min(1).max(1e4),selection_limit:ue.number().int().min(1).max(19)}).strict().superRefine((t,n)=>{let s=t.candidates.map(a=>a.ordinal).sort((a,i)=>a-i);for(let[a,i]of s.entries())if(i!==a+1){n.addIssue({code:"custom",path:["candidates"],message:"candidates ordinals must be unique and consecutive from 1"});return}}),su=ue.object({ordinal:ue.number().int().positive().max(1e4),roles:ue.array(He).min(1).max(7)}).strict(),iu=ue.object({role:He,status:ue.enum(["selected","not_found"]),selected_ordinals:ue.array(ue.number().int().positive().max(1e4)).max(19)}).strict(),aR=ue.object({selections:ue.array(su).max(19),coverage:ue.array(iu).length(7)}).strict().superRefine((t,n)=>{let s=new Set;for(let[i,r]of t.coverage.entries())s.has(r.role)&&n.addIssue({code:"custom",path:["coverage",i,"role"],message:"coverage roles must be unique"}),s.add(r.role);for(let i of He.options)s.has(i)||n.addIssue({code:"custom",path:["coverage"],message:`coverage must include every page role (missing ${i})`});let a=new Map;for(let i of t.selections)for(let r of i.roles){let _=a.get(r)??new Set;_.add(i.ordinal),a.set(r,_)}for(let[i,r]of t.coverage.entries()){let _=a.get(r.role);r.selected_ordinals.some(g=>!_?.has(g))&&n.addIssue({code:"custom",path:["coverage",i,"selected_ordinals"],message:"selected_ordinals must reference selections carrying the same role"})}});function au(t){let n=t.toLowerCase();return n.startsWith("http://")||n.startsWith("https://")||t.startsWith("//")}import{z as h}from"zod";var mR=h.object({force_refresh:h.boolean().optional()}),Uo=h.enum(["running","succeeded","failed"]),ou=h.object({agent_id:h.string().min(1),name:h.string().min(1),icon:h.string().min(1),capability:h.string().min(1),data_source:h.string().min(1),output_topics:h.string().min(1)}),ru=h.object({site_mode:h.enum(["existing_site","new_site"]),scan_required:h.boolean(),scheduled_agent_ids:h.array(h.string().min(1)),omitted_agent_ids:h.array(h.string().min(1)),next_stage:h.enum(["diagnostic_report","strategy"])}),cu=h.object({t:h.string(),d:h.string(),evidence:h.object({from:h.string(),url:h.string().nullable().optional(),value:h.string().nullable().optional()})}),mu=h.enum(["complete","partial","insufficient_data","failed"]),lu=h.enum(["ok","failed","insufficient_data"]),Ws=h.object({agent_id:h.string().min(1),name:h.string().min(1),icon:h.string().min(1),status:lu,topics:h.array(h.object({topic_id:h.string().min(1),status:mu,evidence_refs:h.array(h.string())})).length(3),findings:h.array(cu).max(3),elapsed_ms:h.number().nonnegative(),note:h.string().optional(),error:h.string().optional()}),Fo=h.object({total:h.number().int().nonnegative(),ok:h.number().int().nonnegative(),degraded:h.number().int().nonnegative(),total_findings:h.number().int().nonnegative(),elapsed_ms:h.number().nonnegative(),site_mode:h.enum(["existing_site","new_site"]).optional(),scheduled_agent_ids:h.array(h.string()).optional(),omitted_agent_ids:h.array(h.string()).optional(),scheduled:h.number().int().nonnegative().optional(),complete:h.number().int().nonnegative().optional(),partial:h.number().int().nonnegative().optional(),insufficient:h.number().int().nonnegative().optional(),failed:h.number().int().nonnegative().optional(),next_stage:h.enum(["diagnostic_report","strategy"]).optional()}),pu=h.object({agents_done:h.boolean(),analysis:h.record(h.string(),Ws),step4_scoring_input:h.unknown().optional(),summary:Fo}),qo=h.object({job_id:h.string().min(1),site_id:h.string().min(1),model_version:h.string().min(1),output_locale:h.string().min(2),cached:h.boolean().optional(),status:Uo,result:pu.nullable().optional(),error:h.string().nullable().optional()}),lR=M(h.array(ou)),pR=M(ru),dR=M(qo),uR=M(qo.nullable()),Ge=h.object({id:h.union([h.number().int().nonnegative(),h.string().regex(/^(0|[1-9]\d*)$/u).transform(Number)]).pipe(h.number().int().nonnegative())}),Mo=h.object({percent:h.number().int().min(0).max(100),phase:h.enum(["preparing","analyzing","finalizing","completed","failed"]),stage:h.enum(["queued","baseline_ready","source_pages_ready","external_evidence_ready","knowledge_evidence_ready","page_evidence_ready","analysis_context_ready","preparation_saved","workflow_ready","agent_started","agent_completed","workflow_completed","scoring_input_ready","red_texts_ready","result_ready","result_persisted","completed","failed"]),agents_done:h.number().int().nonnegative(),agents_total:h.number().int().nonnegative(),agent_id:h.string().min(1).optional()}),gR=h.discriminatedUnion("event",[Ge.extend({event:h.literal("snapshot"),data:h.object({job_id:h.string().min(1),status:Uo,done:h.number().int().nonnegative(),total:h.number().int().nonnegative(),results:h.array(Ws),progress:Mo.optional()})}),Ge.extend({event:h.literal("progress"),data:Mo}),Ge.extend({event:h.literal("preparing_started"),data:h.object({stage:h.literal("baseline")})}),Ge.extend({event:h.literal("preparing_progress"),data:h.object({stage:h.enum(["context","external_evidence"])})}),Ge.extend({event:h.literal("preparing_done"),data:h.object({evidence_count:h.number().int().nonnegative(),rule_count:h.number().int().nonnegative(),degraded_capabilities:h.array(h.string())})}),Ge.extend({event:h.literal("agent_start"),data:h.object({agent_id:h.string().min(1),name:h.string().min(1),icon:h.string().min(1)})}),Ge.extend({event:h.literal("agent_done"),data:Ws}),Ge.extend({event:h.literal("done"),data:h.object({agents_done:h.literal(!0),summary:Fo})}),Ge.extend({event:h.literal("failed"),data:h.object({message:h.string().min(1)})})]);import{z as v}from"zod";var Hs=v.enum(["reach","trust","convert","safe"]),ye=v.number().finite(),du=v.number().finite().positive(),Vs=["reach","trust","convert","safe"],uu=17,gu=v.enum(["passed","partial","failed"]),_u=v.object({landing_page_mode:v.enum(["intent_dynamic","static","none"]),ab_test_enabled:v.boolean()}).strict(),hu=v.union([v.boolean(),v.number().finite(),gu,_u]).nullable(),Su=v.union([v.boolean(),v.number().finite()]).nullable(),fu=v.object({competitor_avg:v.number().finite(),score_items:v.record(v.string(),hu),penalty_items:v.record(v.string(),Su),red_texts:v.array(v.string())}).strict(),bu=v.record(Hs,fu),yu=v.object({key:Hs,score:ye,pass_score:ye,gap:ye}),xu=v.object({key:v.string(),title:v.string(),is_redline_option:v.boolean().optional(),score:ye,max_score:du,pass_score:ye,passed:v.boolean(),description:v.string()}),Eu=v.object({key:Hs,title:v.string(),alias:v.string(),slogan:v.string(),score:ye,max_score:v.literal(100),pass_score:ye,competitor_average:ye,status:v.enum(["reached","near","not_reached"]),status_name:v.enum(["\u8FBE\u6807","\u63A5\u8FD1","\u672A\u8FBE\u6807"]),summary:v.string(),sub_dimensions:v.array(xu),red_texts:v.array(v.string()),redline_hit:v.boolean().optional()}),Iu=v.object({id:v.number().int().positive(),task_code:v.string().min(1).max(128),is_sync:v.literal(0),status:v.literal("succeeded"),rules:bu,scores_list:v.object({overview:v.object({pass_scores:v.object({reach:ye,trust:ye,convert:ye,safe:ye}),total_score:ye,total_pass_score:ye,score_gap:ye,competitor_average_score:ye,scoring_criteria_text:v.string().min(1),gap_dimensions:v.array(yu).max(4),overall_passed:v.boolean(),all_scores_passed:v.boolean(),diagnosis_passed:v.boolean(),commitment_eligible:v.boolean(),safe_redline_hit:v.boolean()}),dimensions:v.array(Eu).length(4)}),created_at:v.string().datetime({offset:!0}),updated_at:v.string().datetime({offset:!0})}).superRefine((t,n)=>{Ru(t.scores_list.dimensions)||n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include each canonical score dimension."}),t.scores_list.dimensions.reduce((a,i)=>a+i.sub_dimensions.length,0)!==uu&&n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include 17 subdimensions in total."});for(let[a,i]of t.scores_list.dimensions.entries()){if(i.redline_hit===void 0)continue;let r=i.sub_dimensions.findIndex(_=>_.is_redline_option===void 0);r!==-1&&n.addIssue({code:"custom",path:["scores_list","dimensions",a,"sub_dimensions",r,"is_redline_option"],message:"subdimensions must define is_redline_option when redline_hit is defined."})}}),fR=M(Iu);function Ru(t){let n=t.map(s=>s.key);return n.length===Vs.length&&new Set(n).size===Vs.length&&Vs.every(s=>n.includes(s))}var $e={queued:["preparing_source","lock_failed","deploy_failed"],preparing_source:["building","source_prepare_failed","deploy_failed"],building:["artifact_ready","build_failed","artifact_fetch_failed","artifact_validation_failed","deploy_failed"],artifact_ready:["deploying","deploy_failed"],deploying:["released","deploy_failed"],released:[],lock_failed:[],source_prepare_failed:[],build_failed:[],artifact_fetch_failed:[],artifact_validation_failed:[],deploy_failed:[],cleanup_failed:[]};for(let t of Object.values($e))Object.freeze(t);Object.freeze($e);var xR=Object.freeze(_t.filter(t=>$e[t].length>0)),ER=Object.freeze(_t.filter(t=>$e[t].length===0)),Tu=Object.freeze(["preparing_source","building","artifact_ready","deploying","released"]),ku="DEPLOYMENT_TRANSITION_INVALID",$s=class extends Error{constructor(n,s){super(`Invalid deployment transition: ${n} -> ${s}`),this.currentStatus=n,this.nextStatus=s,this.code=ku,this.name="DeploymentTransitionError"}};function IR(t){return $e[t]}function RR(t){return _t.filter(n=>$e[n].some(s=>s===t))}function Pu(t){return $e[t].length>0}function TR(t){return!Pu(t)}function kR(t,n){if(!$e[t].some(s=>s===n))throw new $s(t,n);return n}function PR(){return Tu}import{z as Au}from"zod";var vR=".i18n.json",jn="translation",Go=new Set(["__proto__","constructor","prototype"]);function zo(t){if(!On(t)||Object.keys(t).length===0)return Ye("I18N_ROOT_INVALID","Component i18n resources must be a non-empty object.",[]);for(let[n,s]of Object.entries(t)){if(Go.has(n))return Ko([n]);if(!wu(n))return Ye("I18N_LOCALE_INVALID",`Component i18n locale must be canonical BCP-47: ${n}`,[n]);if(!On(s))return Ye("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let a=Object.keys(s);if(a.length!==1||a[0]!==jn)return Ye("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let i=s[jn];if(!On(i))return Ye("I18N_RESOURCE_TREE_INVALID",`Component i18n translation namespace for ${n} must be an object.`,[n,jn]);let r=[{value:i,path:[n,jn]}];for(;r.length>0;){let _=r.pop();for(let[c,g]of Object.entries(_.value)){let j=[..._.path,c];if(Go.has(c))return Ko(j);if(typeof g!="string"){if(!On(g))return Ye("I18N_RESOURCE_TREE_INVALID","Component i18n resource leaves must be strings.",j);r.push({value:g,path:j})}}}}return{success:!0,data:t}}function CR(t){let n;try{n=JSON.parse(t)}catch{return Ye("I18N_JSON_INVALID","Component i18n resource file must contain valid JSON.",[])}return zo(n)}var DR=Au.custom(t=>zo(t).success,"Invalid component i18n resources.");function wu(t){try{let n=Intl.getCanonicalLocales(t);return n.length===1&&n[0]===t}catch{return!1}}function On(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null}function Ko(t){return Ye("I18N_RESOURCE_KEY_FORBIDDEN",`Component i18n resource key is forbidden: ${t.at(-1)??""}`,t)}function Ye(t,n,s){return{success:!1,error:{code:t,message:n,path:s}}}var Ke="products",vu=`/${Ke}`,OR=vu,NR=`${Ke} detail`,LR="cms_collection_view",MR="list",UR="detail",Ne={zhHans:{pageTitle:"\u4EA7\u54C1\u4E2D\u5FC3",blockLabel:"\u4EA7\u54C1\u6982\u89C8",detailBlockLabel:"\u4EA7\u54C1\u8BE6\u60C5",heroBlockLabel:"\u4EA7\u54C1\u7B80\u4ECB",homeLabel:"\u9996\u9875"},zhHant:{pageTitle:"\u7522\u54C1\u4E2D\u5FC3",blockLabel:"\u7522\u54C1\u6982\u89BD",detailBlockLabel:"\u7522\u54C1\u8A73\u60C5",heroBlockLabel:"\u7522\u54C1\u7C21\u4ECB",homeLabel:"\u9996\u9801"},en:{pageTitle:"Products",blockLabel:"Products overview",detailBlockLabel:"Product details",heroBlockLabel:"Products Introduction",homeLabel:"Home"},de:{pageTitle:"Produkte",blockLabel:"Produkt\xFCbersicht",detailBlockLabel:"Produktdetails",heroBlockLabel:"Produkteinf\xFChrung",homeLabel:"Startseite"},fr:{pageTitle:"Produits",blockLabel:"Aper\xE7u des produits",detailBlockLabel:"D\xE9tails du produit",heroBlockLabel:"Pr\xE9sentation des produits",homeLabel:"Accueil"},es:{pageTitle:"Productos",blockLabel:"Resumen de productos",detailBlockLabel:"Detalles del producto",heroBlockLabel:"Introducci\xF3n de productos",homeLabel:"Inicio"},ja:{pageTitle:"\u88FD\u54C1",blockLabel:"\u88FD\u54C1\u6982\u8981",detailBlockLabel:"\u88FD\u54C1\u8A73\u7D30",heroBlockLabel:"\u88FD\u54C1\u7D39\u4ECB",homeLabel:"\u30DB\u30FC\u30E0"},ko:{pageTitle:"\uC81C\uD488",blockLabel:"\uC81C\uD488 \uAC1C\uC694",detailBlockLabel:"\uC81C\uD488 \uC0C1\uC138",heroBlockLabel:"\uC81C\uD488 \uC18C\uAC1C",homeLabel:"\uD648"}},Cu=new Set(Object.values(Ne).map(t=>t.pageTitle)),Du=new Set(Object.values(Ne).flatMap(t=>[t.blockLabel,t.detailBlockLabel,t.heroBlockLabel]));function FR(t){let n=t?.trim().toLowerCase()??"";if(n==="zh-tw"||n==="zh-hk"||n==="zh-mo")return Ne.zhHant;if(n.startsWith("zh"))return Ne.zhHans;switch(n.split("-")[0]){case"de":return Ne.de;case"fr":return Ne.fr;case"es":return Ne.es;case"ja":return Ne.ja;case"ko":return Ne.ko;case"en":default:return Ne.en}}function qR(t){return Cu.has(t.trim())}function GR(t){return Du.has(t.trim())}import{z as ge}from"zod";var WR=ge.object({key:ge.string().min(1),composition:se}).strict(),Ln=ge.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),ju=ge.enum(["direct","proxy","upstream","readonly","unsupported"]),Ou=ge.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),Nn=ge.object({mode:ju,reasonCode:ge.string().min(1).optional()}),Nu=ge.object({kind:Ou,message:ge.string().min(1)}),Mn=ge.object({composition:L,key:ge.string().min(1),canUpdateText:ge.boolean(),canInsertChild:ge.boolean(),canMove:ge.boolean(),canRemove:ge.boolean(),editModes:ge.object({updateText:Nn.optional(),insertChild:Nn.optional(),move:Nn.optional(),remove:Nn.optional()}).optional(),constraints:ge.array(Nu)}).strict();import{z}from"zod";var QR=z.discriminatedUnion("type",[z.object({type:z.literal("site-edit.document.changed"),siteId:I,snapshotId:x,composition:L,version:z.number().int().nonnegative(),at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.operation.planned"),siteId:I,operationId:z.string().min(1),baseSnapshotId:x,composition:L,changedFiles:z.array(z.string().min(1)),at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.operation.completed"),siteId:I,composition:L,result:Ns,at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.operation.failed"),siteId:I,composition:L,requestId:z.string().min(1),error:bo,at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.capability.changed"),siteId:I,composition:L,keys:z.array(z.string().min(1)),at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.graph.invalidated"),siteId:I,composition:L,at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.graph.ready"),siteId:I,composition:L,version:z.number().int().nonnegative(),at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.graph.error"),siteId:I,composition:L,message:z.string().min(1),at:z.string().min(1)}).strict()]);import{z as Z}from"zod";var nT="durable-history-v1",Un=Z.object({initiatingComposition:L.optional(),affectedCompositions:Z.array(L)}).strict(),sT=Z.enum(["writable","read-only-recovery","unavailable"]),Lu=Z.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),Mu=Z.object({code:Lu,message:Z.string().min(1),occurredAt:Z.iso.datetime().optional()}).strict(),Uu=Z.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),Bo={revision:Z.number().int().nonnegative(),undoDepth:Z.number().int().nonnegative(),redoDepth:Z.number().int().nonnegative()},Fu=Z.object({mode:Z.literal("writable"),composition:L,...Bo,canUndo:Z.boolean(),canRedo:Z.boolean(),provenance:Un.optional()}).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."})}),qu=Z.object({mode:Z.literal("read-only-recovery"),composition:L,...Bo,canUndo:Z.literal(!1),canRedo:Z.literal(!1),recoveryDiagnostic:Mu,provenance:Un.optional()}).strict(),Gu=Z.object({mode:Z.literal("unavailable"),composition:L,revision:Z.literal(0),undoDepth:Z.literal(0),redoDepth:Z.literal(0),canUndo:Z.literal(!1),canRedo:Z.literal(!1),reason:Uu,provenance:Un.optional()}).strict(),Ku=Z.discriminatedUnion("mode",[Fu,qu,Gu]),iT=Z.object({composition:L,status:Ku,provenance:Un}).strict();import{z as _e}from"zod";var zu=_e.string().min(1).refine(t=>!t.startsWith("/")&&!t.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),Bu=_e.string().regex(/^sha256:[a-f0-9]{64}$/),Wu=_e.object({path:zu,operation:_e.enum(["create","update","delete"]),expectedHash:Bu.optional(),fullContent:_e.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"})}),Vu=_e.object({siteId:I,baseSnapshotId:x,operationId:_e.string().min(1),reason:_e.string().min(1),patches:_e.array(Wu).min(1),changedCompositions:_e.array(L),changedRouteIds:_e.array(_e.string().min(1)).optional(),diagnostics:_e.array(_e.object({code:_e.string().min(1),message:_e.string().min(1),path:_e.string().min(1).optional()})).default([])}).strict().superRefine((t,n)=>{let s=new Set;for(let[i,r]of t.patches.entries())s.has(r.path)&&n.addIssue({code:"custom",path:["patches",i,"path"],message:`Duplicate patch path: ${r.path}`}),s.add(r.path);let a=[...new Set(t.changedCompositions.map(i=>i.routeId))];t.changedRouteIds!==void 0&&(t.changedRouteIds.length!==a.length||t.changedRouteIds.some((i,r)=>i!==a[r]))&&n.addIssue({code:"custom",path:["changedRouteIds"],message:"changedRouteIds must be the stable deduplicated route projection of changedCompositions."})}),mT=Vu.transform(t=>({...t,changedRouteIds:[...new Set(t.changedCompositions.map(n=>n.routeId))]}));var Ys="::repeat-item#";function Hu(t,n){return`${t}${Ys}${n}`}function pT(t,n){return n.reduce((s,a)=>Hu(s,a),t)}function $u(t){if(typeof t!="string"||t.length===0)return null;let n=[],s=t;for(;;){let a=s.lastIndexOf(Ys);if(a<0)break;let i=Number(s.slice(a+Ys.length));if(!Number.isInteger(i)||i<0)return null;n.unshift({repeatIndex:i}),s=s.slice(0,a)}return!s||n.length===0?null:{baseKey:s,parts:n}}function dT(t){return $u(t)?.baseKey??t??null}import{z as m}from"zod";import{z as Ee}from"zod";var Yu=Ee.object({placementKey:Ee.string().min(1),placementUnitKey:Ee.string().min(1),relation:Ee.enum(["before","after","prepend","append"])}).strict(),Xu=Ee.object({status:Ee.literal("supported"),containerKey:Ee.string().min(1),hasBusinessMembers:Ee.boolean(),placementUnitKeys:Ee.array(Ee.string().min(1)),placements:Ee.array(Yu)}).strict().superRefine((t,n)=>{let s=new Set(t.placementUnitKeys);s.size!==t.placementUnitKeys.length&&n.addIssue({code:"custom",path:["placementUnitKeys"],message:"Render page composition placement unit keys must be unique."});let a=new Set;t.placements.forEach((i,r)=>{a.has(i.placementKey)&&n.addIssue({code:"custom",path:["placements",r,"placementKey"],message:"Render page composition placement keys must be unique."}),a.add(i.placementKey),s.has(i.placementUnitKey)||n.addIssue({code:"custom",path:["placements",r,"placementUnitKey"],message:"Render page composition placement must reference a projected unit."})})}),Zu=Ee.object({status:Ee.literal("unsupported"),reason:Pn,diagnostics:Ee.array(Gt)}).strict(),Wo=Ee.discriminatedUnion("status",[Xu,Zu]);var Qu=m.object({canUpdateText:m.boolean(),canInsertChild:m.boolean(),canMove:m.boolean(),canRemove:m.boolean()}),Vo=m.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),Ju=m.enum(["cms-field","api-field"]),eg=m.enum(["text","attribute","richtext","repeat-region","component-prop"]),tg=m.enum(["exact","safe-derived","partial","unknown"]),ng=m.object({file:m.string().min(1),symbol:m.string().min(1).optional(),reason:m.string().min(1)}),sg=m.object({sourceKind:Vo,sourceType:Ju,endpointPattern:m.string().min(1).optional(),operation:m.string().min(1).optional(),collection:m.string().min(1).optional(),fieldPath:m.string().min(1).optional(),valuePath:m.string().min(1).optional(),targetKind:eg,targetName:m.string().min(1),confidence:tg,readonly:m.literal(!0),evidence:m.array(ng)}),Ho=m.object({hasDynamicData:m.boolean(),bindings:m.array(sg)}),$o=m.object({hasDynamicData:m.boolean(),sourceKinds:m.array(Vo),primaryEndpoint:m.string().min(1).optional(),primaryCollection:m.string().min(1).optional(),primaryFieldPath:m.string().min(1).optional()}),ig=m.object({key:m.string().min(1),pageCompositionUnitKey:m.string().min(1).optional(),operationSummary:Qu,dynamicDataSummary:$o.optional()}).strict(),PT=m.object({composition:se}).strict(),AT=m.object({key:m.string().min(1),composition:se}).strict(),wT=m.object({siteId:I,snapshotId:x,composition:L,version:m.number().int().nonnegative(),entries:m.array(ig),pageComposition:Wo}).strict(),Xs=m.enum(["api-field","cms-field","i18n-message","config-entry"]),Yo=m.object({kind:m.enum(["literal","binding","imported-binding","repeat-template"]),file:m.string().min(1),expression:m.string().min(1),bindingName:m.string().min(1).optional(),path:m.array(m.union([m.string(),m.number()])).optional()}),Zs=m.object({index:m.number().int().min(0),value:m.string(),editable:m.boolean(),source:Yo.nullable()}),Ht=m.object({key:m.string().min(1),label:m.string().min(1),tag:m.string().min(1)}),vT=m.object({composition:L,key:m.string().min(1),canUpdateText:m.boolean(),canInsertChild:m.boolean(),canMove:m.boolean(),canRemove:m.boolean(),boundaryKind:Ln.nullable(),isOpaque:m.boolean()}).strict(),ag=m.object({kind:m.enum(["jsx-node","component-proxy","value-binding","route-export"]),file:m.string().min(1),componentName:m.string().min(1),isProxy:m.boolean()}),og=m.object({kind:m.enum(["jsx-node","value-path","route-export","external-entry"]),file:m.string().min(1).optional(),isProxy:m.boolean(),displayPath:m.string().min(1).optional(),sourceType:Xs.optional(),sourceId:m.string().min(1).optional()}),Xo=m.object({kind:m.union([m.enum(["jsx-literal","component-prop","binding","imported-binding","object-field","array-item","repeat-template","conditional-branch"]),Xs]),file:m.string().min(1),displayPath:m.string().min(1),externalSource:m.object({sourceType:Xs,sourceId:m.string().min(1),adapterId:m.string().min(1).optional()}).optional()}),rg=m.object({kind:Xo.shape.kind,file:m.string().min(1),displayName:m.string().min(1),canEditHere:m.boolean()}),$t=m.object({finalSource:Xo.nullable(),chain:m.array(rg),confidence:m.enum(["exact","safe-derived","partial","unknown"]),editMode:m.enum(["direct","proxy","upstream","readonly","unsupported"]),diagnostics:m.array(m.object({code:m.string().min(1),message:m.string().min(1)}))}),cg=m.object({kind:m.literal("css-style-model"),properties:m.array(m.object({property:_o,value:m.union([m.string(),m.number(),m.boolean(),m.null()]),resolvedValue:m.union([m.string(),m.number(),m.boolean(),m.null()]).optional(),breakpoint:So.optional(),state:ho.optional(),variants:m.array(m.string().min(1)).optional(),options:m.array(m.union([m.string(),m.number()])).optional(),editable:m.boolean(),diagnostics:m.array(m.object({code:m.string().min(1),message:m.string().min(1)})).optional(),operationBoundary:m.array(Kt).optional()}))}),CT=m.union([m.record(m.string(),m.unknown()),cg]),Zo=m.object({kind:m.literal("class-name-source"),className:m.string(),sourceKind:m.enum(["missing","static-attribute","static-expression","dynamic-expression"]),editable:m.boolean(),operationBoundary:m.array(Kt),sourcePath:m.string().min(1).optional(),diagnostics:m.array(m.object({code:m.enum(["missing-class-name","dynamic-binding","non-string-binding"]),message:m.string().min(1)})).optional()}),mg=m.object({startLine:m.number().int().positive(),startColumn:m.number().int().nonnegative(),endLine:m.number().int().positive(),endColumn:m.number().int().nonnegative()}),Qs=m.object({sourceFile:m.string().min(1),componentName:m.string().min(1),openingElementRange:mg,structuralPath:m.string().min(1),textPreview:m.string().min(1).optional()}),DT=m.object({composition:L,key:m.string().min(1),tag:m.string().min(1),componentName:m.string().min(1),sourceFile:m.string().min(1),sourceLocator:Qs.optional(),label:m.string().min(1),capabilities:Mn,writeTarget:ag,effectiveWriteTarget:og.optional(),provenanceChain:$t.optional(),componentSemantic:m.record(m.string(),m.unknown()).optional(),contentModel:m.record(m.string(),m.unknown()).optional(),mediaModel:m.record(m.string(),m.unknown()).optional(),styleSource:Zo.optional(),conditional:m.record(m.string(),m.unknown()).optional(),dynamicData:Ho.optional(),textSegments:m.array(Zs),boundaryKind:Ln.nullable(),isOpaque:m.boolean(),ancestors:m.array(Ht),children:m.array(Ht),siblings:m.array(Ht)}).strict(),jT=m.object({composition:L,key:m.string().min(1),tag:m.string().min(1),label:m.string().min(1),sourceLocator:Qs.optional(),capabilities:m.object({constraints:Mn.shape.constraints}),isOpaque:m.boolean(),provenanceChain:m.object({editMode:$t.shape.editMode,diagnostics:$t.shape.diagnostics}).optional(),dynamicDataSummary:$o.optional(),ancestors:m.array(Ht)}).strict(),OT=m.object({composition:L,key:m.string().min(1),tag:m.string().min(1),label:m.string().min(1),sourceLocator:Qs.optional(),isOpaque:m.boolean(),ancestors:m.array(Ht),componentName:m.string().min(1),sourceFile:m.string().min(1),capabilities:Mn,provenanceChain:m.object({editMode:$t.shape.editMode,diagnostics:$t.shape.diagnostics}).optional(),textSegments:m.array(m.object({index:Zs.shape.index,editable:Zs.shape.editable,sourceKind:Yo.shape.kind.nullable()})),dynamicData:Ho.optional(),boundaryKind:Ln.nullable()}).strict(),NT=m.object({composition:L,key:m.string().min(1),mediaModel:m.record(m.string(),m.unknown()).optional(),styleSource:Zo.optional()}).strict();var lg=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],pg=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],dg=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],ug=new Set(lg),gg=new Set(pg),_g=new Set(dg),hg={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function MT(t){return ug.has(Js(t))}function Sg(t){return gg.has(Js(t))}function fg(t){return _g.has(Js(t))}function UT(t){let{operationSummary:n}=t;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:t.fallbackMode!=="preview"?{...hg}:{canUpdateText:fg(t.tagName),canInsertChild:Sg(t.tagName),canMove:!1,canRemove:!1}}function Js(t){return t?.trim().toLowerCase()??""}import{z as bg}from"zod";var zT=bg.object({composition:se,mutationContext:Ft.optional()}).strict();var WT={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.",PRODUCT_SEARCH_APPLY_NOT_AVAILABLE:"Product search changes aren't available yet. Please try again later.",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."},VT={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."},HT={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},$T={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var Qo="0.8.0",XT="x-vcp-edit-engine-version",ZT="x-vcp-edit-engine-version-source",ei=class extends Error{constructor(n="Invalid edit-engine version."){super(n),this.code="EDIT_ENGINE_VERSION_INVALID",this.name="EditEngineVersionParseError"}},yg=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/;function xg(t){return yg.test(t)}function Eg(t){if(typeof t!="string"||!xg(t))throw new ei;return t}function QT(t){return t==null?{version:Qo,source:"fallback_current"}:{version:Eg(t),source:"explicit"}}function JT(){return{version:Qo,source:"system_current"}}import{z as je}from"zod";var Ig=200,Rg=200;function Tg(t){let n=t.indexOf(":");if(n<=0)return null;let s=t.slice(0,n).trim(),a=t.slice(n+1).trim();return s.length===0||a.length===0?null:{source:s,target:a}}var kg=je.string().min(3).max(Ig).refine(t=>Tg(t)!==null,{message:'glossary entries must be "source:target" pairs split on a half-width colon, e.g. "\u7C73:Rice"'}),nk=je.array(kg).max(Rg),sk=je.object({website_name:je.string().min(1).max(200),website_industry:je.string().min(1).max(200).optional(),website_description:je.string().min(1).max(1e3).optional()}),Pg=je.enum(["regional","fonts_only"]),Fn=je.string().regex(/^#[0-9a-fA-F]{6}$/,'color must be a "#rrggbb" value'),Ag=je.object({primary:Fn.optional(),accent:Fn.optional(),foreground:Fn.optional(),neutral:Fn.optional()}),wg=600,ik=je.object({mode:Pg.default("regional"),seeds:Ag.optional(),note:je.string().min(1).max(wg).optional()}),ak={mode:"regional"};function ok(t){return t===void 0?!1:Object.values(t).some(n=>typeof n=="string"&&n.length>0)}import{z as Te}from"zod";var vg=Te.string().trim().min(1),bt=Te.string().uuid(),Cg=Te.string().min(1).max(2048).refine(t=>t.startsWith("/")||t.includes("\\")?!1:t.split("/").every(n=>n.length>0&&n!=="."&&n!==".."),"object_key must be a relative snapshot store path without empty, '.' or '..' segments"),Jo=Te.object({snapshot_id:bt,object_key:Cg}),mk=Te.object({tenant_id:vg,parent_site_id:bt,subsite_site_id:bt,base:Jo,target:Jo}),lk=Te.object({subsite_site_id:bt,pending_pages:Te.array(Te.string().min(1)),hash_diverged_count:Te.number().int().nonnegative(),child_only_count:Te.number().int().nonnegative(),base_snapshot_id:bt,target_snapshot_id:bt}),Dg=Te.enum(["SUBSITE_DIFF_REQUEST_INVALID","SUBSITE_DIFF_STORE_NOT_CONFIGURED","SUBSITE_DIFF_MANIFEST_MISSING","SUBSITE_DIFF_MANIFEST_INVALID"]),pk=Te.object({error_code:Dg,message:Te.string().min(1),side:Te.enum(["base","target"]).optional()});import{z as re}from"zod";var _k=re.object({tenant_id:re.string().min(1),site_id:I,snapshot_id:x,manifest_hash:re.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:re.string().min(1).max(2048),page_slug:re.string().max(512).optional()}),hk=re.object({site_id:I,snapshot_id:x,unit_count:re.number().int().nonnegative(),file_count:re.number().int().nonnegative(),markdown:re.string().min(1),page_slug:re.string().optional(),page_file:re.string().optional(),entries:re.array(re.object({id:re.string().min(1),file_path:re.string().min(1),line:re.number().int().nullable(),kind:re.string().min(1),text:re.string(),media_key:re.string().optional()})).optional()});import{z as jg}from"zod";var Og=/^\/[a-z0-9][a-z0-9-]{0,30}$/,Ng=Object.freeze(["api","_next","assets","static","robots.txt","sitemap.xml",".well-known"]),Lg=new Set(Ng);function Mg(t){return Lg.has(t)}var bk=jg.string().regex(Og).refine(t=>!Mg(t.slice(1)),{message:"mount_path must not use a reserved segment (api, _next, assets, static, robots.txt, sitemap.xml, .well-known)"});import{z as ie}from"zod";var Ug=ie.enum(["active","paused","blocked"]),er=ie.enum(["typecheck_failed","health_failed","validation_failed"]),Fg={status:Ug,attempts:ie.number().int().nonnegative(),attempted_template_version:De.nullable(),last_error_code:er.nullable()},yt=ie.object(Fg).strict(),qn=ie.object({template_id:ie.string().trim().min(1),target_template_version:De}).strict(),Ik=qn,qg=ie.discriminatedUnion("action",[ie.object({action:ie.literal("proceed"),state:yt.extend({status:ie.literal("active")})}).strict(),ie.object({action:ie.literal("skip_not_newer"),state:yt.extend({status:ie.literal("active")})}).strict(),ie.object({action:ie.literal("skip_paused"),state:yt.extend({status:ie.literal("paused")})}).strict(),ie.object({action:ie.literal("skip_blocked"),state:yt.extend({status:ie.literal("blocked")})}).strict()]),Rk=qn,Tk=qg,kk=qn.extend({error_code:er}),Pk=ie.object({state:yt}).strict(),Ak=qn,wk=ie.object({state:yt}).strict();import{z as U}from"zod";var Gg=744*60*60*1e3,Kg=U.enum(["eligible","fast_path","upgraded","skipped","lock_skipped","cas_aborted","validation_failed","blocked","paused"]),zg=U.enum(["typecheck","build","health","validation"]),Bg=U.enum(["not_attempted","promoted","aborted"]),Ok=U.object({template_id:U.string().trim().min(1).max(128),from_version:De.nullable(),to_version:De,outcome:Kg,attempt:U.number().int().nonnegative().max(2147483647),duration_ms:U.number().int().nonnegative().max(2147483647),replaced_group_count:U.number().int().nonnegative().max(2147483647),skipped_group_count:U.number().int().nonnegative().max(2147483647),validation_stage:zg.nullable(),cas_outcome:Bg.nullable()}).strict(),Nk=U.object({recorded:U.literal(!0)}).strict(),tr=U.object({from:U.iso.datetime(),to:U.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)<=Gg,{message:"report window must not exceed 31 days",path:["to"]}),Lk=tr,Wg=U.object({eligible:U.number().int().nonnegative(),fast_path:U.number().int().nonnegative(),upgraded:U.number().int().nonnegative(),skipped:U.number().int().nonnegative(),lock_skipped:U.number().int().nonnegative(),cas_aborted:U.number().int().nonnegative(),validation_failed:U.number().int().nonnegative(),blocked:U.number().int().nonnegative(),paused:U.number().int().nonnegative()}).strict(),Mk=U.object({window:tr,outcome_counts:Wg,current_state_counts:U.object({blocked:U.number().int().nonnegative(),paused:U.number().int().nonnegative()}).strict(),duration_ms:U.object({p50:U.number().int().nonnegative().nullable(),p95:U.number().int().nonnegative().nullable(),sample_count:U.number().int().nonnegative()}).strict()}).strict(),Uk=U.object({older_than:U.iso.datetime(),limit:U.coerce.number().int().min(1).max(200).default(50),include_candidates:U.enum(["true","false"]).default("false").transform(t=>t==="true")}).strict(),Vg=U.object({site_id:I,snapshot_id:x,status:U.enum(["candidate","deleting"]),created_at:U.iso.datetime()}).strict(),Fk=U.object({snapshots:U.array(Vg)}).strict();import{z as ze}from"zod";var Hg=ze.enum(["PREVIEW_SESSION_NOT_FOUND","PREVIEW_SESSION_INVALID","PREVIEW_SESSION_STALE","PREVIEW_SESSION_LOOKUP_FAILED","PREVIEW_SANDBOX_NOT_FOUND","PREVIEW_SANDBOX_CONNECT_FAILED","PREVIEW_SANDBOX_OWNERSHIP_MISMATCH","PREVIEW_ACTIVATION_TIMEOUT","PREVIEW_PREFLIGHT_FAILED","PREVIEW_ENV_LOOKUP_FAILED","PREVIEW_SERVER_START_FAILED","PREVIEW_HEALTH_CHECK_FAILED","SANDBOX_NOT_CONFIGURED"]),$g=ze.object({status:ze.literal("ready"),preview_url:ze.string().url()}).strict(),Yg=ze.object({status:ze.literal("failed"),code:Hg,message:ze.string().min(1),retryable:ze.boolean()}).strict(),Kk=ze.discriminatedUnion("status",[$g,Yg]);import{z as oe}from"zod";var $k="build-context.json",Yk=2e5,nr=oe.string().regex(/^sha256:[a-f0-9]{64}$/u),sr=1e3;function Xg(t){return Array.from(t).length<=sr}var Zg=oe.object({kind:oe.enum(["customer_materials","website_scan_diagnosis","committed_strategy"]),digest:nr}).strict(),Qg=oe.object({schema_version:oe.literal(1),flow_type:An,sources:oe.array(Zg).min(2).max(2)}).strict().superRefine((t,n)=>{let s=new Set(t.sources.map(i=>i.kind)),a=t.flow_type==="with_website"?["website_scan_diagnosis","committed_strategy"]:["customer_materials","committed_strategy"];(s.size!==a.length||a.some(i=>!s.has(i)))&&n.addIssue({code:"custom",path:["sources"],message:"Site-build provenance sources must match the persisted workflow flow."})}),Jg=oe.object({schema_version:oe.literal(1),seed:nr.optional(),cms_settings:oe.object({main_products:oe.string().trim().min(1).refine(Xg,{message:`main_products must contain at most ${sr} characters`}).optional()}).strict().optional(),provenance:Qg.optional()}).strict(),e_=oe.object({schema_version:oe.literal(1),site_id:I,workflow_id:Oe,brief:oe.string().min(1),source:oe.enum(["business_provider","mock"]),payload:Jg}).strict().superRefine((t,n)=>{t.source==="business_provider"&&!t.payload.provenance&&n.addIssue({code:"custom",path:["payload","provenance"],message:"Business site-build context requires persisted provenance."})}),Xk=oe.object({source_snapshot_id:x,source_run_id:V,build_context:e_,page_slugs:oe.array(oe.string().min(1)).optional()}).strict(),Zk=oe.object({disposition:oe.enum(["reused","rebased"]),snapshot_id:x}).strict(),t_=oe.object({snapshot:qs,workspace_run_id:V.nullable()}).strict(),Qk=M(t_);import{z as Le}from"zod";import{z as we}from"zod";import{z as ae}from"zod";import{z as n_}from"zod";var s_=["company_profile","product_manual","product_list","customer_case","product_help","qualification","industry_material"],ir=n_.enum(s_);var ar=ae.enum(["pending","running","ready","failed","missing"]),i_=ae.object({task_id:ae.string().min(1).max(500),status:ar}).strict(),i1=ae.object({items:ae.array(i_).max(100)}).strict(),Yt=ae.string().trim().min(1).max(255),a1=ae.object({knowledge_site_id:Yt,source_ids:ae.array(Yt).min(1).max(200)}).strict().superRefine((t,n)=>{new Set(t.source_ids).size!==t.source_ids.length&&n.addIssue({code:"custom",message:"Knowledge source IDs must be unique.",path:["source_ids"]})}),a_=ae.object({source_file_id:Yt,category_code:ir.nullable(),category_confirmed:ae.boolean(),status:ar}).strict(),o1=ae.object({ready:ae.boolean(),files:ae.array(a_),counts:ae.object({total:ae.number().int().nonnegative(),pending:ae.number().int().nonnegative(),running:ae.number().int().nonnegative(),ready:ae.number().int().nonnegative(),failed:ae.number().int().nonnegative(),missing:ae.number().int().nonnegative(),unclassified:ae.number().int().nonnegative()}).strict()}).strict();var ce=t=>we.string().trim().max(t),or=we.array(we.string().trim().min(1).max(120)).max(20),ti=we.object({company_name:we.string().trim().min(1).max(200),brand_name:ce(200),primary_products:we.string().trim().min(1).max(1e3),industry:ce(200),applications:ce(1e3),business_summary:ce(2e3),registered_capital:ce(200).default(""),legal_representative:ce(200).default(""),target_markets:or,customer_industries:ce(1e3),customer_roles:ce(1e3),buying_scenarios:ce(2e3),differentiators:ce(2e3),competitors:ce(1e3),trust_proof:ce(2e3),customer_cases:ce(3e3),channels:or,expected_domain:ce(255),brand_tone:ce(500),contact_name:ce(200),contact_info:ce(500),timezone:ce(100),launch_timing:ce(200),input_source_ids:we.array(Yt).max(50)}).strict(),o_=we.enum(["draft","submitted"]),ni=ti.extend({id:G,tenant_id:we.string().min(1),site_id:I,workflow_id:Oe,status:o_,submitted_at:we.string().min(1).nullable(),created_at:we.string().min(1),updated_at:we.string().min(1)}).strict(),d1=M(ni),u1=M(ni),g1=M(ni.nullable());var b1=Dn.extend({expected_current_node:Le.literal("website_scan"),type:Le.literal("existing_site"),result:Dn.shape.result.extend({website:Le.string().url(),scan_cards:Le.partialRecord(Lo,Bs).refine(t=>Object.keys(t).length>0,{message:"At least one recognized scan card is required."})}).strict()}).strict(),y1=Le.object({expected_current_node:Le.literal("customer_materials"),materials:ti}).strict(),x1=Le.object({expected_current_node:Le.literal("diagnosis")}).strict(),E1=Le.object({expected_current_node:Le.literal("strategy")}).strict();import{z as k}from"zod";var Xt={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}},r_={heading:"Inter",body:"Inter"},rr=Xt.Inter;function Gn(t){return t.trim().replace(/\s+/g,"_").toLowerCase()}var pr=(()=>{let t=new Map;for(let[n,s]of Object.entries(Xt))t.set(Gn(n),s),t.set(Gn(s.import),s);return t})();function c_(t){return typeof t!="string"||t.trim().length===0?rr:pr.get(Gn(t))??rr}var m_=(()=>{let t=new Map;for(let[n,s]of Object.entries(Xt))t.set(s.import,n);return t})();function l_(t){if(typeof t!="string"||t.trim().length===0)return"Inter";let n=pr.get(Gn(t));return n?m_.get(n.import)??"Inter":"Inter"}var p_=Object.keys(Xt),cr='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',mr='Georgia, "Times New Roman", serif',lr='"SFMono-Regular", Consolas, monospace',d_=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),u_=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(t=>t.toLowerCase())),g_=new Set(["JetBrains Mono","IBM Plex Mono"].map(t=>t.toLowerCase()));function __(t){let n=t.toLowerCase();return g_.has(n)||n.includes("mono")?"mono":u_.has(n)||n.includes("serif")?"serif":"sans"}function si(t,n){let s=g=>(g??"").trim().replace(/^['"]|['"]$/g,"").replace(/[^A-Za-z0-9 _-]+/g,"").trim().slice(0,60),a=s(t),i=s(n),r=g=>d_.has(g.toLowerCase());if(a&&r(a)){let g=a.toLowerCase();return g.includes("mono")?lr:g.includes("serif")?mr:cr}let _=a;_||(_=r(i)?"":i),_||(_="Inter");let c=__(_);return c==="mono"?`"${_}", ${lr}`:c==="serif"?`"${_}", ${mr}`:`"${_}", ${cr}`}function h_(t){return{"--site-font-sans":si(t?.body,"Inter"),"--site-font-heading":si(t?.heading,t?.body??"Inter")}}var ii=["archivo-inter","playfair-source-sans","space-grotesk-manrope","fraunces-libre-franklin","noto-serif-sc-noto-sans-sc","noto-sans-sc"],dr=[{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"}];function ur(t){let n=dr.find(s=>s.id===t);if(!n)throw new Error(`Unknown font pairing: ${t}`);return n}var ai=["compact","comfortable","airy"],gr=["none","sm","md","lg","xl"],_r="lg",oi=["subtle","moderate","expressive"],S_=[{id:"subtle",motionLevel:"subtle"},{id:"moderate",motionLevel:"moderate"},{id:"expressive",motionLevel:"expressive"}];function hr(t){let n=S_.find(s=>s.id===t);if(!n)throw new Error(`Unknown motion preset: ${t}`);return n}var Sr=["ocean","forest","clay","violet","graphite","crimson"],fr=["ai-forest","ai-navy","ai-steel"],br=/^gen-[0-9a-f]{8}$/,ri=[{id:"ai-forest",name:"\u5DE5\u4E1A\u58A8\u7EFF \xB7 Industrial Teal",description:"\u6C89\u7A33\u4E13\u4E1A\uFF0C\u7A81\u51FA\u7CBE\u5BC6\u4E0E\u53EF\u4FE1\u3002",fallbackReason:"\u7A33\u5B9A\u4E13\u4E1A\u7684\u9ED8\u8BA4\u9009\u62E9\u3002",colorSeeds:{primary:"#0E7C6F",accent:"#2F6FED",foreground:"#0F1B2D"},surfaceMode:"light",radius:"sm"},{id:"ai-navy",name:"\u79D1\u6280\u6DF1\u84DD \xB7 Deep Tech Blue",description:"\u7406\u6027\u79D1\u6280\u611F\uFF0C\u5F3A\u8C03\u6280\u672F\u5B9E\u529B\u4E0E\u6570\u636E\u53EF\u4FE1\u3002",fallbackReason:"\u6280\u672F\u8868\u8FBE\u7684\u5907\u9009\u3002",colorSeeds:{primary:"#1E3A8A",accent:"#2F6FED",foreground:"#0F1B2D"},surfaceMode:"light",radius:"md"},{id:"ai-steel",name:"\u7CBE\u5BC6\u94F6\u7070 \xB7 Precision Steel",description:"\u514B\u5236\u6E05\u6670\uFF0C\u9002\u5408\u53C2\u6570\u4E0E\u5DE5\u7A0B\u7EC6\u8282\u8868\u8FBE\u3002",fallbackReason:"\u53C2\u6570\u4FE1\u606F\u8F83\u591A\u65F6\u7684\u5907\u9009\u3002",colorSeeds:{primary:"#475569",accent:"#94A3B8",foreground:"#111827"},surfaceMode:"light",radius:"none"}],ci=[{id:"ocean",colorSeeds:{primary:"#1e3a5f",accent:"#2563eb",foreground:"#0f172a"},surfaceMode:"light",radius:"md"},{id:"forest",colorSeeds:{primary:"#14532d",accent:"#16a34a",foreground:"#0f172a"},surfaceMode:"light",radius:"lg"},{id:"clay",colorSeeds:{primary:"#7c2d12",accent:"#ea580c",foreground:"#1c1917"},surfaceMode:"light",radius:"xl"},{id:"violet",colorSeeds:{primary:"#3b0764",accent:"#7c3aed",foreground:"#18181b"},surfaceMode:"light",radius:"lg"},{id:"graphite",colorSeeds:{primary:"#1f2937",accent:"#0d9488",foreground:"#111827"},surfaceMode:"light",radius:"none"},{id:"crimson",colorSeeds:{primary:"#7f1d1d",accent:"#dc2626",foreground:"#1f1012"},surfaceMode:"light",radius:"sm"}];function k1(t){let n=ci.find(s=>s.id===t);if(!n)throw new Error(`Unknown theme preset: ${t}`);return n}function yr(t){return ci.find(n=>n.id===t)?.radius??ri.find(n=>n.id===t)?.radius}var mi=k.string().regex(/^#[0-9A-F]{6}$/i),Zt=k.string().trim().min(1).max(500),xr=k.string().datetime({offset:!0}),f_=k.enum(Sr),b_=k.enum(fr),y_=k.string().regex(br),Qt=k.union([f_,b_,y_]),Jt=k.enum(ii),en=k.enum(oi),tn=k.enum(ai),Kn=k.enum(gr),Er=300,x_=k.string().trim().min(1).max(Er),zn=k.object({primary:mi,accent:mi,foreground:mi}).strict(),E_=k.object({id:Qt,rank:k.number().int().min(1).max(3),name:k.string().trim().min(1).max(120),description:k.string().trim().min(1).max(240),color_seeds:zn,surface_mode:k.enum(["light","dark"]),radius:Kn,font_pairing_id:Jt,motion_preset_id:en,density:tn,reason:Zt}).strict(),Ir=k.object({name:k.string().trim().min(1).max(120),description:k.string().trim().min(1).max(240),reason:Zt,color_seeds:zn,surface_mode:k.enum(["light","dark"]),radius:Kn,font_pairing_id:Jt,motion_preset_id:en,density:tn}).strict(),Rr=k.object({version:k.number().int().min(1),recommendation_id:k.string().uuid(),theme_preset_id:Qt,color_seeds:zn,surface_mode:k.enum(["light","dark"]),font_pairing_id:Jt,motion_preset_id:en,density:tn,radius:Kn.optional(),aesthetic_note:x_.optional(),updated_at:xr}).strict(),I_=k.object({id:k.string().uuid(),version:k.number().int().min(1),catalog_version:k.string().trim().min(1).max(80),source:k.object({mode:k.enum(["ai","fallback"]),fallback_reason:k.string().trim().min(1).max(80).nullable()}).strict(),inputs:k.object({industry:k.string().trim().min(1).max(160).optional(),site_language:k.string().trim().min(2).max(35),owner_locale:pe.optional(),strategy_version:k.number().int().min(1),input_digest:k.string().regex(/^sha256:[a-f0-9]{64}$/)}).strict(),theme:k.object({recommended_id:Qt,candidate_ids:k.array(Qt).length(3),candidates:k.array(E_).length(3)}).strict().superRefine((t,n)=>{t.recommended_id!==t.candidate_ids[0]&&n.addIssue({code:"custom",path:["recommended_id"],message:"recommended_id must be the first candidate"}),t.candidates.some((s,a)=>s.id!==t.candidate_ids[a]||s.rank!==a+1)&&n.addIssue({code:"custom",path:["candidates"],message:"Candidates must follow candidate_ids order."})}),font:k.object({recommended_id:Jt,reason:Zt}).strict(),motion:k.object({recommended_id:en,reason:Zt}).strict(),density:k.object({recommended_id:tn,reason:Zt}).strict(),conversion:st.optional(),generated_at:xr}).strict(),M1=k.object({force_refresh:k.boolean().optional()}).strict(),U1=k.object({request_id:k.string().trim().min(1).max(160),site_id:I,cached:k.boolean(),recommendation:I_,selection:Rr}).strict(),F1=k.object({recommendation_id:k.string().uuid(),expected_version:k.number().int().min(1),theme_preset_id:Qt,color_seeds:zn,surface_mode:k.enum(["light","dark"]),font_pairing_id:Jt,motion_preset_id:en,density:tn,radius:Kn.optional(),aesthetic_note:k.string().trim().max(Er).optional()}).strict(),q1=k.object({selection:Rr}).strict(),G1=k.object({tenant_id:k.string().trim().min(1).max(160),site_id:I,site_language:k.string().trim().min(2).max(35),owner_locale:pe,industry:k.string().trim().min(1).max(160).optional(),strategy_version_id:k.string().uuid(),strategy_version:k.number().int().min(1),strategy_checksum:k.string().regex(/^[a-f0-9]{64}$/),strategy_summary:k.array(k.string().trim().min(1).max(500)).min(1).max(fe),reference_image_source_id:nt.optional(),owner_whole_site_request:k.string().trim().min(1).max(gt).optional()}).strict(),K1=k.object({theme_candidates:k.array(Ir).length(3),conversion:st.optional()}).strict().superRefine((t,n)=>{let s=new Set;t.theme_candidates.forEach((a,i)=>{let r=JSON.stringify(a.color_seeds).toUpperCase();s.has(r)&&n.addIssue({code:"custom",path:["theme_candidates",i,"color_seeds"],message:"Theme candidates must have pairwise distinct color_seeds"}),s.add(r)})});function z1(){return ri.map(t=>Ir.parse({name:t.name,description:t.description,reason:t.fallbackReason,color_seeds:t.colorSeeds,surface_mode:t.surfaceMode,radius:t.radius,font_pairing_id:ii[0],motion_preset_id:oi[0],density:ai[1]}))}function R_(t){return t.radius??yr(t.theme_preset_id)??"lg"}function B1(t){let n=ur(t.font_pairing_id),s=hr(t.motion_preset_id);return{colorSeeds:t.color_seeds,surfaceMode:t.surface_mode,fonts:{heading:n.heading,body:n.body},density:t.density,motionLevel:s.motionLevel,motionPreset:s.id,radius:R_(t)}}function W1(t,n){let s=t.theme.candidates[0];return{version:1,recommendation_id:t.id,theme_preset_id:s.id,color_seeds:s.color_seeds,surface_mode:s.surface_mode,font_pairing_id:t.font.recommended_id,motion_preset_id:t.motion.recommended_id,density:t.density.recommended_id,radius:s.radius,updated_at:n.toISOString()}}import{z as Xe}from"zod";var Y1=Xe.object({site_id:I,site_language:Xe.string().trim().min(2).max(35),business_facts:Xe.array(Xe.string().trim().min(1).max(1e3)).min(1).max(8)}).strict(),T_=Xe.enum(["high","medium","low"]),X1=Xe.object({skill_name:Xe.string().trim().min(1).max(80).nullable(),confidence:T_,reason:Xe.string().trim().min(1).max(240)}).strict();import{z as W}from"zod";var k_=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],Tr=W.object({name:W.string().min(1).max(100),type:W.enum(k_),label:W.string().min(1).max(255),required:W.boolean().optional(),options:W.array(W.string()).optional()}),J1=W.object({name:W.string(),cms_type:W.string(),label:W.string().optional(),required:W.boolean().optional(),value_shape:W.string().optional(),front_display:W.enum(["visible","internal","forbidden"]).optional(),choices:W.array(W.object({value:W.union([W.string(),W.number()]),label:W.string()})).optional()}),e0=W.object({route_file_path:W.string().min(1),target_component_path:W.string().min(1),content_type_hint:W.string().min(1),collection_purpose:W.enum(["generic","product"]).optional(),required_fields:W.array(Tr).optional(),mode:W.enum(["bind_existing","provision"]),list_mode:W.enum(["page","embedded"]).optional(),fields:W.array(Tr).optional(),seed_records:W.array(W.record(W.string(),W.unknown())).optional()});import{z as me}from"zod";var nn=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number","file"],P_=me.object({name:me.string().min(1).max(100),type:me.enum(nn),label:me.string().min(1).max(255),required:me.boolean().optional(),options:me.array(me.string()).optional()}),A_=me.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),s0=me.object({mode:me.enum(["bind_existing","provision"],{error:'mode is required. Use "bind_existing" or "provision". Never call connect_form with {}.'}),form_hint:me.string().min(1).optional(),name:me.string().min(1).max(255).optional(),component_slug:A_,description:me.string().min(1).max(1e3).optional(),fields:me.array(P_).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"})}),i0=me.object({name:me.string(),label:me.string(),cms_type:me.string(),required:me.boolean()});import{z as l}from"zod";var sn=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,Et=/^[A-Za-z][A-Za-z0-9_-]{0,127}$/,Bn=/^[A-Za-z][A-Za-z0-9_]{0,99}$/,wr=/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/,pi=/^[a-z][a-z0-9-]{0,99}$/,vr=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,kr=2,Pr=3,Wn=l.string().regex(sn),w_=l.string().regex(sn),di=l.string().regex(sn),an=l.string().regex(Bn),ui=l.string().regex(wr),v_=l.discriminatedUnion("status",[l.object({status:l.literal("unbound"),form_code:l.null()}).strict(),l.object({status:l.literal("bound"),form_code:l.string().regex(Et)}).strict(),l.object({status:l.literal("missing"),form_code:l.string().regex(Et)}).strict()]),C_=l.object({value:ui,label:l.string().trim().min(1).max(255)}).strict(),D_=l.object({kind:l.literal("field"),field_name:an,type:l.enum(nn),label:l.string().trim().min(1).max(255),required:l.boolean(),span:l.enum(["full","half"]),options:l.array(C_).max(100),max_files:l.number().int().min(1).max(5).optional()}).strict(),j_=l.object({kind:l.literal("step-break"),step_id:l.string().regex(sn)}).strict(),O_=l.discriminatedUnion("kind",[D_,j_]),N_=l.object({field_name:an,type:l.enum(nn),last_label:l.string().max(255)}).strict(),L_=l.object({field_name:an,value:ui,last_label:l.string().max(255)}).strict(),M_=l.discriminatedUnion("kind",[l.object({kind:l.literal("custom")}).strict(),l.object({kind:l.literal("template"),slug:l.string().regex(pi),version:l.string().regex(vr)}).strict()]),U_={select:2,radio:2,multiselect:1,DropdownSelection:2,RadioButton:2,Checkbox:1};function Me(t){return t.toLowerCase()}function Cr(t,n){return t.trim().toLocaleLowerCase(n)}function xt(t,n){return`${Me(t)}\0${n}`}function he(t,n,s,a){let i=new Set;for(let r of t){if(i.has(r)){a.addIssue({code:"custom",path:n,message:s});return}i.add(r)}}function gi(t,n,s,a){let i=U_[t]??0;i>0&&n<i?a.addIssue({code:"custom",path:s,message:`choice field requires at least ${i} option${i===1?"":"s"}`}):i===0&&n>0&&a.addIssue({code:"custom",path:s,message:"non-choice fields must use an empty options array"})}var _i=l.object({schema_version:l.literal(1),min_runtime_version:l.number().int().positive(),form_definition_id:Wn,binding:v_,content_locale:pe,features:l.object({multistep:l.boolean()}).strict(),copy:l.object({title:l.string().max(255),description:l.string().max(1e3),submit_button:l.string().trim().min(1).max(100),success_message:l.string().trim().min(1).max(500),error_message:l.string().max(500)}).strict(),layout:l.object({columns:l.enum(["one","two"])}).strict(),nodes:l.array(O_).min(1).max(200),source:M_,retired:l.object({fields:l.array(N_).max(1e3),options:l.array(L_).max(5e3)}).strict(),compatibility:l.object({standardization_version:l.number().int().positive(),diagnostics:l.array(l.string().trim().min(1).max(500)).max(100)}).strict()}).strict().superRefine((t,n)=>{let s=t.nodes.flatMap((c,g)=>c.kind==="field"?[[g,c]]:[]),a=s.map(([,c])=>c);a.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"at least one field node is required"});let i=t.nodes.filter(c=>c.kind==="step-break");!t.features.multistep&&i.length>0&&n.addIssue({code:"custom",path:["nodes"],message:"step-break requires the multistep feature"}),t.features.multistep&&(t.min_runtime_version<kr&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`multistep requires runtime version ${kr}`}),i.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"multistep requires at least one step-break"}));for(let[c,g]of t.nodes.entries())g.kind==="step-break"&&(c===0||c===t.nodes.length-1||t.nodes[c-1]?.kind==="step-break"||t.nodes[c+1]?.kind==="step-break")&&n.addIssue({code:"custom",path:["nodes",c],message:"step-break must separate two non-empty steps"});he(i.map(c=>c.step_id),["nodes"],"step_id must be unique",n),he(a.map(c=>Me(c.field_name)),["nodes"],"field_name must be unique",n),he(t.retired.fields.map(c=>Me(c.field_name)),["retired","fields"],"retired field_name must be unique",n);let r=new Set(t.retired.fields.map(c=>Me(c.field_name)));for(let[c,g]of s)r.has(Me(g.field_name))&&n.addIssue({code:"custom",path:["nodes",c,"field_name"],message:"retired field_name cannot be reused"}),gi(g.type,g.options.length,["nodes",c,"options"],n),g.type==="file"?t.min_runtime_version<Pr&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`file fields require runtime version ${Pr}`}):g.max_files!==void 0&&n.addIssue({code:"custom",path:["nodes",c,"max_files"],message:"max_files is only valid for file fields"}),he(g.options.map(j=>j.value),["nodes",c,"options"],"option value must be unique within a field",n),he(g.options.map(j=>Cr(j.label,t.content_locale)),["nodes",c,"options"],"option label must be unique within a field",n);he(t.retired.options.map(c=>xt(c.field_name,c.value)),["retired","options"],"retired option identity must be unique",n);let _=new Set(t.retired.options.map(c=>xt(c.field_name,c.value)));for(let[c,g]of s)for(let[j,E]of g.options.entries())_.has(xt(g.field_name,E.value))&&n.addIssue({code:"custom",path:["nodes",c,"options",j,"value"],message:"retired option value cannot be reused"})}),F_=["copy.title","copy.description","copy.submit_button","copy.success_message","copy.error_message","nodes.*.label","nodes.*.options.*.label"],q_=new Set(F_);function p0(t){let n=t.map(s=>typeof s=="number"||/^\d+$/.test(s)?"*":s).join(".");return q_.has(n)}function d0(t,n){let s=[],a=t.nodes.filter(c=>c.kind==="field"),i=new Map(n.nodes.filter(c=>c.kind==="field").map(c=>[Me(c.field_name),c])),r=new Map(n.retired.fields.map(c=>[Me(c.field_name),c])),_=new Map(n.retired.options.map(c=>[xt(c.field_name,c.value),c]));for(let c of a){let g=Me(c.field_name),j=i.get(g),E=r.get(g);j&&j.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),j&&j.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),!j&&E&&E.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),!j&&E&&E.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),!j&&!r.has(g)&&s.push({code:"FIELD_RETIREMENT_MISSING",field_name:c.field_name});let O=new Set(j?.options.map(F=>F.value)??[]);for(let F of c.options){let q=_.get(xt(c.field_name,F.value));!O.has(F.value)&&q&&q.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),!O.has(F.value)&&!q&&s.push({code:"OPTION_RETIREMENT_MISSING",field_name:c.field_name,value:F.value})}}for(let c of t.retired.fields){let g=r.get(Me(c.field_name));g&&g.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),g&&g.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),g||s.push({code:"FIELD_RETIREMENT_MISSING",field_name:c.field_name})}for(let c of t.retired.options){let g=_.get(xt(c.field_name,c.value));g&&g.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),g||s.push({code:"OPTION_RETIREMENT_MISSING",field_name:c.field_name,value:c.value})}return s}var G_=l.enum(jt),Ze=l.object({english:l.string().max(1e3),translations:l.partialRecord(G_,l.string().max(1e3)).optional()}).strict(),K_=l.object({template_option_key:l.string().regex(wr),label:Ze}).strict(),z_=l.object({template_field_key:l.string().regex(Bn),type:l.enum(nn),label:Ze,required:l.boolean(),span:l.enum(["full","half"]),options:l.array(K_).max(100)}).strict(),B_=l.object({template_step_key:l.string().regex(Bn),after_field_key:l.string().regex(Bn)}).strict(),u0=["lead-generation","trial-and-samples","quote-and-commerce","appointments-and-visits","resources-and-subscriptions","service-and-channel"],g0=[1,1,1,1,1,1],Dr=l.string().regex(pi),W_=l.object({schema_version:l.literal(1),slug:Dr,name:Ze,template_count:l.number().int().min(0).max(500)}).strict().superRefine((t,n)=>{t.name.english.trim()===""&&n.addIssue({code:"custom",path:["name","english"],message:"English category name is required"})}),V_=l.object({schema_version:l.literal(1),slug:l.string().regex(pi),version:l.string().regex(vr),category:Dr,copy:l.object({title:Ze,description:Ze,submit_button:Ze,success_message:Ze,error_message:Ze}).strict(),layout:l.object({columns:l.enum(["one","two"])}).strict(),fields:l.array(z_).min(1).max(200),step_breaks:l.array(B_).max(20).optional()}).strict().superRefine((t,n)=>{for(let r of["title","description","submit_button","success_message","error_message"])t.copy[r].english.trim()===""&&n.addIssue({code:"custom",path:["copy",r,"english"],message:"English baseline text is required"});he(t.fields.map(r=>r.template_field_key),["fields"],"template_field_key must be unique",n);let s=new Map(t.fields.map((r,_)=>[r.template_field_key,_])),a=t.step_breaks??[];he(a.map(r=>r.template_step_key),["step_breaks"],"template_step_key must be unique",n),he(a.map(r=>r.after_field_key),["step_breaks"],"step breaks must not share an anchor field",n);let i=-1;for(let[r,_]of a.entries()){let c=s.get(_.after_field_key);c===void 0||c>=t.fields.length-1?n.addIssue({code:"custom",path:["step_breaks",r,"after_field_key"],message:"step break must follow an existing non-final field"}):c<=i&&n.addIssue({code:"custom",path:["step_breaks",r,"after_field_key"],message:"step breaks must follow field order"}),i=c??i}t.fields.length+a.length>200&&n.addIssue({code:"custom",path:["step_breaks"],message:"template fields and step breaks must not exceed 200 nodes"});for(let[r,_]of t.fields.entries()){_.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",r,"label","english"],message:"English field label is required"}),gi(_.type,_.options.length,["fields",r,"options"],n),he(_.options.map(c=>c.template_option_key),["fields",r,"options"],"template_option_key must be unique within a field",n),he(_.options.map(c=>c.label.english.trim().toLowerCase()),["fields",r,"options"],"English option labels must be unique within a field",n);for(let[c,g]of _.options.entries())g.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",r,"options",c,"label","english"],message:"English option label is required"})}}),_0=l.object({schema_version:l.literal(1),visibility:l.enum(["internal","public"]),categories:l.array(W_).max(500),templates:l.array(V_).max(500)}).strict().superRefine((t,n)=>{let s=(i,r)=>{let _=jt.filter(c=>!i.translations?.[c]?.trim());_.length>0&&n.addIssue({code:"custom",path:[...r,"translations"],message:`public template copy is missing locales: ${_.join(", ")}`})};he(t.categories.map(i=>i.slug),["categories"],"template category slug must be unique",n);let a=new Set(t.categories.map(i=>i.slug));for(let[i,r]of t.categories.entries()){let _=t.templates.filter(c=>c.category===r.slug).length;r.template_count!==_&&n.addIssue({code:"custom",path:["categories",i,"template_count"],message:"template_count must match catalog templates"})}he(t.templates.map(i=>i.slug),["templates"],"template slug must be unique",n);for(let[i,r]of t.templates.entries())a.has(r.category)||n.addIssue({code:"custom",path:["templates",i,"category"],message:"template category must exist in catalog categories"});if(t.visibility==="public"){for(let[i,r]of t.categories.entries())s(r.name,["categories",i,"name"]);for(let[i,r]of t.templates.entries()){for(let[_,c]of Object.entries(r.copy))s(c,["templates",i,"copy",_]);for(let[_,c]of r.fields.entries()){s(c.label,["templates",i,"fields",_,"label"]);for(let[g,j]of c.options.entries())s(j.label,["templates",i,"fields",_,"options",g,"label"])}}}});function h0(t,n){let s=da(n),a=s?t.translations?.[s]:void 0;return a!==void 0&&a.trim()!==""?a:t.english}var H_=["Text","Summary","Email","Phone","DropdownSelection","RadioButton","Checkbox","Boolean","Date","Num","MultipleFile","SpecificFile"],$_={text:"Text",textarea:"Summary",email:"Email",phone:"Phone",select:"DropdownSelection",radio:"RadioButton",multiselect:"Checkbox",boolean:"Boolean",date:"Date",number:"Num",file:"MultipleFile"},Y_=l.object({value:ui,label:l.string().trim().min(1).max(255)}).strict(),X_=l.object({field_name:an,field_type:l.enum(H_),field_label:l.string().trim().min(1).max(255),is_required:l.boolean(),sort_order:l.number().int().nonnegative(),options:l.array(Y_).max(100)}).strict(),jr=l.object({version:l.literal(1),locale:pe,fields:l.array(X_).min(1).max(200)}).strict().superRefine((t,n)=>{he(t.fields.map(s=>Me(s.field_name)),["fields"],"field_name must be unique",n);for(let[s,a]of t.fields.entries())gi(a.field_type,a.options.length,["fields",s,"options"],n),he(a.options.map(i=>i.value),["fields",s,"options"],"option value must be unique within a field",n),he(a.options.map(i=>Cr(i.label,t.locale)),["fields",s,"options"],"option label must be unique within a field",n)});function S0(t){let n=t.nodes.filter(s=>s.kind==="field").map((s,a)=>({field_name:s.field_name,field_type:s.type==="file"&&s.max_files===1?"SpecificFile":$_[s.type],field_label:s.label,is_required:s.required,sort_order:a,options:s.options.map(i=>({...i}))}));return jr.parse({version:1,locale:t.content_locale,fields:n})}var ee=l.string().regex(/^sha256:[0-9a-f]{64}$/),Z_=l.union([le,l.enum(["app/api/forms/[code]/route.ts","hooks/use-cms-form-submit.ts","lib/cms/forms.ts","lib/cms/client.ts"])]),Q_=l.object({path:Z_,content_hash:ee.nullable()}).strict(),J_=l.array(Q_).min(1).max(500).superRefine((t,n)=>{he(t.map(s=>s.path),[],"affected file paths must be unique",n)}),hi=l.object({grade:l.enum(["standard","A","B","C"]),required:l.boolean(),pending_confirmations:l.array(l.object({item_id:l.string().regex(sn),field_name:an.optional(),kind:l.enum(["form_copy","layout","field_label","field_type","field_required","field_options"]),message:l.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 s=t.grade==="standard";s===t.required&&n.addIssue({code:"custom",path:["required"],message:s?"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"})}),eh=l.object({site_id:I,form_definition_id:Wn,base_snapshot_id:x,expected_form_spec_hash:ee,expected_cms_schema_hash:ee.nullable(),draft_form_spec_hash:ee,desired_cms_schema_hash:ee,affected_files_hash:ee,shared_reference_hash:ee,shared_reference_count:l.number().int().positive(),confirm_shared_update:l.boolean(),recreate_missing_binding:l.boolean(),standardization:hi,confirm_standardization:l.boolean()}).strict(),Or=l.object({reference_hash:ee,page_count:l.number().int().positive(),block_count:l.number().int().positive()}).strict().refine(t=>t.page_count<=t.block_count,{message:"page_count cannot exceed block_count"}),f0=l.object({site_id:I,form_block_id:w_,base_snapshot_id:x,form_spec:_i,runtime_upgrade_required:l.boolean(),expected_form_spec_hash:ee,expected_cms_schema_hash:ee.nullable(),affected_files_hash:ee,shared_impact:Or,standardization:hi}).strict(),th=l.object({operation_id:di,operation_fingerprint:ee,site_id:I,form_definition_id:Wn,base_snapshot_id:x,expected_form_spec_hash:ee,expected_cms_schema_hash:ee.nullable(),draft_form_spec:_i,draft_form_spec_hash:ee,desired_cms_schema_hash:ee,affected_files_hash:ee,shared_impact:Or,confirm_shared_update:l.boolean(),recreate_missing_binding:l.boolean(),standardization:hi,confirm_standardization:l.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 s=t.draft_form_spec.binding.status==="missing";s!==t.recreate_missing_binding&&n.addIssue({code:"custom",path:["recreate_missing_binding"],message:s?"missing bindings require explicit recreation confirmation":"only missing bindings can be recreated"});let a=t.draft_form_spec.binding.status==="bound",i=a&&t.standardization.required&&(t.standardization.grade==="B"||t.standardization.grade==="C");(a&&!i&&t.expected_cms_schema_hash===null||!a&&t.expected_cms_schema_hash!==null)&&n.addIssue({code:"custom",path:["expected_cms_schema_hash"],message:a?"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"})}),nh=["created","validated","binding_reserved","candidate_ready","cms_applied","snapshot_promoted","committed","compensating","recovery_required","failed"],Si=l.enum(nh),sh=["pending","running","succeeded","failed","recovery_required"],Nr=l.enum(sh),ih=["candidate_abandon","snapshot_reconcile","cms_restore"],Lr=l.enum(ih),ah=["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"],fi=l.enum(ah),Mr=l.enum(["wait","resume","retry_new_operation","manual_recovery","none"]),Ur=l.enum(["not_started","pending","succeeded","failed"]),Fr=l.object({operation_id:di,operation_fingerprint:ee,site_id:I,form_definition_id:Wn,stage:Si,status:Nr,base_snapshot_id:x,candidate_snapshot_id:x.nullable(),before_form_code:l.string().regex(Et).nullable(),materialized_form_code:l.string().regex(Et).nullable(),expected_form_spec_hash:ee,draft_form_spec_hash:ee,materialized_form_spec_hash:ee.nullable(),expected_cms_schema_hash:ee.nullable(),desired_cms_schema_hash:ee,retry_count:l.number().int().nonnegative(),failure_stage:Lr.nullable(),last_error_code:fi.nullable(),retryable:l.boolean(),next_action:Mr,preview_refresh_status:Ur,created_at:l.string().datetime({offset:!0}),updated_at:l.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 s of["candidate_snapshot_id","materialized_form_code","materialized_form_spec_hash"])t[s]===null&&n.addIssue({code:"custom",path:[s],message:`${s} 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"})}}),bi=l.object({operation:Fr}).strict(),b0=bi,y0=bi,x0=l.object({operation_fingerprint:ee}).strict(),E0=bi,oh=l.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},th),I0=l.object({operation:Fr,request:oh,cms_replace_result:l.unknown().nullable()}).strict(),rh=l.object({stage:Si.optional(),status:Nr.optional(),candidate_snapshot_id:x.nullable().optional(),before_form_code:l.string().regex(Et).nullable().optional(),materialized_form_code:l.string().regex(Et).nullable().optional(),materialized_form_spec_hash:ee.nullable().optional(),retry_count:l.number().int().nonnegative().optional(),failure_stage:Lr.nullable().optional(),last_error_code:fi.nullable().optional(),retryable:l.boolean().optional(),next_action:Mr.optional(),preview_refresh_status:Ur.optional()}).strict(),R0=l.object({expected_updated_at:l.string().datetime({offset:!0}),operation:rh,cms_replace_result:l.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"}),T0=l.object({code:fi,message:l.string().trim().min(1).max(500),retryable:l.boolean(),operation_id:di.optional(),stage:Si.optional()}).strict();function ch(t){return eh.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 Ar(t){for(let n=0;n<t.length;n+=1){let s=t.charCodeAt(n);if(s>=55296&&s<=56319){let a=t.charCodeAt(n+1);if(n+1>=t.length||a<56320||a>57343)throw new TypeError("canonical JSON cannot contain a lone surrogate");n+=1}else if(s>=56320&&s<=57343)throw new TypeError("canonical JSON cannot contain a lone surrogate")}}function li(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 Ar(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 r=[];for(let _=0;_<t.length;_+=1){if(!(_ in t))throw new TypeError("canonical JSON cannot contain sparse arrays");r.push(li(t[_],n))}return`[${r.join(",")}]`}let s=Object.getPrototypeOf(t);if(s!==Object.prototype&&s!==null)throw new TypeError("canonical JSON objects must be plain records");let a=t;return`{${Object.keys(a).sort().map(r=>(Ar(r),`${JSON.stringify(r)}:${li(a[r],n)}`)).join(",")}}`}finally{n.delete(t)}}function yi(t){return li(t,new Set)}async function Vn(t){let n=yi(t),s=new TextEncoder().encode(n),a=globalThis.crypto?.subtle?new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",s)):(await import("@noble/hashes/sha256")).sha256(s);return`sha256:${Array.from(a,r=>r.toString(16).padStart(2,"0")).join("")}`}async function k0(t){return Vn(_i.parse(t))}async function P0(t){return Vn(jr.parse(t))}async function A0(t){let n=J_.parse(t).map(s=>({...s})).sort((s,a)=>s.path<a.path?-1:s.path>a.path?1:0);return Vn({version:1,files:n})}async function w0(t){return Vn(ch(t))}import{z as P}from"zod";var D0=["page-seo","root-layout-metadata","nav-items"],j0=P.object({path:P.string(),title:P.string(),description:P.string().optional(),keywords:P.string().optional(),meta_tags_json:P.record(P.string(),P.record(P.string(),P.string())).nullish(),schema_json:P.union([P.record(P.string(),P.unknown()),P.array(P.record(P.string(),P.unknown())),P.string()]).nullish(),breadcrumbs_json:P.array(P.object({name:P.string().optional(),text:P.string().optional(),url:P.string().nullish()})).nullish()}),O0=P.object({metadataBase:P.string().optional(),title:P.union([P.string(),P.object({default:P.string().optional(),template:P.string().optional(),absolute:P.string().optional()})]).optional(),description:P.string().optional(),keywords:P.string().optional(),openGraph:P.object({title:P.string().optional(),description:P.string().optional(),type:P.string().optional(),siteName:P.string().optional(),url:P.string().optional(),locale:P.string().optional(),images:P.array(P.union([P.string(),P.object({url:P.string(),alt:P.string().optional()})])).optional()}).optional(),twitter:P.object({card:P.string().optional(),title:P.string().optional(),description:P.string().optional(),images:P.array(P.string()).optional()}).optional(),alternates:P.object({canonical:P.string().optional()}).optional()}),qr=()=>P.object({label:P.string(),href:P.string().optional(),targetType:P.enum(["page","anchor","external","email","phone","file","group"]).optional(),role:P.enum(["link","cta"]).optional(),openInNewTab:P.boolean().optional(),nofollow:P.boolean().optional(),description:P.string().optional(),badge:P.string().optional(),iconKey:P.string().optional()}),N0=qr().extend({children:P.array(qr()).optional()}),mh=["title","description","keywords","breadcrumbs_json.*.name","breadcrumbs_json.*.text"],lh=["path","meta_tags_json.**","schema_json.**","breadcrumbs_json.*.url"],ph=["title","title.default","title.template","title.absolute","description","keywords","openGraph.title","openGraph.description","openGraph.siteName","openGraph.images.*.alt","twitter.title","twitter.description"],dh=["metadataBase","openGraph.type","openGraph.url","openGraph.locale","openGraph.images.*","openGraph.images.*.url","twitter.card","twitter.images.*","alternates.canonical"],uh=["label","description","badge"],gh=["href","targetType","role","iconKey"],Gr={"page-seo":{localizable:mh,machine:lh},"root-layout-metadata":{localizable:ph,machine:dh},"nav-items":{localizable:uh,machine:gh}},Kr="*",zr="**",_h="children";function hh(t){return typeof t=="number"||/^\d+$/.test(t)?Kr:t}function Br(t,n){let s=n.map(hh);return t!=="nav-items"?s:s.filter(a=>a!==Kr&&a!==_h)}function Wr(t,n){let s=t.split(".");for(let a=0;a<s.length;a+=1){if(s[a]===zr)return!0;if(a>=n.length||s[a]!==n[a])return!1}return s.length===n.length}function Sh(t,n){let s=t.split(".");if(n.length>=s.length)return!1;for(let a=0;a<n.length;a+=1){if(s[a]===zr)return!0;if(s[a]!==n[a])return!1}return!0}function L0(t,n){let s=Br(t,n);return s.length===0?!1:Gr[t].localizable.some(a=>Wr(a,s))}function M0(t,n){let s=Br(t,n);if(s.length===0)return!0;let{localizable:a,machine:i}=Gr[t];return[...a,...i].some(r=>Wr(r,s)||Sh(r,s))}var q0=["product-search","migration-products","standard-form","form-submission-infrastructure"],fh=[{path:"app/search/page.tsx",materializer:"product-search"},{path:"components/site/generated/product-search/entry.tsx",materializer:"product-search"},{path:"components/site/generated/product-search/results.tsx",materializer:"product-search"},{path:"app/api/product-search/facets/route.ts",materializer:"product-search"},{path:"lib/cms/product-search.ts",materializer:"product-search"},{path:"lib/generated/product-search-value-codec.ts",materializer:"product-search"},{path:"lib/generated/product-search-config.json",materializer:"product-search"},{path:`lib/cms/generated/${Ke}.ts`,materializer:"migration-products"},{path:`components/site/generated/${Ke}-list.tsx`,materializer:"migration-products"},{path:`components/site/generated/${Ke}-list-view.tsx`,materializer:"migration-products"},{path:`components/site/generated/${Ke}-detail-view.tsx`,materializer:"migration-products"},{path:`app/${Ke}/[slug]/page.tsx`,materializer:"migration-products"},{path:`components/site/generated/${Ke}-breadcrumb.tsx`,materializer:"migration-products"},{path:"components/site/generated/forms/vcp-form-runtime.tsx",materializer:"standard-form"},{path:"app/api/forms/[code]/route.ts",materializer:"form-submission-infrastructure"},{path:"hooks/use-cms-form-submit.ts",materializer:"form-submission-infrastructure"},{path:"lib/cms/forms.ts",materializer:"form-submission-infrastructure"}],bh=[{prefix:"components/site/generated/forms/form-",suffix:".tsx",materializer:"standard-form"}],G0=[{path:"lib/cms/client.ts",reason:"\u4E0D\u662F\u7269\u5316\u4EA7\u7269\uFF1A\u6A21\u677F\u81EA\u5E26\u7684 CMS \u4F20\u8F93\u5C42\uFF0C\u7269\u5316\u5668\u53EA\u5BF9\u5B83\u505A\u5B9A\u70B9\u5B57\u7B26\u4E32\u5347\u7EA7\uFF08\u591A\u90E8\u5206\u8868\u5355\u63D0\u4EA4\u3001no-store \u8BFB\uFF09\uFF0C\u6574\u4EFD\u8986\u5199\u53CD\u800C\u4F1A\u62B9\u6389\u7AD9\u70B9\u4FA7\u7684\u5176\u4ED6\u5347\u7EA7\u3002"},{path:"components/site/generated/forms/form-<id>.spec.ts",reason:"\u8DEF\u5F84\u5F52\u5E73\u53F0\u3001\u5185\u5BB9\u5F52\u7AD9\u70B9\uFF1A\u8868\u5355\u8BBE\u8BA1\u5668\u5199\u7684\u5B57\u6BB5\u6587\u6848\uFF0C\u5F52 FORM_SPEC_LOCALIZABLE_FIELD_PATHS \u7684\u5B57\u6BB5\u7EA7\u6E05\u5355\u7BA1\u8F96\u3002"}];function yh(t){return t.length>0&&!t.includes("/")&&!t.includes(".")}function K0(t){return fh.some(n=>n.path===t)?!0:bh.some(n=>!t.startsWith(n.prefix)||!t.endsWith(n.suffix)?!1:yh(t.slice(n.prefix.length,t.length-n.suffix.length)))}import{z as Be}from"zod";var xh=["provisioning","cms_app_created","seeded","ready","failed"],V0=Be.object({tenant_id:Be.string().min(1),site_id:I,collection_slug:Be.string().min(1),cms_collection_id:Be.string().min(1).nullable(),status:Be.enum(xh),owned_by_vcp:Be.boolean(),run_id:V.nullable(),last_error:Be.string().nullable(),created_at:Be.string().datetime(),updated_at:Be.string().datetime()});var Vr="/vibe/v1";function $0(t){let n=t?.trim().replace(/\/+$/,"");if(!n)return null;try{let s=new URL(n),a=s.pathname.replace(/\/+$/,"");return s.search="",s.hash="",s.pathname=a.endsWith(Vr)?a:Vr,s.href.replace(/\/+$/,"")}catch{return n}}import{z as u}from"zod";var Hn=u.string().url().refine(Gh,{message:"URL must use http or https"}),Hr=u.string().trim().pipe(Hn),Eh=u.object({task_type:u.literal("home_url"),task_url:Hr,planned_num:u.number().int().min(1).max(20).optional()}).strict(),Ih=u.object({task_type:u.literal("url_list"),urls:u.array(Hn).min(1).max(1e4)}).strict(),Q0=u.discriminatedUnion("task_type",[Eh,Ih]),J0=u.object({page:u.coerce.number().int().positive().default(1),page_size:u.coerce.number().int().min(1).max(20).default(20)}).strict(),eP=u.object({home_url:Hr}).strict(),mt=u.string().uuid(),It=u.string().uuid(),tP=u.object({task_uuid:mt}).strict(),$r=u.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]),Rh=u.object({task_uuid:mt,status:u.literal("NOT_STARTED"),total:u.literal(0)}).strict(),Th=u.object({task_uuid:mt,status:u.literal("PROCESSING"),total:u.literal(0)}).strict(),nP=u.enum(["no_suitable_page_candidate","page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"]),kh=u.discriminatedUnion("status",[u.object({role:He,status:u.literal("selected"),reason_code:u.null()}).strict(),u.object({role:He,status:u.literal("not_found"),reason_code:u.literal("no_suitable_page_candidate")}).strict(),u.object({role:He,status:u.literal("unknown"),reason_code:u.enum(["page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"])}).strict()]),Yr=u.array(kh).length(7).superRefine((t,n)=>{let s=new Set(t.map(a=>a.role));s.size!==t.length&&n.addIssue({code:"custom",message:"discovery coverage roles must be unique"});for(let a of He.options)s.has(a)||n.addIssue({code:"custom",message:`discovery coverage is missing role ${a}`})}),Ph=u.object({task_uuid:mt,status:u.literal("SUCCEEDED"),total:u.number().int().positive(),discovery_coverage:Yr.optional()}).strict(),Ah=u.enum(["TASK_FAILED","PROVIDER_CAPABILITY_LIMIT","WEBSITE_UNREACHABLE"]),wh=u.object({task_uuid:mt,status:u.literal("FAILED"),total:u.literal(0),error_code:Ah,error_message:u.string().min(1),failure_stage:$r}).strict(),sP=u.discriminatedUnion("status",[Rh,Th,Ph,wh]),vh=u.object({url:Hn,raw_html:u.string().min(1)}).strict(),iP=u.object({task_uuid:mt,status:u.literal("SUCCEEDED"),page:u.number().int().positive(),page_size:u.number().int().min(1).max(20),total:u.number().int().positive(),total_pages:u.number().int().positive(),pages:u.array(vh).max(20),discovery_coverage:Yr.optional()}).strict().superRefine((t,n)=>{t.total_pages!==Math.ceil(t.total/t.page_size)&&n.addIssue({code:"custom",path:["total_pages"],message:"total_pages must equal ceil(total / page_size)"}),t.pages.length>t.page_size&&n.addIssue({code:"custom",path:["pages"],message:"pages must not exceed page_size"})}),aP=u.object({task_code:It}).strict(),Ch=u.object({task_code:It,status:u.literal("NOT_STARTED")}).strict(),Dh=u.object({task_code:It,status:u.literal("PROCESSING")}).strict(),jh=u.object({task_code:It,status:u.literal("SUCCEEDED"),urls:u.array(Hn)}).strict(),Oh=u.literal("SITEMAP_DISCOVERY_FAILED"),Nh=u.object({task_code:It,status:u.literal("FAILED"),error_code:Oh,error_message:u.string().min(1)}).strict(),oP=u.discriminatedUnion("status",[Ch,Dh,jh,Nh]),rP=u.object({company_name:u.string().regex(/\S/u)}).strict(),Lh=u.object({company_name:u.string(),brand_name:u.string(),main_products:u.array(u.string()),industry:u.array(u.string()),subfields:u.array(u.string()),business_intro:u.string(),registered_capital:u.string(),legal_representative:u.string(),target_markets:u.array(u.string()),target_customer_industries:u.array(u.string()),target_customer_roles:u.array(u.string()),purchase_scenarios:u.string(),differentiators:u.array(u.string()),competitors:u.array(u.object({name:u.string(),official_url:u.string()}).strict()).max(3),qualifications:u.array(u.string()),representative_cases:u.array(u.string()),acquisition_channels:u.array(u.string()),desired_domain:u.string(),brand_tone:u.string(),timezone:u.string()}).strict(),$n=u.object({company_uuid:u.string().uuid(),company_info:Lh,created_at:u.string().datetime(),updated_at:u.string().datetime()}),Mh=$n.extend({status:u.literal("NOT_STARTED"),last_error_code:u.null(),last_error_message:u.null(),started_at:u.null(),completed_at:u.null()}).strict(),Uh=$n.extend({status:u.literal("PROCESSING"),last_error_code:u.null(),last_error_message:u.null(),started_at:u.string().datetime(),completed_at:u.null()}).strict(),Xr=$n.extend({status:u.literal("SUCCEEDED"),last_error_code:u.null(),last_error_message:u.null(),started_at:u.string().datetime(),completed_at:u.string().datetime()}).strict(),Zr=$n.extend({status:u.literal("FAILED"),last_error_code:u.string().min(1),last_error_message:u.string().min(1),started_at:u.string().datetime(),completed_at:u.string().datetime()}).strict(),cP=u.discriminatedUnion("status",[Xr,Zr]),mP=u.discriminatedUnion("status",[Mh,Uh,Xr,Zr]),Fh=["BAD_REQUEST","NOT_FOUND","PAYLOAD_TOO_LARGE","INTERNAL_SERVER_ERROR","UNAUTHORIZED","FORBIDDEN","INVALID_TASK_TYPE","TASK_URL_REQUIRED","INVALID_PLANNED_NUM","URL_LIST_REQUIRED","URL_LIST_LIMIT_EXCEEDED","INVALID_URL_LIST","INVALID_PAGINATION","INVALID_TASK_CODE","INVALID_HOME_URL","TASK_CODE_HOME_URL_CONFLICT","SITEMAP_TASK_NOT_FOUND","SITEMAP_DISCOVERY_FAILED","TASK_NOT_FOUND","PROVIDER_CAPABILITY_LIMIT","TASK_FAILED","WEBSITE_UNREACHABLE"],qh=u.enum(Fh),lP=u.object({error_code:qh,error_message:u.string().min(1),failure_stage:$r.optional(),task_uuid:mt.optional(),task_code:It.optional()}).strict();function Gh(t){try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as N}from"zod";var ve=N.string().url().refine(Bh,{message:"URL must use http or https"}),Qr=N.string().min(1).max(512),Yn=N.string().datetime({offset:!0}),Jr=N.enum(["scraping","completed","failed","expired"]),uP=N.object({url:ve,ignore_cache:N.boolean(),sitemap:N.enum(["include","skip"]),include_subdomains:N.boolean(),ignore_query_parameters:N.boolean(),limit:N.number().int().min(1).max(1e5)}).strict(),gP=N.object({links:N.array(ve).max(1e5)}).strict(),_P=N.object({url:ve,limit:N.number().int().min(1).max(1e5),max_discovery_depth:N.literal(1),crawl_entire_domain:N.literal(!1),allow_subdomains:N.literal(!0),sitemap:N.literal("skip")}).strict(),hP=N.object({crawl_id:Qr,expires_at:Yn.optional()}).strict(),SP=N.object({status:Jr,urls:N.array(ve).max(1e5),next:ve.optional(),expires_at:Yn}).strict(),fP=N.object({url:ve,formats:N.tuple([N.literal("rawHtml")]),only_main_content:N.literal(!1),max_age:N.number().int().nonnegative()}).strict(),bP=N.object({url:ve,raw_html:N.string().min(1),status_code:N.number().int().min(100).max(599).nullable()}).strict(),yP=N.object({urls:N.array(ve).min(1).max(1e4),formats:N.tuple([N.literal("rawHtml")]),ignore_invalid_urls:N.literal(!1),max_age:N.number().int().nonnegative(),max_concurrency:N.number().int().positive().optional()}).strict(),xP=N.object({batch_id:Qr,expires_at:Yn.optional()}).strict(),Kh=N.object({url:ve,raw_html:N.string().min(1)}).strict(),EP=N.object({status:Jr,total:N.number().int().nonnegative(),completed:N.number().int().nonnegative(),pages:N.array(Kh).max(1e4),next:ve.optional(),expires_at:Yn}).strict().superRefine((t,n)=>{t.completed>t.total&&n.addIssue({code:"custom",path:["completed"],message:"completed must not exceed total"})}),zh=N.object({url:ve,error_message:N.string().min(1)}).strict(),IP=N.object({errors:N.array(zh).max(1e4),robots_blocked:N.array(ve).max(1e4)}).strict(),RP=N.object({active:N.number().int().nonnegative(),waiting:N.number().int().nonnegative(),max_concurrency:N.number().int().positive()}).strict();function Bh(t){try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as S}from"zod";var tc=S.lazy(()=>rn),Wh=S.enum(["page","block"]),Zn=S.enum(["component","page","pages"]),Vh=S.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),lt=Vh,nc=S.object({requested_locale:lt,resolved_locale:lt,fallback_used:S.boolean()}).strict(),on=S.object({id:S.string().uuid(),key:S.string().min(1),name:S.string().min(1)}).strict(),Xn=on.extend({color:S.string().nullable()}).strict(),wP=S.object({kind:Wh,category_id:S.string().uuid().optional(),tag_id:S.string().uuid().optional(),search:S.string().trim().min(1).max(200).optional(),limit:S.coerce.number().int().min(1).max(50).default(20),cursor:S.string().min(1).optional()}).strict(),Hh=S.object({stable_key:S.string().min(1),type:Zn,title:S.string().min(1).max(200),description:S.string().max(1e3),thumbnail_url:S.string().url().nullable(),resolved_version:S.number().int().positive(),content_schema_version:S.literal(3),category:on.nullable(),tags:S.array(Xn),page_count:S.number().int().nonnegative(),component_count:S.number().int().nonnegative(),locale:nc}).strict(),vP=S.object({items:S.array(Hh),facets:S.object({categories:S.array(on),tags:S.array(Xn)}).strict(),next_cursor:S.string().nullable()}).strict(),CP=S.object({operation_id:S.string().uuidv7(),resolved_version:S.number().int().positive(),base_sitemap_id:S.string().uuid(),base_sitemap_version:S.number().int().positive(),sitemap:tc,target_page_id:S.string().min(1).optional()}).strict(),DP=S.object({next_sitemap:tc,applied:S.object({stable_key:S.string().min(1),resolved_version:S.number().int().positive(),template_type:Zn,page_ids:S.array(S.string().min(1)),block_ids:S.array(S.string().min(1))}).strict(),locale:nc,warnings:S.array(S.string())}).strict(),sc=S.object({nodeId:S.string().uuid(),type:S.string().trim().min(1).max(100),label:S.string().trim().min(1).max(200),variant:S.string().trim().min(1).max(100).optional(),order:S.number().int().nonnegative(),props:S.record(S.string(),S.unknown()),thumbnail:S.string().url().optional(),source:S.unknown().optional()}).strict(),ec=S.object({nodeId:S.string().uuid().optional(),slug:S.string().regex(/^\/$|^\/[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*$/u),navigation:S.object({showInHeader:S.boolean(),showInFooter:S.boolean(),order:S.number().int().nonnegative()}).strict(),components:S.array(sc).min(1).max(100),thumbnail:S.string().url().optional(),source:S.unknown().optional()}).strict(),$h=S.union([sc,ec,S.object({pages:S.array(ec).min(1).max(50),thumbnail:S.string().url().optional(),source:S.unknown().optional()}).strict()]),Yh=S.object({title:S.string().min(1).max(200),description:S.string().min(1).max(1e3),prompt:S.string().min(1).max(8192)}).strict(),Xh=S.object({locale:lt,title:S.string().min(1).max(200),content:S.object({description:S.string().min(1).max(1e3),prompt:S.string().min(1).max(8192),nodes:S.record(S.string().uuid(),Yh)}).strict()}).strict(),jP=S.object({templateId:S.string().uuid(),stableKey:S.string().min(1),type:Zn,resolvedVersion:S.number().int().positive(),contentSchemaVersion:S.literal(3),structure:$h,requestedLocale:lt,resolvedLocale:lt,fallbackUsed:S.boolean(),contents:S.array(Xh).length(1)}).strict().superRefine((t,n)=>{(t.type==="component"&&!("type"in t.structure)||t.type==="page"&&!("components"in t.structure)||t.type==="pages"&&!("pages"in t.structure))&&n.addIssue({code:"custom",path:["structure"],message:"Template type and structure must match."});let s=Zh(t.structure),a=new Set(Object.keys(t.contents[0]?.content.nodes??{}));(s.size!==a.size||[...s].some(i=>!a.has(i)))&&n.addIssue({code:"custom",path:["contents",0,"content","nodes"],message:"Localized nodes must exactly match the structure nodes."}),t.contents[0]?.locale!==t.resolvedLocale&&n.addIssue({code:"custom",path:["contents"],message:"Resolved locale must match returned content."}),t.fallbackUsed!==(t.requestedLocale!==t.resolvedLocale)&&n.addIssue({code:"custom",path:["fallbackUsed"],message:"fallbackUsed must match locale resolution."})}),OP=S.object({items:S.array(S.object({stableKey:S.string().min(1),type:Zn,title:S.string().min(1).max(200),description:S.string().max(1e3),thumbnailUrl:S.string().url().nullable(),resolvedVersion:S.number().int().positive(),contentSchemaVersion:S.literal(3),category:on.nullable(),tags:S.array(Xn),pageCount:S.number().int().nonnegative(),componentCount:S.number().int().nonnegative(),requestedLocale:lt,resolvedLocale:lt,fallbackUsed:S.boolean()}).strict()),facets:S.object({categories:S.array(on),tags:S.array(Xn)}).strict(),nextCursor:S.string().nullable()}).strict().superRefine((t,n)=>{t.items.forEach((s,a)=>{s.fallbackUsed!==(s.requestedLocale!==s.resolvedLocale)&&n.addIssue({code:"custom",path:["items",a,"fallbackUsed"],message:"fallbackUsed must match locale resolution."})})});function Zh(t){if("type"in t)return new Set([t.nodeId]);let n="pages"in t?t.pages:[t];return new Set(n.flatMap(s=>[...s.nodeId?[s.nodeId]:[],...s.components.map(a=>a.nodeId)]))}function NP(t){return yi({tenant_id:t.tenant_id,site_id:t.site_id,stable_key:t.stable_key,resolved_version:t.request.resolved_version,base_sitemap_id:t.request.base_sitemap_id,base_sitemap_version:t.request.base_sitemap_version,sitemap:t.request.sitemap,target_page_id:t.request.target_page_id??null})}import{z as te}from"zod";var Qh=["pending_dns","active","failed","removing"],Jh=te.enum(Qh),eS=["serve_site","redirect_301"],tS=te.enum(eS),nS=["traffic","ownership","certificate_delegation"],sS=te.enum(nS),iS=["pending","verified"],aS=te.enum(iS),xi=te.enum(["prepare_configuration","apply_configuration","verify_dns"]),oS=te.enum(["accepted","running","succeeded","failed"]),rS=te.object({code:te.string().min(1),message:te.string().min(1)}).strict(),cS=te.object({purpose:sS,type:te.string().min(1),name:te.string().min(1),value:te.string().min(1),verificationStatus:aS}).strict(),ic=te.object({id:te.string().min(1),hostname:te.string().min(1),isPrimary:te.boolean(),routingMode:tS,observedStatus:Jh,lastVerifiedAt:te.string().datetime().nullable(),dnsRecords:te.array(cS)}).strict().superRefine((t,n)=>{mS(t.hostname)||n.addIssue({code:"custom",path:["hostname"],message:"hostname must be a canonical ASCII hostname"}),t.isPrimary&&t.routingMode!=="serve_site"&&n.addIssue({code:"custom",path:["routingMode"],message:"a primary domain must serve the site"}),!t.isPrimary&&t.routingMode!=="redirect_301"&&n.addIssue({code:"custom",path:["routingMode"],message:"a non-primary domain must redirect with 301"})}),ac=te.object({primaryDomain:ic.nullable(),redirectDomains:te.array(ic)}).strict().superRefine((t,n)=>{t.primaryDomain!==null&&(!t.primaryDomain.isPrimary||t.primaryDomain.routingMode!=="serve_site")&&n.addIssue({code:"custom",path:["primaryDomain"],message:"primaryDomain must be primary and serve the site"});for(let[a,i]of t.redirectDomains.entries())(i.isPrimary||i.routingMode!=="redirect_301")&&n.addIssue({code:"custom",path:["redirectDomains",a],message:"redirectDomains must be non-primary 301 redirects"});t.primaryDomain!==null&&t.redirectDomains.some(i=>i.hostname===t.primaryDomain?.hostname)&&n.addIssue({code:"custom",path:["redirectDomains"],message:"primaryDomain must not also be a redirect"});let s=[...t.primaryDomain===null?[]:[t.primaryDomain.hostname],...t.redirectDomains.map(a=>a.hostname)];new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["redirectDomains"],message:"domain hostnames must be unique"})}),Ei=te.object({id:te.string().min(1),type:xi,status:oS,error:rS.nullable()}).strict().superRefine((t,n)=>{t.status==="failed"&&t.error===null&&n.addIssue({code:"custom",path:["error"],message:"failed operations must include a stable error"}),t.status!=="failed"&&t.error!==null&&n.addIssue({code:"custom",path:["error"],message:"non-failed operations must not include an error"})});function mS(t){if(t!==t.trim()||t!==t.toLowerCase()||t.length>253||t.endsWith("."))return!1;let n=t.split(".");return n.length>=2&&n[n.length-1].length>=2&&n.every(s=>s.length>=1&&s.length<=63&&/^[a-z0-9-]+$/.test(s)&&!s.startsWith("-")&&!s.endsWith("-"))}import{z as cn}from"zod";import{z as C}from"zod";var lS=C.enum(["active","completed","canceled"]),pS=C.enum(["quality","domain","gsc","publish"]),Rt=C.enum(["pending","running","succeeded","failed"]),dS=C.enum(["calculating","passed","failed"]),uS=C.object({group_code:C.string().min(1),name:C.string().min(1),display_status:Rt,result_text:C.string()}).strict(),gS=C.object({dimension_code:C.enum(["reach","trust","convert","safe"]),name:C.string().min(1),alias_en:C.string().min(1),description:C.string(),tips:C.string(),display_status:Rt,problem_group_count:C.number().int().nonnegative(),groups:C.array(uS)}).strict(),_S=C.object({task_code:C.string().uuid(),status:Rt,remediation_items:C.record(C.string(),C.unknown()),summary:C.object({final_score:C.number().int().min(0).max(100),can_publish:dS,group_count:C.number().int().nonnegative(),problem_group_count:C.number().int().nonnegative()}).strict(),dimensions:C.array(gS)}).strict(),pt=C.object({id:Xi,tenant_id:C.string().min(1),site_id:I,status:lS,current_step:pS,sensitive_word_task_id:C.number().int().nonnegative(),sensitive_word_task_status:Rt,quality_task_code:C.string().uuid(),quality_task_status:Rt,task_id:C.string().min(1).nullable(),task_status:Rt,publish_deployment_id:Fe.nullable(),domain_hostname:C.string().min(1).nullable(),domain_operation_type:xi.nullable(),domain_operation_payload:C.record(C.string(),C.unknown()).nullable(),domain_preparation_operation_id:C.string().min(1).nullable(),domain_operation_id:C.string().min(1).nullable(),revision:C.number().int().positive(),created_at:C.string().min(1),updated_at:C.string().min(1),completed_at:C.string().min(1).nullable(),canceled_at:C.string().min(1).nullable()}).strict().superRefine((t,n)=>{if(t.task_id!==t.quality_task_code&&n.addIssue({code:"custom",path:["task_id"],message:"task_id must remain the read-only quality_task_code alias"}),t.task_status!==t.quality_task_status&&n.addIssue({code:"custom",path:["task_status"],message:"task_status must remain the read-only quality_task_status alias"}),t.domain_operation_type===null){t.domain_operation_payload!==null&&n.addIssue({code:"custom",path:["domain_operation_payload"],message:"domain_operation_payload must be null without an active domain operation"}),t.domain_operation_id!==null&&n.addIssue({code:"custom",path:["domain_operation_id"],message:"domain_operation_id must be null without an active domain operation"});return}t.domain_hostname===null&&n.addIssue({code:"custom",path:["domain_hostname"],message:"an active domain operation requires a hostname"}),t.domain_operation_payload===null&&n.addIssue({code:"custom",path:["domain_operation_payload"],message:"an active domain operation requires a payload"})}),BP=C.object({}).strict(),WP=C.object({}).strict(),VP=C.object({expected_revision:C.number().int().nonnegative(),current_step:C.enum(["domain","gsc","publish"]),skip_domain_binding:C.boolean().optional()}).strict(),HP=C.object({expected_revision:C.number().int().nonnegative()}).strict(),hS=C.object({workflow:pt.nullable(),can_cancel:C.boolean()}).strict(),$P=M(hS).strict(),SS=C.object({workflow:pt,can_cancel:C.boolean()}).strict(),YP=M(SS).strict(),fS=C.object({workflow:pt,deployment:C.lazy(()=>Qe)}).strict(),XP=M(fS).strict(),ZP=C.object({workflow:pt,can_cancel:C.boolean(),quality_result:_S.optional(),message:C.string().min(1).optional()}).strict();var bS=cn.object({hostname:cn.string().min(1),expected_revision:cn.number().int().nonnegative()}).strict(),oc=cn.object({workflow:pt,operation:Ei}).strict(),yS=M(oc).strict(),rc=cn.object({workflow:pt,operation:Ei.nullable()}).strict(),xS=M(rc).strict(),sA=M(ac).strict(),iA=bS,aA=oc,oA=yS,rA=rc,cA=xS;import{z as Pe}from"zod";var ES=["started","success","failed","canceled"],Ii=Pe.enum(ES),IS=["inactive","pending_binding","active"],Ri=Pe.enum(IS),RS=["domain","url_prefix"],Ti=Pe.enum(RS),TS=["not_connected","authorizing","matching_property","ready","failed","canceled","domain_mismatch"],ki=Pe.enum(TS),Ue=Pe.string().nullable(),cc=Pe.object({}).strict(),Pi=Pe.object({authorize_url:Pe.string().url(),custom_domain:Ue}).strict(),mc=M(Pi),kS=Pe.object({auth_status:Ii,binding_status:Ri,credential_connected:Pe.boolean(),custom_domain:Ue,gsc_site_url:Ue,property_type:Ti.nullable(),auth_error_code:Ue,auth_error_message:Ue}).strict(),lc=Pe.object({auth_status:Ii,binding_status:Ri,credential_connected:Pe.boolean(),custom_domain:Ue,gsc_site_url:Ue,property_type:Ti.nullable(),auth_error_code:Ue,auth_error_message:Ue,current_domain:Ue,state:ki,ready:Pe.boolean()}).strict().superRefine((t,n)=>{let s=AS(t,t.current_domain),a=s==="ready";t.state!==s&&n.addIssue({code:"custom",path:["state"],message:`state must equal ${s} for the supplied GSC facts`}),t.ready!==a&&n.addIssue({code:"custom",path:["ready"],message:`ready must equal ${String(a)} for the supplied GSC facts`})}),PS=M(lc);function mn(t){let n=t?.trim()??"";if(!n)return"";let s=/^[a-z][a-z0-9+.-]*:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).hostname.replace(/\.+$/,"").toLowerCase()}catch{return n.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").split(/[/?#]/,1)[0].replace(/\.+$/,"").toLowerCase()}}function AS(t,n){let s=t.gsc_site_url?.trim()??"",a=mn(t.custom_domain),i=mn(n??("current_domain"in t?t.current_domain:void 0)),r=a.length>0&&i.length>0&&a===i,_=wS(s,t.property_type,i);return t.auth_status==="canceled"?"canceled":t.auth_status==="failed"?"failed":t.auth_status==="started"?"authorizing":!t.credential_connected||t.binding_status==="inactive"?"not_connected":s.length===0||t.property_type===null?"matching_property":!r||!_?"domain_mismatch":t.binding_status==="pending_binding"?"matching_property":t.auth_status==="success"&&t.binding_status==="active"&&t.credential_connected&&s.length>0&&r&&_?"ready":"failed"}function wS(t,n,s){let a=t?.trim()??"",i=mn(s);if(!a||!i||!n)return!1;if(n==="domain"){let r=/^sc-domain:(.+)$/i.exec(a);if(!r)return!1;let _=r[1].trim();return!_||/[/:?#]/.test(_)?!1:mn(_)===i}try{let r=new URL(a);return r.protocol!=="https:"||r.username||r.password||r.port||r.pathname!=="/"||r.search||r.hash?!1:mn(r.hostname)===i}catch{return!1}}var dA=cc,uA=Pi,gA=mc,_A=ki,hA=Ii,SA=Ri,fA=Ti,bA=ki,yA=cc,xA=Pi,EA=mc,IA=kS,RA=lc,TA=PS;var pc=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,dc="VCP_E2B_PREVIEW_PROXY_DOMAIN must be a valid hostname.";function vS(t){let n=t?.trim().toLowerCase()??"";if(!n)return null;if(n.length>253||!n.includes(".")||!n.split(".").every(s=>pc.test(s)))throw new Error(dc);return n}function PA(t){let n=vS(t.proxyDomain);if(!n)return null;let s=t.sandboxId.trim();if(!pc.test(s))throw new Error("sandboxId must be a valid DNS label.");if(`${s}.${n}`.length>253)throw new Error(dc);return`https://${s}.${n}/`}function CS(t,n,s=t){let a=new Map(t.map(c=>[c.slug,c])),i=new Map(s.map(c=>[c.id,c])),r=new Map(t.map(c=>{let g=i.get(c.id);return g&&g.slug!==null&&g.slug!==c.slug?[g.slug,c]:null}).filter(c=>c!==null)),_=new Set(s.map(c=>c.slug).filter(c=>c!==null&&!a.has(c)));return{primaryLinks:uc(n.primaryLinks,t,a,r,_,i,"showInHeader"),footerLinks:uc(n.footerLinks,t,a,r,_,i,"showInFooter")}}function uc(t,n,s,a,i,r,_){let c=new Set,g=[];for(let[F,q]of t.entries()){let J=DS(q.href),ne=J===null?void 0:s.get(J)??a.get(J);if(J!==null&&i.has(J)&&!s.has(J)&&!a.has(J))continue;if(!ne||ne.slug==="/"){g.push({kind:"independent",link:q});continue}if(!ne.navigation[_])continue;c.add(ne.slug);let wt=r.get(ne.id),fm=q.label===(wt?.title??ne.title)?ne.title:q.label,bm=J===ne.slug?q.href:jS(q.href,ne.slug);g.push({kind:"page",page:ne,link:{...q,label:fm,href:bm},index:F})}let j=g.filter(F=>F.kind==="page").sort((F,q)=>F.page.navigation.order-q.page.navigation.order||F.index-q.index),E=0,O=g.map(F=>F.kind==="page"?j[E++].link:F.link);for(let F of[...n].filter(q=>q.slug!=="/"&&q.navigation[_]).sort((q,J)=>q.navigation.order-J.navigation.order))c.has(F.slug)||O.push({label:F.title,href:F.slug});return O}function DS(t){if(!t.startsWith("/")||t.startsWith("//"))return null;let n=t.search(/[?#]/u);return n===-1?t:t.slice(0,n)}function jS(t,n){let s=t.search(/[?#]/u);return s===-1?n:`${n}${t.slice(s)}`}import{z as A}from"zod";var gc=20*1024*1024,OS=gc,_c=["jpg","jpeg","png","gif","webp","bmp"],hc=["mp4","avi","mov","webm","mkv"],Sc=["mp3","wav","aac","flac","ogg","wma","m4a"],fc=["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","md","csv"],bc=[...fc,"zip","rar","json","xmind","psd","ai","fig","sketch"],NS=[..._c,...hc,...Sc,...bc],yc=["image/jpeg","image/png","image/gif","image/webp","image/bmp"],xc=["video/mp4","video/x-msvideo","video/quicktime","video/webm","video/x-matroska"],Ec=["audio/mpeg","audio/wav","audio/x-wav","audio/vnd.wave","audio/aac","audio/flac","audio/x-flac","audio/ogg","audio/x-ms-wma","audio/mp4","audio/x-m4a"],LS=[...yc,...xc,...Ec],Ic=A.enum(["image","video","audio","file"]),Rc=A.enum(["external","ai_generated","unsplash"]),Ai=A.object({resource_id:A.string().min(1),name:A.string().min(1).max(255),url:A.string().url(),thumbnail_url:A.union([A.string().url(),A.literal("")]),mime_type:A.string().trim().min(3).max(127),size:A.number().int().nonnegative(),width:A.number().int().positive().nullable(),height:A.number().int().positive().nullable(),source:Rc,created_at:A.string().min(1).nullable()}),MS=A.object({page:A.coerce.number().int().min(1).default(1),page_size:A.coerce.number().int().min(1).max(100).default(24),keyword:A.string().trim().max(100).optional(),file_type:Ic.default("image")}),US=A.object({code:A.literal(0),message:A.string(),data:A.object({items:A.array(Ai),page:A.number().int().min(1),page_size:A.number().int().min(1),total:A.number().int().nonnegative()})}),FS=A.object({code:A.literal(0),message:A.string(),data:Ai}),Tc=A.object({provider_id:A.string().min(1),url:A.string().url(),thumbnail_url:A.string().url(),width:A.number().int().positive(),height:A.number().int().positive(),alt:A.string(),photographer_name:A.string().min(1),photographer_url:A.string().url(),photo_url:A.string().url(),download_location:A.string().url(),dominant_color:A.string().nullable()}),qS=A.object({query:A.string().trim().min(1).max(100),page:A.coerce.number().int().min(1).default(1),page_size:A.coerce.number().int().min(1).max(30).default(18),orientation:A.enum(["landscape","portrait","squarish"]).optional()}),GS=A.object({code:A.literal(0),message:A.string(),data:A.object({items:A.array(Tc),page:A.number().int().min(1),page_size:A.number().int().min(1),total:A.number().int().nonnegative(),total_pages:A.number().int().nonnegative()})}),kc=A.string().url().refine(BS,{message:"download_location must be an official Unsplash download URL"}),KS=A.object({download_location:kc}),zS=A.object({code:A.literal(0),message:A.string(),data:A.object({reported:A.boolean()})});function BS(t){if(!URL.canParse(t))return!1;let n=new URL(t);return n.protocol==="https:"&&n.hostname==="api.unsplash.com"&&n.username===""&&n.password===""&&n.port===""&&n.hash===""&&/^\/photos\/[^/]+\/download$/.test(n.pathname)}import{z as Ce}from"zod";var WS=Ce.object({colorSeeds:Ce.object({primary:Ce.string().min(1).max(40),accent:Ce.string().min(1).max(40),foreground:Ce.string().min(1).max(40).optional()}).strict().optional(),surfaceMode:Ce.enum(["light","dark"]).optional(),fonts:Ce.object({heading:Ce.string().min(1).max(60),body:Ce.string().min(1).max(60)}).strict().optional()}).strict().refine(t=>t.colorSeeds!==void 0||t.surfaceMode!==void 0||t.fonts!==void 0,{message:"colorSeeds, surfaceMode, or fonts is required"}),VS=Ce.object({ok:Ce.literal(!0),design_plan_version:Ce.number().int().positive(),snapshot_id:x});var Ci=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","airy","editorial"]).optional(),motionPreset:e.enum(["subtle","moderate","expressive"]).optional(),colorSeeds:e.object({primary:e.string().min(1).max(40),accent:e.string().min(1).max(40),foreground:e.string().min(1).max(40).optional(),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(),themeId:e.string().min(1).max(60).optional(),themeDescription:e.string().min(1).max(400).optional(),aestheticNote:e.string().min(1).max(300).optional()}),wi=e.enum(["material","reference","brief","industry"]),HS=e.object({market:e.object({value:e.string().min(1).max(200),source:wi}),customer:e.object({value:e.string().min(1).max(200),source:wi}),purpose:e.object({options:e.array(e.string().min(1).max(60)).min(2).max(4),selected:e.string().min(1).max(60),source:wi})}),$S=e.enum(["text-options","motion-slider","positioning"]),Di=e.enum(["none","subtle","moderate","expressive"]),YS=e.enum(["compact","comfortable","airy","editorial"]),XS=Di,Cc=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()}),ZS=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:Ci.optional(),conversionHints:st.optional()}),QS=e.object({id:e.string(),type:$S,question:e.string(),tag:e.string(),aiThinking:e.string(),options:e.array(ZS),source:e.enum(["ai-detected","always-ask"]),sourceDetail:e.string(),positioning:HS.optional()}),ji=e.object({questions:e.array(QS).min(1).max(6)}),nw=e.object({tenant_id:e.string().min(1),site_id:I,brief_id:ut,brief:e.string().min(20).max(1e3),site_default_locale:pe.optional(),owner_locale:pe.optional(),input_context:e.object({facts:e.array(un).max(120),conflicts:e.array(_n).max(20),reference:gn.optional(),sources:e.array(e.object({type:os,title:e.string().max(120).optional(),status:rs})).max(16).optional()}).optional()}),Dc=e.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),sw=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:V,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(Cc).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:Dc.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)})]),iw="SITE_PLANNING_INPUT_FROZEN",aw="SITE_PLANNING_LOCKED",ow="SITE_STRUCTURE_CONFIRMATION_REQUIRED",rw="SITE_STRUCTURE_CONFIRMATION_STALE",cw=e.object({tenant_id:e.string().min(1),owner_user_id:ss,name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),mw=e.object({name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),lw=e.object({name:e.string().min(1).max(120)}),pw=e.object({name:e.string().min(1).max(120),default_locale:pe.optional()}),dw=e.object({body:e.string().min(20).max(1e3)}),uw=e.object({body:e.string().min(20).max(1e3)}),Oi=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"}),gw=e.object({tenant_id:e.string().min(1),site_id:I.optional(),site_url:Oi,site_name:e.string().trim().min(1).max(255).optional()}),_w=M(Aa),hw=M(wa),Sw=M(va),fw=M(Ba),bw=M(Wa),yw=M(Va),xw=M($a),Ew=M(Ya),Iw=M(Xa),Rw=M(e.object({site_id:I,site_url:Oi})),tt=e.object({id:I,tenant_id:e.string().min(1),owner_user_id:ss.nullable(),name:e.string().min(1),slug:e.string().min(1),status:Ms,deployment_status:Us,archived_at:e.string().min(1).nullable(),current_sitemap_id:ke.nullable(),confirmed_sitemap_id:ke.nullable().optional(),confirmed_sitemap_version:e.number().int().positive().nullable().optional(),structure_confirmed_at:e.string().min(1).nullable().optional(),migration_content_requested:e.boolean().optional(),current_snapshot_id:x.nullable(),published_deployment_id:Fe.nullable().optional(),deployed_url:e.string().url().nullable(),default_locale:pe,owner_locale:pe.optional(),cms_site_id:ua.nullable().optional(),cms_site_url:Oi.nullable().optional(),parent_site_id:I.nullable().optional(),mount_path:e.string().min(1).nullable().optional(),schema_version:e.literal(1),created_at:e.string().min(1),updated_at:e.string().min(1)}),Ni=e.object({id:ut,tenant_id:e.string().min(1),site_id:I,body:e.string().min(1),source:e.enum(["user","import","system"]),created_at:e.string().min(1),updated_at:e.string().min(1)}),Tw=e.object({site:tt,brief:Ni,next_step:e.literal("clarify")}),kw=e.object({site:tt,brief:Ni}),Pw=e.object({brief:Ni}),JS=e.enum(["queued","running","succeeded","failed","cancelled"]),jc=e.enum(["clarify","sitemap","workspace"]),Oc=e.enum(["clarify","sitemap","initial_generation","iteration"]),Nc=e.enum(["clarify","sitemap","workspace","summarize"]),et=e.object({id:V,tenant_id:e.string().min(1),site_id:I,agent_type:jc,run_kind:Oc,status:JS,model_route:Nc,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)}),Aw=e.object({run_id:V.optional(),site_id:I,agent_type:jc,run_kind:Oc.optional(),model_route:Nc,input:e.record(e.string(),e.unknown()).optional()}).superRefine((t,n)=>{ln(t.input)&&n.addIssue({code:"custom",path:["input"],message:"Agent run input must not contain secrets"})}),ww=e.object({agent_run:et,next_step:e.literal("stream_events")}),Lc=e.enum(["draft","candidate","deleting","current","failed"]),We=e.object({id:x,tenant_id:e.string().min(1),site_id:I,version:e.number().int().positive(),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),template_version:De.nullable().optional(),reason:e.enum(["initial_generation","workspace_edit","pre_deploy","manual_save","rollback","template_upgrade","subsite_clone"]),status:Lc,created_at:e.string().min(1)}),vw=e.object({snapshot_id:x,creation_key:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),template_version:De.optional(),reason:We.shape.reason,status:e.enum(["draft","candidate","current","failed"]).default("candidate"),source_run_id:V.optional()}),Cw=e.object({site:tt,snapshot:We,next_step:e.literal("workspace")}),Dw=e.object({expected_manifest_hash:We.shape.manifest_hash,manifest_hash:We.shape.manifest_hash,object_key:We.shape.object_key}).strict(),jw=e.union([e.object({base_snapshot_id:x.nullable(),source_run_id:V.optional()}).strict(),e.object({skip_base_check:e.literal(!0)}).strict()]),ef=e.object({site:tt,snapshot:We,next_step:e.literal("workspace")}),Ow=e.object({snapshot:We}),Nw=e.object({status:e.literal("deleting"),snapshot_id:x,object_key:e.string().min(1)}),Lw=e.object({status:e.literal("deleted"),snapshot_id:x}),ts=e.object({id:$i,tenant_id:e.string().min(1),site_id:I,snapshot_id:x,version:e.number().int().positive(),accepted_commit:e.string().min(1),source_run_id:V.nullable(),created_at:e.string().min(1)}),tf=ts.extend({reason:We.shape.reason,status:Lc}),Mw=e.object({accepted_commit:e.string().min(1),source_run_id:V.optional()}),Uw=e.object({site_version:ts,next_step:e.literal("workspace")}),Fw=e.object({owner_id:e.string().min(1)}).strict(),qw=e.discriminatedUnion("acquired",[e.object({acquired:e.literal(!0)}).strict(),e.object({acquired:e.literal(!1)}).strict()]),Gw=e.object({owner_id:e.string().min(1)}).strict(),Kw=e.object({released:e.literal(!0)}).strict(),zw="TEMPLATE_UPGRADE_LOCK_LOST",Bw=e.object({base_snapshot_id:x,accepted_commit:ts.shape.accepted_commit,owner_id:e.string().min(1)}).strict(),Ww=ef.strict(),Vw=e.object({site_versions:e.array(tf)}),Hw=e.object({site:tt,snapshot:We,site_version:ts,next_step:e.literal("workspace")}),$w=e.object({snapshot_id:x,force_rehydrate:e.boolean().optional()}),nf=e.discriminatedUnion("status",[e.object({status:e.literal("ready"),snapshot_id:x,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()})]),Yw=e.object({tenant_id:e.string().min(1),site_id:I,snapshot_id:x}).strict(),Xw=nf,Li=e.enum(_t),Mc=e.enum(["quality_check","publish"]),Qe=e.object({id:Fe,tenant_id:e.string().min(1),site_id:I,snapshot_id:x,type:Mc.default("publish"),version:e.number().int().positive(),status:Li,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)}),Zw=e.object({tenant_id:e.string().min(1),site_id:I,expected_snapshot_id:x}).strict(),Qw=e.object({deployment:Qe}),Jw=e.object({tenant_id:e.string().min(1),site_id:I,deployment_id:Fe}).strict(),ev=e.object({deployment:Qe}),tv=e.object({}).strict(),nv=e.object({snapshot_id:x.optional()}).strict(),sf=e.object({deployment:Qe}),sv=M(sf),iv=e.object({deployment:Qe.nullable()}),av=e.object({deployment:Qe}),Pc=e.object({id:Fe,type:Mc.default("publish"),status:Li,url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable()}),af=e.object({current:Pc.nullable(),latest_released:Pc.nullable()}),ov=M(af),of=e.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),Tt=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:I,deployment_id:Fe,seq:e.number().int().positive(),sent_at:e.string().min(1)}),Qn=e.object({deployment:Qe,steps:No.default([])}),rv=e.discriminatedUnion("type",[Tt.extend({type:e.literal("deployment.snapshot"),payload:Qn}),Tt.extend({type:e.literal("deployment.status.changed"),payload:Qn}),Tt.extend({type:e.literal("deployment.finished"),payload:Qn}),Tt.extend({type:e.literal("deployment.failed"),payload:Qn}),Tt.extend({type:e.literal("deployment.realtime.recovered"),payload:e.object({action:e.literal("refresh")})}),Tt.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})})]),cv=e.object({tenant_id:e.string().min(1),site_id:I,deployment_id:Fe,status:Li,updated_at:e.string().min(1)}),rf="vcp:deployments",mv={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:rf,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...of.options]},cf=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)})}),lv=e.object({error:cf.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:et})})}),pv=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({})}),mf=e.object({theme_id:e.string().min(1),paletteIntent:e.string().min(1),tone:e.string().min(1),mediaMood:e.string().min(1),motionLevel:Di.optional(),userVisualHints:Ci.optional()}),lf=e.object({question:e.string().min(1),answer:e.string().min(1)}),dv=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)}),uv=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()}),pf=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()}),gv=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:pf.optional()}),df=e.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),kt=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:df.default("system_recommended")}),H=e.string().min(1).max(2e3),Ac=e.string().min(1).max(120),Uc=e.object({visualDirection:H,brandFeeling:H,paletteIntent:H,typographyIntent:H,density:YS,motionLevel:XS,motionPreset:e.enum(["subtle","moderate","expressive"]).optional(),mediaStrategy:H,compositionRules:e.array(H).max(20),avoidPatterns:e.array(H).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),foreground:e.string().min(1).max(40).optional(),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()}),Mi=160,Fc=e.object({routeGoal:H,narrativeArc:H,firstViewportIntent:H,visualContinuity:H,sectionRhythm:H,avoidPatterns:e.array(H).max(20),displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(Mi).optional(),metaTitle:e.string().min(1).max(120).optional(),metaDescription:e.string().min(1).max(320).optional(),primaryKeyword:e.string().min(1).max(160).optional(),longTailKeywords:e.array(e.string().min(1).max(160)).max(3).optional()}),qc=e.enum(["model_call","validation","repair","preview","worker_group"]),Je=e.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),Gc=e.object({sectionRole:H,contentIntent:H,layoutIntent:H,visualIntent:H,mediaIntent:H,motionIntent:H,copyTone:H,displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(Mi).optional(),ctaIntent:H.optional(),continuityWithPrevious:H.optional(),avoidRepeating:e.array(H).max(20).optional(),industryRecipeRefs:e.array(Ac).max(12).optional(),templateRecipeRefs:e.array(Ac).max(12).optional()}),Kc=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()}),uf=e.enum(["solid","floating"]),gf=e.enum(["background","card","primary","frosted"]),_f=e.enum(["sticky","hide-on-scroll","static"]),hf=e.enum(["bar","island"]),Sf=e.object({variant:uf,surface:gf.optional(),behavior:_f.optional(),shape:hf.optional()}),ff=e.object({form:H,layoutIntent:H,scrollBehavior:H,shell:Sf.optional(),avoidPatterns:e.array(H).max(10).optional()}),bf=e.enum(["background","card","primary","inverse"]),yf=e.object({surface:bf}),xf=e.object({form:H,composition:H,shell:yf.optional(),avoidPatterns:e.array(H).max(10).optional()}),Ef=e.object({pattern:H,intent:H}),zc=e.object({header:ff,footer:xf,mobileNav:Ef}),Bc=e.object({schemaVersion:e.literal(1).default(1),siteDesignContext:Uc,routeCards:e.record(e.string().min(1),Fc),blockContexts:e.record(e.string().min(1),Gc),selectedSkillPacks:e.array(kt).max(3).optional(),branding:Kc.optional(),chromeDesign:zc.optional()}),_v=e.object({siteDesignContext:Uc.omit({imagePalette:!0}).optional(),routeCards:e.record(e.string().min(1),Fc).optional(),blockContexts:e.record(e.string().min(1),Gc).optional(),branding:Kc.optional(),chromeDesign:zc.optional()}),xe=e.string().trim().min(1),Ui=e.object({id:xe,label:e.string().trim().min(1),type:e.string(),variant:e.string().optional(),order:e.number(),props:e.record(e.string(),e.unknown()),meta:e.object({aiGenerated:e.boolean(),userEdited:e.boolean(),lastEditedAt:e.string(),lastEditedBy:e.enum(["ai","user"]),userInstruction:e.string().optional()}).optional()}).strict(),Wc=e.string().regex(Ut,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),If=new RegExp(`^/(?:${St}(?:/${St})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),Rf=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,Tf=e.union([e.string().regex(If),e.string().regex(Rf)]),wc=e.object({label:e.string(),href:Tf}).passthrough(),kf=e.object({primaryLinks:e.array(wc),footerLinks:e.array(wc)}),Vc=e.object({showInHeader:e.boolean(),showInFooter:e.boolean(),order:e.number()}).strict(),Fi=e.object({id:xe,slug:Wc,title:e.string().trim().min(1),blocks:e.array(Ui).min(1),navigation:Vc}).strict(),Pf=Ui.extend({type:e.string().nullable()}).strict(),Af=Fi.extend({slug:Wc.nullable(),navigation:Vc.extend({showInHeader:e.boolean().nullable(),showInFooter:e.boolean().nullable()}).strict(),blocks:e.array(Pf).min(1)}).strict(),wf=Ui.extend({id:e.string()}),vf=Fi.extend({id:e.string(),slug:e.string().min(1),blocks:e.array(wf).min(1)}),vc=e.object({label:e.string(),href:e.string().min(1)}),Cf=e.object({primaryLinks:e.array(vc),footerLinks:e.array(vc)}),Df=e.discriminatedUnion("kind",[e.object({kind:e.literal("brief_clarify"),brief_id:ut,answer_ids:e.array(e.string().min(1)).max(10)}).strict(),e.object({kind:e.literal("step5_strategy"),strategy_version_id:e.string().uuid(),strategy_version:e.number().int().positive(),strategy_checksum:e.string().regex(/^[a-f0-9]{64}$/)}).strict()]),Jn=e.object({site_name:e.string().min(1).max(80).optional(),version:e.number().int().positive(),pages:e.array(Fi).min(1),navigation:kf,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(),source:Df.optional()}),skillSelection:kt,visualTheme:mf.optional(),userChoices:e.array(lf).optional(),confirmedChoices:e.object({conversion:st.optional()}).optional(),seoKeywords:e.array(En).min(1).max(50).optional()}).strict(),Pt=Jn.superRefine((t,n)=>{Yc(t.pages,n)}),rn=Jn.extend({pages:e.array(Af).min(1)}).strict().superRefine((t,n)=>{Yc(t.pages,n)}),jf=e.enum(["slug","showInHeader","showInFooter"]),Of=e.object({page_id:xe,fields:e.array(jf).min(1).max(3)}).strict(),Nf=e.object({page_id:xe,block_id:xe,fields:e.tuple([e.literal("type")])}).strict(),Hc=100,$c=500,Lf=e.object({pages:e.array(Of).max(Hc),blocks:e.array(Nf).max($c)}).strict().superRefine((t,n)=>{let s=new Set;t.pages.forEach((i,r)=>{s.has(i.page_id)&&n.addIssue({code:"custom",path:["pages",r,"page_id"],message:`Duplicate page target '${i.page_id}'.`}),s.add(i.page_id),new Set(i.fields).size!==i.fields.length&&n.addIssue({code:"custom",path:["pages",r,"fields"],message:"Page target fields must be unique."})});let a=new Set;t.blocks.forEach((i,r)=>{let _=`${i.page_id}\0${i.block_id}`;a.has(_)&&n.addIssue({code:"custom",path:["blocks",r],message:`Duplicate block target '${i.page_id}/${i.block_id}'.`}),a.add(_)})}),hv=e.object({sitemap:rn,targets:Lf}).strict(),Sv=e.object({pages:e.array(e.object({page_id:xe,slug:e.string().min(1).optional(),show_in_header:e.boolean().optional(),show_in_footer:e.boolean().optional()}).strict()).max(Hc),blocks:e.array(e.object({page_id:xe,block_id:xe,type:e.string().trim().min(1)}).strict()).max($c)}).strict().superRefine((t,n)=>{let s=new Set;t.pages.forEach((i,r)=>{s.has(i.page_id)&&n.addIssue({code:"custom",path:["pages",r,"page_id"],message:`Duplicate page output '${i.page_id}'.`}),s.add(i.page_id)});let a=new Set;t.blocks.forEach((i,r)=>{let _=`${i.page_id}\0${i.block_id}`;a.has(_)&&n.addIssue({code:"custom",path:["blocks",r],message:`Duplicate block output '${i.page_id}/${i.block_id}'.`}),a.add(_)})}),fv=e.object({sitemap:Pt}).strict();function Yc(t,n){let s=new Map,a=new Map,i=new Map,r=0;t.forEach((_,c)=>{let g=s.get(_.id);if(g!==void 0?n.addIssue({code:"custom",path:["pages",c,"id"],message:`Duplicate page id '${_.id}' (first used at pages.${g}.id).`}):s.set(_.id,c),_.blocks.forEach((E,O)=>{let F=a.get(E.id);F!==void 0?n.addIssue({code:"custom",path:["pages",c,"blocks",O,"id"],message:`Duplicate block id '${E.id}' (first used at pages.${F.pageIndex}.blocks.${F.blockIndex}.id).`}):a.set(E.id,{pageIndex:c,blockIndex:O})}),_.slug===null)return;_.slug==="/"&&(r+=1);let j=i.get(_.slug);j!==void 0?n.addIssue({code:"custom",path:["pages",c,"slug"],message:`Duplicate page slug '${_.slug}' (first used at pages.${j}.slug).`}):i.set(_.slug,c)}),(r!==1||t[0]?.slug!=="/")&&n.addIssue({code:"custom",path:["pages"],message:"Sitemap must contain exactly one home page at pages[0] with slug '/'."})}var bv=Jn.omit({skillSelection:!0,visualTheme:!0,userChoices:!0,confirmedChoices:!0,seoKeywords:!0}).extend({meta:Jn.shape.meta.omit({source:!0}),site_name:e.string().min(1).max(80),pages:e.array(vf).min(1),navigation:Cf}),Mf=e.enum(["ai","user"]),At=e.object({site_id:I,page_id:xe,edited_by:Mf.default("ai"),source_agent_run_id:V.optional()}),yv=At.extend({block_id:xe,target_index:e.number().int().min(0)}),Uf=At.extend({block_id:xe}),Ff=At.extend({block_id:xe,instruction:e.string()}),xv=At.extend({block_id:xe,variant:e.string().min(1).nullable()}),Ev=At.extend({block_id:xe,props:e.record(e.string(),e.unknown()),mode:e.enum(["replace","merge"]).default("replace")}),Iv=At.extend({block:e.object({id:xe,label:e.string().trim().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()})}),qf=e.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),Rv=e.discriminatedUnion("operation",[e.object({operation:e.literal("delete_block"),input:Uf}).strict(),e.object({operation:e.literal("update_block_instruction"),input:Ff}).strict()]),Gf=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_LAST_BLOCK_DELETE_FORBIDDEN","SITEMAP_EDIT_FAILED"]),Kf=e.object({status:e.literal("updated"),operation:qf,site_id:I,sitemap_id:ke,version:e.number().int().positive(),changed_pages:e.array(xe).min(1),requires_code_patch:e.literal(!0)}),zf=e.object({status:e.literal("failed"),code:Gf,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),Tv=e.discriminatedUnion("status",[Kf,zf]),qi=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:Di.optional(),visual_tonality:Ci.optional(),conversion:st.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()}),Bf=e.object({id:e.string().trim().min(1).max(128),type:e.literal(1),search_intent:e.string().trim().min(1).max(255),path:e.string().trim().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),channel:e.string().trim().min(1).max(80),content_format:e.string().trim().min(1).max(80),priority:e.enum(["P0","P1","P2","P3"])}).strict(),kv=e.object({source:e.object({kind:e.literal("step5_strategy")}).strict()}).strict(),Wf=e.object({item_key:xn,title:e.string().trim().min(1).max(200),selected_option_id:ht,selected_label:e.string().trim().min(1).max(200),selected_value:e.string().trim().min(1).max(500),selected_description:e.string().trim().min(1).max(2e3),impact:e.string().trim().min(1).max(500).optional(),customer_note:e.string().trim().min(1).max(200).optional()}).strict(),Vf=e.object({kind:e.literal("step5_strategy"),site_name:e.string().trim().min(1).max(80).optional(),strategy_version_id:e.string().uuid(),strategy_version:e.number().int().positive(),strategy_checksum:e.string().regex(/^[a-f0-9]{64}$/),decisions:e.array(Wf).length(fe),seo_keywords:e.array(En).min(1).max(50).optional()}).strict().superRefine((t,n)=>{t.decisions.forEach((s,a)=>{s.item_key!==it[a]&&n.addIssue({code:"custom",path:["decisions",a,"item_key"],message:"Step5 sitemap decisions must use the canonical order."})})}),Xc=e.object({tenant_id:e.string().min(1),site_id:I,brief_id:ut,brief:e.string().min(20).max(1e3),answers:e.array(qi).min(1).max(10),skillSelection:kt,site_default_locale:pe.optional(),owner_locale:pe.optional(),cms_site_id:e.string().min(1).nullish(),intent_pages:e.array(Bf).max(bn).optional(),reference:gn.optional(),input_context:e.object({facts:e.array(un).max(120),conflicts:e.array(_n).max(20)}).optional(),business_facts:Qi.optional(),extra_requirement:e.string().trim().min(1).max(gt).optional(),migration_products_enabled:e.boolean().optional()}),Hf=Xc.pick({tenant_id:!0,site_id:!0,skillSelection:!0,site_default_locale:!0,owner_locale:!0,cms_site_id:!0,reference:!0,input_context:!0,business_facts:!0,extra_requirement:!0,migration_products_enabled:!0}).partial({skillSelection:!0}).extend({source:Vf}).strict(),Pv=e.union([Xc,Hf]),Zc=e.enum(["planning","generating","validating","ready"]),$f=e.enum(["salvaged","deterministic_fallback"]),Yf=e.enum(["model_exception_settled_prefix","model_exception_safe_root"]),Qc={outcome:$f.optional(),reason:Yf.optional(),attempts:e.number().int().positive().optional()};function Jc(t,n){if(t.type!=="sitemap.generated")return;let s=t.outcome!==void 0,a=t.reason!==void 0;s!==a&&n.addIssue({code:"custom",path:[s?"reason":"outcome"],message:"sitemap.generated outcome and reason must be provided together"})}var Xf=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:V,at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:Zc,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:ke,sitemap:Pt,...Qc,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_block_count:e.number().int().nonnegative().optional(),final_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:x,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:x.optional(),at:e.string().min(1)})]),Av=Xf.superRefine(Jc),em=e.object({id:ke,tenant_id:e.string().min(1),site_id:I,version:e.number().int().positive(),source_agent_run_id:V.nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}).strict();function tm(t,n){t.version!==t.sitemap.version&&n.addIssue({code:"custom",path:["sitemap","version"],message:`Sitemap JSON version ${t.sitemap.version} must equal record version ${t.version}.`})}var nm=em.extend({sitemap:Pt}).superRefine(tm),Zf=em.extend({sitemap:rn}).superRefine(tm),wv=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:Pt,source_agent_run_id:V.optional()}),vv=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:rn,expected_current_sitemap_id:ke,expected_current_sitemap_version:e.number().int().positive(),migration_content_requested:e.boolean().optional()}),Cv=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:Pt,source_agent_run_id:V}),Dv=e.object({site:tt,sitemap:nm,next_step:e.literal("workspace")}).strict(),jv=e.object({site:tt,sitemap:Zf,next_step:e.literal("workspace")}).strict(),Ov=e.object({site:tt,sitemap:nm,next_step:e.literal("sitemap_review")}).strict(),Qf=e.object({id:Hi,tenant_id:e.string().min(1),site_id:I,brief_id:ut,questions:ji,answers:e.array(qi),selected_archetype:kt.optional(),completed_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Nv=e.object({answers:e.array(qi).min(1),questions:ji,selected_archetype:kt.optional()}),Lv=e.object({clarify_session:Qf}),Mv=e.object({questions:ji,selected_archetype:kt}),Jf=e.object({id:is,tenant_id:e.string().min(1),site_id:I,version:e.number().int().positive(),design_plan:Bc,source_agent_run_id:V.nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Uv=e.object({design_plan_id:is.optional(),design_plan:Bc,source_agent_run_id:V.optional()}),Fv=e.object({design_plan:Jf}),ns=e.enum(["initial_generation","iteration"]),eb=e.object({label:e.string().min(1).max(48),prompt:e.string().min(1).max(160)}).strict(),tb=e.enum(["model","derived","mixed","advisor"]),sm=e.object({suggestions:e.array(eb).min(1).max(4),source:tb}).strict(),nb=e.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),sb=e.enum(["generation_succeeded","entry_slots_omitted","quality_gate_exhausted","schema_gate_exhausted","generation_timeout","stream_schema_mismatch","stream_generation_error","generation_error","fallback_compiler_error","legacy_result_missing_metadata"]),ib=e.enum(["progress","assistant_final"]),im=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"]),ab=e.object({id:e.string().min(1),title:e.string().min(1),status:e.enum(["pending","running","completed","failed"])}),dt=e.enum(["pending","running","completed","completed_with_skips","failed","skipped"]),Gi=e.enum(["style_media","chrome","sections","layout","pages","detect_typecheck","repair","finalize","sitemap_resync","preview"]),Ki=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()}),Se=e.string().min(1).refine(t=>hm(t),{message:"Snapshot file paths must be safe relative POSIX paths without traversal."}),zi=e.object({deduped_paths:e.array(Se),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(Se)}),Bi=e.object({group_id:e.string().min(1),phase:Gi,title:e.string().min(1),status:dt,task_ids:e.array(e.string().min(1)),depends_on_groups:e.array(e.string().min(1)),target_paths:e.array(Se)}),ob=e.enum(["style","media","chrome","section","layout","page"]),Wi=e.object({task_id:e.string().min(1),group_id:e.string().min(1),kind:ob,target_path:Se,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(Mi).optional(),status:dt,required_reads:e.array(Se).optional(),search_params_sections:e.array(Se).optional(),standard_form_view:Se.optional()}),Vi=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"])}),qv=e.object({plan_id:e.string().min(1),run_kind:ns,model_route:e.object({planner:e.literal("workspace_planner"),worker:e.literal("workspace")}),groups:e.array(Bi),tasks:e.array(Wi),dependencies:e.array(Vi),expected_outputs:e.array(Se),diagnostics:zi}),Gv=e.object({task_id:e.string().min(1),patch:e.unknown().optional(),snapshot_id:x.optional(),read_files:e.array(Se),diagnostics:e.array(Ki),status:dt}),am=e.object({worker_count:e.number().int().nonnegative(),task_count:e.number().int().nonnegative(),group_count:e.number().int().nonnegative()}),om=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()}),rb=e.object({type:e.literal("text"),text:e.string(),state:e.enum(["streaming","done"]).optional()}),cb=e.object({type:e.literal("reasoning"),text:e.string(),state:e.enum(["streaming","done"]).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),mb=e.object({type:e.literal("file"),mediaType:e.string().min(1),filename:e.string().min(1).optional(),url:e.string().min(1)}),lb=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()}),pb=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()}),db=e.object({type:e.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:e.string().min(1).optional(),data:e.unknown()}),ub=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()}),gb=e.object({type:e.literal("error"),errorText:e.string().min(1)}),_b=e.object({type:e.literal("step-start")}),es=e.union([rb,cb,mb,lb,pb,db,ub,gb,_b]),hb=e.string().min(1).max(512).refine(t=>hm(t)&&!/^[A-Za-z]:\//.test(t),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),Sb=e.array(hb).min(1).max(64),fb=e.array(e.string().min(1).max(120)).min(1).max(64),bb=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:V,at:e.string().min(1)}),e.object({type:e.literal("message.delta"),text:e.string().min(1),history_purpose:ib.optional(),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(es).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),interaction_response:vn.optional(),at:e.string().min(1)}),e.object({type:e.literal("plan.updated"),steps:e.array(ab),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(Cc).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:Zc,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:ke,sitemap:Pt,...Qc,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_block_count:e.number().int().nonnegative().optional(),final_block_count:e.number().int().nonnegative().optional(),at:e.string().min(1)}).strict(),e.object({type:e.literal("sitemap.updated"),sitemap_id:ke,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),interaction_request:Ks.optional(),at:e.string().min(1)}),e.object({type:e.literal("workspace.plan.created"),plan_id:e.string().min(1),run_kind:ns,groups:e.array(Bi),tasks:e.array(Wi),dependencies:e.array(Vi),expected_outputs:e.array(Se),diagnostics:zi,summary:am,at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.worker.updated"),group_id:e.string().min(1),phase:Gi,status:dt,task_counts:om,target_paths:e.array(Se),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:dt,target_path:Se,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(Ki).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","cms_page_directory_degraded","form_prebuild_skipped","form_section_fallback","first_settings_sync_failed"]),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:Sb.optional(),degraded_page_ids:fb.optional(),snapshot_id:x.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 a of["degraded_file_paths","degraded_page_ids"])t[a]!==void 0&&n.addIssue({code:"custom",path:[a],message:`${a} 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 a of["degraded_block_ids","dropped_files","snapshot_id","code","message","diagnostics","retryable"])t[a]!==void 0&&n.addIssue({code:"custom",path:[a],message:`${a} is not allowed for generated_code_rescue`})}),e.object({type:e.literal("workspace.design_plan.outcome"),design_plan_outcome:nb,reason:sb,gate_diagnostics:e.object({gate:e.enum(["quality","schema"]),issue_codes:e.array(e.string().min(1)).max(20),issue_paths:e.array(e.string()).max(20),finish_reason:e.string().min(1).optional()}).strict().optional(),at:e.string().min(1)}).strict(),sm.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:x,manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("snapshot.finalized"),snapshot_id:x,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:x,at:e.string().min(1)}),e.object({type:e.literal("preview.build.succeeded"),snapshot_id:x,at:e.string().min(1)}),e.object({type:e.literal("preview.build.failed"),snapshot_id:x,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:Dc.optional(),retryable:e.boolean().optional(),attempts:e.number().int().positive().optional(),outcome:e.literal("retained_previous").optional(),details:e.record(e.string(),e.unknown()).optional(),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),snapshot_id:x.optional(),degraded_reason:Dt.optional(),build_verified:e.boolean().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:qc,title:e.string().min(1).max(200),detail:e.string().max(360).optional(),title_code:Je.optional(),detail_code:Je.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:Je.optional(),detail_code:Je.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)})]),rm=bb.superRefine(Jc).superRefine((t,n)=>{if(t.type==="user.message"&&t.interaction_response&&!t.in_reply_to_tool_call_id&&n.addIssue({code:"custom",path:["in_reply_to_tool_call_id"],message:"in_reply_to_tool_call_id is required for an interaction response"}),t.type!=="tool.finished")return;let s=t.name==="prepare_product_search_entry";s!==!!t.interaction_request&&n.addIssue({code:"custom",path:["interaction_request"],message:s?"prepare_product_search_entry requires interaction_request":"interaction_request is only valid for prepare_product_search_entry"})}),vi=e.object({id:Yi,tenant_id:e.string().min(1),site_id:I,agent_run_id:V,sequence:e.number().int().positive(),event_type:im,payload:rm,created_at:e.string().min(1)}),Kv=e.object({event_type:im,payload:rm}).superRefine((t,n)=>{t.event_type!==t.payload.type&&n.addIssue({code:"custom",path:["payload","type"],message:"payload.type must match event_type"}),ln(t.payload)&&n.addIssue({code:"custom",path:["payload"],message:"AgentEvent payload must not contain secrets"})}),zv=e.discriminatedUnion("status",[e.object({status:e.literal("appended"),agent_run:et,event:vi,next_cursor:e.number().int().nonnegative()}),e.object({status:e.literal("duplicate_ignored"),agent_run:et,event:vi,next_cursor:e.number().int().nonnegative()})]),Bv=e.object({events:e.array(vi),next_cursor:e.number().int().nonnegative().optional()}),Wv=e.object({after_sequence:e.coerce.number().int().nonnegative().default(0)}),Vv=e.enum(["implemented","skeleton","planned"]),Hv=e.enum(["GET","POST","PUT","PATCH","DELETE"]),$v=[{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:"POST",path:"/sites/:site_id/workflow",tag:"site-workflows",summary:"Create one version-bound site workflow from a published flow definition.",status:"implemented",request_body_schema:"CreateSiteWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/workflow",tag:"site-workflows",summary:"Read the current site workflow snapshot and derived menu state.",status:"implemented",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"PUT",path:"/sites/:site_id/workflow/website",tag:"site-workflows",summary:"Update the source website while website_scan is current.",status:"implemented",request_body_schema:"UpdateSiteWorkflowWebsiteRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/advance",tag:"site-workflows",summary:"Advance one non-terminal workflow node with an expected-current-node guard.",status:"implemented",request_body_schema:"AdvanceSiteWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/complete",tag:"site-workflows",summary:"Complete the workflow from its final publishing node after server-side release checks pass.",status:"implemented",request_body_schema:"CompleteSiteWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema",notes:["The browser supplies only the expected current node; the server verifies persisted release facts before completing the workflow."]},{method:"POST",path:"/sites/:site_id/workflow/tasks/register",tag:"site-workflows",summary:"Register a business-owned external task id and its idempotency key.",status:"implemented",request_body_schema:"RegisterWorkflowTaskCommandRequestSchema",response_schema:"SiteWorkflowTaskRefResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/step2-site-initialization/tasks",tag:"site-workflows/step2-site-initialization",summary:"Create or reuse the current workflow's Step2 website crawl task.",status:"implemented",response_schema:"Step2SiteInitializationTaskResponseSchema",notes:["The server derives tenantId, sessionId, and siteUrl from trusted request/workflow state; the browser cannot submit upstream scope fields."]},{method:"GET",path:"/sites/:site_id/workflow/step2-site-initialization/tasks/:task_id",tag:"site-workflows/step2-site-initialization",summary:"Poll the workflow-owned Step2 website crawl task.",status:"implemented",response_schema:"Step2SiteInitializationTaskResponseSchema",notes:["The task id must match the current non-superseded website_crawl task reference for the workflow."]},{method:"POST",path:"/sites/:site_id/workflow/tasks/:task_type/replace",tag:"site-workflows",summary:"Replace one task reference while retaining its superseded history.",status:"implemented",request_body_schema:"ReplaceWorkflowTaskCommandRequestSchema",response_schema:"SiteWorkflowTaskRefResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/tasks/website_crawl/replace-and-invalidate-dependents",tag:"site-workflows",summary:"Replace website crawl and invalidate basic-info and metrics dependents atomically.",status:"implemented",request_body_schema:"ReplaceCrawlWorkflowTaskCommandRequestSchema",response_schema:"SiteWorkflowTaskRefResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/build",tag:"site-workflows",summary:"Start the server-owned site build and workspace snapshot lifecycle.",status:"implemented",request_body_schema:"StartSiteBuildRequestSchema",response_schema:"StartSiteBuildResponseSchema",notes:["The browser may start or query the build, but cannot write site build or deployment summary status directly."]},{method:"GET",path:"/sites/:site_id/workflow/customer-materials",tag:"site-workflows",summary:"Read the persisted no-website customer materials draft.",status:"implemented",response_schema:"CustomerMaterialsNullableResponseSchema"},{method:"PUT",path:"/sites/:site_id/workflow/customer-materials",tag:"site-workflows",summary:"Save the no-website customer materials before submission.",status:"implemented",request_body_schema:"CustomerMaterialsDraftSchema",response_schema:"CustomerMaterialsResponseSchema",notes:["A submitted record is immutable and rejects later writes."]},{method:"POST",path:"/sites/:site_id/workflow/customer-materials/submit",tag:"site-workflows",summary:"Submit and freeze customer materials before analysis.",status:"implemented",request_body_schema:"CustomerMaterialsDraftSchema",response_schema:"CustomerMaterialsResponseSchema",notes:["Repeated submissions return 409; clients may retry only the separate workflow advance."]},{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/compose",tag:"designer-page-library",summary:"Compose exact page and component resources into one strict page artifact.",status:"implemented",request_body_schema:"ComposeDesignerPageResourceBodySchema",response_schema:"InstallDesignerPageResponseSchema",notes:["The server installs every immutable source, validates ordered page blocks, scopes component materializations, and returns one artifact without exposing resource-platform credentials."]},{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/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:"GET",path:"/sites/:site_id/media-assets",tag:"media-assets",summary:"List or search enterprise image assets through the CMS adapter.",status:"implemented",query_schema:"ListMediaLibraryAssetsQuerySchema",response_schema:"ListMediaLibraryAssetsResponseSchema"},{method:"POST",path:"/sites/:site_id/media-assets",tag:"media-assets",summary:"Upload one validated image and create its enterprise asset.",status:"implemented",response_schema:"UploadMediaLibraryAssetResponseSchema",notes:["Accepts one multipart field named file; only the image MIME allowlist is accepted and the maximum size is 20 MiB."]},{method:"GET",path:"/sites/:site_id/media-assets/unsplash/search",tag:"media-assets",summary:"Search Unsplash through the VCP server-side client.",status:"implemented",query_schema:"SearchUnsplashMediaQuerySchema",response_schema:"SearchUnsplashMediaResponseSchema",notes:["The browser never receives the Unsplash access key; CMS is not involved in search."]},{method:"POST",path:"/sites/:site_id/media-assets/unsplash/:provider_id/use",tag:"media-assets",summary:"Best-effort report that an Unsplash image was selected.",status:"implemented",request_body_schema:"UseUnsplashMediaRequestSchema",response_schema:"UseUnsplashMediaResponseSchema",notes:["CMS report failure returns reported=false and does not roll back the image replacement."]},{method:"POST",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Confirm the currently reviewed Sitemap Draft and advance the site to structure_saved.",status:"implemented",request_body_schema:"ConfirmSiteStructureRequestSchema",response_schema:"PersistSiteSitemapDraftResponseSchema"},{method:"POST",path:"/internal/sites/:site_id/sitemap-draft",tag:"sitemaps",summary:"Persist an agent-generated sitemap draft without confirming the structure.",status:"implemented",request_body_schema:"PersistGeneratedSitemapDraftRequestSchema",response_schema:"PersistGeneratedSitemapDraftResponseSchema"},{method:"GET",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Read the current Sitemap Draft for a site.",status:"implemented",response_schema:"SitemapDraftRecordSchema"},{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 sites in the editable build phase are writable; the brief row is upserted idempotently while site status, 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 sites in the editable build phase are writable; missing brief rows are created on first save; identical retries 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:"/internal/sites/:site_id/page-templates",tag:"page-templates",summary:"Create a private page template through the authenticated VCP internal service surface.",status:"implemented",request_body_schema:"PageTemplateCreateRequestSchema",response_schema:"PageTemplateCreateResponseSchema",notes:["Internal service endpoint; callers use the API bearer token plus trusted tenant/user headers. API delegates to Agent with its own AGENT_INTERNAL_TOKEN and never forwards caller Authorization."]},{method:"POST",path:"/internal/sites/:site_id/page-templates/promote",tag:"page-templates",summary:"Promote a private page template through the authenticated VCP internal service surface.",status:"implemented",request_body_schema:"PageTemplatePromoteRequestSchema",response_schema:"PageTemplatePromoteResponseSchema",notes:["Internal service endpoint; uses the same bearer + tenant/user context as create and delegates to Agent with API-owned credentials."]},{method:"POST",path:"/internal/sites/:site_id/page-templates/cleanup",tag:"page-templates",summary:"Clean up private page templates through the authenticated VCP internal service surface.",status:"implemented",request_body_schema:"PageTemplateCleanupRequestSchema",response_schema:"PageTemplateCleanupResponseSchema",notes:["Internal service endpoint; cleanup remains explicit and default-template protection is enforced by the Agent lifecycle service."]},{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:"/deployments",tag:"deployments",summary:"Deployment resource summary endpoint until publish APIs 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:"/internal/sites/:site_id/preview-sessions",tag:"sandbox-sessions",summary:"Persist or update an Agent-owned on-demand preview session; optional current/ready-session guards support current-snapshot CAS and guarded in-place snapshot advance.",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/preview/activate",tag:"site-preview",summary:"Activate the existing preview sandbox for a site.",status:"implemented",response_schema:"SitePreviewActivateResponseSchema"},{method:"POST",path:"/v1/agent/site-preview/:site_id/activate",tag:"agent/site-preview",summary:"Activate the existing preview sandbox for a site through Agent.",status:"implemented",response_schema:"SitePreviewActivateResponseSchema"},{method:"POST",path:"/sites/:site_id/deployments",tag:"deployments",summary:"Queue an explicit user-confirmed publish from the latest current snapshot.",status:"implemented",request_body_schema:"CreateDeploymentRequestSchema",response_schema:"CreateDeploymentResponseSchema",notes:["The server resolves the latest current snapshot and validates site and snapshot existence, in-flight deployment state, and site operation lock before creating the deployment record and queue job.","The API returns after creating the deployment record and queue job; worker-service claims deployment_jobs for build and Cloudflare publish."]},{method:"POST",path:"/sites/:site_id/deployments/quality-check",tag:"deployments",summary:"Queue a quality-check deployment from a snapshot.",status:"implemented",request_body_schema:"CreateQualityCheckDeploymentRequestSchema",response_schema:"CreateDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/quality-check/status",tag:"deployments",summary:"Read the latest quality-check deployment status.",status:"implemented",response_schema:"GetDeploymentsStatusResponseSchema"},{method:"POST",path:"/internal/site-deployments/quality-check",tag:"deployments",summary:"Queue a quality-check deployment for the current site through the internal Agent API.",status:"implemented",response_schema:"InternalCreateDeploymentResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id.","POST accepts no request body; VCP resolves the current snapshot. Quality-check and publish deployments are independent."]},{method:"GET",path:"/internal/site-deployments/quality-check/status",tag:"deployments",summary:"Read the latest internal quality-check deployment status for the current site.",status:"implemented",response_schema:"InternalGetDeploymentsStatusResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id."]},{method:"POST",path:"/internal/site-deployments/publish",tag:"deployments",summary:"Queue a publish deployment for the current site through the internal Agent API.",status:"implemented",response_schema:"InternalCreateDeploymentResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id.","POST accepts no request body; VCP resolves the latest current snapshot. Quality-check and publish deployments are independent."]},{method:"GET",path:"/internal/site-deployments/publish/status",tag:"deployments",summary:"Read the latest internal publish deployment status for the current site.",status:"implemented",response_schema:"InternalGetDeploymentsStatusResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id."]},{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/configuration",tag:"custom-domains",summary:"Read the authoritative site domain configuration.",status:"implemented",response_schema:"GetSiteDomainConfigurationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflows/:workflow_id/domain/check",tag:"publish-workflow",summary:"Check a publish workflow domain and start its operation.",status:"implemented",request_body_schema:"CheckSitePublishDomainRequestSchema",response_schema:"CheckSitePublishDomainResponseSchema"},{method:"GET",path:"/sites/:site_id/publish-workflows/:workflow_id/domain/operation",tag:"publish-workflow",summary:"Poll the current publish workflow domain operation.",status:"implemented",response_schema:"GetSitePublishDomainOperationResponseSchema"},{method:"POST",path:"/sites/:site_id/integrations/gsc/auth/start",tag:"gsc",summary:"Start Google Search Console authorization for a site.",status:"implemented",request_body_schema:"StartGscAuthRequestSchema",response_schema:"StartGscAuthResponseSchema"},{method:"GET",path:"/sites/:site_id/integrations/gsc/status",tag:"gsc",summary:"Read Google Search Console authorization and property status.",status:"implemented",response_schema:"GscStatusResponseSchema"},{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"},{method:"GET",path:"/sites/:site_id/publish-workflow/active",tag:"publish-workflow",summary:"Read the active site publish workflow.",status:"implemented",response_schema:"SitePublishWorkflowActiveResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/start",tag:"publish-workflow",summary:"Start or recover the site publish workflow.",status:"implemented",request_body_schema:"StartSitePublishWorkflowRequestSchema",response_schema:"SitePublishWorkflowMutationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/:workflow_id/retry",tag:"publish-workflow",summary:"Retry failed external publish quality tasks.",status:"implemented",request_body_schema:"SitePublishWorkflowRevisionRequestSchema",response_schema:"SitePublishWorkflowMutationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/:workflow_id/stream",tag:"publish-workflow",summary:"Stream updates for an existing site publish workflow.",status:"implemented",request_body_schema:"StreamSitePublishWorkflowRequestSchema",response_schema:"SitePublishWorkflowSseDataSchema"},{method:"PATCH",path:"/sites/:site_id/publish-workflow/:workflow_id/step",tag:"publish-workflow",summary:"Move the site publish workflow to an allowed step.",status:"implemented",request_body_schema:"UpdateSitePublishWorkflowStepRequestSchema",response_schema:"SitePublishWorkflowMutationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/:workflow_id/cancel",tag:"publish-workflow",summary:"Cancel a stable site publish workflow.",status:"implemented",request_body_schema:"SitePublishWorkflowRevisionRequestSchema",response_schema:"SitePublishWorkflowMutationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/:workflow_id/publish",tag:"publish-workflow",summary:"Start formal publishing for a site publish workflow.",status:"implemented",request_body_schema:"SitePublishWorkflowRevisionRequestSchema",response_schema:"SitePublishWorkflowPublishResponseSchema"}],Yv=[{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:"Step5SitemapStartRequestSchema (browser marker only; API injects committed Step5 strategy)",event_schema:"SitemapStreamEventSchema",event_order:["run.started","sitemap.generating","sitemap.partial","sitemap.generated","sitemap.clamped","run.failed"]}],yb=e.object({id:e.string().min(1),role:e.enum(["system","user","assistant"]),metadata:e.unknown().optional(),parts:e.array(es).min(1)}),cm=yb.extend({role:e.literal("user")}),Xv=e.object({base_snapshot_id:x.optional(),message:cm.optional(),client_run_key:e.string().min(1).max(200).optional()}).superRefine((t,n)=>{ln(t.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),xb=e.object({path:e.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:V,base_snapshot_id:x,run_kind:ns}),Zv=e.object({agent_run:et,websocket:xb,next_step:e.literal("workspace_socket")}),Qv=e.object({agent_run:et}),Jv=e.object({agent_type:e.enum(["clarify","sitemap","workspace"])}),eC=e.object({agent_run:et}),tC=e.enum(["client.message.create","client.resource.operation.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"]),Q=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:I,run_id:V.optional(),correlation_id:e.string().min(1).optional(),seq:e.number().int().positive().optional(),sent_at:e.string().min(1)}),Eb=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()}),Ib=e.discriminatedUnion("type",[Q.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(),current_route_id:Bt.optional(),interaction_response:vn.optional(),selected_component:Eb.optional(),message:cm,base_snapshot_id:x.optional()}).superRefine((t,n)=>{t.interaction_response&&!t.in_reply_to_tool_call_id&&n.addIssue({code:"custom",path:["in_reply_to_tool_call_id"],message:"in_reply_to_tool_call_id is required for an interaction response"})})}),Q.extend({type:e.literal("client.run.cancel"),payload:e.object({run_id:V,reason:e.string().min(1).optional()})}),Q.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()})}),Eo]),Rb=e.discriminatedUnion("type",[Q.extend({type:e.literal("server.run.started"),payload:e.object({run_id:V,agent_type:e.literal("workspace")})}),Q.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(es).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),interaction_response:vn.optional()})}),Q.extend({type:e.literal("server.assistant.delta"),payload:e.object({message_id:e.string().min(1),parts:e.array(es).min(1),status:e.enum(["streaming","ready"])})}),Q.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)})}),Q.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),interaction_request:Ks.optional()})}),Q.extend({type:e.literal("server.workspace.suggestions"),payload:sm.extend({run_id:V}).strict()}),Q.extend({type:e.literal("workspace.plan.created"),payload:e.object({plan_id:e.string().min(1),run_kind:ns,groups:e.array(Bi),tasks:e.array(Wi),dependencies:e.array(Vi),expected_outputs:e.array(Se),diagnostics:zi,summary:am})}),Q.extend({type:e.literal("workspace.worker.updated"),payload:e.object({group_id:e.string().min(1),phase:Gi,status:dt,task_counts:om,target_paths:e.array(Se),diagnostics:e.array(e.string().min(1))})}),Q.extend({type:e.literal("workspace.task.updated"),payload:e.object({task_id:e.string().min(1),group_id:e.string().min(1),status:dt,target_path:Se,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(Ki).optional()})}),Q.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()})}),Q.extend({type:e.literal("server.sitemap.updated"),payload:e.object({sitemap_id:ke,version:e.number().int().positive(),reason:e.string().min(1)})}),Q.extend({type:e.literal("server.snapshot.created"),payload:e.object({snapshot_id:x,manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/)})}),Q.extend({type:e.literal("server.snapshot.finalized"),payload:e.object({snapshot_id:x})}),Q.extend({type:e.literal("server.preview.invalidated"),payload:e.object({reason:e.string().min(1),next_preview_url:e.string().url().optional()})}),Q.extend({type:e.literal("preview.build.started"),payload:e.object({snapshot_id:x})}),Q.extend({type:e.literal("preview.build.succeeded"),payload:e.object({snapshot_id:x})}),Q.extend({type:e.literal("preview.build.failed"),payload:e.object({snapshot_id:x,message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean()})}),Q.extend({type:e.literal("server.run.finished"),payload:e.object({run_id:V,snapshot_id:x,degraded_reason:Dt.optional(),build_verified:e.boolean().optional()})}),Q.extend({type:e.literal("server.run.failed"),payload:e.object({run_id:V,error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),outcome:e.literal("retained_previous").optional(),details:e.record(e.string(),e.unknown()).optional()})}),Q.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})}),Q.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:qc,title:e.string().min(1).max(200),title_code:Je.optional(),detail:e.string().max(360).optional(),detail_code:Je.optional(),locks_input:e.boolean()})}),Q.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:Je.optional(),detail:e.string().max(360).optional(),detail_code:Je.optional()})}),Q.extend({type:e.literal("server.activity.finished"),payload:e.object({activity_id:e.string().min(1)})}),Q.extend({type:e.literal("server.activity.failed"),payload:e.object({activity_id:e.string().min(1),detail:e.string().max(360).optional()})})]),Tb=Rb.superRefine((t,n)=>{if(t.type==="server.user.message"&&t.payload.interaction_response&&!t.payload.in_reply_to_tool_call_id&&n.addIssue({code:"custom",path:["payload","in_reply_to_tool_call_id"],message:"in_reply_to_tool_call_id is required for an interaction response"}),t.type!=="server.tool.completed")return;let s=t.payload.name==="prepare_product_search_entry";s!==!!t.payload.interaction_request&&n.addIssue({code:"custom",path:["payload","interaction_request"],message:s?"prepare_product_search_entry requires interaction_request":"interaction_request is only valid for prepare_product_search_entry"})}),nC=e.union([Ib,Tb]),sC={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."},{name:"unattended",required:!1,schema:'"1"',summary:"Unattended mode for machine-driven runs: interactive tools are withheld so the run cannot stall waiting for a human answer. Server-to-server only; the browser proxy strips it."}],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."]},mm=e.string().regex(/^sha256:[a-f0-9]{64}$/),kb=e.enum(["create","update","delete","str_replace"]),lm=e.enum(["sitemap_resync","smoke_test","prepare_preview"]),Pb=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(),Ab=e.object({path:Se,operation:kb,expected_hash:mm.optional(),full_content:e.string().describe("Complete file content for create/update patches. Only this single field is a string value: every double quote inside the source code must be escaped so the field stays 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. The surrounding patch object and the patches array are ordinary JSON structures, not strings.").optional(),edits:e.array(Pb).min(1).max(20).optional()}).strict().superRefine((t,n)=>{let s=t.full_content!==void 0;if(t.operation==="delete"){s&&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(qb(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}s||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"})}),wb=e.object({kind:e.enum(["block","page","site","chrome"]),id:e.string().min(1).max(120)}),vb=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:wb,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)}),pm=e.object({site_id:I,base_snapshot_id:x,reason:e.string().min(1),patches:e.array(Ab).min(1).describe("A real JSON array of patch objects. Never JSON.stringify this array, and never put an encoded JSON array inside a string \u2014 emit the array itself. Only full_content within a patch object is a string field."),media_requests:e.array(vb).max(24).optional(),post_actions:e.array(lm).optional()});function dm(t,n){let s=new Set;for(let[a,i]of t.patches.entries())s.has(i.path)&&n.addIssue({code:"custom",path:["patches",a,"path"],message:`Duplicate patch path: ${i.path}`}),s.add(i.path)}var iC=pm.superRefine(dm),aC=pm.omit({base_snapshot_id:!0}).extend({site_id:I.optional()}).superRefine(dm),Cb=le,Db=e.object({path:Cb,operation:e.enum(["upsert","delete"]).optional()}),um=e.enum(["sync_cms_pages","sync_cms_navigation"]),oC=e.object({files:e.array(Db).min(1),post_actions:e.array(um).optional()}).strict().overwrite(t=>t.post_actions?{...t,post_actions:[...new Set(t.post_actions)]}:t),jb=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"]),Ob=e.object({status:e.literal("applied"),patch_batch_id:e.string().min(1),site_id:I,base_snapshot_id:x,snapshot_id:x,manifest_hash:mm,object_key:e.string().min(1),changed_files:e.array(Se).min(1),post_actions_queued:e.array(lm),dropped_protected_files:e.array(e.string().min(1)).min(1).optional()}),Nb=e.object({status:e.literal("failed"),code:jb,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),rC=e.discriminatedUnion("status",[Ob,Nb]),cC=e.object({ok:e.literal(!0),post_actions:e.array(e.object({action:um,status:e.enum(["succeeded","failed"])}).strict()).default([])}),gm=le,Lb=e.enum(["text","binary"]),_m=e.object({path:gm,kind:Lb,language:e.string().min(1).nullable(),size_bytes:e.number().int().nonnegative()}),mC=e.object({path:gm}),Mb=_m.extend({kind:e.literal("text"),language:e.string().min(1),content:e.string()}),Ub=_m.extend({kind:e.literal("binary"),language:e.null(),mime_type:e.string().min(1),content_base64:e.string().min(1)}),lC=e.union([Mb,Ub]);function ln(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=>ln(n)):Object.entries(t).some(([n,s])=>Fb(n)||ln(s))}function Fb(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 hm(t){let n=t.split("/");return t.length>0&&!t.startsWith("/")&&!t.includes("\\")&&n.every(s=>s!==""&&s!=="."&&s!=="..")}function qb(t){let n=/^app\/(?:(.*)\/)?page\.(?:tsx|jsx)$/.exec(t);if(!n)return!0;let a=(n[1]??"").split("/").filter(r=>r.length>0);return a.some(r=>r.startsWith("_"))?!0:a.filter(r=>!r.startsWith("@")&&!/^\(.+\)$/.test(r)).map(r=>r.replace(/^\((?:\.|\.\.|\.\.\.)\)/,"")).filter(r=>r.length>0).every(r=>/^\[.*\]$/.test(r)||Ut.test(`/${r}`))}var Sm=e.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),Gb=e.object({id:pn,tenant_id:e.string().min(1),site_id:I,sandbox_id:e.string().min(1).nullable(),status:Sm,source_snapshot_id:x.nullable(),last_snapshot_id:x.nullable(),preview_url:e.string().url().nullable(),browser_preview_url:e.string().url().nullable().optional(),last_activity_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),pC=e.object({session_id:pn.optional(),sandbox_id:e.string().min(1).optional(),source_snapshot_id:x.optional(),last_snapshot_id:x,expected_current_snapshot_id:x.optional(),expected_ready_session_id:pn.optional(),expected_ready_session_last_snapshot_id:x.optional(),status:Sm,preview_url:e.string().url().optional()}),dC=e.object({preview_session:Gb,next_step:e.literal("preview")}),uC=e.object({failed_count:e.number().int().nonnegative()}),gC=e.object({site_id:I}),_C=e.object({status:e.enum(["cancelled","no_active_run"]),agent_run:et.nullable()});export{Er as AESTHETIC_NOTE_MAX_LENGTH,Ow as AbandonSiteSnapshotResponseSchema,qc as ActivityKindSchema,Je as ActivityTitleCodeSchema,CI as AdvanceSiteWorkflowRequestSchema,Dc as AgentErrorCategorySchema,Yi as AgentEventIdSchema,vi as AgentEventRecordSchema,rm as AgentEventSchema,im as AgentEventTypeSchema,ib as AgentMessageHistoryPurposeSchema,Nc as AgentModelRouteSchema,ab as AgentPlanStepSchema,V as AgentRunIdSchema,Oc as AgentRunKindSchema,et as AgentRunRecordSchema,JS as AgentRunStatusSchema,jc as AgentRunTypeSchema,db as AiSdkUiDataPartSchema,gb as AiSdkUiErrorPartSchema,mb as AiSdkUiFilePartSchema,es as AiSdkUiMessagePartSchema,yb as AiSdkUiMessageSchema,cb as AiSdkUiReasoningPartSchema,pb as AiSdkUiSourceDocumentPartSchema,lb as AiSdkUiSourceUrlPartSchema,_b as AiSdkUiStepStartPartSchema,rb as AiSdkUiTextPartSchema,ub as AiSdkUiToolPartSchema,Vv as ApiContractStatusSchema,cf as ApiErrorEnvelopeSchema,M as ApiResponseSchema,Kv as AppendAgentEventRequestSchema,zv as AppendAgentEventResponseSchema,jb as ApplyPatchBatchErrorCodeSchema,Nb as ApplyPatchBatchFailureSchema,iC as ApplyPatchBatchInputSchema,Ab as ApplyPatchBatchPatchSchema,lm as ApplyPatchBatchPostActionSchema,rC as ApplyPatchBatchResultSchema,Ob as ApplyPatchBatchSuccessSchema,aC as ApplyPatchBatchToolInputSchema,Pb as ApplyPatchEditSchema,kb as ApplyPatchOperationSchema,Cc as ArchetypeProposalSchema,ty as AuditLogIdSchema,zb as AuthIdentityIdSchema,Hb as AuthLoginCodeIdSchema,Vb as AuthOidcStateIdSchema,Bb as AuthSessionIdSchema,Wb as AuthTokenIdSchema,$b as AuthWsTicketIdSchema,xh as BINDING_STATUSES,Gc as BlockGenerationContextSchema,dv as BlockMediaIntentSchema,Ui as BlockSchema,Kc as BrandingSchema,ut as BriefIdSchema,Ni as BriefRecordSchema,Qi as BusinessFactsSchema,$T as CHAT_COPY,HT as CLARIFICATION_COPY,H_ as CMS_FORM_FIELD_TYPES,sr as CMS_MAIN_PRODUCTS_MAX_LENGTH,Yl as CMS_PAGE_DIRECTORY_MAX_DEPTH,$l as CMS_PAGE_DIRECTORY_MAX_NODES,ja as CMS_PAGE_URL_PATH_MAX_LENGTH,vR as COMPONENT_I18N_FILE_SUFFIX,jn as COMPONENT_I18N_NAMESPACE,Em as CONVERSION_CTA_LABEL_MAX_LENGTH,Fh as CRAWLER_INTERNAL_ERROR_CODES,Qo as CURRENT_EDIT_ENGINE_VERSION,gC as CancelActiveWorkspaceRunRequestSchema,_C as CancelActiveWorkspaceRunResponseSchema,oc as CheckSitePublishDomainDataSchema,bS as CheckSitePublishDomainRequestSchema,yS as CheckSitePublishDomainResponseSchema,zc as ChromeDesignSchema,xf as ChromeFooterDesignSchema,yf as ChromeFooterShellSchema,ff as ChromeHeaderDesignSchema,Sf as ChromeHeaderShellSchema,Ef as ChromeMobileNavDesignSchema,ZS as ClarifyQuestionOptionSchema,QS as ClarifyQuestionSchema,$S as ClarifyQuestionTypeSchema,ji as ClarifyQuestionsSchema,nw as ClarifyRunInputSchema,Hi as ClarifySessionIdSchema,Qf as ClarifySessionRecordSchema,sw as ClarifyStreamEventSchema,ny as CmsCollectionBindingIdSchema,V0 as CmsCollectionBindingSchema,jr as CmsFormSchemaProjectionSchema,Oa as CmsManagedPageTypeSchema,Zl as CmsPageDirectoryGroupSchema,Na as CmsPageDirectoryNodeSchema,Ca as CmsPageDirectorySchema,Ps as CmsPageTypeSchema,Rn as CmsPageUrlPathSchema,ua as CmsSiteIdSchema,Lh as CompanyInfoSchema,rP as CompanyInfoTaskCreateRequestSchema,cP as CompanyInfoTaskCreateResponseSchema,mP as CompanyInfoTaskResponseSchema,y1 as CompleteCustomerMaterialsRequestSchema,x1 as CompleteDiagnosisRequestSchema,Lw as CompleteSiteSnapshotDeletionResponseSchema,DI as CompleteSiteWorkflowRequestSchema,E1 as CompleteStrategyRequestSchema,b1 as CompleteWebsiteScanRequestSchema,DR as ComponentI18nResourcesSchema,bE as ComposeDesignerPageResourceBodySchema,vv as ConfirmSiteStructureRequestSchema,e0 as ConnectDynamicCollectionInputSchema,s0 as ConnectFormInputSchema,st as ConversionHintsSchema,qh as CrawlerInternalErrorCodeSchema,lP as CrawlerInternalErrorSchema,It as CrawlerTaskCodeSchema,Q0 as CrawlerTaskCreateRequestSchema,tP as CrawlerTaskCreateResponseSchema,Ah as CrawlerTaskFailureErrorCodeSchema,$r as CrawlerTaskFailureStageSchema,vh as CrawlerTaskPageSchema,J0 as CrawlerTaskPagesQuerySchema,iP as CrawlerTaskPagesResponseSchema,sP as CrawlerTaskStatusResponseSchema,mt as CrawlerTaskUuidSchema,lv as CreateAgentRunConflictResponseSchema,Aw as CreateAgentRunRequestSchema,ww as CreateAgentRunResponseSchema,tv as CreateDeploymentRequestSchema,sf as CreateDeploymentResponseSchema,Oy as CreateDocumentUploadRequestSchema,xy as CreateExternalSiteEditRequestSchema,Ey as CreateExternalSiteEditResponseSchema,qy as CreateImageUploadRequestSchema,wy as CreateInputSourceRequestSchema,nv as CreateQualityCheckDeploymentRequestSchema,mw as CreateSiteBriefRequestSchema,Tw as CreateSiteBriefResponseSchema,lw as CreateSiteDraftRequestSchema,cw as CreateSiteInputSchema,wI as CreateSiteWorkflowRequestSchema,Dm as CreateTextInputSourceRequestSchema,jm as CreateUrlInputSourceRequestSchema,iv as CurrentDeploymentResponseSchema,u1 as CustomerMaterialsDraftResponseSchema,ti as CustomerMaterialsDraftSchema,g1 as CustomerMaterialsNullableResponseSchema,ni as CustomerMaterialsRecordSchema,d1 as CustomerMaterialsResponseSchema,o_ as CustomerMaterialsStatusSchema,r_ as DEFAULT_FONTS,_r as DEFAULT_SITE_DESIGN_RADIUS_ID,nl as DEFAULT_SITE_LOCALE,ak as DEFAULT_SUBSITE_PALETTE,xR as DEPLOYMENT_ACTIVE_STATUSES,$e as DEPLOYMENT_LIFECYCLE_TRANSITIONS,zd as DEPLOYMENT_PROGRESS_STEP_CODES,rf as DEPLOYMENT_REALTIME_CHANNEL,_t as DEPLOYMENT_STATUSES,ER as DEPLOYMENT_TERMINAL_STATUSES,ku as DEPLOYMENT_TRANSITION_ERROR_CODE,mv as DEPLOYMENT_WEBSOCKET_CONTRACT,$x as DESIGNER_COMPONENT_LIBRARY_ERROR_CODES,gE as DESIGNER_PAGE_LIBRARY_ERROR_CODES,vy as DOCUMENT_EXTENSION_WHITELIST,Cy as DOCUMENT_MIME_WHITELIST,nS as DOMAIN_DNS_PURPOSES,iS as DOMAIN_DNS_VERIFICATION_STATUSES,Qh as DOMAIN_OBSERVED_STATUSES,eS as DOMAIN_ROUTING_MODES,aE as DeleteDesignerPageErrorDetailsSchema,sE as DeleteDesignerPageRequestSchema,iE as DeleteDesignerPageResponseSchema,ap as DeleteDesignerPageResultSchema,Nw as DeleteSiteSnapshotResponseSchema,Fe as DeploymentIdSchema,Yb as DeploymentJobIdSchema,Bd as DeploymentProgressStepCodeSchema,Vd as DeploymentProgressStepSchema,Wd as DeploymentProgressStepStatusSchema,No as DeploymentProgressStepsSchema,Qe as DeploymentRecordSchema,cv as DeploymentRedisPubSubEventSchema,Li as DeploymentStatusSchema,Pc as DeploymentStatusSummarySchema,$s as DeploymentTransitionError,Mc as DeploymentTypeSchema,Qn as DeploymentWsDeploymentPayloadSchema,rv as DeploymentWsServerMessageSchema,of as DeploymentWsServerMessageTypeSchema,nb as DesignPlanGenerationOutcomeSchema,sb as DesignPlanGenerationReasonSchema,is as DesignPlanIdSchema,_v as DesignPlanPatchSchema,Jf as DesignPlanRecordSchema,Bc as DesignPlanSchema,pv as DesignTokensSchema,Hl as DesignerComponentCatalogItemSchema,Aa as DesignerComponentCategoriesDataSchema,Pa as DesignerComponentCategoryNodeSchema,ot as DesignerComponentExactVersionSchema,va as DesignerComponentInstallDataSchema,wa as DesignerComponentsDataSchema,mp as DesignerPageCatalogItemSchema,Ba as DesignerPageCategoriesDataSchema,za as DesignerPageCategoryNodeSchema,np as DesignerPageDeleteBlockReasonSchema,tp as DesignerPageDisabledReasonSchema,Mt as DesignerPageExactVersionSchema,Fa as DesignerPageGroupSchema,Va as DesignerPageInstallDataSchema,Ua as DesignerPageNodeSchema,$a as DesignerPageResourcePreparationDataSchema,cp as DesignerPageResourceSourceSchema,hp as DesignerPageResourceTemplateSchema,rt as DesignerPageResourceTypeSchema,Wa as DesignerPagesDataSchema,Is as DesignerResourceVersionSchema,Ya as DesignerSitePagesDataSchema,hE as DesignerSiteRouteIdSchema,ac as DomainConfigurationSchema,sS as DomainDnsPurposeSchema,cS as DomainDnsRecordSchema,aS as DomainDnsVerificationStatusSchema,Jh as DomainObservedStatusSchema,rS as DomainOperationErrorSchema,Ei as DomainOperationSchema,oS as DomainOperationStatusSchema,xi as DomainOperationTypeSchema,ic as DomainRecordSchema,tS as DomainRoutingModeSchema,XT as EDIT_ENGINE_VERSION_HEADER,ZT as EDIT_ENGINE_VERSION_SOURCE_HEADER,WT as ERROR_COPY,Tm as EXTERNAL_SITE_EDIT_INFRASTRUCTURE_REASONS,Rm as EXTERNAL_SITE_EDIT_PROMPT_MAX_LENGTH,ei as EditEngineVersionParseError,Xa as EnhanceDesignerPageResourceBodySchema,Iw as EnhanceDesignerPageResourceResponseSchema,Ty as ExternalSiteEditCallbackAckSchema,Ry as ExternalSiteEditCallbackPayloadSchema,km as ExternalSiteEditCallbackStatusSchema,Dt as ExternalSiteEditDegradedReasonSchema,ta as ExternalSiteEditOutcomeSchema,ea as ExternalSiteEditTaskIdSchema,na as ExternalSiteEditTaskSchema,Pm as ExternalSiteEditTaskStatusSchema,gw as ExternalSyncSiteRequestSchema,Rw as ExternalSyncSiteResponseSchema,wm as ExtractedFactKindSchema,un as ExtractedFactSchema,k_ as FIELD_TYPES,dr as FONT_PAIRINGS,ii as FONT_PAIRING_IDS,ah as FORM_DESIGN_ERROR_CODES,ih as FORM_DESIGN_FAILURE_STAGES,nh as FORM_DESIGN_OPERATION_STAGES,sh as FORM_DESIGN_OPERATION_STATUSES,nn as FORM_FIELD_TYPES,$_ as FORM_SPEC_FIELD_TYPE_TO_CMS,Pr as FORM_SPEC_FILE_MIN_RUNTIME_VERSION,F_ as FORM_SPEC_LOCALIZABLE_FIELD_PATHS,kr as FORM_SPEC_MULTISTEP_MIN_RUNTIME_VERSION,g0 as FORM_TEMPLATE_CATEGORY_COUNTS,u0 as FORM_TEMPLATE_CATEGORY_SLUGS,uC as FailStaleInFlightWorkspaceRunsResponseSchema,Tr as FieldDeclSchema,yP as FirecrawlBatchCreateRequestSchema,xP as FirecrawlBatchCreatedResponseSchema,zh as FirecrawlBatchErrorSchema,IP as FirecrawlBatchErrorsResponseSchema,Kh as FirecrawlBatchPageSchema,EP as FirecrawlBatchStatusResponseSchema,_P as FirecrawlCrawlCreateRequestSchema,hP as FirecrawlCrawlCreatedResponseSchema,SP as FirecrawlCrawlStatusResponseSchema,Jr as FirecrawlJobStatusSchema,uP as FirecrawlMapRequestSchema,gP as FirecrawlMapResponseSchema,RP as FirecrawlQueueStatusResponseSchema,fP as FirecrawlScrapeRequestSchema,bP as FirecrawlScrapeResponseSchema,bf as FooterShellSurfaceSchema,w_ as FormBlockIdSchema,Wn as FormDefinitionIdSchema,J_ as FormDesignAffectedFilesSchema,fi as FormDesignErrorCodeSchema,T0 as FormDesignErrorSchema,Lr as FormDesignFailureStageSchema,ee as FormDesignHashSchema,f0 as FormDesignOpenResponseSchema,eh as FormDesignOperationFingerprintInputSchema,di as FormDesignOperationIdSchema,Mr as FormDesignOperationNextActionSchema,Zb as FormDesignOperationRecordIdSchema,I0 as FormDesignOperationRecordSchema,bi as FormDesignOperationResponseSchema,Fr as FormDesignOperationSchema,Si as FormDesignOperationStageSchema,Nr as FormDesignOperationStatusSchema,R0 as FormDesignOperationTransitionRequestSchema,Ur as FormDesignPreviewRefreshStatusSchema,y0 as FormDesignQueryResponseSchema,x0 as FormDesignResumeRequestSchema,E0 as FormDesignResumeResponseSchema,th as FormDesignSaveRequestSchema,b0 as FormDesignSaveResponseSchema,Or as FormDesignSharedImpactSchema,hi as FormDesignStandardizationSchema,P_ as FormFieldDeclSchema,an as FormFieldNameSchema,ui as FormOptionValueSchema,v_ as FormSpecBindingSchema,D_ as FormSpecFieldNodeSchema,O_ as FormSpecNodeSchema,C_ as FormSpecOptionSchema,j_ as FormSpecStepBreakNodeSchema,_i as FormSpecV1Schema,_0 as FormTemplateCatalogResponseSchema,Dr as FormTemplateCategorySlugSchema,W_ as FormTemplateCategoryV1Schema,Ze as FormTemplateTextSchema,V_ as FormTemplateV1Schema,ES as GSC_AUTH_STATUSES,IS as GSC_BINDING_STATUSES,RS as GSC_PROPERTY_TYPES,av as GetDeploymentResponseSchema,af as GetDeploymentsStatusResponseSchema,Iy as GetExternalSiteEditResponseSchema,sA as GetSiteDomainConfigurationResponseSchema,rc as GetSitePublishDomainOperationDataSchema,xS as GetSitePublishDomainOperationResponseSchema,Lk as GetTemplateUpgradeReportQuerySchema,Mk as GetTemplateUpgradeReportResponseSchema,xA as GoogleSearchConsoleAuthStartDataSchema,yA as GoogleSearchConsoleAuthStartRequestSchema,EA as GoogleSearchConsoleAuthStartResponseSchema,hA as GoogleSearchConsoleAuthStatusSchema,SA as GoogleSearchConsoleBindingStatusSchema,fA as GoogleSearchConsolePropertyTypeSchema,bA as GoogleSearchConsoleStateSchema,RA as GoogleSearchConsoleStatusDataSchema,IA as GoogleSearchConsoleStatusInputSchema,TA as GoogleSearchConsoleStatusResponseSchema,uA as GscAuthStartDataSchema,dA as GscAuthStartRequestSchema,gA as GscAuthStartResponseSchema,Ii as GscAuthStatusSchema,Ri as GscBindingStatusSchema,Ti as GscPropertyTypeSchema,kS as GscStateInputSchema,_A as GscStateSchema,lc as GscStatusDataSchema,PS as GscStatusResponseSchema,Da as HOME_PAGE_URL_PATH,_f as HeaderShellBehaviorSchema,hf as HeaderShellShapeSchema,gf as HeaderShellSurfaceSchema,uf as HeaderShellVariantSchema,Eh as HomeUrlCrawlerTaskCreateRequestSchema,Ls as HttpUrlSchema,Ly as IMAGE_EXTENSION_WHITELIST,My as IMAGE_MIME_WHITELIST,ka as INSERT_NEW_COMPONENT_CATEGORY_GROUP_KEY,Ka as INSERT_NEW_PAGE_CATEGORY_GROUP_KEY,sl as ISO_639_3_TO_SITE_LOCALE,Om as ImageRoleSchema,cm as InboundUserMessageSchema,Y1 as IndustryClassificationRequestSchema,X1 as IndustryClassificationResultSchema,T_ as IndustryConfidenceSchema,Am as InputBundleStatusSchema,_n as InputConflictSchema,Gy as InputContextBundleSchema,nt as InputContextSourceIdSchema,Cm as InputSourceSchema,rs as InputSourceStatusSchema,os as InputSourceTypeSchema,Rk as InspectTemplateUpgradeStateRequestSchema,Tk as InspectTemplateUpgradeStateResponseSchema,Qx as InstallDesignerComponentBodySchema,Sw as InstallDesignerComponentResponseSchema,SE as InstallDesignerPageBodySchema,yw as InstallDesignerPageResponseSchema,sv as InternalCreateDeploymentResponseSchema,Zw as InternalEnsureSubsitePublishRequestSchema,Qw as InternalEnsureSubsitePublishResponseSchema,G as InternalEntityIdSchema,ov as InternalGetDeploymentsStatusResponseSchema,Jw as InternalGetSubsitePublishStatusRequestSchema,ev as InternalGetSubsitePublishStatusResponseSchema,Yw as InternalPrepareSubsitePreviewRequestSchema,Xw as InternalPrepareSubsitePreviewResponseSchema,s_ as KNOWLEDGE_CATEGORY_CODES,ir as KnowledgeCategoryCodeSchema,o1 as KnowledgeContextReadinessSchema,a_ as KnowledgeSourceReadinessSchema,ar as KnowledgeSourceReadinessStatusSchema,i1 as KnowledgeTaskStatusBatchSchema,i_ as KnowledgeTaskStatusSchema,Zm as LEGACY_SITE_LOCALE_CODES,Jv as LatestAgentRunQuerySchema,eC as LatestAgentRunResponseSchema,Qv as LatestWorkspaceRunResponseSchema,CP as LauncherPromptTemplateApplyRequestSchema,DP as LauncherPromptTemplateApplyResponseSchema,Hh as LauncherPromptTemplateCatalogItemSchema,wP as LauncherPromptTemplateCatalogQuerySchema,vP as LauncherPromptTemplateCatalogSchema,Wh as LauncherPromptTemplateKindSchema,Vh as LauncherPromptTemplateLocaleSchema,Zn as LauncherPromptTemplateTypeSchema,Wv as ListAgentEventsQuerySchema,Bv as ListAgentEventsResponseSchema,_w as ListDesignerComponentCategoriesResponseSchema,Zx as ListDesignerComponentsQuerySchema,hw as ListDesignerComponentsResponseSchema,fw as ListDesignerPageCategoriesResponseSchema,_E as ListDesignerPagesQuerySchema,bw as ListDesignerPagesResponseSchema,Ew as ListDesignerSitePagesResponseSchema,MS as ListMediaLibraryAssetsQuerySchema,US as ListMediaLibraryAssetsResponseSchema,Vw as ListSiteVersionsResponseSchema,Uk as ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema,Fk as ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema,jy as MAX_DOCUMENT_SOURCES_PER_SITE,Dy as MAX_DOCUMENT_UPLOAD_BYTES,Fy as MAX_IMAGE_SOURCES_PER_SITE,Uy as MAX_IMAGE_UPLOAD_BYTES,Sc as MEDIA_LIBRARY_AUDIO_EXTENSIONS,Ec as MEDIA_LIBRARY_AUDIO_MIME_TYPES,fc as MEDIA_LIBRARY_DOCUMENT_EXTENSIONS,NS as MEDIA_LIBRARY_EXTENSIONS,bc as MEDIA_LIBRARY_FILE_EXTENSIONS,_c as MEDIA_LIBRARY_IMAGE_EXTENSIONS,OS as MEDIA_LIBRARY_IMAGE_MAX_BYTES,yc as MEDIA_LIBRARY_IMAGE_MIME_TYPES,gc as MEDIA_LIBRARY_MAX_BYTES,LS as MEDIA_LIBRARY_MIME_TYPES,hc as MEDIA_LIBRARY_VIDEO_EXTENSIONS,xc as MEDIA_LIBRARY_VIDEO_MIME_TYPES,NR as MIGRATION_PRODUCTS_CMS_DETAIL_PAGE_TITLE,OR as MIGRATION_PRODUCTS_DETAIL_PREFIX,UR as MIGRATION_PRODUCTS_DETAIL_VIEW_VARIANT,MR as MIGRATION_PRODUCTS_LIST_VIEW_VARIANT,vu as MIGRATION_PRODUCTS_ROUTE,Ke as MIGRATION_PRODUCTS_SLUG,LR as MIGRATION_PRODUCTS_VIEW_BLOCK_TYPE,S_ as MOTION_PRESETS,oi as MOTION_PRESET_IDS,Vy as ManagedPageTemplateRouteManifestV1Schema,gv as MediaAssetSchema,pf as MediaAttributionSchema,Ai as MediaLibraryAssetSchema,Ic as MediaLibraryFileTypeSchema,Rc as MediaLibrarySourceSchema,wb as MediaRequestOwnerSchema,ey as MediaResolutionCacheIdSchema,Xx as MockDesignerComponentInsertDataSchema,Yx as MockDesignerComponentInsertRequestSchema,Di as MotionLevelSchema,uh as NAV_ITEMS_LOCALIZABLE_FIELD_PATHS,gh as NAV_ITEMS_MACHINE_FIELD_PATHS,p_ as NEXT_FONT_DISPLAY_NAMES,Xt as NEXT_FONT_REGISTRY,il as NON_LATIN_SITE_LOCALE_CODES,N0 as NavItemSchema,mh as PAGE_SEO_LOCALIZABLE_FIELD_PATHS,lh as PAGE_SEO_MACHINE_FIELD_PATHS,Ut as PAGE_SLUG_PATTERN,St as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,G0 as PLATFORM_MATERIALIZED_EXEMPTIONS,fh as PLATFORM_MATERIALIZED_FILES,bh as PLATFORM_MATERIALIZED_FILE_PATTERNS,q0 as PLATFORM_MATERIALIZERS,Za as PLATFORM_OWNED_PAGE_SLUGS,Sp as PLATFORM_OWNED_ROUTE_FILE_PATHS,ip as PageDirectoryReconcileFailedPageSchema,qa as PageDirectoryReconcileResultSchema,rE as PageDirectoryReconcileStateSchema,sp as PageDirectoryReconcileStatusSchema,kh as PageDiscoveryCoverageEntrySchema,nP as PageDiscoveryCoverageReasonSchema,Yr as PageDiscoveryCoverageSchema,Vc as PageNavigationSchema,ws as PageResourceArtifactSchema,up as PageResourceComponentReferenceSchema,gp as PageResourceComponentSchema,pp as PageResourceDraftPageSchema,dp as PageResourceDraftSchema,Tn as PageResourceFinalRouteSchema,_p as PageResourcePageSchema,lp as PageResourcePageSelectionSchema,Ha as PageResourceRouteMappingSchema,Fi as PageSchema,j0 as PageSeoDeclSchema,Wc as PageSlugSchema,op as PageTargetKindSchema,Ts as PageTargetProjectionHashSchema,Ga as PageTargetSchema,oE as PageTargetSetSchema,Yy as PageTemplateCleanupRequestSchema,Qy as PageTemplateCleanupResponseSchema,Hy as PageTemplateCreateRequestSchema,Xy as PageTemplateCreateResponseSchema,Jy as PageTemplateErrorCodeSchema,Ie as PageTemplateIdSchema,hn as PageTemplatePagePathSchema,$y as PageTemplatePromoteRequestSchema,Zy as PageTemplatePromoteResponseSchema,Nv as PersistClarifyAnswersRequestSchema,Lv as PersistClarifyAnswersResponseSchema,Cv as PersistGeneratedSitemapDraftRequestSchema,Ov as PersistGeneratedSitemapDraftResponseSchema,pC as PersistPreviewSessionRequestSchema,dC as PersistPreviewSessionResponseSchema,Uv as PersistSiteDesignPlanRequestSchema,Fv as PersistSiteDesignPlanResponseSchema,jv as PersistSiteSitemapDraftResponseSchema,wv as PersistSiteSitemapRequestSchema,Dv as PersistSiteSitemapResponseSchema,vw as PersistSiteSnapshotRequestSchema,Cw as PersistSiteSnapshotResponseSchema,HS as PositioningPrefillSchema,wi as PositioningSourceSchema,fE as PrepareDesignerPageBodySchema,xw as PrepareDesignerPageResponseSchema,Xk as PrepareSiteBuildInitialGenerationBaseRequestSchema,Zk as PrepareSiteBuildInitialGenerationBaseResultSchema,Ik as PrepareTemplateUpgradeStateRequestSchema,qg as PrepareTemplateUpgradeStateResponseSchema,$w as PrepareVersionPreviewRequestSchema,nf as PrepareVersionPreviewResponseSchema,Oo as ProductSearchAppConfigDraftSchema,Gs as ProductSearchAppSlugSchema,HI as ProductSearchContractFixtureSchema,Ld as ProductSearchDraftConfigSchema,Re as ProductSearchFieldNameSchema,Od as ProductSearchFilterMetaSchema,Ks as ProductSearchInteractionRequestSchema,vn as ProductSearchInteractionResponseSchema,VI as ProductSearchPopularTermsReadSchema,jo as ProductSearchPopularTermsSchema,qd as ProductSearchRequestSchema,Kd as ProductSearchResponseSchema,Bt as ProductSearchRouteIdSchema,jd as ProductSearchValueShapeSchema,jw as PromoteSiteSnapshotRequestSchema,ef as PromoteSiteSnapshotResponseSchema,Bw as PromoteTemplateUpgradeSnapshotRequestSchema,Ww as PromoteTemplateUpgradeSnapshotResponseSchema,dS as PublishDecisionSchema,VT as REFUSAL_COPY,$v as REST_API_ENDPOINTS,ph as ROOT_LAYOUT_METADATA_LOCALIZABLE_FIELD_PATHS,dh as ROOT_LAYOUT_METADATA_MACHINE_FIELD_PATHS,Mw as RecordSnapshotVersionRequestSchema,Uw as RecordSnapshotVersionResponseSchema,Ok as RecordTemplateUpgradeEventRequestSchema,Nk as RecordTemplateUpgradeEventResponseSchema,kk as RecordTemplateUpgradeFailureRequestSchema,Pk as RecordTemplateUpgradeFailureResponseSchema,Ak as RecordTemplateUpgradeSuccessRequestSchema,wk as RecordTemplateUpgradeSuccessResponseSchema,vm as ReferencePagePatternSchema,gn as ReferenceSignalsSchema,jI as RegisterWorkflowTaskCommandRequestSchema,kd as RegisterWorkflowTaskRequestSchema,Gw as ReleaseTemplateUpgradeLockRequestSchema,Kw as ReleaseTemplateUpgradeLockResponseSchema,LI as ReplaceCrawlWorkflowTaskCommandRequestSchema,Ad as ReplaceCrawlWorkflowTaskRequestSchema,NI as ReplaceWorkflowTaskCommandRequestSchema,Pd as ReplaceWorkflowTaskRequestSchema,J1 as ResolvedFieldSchema,i0 as ResolvedFormFieldSchema,Hv as RestApiMethodSchema,Hw as RestoreSiteSnapshotResponseSchema,O0 as RootLayoutMetadataSchema,Fc as RouteGenerationCardSchema,bu as RuleEngineInputSchema,Iu as RuleEngineScoreRecordSchema,Hs as RuleScoreDimensionKeySchema,Eu as RuleScoreDimensionSchema,jt as SELECTABLE_SITE_LOCALE_CODES,$c as SITEMAP_RESOLVER_MAX_BLOCK_TARGETS,Hc as SITEMAP_RESOLVER_MAX_PAGE_TARGETS,$k as SITE_BUILD_CONTEXT_FILE_PATH,Yk as SITE_BUILD_CONTEXT_MAX_BYTES,gd as SITE_BUILD_STATUSES,ko as SITE_BUILD_STATUS_CODES,_d as SITE_DEPLOYMENT_STATUSES,Po as SITE_DEPLOYMENT_STATUS_CODES,ai as SITE_DESIGN_DENSITY_IDS,gr as SITE_DESIGN_RADIUS_IDS,nT as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,ql as SITE_EDIT_MATERIALIZATION_MAX_FILE_CONTENT_BYTES,xs as SITE_EDIT_MATERIALIZATION_MAX_FILE_COUNT,Es as SITE_EDIT_MATERIALIZATION_MAX_TOTAL_CONTENT_BYTES,mo as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,HE as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,pg as SITE_EDIT_RUNTIME_CONTAINER_TAGS,dg as SITE_EDIT_RUNTIME_TEXT_TAGS,lg as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,UE as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,Mm as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,ia as SITE_EDIT_SOURCE_ALLOWED_DIRS,Lm as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,ls as SITE_EDIT_SOURCE_DELETE_CAPABILITY,Um as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,gt as SITE_EXTRA_REQUIREMENT_MAX_LENGTH,Qm as SITE_LOCALE_CODES,D0 as SITE_LOCALIZATION_STRUCTURES,iw as SITE_PLANNING_FROZEN_ERROR_CODE,aw as SITE_PLANNING_LOCKED_ERROR_CODE,ow as SITE_STRUCTURE_CONFIRMATION_REQUIRED_ERROR_CODE,rw as SITE_STRUCTURE_CONFIRMATION_STALE_ERROR_CODE,hd as SITE_WORKFLOW_STATUSES,Ao as SITE_WORKFLOW_STATUS_CODES,Yv as SSE_STREAMS,bn as STEP5_PRIMARY_INTENT_PAGE_LIMIT,ga as STEP5_SEMRUSH_MIN_RELEVANCE_SCORE,vx as STEP5_SEO_KEYWORD_DEFAULT,Il as STEP5_SEO_KEYWORD_MAX,El as STEP5_SEO_KEYWORD_MIN,xl as STEP5_SEO_PAYLOAD_SCHEMA_VERSION,Nl as STEP5_SSE_EVENT_NAMES,fe as STEP5_STRATEGY_COUNT,it as STEP5_STRATEGY_KEYS,ha as STEP5_STRATEGY_OPTION_IDS,fr as STEP6_AI_THEME_IDS,ri as STEP6_AI_THEME_PRESETS,br as STEP6_GENERATED_THEME_ID_PATTERN,Ig as SUBSITE_GLOSSARY_ENTRY_MAX_CHARS,Rg as SUBSITE_GLOSSARY_MAX_ENTRIES,Og as SUBSITE_MOUNT_PATH_PATTERN,wg as SUBSITE_PALETTE_NOTE_MAX_CHARS,Ng as SUBSITE_RESERVED_MOUNT_SEGMENTS,Sx as SUPPORTED_SITE_LOCALES,pn as SandboxSessionIdSchema,Gb as SandboxSessionSchema,Sm as SandboxSessionStatusSchema,uw as SaveBriefDraftRequestSchema,Pw as SaveBriefDraftResponseSchema,py as SaveSiteExtraRequirementRequestSchema,qS as SearchUnsplashMediaQuerySchema,GS as SearchUnsplashMediaResponseSchema,e_ as SiteBuildContextFileSchema,Jg as SiteBuildContextPayloadSchema,Qg as SiteBuildContextProvenanceSchema,Zg as SiteBuildContextProvenanceSourceSchema,Ms as SiteBuildStatusSchema,Us as SiteDeploymentStatusSchema,Uc as SiteDesignContextSchema,YS as SiteDesignDensitySchema,XS as SiteDesignMotionLevelSchema,Ln as SiteEditBoundaryKindSchema,Nu as SiteEditCapabilityConstraintSchema,ju as SiteEditCapabilityModeSchema,Nn as SiteEditCapabilityModeViewSchema,WR as SiteEditCapabilityReadRequestSchema,Ep as SiteEditClassNameSourceDiagnosticSchema,ct as SiteEditClassNameSourceRangeSchema,so as SiteEditClassNameSourceSchema,wE as SiteEditClassNameSourceStyleContextSchema,no as SiteEditClassNameSourceStylesheetSchema,Cs as SiteEditClassNameSourceWriteIntentSchema,RE as SiteEditCommandDiagnosticSchema,yp as SiteEditCommandErrorSchema,L as SiteEditCompositionContextSchema,se as SiteEditCompositionSelectorSchema,Ou as SiteEditConstraintKindSchema,nd as SiteEditDeletePageSourceOutputSchema,tg as SiteEditDynamicConfidenceSchema,sg as SiteEditDynamicDataBindingSchema,Ho as SiteEditDynamicDataDetailSchema,$o as SiteEditDynamicDataSummarySchema,ng as SiteEditDynamicEvidenceSchema,Vo as SiteEditDynamicSourceKindSchema,Ju as SiteEditDynamicSourceTypeSchema,eg as SiteEditDynamicTargetKindSchema,og as SiteEditEffectiveWriteTargetSchema,Ds as SiteEditElementPropertySchema,QR as SiteEditEventSchema,Xs as SiteEditExternalSourceKindSchema,jE as SiteEditGetClassNameSourceCommandResultSchema,CE as SiteEditGetClassNameSourceInputSchema,DE as SiteEditGetClassNameSourceResultSchema,PT as SiteEditGetDocumentInputSchema,AT as SiteEditGetObjectEditContextInputSchema,lx as SiteEditGetSourceFileInputSchema,mx as SiteEditGetSourceTreeInputSchema,vE as SiteEditGetStyleContextInputSchema,Un as SiteEditHistoryProvenanceSchema,qu as SiteEditHistoryReadOnlyRecoveryStatusSchema,Lu as SiteEditHistoryRecoveryCodeSchema,Mu as SiteEditHistoryRecoveryDiagnosticSchema,iT as SiteEditHistoryResultSchema,sT as SiteEditHistoryStatusModeSchema,Ku as SiteEditHistoryStatusSchema,Uu as SiteEditHistoryUnavailableReasonSchema,Gu as SiteEditHistoryUnavailableStatusSchema,Fu as SiteEditHistoryWritableStatusSchema,zT as SiteEditInitializeSessionInputSchema,Jp as SiteEditInsertNodeSpecSchema,td as SiteEditInsertPageResourceOutputSchema,Vl as SiteEditMaterializationDataRequirementsSchema,Wl as SiteEditMaterializationEntrySchema,Bl as SiteEditMaterializationExportSchema,zl as SiteEditMaterializationFileSchema,Ta as SiteEditMaterializationPathTemplateSchema,at as SiteEditMaterializationSchema,go as SiteEditMoveTargetSchema,Ft as SiteEditMutationContextSchema,Mn as SiteEditNodeCapabilitySnapshotSchema,vT as SiteEditObjectCapabilitiesSchema,DT as SiteEditObjectDetailSchema,OT as SiteEditObjectEditContextSchema,NT as SiteEditObjectStyleDetailSchema,jT as SiteEditObjectSummarySchema,cI as SiteEditOperationCommandResultSchema,fo as SiteEditOperationErrorCodeSchema,bo as SiteEditOperationErrorSchema,sd as SiteEditOperationOutputSchema,ed as SiteEditOperationParamsSchema,Ns as SiteEditOperationPayloadSchema,Os as SiteEditOperationRequestSchema,Qp as SiteEditOperationResultTargetSchema,yo as SiteEditOperationSelectionRefSchema,Qu as SiteEditOperationSummarySchema,Zp as SiteEditOperationTargetSchema,Kt as SiteEditOperationTypeSchema,uo as SiteEditOperationValueSchema,$E as SiteEditPageCompositionAnyVersionSchema,Np as SiteEditPageCompositionAtomicKindSchema,Fp as SiteEditPageCompositionBoundaryModeSchema,Pp as SiteEditPageCompositionBusinessMemberSchema,Tp as SiteEditPageCompositionContainerSchema,Gt as SiteEditPageCompositionDiagnosticSchema,Pn as SiteEditPageCompositionErrorCodeSchema,oo as SiteEditPageCompositionPlacementTargetSchema,Ap as SiteEditPageCompositionPlacementUnitSchema,jp as SiteEditPageCompositionRuntimeRefSchema,Dp as SiteEditPageCompositionSchema,Op as SiteEditPageCompositionSourceMemberKindSchema,kp as SiteEditPageCompositionSourceMemberSchema,lo as SiteEditPageCompositionSourceRangeSchema,vp as SiteEditPageCompositionSupportedSchema,Cp as SiteEditPageCompositionUnsupportedSchema,Up as SiteEditPageCompositionV2BusinessMemberSchema,Lp as SiteEditPageCompositionV2ContainerSchema,Gp as SiteEditPageCompositionV2PlacementRelationSchema,zp as SiteEditPageCompositionV2PlacementSchema,qp as SiteEditPageCompositionV2PlacementUnitSchema,Hp as SiteEditPageCompositionV2Schema,Mp as SiteEditPageCompositionV2SourceMemberSchema,Wp as SiteEditPageCompositionV2SupportedSchema,Vp as SiteEditPageCompositionV2UnsupportedSchema,Kp as SiteEditPageCompositionV2WriteModeSchema,Bp as SiteEditPageCompositionVisualAnchorSchema,wp as SiteEditPagePlacementOptionSchema,ao as SiteEditPagePlacementSchema,co as SiteEditPageUnitResultTargetSchema,ro as SiteEditPageUnitTargetSchema,Wu as SiteEditPatchPlanPatchSchema,mT as SiteEditPatchPlanSchema,$t as SiteEditProvenanceChainSchema,rg as SiteEditProvenanceHopSchema,wT as SiteEditRenderDocumentSchema,Ht as SiteEditRenderEntryRefSchema,ig as SiteEditRenderEntrySchema,Wo as SiteEditRenderPageCompositionSchema,Xu as SiteEditRenderPageCompositionSupportedSchema,Zu as SiteEditRenderPageCompositionUnsupportedSchema,Yu as SiteEditRenderPagePlacementSchema,FE as SiteEditRequiredMutationContextEnvelopeSchema,dx as SiteEditResolveSourceLocationInputSchema,Xo as SiteEditSemanticSourceSchema,rI as SiteEditSignedOperationRequestSchema,aa as SiteEditSourceDeleteCapabilitySchema,qm as SiteEditSourceDirectoryPathSchema,Wm as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,Vm as SiteEditSourceFileBinaryResponseSchema,rx as SiteEditSourceFileKindSchema,Gm as SiteEditSourceFileListItemSchema,px as SiteEditSourceFileResponseSchema,Bm as SiteEditSourceFileTextResponseSchema,js as SiteEditSourceIdentitySchema,Hm as SiteEditSourceLocationRangeSchema,ux as SiteEditSourceLocationSchema,mg as SiteEditSourceLocatorRangeSchema,Qs as SiteEditSourceLocatorSchema,le as SiteEditSourcePathSchema,oa as SiteEditSourceTreeNodeSchema,cx as SiteEditSourceTreeResponseSchema,Km as SiteEditSourceTreeTruncationReasonSchema,zm as SiteEditSourceTreeTruncationSchema,So as SiteEditStyleBreakpointSchema,CT as SiteEditStyleModelSchema,_o as SiteEditStylePropertySchema,Zo as SiteEditStyleSourceSchema,ho as SiteEditStyleStateModeSchema,Zs as SiteEditTextSegmentSchema,Yo as SiteEditTextSourceSchema,ag as SiteEditWriteTargetSchema,dy as SiteExtraRequirementResponseSchema,xm as SiteExtraRequirementSchema,I as SiteIdSchema,pe as SiteLocaleSchema,uv as SiteMediaIntentSchema,Xb as SiteOperationLockIdSchema,Hg as SitePreviewActivateErrorCodeSchema,Yg as SitePreviewActivateFailedSchema,$g as SitePreviewActivateReadySchema,Kk as SitePreviewActivateResponseSchema,aA as SitePublishDomainCheckDataSchema,iA as SitePublishDomainCheckRequestSchema,oA as SitePublishDomainCheckResponseSchema,rA as SitePublishDomainOperationDataSchema,cA as SitePublishDomainOperationResponseSchema,Rt as SitePublishQualityTaskStatusSchema,$P as SitePublishWorkflowActiveResponseSchema,Xi as SitePublishWorkflowIdSchema,SS as SitePublishWorkflowMutationDataSchema,YP as SitePublishWorkflowMutationResponseSchema,fS as SitePublishWorkflowPublishDataSchema,XP as SitePublishWorkflowPublishResponseSchema,pt as SitePublishWorkflowRecordSchema,HP as SitePublishWorkflowRevisionRequestSchema,ZP as SitePublishWorkflowSseDataSchema,lS as SitePublishWorkflowStatusSchema,pS as SitePublishWorkflowStepSchema,tt as SiteRecordSchema,Qb as SiteTemplateUpgradeStateIdSchema,$i as SiteVersionIdSchema,tf as SiteVersionListItemSchema,ts as SiteVersionRecordSchema,Oe as SiteWorkflowIdSchema,Td as SiteWorkflowRecordSchema,PI as SiteWorkflowSnapshotResponseSchema,qs as SiteWorkflowSnapshotSchema,Sd as SiteWorkflowStatusSchema,Zi as SiteWorkflowTaskRefIdSchema,AI as SiteWorkflowTaskRefResponseSchema,Co as SiteWorkflowTaskRefSchema,Iv as SitemapAddBlockInputSchema,qi as SitemapAnswerSchema,xv as SitemapChangeBlockVariantInputSchema,Uf as SitemapDeleteBlockInputSchema,Pf as SitemapDraftBlockSchema,Af as SitemapDraftPageSchema,Zf as SitemapDraftRecordSchema,rn as SitemapDraftSchema,Mf as SitemapEditActorSchema,Gf as SitemapEditErrorCodeSchema,zf as SitemapEditFailureSchema,qf as SitemapEditOperationSchema,Tv as SitemapEditResultSchema,Kf as SitemapEditSuccessSchema,Pv as SitemapGenerationInputSchema,$f as SitemapGenerationOutcomeSchema,Yf as SitemapGenerationReasonSchema,Zc as SitemapGenerationStageSchema,ke as SitemapIdSchema,Bf as SitemapIntentPageSchema,bv as SitemapModelOutputSchema,vf as SitemapModelPageSchema,yv as SitemapMoveBlockInputSchema,Tf as SitemapNavigationHrefSchema,xe as SitemapNodeIdSchema,nm as SitemapRecordSchema,Sv as SitemapResolverModelOutputSchema,hv as SitemapResolverRequestSchema,fv as SitemapResolverResponseSchema,Lf as SitemapResolverTargetsSchema,Xc as SitemapRunInputSchema,Pt as SitemapSchema,Df as SitemapSourceProvenanceSchema,Av as SitemapStreamEventSchema,eP as SitemapTaskCreateRequestSchema,aP as SitemapTaskCreateResponseSchema,Oh as SitemapTaskFailureErrorCodeSchema,oP as SitemapTaskResponseSchema,Ff as SitemapUpdateBlockInstructionInputSchema,Ev as SitemapUpdateBlockPropsInputSchema,lf as SitemapUserChoiceSchema,kt as SkillSelectionSchema,df as SkillSelectionSourceSchema,mm as SnapshotContentHashSchema,Se as SnapshotFilePathSchema,x as SnapshotIdSchema,We as SnapshotRecordSchema,Lc as SnapshotStatusSchema,Pi as StartGscAuthDataSchema,cc as StartGscAuthRequestSchema,mc as StartGscAuthResponseSchema,MI as StartSiteBuildRequestSchema,Qk as StartSiteBuildResponseSchema,t_ as StartSiteBuildResultSchema,BP as StartSitePublishWorkflowRequestSchema,Xv as StartWorkspaceRunRequestSchema,Zv as StartWorkspaceRunResponseSchema,Jd as Step2FinalResultDataSourceSchema,Dn as Step2FinalResultRequestSchema,tR as Step2FinalResultResponseSchema,eR as Step2FinalResultSaveResponseSchema,Qd as Step2FinalResultSaveResultSchema,zs as Step2FinalResultTypeSchema,tu as Step2FinalResultViewSchema,Lo as Step2FinalScanCardKeySchema,Bs as Step2FinalScanCardSchema,Zd as Step2FinalScanResultSchema,Yt as Step2KnowledgeOpaqueIdSchema,a1 as Step2KnowledgeScopeSchema,He as Step2PageRoleSchema,iR as Step2PageSelectionRequestSchema,aR as Step2PageSelectionResponseSchema,$d as Step2SiteInitializationCrawlerErrorCodeSchema,Hd as Step2SiteInitializationStatusSchema,JI as Step2SiteInitializationTaskResponseSchema,Yd as Step2SiteInitializationTaskSchema,Ws as Step3AgentAnalysisSchema,cu as Step3AnalysisFindingSchema,dR as Step3AnalysisJobResponseSchema,qo as Step3AnalysisJobSchema,Uo as Step3AnalysisJobStatusSchema,uR as Step3AnalysisLatestResponseSchema,Mo as Step3AnalysisProgressSchema,pu as Step3AnalysisResultSchema,pR as Step3AnalysisScheduleResponseSchema,ru as Step3AnalysisScheduleSchema,gR as Step3AnalysisSseFrameSchema,mR as Step3AnalysisStartRequestSchema,Fo as Step3AnalysisSummarySchema,ou as Step3AnalystSchema,lR as Step3AnalystsResponseSchema,fR as Step4DiagnosisResponseSchema,yn as Step5ActiveStrategyKeySchema,Lx as Step5CommitStrategyRequestSchema,Mx as Step5CommitStrategyResponseSchema,jl as Step5CommittedVersionSchema,ya as Step5DecisionCustomPayloadInputSchema,wl as Step5DecisionCustomPayloadSchema,cl as Step5EvidenceReferenceSchema,yl as Step5GenerationStatusSchema,Cl as Step5JobStatusSchema,Al as Step5LegacyDecisionCustomPayloadInputSchema,Pl as Step5LegacyDecisionCustomPayloadSchema,Rl as Step5LegacySeoKeywordInputSchema,ba as Step5LegacySeoKeywordSchema,Ss as Step5OutputLocaleSchema,jx as Step5RegenerateItemRequestSchema,Ox as Step5SaveDecisionRequestSchema,Nx as Step5SaveDecisionResponseSchema,ul as Step5SemrushEmptyReasonCodeSchema,dl as Step5SemrushIntentGroupSchema,hl as Step5SemrushKeywordCandidateSchema,Sl as Step5SemrushKeywordCandidateSearchDataSchema,kx as Step5SemrushKeywordCandidateSearchRequestSchema,Px as Step5SemrushKeywordCandidateSearchResponseSchema,pl as Step5SemrushKeywordRecommendationSchema,bl as Step5SemrushKeywordSelectionDataSchema,fl as Step5SemrushKeywordSelectionItemSchema,Ax as Step5SemrushKeywordSelectionRequestSchema,wx as Step5SemrushKeywordSelectionResponseSchema,ll as Step5SemrushRecommendationSeedSchema,_l as Step5SemrushRecommendationSnapshotSchema,ml as Step5SemrushRecommendationStatusSchema,Sa as Step5SemrushSearchIntentSchema,gl as Step5SemrushSelectionSummarySchema,Tl as Step5SemrushSnapshotRefSchema,fa as Step5SeoGeoPlanRowSchema,En as Step5SeoKeywordSchema,kl as Step5SeoPayloadV2InputSchema,bs as Step5SeoPayloadV2Schema,Wf as Step5SitemapDecisionSchema,Hf as Step5SitemapRunInputSchema,Vf as Step5SitemapSourceSchema,kv as Step5SitemapStartRequestSchema,Cx as Step5StartStrategyRequestSchema,Dx as Step5StartStrategyResponseSchema,vl as Step5StrategyDecisionInputSchema,ys as Step5StrategyDecisionSchema,fs as Step5StrategyItemSchema,xa as Step5StrategyJobSchema,xn as Step5StrategyKeySchema,ht as Step5StrategyOptionIdSchema,gs as Step5StrategyOptionSchema,rl as Step5StrategyPlanSchema,Ol as Step5StrategySnapshotDataSchema,Fx as Step5StrategySseFrameSchema,Dl as Step5StrategyVersionSnapshotSchema,E_ as Step6AiThemeCandidateSchema,zn as Step6ColorSeedsSchema,G1 as Step6DesignRecommendationGenerationInputSchema,K1 as Step6DesignRecommendationModelOutputSchema,I_ as Step6DesignRecommendationSchema,M1 as Step6DesignRecommendationsRequestSchema,U1 as Step6DesignRecommendationsResponseSchema,Rr as Step6DesignSelectionSchema,Ir as Step6GeneratedThemeCardSchema,WP as StreamSitePublishWorkflowRequestSchema,nk as SubsiteGlossariesSchema,kg as SubsiteGlossaryEntrySchema,Fn as SubsiteHexColorSchema,bk as SubsiteMountPathSchema,ik as SubsitePaletteLocalizationSchema,Pg as SubsitePaletteModeSchema,Ag as SubsitePaletteSeedsSchema,sk as SubsiteSiteInfoSchema,mk as SubsiteSyncDiffComputeRequestSchema,lk as SubsiteSyncDiffComputeResponseSchema,Dg as SubsiteSyncDiffErrorCodeSchema,pk as SubsiteSyncDiffErrorResponseSchema,_k as SubsiteVisibleTextExportRequestSchema,hk as SubsiteVisibleTextExportResponseSchema,ud as TASK_EXECUTION_STATUSES,wo as TASK_EXECUTION_STATUS_CODES,zw as TEMPLATE_UPGRADE_LOCK_LOST_ERROR_CODE,ci as THEME_PRESETS,Sr as THEME_PRESET_IDS,To as TaskExecutionStatusSchema,Bg as TemplateUpgradeCasOutcomeSchema,er as TemplateUpgradeErrorCodeSchema,Wg as TemplateUpgradeOutcomeCountsSchema,Kg as TemplateUpgradeOutcomeSchema,Vg as TemplateUpgradeSnapshotDeletionCandidateSchema,yt as TemplateUpgradeStateSchema,Ug as TemplateUpgradeStatusSchema,zg as TemplateUpgradeValidationStageSchema,De as TemplateVersionSchema,Fw as TryAcquireTemplateUpgradeLockRequestSchema,qw as TryAcquireTemplateUpgradeLockResponseSchema,kc as UnsplashDownloadLocationSchema,Tc as UnsplashMediaAssetSchema,dw as UpdateBriefRequestSchema,kw as UpdateBriefResponseSchema,Mv as UpdateClarifyArchetypeRequestSchema,Dw as UpdateCurrentSnapshotManifestRequestSchema,cE as UpdatePageDirectoryReconcileStateRequestSchema,VP as UpdateSitePublishWorkflowStepRequestSchema,pw as UpdateSiteRequestSchema,vI as UpdateSiteWorkflowWebsiteRequestSchema,F1 as UpdateStep6DesignSelectionRequestSchema,q1 as UpdateStep6DesignSelectionResponseSchema,OI as UpdateWorkflowTaskStatusRequestSchema,FS as UploadMediaLibraryAssetResponseSchema,OP as UpstreamPromptTemplateCatalogDataSchema,jP as UpstreamPromptTemplateConsumeDataSchema,Ih as UrlListCrawlerTaskCreateRequestSchema,Jb as UsageRecordIdSchema,KS as UseUnsplashMediaRequestSchema,zS as UseUnsplashMediaResponseSchema,ss as UserIdSchema,TS as VCP_GSC_STATES,ki as VcpGscStateSchema,_S as VcpQualityResultSchema,Ci as VisualHintsSchema,mf as VisualThemeSchema,kI as WORKFLOW_DEFINITIONS_V1,Fs as WORKFLOW_DEFINITION_REGISTRY,ld as WORKFLOW_FLOW_TYPES,fd as WORKFLOW_MENU_STATES,pd as WORKFLOW_NODE_CODES,dd as WORKFLOW_TASK_TYPES,sC as WORKSPACE_WEBSOCKET_CONTRACT,Io as WorkflowClientCapabilitiesSchema,vo as WorkflowDefinitionVersionSchema,An as WorkflowFlowTypeSchema,Rd as WorkflowMenuItemSchema,bd as WorkflowMenuStateSchema,zt as WorkflowNodeCodeSchema,Ro as WorkflowTaskTypeSchema,Ib as WorkspaceClientMessageSchema,WS as WorkspaceDesignApplyRequestSchema,VS as WorkspaceDesignApplyResponseSchema,Ki as WorkspaceDiagnosticSchema,Db as WorkspaceDirectEditFileSchema,Cb as WorkspaceDirectEditPathSchema,um as WorkspaceDirectEditPostActionSchema,oC as WorkspaceDirectEditRequestSchema,cC as WorkspaceDirectEditResponseSchema,zi as WorkspaceExecutionDiagnosticsSchema,qv as WorkspaceExecutionPlanSchema,vb as WorkspaceMediaRequestSchema,Vi as WorkspacePlanDependencySchema,am as WorkspacePlanSummarySchema,ob as WorkspacePlanTaskKindSchema,Wi as WorkspacePlanTaskSchema,ad as WorkspaceResourceKindSchema,rd as WorkspaceResourceNavigationSelectionSchema,Eo as WorkspaceResourceOperationClientMessageSchema,od as WorkspaceResourceOperationSummarySchema,cd as WorkspaceResourceOperationTransientInputSchema,ns as WorkspaceRunKindSchema,Eb as WorkspaceSelectedComponentSchema,Tb as WorkspaceServerMessageSchema,Rv as WorkspaceSitemapEditRequestSchema,xb as WorkspaceSocketDescriptorSchema,Ub as WorkspaceSourceFileBinaryResponseSchema,Lb as WorkspaceSourceFileKindSchema,_m as WorkspaceSourceFileListItemSchema,mC as WorkspaceSourceFilePathQuerySchema,lC as WorkspaceSourceFileResponseSchema,Mb as WorkspaceSourceFileTextResponseSchema,gm as WorkspaceSourcePathSchema,eb as WorkspaceSuggestionSchema,sm as WorkspaceSuggestionsSchema,tb as WorkspaceSuggestionsSourceSchema,om as WorkspaceTaskCountsSchema,nC as WorkspaceWebSocketMessageSchema,tC as WorkspaceWebSocketMessageTypeSchema,Bi as WorkspaceWorkerGroupSchema,Gi as WorkspaceWorkerPhaseSchema,Gv as WorkspaceWorkerResultSchema,dt as WorkspaceWorkerStatusSchema,kR as assertDeploymentTransition,KI as assertSiteBuildStatusTransition,GI as assertTaskExecutionStatusTransition,PA as buildE2bBrowserPreviewUrl,z1 as buildStep6FallbackThemeCards,yi as canonicalizeFormDesignJson,NP as canonicalizeLauncherPromptTemplateOperation,eo as canonicalizePageSlug,Kx as compareTemplateVersions,pT as composeSiteEditRepeatInstanceKey,w0 as computeFormDesignOperationFingerprint,ms as computeSiteEditCompositionKey,Rp as computeSiteEditSourceIdentityKey,ln as containsSensitiveData,xp as createSiteEditCommandFailureSchema,to as createSiteEditCommandResultSchema,vs as createSiteEditCommandSuccessSchema,W1 as defaultStep6Selection,AS as deriveVcpGscState,wS as doesGscPropertyMatchDomain,vd as findWorkflowDefinition,wd as findWorkflowDefinitionInRegistry,si as fontStack,ch as formDesignOperationFingerprintInput,PR as getDeploymentHappyPathTransitions,RR as getDeploymentTransitionPredecessors,IR as getDeploymentTransitionTargets,ur as getFontPairing,hr as getMotionPreset,yr as getSiteDesignThemeRadius,ds as getSiteEditSourceDeleteProtectionReason,k1 as getThemePreset,Cd as getWorkflowDefinition,FI as getWorkflowNodeIndex,ay as hasAnyBusinessFact,ok as hasLockedSeeds,A0 as hashAffectedFormDesignFiles,P0 as hashCmsFormSchemaProjection,Vn as hashFormDesignJson,k0 as hashFormSpec,Qa as isCanonicalPageSlug,Xg as isCmsMainProductsWithinLimit,Ny as isConsentGranted,Pu as isDeploymentActiveStatus,TR as isDeploymentTerminalStatus,xg as isExactEditEngineVersion,yy as isExternalSiteEditInfrastructureReason,p0 as isFormSpecLocalizableFieldPath,Ux as isKnownStep5SseEventName,GR as isMigrationProductsPresetBlockLabel,qR as isMigrationProductsPresetPageTitle,yx as isNonLatinSiteLocale,K0 as isPlatformMaterializedFile,Mg as isReservedSubsiteMountSegment,Kl as isSiteEditMaterializationPathTemplate,Sg as isSiteEditRuntimeContainerTag,fg as isSiteEditRuntimeTextTag,MT as isSiteEditRuntimeVoidElementTag,gx as isSiteEditSourceDeleteProtectedPath,$m as isSiteEditSourceDirectoryPath,ra as isSiteEditSourcePath,ps as isSiteEditTextSourcePath,M0 as isSiteStructureKnownFieldPath,L0 as isSiteStructureLocalizableFieldPath,qI as isWorkflowTaskTypeForNode,Hu as makeSiteEditRepeatInstanceKey,FR as migrationProductsCopyForLocale,$0 as normalizeCmsPublicApiBase,Cr as normalizeFormOptionLabelIdentity,mn as normalizeGscDomain,Ea as normalizeStep5SeoKeyword,bp as pageSlugToRouteFilePath,nE as parseCmsPageDirectory,CR as parseComponentI18nResourcesJson,vS as parseE2bPreviewProxyDomain,Eg as parseExactEditEngineVersion,sx as parseSiteEditCompositionKey,$u as parseSiteEditRepeatInstanceKey,KE as parseSiteEditSourceIdentityKey,S0 as projectFormSpecToCmsSchema,CS as reconcileSitemapNavigation,c_ as resolveFont,l_ as resolveFontDisplayName,h0 as resolveFormTemplateText,UI as resolvePublishedWorkflowDefinition,hy as resolveRedisConnectionConfig,QT as resolveRequestedEditEngineVersion,da as resolveSelectableSiteLocale,UT as resolveSiteEditRuntimeOperationSummary,bx as resolveSiteLocaleFromIso6393,fx as resolveSiteTextDirection,R_ as resolveStep6RadiusId,JT as resolveSystemCurrentEditEngineVersion,Dd as selectPublishedWorkflowDefinition,Ky as selectReferenceVisualImage,fI as siteBuildStatusFromCode,EI as siteBuildStatusToCode,bI as siteDeploymentStatusFromCode,II as siteDeploymentStatusToCode,h_ as siteFontVariables,yI as siteWorkflowStatusFromCode,RI as siteWorkflowStatusToCode,Tg as splitSubsiteGlossaryEntry,dT as stripSiteEditRepeatInstanceKeys,xI as taskExecutionStatusFromCode,TI as taskExecutionStatusToCode,B1 as toStep6GenerationVisualHints,Ja as tryCanonicalizeAsciiPageSlug,zo as validateComponentI18nResources,d0 as validateFormSpecIdentityTransition};
|