@vcp-dev/contracts 0.10.5 → 0.10.6
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 +1 -1
- package/dist/site-edit-version.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as t}from"zod";import{z as ie}from"zod";import{z as Z}from"zod";import{z as Jl}from"zod";var V=Jl.uuidv7(),cR=V,mR=V,lR=V,pR=V,dR=V,uR=V,_R=V,T=V,Dt=V,$a=V,Ae=V,Bs=V,k=V,Ya=V,K=V,Xa=V,He=V,Ln=V,Je=V,gR=V,hR=V,Qa=V,Ve=V,Za=V,SR=V,fR=V,bR=V,xt=V,yR=V,xR=V,ER=V;var Ja=V,Hs=Z.enum(["external_site_edit","page_template_create"]),ep=200,Et=Z.string().min(1).max(ep),tp=4e3,eo=Z.enum(["succeeded","degraded","no_changes","failed"]),Qt=Z.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"]),np=["sandbox_unavailable"];function kR(e){return e!=null&&np.includes(e)}var sp=Z.enum(["pending","delivered","failed"]),ip=Z.enum(["running","succeeded","degraded","no_changes","failed"]),AR=Z.object({site_id:T,external_run_id:Et,external_thread_id:Et,prompt:Z.string().min(1).max(tp),thread_title:Z.string().trim().min(1).max(200).optional()}).strict(),Mn=Z.object({id:Ja,execution_scene:Hs.default("external_site_edit"),site_id:T,external_run_id:Z.string().min(1).nullable(),external_thread_id:Z.string().min(1).nullable(),status:ip,outcome:eo.nullable(),degraded_reason:Qt.nullable(),vcp_run_id:K.nullable(),vcp_thread_id:He.nullable(),base_snapshot_id:k,snapshot_id:k.nullable(),preview_url:Z.string().url().nullable(),summary:Z.string().nullable(),error_code:Z.string().nullable(),build_verified:Z.boolean().nullable(),callback_status:sp.nullable(),created_at:Z.string().min(1),started_at:Z.string().min(1).nullable(),finished_at:Z.string().min(1).nullable()}).strict().superRefine((e,n)=>{e.execution_scene==="page_template_create"?((e.external_run_id===null!=(e.external_thread_id===null)||e.callback_status!==null)&&n.addIssue({code:"custom",message:"Page Template tasks require paired external identities and no callback"}),(!["running","succeeded","failed"].includes(e.status)||e.outcome!==null&&!["succeeded","failed"].includes(e.outcome)||e.degraded_reason!==null)&&n.addIssue({code:"custom",message:"Page Template tasks require strict whole-batch outcomes"})):(!e.external_run_id||!e.external_thread_id||!e.callback_status)&&n.addIssue({code:"custom",message:"External edit tasks require external identity and callback status"})}),PR=Z.object({task:Mn}).strict(),wR=Z.object({task:Mn}).strict(),CR=Z.object({task_id:Ja,external_run_id:Z.string().min(1),external_thread_id:Z.string().min(1),site_id:T,vcp_run_id:K.nullable(),outcome:eo,degraded_reason:Qt.nullable(),snapshot_id:k.nullable(),preview_url:Z.string().url().nullable(),summary:Z.string().nullable(),error_code:Z.string().nullable(),build_verified:Z.boolean().nullable(),retryable:Z.boolean(),finished_at:Z.string().min(1)}).strict(),vR=Z.object({received:Z.literal(!0)}).strict();var Ge=ie.string().min(1).max(191).refine(e=>{if(/[^\x20-\x7e\xa0-\xff]/.test(e)||e.startsWith(" ")||e.endsWith(" ")||new TextEncoder().encode(e).length>191)return!1;try{return new Headers({"x-template-id":e}).get("x-template-id")===e}catch{return!1}},{message:"template_id must round-trip through HTTP headers and fit a 255-byte base64url filename"}),Zt=ie.string().min(1).refine(e=>e.startsWith("/")&&!e.startsWith("//")&&!/[?#\\\x00-\x20\x7f]/.test(e)&&!e.startsWith("/.vcp")&&!e.split("/").some(n=>{try{let s=decodeURIComponent(n);return s==="."||s===".."||/[/\\\x00-\x1f\x7f]/.test(s)||s.startsWith(".vcp")}catch{return!0}}),{message:"page_path must start with / and must not contain ? or #"});function Un(e){let n=/^(?:src\/)?app\/\.vcp\/page-templates\/(.+)\/page\.tsx$/.exec(e);if(!n)return!1;let s=n[1].split("/"),a=s.pop();if(!/^[A-Za-z0-9_-]{1,255}$/.test(a)||!Zt.safeParse(`/${s.join("/")}`).success||s.some(i=>!i||/[\[\]()%]/.test(i)||i.startsWith("_")||i.startsWith("@")))return!1;try{let i=atob(a.replace(/-/g,"+").replace(/_/g,"/")),r=Uint8Array.from(i,c=>c.charCodeAt(0)),m=new TextDecoder("utf-8",{fatal:!0}).decode(r);return Ge.safeParse(m).success&&btoa(String.fromCharCode(...new TextEncoder().encode(m))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")===a}catch{return!1}}var to=ie.object({page_path:Zt,template_id:Ge,instruction:ie.string().min(1).refine(e=>e.trim().length>0)}).strict(),no=3;function so(e){return e.replace(/\/+$/,"")||"/"}var LR=ie.object({external_run_id:Et,external_thread_id:Et,items:ie.array(to).min(1).max(no)}).strict().transform(e=>({external_run_id:e.external_run_id,external_thread_id:e.external_thread_id,items:e.items.map(n=>({...n,page_path:so(n.page_path)}))})).superRefine((e,n)=>{let s=new Set;e.items.forEach((a,i)=>{let r=JSON.stringify([a.page_path,a.template_id]);s.has(r)&&n.addIssue({code:"custom",path:["items",i],message:"Duplicate normalized page_path/template_id identity"}),s.add(r)})}),io=ie.object({items:ie.array(to).min(1).max(no)}).strict().refine(e=>e.items.every(n=>n.page_path===so(n.page_path))&&new Set(e.items.map(n=>JSON.stringify([n.page_path,n.template_id]))).size===e.items.length,{message:"Batch Manifest must contain unique normalized identities"}),ao=e=>[...new Set(e)],MR=ie.object({page_path:Zt,template_id:Ge,exit_template_ids:ie.array(Ge).default([]).transform(ao)}).strict().refine(e=>!e.exit_template_ids.includes(e.template_id),{path:["exit_template_ids"],message:"exit_template_ids must not contain the promoted template"}),UR=ie.object({page_path:Zt,template_ids:ie.array(Ge).min(1).transform(ao)}).strict(),oo={ok:ie.literal(!0),site_id:T,page_path:Zt,route_id:ie.string().min(1),snapshot_id:k},ap=Mn.safeExtend({execution_scene:ie.literal("page_template_create"),external_run_id:Et,external_thread_id:Et,callback_status:ie.null(),status:ie.enum(["running","succeeded","failed"]),outcome:ie.enum(["succeeded","failed"]).nullable(),degraded_reason:ie.null()}),qR=ie.object({task:ap}).strict(),FR=ie.object({...oo,promoted_template_id:Ge,deleted_template_ids:ie.array(Ge),status:ie.literal("promoted")}).strict(),GR=ie.object({...oo,deleted_template_ids:ie.array(Ge),status:ie.literal("cleaned")}).strict(),KR=ie.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_SNAPSHOT_CONFLICT","PAGE_TEMPLATE_DYNAMIC_ROUTE_UNSUPPORTED","PAGE_TEMPLATE_SOURCE_UNSUPPORTED","PAGE_TEMPLATE_GENERATION_FAILED","PAGE_TEMPLATE_PATCH_FAILED"]);import{z as qn}from"zod";var ro=qn.object({primary_products:qn.string().trim().min(1).max(1e3).optional(),current_markets:qn.string().trim().min(1).max(1e3).optional(),qualifications:qn.string().trim().min(1).max(1e3).optional()}).strict();function BR(e){return Object.values(e).some(n=>typeof n=="string"&&n.trim().length>0)}import{z as Jt}from"zod";import{z as Vs}from"zod";var M=e=>Vs.object({code:Vs.number().int(),data:e,message:Vs.string()});var Ot=2e3,op=Jt.object({note:Jt.string().trim().max(Ot),updated_at:Jt.string().min(1)}).strict(),QR=Jt.object({note:Jt.string().trim().max(Ot)}).strict(),ZR=M(op.nullable());import{z as en}from"zod";var rp=40,Rt=en.object({protocol:en.enum(["phone","form","download","route","external"]),ctaLabel:en.string().min(1).max(rp),ctaTarget:en.string().min(1).max(200).optional(),requiresOwnerDetail:en.boolean().optional()});var jt=["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 nI(e){let n=e.VCP_REDIS_URL??e.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:e.VCP_REDIS_HOST??"127.0.0.1",port:cp(e.VCP_REDIS_PORT,56379)}}function cp(e,n){if(!e)return n;let s=Number(e);return Number.isInteger(s)&&s>0?s:n}import{z as te}from"zod";var mp=te.enum(["component","page","shared"]),lp=te.enum(["generation_failed","repair_exhausted","page_unusable","check_incomplete","design_missing","chrome_fallback","style_fallback","resume_exhausted","user_stopped","conflict"]),co=te.object({kind:mp,target_id:te.string().min(1),page_id:te.string().min(1).nullable(),reason:lp,repair_attempts:te.number().int().nonnegative(),message:te.string().min(1),filled:te.boolean().optional()}).strict(),pp=te.enum(["complete","partial","omitted","check_incomplete","pending"]),dp=te.object({page_id:te.string().min(1),slug:te.string().min(1),title:te.string().min(1),parent_page_id:te.string().min(1).nullable(),result:pp,attempts:te.number().int().nonnegative(),omissions:te.array(co)}).strict(),tn=te.object({schema_version:te.literal(1),sitemap_id:te.string().min(1),confirmed_page_ids:te.array(te.string().min(1)).min(1),pages:te.array(dp),shared:te.array(co),stopped_by_user:te.boolean(),resume_count:te.number().int().nonnegative(),home_replaced_by:te.string().min(1).nullable(),updated_at:te.string().min(1)}).strict(),mo=te.object({type:te.literal("workspace.generation_ledger"),ledger:tn,at:te.string().min(1)}).strict();function aI(e){return e.pages.filter(n=>n.result==="complete"||n.result==="partial").length}function oI(e){return e.pages.filter(n=>n.result==="complete"||n.result==="partial"||n.omissions.some(s=>s.kind==="page")).length}import{z as j}from"zod";var $s=j.enum(["text","url","document","image"]),Ys=j.enum(["pending","ready","failed"]),up=j.enum(["pending","ready","failed"]),_p=j.enum(["product","price","contact","copy","audience","other"]),Fn=j.object({fact:j.string().min(1).max(300),kind:_p,source_id:xt,quote:j.string().min(1).max(500),trust:j.enum(["verbatim","ocr"]).default("verbatim")}),gp=j.object({page_type:j.string().min(1).max(40),sections:j.array(j.string().min(1).max(40)).max(12)}),Gn=j.object({source_id:xt,nav_structure:j.array(j.string().min(1).max(30)).max(12),page_patterns:j.array(gp).max(10),tone:j.array(j.string().min(1).max(20)).max(8),screenshot_ref:j.string().optional()}),hp=j.object({source_id:xt,type:$s,status:Ys,title:j.string().max(120).optional(),original_ref:j.string().min(1),source_metadata:j.record(j.string(),j.unknown()),error_code:j.string().optional(),submitted:j.boolean().optional()}),Kn=j.object({topic:j.string().min(1).max(80),variants:j.array(j.object({value:j.string().min(1).max(300),source_id:xt})).min(2)}),Sp=j.object({type:j.literal("text"),content:j.string().min(20).max(1e4),title:j.string().min(1).max(120).optional()}).strict(),fp=j.object({type:j.literal("url"),url:j.string().url().max(2048),rights_ack:j.boolean().optional(),title:j.string().min(1).max(120).optional()}).strict(),lI=j.discriminatedUnion("type",[Sp,fp]),pI=[".docx",".html",".md",".txt"],dI=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],uI=10*1024*1024,_I=2,gI=j.object({consent_cross_border:j.union([j.literal(!0),j.literal("true")]),consent_text_version:j.string().min(1).max(120),title:j.string().min(1).max(120).optional()}).strict();function hI(e){return e===!0||e==="true"}var SI=[".png",".jpg",".jpeg",".webp"],fI=["image/png","image/jpeg","image/webp","application/octet-stream"],bI=8*1024*1024,yI=10,bp=j.enum(["asset","reference"]),xI=j.object({image_role:bp,title:j.string().min(1).max(120).optional()}).strict(),EI=j.object({version:j.literal(1),site_id:T,tenant_id:j.string().min(1),user_prompt:j.string(),status:up,sources:j.array(hp).max(16),facts:j.array(Fn).max(120),reference:Gn.optional(),conflicts:j.array(Kn).max(20)}).superRefine((e,n)=>{let s=new Map(e.sources.map(a=>[a.source_id,a]));for(let[a,i]of e.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(e.reference){let a=s.get(e.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 RI(e){for(let n of e.sources)if(n.type==="image"&&n.status==="ready"&&n.source_metadata?.image_role==="reference")return{source_id:n.source_id};return e.reference?.screenshot_ref?{source_id:e.reference.source_id}:null}import{z as D}from"zod";import{z as Wn}from"zod";var ce=Wn.object({routeId:Wn.string().min(1),templateId:Ge.optional()}).strict(),q=Wn.object({routeId:Wn.string().min(1),effectiveTemplateId:Ge.optional()}).strict();function Xs(e){return JSON.stringify([e.routeId,e.effectiveTemplateId??null])}function AI(e){let n;try{n=JSON.parse(e)}catch{return null}if(!Array.isArray(n)||n.length!==2)return null;let[s,a]=n,i=q.safeParse(a===null?{routeId:s}:{routeId:s,effectiveTemplateId:a});return i.success?i.data:null}var yp=["design.md","DESIGN.md"],lo=["components/site","src/components/site","lib/generated","src/lib/generated","public"],xp=["app/globals.css","src/app/globals.css"],Ep=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],Rp=new Set(Ep),Qs="source-delete",po=D.literal(Qs),Se=D.string().min(1).refine(_o,"Invalid site edit source path"),Ip=D.string().min(1).refine(Dp,"Invalid site edit source directory path"),DI=D.enum(["text","binary"]),zn=D.object({composition:q,path:Se,language:D.string().min(1).nullable(),sizeBytes:D.number().int().nonnegative(),contentHash:D.string().min(1).optional()}).strict(),Tp=D.discriminatedUnion("kind",[zn.extend({kind:D.literal("text"),language:D.string().min(1),readonly:D.boolean().default(!1)}),zn.extend({kind:D.literal("binary"),language:D.null(),mimeType:D.string().min(1).optional(),readonly:D.literal(!0)})]),uo=D.lazy(()=>D.discriminatedUnion("kind",[D.object({kind:D.literal("directory"),name:D.string().min(1),path:Ip,children:D.array(uo)}),D.object({kind:D.literal("file"),name:D.string().min(1),path:Se,file:Tp}).superRefine((e,n)=>{e.path!==e.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),kp=D.enum(["max-files","max-depth","max-total-bytes"]),Ap=D.object({reasons:D.array(kp).min(1),maxFiles:D.number().int().positive(),maxDepth:D.number().int().positive(),maxTotalBytes:D.number().int().positive()}),OI=D.object({composition:q,nodes:D.array(uo),defaultPath:Se.optional(),totalFiles:D.number().int().nonnegative(),truncated:Ap.optional()}).strict(),jI=D.object({composition:ce}).strict(),NI=D.object({path:Se,composition:ce}).strict(),Pp=zn.extend({kind:D.literal("text"),language:D.string().min(1),readonly:D.boolean().default(!1),content:D.string()}),wp=D.enum(["too-large","unsupported-mime","bytes-unavailable"]),Cp=zn.extend({kind:D.literal("binary"),language:D.null(),readonly:D.literal(!0),mimeType:D.string().min(1),contentBase64:D.string().min(1).optional(),previewUnavailableReason:wp.optional()}),LI=D.discriminatedUnion("kind",[Pp,Cp]),MI=D.object({key:D.string().min(1),composition:ce}).strict(),vp=D.object({startLine:D.number().int().positive(),startColumn:D.number().int().nonnegative(),endLine:D.number().int().positive(),endColumn:D.number().int().nonnegative()}),UI=D.object({key:D.string().min(1),composition:q,sourceFile:Se,componentName:D.string().min(1),openingElementRange:vp,structuralPath:D.string().min(1),textPreview:D.string().min(1).optional()}).strict();function _o(e){return!Bn(e)&&!jp(e)||So(e)?!1:ei(e)||ho(e)||go(e)||lo.some(n=>e===n||e.startsWith(`${n}/`))}function Zs(e){return ei(e)||Rp.has(Lp(e))}function Dp(e){return!Bn(e)&&!Np(e)||So(e)?!1:e==="app"||e.startsWith("app/")||e==="src"||e==="src/app"||e.startsWith("src/app/")||lo.some(n=>e===n||e.startsWith(`${n}/`)||n.startsWith(`${e}/`))}function Op(e){return ei(e)}function Js(e){return _o(e)?Op(e)?"design-document":go(e)?"route-entry":ho(e)?"app-global-style":e.toLowerCase()==="lib/generated/media-assets.ts"||e.toLowerCase()==="src/lib/generated/media-assets.ts"?"generated-media-manifest":null:null}function qI(e){return Js(e)!==null}function go(e){return/^(?:src\/)?app\/(?:.*\/)?page\.[cm]?[jt]sx?$/.test(e.toLowerCase())}function jp(e){return Un(e)&&Bn(e.replace("/.vcp/","/_vcp/"))}function Np(e){return/^(?:src\/)?app\/\.vcp(?:\/page-templates(?:\/.+)?)?$/i.test(e)?Bn(e.replace("/.vcp","/_vcp")):!1}function ho(e){return xp.some(n=>n.toLowerCase()===e.toLowerCase())}function Lp(e){let n=e.split("/").at(-1)??e,s=n.lastIndexOf(".");return s>0?n.slice(s).toLowerCase():""}function ei(e){return!e.includes("/")&&yp.some(n=>n.toLowerCase()===e.toLowerCase())}function So(e){let n=e.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 Bn(e){return!e||e.startsWith("/")||e.includes("\\")?!1:e.split("/").every(n=>!(n.length===0||n==="."||n===".."||n.startsWith(".")||n==="package.json"||n==="node_modules"||n==="recipes"||n.startsWith(".env")))}import{z as Mp}from"zod";var nn=["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"],Up=["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"],qp=[...nn,...Up],Fp=new Set(["ar","fa","he"]),KI=[{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"}],Gp={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"},Kp=new Set(nn);function fo(e){return Kp.has(e)?e:Gp[e]}var Wp="en";function WI(e){let n=e.toLowerCase().split("-",1)[0]??"";return Fp.has(n)?"rtl":"ltr"}var zp={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 zI(e){return zp[e]??Wp}var Bp=["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"],Hp=new Set(Bp);function BI(e){return Hp.has(e)}var fe=Mp.enum(qp);import{z as Vp}from"zod";var bo=Vp.string().uuid();import{z as o}from"zod";import{z as Y}from"zod";var mt=Y.string().trim().min(1).max(128),Nt=Y.string().trim().min(1).max(500),$p=["\u4EA7\u54C1","\u90E8\u4EF6/\u8017\u6750","\u5E94\u7528\u65B9\u6848","\u5B9A\u5236/OEM","\u670D\u52A1","\u8D44\u8D28/\u80FD\u529B"],Yp=Y.enum($p),sn=Y.object({id:mt,keyword:Y.string().trim().min(1).max(255),business_id:mt,business_name:Y.string().trim().min(1).max(255),category:Yp,selling_points:Y.string().trim().max(2e3),section_id:mt,content_usage:Y.enum(["product","category","solution","service","capability","article","faq"]),intent:Nt,semantic_group:mt,primary_business:Y.boolean(),monthly_volume:Y.number().int().min(1),keyword_difficulty:Y.number().min(0).max(100).nullable(),variants:Y.array(Y.string().trim().min(1).max(255)),source:Y.literal("semrush"),source_evidence:Y.array(Nt).min(1)}).strict(),ti=Y.object({schema_version:Y.literal(1),snapshot_id:mt,dependency_hash:Y.string().regex(/^[a-f0-9]{64}$/),language:Y.string().trim().min(2).max(35),database:Y.string().regex(/^[a-z]{2}$/),generated_at:Y.string().datetime({offset:!0}),entries:Y.array(sn),candidates:Y.array(sn),search_result_ids:Y.array(mt).optional()}).strict().superRefine((e,n)=>{for(let s of["entries","candidates"]){let a=e[s];(new Set(a.map(i=>i.id)).size!==a.length||new Set(a.map(i=>i.keyword.normalize("NFKC").trim().toLowerCase())).size!==a.length)&&n.addIssue({code:"custom",path:[s],message:"\u5173\u952E\u8BCD\u4E0D\u80FD\u91CD\u590D"})}}),Hn=Y.object({snapshot_id:mt,entry_ids:Y.array(mt).min(1)}).strict().superRefine((e,n)=>{new Set(e.entry_ids).size!==e.entry_ids.length&&n.addIssue({code:"custom",path:["entry_ids"],message:"\u5173\u952E\u8BCD\u4E0D\u80FD\u91CD\u590D"})}),XI=Y.object({expected_revision:Y.number().int().nonnegative(),business_subject:Y.string().trim().min(1).max(255)}).strict(),yo=Y.object({points:Y.array(Nt).length(3),comparison:Y.array(Y.object({dimension:Nt,recommended:Nt,alternative:Nt}).strict()).min(1).max(4)}).strict();var ue=o.string().trim().min(1).max(128),lt=o.string().trim().min(1).max(200),Ke=o.string().trim().min(1).max(2e3),ni=o.string().trim().max(200),an=o.string().regex(/^[a-f0-9]{64}$/),si=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","keywords","risk"],ve=It.length,Xp=["keywords"],on=It.filter(e=>!Xp.includes(e)),Yn=on.length,ii=o.enum(It);function tT(e){return on.some(n=>n===e)}var Xn=o.enum([...It,"seogeo","content","conversion"]),Ro=["recommended","conservative","focused"],Io=o.enum(Ro),rn=o.union([Io,o.literal("confirmed")]),Qn=o.enum(["single_country","regional_combination","multi_market"]),Zn=o.object({code:o.string().trim().regex(/^[A-Z]{2}$/),name_zh:lt,name_en:lt,region:lt}).strict(),Qp=o.object({id:Io,presentation:yo.nullish(),sections:o.array(o.object({id:o.string().trim().min(1).max(128),label:o.string().trim().min(1).max(200)}).strict()).max(30).optional(),label:lt,note:Ke,impact:o.string().trim().max(500).nullish(),set_value:o.string().trim().max(500).nullish(),site_locale:fe.nullish(),market_type:Qn.nullish(),markets:o.array(Zn).max(32).optional()}).loose(),Zp=o.object({lead:o.string().trim().min(1).max(500),title:lt,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((e,n)=>{e.rows.forEach((s,a)=>{s.length!==e.columns.length&&n.addIssue({code:"custom",path:["rows",a],message:"Each Step5 plan row must match the column count."})})}),Jp=o.object({goal:Ke,issue:Ke,criteria:o.array(Ke).min(1).max(12),resources:o.array(Ke).min(1).max(12),risks:o.array(Ke).min(1).max(12),execution:o.object({standard:o.array(Ke).min(1).max(12),acceptance:o.array(Ke).min(1).max(12),downstream:o.array(Ke).min(1).max(12)}).strict()}).strict(),ed=o.object({source_type:o.enum(["step2","step3"]),source_id:ue,field_path:o.string().trim().max(300).nullish()}).strict(),td=o.enum(["ready","disabled","empty","timeout","rate_limited","quota_exhausted","failed"]),nd=["INFORMATIONAL","NAVIGATIONAL","COMMERCIAL","TRANSACTIONAL"],To=o.enum(nd),Vn=50,$n=60,xo=7,nT=["COMMERCIAL","TRANSACTIONAL"],sd=["C","T"];function ko(e){return sd.includes(e)}var id=o.object({id:ue,term:o.string().trim().min(1).max(255),source_type:o.enum(["step2","step3","step5"]),source_id:ue,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(),ad=o.object({keyword:o.string().trim().min(1).max(255),normalized_keyword:o.string().trim().min(1).max(255),intents:o.array(To).min(1).max(4),search_volume:o.number().int().min(Vn),keyword_difficulty:o.number().min(0).max($n),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(),od=o.object({id:ue,intent:To,title:lt,landing_page_type:o.enum(["blog","product","category","landing"]),keywords:o.array(ad).min(1).max(100)}).strict(),rd=o.enum(["NO_SEEDS","NO_PROVIDER_CANDIDATES","NO_METRIC_ELIGIBLE_CANDIDATES","NO_COMMERCIAL_INTENT_CANDIDATES","NO_FIT_ELIGIBLE_CANDIDATES"]),cd=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((e,n)=>{let s=[e.fetched_count,e.unique_count,e.metric_gate_pass_count,e.commercial_intent_pass_count,e.fit_pass_count,e.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."})}),Eo={provider:o.literal("semrush"),api_version:o.literal("v4"),fetched_at:o.string().datetime({offset:!0}),context_hash:an,status:td,seeds:o.array(id).max(20),intent_groups:o.array(od).max(16),selection_summary:cd.optional(),empty_reason_code:rd.nullish(),error_code:o.string().trim().regex(/^[A-Z0-9_]+$/).max(64).nullish()},md=o.discriminatedUnion("schema_version",[o.object({schema_version:o.literal(1),...Eo,database:o.string().trim().regex(/^[A-Z]{2}$/),country:o.string().trim().regex(/^[A-Z]{2}$/)}).strict(),o.object({schema_version:o.literal(2),...Eo,database:o.string().trim().regex(/^[a-z]{2}$/),country:o.string().trim().regex(/^[A-Z]{2}$/)}).strict()]).superRefine((e,n)=>{if(e.schema_version===1&&e.database!==e.country&&n.addIssue({code:"custom",path:["database"],message:"Semrush database must match the ISO country code."}),e.status==="ready"&&e.intent_groups.length===0&&n.addIssue({code:"custom",path:["intent_groups"],message:"Ready Semrush recommendations require an intent group."}),e.status==="ready"&&e.error_code&&n.addIssue({code:"custom",path:["error_code"],message:"Ready Semrush recommendations cannot contain an error code."}),e.empty_reason_code&&e.status!=="empty"&&n.addIssue({code:"custom",path:["empty_reason_code"],message:"Semrush empty reason is only valid for an empty snapshot."}),e.selection_summary){let s=e.intent_groups.reduce((a,i)=>a+i.keywords.length,0);e.selection_summary.selected_count!==s&&n.addIssue({code:"custom",path:["selection_summary","selected_count"],message:"Semrush selected count must match the persisted keywords."})}}),Ao=0,ld=o.union([o.literal(Ao),o.literal(1)]),sT=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(Vn),max_keyword_difficulty:o.number().finite().min(0).max(100).default($n),min_relevance_score:ld.default(Ao)}).strict(),pd=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(),dd=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(pd).max(100),result_count:o.number().int().nonnegative()}).strict(),iT=o.object({code:o.literal(0),message:o.string(),data:dd}).strict(),aT=o.object({snapshot_id:o.string().uuid(),selected_keywords:o.array(o.string().trim().min(2).max(160)).min(1).max(50)}).strict(),ud=o.object({candidate_id:ue,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(),_d=o.object({selection_batch_id:ue,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(ud).max(50)}).strict().superRefine((e,n)=>{e.selected_count!==e.items.length&&n.addIssue({code:"custom",path:["selected_count"],message:"selected_count must equal items.length."})}),oT=o.object({code:o.literal(0),message:o.string(),data:_d}).strict(),gd=o.enum(["ok","degraded"]),hd=["category","selection","application","parameter","cost","trust","compliance","delivery"],Po=o.object({id:ue,question:o.string().trim().min(8).max(300).refine(e=>/^[\x20-\x7E]+$/.test(e)),question_type:o.enum(hd),intent_strength:o.enum(["high","medium","low"]),source:o.enum(["ai_generation","user_input"])}).strict(),Sd=Po.extend({source:o.literal("ai_generation")}).strict(),ai=o.object({key:Xn,position:o.number().int().min(1).max(11),category:lt,title:lt,summary:Ke,rationale:Ke,parameter:o.string().trim().max(500).nullish(),options:o.array(Qp).max(3),keyword_library:ti.nullish(),plan:Zp.nullish(),structure_detail:Jp.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(ed).min(1).max(8),semrush_recommendations:md.nullish(),seo_payload:o.lazy(()=>oi).nullish(),geo_questions:o.array(Sd).max(20).optional(),generation_status:gd.optional()}).loose().superRefine((e,n)=>{let s=It.indexOf(e.key)+1;s>0&&e.position!==s&&n.addIssue({code:"custom",path:["position"],message:`Step5 strategy ${e.key} uses an invalid position.`}),e.key!=="keywords"&&e.keyword_library&&n.addIssue({code:"custom",path:["keyword_library"],message:"Only the keywords card can carry an enterprise keyword library."}),e.options.length!==(e.key==="keywords"?0:3)&&n.addIssue({code:"custom",path:["options"],message:"Keywords use no options; ordinary cards require three options."}),e.key==="keywords"&&(e.note_tips.length||e.geo_questions?.length||e.seo_payload||e.semrush_recommendations)&&n.addIssue({code:"custom",message:"The enterprise keyword library cannot carry legacy SEO/GEO content."}),e.options.forEach((a,i)=>{a.id!==Ro[i]&&n.addIssue({code:"custom",path:["options",i,"id"],message:"Step5 strategy options must use the canonical order."})}),e.semrush_recommendations&&e.key!=="seogeo"&&n.addIssue({code:"custom",path:["semrush_recommendations"],message:"Semrush recommendations are only valid for the seogeo item."}),e.seo_payload&&e.key!=="seogeo"&&n.addIssue({code:"custom",path:["seo_payload"],message:"SEO payloads are only valid for the seogeo item."}),(e.geo_questions?.length??0)>0&&e.key!=="seogeo"&&n.addIssue({code:"custom",path:["geo_questions"],message:"GEO questions are only valid for the seogeo item."}),e.structure_detail&&e.key!=="structure"&&n.addIssue({code:"custom",path:["structure_detail"],message:"Structure detail is only valid for the structure item."}),e.geo_questions&&new Set(e.geo_questions.map(a=>a.question.trim().toLocaleLowerCase())).size!==e.geo_questions.length&&n.addIssue({code:"custom",path:["geo_questions"],message:"GEO citation questions must be unique."})}),wo=9,Co=o.object({id:ue,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(),fd=2,bd=0,rT=20,yd=50,vo=o.object({id:ue,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(),xd=vo.superRefine((e,n)=>{ko(e.intent_code)||n.addIssue({code:"custom",path:["intent_code"],message:"New legacy SEO keyword selections must use commercial or transactional intent."})}),Jn=o.object({id:ue,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((e,n)=>{let s=Oo(e.keyword);e.normalized_keyword!==s&&n.addIssue({code:"custom",path:["normalized_keyword"],message:"normalized_keyword must match the canonical keyword form."})}),Ed=o.object({request_id:o.string().trim().min(1).max(128),snapshot_id:ue,selected_keywords:o.array(o.string().trim().min(2).max(160)).min(1).max(50)}).strict(),oi=o.object({schema_version:o.literal(fd),seo_keywords:o.array(Jn).min(bd).max(yd),semrush_snapshot_refs:o.array(Ed).max(20).optional(),geo_questions:o.array(Po).max(20).optional()}).strict().superRefine(jd),Rd=oi.superRefine((e,n)=>{e.seo_keywords.forEach((s,a)=>{ko(s.intc)||n.addIssue({code:"custom",path:["seo_keywords",a,"intc"],message:"New SEO keyword selections must use commercial or transactional intent."})})}),Id=o.object({rows:o.array(Co).max(100).optional(),seo_keywords:o.array(vo).max(100).optional()}).strict(),Td=o.object({rows:o.array(Co).max(100).optional(),seo_keywords:o.array(xd).max(100).optional()}).strict(),kd=o.union([oi,Id]),Ad=o.union([Rd,Td]),Pd=o.object({item_key:ii,selected_option_id:rn,note:ni,custom_payload:Ad.optional(),keyword_selection:Hn.optional()}).strict().superRefine((e,n)=>{(e.custom_payload||(e.item_key==="keywords"?e.selected_option_id!=="confirmed"||e.note!==""||!e.keyword_selection:e.selected_option_id==="confirmed"||e.keyword_selection!==void 0))&&n.addIssue({code:"custom",message:"\u666E\u901A\u5361\u4EC5\u63A5\u53D7\u65B9\u6848\u4E0E\u5907\u6CE8\uFF1B\u4F01\u4E1A\u5173\u952E\u8BCD\u5E93\u4EC5\u63A5\u53D7\u5DF2\u751F\u6210\u5FEB\u7167\u4E2D\u7684\u5173\u952E\u8BCD ID"})}),ri=o.object({item_key:ii,selected_option_id:rn,note:ni,custom_payload:kd.optional(),keyword_selection:Hn.optional(),keyword_library:ti.optional(),market_type:Qn.nullish(),markets:o.array(Zn).max(32).optional(),selected_value:o.unknown().nullable(),accepted_at:o.string().datetime({offset:!0})}).loose(),wd=o.enum(["running","succeeded","failed"]),Cd=o.object({schema_version:o.literal(1),source_job_id:ue,site_id:ue,output_locale:si.optional(),items:o.array(ai).length(ve),decisions:o.array(ri).min(Yn).max(ve)}).loose(),vd=o.object({strategy_version_id:ue,site_id:ue,source_job_id:ue,output_locale:si.optional(),version:o.number().int().positive(),checksum:an,snapshot:Cd,committed_at:o.string().datetime({offset:!0})}).loose(),Do=o.object({job_id:ue,site_id:ue,output_locale:si.optional(),status:wd,keyword_library_needs_update:o.boolean().optional(),revision:o.number().int().nonnegative(),items:o.array(ai).max(ve),decisions:o.array(ri).max(ve),output_checksum:an.nullish(),error_code:o.string().trim().max(64).nullish(),error_message:o.string().trim().max(500).nullish(),committed_version:vd.nullish()}).loose().superRefine((e,n)=>{let s=e.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=e.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."})}),cT=o.object({force_refresh:o.boolean().optional().default(!1)}).strict(),mT=Do.extend({cached:o.boolean()}).strict(),lT=o.object({expected_revision:o.number().int().nonnegative()}).strict(),pT=o.object({expected_revision:o.number().int().nonnegative(),selected_option_id:rn,note:ni,keyword_selection:Hn.optional()}).strict().superRefine((e,n)=>{(e.selected_option_id==="confirmed"?!e.keyword_selection||e.note!=="":e.keyword_selection)&&n.addIssue({code:"custom",message:"\u4F01\u4E1A\u5173\u952E\u8BCD\u53EA\u63A5\u53D7\u5DF2\u751F\u6210\u6761\u76EE\u7684 ID\uFF1B\u666E\u901A\u7B56\u7565\u53EA\u63A5\u53D7\u65B9\u6848\u548C\u5907\u6CE8"})}),dT=o.object({revision:o.number().int().positive(),decision:ri}).strict(),uT=o.object({idempotency_key:o.string().trim().min(8).max(128),expected_revision:o.number().int().nonnegative(),decisions:o.array(Pd).min(Yn).max(ve)}).strict().superRefine((e,n)=>{let s=e.decisions.map(a=>a.item_key);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["decisions"],message:"Step5 commit decisions must use unique strategy keys."}),on.forEach(a=>{s.includes(a)||n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit is missing ${a}.`})})}),_T=o.object({strategy_version_id:ue,version:o.number().int().positive(),checksum:an,next_path:o.string().trim().min(1).max(500)}).strict(),Dd=Do.extend({completed:o.number().int().min(0).max(ve),total:o.literal(ve)}).loose(),Od=["snapshot","strategy_item_start","strategy_item_done","strategy_items_invalidated","strategy_generation_done","failed"];function gT(e){return typeof e=="string"&&Od.includes(e)}var hT=o.discriminatedUnion("event",[o.object({id:o.number().int().nonnegative(),event:o.literal("snapshot"),data:Dd}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_item_start"),data:o.object({key:ii,position:o.number().int().min(1).max(ve)}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_item_done"),data:o.object({item:ai}).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(ve)}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_generation_done"),data:o.object({item_count:o.literal(ve),schema_version:o.literal(1),checksum:an}).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 jd(e,n){let s=new Set;e.seo_keywords.forEach((r,m)=>{s.has(r.normalized_keyword)&&n.addIssue({code:"custom",path:["seo_keywords",m,"normalized_keyword"],message:"SEO keywords must be unique after Unicode normalization."}),s.add(r.normalized_keyword),(r.monthly_volume===null||r.monthly_volume<Vn)&&n.addIssue({code:"custom",path:["seo_keywords",m,"monthly_volume"],message:`Selected SEO keywords require monthly_volume >= ${Vn}.`}),(r.keyword_difficulty===null||r.keyword_difficulty>$n)&&n.addIssue({code:"custom",path:["seo_keywords",m,"keyword_difficulty"],message:`Selected SEO keywords require keyword_difficulty <= ${$n}.`}),(r.fit===null||r.fit<xo)&&n.addIssue({code:"custom",path:["seo_keywords",m,"fit"],message:`Selected SEO keywords require fit >= ${xo.toFixed(1)}.`})});let a=new Set((e.semrush_snapshot_refs??[]).flatMap(r=>r.selected_keywords.map(Oo)));e.seo_keywords.forEach((r,m)=>{r.source==="semrush"&&!a.has(r.normalized_keyword)&&n.addIssue({code:"custom",path:["seo_keywords",m,"source"],message:"Semrush keywords must reference a persisted Semrush snapshot selection."})});let i=(e.geo_questions??[]).map(r=>r.question.trim().toLocaleLowerCase());new Set(i).size!==i.length&&n.addIssue({code:"custom",path:["geo_questions"],message:"GEO citation questions must be unique."})}function Oo(e){return e.normalize("NFKC").trim().replace(/\s+/g," ").toLowerCase()}import{z as Nd}from"zod";var We=Nd.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 bT(e,n){let s=We.safeParse(e),a=We.safeParse(n);if(!s.success||!a.success)return null;let i=jo(s.data),r=jo(a.data);for(let c=0;c<3;c+=1){let p=No(i.release[c],r.release[c]);if(p!==0)return p}if(!i.prerelease&&!r.prerelease)return 0;if(!i.prerelease)return 1;if(!r.prerelease)return-1;let m=Math.max(i.prerelease.length,r.prerelease.length);for(let c=0;c<m;c+=1){let p=i.prerelease[c],I=r.prerelease[c];if(p===void 0)return-1;if(I===void 0)return 1;if(p===I)continue;let R=/^\d+$/u.test(p),w=/^\d+$/u.test(I);return R&&w?No(BigInt(p),BigInt(I)):R?-1:w?1:Ld(p,I)}return 0}function jo(e){let n=e.indexOf("+"),s=n===-1?e:e.slice(0,n),a=s.indexOf("-"),i=a===-1?s:s.slice(0,a),r=a===-1?void 0:s.slice(a+1),[m,c,p]=i.split(".");return{release:[BigInt(m),BigInt(c),BigInt(p)],...r?{prerelease:r.split(".")}:{}}}function No(e,n){return e<n?-1:e>n?1:0}function Ld(e,n){return e<n?-1:e>n?1:0}import{z as $}from"zod";import{z as Te}from"zod";var ci=64,Md=512*1024,mi=4*1024*1024,Ud=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function qd(e){return Ud.test(e)}var Lo=Te.string().min(1).refine(qd,{message:"Materialization pathTemplate must be a safe relative path."}),Fd=Te.object({pathTemplate:Lo,content:Te.string(),role:Te.string().min(1).optional()}).strict(),Gd=Te.union([Te.object({kind:Te.literal("default")}).strict(),Te.object({kind:Te.literal("named"),name:Te.string().min(1)}).strict()]),Kd=Te.object({pathTemplate:Lo,export:Gd}).strict(),Wd=Te.array(Te.never()).optional(),Tt=Te.object({instanceBaseName:Te.string().min(1),files:Te.array(Fd).min(1).max(ci),entry:Kd,dataRequirements:Wd}).strict().superRefine((e,n)=>{let s=new Set,a=e.entry.pathTemplate,i=0;for(let[r,m]of e.files.entries()){s.has(m.pathTemplate)&&n.addIssue({code:"custom",path:["files",r,"pathTemplate"],message:`Duplicate materialization pathTemplate: ${m.pathTemplate}`}),s.add(m.pathTemplate);let c=new TextEncoder().encode(m.content).length;c>Md&&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>mi&&n.addIssue({code:"custom",path:["files"],message:"Materialization exceeds the total content byte limit."})});var Mo="insertNewComponent",TT={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"},li=$.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),Uo=$.lazy(()=>$.object({id:$.string().uuid(),key:$.string().min(1),name:$.string(),children:$.array(Uo)}).strict()),qo=$.object({category_group_key:$.literal(Mo),categories:$.array(Uo)}).strict(),zd=$.object({resource_id:$.string().min(1),name:$.string(),description:$.string().nullable(),thumbnail_url:$.string().nullable(),resolved_version:li,category_id:$.string().uuid().nullable()}).strict(),Fo=$.object({category_group_key:$.literal(Mo),items:$.array(zd),next_cursor:$.string().min(1).nullable()}).strict(),kT=$.object({resource_id:$.string().min(1),resolved_version:li,anchor_block_id:$.string().min(1),placement:$.enum(["before","after"])}).strict(),AT=$.object({status:$.literal("mock_acknowledged")}).strict(),PT=$.object({category_id:$.string().uuid().optional(),include_descendants:$.enum(["true","false"]).optional().transform(e=>e==="true"),limit:$.coerce.number().int().min(1).max(100).optional().default(20),cursor:$.string().min(1).optional()}).strict().superRefine((e,n)=>{e.include_descendants&&!e.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),kt=li,wT=$.object({version:kt}).strict(),Go=$.object({resource_id:$.string().min(1),resolved_version:kt,revision_id:$.string().uuid().optional(),digest_sha256:$.string().regex(/^[a-f0-9]{64}$/),materialization:Tt}).strict();import{z as x}from"zod";import{z as h}from"zod";var Bo="/",Ho=255,Bd=5e3,Hd=64;function Vd(e){if(!e.startsWith("/")||e.includes("//")||/[?#\\\s\u0000-\u001f\u007f]/u.test(e))return!1;try{let n=decodeURIComponent(e);return n.includes("//")||/[?#\\\s\u0000-\u001f\u007f]/u.test(n)||n.split("/").length!==e.split("/").length||/%25/iu.test(e)?!1:n.split("/").every(s=>![".",".."].includes(s))}catch{return!1}}var et=h.string().min(1).max(Ho).refine(Vd,"url_path must be a safe site-relative path"),ui=h.string().max(Ho),es=h.preprocess(e=>e===0?!1:e===1?!0:e,h.boolean()),cn=h.union([h.url(),et]),_i=h.enum(["landing_page","general_page","detail_page"]),gi=h.enum([..._i.options,"list_page","category_page","tag_page","author_page","search_page","date_page"]);function OT(e){return e.vcp_managed&&e.url!==null&&_i.safeParse(e.page_type).success&&et.safeParse(e.url_path).success}function Ko(e){return e.includes("{")||e.includes("}")}function jT(e){if(!Ko(e.url_path))return Wo(e.url_path);if(e.url===null)return null;let n=/^[a-z][a-z0-9+.-]*:\/\//iu.test(e.url)?$d(e.url):e.url;return n===null||Ko(n)?null:Wo(n)}function Wo(e){let n=et.safeParse(e);return n.success?n.data:null}function $d(e){try{return new URL(e).pathname}catch{return null}}var Vo=h.lazy(()=>h.object({cms_page_id:h.number().int().positive(),title:h.string().trim().min(1).max(255),url_path:ui,url:cn.nullable(),page_type:gi,vcp_managed:es,children:h.array(Vo)}).strict()),Yd=h.object({group_id:h.string().min(1),title:h.string().trim().min(1).max(255),collection_slug:h.string(),pages:h.array(Vo)}).strict(),zo=h.object({groups:h.array(Yd)}).strict(),$o=h.lazy(()=>h.object({id:h.number().int().positive(),title:h.string().trim().min(1).max(120),url_path:ui,parent_id:h.number().int().nonnegative(),group_type:h.string().min(1),page_type:gi,plugin_id:h.number().int().nonnegative(),is_default:es,is_published:es,url:cn.nullable(),vcp_managed:es,children:h.array($o)})),Xd=h.object({plugin_id:h.number().int().nonnegative(),slug:h.string(),group_name:h.string().trim().min(1).max(255),pages:h.array($o)}).passthrough(),Qd=h.array(Xd);function Yo(e){return{cms_page_id:e.id,title:e.title,url_path:e.url_path,url:e.url,page_type:e.page_type,vcp_managed:e.vcp_managed,children:e.children.map(n=>Yo(n))}}function NT(e){if(!Zd(e))return null;let n=zo.safeParse(e);if(n.success)return n.data;let s=Qd.safeParse(e);if(!s.success)return null;let a=zo.safeParse({groups:s.data.map(i=>({group_id:String(i.plugin_id),title:i.group_name,collection_slug:i.slug,pages:i.pages.map(Yo)}))});return a.success?a.data:null}function Zd(e){let n=Array.isArray(e)?e:pi(e)&&Array.isArray(e.groups)?e.groups:[],s=[];for(let i of n)if(!(!pi(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>Bd||i.depth>Hd)return!1;if(!(!pi(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 pi(e){return typeof e=="object"&&e!==null}var Jd=h.enum(["invalid_url_path","missing_url","not_vcp_managed","unsupported_page_type","page_not_generated"]),eu=h.enum(["home_page","invalid_url_path","not_selectable","not_vcp_managed","page_has_children","last_selectable_page","cms_unbound","unsupported_page_type"]),Xo=h.lazy(()=>h.object({cms_page_id:h.number().int().positive().nullable(),title:h.string().trim().min(1).max(255),url_path:ui,preview_url_path:et.nullable(),url:cn.nullable(),page_type:gi,vcp_managed:h.boolean(),selectable:h.boolean(),disabled_reason:Jd.nullable(),can_delete:h.boolean(),delete_block_reason:eu.nullable(),has_cms_children:h.boolean(),children:h.array(Xo)}).strict()),Qo=h.object({group_id:h.string().min(1),title:h.string().trim().min(1).max(255),pages:h.array(Xo)}).strict(),LT=h.object({base_snapshot_id:k,expected_url_path:et}).strict(),tu=h.enum(["succeeded","failed"]),nu=h.object({url_path:et,phase:h.enum(["ensure","binding","delete"]),code:h.string().min(1),message:h.string().min(1)}).strict(),hi=h.object({status:tu,checked_count:h.number().int().nonnegative(),ensured_count:h.number().int().nonnegative(),deleted_count:h.number().int().nonnegative(),already_absent_count:h.number().int().nonnegative(),failed_pages:h.array(nu),warnings:h.array(h.string().min(1))}).strict(),su=h.object({result_snapshot_id:k,deleted_files:h.array(h.string().min(1)),updated_files:h.array(h.string().min(1)),preserved_shared_files:h.array(h.string().min(1)),warnings:h.array(h.string().min(1)),next_url:cn.nullable(),previous_url:cn.nullable(),cms_reconcile_result:hi}).strict(),MT=h.object({code:h.literal(0),message:h.string(),data:su}).strict(),UT=h.object({snapshot_id:k}).strict(),iu=h.object({snapshot_id:k,warnings:h.array(h.string().min(1)),cms_reconcile_result:hi}).strict(),qT=h.object({code:h.literal(0),message:h.string(),data:iu}).strict(),FT=h.object({source_committed:h.boolean(),result_snapshot_id:k.optional(),cms_reconcile_result:hi.optional()}).strict().superRefine((e,n)=>{e.source_committed&&!e.result_snapshot_id&&n.addIssue({code:"custom",path:["result_snapshot_id"],message:"committed source requires result_snapshot_id"})}),au=_i,ou=h.object({title:h.string().min(1).max(255).optional(),description:h.string().min(1).max(1e3).optional(),keywords:h.string().min(1).max(255).optional(),meta_tags_json:h.record(h.string(),h.unknown()).optional(),schema_json:h.union([h.record(h.string(),h.unknown()),h.array(h.unknown())]).optional(),breadcrumbs_json:h.array(h.unknown()).optional()}).strict(),Zo=h.object({url_path:et,title:h.string().trim().min(1).max(255),kind:au,route_file:h.string().min(1),collection_id:h.string().trim().min(1).optional(),seo:ou.optional()}).strict().superRefine((e,n)=>{e.kind==="detail_page"&&e.seo&&n.addIssue({code:"custom",path:["seo"],message:"detail_page target cannot carry seo (owned by the collection binding flow)"}),e.kind==="detail_page"&&!e.collection_id&&n.addIssue({code:"custom",path:["collection_id"],message:"detail_page target requires collection_id"}),e.kind!=="detail_page"&&e.collection_id&&n.addIssue({code:"custom",path:["collection_id"],message:`${e.kind} target cannot have collection_id`}),e.kind==="landing_page"!=(e.url_path===Bo)&&n.addIssue({code:"custom",path:["kind"],message:"The home target must be the only landing_page target."})}),ru=h.object({complete:h.literal(!0),targets:h.array(Zo)}).strict().superRefine((e,n)=>{e.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."}),e.targets.filter(a=>a.url_path===Bo).length!==1&&n.addIssue({code:"custom",path:["targets"],message:"A complete page target set must contain exactly one home page."})}),GT=h.discriminatedUnion("complete",[ru,h.object({complete:h.literal(!1),targets:h.array(Zo),errors:h.array(h.string().min(1)).min(1)}).strict()]),di=h.string().regex(/^sha256:[0-9a-f]{64}$/),KT=h.object({projection_hash:di.nullable()}).strict(),WT=h.object({expected_projection_hash:di.nullable(),projection_hash:di}).strict();var Jo="insertNewPage",YT={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"},At=x.enum(["page","pages"]),cu=x.object({resource_id:x.string().min(1),resource_type:At,resolved_version:kt,template_page_id:x.string().min(1)}).strict(),er=x.lazy(()=>x.object({id:x.string().uuid(),key:x.string().min(1),name:x.string(),children:x.array(er)}).strict()),tr=x.object({category_group_key:x.literal(Jo),categories:x.array(er)}).strict(),mu=x.object({resource_id:x.string().min(1),resource_type:At,name:x.string(),description:x.string().nullable(),thumbnail_url:x.string().nullable(),preview_images:x.array(x.object({url:x.string().min(1),page_id:x.string().min(1).nullable(),is_primary:x.boolean()}).strict()).optional(),resolved_version:kt,category_id:x.string().uuid().nullable()}).strict(),nr=x.object({category_group_key:x.literal(Jo),items:x.array(mu),next_cursor:x.string().min(1).nullable()}).strict(),XT=x.object({category_id:x.string().uuid().optional(),include_descendants:x.enum(["true","false"]).optional().transform(e=>e==="true"),limit:x.coerce.number().int().min(1).max(100).optional().default(20),cursor:x.string().min(1).optional()}).strict().superRefine((e,n)=>{e.include_descendants&&!e.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),mn=kt,ts=x.string().regex(/^\/[a-z0-9]+(?:-[a-z0-9]+)*$/),QT=x.string().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),lu=x.object({template_page_id:x.string().min(1),title:x.string().trim().min(1).max(120),final_route:ts}).strict(),pu=x.object({template_page_id:x.string().min(1),title:x.string().trim().min(1).max(120),source:cu.optional(),blocks:x.array(x.discriminatedUnion("kind",[x.object({kind:x.literal("package-component"),instance_id:x.string().min(1),component_id:x.string().min(1),label:x.string().trim().min(1).max(120)}).strict(),x.object({kind:x.literal("component-resource"),instance_id:x.string().min(1),resource_id:x.string().min(1),resolved_version:kt,label:x.string().trim().min(1).max(120)}).strict()])).optional(),route:x.object({input:x.string(),append_random_suffix:x.boolean().optional(),random_suffix_length:x.number().int().min(4).max(16).optional(),final:ts}).strict()}).strict(),du=x.object({resource_id:x.string().min(1),resource_type:At,resolved_version:mn,pages:x.array(pu).min(1)}).strict().superRefine((e,n)=>{pt(e.pages.map(s=>s.template_page_id),"pages",n),pt(e.pages.map(s=>s.route.final),"routes",n);for(let[s,a]of e.pages.entries()){if(!a.blocks)continue;let i=new Set;for(let[r,m]of a.blocks.entries())i.has(m.instance_id)&&n.addIssue({code:"custom",path:["pages",s,"blocks",r,"instance_id"],message:`Duplicate block instance identifier within page: ${m.instance_id}`}),i.add(m.instance_id)}});function Si(e,n){e.resource_type==="page"&&e.pages.length!==1&&n.addIssue({code:"custom",path:["pages"],message:"page resources must contain exactly one page"}),e.resource_type==="pages"&&e.pages.length<2&&n.addIssue({code:"custom",path:["pages"],message:"pages resources must contain at least two pages"})}function pt(e,n,s){let a=new Set;for(let[i,r]of e.entries())a.has(r)&&s.addIssue({code:"custom",path:[n,i],message:`Duplicate ${n} identifier: ${r}`}),a.add(r)}var ZT=x.object({resource_type:At,version:mn,pages:x.array(lu).min(1)}).strict().superRefine((e,n)=>{Si(e,n),pt(e.pages.map(s=>s.template_page_id),"pages",n),pt(e.pages.map(s=>s.final_route),"routes",n)}),uu=x.object({instance_id:x.string().min(1),component_id:x.string().min(1)}).strict(),_u=x.object({component_id:x.string().min(1),materialization:Tt}).strict(),gu=x.object({template_page_id:x.string().min(1),title:x.string().trim().min(1).max(120),final_route:ts,materialization:Tt,components:x.array(uu)}).strict(),fi=x.object({resource_id:x.string().min(1),resource_type:At,resolved_version:mn,revision_id:x.string().uuid().optional(),digest_sha256:x.string().regex(/^[a-f0-9]{64}$/),components:x.array(_u),pages:x.array(gu).min(1),project_dependencies:x.record(x.string(),x.never()).optional()}).strict().superRefine((e,n)=>{Si(e,n);let s=e.components.map(i=>i.component_id),a=new Set(s);pt(s,"components",n),pt(e.pages.map(i=>i.template_page_id),"pages",n),pt(e.pages.map(i=>i.final_route),"routes",n);for(let[i,r]of e.pages.entries()){let m=new Set;for(let[c,p]of r.components.entries())a.has(p.component_id)||n.addIssue({code:"custom",path:["pages",i,"components",c,"component_id"],message:`Unknown component reference: ${p.component_id}`}),m.has(p.instance_id)&&n.addIssue({code:"custom",path:["pages",i,"components",c,"instance_id"],message:`Duplicate component instance identifier within page: ${p.instance_id}`}),m.add(p.instance_id)}}),sr=fi,ir=x.object({template_page_id:x.string().min(1),title:x.string().trim().min(1).max(120),final_route:ts,route_file_path:x.string().regex(/^app\/[a-z0-9]+(?:-[a-z0-9]+)*\/page\.tsx$/)}).strict(),hu=x.object({template_page_id:x.string().min(1),title:x.string().trim().min(1).max(120),composition_supported:x.boolean(),blocks:x.array(x.object({instance_id:x.string().min(1),component_id:x.string().min(1),label:x.string().trim().min(1).max(120)}).strict())}).strict(),ar=x.object({resource_id:x.string().min(1),resource_type:At,resolved_version:mn,pages:x.array(hu).min(1)}).strict().superRefine((e,n)=>{Si(e,n),pt(e.pages.map(s=>s.template_page_id),"pages",n)}),JT=x.object({resource_type:At,version:mn}).strict(),ek=x.object({draft:du}).strict(),or=x.object({groups:x.array(Qo)}).strict(),rr=x.object({candidate:x.record(x.string(),x.unknown())}).strict();var Lt="[a-z0-9]+(?:-[a-z0-9]+)*",ln=new RegExp(`^/(?:${Lt}(?:/${Lt})*)?$`),cr=["/privacy","/cookie-policy","/system/not-found"],Su=cr.map(e=>`app/${e.slice(1)}/page.tsx`);function fu(e){return e.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function mr(e){return typeof e=="string"&&ln.test(e)}function lr(e){if(typeof e!="string")return null;let n=e.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(fu).filter(c=>c.length>0);if(r.length===0)return null;let m=`/${r.join("/")}`;return mr(m)?m:null}function pr(e){let n=lr(e);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function bu(e){let n=pr(e);return n==="/"?"app/page.tsx":`app/${n.slice(1)}/page.tsx`}import{z as ne}from"zod";import{z as _}from"zod";import{z as Le}from"zod";var yu=Le.object({code:Le.string().min(1),message:Le.string().min(1)}),ak=Le.object({code:Le.string().min(1),message:Le.string().min(1)});function bi(e){return Le.object({ok:Le.literal(!0),composition:q,data:e}).strict()}function xu(e){let n={ok:Le.literal(!1),composition:q,error:yu.extend({code:e.codeSchema})};return e.currentSchema&&(n.current=e.currentSchema.optional()),e.diagnosticsSchema&&(n.diagnostics=Le.array(e.diagnosticsSchema).optional()),e.dataSchema&&(n.data=e.dataSchema.optional()),Le.object(n).strict()}function dr(e){return Le.discriminatedUnion("ok",[bi(e.dataSchema),xu({codeSchema:e.codeSchema,currentSchema:e.currentSchema,diagnosticsSchema:e.diagnosticsSchema,dataSchema:e.failureDataSchema})])}import{z as X}from"zod";var tt=X.object({start:X.number().int().nonnegative(),end:X.number().int().nonnegative()}).superRefine((e,n)=>{e.end<e.start&&n.addIssue({code:"custom",path:["end"],message:"end must be greater than or equal to start"})}),Eu=X.object({code:X.enum(["missing-class-name","unsupported-attribute-name","source-locator-warning","invalid-new-attr","version-conflict","write-failed"]),message:X.string().min(1)}),ur=X.object({path:X.string().min(1),content:X.string(),hash:X.string().min(1).optional()}),lk=X.object({composition:q,revision:X.string().min(1),entryCss:ur,stylesheets:X.array(ur).default([])}).strict(),pk=X.object({composition:ce}).strict(),dk=X.object({key:X.string().min(1),composition:ce}).strict(),_r=X.object({key:X.string().min(1),composition:q,filePath:X.string().min(1),componentName:X.string().min(1),sourceKind:X.enum(["missing","stringLiteral","expression"]),attrRaw:X.string().min(1).nullable(),valueRaw:X.string().min(1).nullable(),attrRange:tt.nullable(),openingElementRange:tt,version:X.object({documentVersion:X.number().int().nonnegative(),contentHash:X.string().min(1)}),diagnostics:X.array(Eu),computedStyle:X.record(X.string(),X.string()).optional()}).strict().superRefine((e,n)=>{if(e.sourceKind==="missing"){(e.attrRaw!==null||e.valueRaw!==null||e.attrRange!==null)&&n.addIssue({code:"custom",message:"missing className source must not include attr raw or range"});return}(e.attrRaw===null||e.valueRaw===null||e.attrRange===null)&&n.addIssue({code:"custom",message:"present className source must include attr raw and ranges"})}),uk=_r,_k=bi(_r),yi=X.object({source:X.enum(["style-panel","class-source-editor"]),operation:X.enum(["replace-static-classname","replace-expression","create-attribute","remove-attribute"])});import{z as $e}from"zod";var Ru=new Set(["children","key","ref","dangerouslysetinnerhtml"]),Iu=new Set(["data-designer-hover-outline","data-designer-select-outline"]),Tu=/^[A-Za-z_$][A-Za-z0-9_$:-]*$/u;function ku(e){return{code:"protected-attribute",message:`Property is protected from generic site editing: ${e}`}}function Au(){return{code:"invalid-attribute-name",message:"Property name must be a valid single JSX attribute name"}}function Pu(e){let n=e.toLowerCase();return Ru.has(n)||n.startsWith("data-vcp-")||Iu.has(n)||/^on[a-z]/iu.test(e)}function xi(e){if(!Tu.test(e))return{owner:"blocked",name:e,diagnostic:Au()};if(Pu(e))return{owner:"blocked",name:e,diagnostic:ku(e)};let n=e.toLowerCase();return n==="classname"||n==="class"?{owner:"class-name-source",name:e}:n==="style"?{owner:"style",name:e}:{owner:"generic",name:e}}import{z as nt}from"zod";var Pt=nt.lazy(()=>nt.union([nt.string(),nt.number().finite(),nt.boolean(),nt.null(),nt.array(Pt),nt.record(nt.string(),Pt)]));var gr=$e.string().min(1),wu=$e.discriminatedUnion("operation",[$e.object({operation:$e.literal("set"),name:gr,value:Pt}).strict(),$e.object({operation:$e.literal("remove"),name:gr}).strict()]).superRefine((e,n)=>{let s=xi(e.name);s.owner==="blocked"&&n.addIssue({code:"custom",path:["name"],message:s.diagnostic?.message??"Property is not available for site editing"})}),hr=$e.object({kind:$e.literal("set-props"),scope:$e.enum(["selection","template"]),changes:$e.array(wu).min(1)}).strict().superRefine((e,n)=>{let s=new Map;for(let[a,i]of e.changes.entries()){let r=xi(i.name),m=Cu(r),c=s.get(m);c!==void 0?n.addIssue({code:"custom",path:["changes",a,"name"],message:`Duplicate property change; first declared at index ${c}`}):s.set(m,a)}});function Cu(e){return e.owner==="class-name-source"||e.owner==="style"?`owner:${e.owner}`:`name:${e.name}`}import{z as vu}from"zod";var Sr=vu.enum(["src","alt","poster","href","width","height"]);import{z as Mt}from"zod";var pn=Mt.object({editingSessionId:Mt.string().min(1),lockId:Mt.string().min(1),ownerId:Mt.string().min(1),leaseAssertion:Mt.string().min(1)}).strict(),kk="signed-designer-mutations-v1",Ak=Mt.object({mutationContext:pn}).strict();import{z as u}from"zod";import{z as dn}from"zod";var ns="::",Ei=dn.object({file:dn.string().min(1),component:dn.string().min(1),structuralPath:dn.string().min(1),key:dn.string().min(1)}).superRefine((e,n)=>{let s=Du(e.file,e.component,e.structuralPath);e.key!==s&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function Du(e,n,s){return`${e}${ns}${n}${ns}${s}`}function Ck(e){let[n,s,...a]=e.split(ns);return!n||!s||a.length===0?null:{file:n,component:s,structuralPath:a.join(ns)}}var ss=u.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"]),un=u.object({code:u.string().min(1),message:u.string().min(1)}).strict(),Ou=u.union([u.object({kind:u.literal("virtual-route-root"),key:u.string().min(1)}).strict(),u.object({kind:u.literal("jsx-container"),key:u.string().min(1),sourceMemberKey:u.string().min(1),sourceFile:u.string().min(1),componentName:u.string().min(1).optional()}).strict(),u.object({kind:u.literal("starter-placeholder"),key:u.string().min(1),sourceFile:u.string().min(1).optional()}).strict()]),ju=u.object({key:u.string().min(1),kind:u.enum(["jsx-element","jsx-fragment","jsx-expression","null-return","starter-placeholder"]),containerKey:u.string().min(1),label:u.string().min(1),sourceFile:u.string().min(1).optional(),isAtomic:u.boolean()}).strict(),Nu=u.object({key:u.string().min(1),sourceMemberKey:u.string().min(1),containerKey:u.string().min(1),label:u.string().min(1),isIndependent:u.boolean()}).strict(),Lu=u.object({key:u.string().min(1),containerKey:u.string().min(1),businessMemberKeys:u.array(u.string().min(1)),isMultiMember:u.boolean()}).strict(),br=u.object({kind:u.literal("page-composition"),placementKey:u.string().min(1),documentVersion:u.number().int().nonnegative(),composition:ce}).strict(),Mu=u.object({kind:u.literal("page-composition"),placementKey:u.string().min(1),documentVersion:u.number().int().nonnegative(),composition:q,placementUnitKey:u.string().min(1),relation:u.enum(["before","after","prepend","append"])}).strict(),yr=u.object({kind:u.literal("page-composition"),placementKey:u.string().min(1),documentVersion:u.number().int().nonnegative(),composition:ce,placementUnitKey:u.string().min(1),relation:u.enum(["before","after","prepend","append"])}).strict(),xr=u.object({kind:u.literal("page-unit"),composition:ce,placementUnitKey:u.string().min(1)}).strict(),Er=u.object({kind:u.literal("page-unit"),composition:q,placementUnitKey:u.string().min(1)}).strict();function st(e,n,s,a,i){let r=new Set;for(let[m,c]of e.entries()){let p=a(c);r.has(p)&&n.addIssue({code:"custom",path:[s,m,i],message:`Duplicate ${s} key: ${p}`}),r.add(p)}}var Uu=u.object({status:u.literal("supported"),version:u.number().int().nonnegative(),composition:q,container:Ou,sourceMembers:u.array(ju),businessMembers:u.array(Nu),placementUnits:u.array(Lu),placements:u.array(Mu)}).strict().superRefine((e,n)=>{st(e.sourceMembers,n,"sourceMembers",c=>c.key,"key"),st(e.businessMembers,n,"businessMembers",c=>c.key,"key"),st(e.placementUnits,n,"placementUnits",c=>c.key,"key"),st(e.placements,n,"placements",c=>c.placementKey,"placementKey");let s=new Set(e.sourceMembers.map(c=>c.key)),a=new Set(e.placementUnits.map(c=>c.key)),i=new Map(e.sourceMembers.map(c=>[c.key,c])),r=new Map(e.businessMembers.map(c=>[c.key,c]));for(let[c,p]of e.sourceMembers.entries()){p.containerKey!==e.container.key&&!s.has(p.containerKey)&&n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member parent must reference the page container or another source member."}),p.containerKey===p.key&&n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member cannot contain itself."});let I=new Set([p.key]),R=p.containerKey;for(;R!==e.container.key;){if(I.has(R)){n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member hierarchy must be acyclic."});break}I.add(R);let w=i.get(R);if(!w)break;R=w.containerKey}}e.container.kind==="jsx-container"&&!s.has(e.container.sourceMemberKey)&&n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."});for(let[c,p]of e.businessMembers.entries())s.has(p.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",c,"sourceMemberKey"],message:"Business member must reference a source member."}),a.has(p.containerKey)||n.addIssue({code:"custom",path:["businessMembers",c,"containerKey"],message:"Business member must reference a placement unit container."});for(let[c,p]of e.placementUnits.entries()){let I=i.get(p.containerKey);I?I.containerKey!==e.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 R=new Set;for(let[w,F]of p.businessMemberKeys.entries()){let B=r.get(F);if(!B){n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",w],message:"Placement unit must reference existing business members."});continue}R.has(F)&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",w],message:"Placement unit cannot reference the same business member twice."}),R.add(F),B.containerKey!==p.key&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",w],message:"Business member containerKey must match its placement unit."});let ee=B.sourceMemberKey,pe=new Set;for(;ee&&ee!==p.containerKey&&!pe.has(ee);)pe.add(ee),ee=i.get(ee)?.containerKey;ee!==p.containerKey&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",w],message:"Placement unit business members must belong to its source subtree."})}}for(let[c,p]of e.businessMembers.entries())e.placementUnits.find(R=>R.key===p.containerKey)?.businessMemberKeys.includes(p.key)||n.addIssue({code:"custom",path:["businessMembers",c,"containerKey"],message:"Business member must be listed by its placement unit container."});let m=new Map;for(let c of e.placementUnits)m.set(c.containerKey,(m.get(c.containerKey)??0)+1);for(let[c,p]of e.sourceMembers.entries())p.containerKey===e.container.key&&m.get(p.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,p]of e.placements.entries())Tr(p.composition,e.composition)||n.addIssue({code:"custom",path:["placements",c,"composition"],message:"Page placement composition must match page composition."}),p.documentVersion!==e.version&&n.addIssue({code:"custom",path:["placements",c,"documentVersion"],message:"Page placement version must match page composition version."}),a.has(p.placementUnitKey)||n.addIssue({code:"custom",path:["placements",c,"placementUnitKey"],message:"Placement option must reference an existing placement unit."})}),qu=u.object({status:u.literal("unsupported"),version:u.number().int().nonnegative(),composition:q,reason:ss,diagnostics:u.array(un)}).strict(),Fu=u.discriminatedUnion("status",[Uu,qu]),Rr=2,Nk="page-composition-v2",Ir=u.object({start:u.number().int().nonnegative(),end:u.number().int().nonnegative(),startLine:u.number().int().positive().optional(),startColumn:u.number().int().nonnegative().optional(),endLine:u.number().int().positive().optional(),endColumn:u.number().int().nonnegative().optional()}).strict().superRefine((e,n)=>{e.end<e.start&&n.addIssue({code:"custom",path:["end"],message:"Source range end must be greater than or equal to start."});let s=[e.startLine,e.startColumn,e.endLine,e.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."}),e.startLine!==void 0&&e.endLine!==void 0&&e.endLine<e.startLine&&n.addIssue({code:"custom",path:["endLine"],message:"Source range endLine must not precede startLine."}),e.startLine!==void 0&&e.endLine===e.startLine&&e.startColumn!==void 0&&e.endColumn!==void 0&&e.endColumn<e.startColumn&&n.addIssue({code:"custom",path:["endColumn"],message:"Source range endColumn must not precede startColumn."})}),Gu=u.object({key:u.string().min(1),instanceIndex:u.number().int().nonnegative().optional(),instanceCount:u.number().int().positive().optional(),textSegmentIndex:u.number().int().nonnegative().optional()}).strict().superRefine((e,n)=>{e.instanceIndex!==void 0&&e.instanceCount!==void 0&&e.instanceIndex>=e.instanceCount&&n.addIssue({code:"custom",path:["instanceIndex"],message:"instanceIndex must be lower than instanceCount."})}),Ku=u.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),Wu=u.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),zu=u.discriminatedUnion("kind",[u.object({kind:u.literal("virtual-route-root"),key:u.null(),routeReturn:u.object({sourceIdentity:Ei,sourceRange:Ir}).strict()}).strict(),u.object({kind:u.literal("jsx-container"),key:u.string().min(1),sourceMemberKey:u.string().min(1)}).strict(),u.object({kind:u.literal("starter-placeholder"),key:u.string().min(1),sourceMemberKey:u.string().min(1),replacementMode:u.literal("replace")}).strict()]),Bu=u.object({key:u.string().min(1),kind:Ku,parentKey:u.string().min(1).nullable(),childKeys:u.array(u.string().min(1)),order:u.number().int().nonnegative(),label:u.string().min(1),sourceIdentity:Ei,sourceRange:Ir.nullable(),atomicKind:Wu}).strict().superRefine((e,n)=>{let s=e.kind==="component-call"||e.kind==="native-jsx"?"none":e.kind;e.atomicKind!==s&&n.addIssue({code:"custom",path:["atomicKind"],message:`atomicKind must be ${s} for ${e.kind}.`});let a=new Set;for(let[i,r]of e.childKeys.entries())a.has(r)&&n.addIssue({code:"custom",path:["childKeys",i],message:`Duplicate child source member key: ${r}`}),a.add(r)}),Hu=u.object({key:u.string().min(1),sourceMemberKey:u.string().min(1),placementUnitKey:u.string().min(1),label:u.string().min(1),isIndependent:u.boolean()}).strict(),Vu=u.enum(["independent","atomic","container"]),$u=u.object({key:u.string().min(1),containerKey:u.string().min(1).nullable(),sourceMemberKeys:u.array(u.string().min(1)).min(1),businessMemberKeys:u.array(u.string().min(1)),order:u.number().int().nonnegative(),boundaryMode:Vu,isIndependent:u.boolean(),isMultiMember:u.boolean()}).strict().superRefine((e,n)=>{fr(e.sourceMemberKeys,n,"sourceMemberKeys","source member"),fr(e.businessMemberKeys,n,"businessMemberKeys","business member");let s=e.sourceMemberKeys.length>1||e.businessMemberKeys.length>1;e.isMultiMember!==s&&n.addIssue({code:"custom",path:["isMultiMember"],message:"isMultiMember must reflect the source and business member cardinality."});let a=e.boundaryMode==="independent";e.isIndependent!==a&&n.addIssue({code:"custom",path:["isIndependent"],message:"isIndependent must match boundaryMode."})}),Yu=u.enum(["before","after","prepend","append","replace"]),Xu=u.enum(["insert-sibling","insert-child","replace-placeholder"]),Qu=u.object({kind:u.literal("page-composition"),placementKey:u.string().min(1),documentVersion:u.number().int().nonnegative(),composition:q,placementUnitKey:u.string().min(1),containerKey:u.string().min(1).nullable(),relation:Yu,writeMode:Xu}).strict().superRefine((e,n)=>{let s=e.relation==="before"||e.relation==="after"?"insert-sibling":e.relation==="prepend"||e.relation==="append"?"insert-child":"replace-placeholder";e.writeMode!==s&&n.addIssue({code:"custom",path:["writeMode"],message:`writeMode must be ${s} for ${e.relation}.`})}),Zu=u.object({key:u.string().min(1),placementUnitKey:u.string().min(1),runtimeRefs:u.array(Gu).min(1)}).strict(),Ju=u.object({schemaVersion:u.literal(Rr),status:u.literal("supported"),version:u.number().int().nonnegative(),composition:q,container:zu,sourceMembers:u.array(Bu),businessMembers:u.array(Hu),placementUnits:u.array($u),placements:u.array(Qu),visualAnchors:u.array(Zu).optional(),diagnostics:u.array(un)}).strict().superRefine((e,n)=>{n_(e,n)}),e_=u.object({schemaVersion:u.literal(Rr),status:u.literal("unsupported"),version:u.number().int().nonnegative(),composition:q,reason:ss,diagnostics:u.array(un)}).strict(),t_=u.discriminatedUnion("status",[Ju,e_]),Lk=u.union([t_,Fu]);function fr(e,n,s,a){let i=new Set;for(let[r,m]of e.entries())i.has(m)&&n.addIssue({code:"custom",path:[s,r],message:`Duplicate ${a} key: ${m}`}),i.add(m)}function Tr(e,n){return Xs(e)===Xs(n)}function n_(e,n){st(e.sourceMembers,n,"sourceMembers",R=>R.key,"key"),st(e.businessMembers,n,"businessMembers",R=>R.key,"key"),st(e.placementUnits,n,"placementUnits",R=>R.key,"key"),st(e.placements,n,"placements",R=>R.placementKey,"placementKey"),st(e.visualAnchors??[],n,"visualAnchors",R=>R.key,"key"),s_(e,n);let s=new Map(e.sourceMembers.map(R=>[R.key,R])),a=new Map(e.businessMembers.map(R=>[R.key,R])),i=new Map(e.placementUnits.map(R=>[R.key,R]));i_(e,s,n),e.container.kind!=="virtual-route-root"&&(s.has(e.container.sourceMemberKey)||n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."}));let r=new Map,m=new Map,c=new Set;for(let[R,w]of e.placementUnits.entries()){w.containerKey!==e.container.key&&n.addIssue({code:"custom",path:["placementUnits",R,"containerKey"],message:"Placement unit containerKey must match the page container."});let F=`${w.containerKey??"<virtual>"}:${w.order}`;c.has(F)&&n.addIssue({code:"custom",path:["placementUnits",R,"order"],message:"Placement unit order must be unique within its container."}),c.add(F);for(let[B,ee]of w.sourceMemberKeys.entries()){s.has(ee)||n.addIssue({code:"custom",path:["placementUnits",R,"sourceMemberKeys",B],message:"Placement unit must reference existing source members."});let pe=r.get(ee);pe&&pe!==w.key&&n.addIssue({code:"custom",path:["placementUnits",R,"sourceMemberKeys",B],message:`Source member is already assigned to ${pe}.`}),r.set(ee,w.key)}for(let[B,ee]of w.businessMemberKeys.entries()){let pe=a.get(ee);if(!pe){n.addIssue({code:"custom",path:["placementUnits",R,"businessMemberKeys",B],message:"Placement unit must reference existing business members."});continue}pe.placementUnitKey!==w.key&&n.addIssue({code:"custom",path:["placementUnits",R,"businessMemberKeys",B],message:"Placement unit and business member must reference each other."}),w.sourceMemberKeys.includes(pe.sourceMemberKey)||n.addIssue({code:"custom",path:["placementUnits",R,"businessMemberKeys",B],message:"Business member sourceMemberKey must belong to the placement unit."});let Xt=m.get(ee);Xt&&Xt!==w.key&&n.addIssue({code:"custom",path:["placementUnits",R,"businessMemberKeys",B],message:`Business member is already assigned to ${Xt}.`}),m.set(ee,w.key)}}for(let[R,w]of e.businessMembers.entries()){s.has(w.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",R,"sourceMemberKey"],message:"Business member must reference a source member."});let F=i.get(w.placementUnitKey);if(!F){n.addIssue({code:"custom",path:["businessMembers",R,"placementUnitKey"],message:"Business member must reference a placement unit."});continue}F.businessMemberKeys.includes(w.key)||n.addIssue({code:"custom",path:["businessMembers",R,"placementUnitKey"],message:"Business member and placement unit must reference each other."}),F.sourceMemberKeys.includes(w.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",R,"sourceMemberKey"],message:"Business member sourceMemberKey must belong to its placement unit."});let B=F.isIndependent&&F.businessMemberKeys.length===1;w.isIndependent!==B&&n.addIssue({code:"custom",path:["businessMembers",R,"isIndependent"],message:"Business member independence must match its placement unit boundary."})}let p=new Set;for(let[R,w]of e.placements.entries()){w.documentVersion!==e.version&&n.addIssue({code:"custom",path:["placements",R,"documentVersion"],message:"Page placement version must match page composition version."}),Tr(w.composition,e.composition)||n.addIssue({code:"custom",path:["placements",R,"composition"],message:"Page placement composition must match page composition."});let F=i.get(w.placementUnitKey);F?w.containerKey!==F.containerKey&&n.addIssue({code:"custom",path:["placements",R,"containerKey"],message:"Placement containerKey must match its placement unit."}):n.addIssue({code:"custom",path:["placements",R,"placementUnitKey"],message:"Placement option must reference a placement unit."});let B=`${w.placementUnitKey}:${w.relation}`;p.has(B)&&n.addIssue({code:"custom",path:["placements",R,"relation"],message:"A placement unit cannot expose the same relation more than once."}),p.add(B),w.relation==="replace"&&e.container.kind!=="starter-placeholder"&&n.addIssue({code:"custom",path:["placements",R,"relation"],message:"replace is only valid for a starter placeholder container."}),e.container.kind==="starter-placeholder"&&w.relation!=="replace"&&n.addIssue({code:"custom",path:["placements",R,"relation"],message:"Starter placeholder placements must use replace."})}let I=new Set;for(let[R,w]of(e.visualAnchors??[]).entries())i.has(w.placementUnitKey)||n.addIssue({code:"custom",path:["visualAnchors",R,"placementUnitKey"],message:"Visual anchor must reference a placement unit."}),I.has(w.placementUnitKey)&&n.addIssue({code:"custom",path:["visualAnchors",R,"placementUnitKey"],message:"A placement unit may expose only one visual anchor."}),I.add(w.placementUnitKey)}function s_(e,n){let s=[];e.container.key!==null&&s.push({key:e.container.key,path:["container","key"],namespace:"container"});for(let[i,r]of e.sourceMembers.entries())s.push({key:r.key,path:["sourceMembers",i,"key"],namespace:"source member"});for(let[i,r]of e.businessMembers.entries())s.push({key:r.key,path:["businessMembers",i,"key"],namespace:"business member"});for(let[i,r]of e.placementUnits.entries())s.push({key:r.key,path:["placementUnits",i,"key"],namespace:"placement unit"});for(let[i,r]of(e.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 i_(e,n,s){let a=new Set;for(let[i,r]of e.sourceMembers.entries()){let m=`${r.parentKey??"<root>"}:${r.order}`;if(a.has(m)&&s.addIssue({code:"custom",path:["sourceMembers",i,"order"],message:"Source member order must be unique among siblings."}),a.add(m),r.parentKey===r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member cannot be its own parent."}),r.parentKey!==null){let I=n.get(r.parentKey);I?I.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[I,R]of r.childKeys.entries()){if(R===r.key){s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",I],message:"Source member cannot be its own child."});continue}let w=n.get(R);w?w.parentKey!==r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",I],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",I],message:"Source child key must reference a source member."})}let c=new Set,p=r;for(;p;){if(c.has(p.key)){s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member graph must be acyclic."});break}c.add(p.key),p=p.parentKey===null?void 0:n.get(p.parentKey)}}}var _n=_.enum(["update-text","update-array-item","remove-node","insert-child","replace-node","move-node","set-class-name-source","set-props","apply-style-draft","source-edit","insert-page-resource","delete-page-source"]),a_=_.discriminatedUnion("kind",[_.object({kind:_.literal("node"),key:_.string().min(1)}).strict(),xr,_.object({kind:_.literal("route"),composition:ce}).strict(),_.object({kind:_.literal("source-file"),path:Se}).strict(),_.object({kind:_.literal("source-batch"),paths:_.array(Se).min(1)}).superRefine((e,n)=>{let s=new Set;for(let[a,i]of e.paths.entries())s.has(i)&&n.addIssue({code:"custom",path:["paths",a],message:`Duplicate source target path: ${i}`}),s.add(i)}).strict(),_.object({kind:_.literal("project")}).strict()]),o_=_.discriminatedUnion("kind",[_.object({kind:_.literal("node"),key:_.string().min(1)}).strict(),Er,_.object({kind:_.literal("route"),composition:q}).strict(),_.object({kind:_.literal("source-file"),path:Se}).strict(),_.object({kind:_.literal("source-batch"),paths:_.array(Se).min(1)}).strict(),_.object({kind:_.literal("project")}).strict()]),Ar=_.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"]),Pr=_.enum(["hover","active","focus","disabled"]),wr=_.enum(["sm","md","lg","xl","2xl"]),kr=_.union([_.object({relation:_.enum(["before","after"]),anchorKey:_.string().min(1)}),_.object({relation:_.enum(["prepend","append"]),parentKey:_.string().min(1)}),yr]),Cr=_.object({kind:_.literal("component-call"),component:_.never().optional(),materialization:Tt,props:_.record(_.string(),_.never()).optional()}).strict(),r_=_.union([_.object({kind:_.literal("native-tag"),tag:_.string().min(1),text:_.string().optional()}),_.object({kind:_.literal("component-call"),component:_.object({source:_.string().min(1),exportName:_.string().min(1)}),materialization:_.never().optional(),props:_.record(_.string(),_.unknown()).optional()}).strict(),Cr]),c_=_.discriminatedUnion("kind",[_.object({kind:_.literal("update-text"),segmentIndex:_.number().int().min(0),value:_.string()}),_.object({kind:_.literal("update-array-item"),segmentIndex:_.number().int().min(0),index:_.number().int().min(0),value:_.string()}),_.object({kind:_.literal("remove-node")}),_.object({kind:_.literal("insert-child"),node:r_,position:_.union([kr,br])}),_.object({kind:_.literal("replace-node"),node:Cr}),_.object({kind:_.literal("move-node"),target:kr,preserveBindings:_.boolean().optional()}),_.object({kind:_.literal("set-class-name-source"),filePath:_.string().min(1),expectedVersion:_.object({documentVersion:_.number().int().nonnegative(),contentHash:_.string().min(1)}),oldAttrRaw:_.string().min(1).nullable(),oldAttrRange:tt.nullable(),openingElementRange:tt,newAttrRaw:_.string().min(1).nullable(),intent:yi}),hr,_.object({kind:_.literal("apply-style-draft"),className:_.object({filePath:_.string().min(1),expectedVersion:_.object({documentVersion:_.number().int().nonnegative(),contentHash:_.string().min(1)}),oldAttrRaw:_.string().min(1).nullable(),oldAttrRange:tt.nullable(),openingElementRange:tt,newAttrRaw:_.string().min(1).nullable(),intent:yi}).optional(),props:_.partialRecord(Sr,_.string()).optional()}).superRefine((e,n)=>{!e.className&&!e.props&&n.addIssue({code:"custom",message:"apply-style-draft requires className or props"})}),_.object({kind:_.literal("source-edit"),conflictPolicy:_.enum(["compare-and-swap","overwrite"]),edits:_.array(_.discriminatedUnion("operation",[_.object({operation:_.literal("upsert"),path:Se,content:_.string(),baseContentHash:_.string().min(1).nullable().optional()}).strict().superRefine((e,n)=>{Zs(e.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit upsert only accepts allowlisted text source files"}),e.content.includes("\0")&&n.addIssue({code:"custom",path:["content"],message:"source-edit content must be valid text"})}),_.object({operation:_.literal("delete"),path:Se,capability:po,confirmDelete:_.literal(!0),confirmPath:Se,baseContentHash:_.string().min(1).nullable().optional()}).strict().superRefine((e,n)=>{e.capability!==Qs&&n.addIssue({code:"custom",path:["capability"],message:"delete requires source-delete capability"}),e.confirmPath!==e.path&&n.addIssue({code:"custom",path:["confirmPath"],message:"delete confirmation path must match edit path"}),Zs(e.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit delete only accepts allowlisted text source files"});let s=Js(e.path);s&&n.addIssue({code:"custom",path:["path"],message:`Protected source file cannot be deleted: ${e.path} (${s})`})})])).min(1),reason:_.string().min(1).optional()}).strict().superRefine((e,n)=>{let s=new Set;for(let[a,i]of e.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),e.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"})}),_.object({kind:_.literal("insert-page-resource"),artifact:fi}).strict(),_.object({kind:_.literal("delete-page-source"),expectedUrlPath:_.string().startsWith("/")}).strict()]),vr=_.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"]),Dr=_.object({code:vr,message:_.string().min(1),details:_.record(_.string(),_.unknown()).optional()}),Ut=_.object({key:_.string().min(1),instanceIndex:_.number().int().nonnegative().optional(),instanceCount:_.number().int().positive().optional()}),Ri=_.object({id:_.string().min(1),siteId:T,baseSnapshotId:k,composition:ce,kind:_n,target:a_,documentVersion:_.number().int().nonnegative(),selectionRef:Ut.optional(),mutationContext:pn.optional(),params:c_}).strict().superRefine((e,n)=>{if(e.kind!==e.params.kind&&n.addIssue({code:"custom",path:["params","kind"],message:"params.kind must match operation kind"}),e.kind==="source-edit"){if(e.target.kind!=="source-file"&&e.target.kind!=="source-batch")n.addIssue({code:"custom",path:["target","kind"],message:"source-edit requires a source-file or source-batch target"});else if(e.params.kind==="source-edit"){let s=e.params.edits.map(i=>i.path),a=e.target.kind==="source-file"?[e.target.path]:e.target.paths;d_(s,a)||n.addIssue({code:"custom",path:["target"],message:"source-edit target paths must match edit paths"})}}else(e.target.kind==="source-file"||e.target.kind==="source-batch")&&n.addIssue({code:"custom",path:["target","kind"],message:"source targets are only valid for source-edit"});e.target.kind==="page-unit"&&(e.kind!=="insert-child"&&e.kind!=="replace-node"&&e.kind!=="move-node"&&e.kind!=="remove-node"&&n.addIssue({code:"custom",path:["target","kind"],message:"page-unit target is only valid for page-level operations"}),e.kind==="move-node"&&e.params.kind==="move-node"&&(!("kind"in e.params.target)||e.params.target.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","target","kind"],message:"page-unit move-node target requires page-composition placement"})),e.params.kind==="insert-child"&&"kind"in e.params.position&&e.params.position.kind==="page-composition"&&e.target.kind!=="page-unit"&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-composition position requires page-unit target"}),e.kind==="replace-node"&&e.target.kind!=="page-unit"&&n.addIssue({code:"custom",path:["target","kind"],message:"replace-node requires a page-unit target"}),e.kind==="insert-page-resource"||e.kind==="delete-page-source"?e.target.kind!=="project"&&n.addIssue({code:"custom",path:["target","kind"],message:`${e.kind} requires a project target`}):e.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project target is only valid for insert-page-resource or delete-page-source"}),e.kind==="insert-child"&&e.target.kind==="page-unit"&&e.params.kind==="insert-child"&&(!("kind"in e.params.position)||e.params.position.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-unit target requires page-composition position"})}),Xk=Ri,m_=_.object({kind:_.literal("insert-page-resource"),package_instance_id:_.string().min(1),pages:_.array(ir).min(1)}).strict().superRefine((e,n)=>{let s=new Set,a=new Set;for(let[i,r]of e.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)}),l_=_.object({kind:_.literal("delete-page-source"),deleted_files:_.array(_.string().min(1)),updated_files:_.array(_.string().min(1)),preserved_shared_files:_.array(_.string().min(1)),warnings:_.array(_.string().min(1))}).strict(),p_=_.discriminatedUnion("kind",[m_,l_]),Or=_.object({requestId:_.string().min(1),kind:_n,composition:q,target:o_,resultVersion:_.number().int().nonnegative(),affectedFiles:_.array(_.string().min(1)).optional(),selectionRef:Ut.optional(),output:p_.optional()}).strict(),Ii=Or.superRefine((e,n)=>{let s=e.kind==="insert-page-resource"||e.kind==="delete-page-source";s&&e.target.kind!=="project"?n.addIssue({code:"custom",path:["target","kind"],message:`${e.kind} result requires a project target`}):!s&&e.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project result target requires a project operation"}),s&&!e.output&&n.addIssue({code:"custom",path:["output"],message:`${e.kind} result requires typed output`}),e.output&&e.output.kind!==e.kind&&n.addIssue({code:"custom",path:["output","kind"],message:"output.kind must match operation kind"})}),Qk=dr({dataSchema:Ii,codeSchema:vr,failureDataSchema:Or.partial()});function d_(e,n){return e.length===n.length&&e.every((s,a)=>s===n[a])}var u_=ne.enum(["component","page","pages"]),__=ne.object({resource_kind:u_,resource_name:ne.string().trim().min(1).max(200),file_count:ne.number().int().min(1).max(64),total_bytes:ne.number().int().min(0).max(4*1024*1024),content_digest:ne.string().regex(/^sha256:[a-f0-9]{64}$/),custom_prompt:ne.string().trim().min(1).max(4e3).optional(),final_routes:ne.array(ne.string().min(1)).max(64)}).strict(),g_=ne.discriminatedUnion("kind",[ne.object({kind:ne.literal("none")}).strict(),ne.object({kind:ne.literal("primary"),items:ne.array(ne.object({label:ne.string().trim().min(1).max(120),href:ne.string().startsWith("/").max(200)}).strict()).min(1).max(64)}).strict().superRefine((e,n)=>{let s=new Set;for(let[a,i]of e.items.entries())s.has(i.href)&&n.addIssue({code:"custom",path:["items",a,"href"],message:`Duplicate navigation href: ${i.href}`}),s.add(i.href)})]),h_=ne.object({base_snapshot_id:ne.string().min(1),operation:Ri,navigation_selection:g_.optional()}).strict().superRefine((e,n)=>{e.base_snapshot_id!==e.operation.baseSnapshotId&&n.addIssue({code:"custom",path:["operation","baseSnapshotId"],message:"Resource operation baseSnapshotId must match base_snapshot_id."})});function S_(e){return(e.kind==="insert-child"||e.kind==="replace-node")&&(e.params.kind==="insert-child"||e.params.kind==="replace-node")&&e.params.node.kind==="component-call"&&"materialization"in e.params.node&&e.params.node.materialization?[e.params.node.materialization]:e.kind==="insert-page-resource"&&e.params.kind==="insert-page-resource"?[...e.params.artifact.components.map(n=>n.materialization),...e.params.artifact.pages.map(n=>n.materialization)]:[]}var jr=ne.object({id:ne.string().min(1),tenant_id:ne.string().min(1),site_id:ne.string().min(1),run_id:ne.string().min(1).optional(),correlation_id:ne.string().min(1).optional(),sent_at:ne.string().min(1),type:ne.literal("client.resource.operation.create"),payload:ne.object({client_message_id:ne.string().min(1),display:__,transient_resource_input:h_}).strict()}).strict().superRefine((e,n)=>{let{display:s,transient_resource_input:a}=e.payload;e.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."}),(s.resource_kind==="component"?a.operation.kind==="insert-child"||a.operation.kind==="replace-node":a.operation.kind==="insert-page-resource")||n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","kind"],message:s.resource_kind==="component"?"component resources require insert-child or replace-node.":`${s.resource_kind} resources require insert-page-resource.`});let m=S_(a.operation).flatMap(p=>p.files),c=m.reduce((p,I)=>p+new TextEncoder().encode(I.content).byteLength,0);if(m.length>ci&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate file count limit."}),c>mi&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate content byte limit."}),s.file_count!==m.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 p=a.operation.params.artifact;p.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 I=p.pages.map(R=>R.final_route);(I.length!==s.final_routes.length||I.some((R,w)=>R!==s.final_routes[w]))&&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 p=new Set(s.final_routes);for(let[I,R]of a.navigation_selection.items.entries())p.has(R.href)||n.addIssue({code:"custom",path:["payload","transient_resource_input","navigation_selection","items",I,"href"],message:"Navigation selection href must reference a final resource route."})}});import{z as P}from"zod";var f_=["with_website","without_website"],is=P.enum(f_),Ti=P.string().trim().url().refine(e=>{let n=new URL(e).protocol;return n==="http:"||n==="https:"},{message:"Website must use the http or https protocol."}),b_=["welcome","website_scan","customer_materials","analysis","diagnosis","strategy","structure_planning","preview_personalization","publishing"],gn=P.enum(b_),y_=["company_info","website_crawl","website_basic_info_extract","website_metrics_evaluate","intelligent_analysis","strategy_recommendation"],Lr=P.enum(y_),x_=["started","running","succeeded","failed","invalidated"],Mr=P.enum(x_),E_=["draft","structure_saved","generating","workspace_ready"],ki=P.enum(E_),R_=["not_deployed","deploying","deployed"],Ai=P.enum(R_),I_=["active","completed"],T_=P.enum(I_),k_=["completed","current","locked"],A_=P.enum(k_),Ur={draft:10,structure_saved:20,generating:30,workspace_ready:40},qr={not_deployed:10,deploying:20,deployed:30},Fr={active:10,completed:20},Gr={started:10,running:20,succeeded:30,failed:40,invalidated:50};function as(e){return new Map(Object.entries(e).map(([n,s])=>[s,n]))}var P_=as(Ur),w_=as(qr),C_=as(Fr),v_=as(Gr);function c1(e){let n=P_.get(e);if(!n)throw new Error(`Unknown site build status code: ${e}`);return n}function m1(e){let n=w_.get(e);if(!n)throw new Error(`Unknown site deployment status code: ${e}`);return n}function l1(e){let n=C_.get(e);if(!n)throw new Error(`Unknown site workflow status code: ${e}`);return n}function p1(e){let n=v_.get(e);if(!n)throw new Error(`Unknown task execution status code: ${e}`);return n}function d1(e){return Ur[e]}function u1(e){return qr[e]}function _1(e){return Fr[e]}function g1(e){return Gr[e]}var Pi=[{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}]}}],h1=Pi[0].definitions,Kr=P.number().int().min(1),D_=P.object({id:V,flow_type:is,definition_version:Kr,node_code:gn,label:P.string().min(1),sort_order:P.number().int().min(1),is_enabled:P.boolean(),state:A_}),Wr=P.object({id:Za,tenant_id:P.string().min(1),site_id:T,workflow_id:Ve,node_code:gn,task_type:Lr,external_task_id:P.string().min(1),execution_status:Mr,idempotency_key:P.string().min(1),attempt_no:P.number().int().min(1),source_crawl_task_ref_id:P.string().uuid().nullable(),succeeded_at:P.string().min(1).nullable(),superseded_at:P.string().min(1).nullable(),site_url:P.string().url().nullable(),created_at:P.string().min(1),updated_at:P.string().min(1)}),O_=P.object({id:Ve,tenant_id:P.string().min(1),site_id:T,flow_type:is,website:Ti.nullable(),definition_version:Kr,current_node_code:gn,status:T_,started_at:P.string().min(1),completed_at:P.string().min(1).nullable(),created_at:P.string().min(1),updated_at:P.string().min(1)}),wi=P.object({workflow:O_,menu:P.array(D_),task_refs:P.array(Wr),site:P.object({default_locale:fe.optional(),status:ki,deployment_status:Ai,archived_at:P.string().min(1).nullable(),current_sitemap_id:P.string().nullable().optional(),current_sitemap_version:P.number().int().positive().nullable().optional(),confirmed_sitemap_id:P.string().nullable().optional(),confirmed_sitemap_version:P.number().int().positive().nullable().optional(),structure_confirmed_at:P.string().min(1).nullable().optional(),current_snapshot_id:P.string().nullable(),deployed_url:P.string().url().nullable(),cms_site_id:P.string().min(1).nullish()})}),S1=M(wi),f1=M(Wr),Nr=P.array(P.string().min(1).max(64)).max(16).optional(),b1=P.discriminatedUnion("flow_type",[P.object({flow_type:P.literal("with_website"),website:Ti,client_capabilities:Nr}).strict(),P.object({flow_type:P.literal("without_website"),website:P.null().optional(),client_capabilities:Nr}).strict()]),y1=P.object({expected_current_node:P.literal("website_scan"),website:Ti}).strict(),x1=P.object({expected_current_node:gn}).strict(),E1=P.object({expected_current_node:P.literal("publishing")}).strict(),j_=P.object({node_code:gn,task_type:Lr,external_task_id:P.string().min(1).max(255),idempotency_key:P.string().min(1).max(255),site_url:P.string().url().optional()}),R1=j_.extend({workflow_id:Ve}).strict(),I1=P.object({external_task_id:P.string().min(1).max(255),execution_status:Mr}),N_=P.object({previous_external_task_id:P.string().min(1).max(255),external_task_id:P.string().min(1).max(255),idempotency_key:P.string().min(1).max(255),site_url:P.string().url().optional()}),T1=N_.extend({workflow_id:Ve}).strict(),L_=P.object({previous_external_task_id:P.string().min(1).max(255),external_task_id:P.string().min(1).max(255),idempotency_key:P.string().min(1).max(255),site_url:P.string().url()}),k1=L_.extend({workflow_id:Ve}).strict(),A1=P.object({}).strict();function M_(e,n,s){return e.find(a=>a.definition_version===s)?.definitions[n]}function U_(e,n){return M_(Pi,e,n)}function q_(e,n=1){let s=U_(e,n);if(!s)throw new Error(`Unknown workflow definition: ${e} v${n}.`);return s}function F_(e,n,s){let a=new Set(s);return e.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 P1(e,n){return F_(Pi,e,n)}function w1(e,n){return q_(e).findIndex(s=>s.node_code===n)}function C1(e,n){return e==="website_scan"?n==="website_crawl"||n==="website_basic_info_extract"||n==="website_metrics_evaluate":e==="customer_materials"?n==="company_info":e==="analysis"?n==="intelligent_analysis":e==="strategy"?n==="strategy_recommendation":!1}function v1(e,n){if(e===n)return n;if(!{started:["running","succeeded","failed","invalidated"],running:["succeeded","failed","invalidated"],succeeded:["invalidated"],failed:["invalidated"],invalidated:[]}[e].includes(n))throw new Error(`Invalid task execution status transition: ${e} -> ${n}`);return n}function D1(e,n){if(e===n)return n;if(!{draft:["structure_saved"],structure_saved:["generating","draft"],generating:["workspace_ready","structure_saved"],workspace_ready:[]}[e].includes(n))throw new Error(`Invalid site build status transition: ${e} -> ${n}`);return n}import{z as E}from"zod";var Ci=E.string().min(1).max(120).regex(/^[a-z][a-z0-9_-]*$/),De=E.string().min(1).max(120).regex(/^[A-Za-z_][A-Za-z0-9_]*$/),G_=E.enum(["text","select","multi_select","tags","category_list","boolean","number"]),hn=E.string().min(1).max(512).regex(/^\/(?:[^?#]*)$/),K_=E.object({minimum:E.number().finite(),maximum:E.number().finite(),step:E.number().finite().positive()}).strict().refine(e=>e.minimum<e.maximum,{message:"minimum must be less than maximum"}),W_=E.string().trim().min(1).max(100),Br=E.array(W_).max(5).refine(e=>new Set(e.map(n=>n.toLowerCase())).size===e.length,{message:"popular_terms must be unique ignoring case"}),L1=E.array(E.string()).max(20).transform(e=>{let n=new Set;return e.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)}),Hr=E.object({filter_enabled:E.boolean(),selected_fields:E.array(De).max(64),selected_card_fields:E.array(De).max(64).default([]),popular_terms_enabled:E.boolean().default(!1),popular_terms:Br.optional()}).strict(),z_=E.object({app_slug:Ci}).extend(Hr.shape).strict(),vi=E.object({kind:E.literal("product_search_confirmation"),baseline_snapshot_id:k,target_route_id:hn,applications:E.array(E.object({app_slug:Ci,label:E.string().min(1).max(200),popular_terms:Br.default([]),current_config:Hr.nullable().default(null),affected_routes:E.array(hn).max(64).default([]),fields:E.array(E.object({field_name:De,label:E.string().min(1).max(200),value_shape:G_,option_count:E.number().int().nonnegative().optional(),filter_meta:K_.optional()}).strict()).max(64)}).strict()).min(1).max(12),current_config:z_.nullable().optional(),affected_routes:E.array(hn).min(1).max(64).optional()}).strict(),B_=E.object({kind:E.literal("product_search_confirmation"),action:E.enum(["confirm","modify"]),app_slug:Ci,filter_enabled:E.boolean(),popular_terms_enabled:E.boolean().default(!1),selected_fields:E.array(De).max(64),selected_card_fields:E.array(De).max(64).default([])}).strict().superRefine((e,n)=>{e.filter_enabled&&e.selected_fields.length===0&&n.addIssue({code:"custom",path:["selected_fields"],message:"selected_fields must not be empty while filters are enabled"}),new Set(e.selected_fields).size!==e.selected_fields.length&&n.addIssue({code:"custom",path:["selected_fields"],message:"selected_fields must be unique"}),new Set(e.selected_card_fields).size!==e.selected_card_fields.length&&n.addIssue({code:"custom",path:["selected_card_fields"],message:"selected_card_fields must be unique"})}),os=E.union([B_,E.object({kind:E.literal("product_search_confirmation"),action:E.literal("cancel")}).strict()]),Sn=E.union([E.string().max(255),E.number().finite(),E.boolean()]),H_=E.object({values:E.array(Sn).min(1).max(20).refine(e=>new Set(e.map(n=>`${typeof n}:${String(n)}`)).size===e.length,{message:"values must be unique"})}).strict(),V_=E.object({min:E.number().finite().optional(),max:E.number().finite().optional(),include_unlabeled:E.boolean().optional()}).strict().refine(e=>e.min!==void 0||e.max!==void 0||e.include_unlabeled===!0,{message:"a numeric boundary or include_unlabeled is required"}).refine(e=>e.min===void 0||e.max===void 0||e.min<=e.max,{message:"min must not be greater than max"}),$_=E.object({q:E.string().max(200),page:E.number().int().min(1).max(500),page_size:E.union([E.literal(9),E.literal(20)]),sort:E.enum(["published_at_desc","published_at_asc","product_name_asc","product_name_desc"]),filters:E.record(De,E.union([H_,V_])).superRefine((e,n)=>{Object.keys(e).length>12&&n.addIssue({code:"custom",message:"filters must contain at most 12 fields"})}),display_fields:E.array(De).max(64).default([]),missing_count_fields:E.array(De).max(12).default([]),relaxation_count_fields:E.array(De).max(12).default([]),facets:E.array(E.object({field:De,query:E.string().max(100),page:E.number().int().min(1).max(100),page_size:E.literal(10),include_values:E.array(Sn).max(20)}).strict()).max(8)}).strict(),zr=E.object({value:Sn,label:E.string().max(200),count:E.number().int().nonnegative()}).strict(),Y_=E.union([Sn,E.array(Sn).max(50)]),X_=E.object({items:E.array(E.object({id:E.number().int().positive(),thumbnail:E.string().max(2048).nullable(),title:E.string().max(300),summary:E.string().max(2e3),category:E.string().max(300).nullable(),field_values:E.record(De,Y_).default({}),url:E.string().min(1).max(2048)}).strict()).max(20),page:E.object({total:E.number().int().nonnegative(),page:E.number().int().positive(),page_size:E.union([E.literal(9),E.literal(20)])}).strict(),facets:E.array(E.object({field:De,total:E.number().int().nonnegative(),page:E.number().int().positive(),page_size:E.literal(10),values:E.array(zr).max(10),selected_values:E.array(zr).max(20)}).strict()).max(8),missing_counts:E.record(De,E.number().int().nonnegative()).default({}),relaxation_counts:E.record(De,E.number().int().nonnegative()).default({})}).strict(),M1=E.object({contract_version:E.literal(1),request:$_,response:X_}).strict();import{z as je}from"zod";var Di=4,F1=20,G1=1440*60*1e3,K1=1e6,Q_=["image/png","image/jpeg","image/webp"],Oi=je.enum(Q_),W1="WORKSPACE_ATTACHMENT_UNSUPPORTED_FORMAT",z1="WORKSPACE_ATTACHMENT_TOO_LARGE",B1="WORKSPACE_ATTACHMENT_LIMIT",H1="WORKSPACE_ATTACHMENT_BOUND",V1=10,$1=3600*1e3,Y1="WORKSPACE_ATTACHMENT_URL_REJECTED",X1="WORKSPACE_ATTACHMENT_CAPTURE_FAILED",Q1="WORKSPACE_ATTACHMENT_CAPTURE_BUSY",Z1="WORKSPACE_ATTACHMENT_CAPTURE_TIMEOUT",J1="WORKSPACE_ATTACHMENT_CAPTURE_BUDGET_EXCEEDED",eA="WORKSPACE_ATTACHMENT_CAPTURE_UNAVAILABLE",tA=je.object({attachment_id:je.string().min(1),media_type:Oi,width:je.number().int().positive(),height:je.number().int().positive(),size_bytes:je.number().int().nonnegative(),filename:je.string().min(1).max(120),image_url:je.string().min(1),source_url:je.string().min(1).optional(),created_at:je.string().min(1)}).strict(),nA=je.object({url:je.string().url().max(2048),full_page:je.boolean().optional()}).strict(),Vr="[A-Za-z0-9_-]+",Z_=new RegExp(`^/sites/(${Vr})/workspace/attachments/(${Vr})/image$`);function sA(e,n){return`/sites/${encodeURIComponent(e)}/workspace/attachments/${encodeURIComponent(n)}/image`}function ji(e){let n=Z_.exec(e);return n?{site_id:n[1],attachment_id:n[2]}:null}function iA(e){let n=[];for(let s of e){if(s.type!=="file"||typeof s.url!="string")continue;let a=ji(s.url);a&&n.push({attachment_id:a.attachment_id,site_id:a.site_id,media_type:typeof s.mediaType=="string"?s.mediaType:"",filename:typeof s.filename=="string"&&s.filename.trim()!==""?s.filename:"image",url:s.url})}return n}import{z as fn}from"zod";var J_=["deployment_queued","prepare_source","build_artifact","publish_site","site_released","cleanup_release"],eg=fn.enum(J_),tg=fn.enum(["running","succeeded","failed"]),ng=fn.object({code:eg,status:tg,message:fn.string().trim().min(1)}).strict(),$r=fn.array(ng);import{z as A}from"zod";var sg=A.enum(["pending","running","succeeded","failed"]),ig=A.enum(["TASK_FAILED","WEBSITE_UNREACHABLE"]),ag=A.object({task_id:A.string().uuid(),site_url:A.string().url(),crawler_task_id:A.string().min(1).max(255).nullable(),crawler_error_code:ig.nullable().optional(),crawler_failure_stage:A.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]).nullable().optional(),page_count:A.number().int().min(0).max(20),status:sg,error:A.string().nullable(),created_at:A.string().min(1),updated_at:A.string().min(1)}),lA=M(ag),Ni=A.enum(["existing_site","new_site"]),Xr=A.enum(["google_indexing","ai_recommendation","qualification_verifiability","content_freshness","inquiry_form","inquiry_response","privacy_compliance","prohibited_content"]),Yr=A.object({observed_result:A.enum(["pass","fail","unknown"])}).strict(),Qr=A.object({kind:A.literal("ai_crawlability"),checks:A.object({ai_access_guidance:Yr,structured_data_presence:Yr}).strict()}).strict(),Li=A.object({label:A.string().trim(),value:A.union([A.string(),A.number(),A.boolean(),A.null()]),summary:A.string().trim(),tone:A.enum(["good","warn","bad","unknown"]),status:A.enum(["ok","unknown"]),assessment:Qr.optional()}),rs=A.object({key:A.string().trim().min(1).max(100),label:A.string().trim().min(1).max(100),value:A.union([A.string().max(1e3),A.number(),A.boolean(),A.null()]),tone:A.enum(["good","warn","bad","unknown"]),status:A.enum(["ok","unknown"]),evidence:A.string().trim().max(2e3).optional(),assessment:Qr.optional()}).strict(),og=A.object({url:A.string().url().max(2048),title:A.string().trim().max(300),words:A.number().int().nonnegative().max(1e7)}).strict(),rg=A.object({site_url:A.string().url().max(2048),scanned_at:A.string().datetime({offset:!0}),reach:A.array(rs).max(64),trust:A.array(rs).max(64),convert:A.array(rs).max(64),safe:A.array(rs).max(64),pages:A.array(og).max(100)}).strict(),cs=A.object({company_task_id:A.string().min(1).max(128),scan_task_id:A.string().min(1).max(128),type:Ni,result:A.object({company_name:A.string(),website:A.string().url().optional(),primary_product:A.string(),current_market:A.string(),qualifications:A.string(),scan_cards:A.record(A.string(),Li),scan_result:rg.optional()})}),cg=A.object({saved:A.literal(!0),company_task_id:A.string().min(1).max(128),scan_task_id:A.string().min(1).max(128)}),pA=M(cg),mg=A.enum(["snapshot","task"]),lg=cs.shape.result.extend({type:Ni,structured_facts:A.unknown().optional()}).extend({company_name:A.string(),primary_product:A.string(),current_market:A.string(),qualifications:A.string()}),pg=A.object({site_id:A.string().min(1).max(128),company_task_id:A.string().min(1).max(128),scan_task_id:A.string().min(1).max(128),type:Ni,data_source:mg,result:lg}),dA=M(pg.nullable());import{z as be}from"zod";var dt=be.enum(["company","product_service","case_qualification","market","contact_inquiry","privacy_compliance","news_freshness"]),dg=be.object({ordinal:be.number().int().min(1).max(1e4),path:be.string().min(1).max(2048).refine(e=>!gg(e),{message:"path must be a site-relative path, not an absolute URL"}),last_modified:be.string().max(64).nullable()}).strict(),gA=be.object({candidates:be.array(dg).min(1).max(1e4),selection_limit:be.number().int().min(1).max(19)}).strict().superRefine((e,n)=>{let s=e.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}}),ug=be.object({ordinal:be.number().int().positive().max(1e4),roles:be.array(dt).min(1).max(7)}).strict(),_g=be.object({role:dt,status:be.enum(["selected","not_found"]),selected_ordinals:be.array(be.number().int().positive().max(1e4)).max(19)}).strict(),hA=be.object({selections:be.array(ug).max(19),coverage:be.array(_g).length(7)}).strict().superRefine((e,n)=>{let s=new Set;for(let[i,r]of e.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 dt.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 e.selections)for(let r of i.roles){let m=a.get(r)??new Set;m.add(i.ordinal),a.set(r,m)}for(let[i,r]of e.coverage.entries()){let m=a.get(r.role);r.selected_ordinals.some(p=>!m?.has(p))&&n.addIssue({code:"custom",path:["coverage",i,"selected_ordinals"],message:"selected_ordinals must reference selections carrying the same role"})}});function gg(e){let n=e.toLowerCase();return n.startsWith("http://")||n.startsWith("https://")||e.startsWith("//")}import{z as S}from"zod";var yA=S.object({force_refresh:S.boolean().optional()}),Jr=S.enum(["running","succeeded","failed"]),hg=S.object({agent_id:S.string().min(1),name:S.string().min(1),icon:S.string().min(1),capability:S.string().min(1),data_source:S.string().min(1),output_topics:S.string().min(1)}),Sg=S.object({site_mode:S.enum(["existing_site","new_site"]),scan_required:S.boolean(),scheduled_agent_ids:S.array(S.string().min(1)),omitted_agent_ids:S.array(S.string().min(1)),next_stage:S.enum(["diagnostic_report","strategy"])}),fg=S.object({t:S.string(),d:S.string(),evidence:S.object({from:S.string(),url:S.string().nullable().optional(),value:S.string().nullable().optional()})}),bg=S.enum(["complete","partial","insufficient_data","failed"]),yg=S.enum(["ok","failed","insufficient_data"]),Mi=S.object({agent_id:S.string().min(1),name:S.string().min(1),icon:S.string().min(1),status:yg,topics:S.array(S.object({topic_id:S.string().min(1),status:bg,evidence_refs:S.array(S.string())})).length(3),findings:S.array(fg).max(3),elapsed_ms:S.number().nonnegative(),note:S.string().optional(),error:S.string().optional()}),ec=S.object({total:S.number().int().nonnegative(),ok:S.number().int().nonnegative(),degraded:S.number().int().nonnegative(),total_findings:S.number().int().nonnegative(),elapsed_ms:S.number().nonnegative(),site_mode:S.enum(["existing_site","new_site"]).optional(),scheduled_agent_ids:S.array(S.string()).optional(),omitted_agent_ids:S.array(S.string()).optional(),scheduled:S.number().int().nonnegative().optional(),complete:S.number().int().nonnegative().optional(),partial:S.number().int().nonnegative().optional(),insufficient:S.number().int().nonnegative().optional(),failed:S.number().int().nonnegative().optional(),next_stage:S.enum(["diagnostic_report","strategy"]).optional()}),xg=S.object({agents_done:S.boolean(),analysis:S.record(S.string(),Mi),step4_scoring_input:S.unknown().optional(),summary:ec}),tc=S.object({job_id:S.string().min(1),site_id:S.string().min(1),model_version:S.string().min(1),output_locale:S.string().min(2),cached:S.boolean().optional(),status:Jr,result:xg.nullable().optional(),error:S.string().nullable().optional()}),xA=M(S.array(hg)),EA=M(Sg),RA=M(tc),IA=M(tc.nullable()),it=S.object({id:S.union([S.number().int().nonnegative(),S.string().regex(/^(0|[1-9]\d*)$/u).transform(Number)]).pipe(S.number().int().nonnegative())}),Zr=S.object({percent:S.number().int().min(0).max(100),phase:S.enum(["preparing","analyzing","finalizing","completed","failed"]),stage:S.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:S.number().int().nonnegative(),agents_total:S.number().int().nonnegative(),agent_id:S.string().min(1).optional()}),TA=S.discriminatedUnion("event",[it.extend({event:S.literal("snapshot"),data:S.object({job_id:S.string().min(1),status:Jr,done:S.number().int().nonnegative(),total:S.number().int().nonnegative(),results:S.array(Mi),progress:Zr.optional()})}),it.extend({event:S.literal("progress"),data:Zr}),it.extend({event:S.literal("preparing_started"),data:S.object({stage:S.literal("baseline")})}),it.extend({event:S.literal("preparing_progress"),data:S.object({stage:S.enum(["context","external_evidence"])})}),it.extend({event:S.literal("preparing_done"),data:S.object({evidence_count:S.number().int().nonnegative(),rule_count:S.number().int().nonnegative(),degraded_capabilities:S.array(S.string())})}),it.extend({event:S.literal("agent_start"),data:S.object({agent_id:S.string().min(1),name:S.string().min(1),icon:S.string().min(1)})}),it.extend({event:S.literal("agent_done"),data:Mi}),it.extend({event:S.literal("done"),data:S.object({agents_done:S.literal(!0),summary:ec})}),it.extend({event:S.literal("failed"),data:S.object({message:S.string().min(1)})})]);import{z as O}from"zod";var qi=O.enum(["reach","trust","convert","safe"]),ke=O.number().finite(),Eg=O.number().finite().positive(),Ui=["reach","trust","convert","safe"],Rg=17,Ig=O.enum(["passed","partial","failed"]),Tg=O.object({landing_page_mode:O.enum(["intent_dynamic","static","none"]),ab_test_enabled:O.boolean()}).strict(),kg=O.union([O.boolean(),O.number().finite(),Ig,Tg]).nullable(),Ag=O.union([O.boolean(),O.number().finite()]).nullable(),Pg=O.object({competitor_avg:O.number().finite(),score_items:O.record(O.string(),kg),penalty_items:O.record(O.string(),Ag),red_texts:O.array(O.string())}).strict(),wg=O.record(qi,Pg),Cg=O.object({key:qi,score:ke,pass_score:ke,gap:ke}),vg=O.object({key:O.string(),title:O.string(),is_redline_option:O.boolean().optional(),score:ke,max_score:Eg,pass_score:ke,passed:O.boolean(),description:O.string()}),Dg=O.object({key:qi,title:O.string(),alias:O.string(),slogan:O.string(),score:ke,max_score:O.literal(100),pass_score:ke,competitor_average:ke,status:O.enum(["reached","near","not_reached"]),status_name:O.enum(["\u8FBE\u6807","\u63A5\u8FD1","\u672A\u8FBE\u6807"]),summary:O.string(),sub_dimensions:O.array(vg),red_texts:O.array(O.string()),redline_hit:O.boolean().optional()}),Og=O.object({id:O.number().int().positive(),task_code:O.string().min(1).max(128),is_sync:O.literal(0),status:O.literal("succeeded"),rules:wg,scores_list:O.object({overview:O.object({pass_scores:O.object({reach:ke,trust:ke,convert:ke,safe:ke}),total_score:ke,total_pass_score:ke,score_gap:ke,competitor_average_score:ke,scoring_criteria_text:O.string().min(1),gap_dimensions:O.array(Cg).max(4),overall_passed:O.boolean(),all_scores_passed:O.boolean(),diagnosis_passed:O.boolean(),commitment_eligible:O.boolean(),safe_redline_hit:O.boolean()}),dimensions:O.array(Dg).length(4)}),created_at:O.string().datetime({offset:!0}),updated_at:O.string().datetime({offset:!0})}).superRefine((e,n)=>{jg(e.scores_list.dimensions)||n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include each canonical score dimension."}),e.scores_list.dimensions.reduce((a,i)=>a+i.sub_dimensions.length,0)!==Rg&&n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include 17 subdimensions in total."});for(let[a,i]of e.scores_list.dimensions.entries()){if(i.redline_hit===void 0)continue;let r=i.sub_dimensions.findIndex(m=>m.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."})}}),wA=M(Og);function jg(e){let n=e.map(s=>s.key);return n.length===Ui.length&&new Set(n).size===Ui.length&&Ui.every(s=>n.includes(s))}var ut={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 e of Object.values(ut))Object.freeze(e);Object.freeze(ut);var DA=Object.freeze(jt.filter(e=>ut[e].length>0)),OA=Object.freeze(jt.filter(e=>ut[e].length===0)),Ng=Object.freeze(["preparing_source","building","artifact_ready","deploying","released"]),Lg="DEPLOYMENT_TRANSITION_INVALID",Fi=class extends Error{constructor(n,s){super(`Invalid deployment transition: ${n} -> ${s}`),this.currentStatus=n,this.nextStatus=s,this.code=Lg,this.name="DeploymentTransitionError"}};function jA(e){return ut[e]}function NA(e){return jt.filter(n=>ut[n].some(s=>s===e))}function Mg(e){return ut[e].length>0}function LA(e){return!Mg(e)}function MA(e,n){if(!ut[e].some(s=>s===n))throw new Fi(e,n);return n}function UA(){return Ng}import{z as U}from"zod";var BA="x-vcp-run-lease-owner",HA=600*1e3,VA=60*1e3,$A=3,YA=2,XA="WORKSPACE_RUN_RESUME_EXHAUSTED",QA="WORKSPACE_CHECK_INCOMPLETE",ZA="WORKSPACE_GENERATION_STOPPED",JA="WORKSPACE_FILL_IN_INTERRUPTED",e0="WORKSPACE_RUN_LEASE_SUPERSEDED",t0="WORKSPACE_RUN_NOT_ACTIVE",n0="FILL_IN_NOT_AVAILABLE",s0="FILL_IN_TARGET_NOT_OMITTED",i0="FILL_IN_TARGET_MODIFIED",Ug=U.object({authMode:U.enum(["disabled-dev","internal-service","oidc"]),user_id:U.string().min(1),external_user_id:U.string().min(1).optional(),email:U.string().min(1).optional(),display_name:U.string().min(1).optional()}).strict(),a0=U.object({run_id:K,lease_owner:U.string().min(1),lease_ms:U.number().int().positive().max(1800*1e3).optional()}).strict(),o0=U.object({status:U.enum(["renewed","not_active","superseded"]),expires_at:U.string().min(1).nullable(),stop_requested:U.boolean()}).strict(),nc=U.object({run_id:K,page_id:U.string().min(1),attempt:U.number().int().positive(),snapshot_id:k,object_key:U.string().min(1),manifest_hash:U.string().min(1),file_paths:U.array(U.string().min(1)).min(1),created_at:U.string().min(1)}).strict(),r0=nc.omit({created_at:!0}).extend({lease_owner:U.string().min(1)}).strict(),c0=U.object({checkpoints:U.array(nc)}).strict(),sc=U.object({kind:U.enum(["page","component","shared"]),target_id:U.string().min(1)}).strict(),m0=U.object({run_id:K,site_id:T,tenant_id:U.string().min(1),run_kind:U.enum(["initial_generation","iteration","landing_page","fill_in"]),status:U.enum(["queued","running","succeeded","failed","cancelled"]),base_snapshot_id:k.nullable(),lease_owner:U.string().min(1).nullable(),resume_count:U.number().int().nonnegative(),stop_requested:U.boolean(),reuse_from_run_id:K.nullable(),source_run_id:K.nullable(),fill_in_targets:U.array(sc),execution_scene:Hs.nullable().optional(),page_template_manifest:io.nullable().optional()}).strict().superRefine((e,n)=>{e.execution_scene==="page_template_create"?(e.run_kind!=="iteration"||!e.page_template_manifest)&&n.addIssue({code:"custom",message:"Page Template execution requires an iteration run with its authoritative manifest"}):e.page_template_manifest&&n.addIssue({code:"custom",message:"Only Page Template execution has a batch manifest"})}),l0=U.object({runs:U.array(U.object({run_id:K,site_id:T,tenant_id:U.string().min(1),run_kind:U.literal("initial_generation"),base_snapshot_id:k,sitemap_id:Ae,resume_count:U.number().int().nonnegative(),lease_owner:U.string().min(1),stop_requested:U.boolean(),resume_principal:Ug}).strict())}).strict(),p0=U.object({site_id:T}).strict(),d0=U.object({status:U.enum(["requested","already_requested","stopped","no_active_run"]),run_id:K.nullable()}).strict(),u0=U.object({ledger:tn.nullable(),source_run_id:K.nullable(),updated_at:U.string().min(1).nullable()}).strict(),_0=U.object({targets:U.array(sc).min(1).max(50),client_run_key:U.string().min(1).max(400)}).strict();import{z as qg}from"zod";var S0=".i18n.json",ms="translation",ic=new Set(["__proto__","constructor","prototype"]);function oc(e){if(!ls(e)||Object.keys(e).length===0)return _t("I18N_ROOT_INVALID","Component i18n resources must be a non-empty object.",[]);for(let[n,s]of Object.entries(e)){if(ic.has(n))return ac([n]);if(!Fg(n))return _t("I18N_LOCALE_INVALID",`Component i18n locale must be canonical BCP-47: ${n}`,[n]);if(!ls(s))return _t("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]!==ms)return _t("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let i=s[ms];if(!ls(i))return _t("I18N_RESOURCE_TREE_INVALID",`Component i18n translation namespace for ${n} must be an object.`,[n,ms]);let r=[{value:i,path:[n,ms]}];for(;r.length>0;){let m=r.pop();for(let[c,p]of Object.entries(m.value)){let I=[...m.path,c];if(ic.has(c))return ac(I);if(typeof p!="string"){if(!ls(p))return _t("I18N_RESOURCE_TREE_INVALID","Component i18n resource leaves must be strings.",I);r.push({value:p,path:I})}}}}return{success:!0,data:e}}function f0(e){let n;try{n=JSON.parse(e)}catch{return _t("I18N_JSON_INVALID","Component i18n resource file must contain valid JSON.",[])}return oc(n)}var b0=qg.custom(e=>oc(e).success,"Invalid component i18n resources.");function Fg(e){try{let n=Intl.getCanonicalLocales(e);return n.length===1&&n[0]===e}catch{return!1}}function ls(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=Object.getPrototypeOf(e);return n===Object.prototype||n===null}function ac(e){return _t("I18N_RESOURCE_KEY_FORBIDDEN",`Component i18n resource key is forbidden: ${e.at(-1)??""}`,e)}function _t(e,n,s){return{success:!1,error:{code:e,message:n,path:s}}}var at="products",Gg=`/${at}`,x0=Gg,E0=`${at} detail`,R0="cms_collection_view",I0="list",T0="detail",Ye={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"}},Kg=new Set(Object.values(Ye).map(e=>e.pageTitle)),Wg=new Set(Object.values(Ye).flatMap(e=>[e.blockLabel,e.detailBlockLabel,e.heroBlockLabel]));function k0(e){let n=e?.trim().toLowerCase()??"";if(n==="zh-tw"||n==="zh-hk"||n==="zh-mo")return Ye.zhHant;if(n.startsWith("zh"))return Ye.zhHans;switch(n.split("-")[0]){case"de":return Ye.de;case"fr":return Ye.fr;case"es":return Ye.es;case"ja":return Ye.ja;case"ko":return Ye.ko;case"en":default:return Ye.en}}function A0(e){return Kg.has(e.trim())}function P0(e){return Wg.has(e.trim())}import{z as qt}from"zod";var D0="SITE_HAS_ACTIVE_SUBSITES",O0="SITE_HAS_SUBSITES",zg=qt.object({site_id:T,name:qt.string().min(1),mount_path:qt.string().min(1),archived_at:qt.string().nullable()}),j0=qt.object({subsites:qt.array(zg)});import{z as ye}from"zod";var U0=ye.object({key:ye.string().min(1),composition:ce}).strict(),ds=ye.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),Bg=ye.enum(["direct","proxy","upstream","readonly","unsupported"]),Hg=ye.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),ps=ye.object({mode:Bg,reasonCode:ye.string().min(1).optional()}),Vg=ye.object({kind:Hg,message:ye.string().min(1)}),us=ye.object({composition:q,key:ye.string().min(1),canUpdateText:ye.boolean(),canInsertChild:ye.boolean(),canMove:ye.boolean(),canRemove:ye.boolean(),editModes:ye.object({updateText:ps.optional(),insertChild:ps.optional(),move:ps.optional(),remove:ps.optional()}).optional(),constraints:ye.array(Vg)}).strict();import{z as H}from"zod";var B0=H.discriminatedUnion("type",[H.object({type:H.literal("site-edit.document.changed"),siteId:T,snapshotId:k,composition:q,version:H.number().int().nonnegative(),at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.operation.planned"),siteId:T,operationId:H.string().min(1),baseSnapshotId:k,composition:q,changedFiles:H.array(H.string().min(1)),at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.operation.completed"),siteId:T,composition:q,result:Ii,at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.operation.failed"),siteId:T,composition:q,requestId:H.string().min(1),error:Dr,at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.capability.changed"),siteId:T,composition:q,keys:H.array(H.string().min(1)),at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.graph.invalidated"),siteId:T,composition:q,at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.graph.ready"),siteId:T,composition:q,version:H.number().int().nonnegative(),at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.graph.error"),siteId:T,composition:q,message:H.string().min(1),at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.snapshot.changed"),siteId:T,composition:q,snapshotId:k,previousSnapshotId:H.string().min(1).nullable(),at:H.string().min(1)}).strict()]);import{z as se}from"zod";var Y0="durable-history-v1",_s=se.object({initiatingComposition:q.optional(),affectedCompositions:se.array(q)}).strict(),X0=se.enum(["writable","read-only-recovery","unavailable"]),$g=se.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),Yg=se.object({code:$g,message:se.string().min(1),occurredAt:se.iso.datetime().optional()}).strict(),Xg=se.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),rc={revision:se.number().int().nonnegative(),undoDepth:se.number().int().nonnegative(),redoDepth:se.number().int().nonnegative()},Qg=se.object({mode:se.literal("writable"),composition:q,...rc,canUndo:se.boolean(),canRedo:se.boolean(),provenance:_s.optional()}).strict().superRefine((e,n)=>{e.canUndo!==e.undoDepth>0&&n.addIssue({code:"custom",path:["canUndo"],message:"canUndo must reflect undoDepth."}),e.canRedo!==e.redoDepth>0&&n.addIssue({code:"custom",path:["canRedo"],message:"canRedo must reflect redoDepth."})}),Zg=se.object({mode:se.literal("read-only-recovery"),composition:q,...rc,canUndo:se.literal(!1),canRedo:se.literal(!1),recoveryDiagnostic:Yg,provenance:_s.optional()}).strict(),Jg=se.object({mode:se.literal("unavailable"),composition:q,revision:se.literal(0),undoDepth:se.literal(0),redoDepth:se.literal(0),canUndo:se.literal(!1),canRedo:se.literal(!1),reason:Xg,provenance:_s.optional()}).strict(),eh=se.discriminatedUnion("mode",[Qg,Zg,Jg]),Q0=se.object({composition:q,status:eh,provenance:_s}).strict();import{z as W}from"zod";var gs=W.enum(["api-field","cms-field","i18n-message","config-entry"]),Gi=W.object({kind:W.enum(["jsx-node","value-path","route-export","external-entry"]),file:W.string().min(1).optional(),isProxy:W.boolean(),displayPath:W.string().min(1).optional(),sourceType:gs.optional(),sourceId:W.string().min(1).optional()}),th=W.discriminatedUnion("status",[W.object({status:W.literal("resolved"),value:Pt}).strict(),W.object({status:W.literal("undefined")}).strict(),W.object({status:W.literal("unresolved")}).strict()]),nh=W.object({kind:W.enum(["literal","boolean-shorthand","expression","binding","repeat-template"]),raw:W.string().optional()}).strict(),sh=W.object({name:W.string().min(1),source:nh,resolution:th,editMode:W.enum(["direct","proxy","upstream","readonly","unsupported"]),sourceScope:W.enum(["node","repeat-item","repeat-template"]),allowedWriteScopes:W.array(W.enum(["selection","template"])),effectiveWriteTarget:Gi.optional(),diagnostics:W.array(W.object({code:W.string().min(1),message:W.string().min(1)}).strict())}).strict(),ih=W.object({raw:W.string().min(1),sourceRange:tt,order:W.number().int().nonnegative(),diagnostics:W.array(W.object({code:W.string().min(1),message:W.string().min(1)}).strict())}).strict(),ah=W.object({selection:W.enum(["direct","materialize","unsupported"]),template:W.enum(["direct","unsupported"])}).strict(),Ki=W.object({documentVersion:W.number().int().nonnegative(),selectionRef:Ut.optional(),items:W.array(sh),spreads:W.array(ih),creation:ah}).strict().superRefine((e,n)=>{let s=e.selectionRef;s&&s.instanceIndex!==void 0&&s.instanceCount!==void 0&&s.instanceIndex>=s.instanceCount&&n.addIssue({code:"custom",path:["selectionRef","instanceIndex"],message:"instanceIndex must be smaller than instanceCount"})});import{z as xe}from"zod";var oh=xe.string().min(1).refine(e=>!e.startsWith("/")&&!e.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),rh=xe.string().regex(/^sha256:[a-f0-9]{64}$/),ch=xe.object({path:oh,operation:xe.enum(["create","update","delete"]),expectedHash:rh.optional(),fullContent:xe.string().optional()}).superRefine((e,n)=>{e.operation==="delete"&&e.fullContent!==void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"delete patches must not include fullContent"}),e.operation!=="delete"&&e.fullContent===void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"create/update patches must include fullContent"})}),mh=xe.object({siteId:T,baseSnapshotId:k,operationId:xe.string().min(1),reason:xe.string().min(1),patches:xe.array(ch).min(1),changedCompositions:xe.array(q),changedRouteIds:xe.array(xe.string().min(1)).optional(),diagnostics:xe.array(xe.object({code:xe.string().min(1),message:xe.string().min(1),path:xe.string().min(1).optional()})).default([])}).strict().superRefine((e,n)=>{let s=new Set;for(let[i,r]of e.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(e.changedCompositions.map(i=>i.routeId))];e.changedRouteIds!==void 0&&(e.changedRouteIds.length!==a.length||e.changedRouteIds.some((i,r)=>i!==a[r]))&&n.addIssue({code:"custom",path:["changedRouteIds"],message:"changedRouteIds must be the stable deduplicated route projection of changedCompositions."})}),rP=mh.transform(e=>({...e,changedRouteIds:[...new Set(e.changedCompositions.map(n=>n.routeId))]}));var Wi="::repeat-item#";function lh(e,n){return`${e}${Wi}${n}`}function mP(e,n){return n.reduce((s,a)=>lh(s,a),e)}function ph(e){if(typeof e!="string"||e.length===0)return null;let n=[],s=e;for(;;){let a=s.lastIndexOf(Wi);if(a<0)break;let i=Number(s.slice(a+Wi.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 lP(e){return ph(e)?.baseKey??e??null}import{z as l}from"zod";import{z as Pe}from"zod";var dh=Pe.object({placementKey:Pe.string().min(1),placementUnitKey:Pe.string().min(1),relation:Pe.enum(["before","after","prepend","append"])}).strict(),uh=Pe.object({status:Pe.literal("supported"),containerKey:Pe.string().min(1),hasBusinessMembers:Pe.boolean(),placementUnitKeys:Pe.array(Pe.string().min(1)),placements:Pe.array(dh)}).strict().superRefine((e,n)=>{let s=new Set(e.placementUnitKeys);s.size!==e.placementUnitKeys.length&&n.addIssue({code:"custom",path:["placementUnitKeys"],message:"Render page composition placement unit keys must be unique."});let a=new Set;e.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."})})}),_h=Pe.object({status:Pe.literal("unsupported"),reason:ss,diagnostics:Pe.array(un)}).strict(),cc=Pe.discriminatedUnion("status",[uh,_h]);var gh=l.object({canUpdateText:l.boolean(),canInsertChild:l.boolean(),canMove:l.boolean(),canRemove:l.boolean()}),mc=l.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),hh=l.enum(["cms-field","api-field"]),Sh=l.enum(["text","attribute","richtext","repeat-region","conditional-region","component-prop"]),fh=l.enum(["exact","safe-derived","partial","unknown"]),bh=l.object({file:l.string().min(1),symbol:l.string().min(1).optional(),reason:l.string().min(1)}),yh=l.object({sourceKind:mc,sourceType:hh,endpointPattern:l.string().min(1).optional(),operation:l.string().min(1).optional(),collection:l.string().min(1).optional(),fieldPath:l.string().min(1).optional(),valuePath:l.string().min(1).optional(),targetKind:Sh,targetName:l.string().min(1),confidence:fh,readonly:l.literal(!0),evidence:l.array(bh)}),lc=l.object({hasDynamicData:l.boolean(),bindings:l.array(yh)}),pc=l.object({hasDynamicData:l.boolean(),sourceKinds:l.array(mc),collections:l.array(l.string().min(1)).min(1).optional(),primaryEndpoint:l.string().min(1).optional(),primaryCollection:l.string().min(1).optional(),primaryFieldPath:l.string().min(1).optional()}),xh=l.object({key:l.string().min(1),pageCompositionUnitKey:l.string().min(1).optional(),operationSummary:gh,dynamicDataSummary:pc.optional()}).strict(),AP=l.object({composition:ce}).strict(),PP=l.object({key:l.string().min(1),composition:ce,selectionRef:Ut.optional()}).strict(),wP=l.object({siteId:T,snapshotId:k,composition:q,version:l.number().int().nonnegative(),entries:l.array(xh),pageComposition:cc}).strict(),dc=l.object({kind:l.enum(["literal","binding","imported-binding","repeat-template"]),file:l.string().min(1),expression:l.string().min(1),bindingName:l.string().min(1).optional(),path:l.array(l.union([l.string(),l.number()])).optional()}),zi=l.object({index:l.number().int().min(0),value:l.string(),editable:l.boolean(),source:dc.nullable()}),bn=l.object({key:l.string().min(1),label:l.string().min(1),tag:l.string().min(1)}),CP=l.object({composition:q,key:l.string().min(1),canUpdateText:l.boolean(),canInsertChild:l.boolean(),canMove:l.boolean(),canRemove:l.boolean(),boundaryKind:ds.nullable(),isOpaque:l.boolean()}).strict(),Eh=l.object({kind:l.enum(["jsx-node","component-proxy","value-binding","route-export"]),file:l.string().min(1),componentName:l.string().min(1),isProxy:l.boolean()}),uc=l.object({kind:l.union([l.enum(["jsx-literal","component-prop","binding","imported-binding","object-field","array-item","repeat-template","conditional-branch"]),gs]),file:l.string().min(1),displayPath:l.string().min(1),externalSource:l.object({sourceType:gs,sourceId:l.string().min(1),adapterId:l.string().min(1).optional()}).optional()}),Rh=l.object({kind:uc.shape.kind,file:l.string().min(1),displayName:l.string().min(1),canEditHere:l.boolean()}),yn=l.object({finalSource:uc.nullable(),chain:l.array(Rh),confidence:l.enum(["exact","safe-derived","partial","unknown"]),editMode:l.enum(["direct","proxy","upstream","readonly","unsupported"]),diagnostics:l.array(l.object({code:l.string().min(1),message:l.string().min(1)}))}),Ih=l.object({kind:l.literal("css-style-model"),properties:l.array(l.object({property:Ar,value:l.union([l.string(),l.number(),l.boolean(),l.null()]),resolvedValue:l.union([l.string(),l.number(),l.boolean(),l.null()]).optional(),breakpoint:wr.optional(),state:Pr.optional(),variants:l.array(l.string().min(1)).optional(),options:l.array(l.union([l.string(),l.number()])).optional(),editable:l.boolean(),diagnostics:l.array(l.object({code:l.string().min(1),message:l.string().min(1)})).optional(),operationBoundary:l.array(_n).optional()}))}),vP=l.union([l.record(l.string(),l.unknown()),Ih]),_c=l.object({kind:l.literal("class-name-source"),className:l.string(),sourceKind:l.enum(["missing","static-attribute","static-expression","dynamic-expression"]),editable:l.boolean(),operationBoundary:l.array(_n),sourcePath:l.string().min(1).optional(),diagnostics:l.array(l.object({code:l.enum(["missing-class-name","dynamic-binding","non-string-binding"]),message:l.string().min(1)})).optional()}),Th=l.object({startLine:l.number().int().positive(),startColumn:l.number().int().nonnegative(),endLine:l.number().int().positive(),endColumn:l.number().int().nonnegative()}),Bi=l.object({sourceFile:l.string().min(1),componentName:l.string().min(1),openingElementRange:Th,structuralPath:l.string().min(1),textPreview:l.string().min(1).optional()}),DP=l.object({composition:q,key:l.string().min(1),tag:l.string().min(1),componentName:l.string().min(1),sourceFile:l.string().min(1),sourceLocator:Bi.optional(),label:l.string().min(1),capabilities:us,writeTarget:Eh,effectiveWriteTarget:Gi.optional(),provenanceChain:yn.optional(),componentSemantic:l.record(l.string(),l.unknown()).optional(),contentModel:l.record(l.string(),l.unknown()).optional(),mediaModel:l.record(l.string(),l.unknown()).optional(),styleSource:_c.optional(),conditional:l.record(l.string(),l.unknown()).optional(),dynamicData:lc.optional(),properties:Ki.optional(),textSegments:l.array(zi),boundaryKind:ds.nullable(),isOpaque:l.boolean(),ancestors:l.array(bn),children:l.array(bn),siblings:l.array(bn)}).strict(),OP=l.object({composition:q,key:l.string().min(1),tag:l.string().min(1),label:l.string().min(1),sourceLocator:Bi.optional(),capabilities:l.object({constraints:us.shape.constraints}),isOpaque:l.boolean(),provenanceChain:l.object({editMode:yn.shape.editMode,diagnostics:yn.shape.diagnostics}).optional(),dynamicDataSummary:pc.optional(),ancestors:l.array(bn)}).strict(),jP=l.object({composition:q,key:l.string().min(1),tag:l.string().min(1),label:l.string().min(1),sourceLocator:Bi.optional(),isOpaque:l.boolean(),ancestors:l.array(bn),componentName:l.string().min(1),sourceFile:l.string().min(1),capabilities:us,provenanceChain:l.object({editMode:yn.shape.editMode,diagnostics:yn.shape.diagnostics}).optional(),textSegments:l.array(l.object({index:zi.shape.index,editable:zi.shape.editable,sourceKind:dc.shape.kind.nullable()})),dynamicData:lc.optional(),properties:Ki.optional(),boundaryKind:ds.nullable()}).strict(),NP=l.object({composition:q,key:l.string().min(1),mediaModel:l.record(l.string(),l.unknown()).optional(),styleSource:_c.optional()}).strict();var kh=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Ah=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],Ph=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],wh=new Set(kh),Ch=new Set(Ah),vh=new Set(Ph),Dh={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function MP(e){return wh.has(Hi(e))}function Oh(e){return Ch.has(Hi(e))}function jh(e){return vh.has(Hi(e))}function UP(e){let{operationSummary:n}=e;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:e.fallbackMode!=="preview"?{...Dh}:{canUpdateText:jh(e.tagName),canInsertChild:Oh(e.tagName),canMove:!1,canRemove:!1}}function Hi(e){return e?.trim().toLowerCase()??""}import{z as Nh}from"zod";var WP=Nh.object({composition:ce,mutationContext:pn.optional()}).strict();var BP={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_RUN_INPUT_REQUIRED:"Nothing to work on: the request had no instruction, so no edit was started. Describe the change you want and send it.",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_CHECK_INCOMPLETE:"The check couldn't complete, so no page was delivered this round. Please regenerate the site.",WORKSPACE_RUN_RESUME_EXHAUSTED:"Generation was interrupted several times and stopped. Everything already saved is kept; you can regenerate the missing pages.",WORKSPACE_GENERATION_STOPPED:"You stopped this generation before any page was ready. Nothing was lost \u2014 start it again when you want.",WORKSPACE_FILL_IN_INTERRUPTED:"The fill-in run was interrupted and stopped. Your site is unchanged; select the targets again to retry.",WORKSPACE_RUN_LEASE_SUPERSEDED:"Another attempt took over this run, so this one stopped. Reload to see the current progress.",FILL_IN_NOT_AVAILABLE:"Fill-in is available after the site has been generated.",FILL_IN_TARGET_NOT_OMITTED:"One of the selected items is no longer listed as missing. Reload the omissions list and try again.",FILL_IN_TARGET_MODIFIED:"One of the selected items was changed or removed after generation, so it was not filled in. Your edits are kept.",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.",WORKSPACE_THREAD_NOT_FOUND:"That conversation no longer exists. Switching back to the default conversation.",WORKSPACE_THREAD_ARCHIVED:"This conversation is archived. Start a new one to continue.",WORKSPACE_THREAD_BUSY:"This conversation is still running. Wait for it to finish before archiving.",WORKSPACE_THREAD_READ_ONLY:"Background conversations are read-only here.",WORKSPACE_THREAD_INVALID:"This conversation can't accept new requests right now. Refresh and 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."},Lh=["WORKSPACE_RUN_CANCELLED","WORKSPACE_GENERATION_STOPPED"],Mh=new Set(Lh);function HP(e){return typeof e=="string"&&Mh.has(e)}var VP={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."},$P={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},YP={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var gc="0.10.5",QP="x-vcp-edit-engine-version",ZP="x-vcp-edit-engine-version-source",Vi=class extends Error{constructor(n="Invalid edit-engine version."){super(n),this.code="EDIT_ENGINE_VERSION_INVALID",this.name="EditEngineVersionParseError"}},Uh=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/;function qh(e){return Uh.test(e)}function Fh(e){if(typeof e!="string"||!qh(e))throw new Vi;return e}function JP(e){return e==null?{version:gc,source:"fallback_current"}:{version:Fh(e),source:"explicit"}}function ew(){return{version:gc,source:"system_current"}}import{z as ze}from"zod";var Gh=200,Kh=200;function Wh(e){let n=e.indexOf(":");if(n<=0)return null;let s=e.slice(0,n).trim(),a=e.slice(n+1).trim();return s.length===0||a.length===0?null:{source:s,target:a}}var zh=ze.string().min(3).max(Gh).refine(e=>Wh(e)!==null,{message:'glossary entries must be "source:target" pairs split on a half-width colon, e.g. "\u7C73:Rice"'}),sw=ze.array(zh).max(Kh),iw=ze.object({website_name:ze.string().min(1).max(200),website_industry:ze.string().min(1).max(200).optional(),website_description:ze.string().min(1).max(1e3).optional()}),Bh=ze.enum(["regional","fonts_only"]),hs=ze.string().regex(/^#[0-9a-fA-F]{6}$/,'color must be a "#rrggbb" value'),Hh=ze.object({primary:hs.optional(),accent:hs.optional(),foreground:hs.optional(),neutral:hs.optional()}),Vh=600,aw=ze.object({mode:Bh.default("regional"),seeds:Hh.optional(),note:ze.string().min(1).max(Vh).optional()}),ow={mode:"regional"};function rw(e){return e===void 0?!1:Object.values(e).some(n=>typeof n=="string"&&n.length>0)}import{z as Oe}from"zod";var $h=Oe.string().trim().min(1),Ft=Oe.string().uuid(),Yh=Oe.string().min(1).max(2048).refine(e=>e.startsWith("/")||e.includes("\\")?!1:e.split("/").every(n=>n.length>0&&n!=="."&&n!==".."),"object_key must be a relative snapshot store path without empty, '.' or '..' segments"),hc=Oe.object({snapshot_id:Ft,object_key:Yh}),lw=Oe.object({tenant_id:$h,parent_site_id:Ft,subsite_site_id:Ft,base:hc,target:hc}),pw=Oe.object({subsite_site_id:Ft,pending_pages:Oe.array(Oe.string().min(1)),hash_diverged_count:Oe.number().int().nonnegative(),child_only_count:Oe.number().int().nonnegative(),base_snapshot_id:Ft,target_snapshot_id:Ft}),Xh=Oe.enum(["SUBSITE_DIFF_REQUEST_INVALID","SUBSITE_DIFF_STORE_NOT_CONFIGURED","SUBSITE_DIFF_MANIFEST_MISSING","SUBSITE_DIFF_MANIFEST_INVALID"]),dw=Oe.object({error_code:Xh,message:Oe.string().min(1),side:Oe.enum(["base","target"]).optional()});import{z as _e}from"zod";var hw=_e.object({tenant_id:_e.string().min(1),site_id:T,snapshot_id:k,manifest_hash:_e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:_e.string().min(1).max(2048),page_slug:_e.string().max(512).optional()}),Sw=_e.object({site_id:T,snapshot_id:k,unit_count:_e.number().int().nonnegative(),file_count:_e.number().int().nonnegative(),markdown:_e.string().min(1),page_slug:_e.string().optional(),page_file:_e.string().optional(),entries:_e.array(_e.object({id:_e.string().min(1),file_path:_e.string().min(1),line:_e.number().int().nullable(),kind:_e.string().min(1),text:_e.string(),media_key:_e.string().optional()})).optional()});import{z as Qh}from"zod";var Zh=/^\/[a-z0-9][a-z0-9-]{0,30}$/,Jh=Object.freeze(["api","_next","assets","static","robots.txt","sitemap.xml",".well-known"]),eS=new Set(Jh);function tS(e){return eS.has(e)}var yw=Qh.string().regex(Zh).refine(e=>!tS(e.slice(1)),{message:"mount_path must not use a reserved segment (api, _next, assets, static, robots.txt, sitemap.xml, .well-known)"});import{z as me}from"zod";var nS=me.enum(["active","paused","blocked"]),Sc=me.enum(["typecheck_failed","health_failed","validation_failed"]),sS={status:nS,attempts:me.number().int().nonnegative(),attempted_template_version:We.nullable(),last_error_code:Sc.nullable()},Gt=me.object(sS).strict(),Ss=me.object({template_id:me.string().trim().min(1),target_template_version:We}).strict(),Iw=Ss,iS=me.discriminatedUnion("action",[me.object({action:me.literal("proceed"),state:Gt.extend({status:me.literal("active")})}).strict(),me.object({action:me.literal("skip_not_newer"),state:Gt.extend({status:me.literal("active")})}).strict(),me.object({action:me.literal("skip_paused"),state:Gt.extend({status:me.literal("paused")})}).strict(),me.object({action:me.literal("skip_blocked"),state:Gt.extend({status:me.literal("blocked")})}).strict()]),Tw=Ss,kw=iS,Aw=Ss.extend({error_code:Sc}),Pw=me.object({state:Gt}).strict(),ww=Ss,Cw=me.object({state:Gt}).strict();import{z}from"zod";var aS=744*60*60*1e3,oS=z.enum(["eligible","fast_path","upgraded","skipped","lock_skipped","cas_aborted","validation_failed","blocked","paused"]),rS=z.enum(["typecheck","build","health","validation"]),cS=z.enum(["not_attempted","promoted","aborted"]),Nw=z.object({template_id:z.string().trim().min(1).max(128),from_version:We.nullable(),to_version:We,outcome:oS,attempt:z.number().int().nonnegative().max(2147483647),duration_ms:z.number().int().nonnegative().max(2147483647),replaced_group_count:z.number().int().nonnegative().max(2147483647),skipped_group_count:z.number().int().nonnegative().max(2147483647),validation_stage:rS.nullable(),cas_outcome:cS.nullable()}).strict(),Lw=z.object({recorded:z.literal(!0)}).strict(),fc=z.object({from:z.iso.datetime(),to:z.iso.datetime()}).strict().refine(({from:e,to:n})=>Date.parse(e)<Date.parse(n),{message:"from must be earlier than to",path:["to"]}).refine(({from:e,to:n})=>Date.parse(n)-Date.parse(e)<=aS,{message:"report window must not exceed 31 days",path:["to"]}),Mw=fc,mS=z.object({eligible:z.number().int().nonnegative(),fast_path:z.number().int().nonnegative(),upgraded:z.number().int().nonnegative(),skipped:z.number().int().nonnegative(),lock_skipped:z.number().int().nonnegative(),cas_aborted:z.number().int().nonnegative(),validation_failed:z.number().int().nonnegative(),blocked:z.number().int().nonnegative(),paused:z.number().int().nonnegative()}).strict(),Uw=z.object({window:fc,outcome_counts:mS,current_state_counts:z.object({blocked:z.number().int().nonnegative(),paused:z.number().int().nonnegative()}).strict(),duration_ms:z.object({p50:z.number().int().nonnegative().nullable(),p95:z.number().int().nonnegative().nullable(),sample_count:z.number().int().nonnegative()}).strict()}).strict(),qw=z.object({older_than:z.iso.datetime(),limit:z.coerce.number().int().min(1).max(200).default(50),include_candidates:z.enum(["true","false"]).default("false").transform(e=>e==="true")}).strict(),lS=z.object({site_id:T,snapshot_id:k,status:z.enum(["candidate","deleting"]),created_at:z.iso.datetime()}).strict(),Fw=z.object({snapshots:z.array(lS)}).strict();import{z as ot}from"zod";var pS=ot.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"]),dS=ot.object({status:ot.literal("ready"),preview_url:ot.string().url()}).strict(),uS=ot.object({status:ot.literal("failed"),code:pS,message:ot.string().min(1),retryable:ot.boolean()}).strict(),Ww=ot.discriminatedUnion("status",[dS,uS]);import{z as de}from"zod";var Yw="build-context.json",Xw=2e5,bc=de.string().regex(/^sha256:[a-f0-9]{64}$/u),yc=1e3;function _S(e){return Array.from(e).length<=yc}var gS=de.object({kind:de.enum(["customer_materials","website_scan_diagnosis","committed_strategy"]),digest:bc}).strict(),hS=de.object({schema_version:de.literal(1),flow_type:is,sources:de.array(gS).min(2).max(2)}).strict().superRefine((e,n)=>{let s=new Set(e.sources.map(i=>i.kind)),a=e.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."})}),SS=de.object({schema_version:de.literal(1),seed:bc.optional(),cms_settings:de.object({main_products:de.string().trim().min(1).refine(_S,{message:`main_products must contain at most ${yc} characters`}).optional()}).strict().optional(),provenance:hS.optional()}).strict(),fS=de.object({schema_version:de.literal(1),site_id:T,workflow_id:Ve,brief:de.string().min(1),source:de.enum(["business_provider","mock"]),payload:SS}).strict().superRefine((e,n)=>{e.source==="business_provider"&&!e.payload.provenance&&n.addIssue({code:"custom",path:["payload","provenance"],message:"Business site-build context requires persisted provenance."})}),Qw=de.object({source_snapshot_id:k,source_run_id:K,build_context:fS,page_slugs:de.array(de.string().min(1)).optional()}).strict(),Zw=de.object({disposition:de.enum(["reused","rebased"]),snapshot_id:k}).strict(),bS=de.object({snapshot:wi,workspace_run_id:K.nullable()}).strict(),Jw=M(bS);import{z as Xe}from"zod";import{z as Me}from"zod";import{z as le}from"zod";import{z as yS}from"zod";var xS=["company_profile","product_manual","product_list","customer_case","product_help","qualification","industry_material"],xc=yS.enum(xS);var Ec=le.enum(["pending","running","ready","failed","missing"]),ES=le.object({task_id:le.string().min(1).max(500),status:Ec}).strict(),aC=le.object({items:le.array(ES).max(100)}).strict(),xn=le.string().trim().min(1).max(255),oC=le.object({knowledge_site_id:xn,source_ids:le.array(xn).min(1).max(200)}).strict().superRefine((e,n)=>{new Set(e.source_ids).size!==e.source_ids.length&&n.addIssue({code:"custom",message:"Knowledge source IDs must be unique.",path:["source_ids"]})}),RS=le.object({source_file_id:xn,category_code:xc.nullable(),category_confirmed:le.boolean(),status:Ec}).strict(),rC=le.object({ready:le.boolean(),files:le.array(RS),counts:le.object({total:le.number().int().nonnegative(),pending:le.number().int().nonnegative(),running:le.number().int().nonnegative(),ready:le.number().int().nonnegative(),failed:le.number().int().nonnegative(),missing:le.number().int().nonnegative(),unclassified:le.number().int().nonnegative()}).strict()}).strict();var ge=e=>Me.string().trim().max(e),Rc=Me.array(Me.string().trim().min(1).max(120)).max(20),$i=Me.object({company_name:Me.string().trim().min(1).max(200),brand_name:ge(200),primary_products:Me.string().trim().min(1).max(1e3),industry:ge(200),applications:ge(1e3),business_summary:ge(2e3),registered_capital:ge(200).default(""),legal_representative:ge(200).default(""),target_markets:Rc,customer_industries:ge(1e3),customer_roles:ge(1e3),buying_scenarios:ge(2e3),differentiators:ge(2e3),competitors:ge(1e3),trust_proof:ge(2e3),customer_cases:ge(3e3),channels:Rc,expected_domain:ge(255),brand_tone:ge(500),contact_name:ge(200),contact_info:ge(500),timezone:ge(100),launch_timing:ge(200),input_source_ids:Me.array(xn).max(50)}).strict(),IS=Me.enum(["draft","submitted"]),Yi=$i.extend({id:V,tenant_id:Me.string().min(1),site_id:T,workflow_id:Ve,status:IS,submitted_at:Me.string().min(1).nullable(),created_at:Me.string().min(1),updated_at:Me.string().min(1)}).strict(),uC=M(Yi),_C=M(Yi),gC=M(Yi.nullable());var yC=cs.extend({expected_current_node:Xe.literal("website_scan"),type:Xe.literal("existing_site"),result:cs.shape.result.extend({website:Xe.string().url(),scan_cards:Xe.partialRecord(Xr,Li).refine(e=>Object.keys(e).length>0,{message:"At least one recognized scan card is required."})}).strict()}).strict(),xC=Xe.object({expected_current_node:Xe.literal("customer_materials"),materials:$i}).strict(),EC=Xe.object({expected_current_node:Xe.literal("diagnosis")}).strict(),RC=Xe.object({expected_current_node:Xe.literal("strategy")}).strict();import{z as C}from"zod";var En={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}},TS={heading:"Inter",body:"Inter"},Ic=En.Inter;function fs(e){return e.trim().replace(/\s+/g,"_").toLowerCase()}var Pc=(()=>{let e=new Map;for(let[n,s]of Object.entries(En))e.set(fs(n),s),e.set(fs(s.import),s);return e})();function kS(e){return typeof e!="string"||e.trim().length===0?Ic:Pc.get(fs(e))??Ic}var AS=(()=>{let e=new Map;for(let[n,s]of Object.entries(En))e.set(s.import,n);return e})();function PS(e){if(typeof e!="string"||e.trim().length===0)return"Inter";let n=Pc.get(fs(e));return n?AS.get(n.import)??"Inter":"Inter"}var wS=Object.keys(En),Tc='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',kc='Georgia, "Times New Roman", serif',Ac='"SFMono-Regular", Consolas, monospace',CS=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),vS=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(e=>e.toLowerCase())),DS=new Set(["JetBrains Mono","IBM Plex Mono"].map(e=>e.toLowerCase()));function OS(e){let n=e.toLowerCase();return DS.has(n)||n.includes("mono")?"mono":vS.has(n)||n.includes("serif")?"serif":"sans"}function Xi(e,n){let s=p=>(p??"").trim().replace(/^['"]|['"]$/g,"").replace(/[^A-Za-z0-9 _-]+/g,"").trim().slice(0,60),a=s(e),i=s(n),r=p=>CS.has(p.toLowerCase());if(a&&r(a)){let p=a.toLowerCase();return p.includes("mono")?Ac:p.includes("serif")?kc:Tc}let m=a;m||(m=r(i)?"":i),m||(m="Inter");let c=OS(m);return c==="mono"?`"${m}", ${Ac}`:c==="serif"?`"${m}", ${kc}`:`"${m}", ${Tc}`}function jS(e){return{"--site-font-sans":Xi(e?.body,"Inter"),"--site-font-heading":Xi(e?.heading,e?.body??"Inter")}}var Qi=["archivo-inter","playfair-source-sans","space-grotesk-manrope","fraunces-libre-franklin","noto-serif-sc-noto-sans-sc","noto-sans-sc"],wc=[{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 Cc(e){let n=wc.find(s=>s.id===e);if(!n)throw new Error(`Unknown font pairing: ${e}`);return n}var Zi=["compact","comfortable","airy"],vc=["none","sm","md","lg","xl"],Dc="lg",Ji=["subtle","moderate","expressive"],NS=[{id:"subtle",motionLevel:"subtle"},{id:"moderate",motionLevel:"moderate"},{id:"expressive",motionLevel:"expressive"}];function Oc(e){let n=NS.find(s=>s.id===e);if(!n)throw new Error(`Unknown motion preset: ${e}`);return n}var jc=["ocean","forest","clay","violet","graphite","crimson"],Nc=["ai-forest","ai-navy","ai-steel"],Lc=/^gen-[0-9a-f]{8}$/,ea=[{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"}],ta=[{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 AC(e){let n=ta.find(s=>s.id===e);if(!n)throw new Error(`Unknown theme preset: ${e}`);return n}function Mc(e){return ta.find(n=>n.id===e)?.radius??ea.find(n=>n.id===e)?.radius}var na=C.string().regex(/^#[0-9A-F]{6}$/i),Rn=C.string().trim().min(1).max(500),Uc=C.string().datetime({offset:!0}),LS=C.enum(jc),MS=C.enum(Nc),US=C.string().regex(Lc),In=C.union([LS,MS,US]),Tn=C.enum(Qi),kn=C.enum(Ji),An=C.enum(Zi),bs=C.enum(vc),qc=300,qS=C.string().trim().min(1).max(qc),ys=C.object({primary:na,accent:na,foreground:na}).strict(),FS=C.object({id:In,rank:C.number().int().min(1).max(3),name:C.string().trim().min(1).max(120),description:C.string().trim().min(1).max(240),color_seeds:ys,surface_mode:C.enum(["light","dark"]),radius:bs,font_pairing_id:Tn,motion_preset_id:kn,density:An,reason:Rn}).strict(),Fc=C.object({name:C.string().trim().min(1).max(120),description:C.string().trim().min(1).max(240),reason:Rn,color_seeds:ys,surface_mode:C.enum(["light","dark"]),radius:bs,font_pairing_id:Tn,motion_preset_id:kn,density:An}).strict(),Gc=C.object({version:C.number().int().min(1),recommendation_id:C.string().uuid(),theme_preset_id:In,color_seeds:ys,surface_mode:C.enum(["light","dark"]),font_pairing_id:Tn,motion_preset_id:kn,density:An,radius:bs.optional(),aesthetic_note:qS.optional(),updated_at:Uc}).strict(),GS=C.object({id:C.string().uuid(),version:C.number().int().min(1),catalog_version:C.string().trim().min(1).max(80),source:C.object({mode:C.enum(["ai","fallback"]),fallback_reason:C.string().trim().min(1).max(80).nullable()}).strict(),inputs:C.object({industry:C.string().trim().min(1).max(160).optional(),site_language:C.string().trim().min(2).max(35),owner_locale:fe.optional(),strategy_version:C.number().int().min(1),input_digest:C.string().regex(/^sha256:[a-f0-9]{64}$/)}).strict(),theme:C.object({recommended_id:In,candidate_ids:C.array(In).length(3),candidates:C.array(FS).length(3)}).strict().superRefine((e,n)=>{e.recommended_id!==e.candidate_ids[0]&&n.addIssue({code:"custom",path:["recommended_id"],message:"recommended_id must be the first candidate"}),e.candidates.some((s,a)=>s.id!==e.candidate_ids[a]||s.rank!==a+1)&&n.addIssue({code:"custom",path:["candidates"],message:"Candidates must follow candidate_ids order."})}),font:C.object({recommended_id:Tn,reason:Rn}).strict(),motion:C.object({recommended_id:kn,reason:Rn}).strict(),density:C.object({recommended_id:An,reason:Rn}).strict(),conversion:Rt.optional(),generated_at:Uc}).strict(),UC=C.object({force_refresh:C.boolean().optional()}).strict(),qC=C.object({request_id:C.string().trim().min(1).max(160),site_id:T,cached:C.boolean(),recommendation:GS,selection:Gc}).strict(),FC=C.object({recommendation_id:C.string().uuid(),expected_version:C.number().int().min(1),theme_preset_id:In,color_seeds:ys,surface_mode:C.enum(["light","dark"]),font_pairing_id:Tn,motion_preset_id:kn,density:An,radius:bs.optional(),aesthetic_note:C.string().trim().max(qc).optional()}).strict(),GC=C.object({selection:Gc}).strict(),KC=C.object({tenant_id:C.string().trim().min(1).max(160),site_id:T,site_language:C.string().trim().min(2).max(35),owner_locale:fe,industry:C.string().trim().min(1).max(160).optional(),strategy_version_id:C.string().uuid(),strategy_version:C.number().int().min(1),strategy_checksum:C.string().regex(/^[a-f0-9]{64}$/),strategy_summary:C.array(C.string().trim().min(1).max(500)).min(1).max(ve),reference_image_source_id:xt.optional(),owner_whole_site_request:C.string().trim().min(1).max(Ot).optional()}).strict(),sa=C.object({theme_candidates:C.array(Fc).length(3),conversion:Rt.optional()}).strict().superRefine((e,n)=>{let s=new Set;e.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 WC(){return ea.map(e=>Fc.parse({name:e.name,description:e.description,reason:e.fallbackReason,color_seeds:e.colorSeeds,surface_mode:e.surfaceMode,radius:e.radius,font_pairing_id:Qi[0],motion_preset_id:Ji[0],density:Zi[1]}))}function KS(e){return e.radius??Mc(e.theme_preset_id)??"lg"}function zC(e){let n=Cc(e.font_pairing_id),s=Oc(e.motion_preset_id);return{colorSeeds:e.color_seeds,surfaceMode:e.surface_mode,fonts:{heading:n.heading,body:n.body},density:e.density,motionLevel:s.motionLevel,motionPreset:s.id,radius:KS(e)}}function BC(e,n){let s=e.theme.candidates[0];return{version:1,recommendation_id:e.id,theme_preset_id:s.id,color_seeds:s.color_seeds,surface_mode:s.surface_mode,font_pairing_id:e.font.recommended_id,motion_preset_id:e.motion.recommended_id,density:e.density.recommended_id,radius:s.radius,updated_at:n.toISOString()}}import{z as ia}from"zod";function WS(e){return JSON.stringify([e.color_seeds.primary.toUpperCase(),e.color_seeds.accent.toUpperCase(),e.color_seeds.foreground.toUpperCase(),e.surface_mode,e.font_pairing_id,e.radius,e.motion_preset_id,e.density])}var zS=ia.object(sa.shape).strict().superRefine((e,n)=>{let s=new Set;e.theme_candidates.forEach((a,i)=>{let r=WS(a);s.has(r)&&n.addIssue({code:"custom",path:["theme_candidates",i],message:"Theme candidates must have pairwise distinct visual identities"}),s.add(r)})}),YC=ia.union([sa,zS.safeExtend({model_profile:ia.literal("azure-gpt")})]);import{z as gt}from"zod";var JC=gt.object({site_id:T,site_language:gt.string().trim().min(2).max(35),business_facts:gt.array(gt.string().trim().min(1).max(1e3)).min(1).max(8)}).strict(),BS=gt.enum(["high","medium","low"]),ev=gt.object({skill_name:gt.string().trim().min(1).max(80).nullable(),confidence:BS,reason:gt.string().trim().min(1).max(240)}).strict();import{z as Q}from"zod";var aa=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],xs=Q.object({name:Q.string().min(1).max(100),type:Q.enum(aa),label:Q.string().min(1).max(255),required:Q.boolean().optional(),options:Q.array(Q.string()).optional()}),sv=Q.object({name:Q.string(),cms_type:Q.string(),label:Q.string().optional(),required:Q.boolean().optional(),value_shape:Q.string().optional(),front_display:Q.enum(["visible","internal","forbidden"]).optional(),choices:Q.array(Q.object({value:Q.union([Q.string(),Q.number()]),label:Q.string()})).optional()}),iv=Q.object({route_file_path:Q.string().min(1),target_component_path:Q.string().min(1),content_type_hint:Q.string().min(1),collection_purpose:Q.enum(["generic","product"]).optional(),required_fields:Q.array(xs).optional(),mode:Q.enum(["bind_existing","provision"]),list_mode:Q.enum(["page","embedded"]).optional(),fields:Q.array(xs).optional(),seed_records:Q.array(Q.record(Q.string(),Q.unknown())).optional()});import{z as N}from"zod";var Pn=N.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),Es=N.string().regex(/^[a-f0-9]{64}$/),Rs=N.string().regex(/^[a-z][a-z0-9-]{0,99}$/),Is=N.string().regex(/^[a-z0-9]{1,30}$/),qe=e=>N.string().max(e).refine(n=>n.trim().length>0,"Value must not be blank"),Kc=N.object({id:N.string().uuid(),key:qe(100),name:qe(255)}).strict(),zc=new Set(["title","summary","description","category","thumbnail","url","admin_id"]),HS=new Set(["title","summary","description","image_query"]),VS=new Set(["category","thumbnail","url","admin_id","page","pages","route","path","component","components","snapshot","run","site_id","cms_site_id","tenant_id","token","secret","password","authorization","headers","__proto__","prototype","constructor"]),Wc=new Set(["select","multiselect"]),$S=new Set(["title","text","richtext","date","datetime","url","email","color"]),YS=N.object({name:qe(100),label:qe(255),type:N.enum(aa),required:N.boolean().optional(),options:N.array(qe(100)).max(100).optional()}).strict().superRefine((e,n)=>{let s=e.options??[];Wc.has(e.type)&&s.length===0&&n.addIssue({code:"custom",path:["options"],message:"Choice fields require at least one option"}),!Wc.has(e.type)&&s.length>0&&n.addIssue({code:"custom",path:["options"],message:"Only choice fields may declare options"}),new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["options"],message:"Field options must be unique"}),zc.has(e.name)&&n.addIssue({code:"custom",path:["name"],message:"Reserved CMS field names cannot be declared"})}),XS=N.array(YS).min(1).max(200),QS=N.array(N.record(N.string(),N.unknown())).max(1e3);function Ue(e,n,s){e.addIssue({code:"custom",path:n,message:s})}var ZS=N.object({name:qe(30),slug:Is,collection_purpose:N.enum(["generic","product"]).optional(),fields:XS,seed_records:QS}).strict().superRefine((e,n)=>{let s=e.fields.map(i=>i.name);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["fields"],message:"Field names must be unique"}),s.some(i=>!zc.has(i))||n.addIssue({code:"custom",path:["fields"],message:"At least one custom field is required"});let a=new Map(e.fields.map(i=>[i.name,i]));e.seed_records.forEach((i,r)=>{for(let[m,c]of Object.entries(i)){let p=["seed_records",r,m];if(VS.has(m)){Ue(n,p,"Seed cannot write reserved or runtime-owned fields");continue}if(m==="image_query"){(typeof c!="string"||c.trim()==="")&&Ue(n,p,"image_query must be a non-empty string");continue}if(HS.has(m)){typeof c!="string"&&Ue(n,p,"Seed skeleton text fields must be strings");continue}let I=a.get(m);if(!I){Ue(n,p,"Seed contains an undeclared field");continue}if(c==null){Ue(n,p,"Seed field values must not be null");continue}if(I.type==="select")(typeof c!="string"||!(I.options??[]).includes(c))&&Ue(n,p,"Seed select value must be one of the declared options");else if(I.type==="multiselect")(!Array.isArray(c)||c.length===0||c.some(R=>typeof R!="string"||!(I.options??[]).includes(R)))&&Ue(n,p,"Seed multiselect value must contain only declared options");else if(I.type==="number")(typeof c!="number"||!Number.isFinite(c))&&Ue(n,p,"Seed number values must be finite numbers");else if(I.type==="boolean")typeof c!="boolean"&&Ue(n,p,"Seed boolean values must be booleans");else if(I.type==="tag"){let R=Array.isArray(c)?c:[c];(R.length===0||R.some(w=>typeof w!="string"||w.trim()===""))&&Ue(n,p,"Seed tag values must be non-empty strings")}else $S.has(I.type)&&typeof c!="string"&&Ue(n,p,"Seed text-like values must be strings")}for(let m of e.fields)m.required&&!(m.name in i)&&Ue(n,["seed_records",r,m.name],"Required fields must be present in every seed record")}),new TextEncoder().encode(JSON.stringify(e)).byteLength>1024*1024&&n.addIssue({code:"custom",path:[],message:"Application template must not exceed 1048576 UTF-8 bytes"})}),oa=N.object({schema_version:N.literal(1),application:ZS}).strict(),JS=N.object({templateId:N.string().uuid(),stableKey:Rs,resolvedVersion:Pn,digest:Es,template:oa}).strict(),ef=JS,tf={alreadyCreated:"APPLICATION_ALREADY_CREATED",slugConflict:"APPLICATION_SLUG_CONFLICT",createInProgress:"APPLICATION_CREATE_IN_PROGRESS",cmsUnbound:"APPLICATION_CMS_UNBOUND",templateVersionUnavailable:"APPLICATION_TEMPLATE_VERSION_UNAVAILABLE",createFailed:"APPLICATION_CREATE_FAILED",createResultUnknown:"APPLICATION_CREATE_RESULT_UNKNOWN"},Bc=N.enum(Object.values(tf)),Hc=N.object({category_status:N.enum(["succeeded","failed","not_attempted"]),seed_status:N.enum(["skipped","succeeded","partial","failed"]),requested_count:N.number().int().nonnegative(),written_count:N.number().int().nonnegative().nullable(),published_count:N.number().int().nonnegative().nullable(),errors:N.array(N.object({stage:N.enum(["category","seed","receipt"]),code:qe(100)}).strict()).max(20)}).strict(),nf=N.object({templateId:N.string().uuid(),stableKey:Rs,title:qe(200),description:N.string().max(1e3),thumbnailUrl:N.string().url().nullable(),resolvedVersion:Pn,digest:Es,application:N.object({name:qe(30),slug:Is}).strict(),categories:N.array(Kc),tags:N.array(Kc),status:N.enum(["available","creating","created","conflict","failed"]),errorCode:Bc.nullable().optional(),template:oa.optional()}).strict(),Vc=N.object({items:N.array(nf)}).strict(),cv=N.object({version:Pn}).strict(),sf=N.object({app_slug:Is,name:qe(30),template:N.object({stable_key:Rs,version:Pn,digest:Es}).strict()}).strict(),af=N.object({status:N.literal("created"),application:sf,initialization:Hc}).strict(),mv=af,of=N.object({stable_key:Rs,version:Pn,digest:Es,created_at:N.string().datetime().nullable(),initialization:Hc.nullable()}).strict(),rf=N.object({app_slug:Is,name:qe(30),collection_slug:N.string().min(1),detail_prefix:N.string().min(1).optional(),source:of.nullable()}).strict(),lv=N.object({applications:N.array(rf)}).strict(),pv=Vc,dv=N.object({code:Bc,message:qe(500)}).strict(),uv=oa,_v=ef,gv=Vc;import{z as re}from"zod";var $c=e=>re.string().max(e).refine(n=>n.trim().length>0,"Value must not be blank"),cf=xs.strict(),Xc=re.array(cf).min(1).max(200),mf=re.array(re.record(re.string(),re.unknown())).max(1e3),lf=re.string().regex(/^[a-z0-9]{1,30}$/),ra=re.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),bv=re.object({name:$c(30),slug:$c(50),collection_purpose:re.enum(["generic","product"]).optional(),fields:Xc}).strict(),Yc=re.object({collection_slug:lf,detail_prefix:re.string().min(1).max(255),plugin_id:ra.optional()}).strict(),yv=re.discriminatedUnion("kind",[Yc.extend({kind:re.literal("created")}),Yc.extend({kind:re.literal("exists")})]),xv=re.object({fields:Xc,seed_records:mf,category_id:ra}).strict(),pf=re.record(re.string().min(1),re.string().min(1).nullable()),Ev=re.object({ids:re.array(ra).max(1e3),urls:pf,failed:re.array(re.unknown()).max(1e3)}).strict();function Rv(e){return e.replace(/[^a-zA-Z0-9]/g,"").toLowerCase().slice(0,30)}import{z as he}from"zod";var Ts=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number","file"],df=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number"],uf=he.object({name:he.string().min(1).max(100),type:he.enum(df),label:he.string().min(1).max(255),required:he.boolean().optional(),options:he.array(he.string()).optional()}),_f=he.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),kv=he.object({mode:he.enum(["bind_existing","provision"],{error:'mode is required. Use "bind_existing" or "provision". Never call connect_form with {}.'}),form_hint:he.string().min(1).optional(),name:he.string().min(1).max(255).optional(),component_slug:_f,description:he.string().min(1).max(1e3).optional(),fields:he.array(uf).optional()}).superRefine((e,n)=>{e.mode==="bind_existing"&&!e.form_hint?.trim()&&n.addIssue({code:"custom",path:["form_hint"],message:"form_hint is required for bind_existing"}),e.mode==="provision"&&!e.name?.trim()&&n.addIssue({code:"custom",path:["name"],message:"name is required for provision"})}),Av=he.object({name:he.string(),label:he.string(),cms_type:he.string(),required:he.boolean()});import{z as d}from"zod";var wn=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,Wt=/^[A-Za-z][A-Za-z0-9_-]{0,127}$/,ks=/^[A-Za-z][A-Za-z0-9_]{0,99}$/,em=/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/,ma=/^[a-z][a-z0-9-]{0,99}$/,tm=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,Qc=2,Zc=3,As=d.string().regex(wn),gf=d.string().regex(wn),la=d.string().regex(wn),Cn=d.string().regex(ks),pa=d.string().regex(em),hf=d.discriminatedUnion("status",[d.object({status:d.literal("unbound"),form_code:d.null()}).strict(),d.object({status:d.literal("bound"),form_code:d.string().regex(Wt)}).strict(),d.object({status:d.literal("missing"),form_code:d.string().regex(Wt)}).strict()]),Sf=d.object({value:pa,label:d.string().trim().min(1).max(255)}).strict(),ff=d.object({kind:d.literal("field"),field_name:Cn,type:d.enum(Ts),label:d.string().trim().min(1).max(255),required:d.boolean(),span:d.enum(["full","half"]),options:d.array(Sf).max(100),max_files:d.number().int().min(1).max(5).optional()}).strict(),bf=d.object({kind:d.literal("step-break"),step_id:d.string().regex(wn)}).strict(),yf=d.discriminatedUnion("kind",[ff,bf]),xf=d.object({field_name:Cn,type:d.enum(Ts),last_label:d.string().max(255)}).strict(),Ef=d.object({field_name:Cn,value:pa,last_label:d.string().max(255)}).strict(),Rf=d.discriminatedUnion("kind",[d.object({kind:d.literal("custom")}).strict(),d.object({kind:d.literal("template"),slug:d.string().regex(ma),version:d.string().regex(tm)}).strict()]),If={select:2,radio:2,multiselect:1,DropdownSelection:2,RadioButton:2,Checkbox:1};function Qe(e){return e.toLowerCase()}function nm(e,n){return e.trim().toLocaleLowerCase(n)}function Kt(e,n){return`${Qe(e)}\0${n}`}function Ee(e,n,s,a){let i=new Set;for(let r of e){if(i.has(r)){a.addIssue({code:"custom",path:n,message:s});return}i.add(r)}}function da(e,n,s,a){let i=If[e]??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 ua=d.object({schema_version:d.literal(1),min_runtime_version:d.number().int().positive(),form_definition_id:As,binding:hf,content_locale:fe,features:d.object({multistep:d.boolean()}).strict(),copy:d.object({title:d.string().max(255),description:d.string().max(1e3),submit_button:d.string().trim().min(1).max(100),success_message:d.string().trim().min(1).max(500),error_message:d.string().max(500)}).strict(),layout:d.object({columns:d.enum(["one","two"])}).strict(),nodes:d.array(yf).min(1).max(200),source:Rf,retired:d.object({fields:d.array(xf).max(1e3),options:d.array(Ef).max(5e3)}).strict(),compatibility:d.object({standardization_version:d.number().int().positive(),diagnostics:d.array(d.string().trim().min(1).max(500)).max(100)}).strict()}).strict().superRefine((e,n)=>{let s=e.nodes.flatMap((c,p)=>c.kind==="field"?[[p,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=e.nodes.filter(c=>c.kind==="step-break");!e.features.multistep&&i.length>0&&n.addIssue({code:"custom",path:["nodes"],message:"step-break requires the multistep feature"}),e.features.multistep&&(e.min_runtime_version<Qc&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`multistep requires runtime version ${Qc}`}),i.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"multistep requires at least one step-break"}));for(let[c,p]of e.nodes.entries())p.kind==="step-break"&&(c===0||c===e.nodes.length-1||e.nodes[c-1]?.kind==="step-break"||e.nodes[c+1]?.kind==="step-break")&&n.addIssue({code:"custom",path:["nodes",c],message:"step-break must separate two non-empty steps"});Ee(i.map(c=>c.step_id),["nodes"],"step_id must be unique",n),Ee(a.map(c=>Qe(c.field_name)),["nodes"],"field_name must be unique",n),Ee(e.retired.fields.map(c=>Qe(c.field_name)),["retired","fields"],"retired field_name must be unique",n);let r=new Set(e.retired.fields.map(c=>Qe(c.field_name)));for(let[c,p]of s)r.has(Qe(p.field_name))&&n.addIssue({code:"custom",path:["nodes",c,"field_name"],message:"retired field_name cannot be reused"}),da(p.type,p.options.length,["nodes",c,"options"],n),p.type==="file"?e.min_runtime_version<Zc&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`file fields require runtime version ${Zc}`}):p.max_files!==void 0&&n.addIssue({code:"custom",path:["nodes",c,"max_files"],message:"max_files is only valid for file fields"}),Ee(p.options.map(I=>I.value),["nodes",c,"options"],"option value must be unique within a field",n),Ee(p.options.map(I=>nm(I.label,e.content_locale)),["nodes",c,"options"],"option label must be unique within a field",n);Ee(e.retired.options.map(c=>Kt(c.field_name,c.value)),["retired","options"],"retired option identity must be unique",n);let m=new Set(e.retired.options.map(c=>Kt(c.field_name,c.value)));for(let[c,p]of s)for(let[I,R]of p.options.entries())m.has(Kt(p.field_name,R.value))&&n.addIssue({code:"custom",path:["nodes",c,"options",I,"value"],message:"retired option value cannot be reused"})}),Tf=["copy.title","copy.description","copy.submit_button","copy.success_message","copy.error_message","nodes.*.label","nodes.*.options.*.label"],kf=new Set(Tf);function jv(e){let n=e.map(s=>typeof s=="number"||/^\d+$/.test(s)?"*":s).join(".");return kf.has(n)}function Nv(e,n){let s=[],a=e.nodes.filter(c=>c.kind==="field"),i=new Map(n.nodes.filter(c=>c.kind==="field").map(c=>[Qe(c.field_name),c])),r=new Map(n.retired.fields.map(c=>[Qe(c.field_name),c])),m=new Map(n.retired.options.map(c=>[Kt(c.field_name,c.value),c]));for(let c of a){let p=Qe(c.field_name),I=i.get(p),R=r.get(p);I&&I.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),I&&I.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),!I&&R&&R.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),!I&&R&&R.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),!I&&!r.has(p)&&s.push({code:"FIELD_RETIREMENT_MISSING",field_name:c.field_name});let w=new Set(I?.options.map(F=>F.value)??[]);for(let F of c.options){let B=m.get(Kt(c.field_name,F.value));!w.has(F.value)&&B&&B.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),!w.has(F.value)&&!B&&s.push({code:"OPTION_RETIREMENT_MISSING",field_name:c.field_name,value:F.value})}}for(let c of e.retired.fields){let p=r.get(Qe(c.field_name));p&&p.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),p&&p.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),p||s.push({code:"FIELD_RETIREMENT_MISSING",field_name:c.field_name})}for(let c of e.retired.options){let p=m.get(Kt(c.field_name,c.value));p&&p.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),p||s.push({code:"OPTION_RETIREMENT_MISSING",field_name:c.field_name,value:c.value})}return s}var Af=d.enum(nn),ht=d.object({english:d.string().max(1e3),translations:d.partialRecord(Af,d.string().max(1e3)).optional()}).strict(),Pf=d.object({template_option_key:d.string().regex(em),label:ht}).strict(),wf=d.object({template_field_key:d.string().regex(ks),type:d.enum(Ts),label:ht,required:d.boolean(),span:d.enum(["full","half"]),options:d.array(Pf).max(100)}).strict(),Cf=d.object({template_step_key:d.string().regex(ks),after_field_key:d.string().regex(ks)}).strict(),Lv=["lead-generation","trial-and-samples","quote-and-commerce","appointments-and-visits","resources-and-subscriptions","service-and-channel"],Mv=[1,1,1,1,1,1],sm=d.string().regex(ma),vf=d.object({schema_version:d.literal(1),slug:sm,name:ht,template_count:d.number().int().min(0).max(500)}).strict().superRefine((e,n)=>{e.name.english.trim()===""&&n.addIssue({code:"custom",path:["name","english"],message:"English category name is required"})}),Df=d.object({schema_version:d.literal(1),slug:d.string().regex(ma),version:d.string().regex(tm),category:sm,copy:d.object({title:ht,description:ht,submit_button:ht,success_message:ht,error_message:ht}).strict(),layout:d.object({columns:d.enum(["one","two"])}).strict(),fields:d.array(wf).min(1).max(200),step_breaks:d.array(Cf).max(20).optional()}).strict().superRefine((e,n)=>{for(let r of["title","description","submit_button","success_message","error_message"])e.copy[r].english.trim()===""&&n.addIssue({code:"custom",path:["copy",r,"english"],message:"English baseline text is required"});Ee(e.fields.map(r=>r.template_field_key),["fields"],"template_field_key must be unique",n);let s=new Map(e.fields.map((r,m)=>[r.template_field_key,m])),a=e.step_breaks??[];Ee(a.map(r=>r.template_step_key),["step_breaks"],"template_step_key must be unique",n),Ee(a.map(r=>r.after_field_key),["step_breaks"],"step breaks must not share an anchor field",n);let i=-1;for(let[r,m]of a.entries()){let c=s.get(m.after_field_key);c===void 0||c>=e.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}e.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,m]of e.fields.entries()){m.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",r,"label","english"],message:"English field label is required"}),da(m.type,m.options.length,["fields",r,"options"],n),Ee(m.options.map(c=>c.template_option_key),["fields",r,"options"],"template_option_key must be unique within a field",n),Ee(m.options.map(c=>c.label.english.trim().toLowerCase()),["fields",r,"options"],"English option labels must be unique within a field",n);for(let[c,p]of m.options.entries())p.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",r,"options",c,"label","english"],message:"English option label is required"})}}),Uv=d.object({schema_version:d.literal(1),visibility:d.enum(["internal","public"]),categories:d.array(vf).max(500),templates:d.array(Df).max(500)}).strict().superRefine((e,n)=>{let s=(i,r)=>{let m=nn.filter(c=>!i.translations?.[c]?.trim());m.length>0&&n.addIssue({code:"custom",path:[...r,"translations"],message:`public template copy is missing locales: ${m.join(", ")}`})};Ee(e.categories.map(i=>i.slug),["categories"],"template category slug must be unique",n);let a=new Set(e.categories.map(i=>i.slug));for(let[i,r]of e.categories.entries()){let m=e.templates.filter(c=>c.category===r.slug).length;r.template_count!==m&&n.addIssue({code:"custom",path:["categories",i,"template_count"],message:"template_count must match catalog templates"})}Ee(e.templates.map(i=>i.slug),["templates"],"template slug must be unique",n);for(let[i,r]of e.templates.entries())a.has(r.category)||n.addIssue({code:"custom",path:["templates",i,"category"],message:"template category must exist in catalog categories"});if(e.visibility==="public"){for(let[i,r]of e.categories.entries())s(r.name,["categories",i,"name"]);for(let[i,r]of e.templates.entries()){for(let[m,c]of Object.entries(r.copy))s(c,["templates",i,"copy",m]);for(let[m,c]of r.fields.entries()){s(c.label,["templates",i,"fields",m,"label"]);for(let[p,I]of c.options.entries())s(I.label,["templates",i,"fields",m,"options",p,"label"])}}}});function qv(e,n){let s=fo(n),a=s?e.translations?.[s]:void 0;return a!==void 0&&a.trim()!==""?a:e.english}var Of=["Text","Summary","Email","Phone","DropdownSelection","RadioButton","Checkbox","Boolean","Date","Num","MultipleFile","SpecificFile"],jf={text:"Text",textarea:"Summary",email:"Email",phone:"Phone",select:"DropdownSelection",radio:"RadioButton",multiselect:"Checkbox",boolean:"Boolean",date:"Date",number:"Num",file:"MultipleFile"},Nf=d.object({value:pa,label:d.string().trim().min(1).max(255)}).strict(),Lf=d.object({field_name:Cn,field_type:d.enum(Of),field_label:d.string().trim().min(1).max(255),is_required:d.boolean(),sort_order:d.number().int().nonnegative(),options:d.array(Nf).max(100)}).strict(),im=d.object({version:d.literal(1),locale:fe,fields:d.array(Lf).min(1).max(200)}).strict().superRefine((e,n)=>{Ee(e.fields.map(s=>Qe(s.field_name)),["fields"],"field_name must be unique",n);for(let[s,a]of e.fields.entries())da(a.field_type,a.options.length,["fields",s,"options"],n),Ee(a.options.map(i=>i.value),["fields",s,"options"],"option value must be unique within a field",n),Ee(a.options.map(i=>nm(i.label,e.locale)),["fields",s,"options"],"option label must be unique within a field",n)});function Fv(e){let n=e.nodes.filter(s=>s.kind==="field").map((s,a)=>({field_name:s.field_name,field_type:s.type==="file"&&s.max_files===1?"SpecificFile":jf[s.type],field_label:s.label,is_required:s.required,sort_order:a,options:s.options.map(i=>({...i}))}));return im.parse({version:1,locale:e.content_locale,fields:n})}var oe=d.string().regex(/^sha256:[0-9a-f]{64}$/),Mf=d.union([Se,d.enum(["app/api/forms/[code]/route.ts","hooks/use-cms-form-submit.ts","lib/cms/forms.ts","lib/cms/client.ts"])]),Uf=d.object({path:Mf,content_hash:oe.nullable()}).strict(),qf=d.array(Uf).min(1).max(500).superRefine((e,n)=>{Ee(e.map(s=>s.path),[],"affected file paths must be unique",n)}),_a=d.object({grade:d.enum(["standard","A","B","C"]),required:d.boolean(),pending_confirmations:d.array(d.object({item_id:d.string().regex(wn),field_name:Cn.optional(),kind:d.enum(["form_copy","layout","field_label","field_type","field_required","field_options"]),message:d.string().trim().min(1).max(500)}).strict().superRefine((e,n)=>{e.kind.startsWith("field_")&&!e.field_name&&n.addIssue({code:"custom",path:["field_name"],message:"field confirmation items require field_name"})})).max(200)}).strict().superRefine((e,n)=>{let s=e.grade==="standard";s===e.required&&n.addIssue({code:"custom",path:["required"],message:s?"standard forms do not require standardization confirmation":"legacy forms require standardization confirmation"}),e.grade==="C"&&e.pending_confirmations.length===0&&n.addIssue({code:"custom",path:["pending_confirmations"],message:"grade C requires at least one pending confirmation"}),e.grade!=="C"&&e.pending_confirmations.length>0&&n.addIssue({code:"custom",path:["pending_confirmations"],message:"only grade C can contain pending confirmations"})}),Ff=d.object({site_id:T,form_definition_id:As,base_snapshot_id:k,expected_form_spec_hash:oe,expected_cms_schema_hash:oe.nullable(),draft_form_spec_hash:oe,desired_cms_schema_hash:oe,affected_files_hash:oe,shared_reference_hash:oe,shared_reference_count:d.number().int().positive(),confirm_shared_update:d.boolean(),recreate_missing_binding:d.boolean(),standardization:_a,confirm_standardization:d.boolean()}).strict(),am=d.object({reference_hash:oe,page_count:d.number().int().positive(),block_count:d.number().int().positive()}).strict().refine(e=>e.page_count<=e.block_count,{message:"page_count cannot exceed block_count"}),Gv=d.object({site_id:T,form_block_id:gf,base_snapshot_id:k,form_spec:ua,runtime_upgrade_required:d.boolean(),expected_form_spec_hash:oe,expected_cms_schema_hash:oe.nullable(),affected_files_hash:oe,shared_impact:am,standardization:_a}).strict(),Gf=d.object({operation_id:la,operation_fingerprint:oe,site_id:T,form_definition_id:As,base_snapshot_id:k,expected_form_spec_hash:oe,expected_cms_schema_hash:oe.nullable(),draft_form_spec:ua,draft_form_spec_hash:oe,desired_cms_schema_hash:oe,affected_files_hash:oe,shared_impact:am,confirm_shared_update:d.boolean(),recreate_missing_binding:d.boolean(),standardization:_a,confirm_standardization:d.boolean()}).strict().superRefine((e,n)=>{e.form_definition_id!==e.draft_form_spec.form_definition_id&&n.addIssue({code:"custom",path:["form_definition_id"],message:"form_definition_id must match draft_form_spec"}),e.shared_impact.block_count>1&&!e.confirm_shared_update&&n.addIssue({code:"custom",path:["confirm_shared_update"],message:"shared definition updates require explicit confirmation"});let s=e.draft_form_spec.binding.status==="missing";s!==e.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=e.draft_form_spec.binding.status==="bound",i=a&&e.standardization.required&&(e.standardization.grade==="B"||e.standardization.grade==="C");(a&&!i&&e.expected_cms_schema_hash===null||!a&&e.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"}),e.confirm_standardization!==e.standardization.required&&n.addIssue({code:"custom",path:["confirm_standardization"],message:e.standardization.required?"legacy standardization requires explicit confirmation":"standard forms cannot claim legacy standardization confirmation"})}),Kf=["created","validated","binding_reserved","candidate_ready","cms_applied","snapshot_promoted","committed","compensating","recovery_required","failed"],ga=d.enum(Kf),Wf=["pending","running","succeeded","failed","recovery_required"],om=d.enum(Wf),zf=["candidate_abandon","snapshot_reconcile","cms_restore"],rm=d.enum(zf),Bf=["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"],ha=d.enum(Bf),cm=d.enum(["wait","resume","retry_new_operation","manual_recovery","none"]),mm=d.enum(["not_started","pending","succeeded","failed"]),lm=d.object({operation_id:la,operation_fingerprint:oe,site_id:T,form_definition_id:As,stage:ga,status:om,base_snapshot_id:k,candidate_snapshot_id:k.nullable(),before_form_code:d.string().regex(Wt).nullable(),materialized_form_code:d.string().regex(Wt).nullable(),expected_form_spec_hash:oe,draft_form_spec_hash:oe,materialized_form_spec_hash:oe.nullable(),expected_cms_schema_hash:oe.nullable(),desired_cms_schema_hash:oe,retry_count:d.number().int().nonnegative(),failure_stage:rm.nullable(),last_error_code:ha.nullable(),retryable:d.boolean(),next_action:cm,preview_refresh_status:mm,created_at:d.string().datetime({offset:!0}),updated_at:d.string().datetime({offset:!0})}).strict().superRefine((e,n)=>{if(!(e.stage!=="committed"&&e.status!=="succeeded")){(e.stage!=="committed"||e.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"])e[s]===null&&n.addIssue({code:"custom",path:[s],message:`${s} is required for a committed success`});(e.failure_stage!==null||e.last_error_code!==null||e.retryable||e.next_action!=="none")&&n.addIssue({code:"custom",path:["next_action"],message:"a committed success cannot retain an error or retry action"})}}),Sa=d.object({operation:lm}).strict(),Kv=Sa,Wv=Sa,zv=d.object({operation_fingerprint:oe}).strict(),Bv=Sa,Hf=d.preprocess(e=>!e||typeof e!="object"||Array.isArray(e)||"standardization"in e||"confirm_standardization"in e?e:{...e,standardization:{grade:"standard",required:!1,pending_confirmations:[]},confirm_standardization:!1},Gf),Hv=d.object({operation:lm,request:Hf,cms_replace_result:d.unknown().nullable()}).strict(),Vf=d.object({stage:ga.optional(),status:om.optional(),candidate_snapshot_id:k.nullable().optional(),before_form_code:d.string().regex(Wt).nullable().optional(),materialized_form_code:d.string().regex(Wt).nullable().optional(),materialized_form_spec_hash:oe.nullable().optional(),retry_count:d.number().int().nonnegative().optional(),failure_stage:rm.nullable().optional(),last_error_code:ha.nullable().optional(),retryable:d.boolean().optional(),next_action:cm.optional(),preview_refresh_status:mm.optional()}).strict(),Vv=d.object({expected_updated_at:d.string().datetime({offset:!0}),operation:Vf,cms_replace_result:d.unknown().nullable().optional()}).strict().refine(e=>Object.keys(e.operation).length>0||Object.hasOwn(e,"cms_replace_result"),{message:"transition must change operation state or CMS result"}),$v=d.object({code:ha,message:d.string().trim().min(1).max(500),retryable:d.boolean(),operation_id:la.optional(),stage:ga.optional()}).strict();function $f(e){return Ff.parse({site_id:e.site_id,form_definition_id:e.form_definition_id,base_snapshot_id:e.base_snapshot_id,expected_form_spec_hash:e.expected_form_spec_hash,expected_cms_schema_hash:e.expected_cms_schema_hash,draft_form_spec_hash:e.draft_form_spec_hash,desired_cms_schema_hash:e.desired_cms_schema_hash,affected_files_hash:e.affected_files_hash,shared_reference_hash:e.shared_impact.reference_hash,shared_reference_count:e.shared_impact.block_count,confirm_shared_update:e.confirm_shared_update,recreate_missing_binding:e.recreate_missing_binding,standardization:e.standardization,confirm_standardization:e.confirm_standardization})}function Jc(e){for(let n=0;n<e.length;n+=1){let s=e.charCodeAt(n);if(s>=55296&&s<=56319){let a=e.charCodeAt(n+1);if(n+1>=e.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 ca(e,n){if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number"){if(!Number.isFinite(e))throw new TypeError("canonical JSON numbers must be finite");return JSON.stringify(e)}if(typeof e=="string")return Jc(e),JSON.stringify(e);if(typeof e!="object")throw new TypeError("value is not valid JSON");if(n.has(e))throw new TypeError("canonical JSON cannot contain cycles");n.add(e);try{if(Array.isArray(e)){let r=[];for(let m=0;m<e.length;m+=1){if(!(m in e))throw new TypeError("canonical JSON cannot contain sparse arrays");r.push(ca(e[m],n))}return`[${r.join(",")}]`}let s=Object.getPrototypeOf(e);if(s!==Object.prototype&&s!==null)throw new TypeError("canonical JSON objects must be plain records");let a=e;return`{${Object.keys(a).sort().map(r=>(Jc(r),`${JSON.stringify(r)}:${ca(a[r],n)}`)).join(",")}}`}finally{n.delete(e)}}function fa(e){return ca(e,new Set)}async function Ps(e){let n=fa(e),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 Yv(e){return Ps(ua.parse(e))}async function Xv(e){return Ps(im.parse(e))}async function Qv(e){let n=qf.parse(e).map(s=>({...s})).sort((s,a)=>s.path<a.path?-1:s.path>a.path?1:0);return Ps({version:1,files:n})}async function Zv(e){return Ps($f(e))}import{z as v}from"zod";var tD=["page-seo","root-layout-metadata","nav-items"],nD=v.object({path:v.string(),title:v.string(),description:v.string().optional(),keywords:v.string().optional(),meta_tags_json:v.record(v.string(),v.record(v.string(),v.string())).nullish(),schema_json:v.union([v.record(v.string(),v.unknown()),v.array(v.record(v.string(),v.unknown())),v.string()]).nullish(),breadcrumbs_json:v.array(v.object({name:v.string().optional(),text:v.string().optional(),url:v.string().nullish()})).nullish()}),sD=v.object({metadataBase:v.string().optional(),title:v.union([v.string(),v.object({default:v.string().optional(),template:v.string().optional(),absolute:v.string().optional()})]).optional(),description:v.string().optional(),keywords:v.string().optional(),openGraph:v.object({title:v.string().optional(),description:v.string().optional(),type:v.string().optional(),siteName:v.string().optional(),url:v.string().optional(),locale:v.string().optional(),images:v.array(v.union([v.string(),v.object({url:v.string(),alt:v.string().optional()})])).optional()}).optional(),twitter:v.object({card:v.string().optional(),title:v.string().optional(),description:v.string().optional(),images:v.array(v.string()).optional()}).optional(),alternates:v.object({canonical:v.string().optional()}).optional()}),pm=()=>v.object({label:v.string(),href:v.string().optional(),targetType:v.enum(["page","anchor","external","email","phone","file","group"]).optional(),role:v.enum(["link","cta"]).optional(),openInNewTab:v.boolean().optional(),nofollow:v.boolean().optional(),description:v.string().optional(),badge:v.string().optional(),iconKey:v.string().optional()}),iD=pm().extend({children:v.array(pm()).optional()}),Yf=["title","description","keywords","breadcrumbs_json.*.name","breadcrumbs_json.*.text"],Xf=["path","meta_tags_json.**","schema_json.**","breadcrumbs_json.*.url"],Qf=["title","title.default","title.template","title.absolute","description","keywords","openGraph.title","openGraph.description","openGraph.siteName","openGraph.images.*.alt","twitter.title","twitter.description"],Zf=["metadataBase","openGraph.type","openGraph.url","openGraph.locale","openGraph.images.*","openGraph.images.*.url","twitter.card","twitter.images.*","alternates.canonical"],Jf=["label","description","badge"],eb=["href","targetType","role","iconKey"],dm={"page-seo":{localizable:Yf,machine:Xf},"root-layout-metadata":{localizable:Qf,machine:Zf},"nav-items":{localizable:Jf,machine:eb}},um="*",_m="**",tb="children";function nb(e){return typeof e=="number"||/^\d+$/.test(e)?um:e}function gm(e,n){let s=n.map(nb);return e!=="nav-items"?s:s.filter(a=>a!==um&&a!==tb)}function hm(e,n){let s=e.split(".");for(let a=0;a<s.length;a+=1){if(s[a]===_m)return!0;if(a>=n.length||s[a]!==n[a])return!1}return s.length===n.length}function sb(e,n){let s=e.split(".");if(n.length>=s.length)return!1;for(let a=0;a<n.length;a+=1){if(s[a]===_m)return!0;if(s[a]!==n[a])return!1}return!0}function aD(e,n){let s=gm(e,n);return s.length===0?!1:dm[e].localizable.some(a=>hm(a,s))}function oD(e,n){let s=gm(e,n);if(s.length===0)return!0;let{localizable:a,machine:i}=dm[e];return[...a,...i].some(r=>hm(r,s)||sb(r,s))}var mD=["product-search","migration-products","standard-form","form-submission-infrastructure"],ib=[{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/${at}.ts`,materializer:"migration-products"},{path:`components/site/generated/${at}-list.tsx`,materializer:"migration-products"},{path:`components/site/generated/${at}-list-view.tsx`,materializer:"migration-products"},{path:`components/site/generated/${at}-detail-view.tsx`,materializer:"migration-products"},{path:`app/${at}/[slug]/page.tsx`,materializer:"migration-products"},{path:`components/site/generated/${at}-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"}],ab=[{prefix:"components/site/generated/forms/form-",suffix:".tsx",materializer:"standard-form"}],lD=[{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 ob(e){return e.length>0&&!e.includes("/")&&!e.includes(".")}function pD(e){return ib.some(n=>n.path===e)?!0:ab.some(n=>!e.startsWith(n.prefix)||!e.endsWith(n.suffix)?!1:ob(e.slice(n.prefix.length,e.length-n.suffix.length)))}import{z as rt}from"zod";var rb=["provisioning","cms_app_created","seeded","ready","failed"],gD=rt.object({tenant_id:rt.string().min(1),site_id:T,collection_slug:rt.string().min(1),cms_collection_id:rt.string().min(1).nullable(),status:rt.enum(rb),owned_by_vcp:rt.boolean(),run_id:K.nullable(),last_error:rt.string().nullable(),created_at:rt.string().datetime(),updated_at:rt.string().datetime()});var Sm="/vibe/v1";function SD(e){let n=e?.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(Sm)?a:Sm,s.href.replace(/\/+$/,"")}catch{return n}}import{z as g}from"zod";var ws=g.string().url().refine(Ab,{message:"URL must use http or https"}),fm=g.string().trim().pipe(ws),cb=g.object({task_type:g.literal("home_url"),task_url:fm,planned_num:g.number().int().min(1).max(20).optional()}).strict(),mb=g.object({task_type:g.literal("url_list"),urls:g.array(ws).min(1).max(1e4)}).strict(),xD=g.discriminatedUnion("task_type",[cb,mb]),ED=g.object({page:g.coerce.number().int().positive().default(1),page_size:g.coerce.number().int().min(1).max(20).default(20)}).strict(),RD=g.object({home_url:fm}).strict(),wt=g.string().uuid(),zt=g.string().uuid(),ID=g.object({task_uuid:wt}).strict(),bm=g.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]),lb=g.object({task_uuid:wt,status:g.literal("NOT_STARTED"),total:g.literal(0)}).strict(),pb=g.object({task_uuid:wt,status:g.literal("PROCESSING"),total:g.literal(0)}).strict(),TD=g.enum(["no_suitable_page_candidate","page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"]),db=g.discriminatedUnion("status",[g.object({role:dt,status:g.literal("selected"),reason_code:g.null()}).strict(),g.object({role:dt,status:g.literal("not_found"),reason_code:g.literal("no_suitable_page_candidate")}).strict(),g.object({role:dt,status:g.literal("unknown"),reason_code:g.enum(["page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"])}).strict()]),ym=g.array(db).length(7).superRefine((e,n)=>{let s=new Set(e.map(a=>a.role));s.size!==e.length&&n.addIssue({code:"custom",message:"discovery coverage roles must be unique"});for(let a of dt.options)s.has(a)||n.addIssue({code:"custom",message:`discovery coverage is missing role ${a}`})}),ub=g.object({task_uuid:wt,status:g.literal("SUCCEEDED"),total:g.number().int().positive(),discovery_coverage:ym.optional()}).strict(),_b=g.enum(["TASK_FAILED","PROVIDER_CAPABILITY_LIMIT","WEBSITE_UNREACHABLE"]),gb=g.object({task_uuid:wt,status:g.literal("FAILED"),total:g.literal(0),error_code:_b,error_message:g.string().min(1),failure_stage:bm}).strict(),kD=g.discriminatedUnion("status",[lb,pb,ub,gb]),hb=g.object({url:ws,raw_html:g.string().min(1)}).strict(),AD=g.object({task_uuid:wt,status:g.literal("SUCCEEDED"),page:g.number().int().positive(),page_size:g.number().int().min(1).max(20),total:g.number().int().positive(),total_pages:g.number().int().positive(),pages:g.array(hb).max(20),discovery_coverage:ym.optional()}).strict().superRefine((e,n)=>{e.total_pages!==Math.ceil(e.total/e.page_size)&&n.addIssue({code:"custom",path:["total_pages"],message:"total_pages must equal ceil(total / page_size)"}),e.pages.length>e.page_size&&n.addIssue({code:"custom",path:["pages"],message:"pages must not exceed page_size"})}),PD=g.object({task_code:zt}).strict(),Sb=g.object({task_code:zt,status:g.literal("NOT_STARTED")}).strict(),fb=g.object({task_code:zt,status:g.literal("PROCESSING")}).strict(),bb=g.object({task_code:zt,status:g.literal("SUCCEEDED"),urls:g.array(ws)}).strict(),yb=g.literal("SITEMAP_DISCOVERY_FAILED"),xb=g.object({task_code:zt,status:g.literal("FAILED"),error_code:yb,error_message:g.string().min(1)}).strict(),wD=g.discriminatedUnion("status",[Sb,fb,bb,xb]),CD=g.object({company_name:g.string().regex(/\S/u)}).strict(),Eb=g.object({company_name:g.string(),brand_name:g.string(),main_products:g.array(g.string()),industry:g.array(g.string()),subfields:g.array(g.string()),business_intro:g.string(),registered_capital:g.string(),legal_representative:g.string(),target_markets:g.array(g.string()),target_customer_industries:g.array(g.string()),target_customer_roles:g.array(g.string()),purchase_scenarios:g.string(),differentiators:g.array(g.string()),competitors:g.array(g.object({name:g.string(),official_url:g.string()}).strict()).max(3),qualifications:g.array(g.string()),representative_cases:g.array(g.string()),acquisition_channels:g.array(g.string()),desired_domain:g.string(),brand_tone:g.string(),timezone:g.string()}).strict(),Cs=g.object({company_uuid:g.string().uuid(),company_info:Eb,created_at:g.string().datetime(),updated_at:g.string().datetime()}),Rb=Cs.extend({status:g.literal("NOT_STARTED"),last_error_code:g.null(),last_error_message:g.null(),started_at:g.null(),completed_at:g.null()}).strict(),Ib=Cs.extend({status:g.literal("PROCESSING"),last_error_code:g.null(),last_error_message:g.null(),started_at:g.string().datetime(),completed_at:g.null()}).strict(),xm=Cs.extend({status:g.literal("SUCCEEDED"),last_error_code:g.null(),last_error_message:g.null(),started_at:g.string().datetime(),completed_at:g.string().datetime()}).strict(),Em=Cs.extend({status:g.literal("FAILED"),last_error_code:g.string().min(1),last_error_message:g.string().min(1),started_at:g.string().datetime(),completed_at:g.string().datetime()}).strict(),vD=g.discriminatedUnion("status",[xm,Em]),DD=g.discriminatedUnion("status",[Rb,Ib,xm,Em]),Tb=["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"],kb=g.enum(Tb),OD=g.object({error_code:kb,error_message:g.string().min(1),failure_stage:bm.optional(),task_uuid:wt.optional(),task_code:zt.optional()}).strict();function Ab(e){try{let n=new URL(e).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as L}from"zod";var Fe=L.string().url().refine(Cb,{message:"URL must use http or https"}),Rm=L.string().min(1).max(512),vs=L.string().datetime({offset:!0}),Im=L.enum(["scraping","completed","failed","expired"]),LD=L.object({url:Fe,ignore_cache:L.boolean(),sitemap:L.enum(["include","skip"]),include_subdomains:L.boolean(),ignore_query_parameters:L.boolean(),limit:L.number().int().min(1).max(1e5)}).strict(),MD=L.object({links:L.array(Fe).max(1e5)}).strict(),UD=L.object({url:Fe,limit:L.number().int().min(1).max(1e5),max_discovery_depth:L.literal(1),crawl_entire_domain:L.literal(!1),allow_subdomains:L.literal(!0),sitemap:L.literal("skip")}).strict(),qD=L.object({crawl_id:Rm,expires_at:vs.optional()}).strict(),FD=L.object({status:Im,urls:L.array(Fe).max(1e5),next:Fe.optional(),expires_at:vs}).strict(),GD=L.object({url:Fe,formats:L.tuple([L.literal("rawHtml")]),only_main_content:L.literal(!1),max_age:L.number().int().nonnegative()}).strict(),KD=L.object({url:Fe,raw_html:L.string().min(1),status_code:L.number().int().min(100).max(599).nullable()}).strict(),WD=L.object({urls:L.array(Fe).min(1).max(1e4),formats:L.tuple([L.literal("rawHtml")]),ignore_invalid_urls:L.literal(!1),max_age:L.number().int().nonnegative(),max_concurrency:L.number().int().positive().optional()}).strict(),zD=L.object({batch_id:Rm,expires_at:vs.optional()}).strict(),Pb=L.object({url:Fe,raw_html:L.string().min(1)}).strict(),BD=L.object({status:Im,total:L.number().int().nonnegative(),completed:L.number().int().nonnegative(),pages:L.array(Pb).max(1e4),next:Fe.optional(),expires_at:vs}).strict().superRefine((e,n)=>{e.completed>e.total&&n.addIssue({code:"custom",path:["completed"],message:"completed must not exceed total"})}),wb=L.object({url:Fe,error_message:L.string().min(1)}).strict(),HD=L.object({errors:L.array(wb).max(1e4),robots_blocked:L.array(Fe).max(1e4)}).strict(),VD=L.object({active:L.number().int().nonnegative(),waiting:L.number().int().nonnegative(),max_concurrency:L.number().int().positive()}).strict();function Cb(e){try{let n=new URL(e).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as b}from"zod";var km=b.lazy(()=>Dn),vb=b.enum(["page","block"]),Os=b.enum(["component","page","pages"]),Db=b.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),Ct=Db,Am=b.object({requested_locale:Ct,resolved_locale:Ct,fallback_used:b.boolean()}).strict(),vn=b.object({id:b.string().uuid(),key:b.string().min(1),name:b.string().min(1)}).strict(),Ds=vn.extend({color:b.string().nullable()}).strict(),ZD=b.object({kind:vb,category_id:b.string().uuid().optional(),tag_id:b.string().uuid().optional(),search:b.string().trim().min(1).max(200).optional(),limit:b.coerce.number().int().min(1).max(50).default(20),cursor:b.string().min(1).optional()}).strict(),Ob=b.object({stable_key:b.string().min(1),type:Os,title:b.string().min(1).max(200),description:b.string().max(1e3),thumbnail_url:b.string().url().nullable(),resolved_version:b.number().int().positive(),content_schema_version:b.literal(3),category:vn.nullable(),tags:b.array(Ds),page_count:b.number().int().nonnegative(),component_count:b.number().int().nonnegative(),locale:Am}).strict(),JD=b.object({items:b.array(Ob),facets:b.object({categories:b.array(vn),tags:b.array(Ds)}).strict(),next_cursor:b.string().nullable()}).strict(),eO=b.object({operation_id:b.string().uuidv7(),resolved_version:b.number().int().positive(),base_sitemap_id:b.string().uuid(),base_sitemap_version:b.number().int().positive(),sitemap:km,target_page_id:b.string().min(1).optional()}).strict(),tO=b.object({next_sitemap:km,applied:b.object({stable_key:b.string().min(1),resolved_version:b.number().int().positive(),template_type:Os,page_ids:b.array(b.string().min(1)),block_ids:b.array(b.string().min(1))}).strict(),locale:Am,warnings:b.array(b.string())}).strict(),Pm=b.object({nodeId:b.string().uuid(),type:b.string().trim().min(1).max(100),label:b.string().trim().min(1).max(200),variant:b.string().trim().min(1).max(100).optional(),order:b.number().int().nonnegative(),props:b.record(b.string(),b.unknown()),thumbnail:b.string().url().optional(),source:b.unknown().optional()}).strict(),Tm=b.object({nodeId:b.string().uuid().optional(),slug:b.string().regex(/^\/$|^\/[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*$/u),navigation:b.object({showInHeader:b.boolean(),showInFooter:b.boolean(),order:b.number().int().nonnegative()}).strict(),components:b.array(Pm).min(1).max(100),thumbnail:b.string().url().optional(),source:b.unknown().optional()}).strict(),jb=b.union([Pm,Tm,b.object({pages:b.array(Tm).min(1).max(50),thumbnail:b.string().url().optional(),source:b.unknown().optional()}).strict()]),Nb=b.object({title:b.string().min(1).max(200),description:b.string().min(1).max(1e3),prompt:b.string().min(1).max(8192)}).strict(),Lb=b.object({locale:Ct,title:b.string().min(1).max(200),content:b.object({description:b.string().min(1).max(1e3),prompt:b.string().min(1).max(8192),nodes:b.record(b.string().uuid(),Nb)}).strict()}).strict(),nO=b.object({templateId:b.string().uuid(),stableKey:b.string().min(1),type:Os,resolvedVersion:b.number().int().positive(),contentSchemaVersion:b.literal(3),structure:jb,requestedLocale:Ct,resolvedLocale:Ct,fallbackUsed:b.boolean(),contents:b.array(Lb).length(1)}).strict().superRefine((e,n)=>{(e.type==="component"&&!("type"in e.structure)||e.type==="page"&&!("components"in e.structure)||e.type==="pages"&&!("pages"in e.structure))&&n.addIssue({code:"custom",path:["structure"],message:"Template type and structure must match."});let s=Mb(e.structure),a=new Set(Object.keys(e.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."}),e.contents[0]?.locale!==e.resolvedLocale&&n.addIssue({code:"custom",path:["contents"],message:"Resolved locale must match returned content."}),e.fallbackUsed!==(e.requestedLocale!==e.resolvedLocale)&&n.addIssue({code:"custom",path:["fallbackUsed"],message:"fallbackUsed must match locale resolution."})}),sO=b.object({items:b.array(b.object({stableKey:b.string().min(1),type:Os,title:b.string().min(1).max(200),description:b.string().max(1e3),thumbnailUrl:b.string().url().nullable(),resolvedVersion:b.number().int().positive(),contentSchemaVersion:b.literal(3),category:vn.nullable(),tags:b.array(Ds),pageCount:b.number().int().nonnegative(),componentCount:b.number().int().nonnegative(),requestedLocale:Ct,resolvedLocale:Ct,fallbackUsed:b.boolean()}).strict()),facets:b.object({categories:b.array(vn),tags:b.array(Ds)}).strict(),nextCursor:b.string().nullable()}).strict().superRefine((e,n)=>{e.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 Mb(e){if("type"in e)return new Set([e.nodeId]);let n="pages"in e?e.pages:[e];return new Set(n.flatMap(s=>[...s.nodeId?[s.nodeId]:[],...s.components.map(a=>a.nodeId)]))}function iO(e){return fa({tenant_id:e.tenant_id,site_id:e.site_id,stable_key:e.stable_key,resolved_version:e.request.resolved_version,base_sitemap_id:e.request.base_sitemap_id,base_sitemap_version:e.request.base_sitemap_version,sitemap:e.request.sitemap,target_page_id:e.request.target_page_id??null})}import{z as G}from"zod";var Ub=["pending_dns","active","failed","removing"],qb=G.enum(Ub),Fb=["serve_site","redirect_301"],Gb=G.enum(Fb),Kb=["traffic","ownership","certificate_delegation"],ba=G.enum(Kb),Wb=["pending","verified"],zb=G.enum(Wb),Bb=["not_applicable","unavailable","not_needed","auto_applied","confirmation_required","blocked"],Hb=G.enum(Bb),ya=G.enum(["prepare_configuration","apply_configuration","verify_dns","remediate_dns","confirm_dns_remediation"]),Vb=G.enum(["accepted","running","succeeded","failed"]),$b=G.object({code:G.string().min(1),message:G.string().min(1)}).strict(),Yb=G.object({purpose:ba,verified:G.boolean(),observedValues:G.array(G.string())}).strict(),wm=G.object({ready:G.boolean(),providerReady:G.boolean(),dnsVerified:G.boolean(),records:G.array(Yb)}).strict(),Cm=G.object({type:G.string().min(1),name:G.string().min(1),value:G.string().min(1),ttl:G.number().nullable()}).strict(),Xb=G.object({purpose:ba,action:G.enum(["none","create","update","blocked"]),before:Cm.nullable(),after:Cm.nullable()}).strict(),vm=G.object({domainId:G.string().min(1),status:Hb,changes:G.array(Xb)}).strict(),Qb=G.object({purpose:ba,type:G.string().min(1),name:G.string().min(1),value:G.string().min(1),verificationStatus:zb}).strict(),Dm=G.object({id:G.string().min(1),hostname:G.string().min(1),isPrimary:G.boolean(),routingMode:Gb,observedStatus:qb,lastVerifiedAt:G.string().datetime().nullable(),dnsRecords:G.array(Qb)}).strict().superRefine((e,n)=>{Zb(e.hostname)||n.addIssue({code:"custom",path:["hostname"],message:"hostname must be a canonical ASCII hostname"}),e.isPrimary&&e.routingMode!=="serve_site"&&n.addIssue({code:"custom",path:["routingMode"],message:"a primary domain must serve the site"}),!e.isPrimary&&e.routingMode!=="redirect_301"&&n.addIssue({code:"custom",path:["routingMode"],message:"a non-primary domain must redirect with 301"})}),Om=G.object({primaryDomain:Dm.nullable(),redirectDomains:G.array(Dm)}).strict().superRefine((e,n)=>{e.primaryDomain!==null&&(!e.primaryDomain.isPrimary||e.primaryDomain.routingMode!=="serve_site")&&n.addIssue({code:"custom",path:["primaryDomain"],message:"primaryDomain must be primary and serve the site"});for(let[a,i]of e.redirectDomains.entries())(i.isPrimary||i.routingMode!=="redirect_301")&&n.addIssue({code:"custom",path:["redirectDomains",a],message:"redirectDomains must be non-primary 301 redirects"});e.primaryDomain!==null&&e.redirectDomains.some(i=>i.hostname===e.primaryDomain?.hostname)&&n.addIssue({code:"custom",path:["redirectDomains"],message:"primaryDomain must not also be a redirect"});let s=[...e.primaryDomain===null?[]:[e.primaryDomain.hostname],...e.redirectDomains.map(a=>a.hostname)];new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["redirectDomains"],message:"domain hostnames must be unique"})}),js=G.object({id:G.string().min(1),type:ya,status:Vb,error:$b.nullable(),result:G.union([wm,vm]).nullable().optional()}).strict().superRefine((e,n)=>{if(e.status==="failed"&&e.error===null&&n.addIssue({code:"custom",path:["error"],message:"failed operations must include a stable error"}),e.status!=="failed"&&e.error!==null&&n.addIssue({code:"custom",path:["error"],message:"non-failed operations must not include an error"}),!(e.result===void 0||e.result===null)){if(e.status!=="succeeded"){n.addIssue({code:"custom",path:["result"],message:"operation results only belong to succeeded operations"});return}if(e.type==="verify_dns"){wm.safeParse(e.result).success||n.addIssue({code:"custom",path:["result"],message:"verify_dns operations require a DNS verification result"});return}if(e.type==="remediate_dns"){vm.safeParse(e.result).success||n.addIssue({code:"custom",path:["result"],message:"remediate_dns operations require a DNS remediation result"});return}n.addIssue({code:"custom",path:["result"],message:"only verify_dns and remediate_dns operations may carry a result"})}});function Zb(e){if(e!==e.trim()||e!==e.toLowerCase()||e.length>253||e.endsWith("."))return!1;let n=e.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 we}from"zod";import{z as f}from"zod";var Jb=f.enum(["active","completed","canceled"]),ey=f.enum(["quality","domain","gsc","publish"]),Ns=f.enum(["pending","running","succeeded","failed"]),Nm=Ns,Lm=f.enum(["pending","running","completed"]),ty=f.object({group_code:f.string().min(1),name:f.string().min(1),score:f.number().nonnegative(),total_score:f.number().nonnegative(),pass_score:f.number().nonnegative(),running_status:Lm,result_text:f.string()}).strict(),ny=f.object({id:f.number().int().positive().optional(),quality_task_id:f.number().int().positive(),item_code:f.string().min(1),status:Ns,is_repaired:f.boolean(),total_score:f.number().nonnegative(),score:f.number().nonnegative(),check_result:f.unknown().nullable(),remediation_items:f.unknown().nullable(),result_text:f.string(),created_at:f.string().min(1),updated_at:f.string().min(1),item_name:f.string().min(1),dimension_code:f.enum(["reach","trust","convert","safe"]),group_code:f.string().min(1),auto_fix:f.boolean()}).strict(),sy=f.object({dimension_code:f.enum(["reach","trust","convert","safe"]),name:f.string().min(1),alias_en:f.string().min(1),description:f.string(),tips:f.string(),score:f.number().nonnegative(),repaired_score:f.number().nonnegative(),total_score:f.number().nonnegative(),pass_score:f.number().nonnegative(),running_status:Lm,problem_group_count:f.number().int().nonnegative(),remediation_items:f.array(ny),groups:f.array(ty)}).strict(),iy=f.object({id:f.number().int().positive(),task_code:f.string().uuid(),scene_code:f.enum(["site_publish","vcp_published_pages","content_publish"]),tenant_id:f.string().min(1),vcp_site_id:T,cms_site_id:f.string().min(1),checked_url:f.string().url(),quality_params:f.record(f.string(),f.unknown()).nullable(),status:Ns,error_info:f.record(f.string(),f.unknown()).nullable(),created_at:f.string().min(1),updated_at:f.string().min(1)}).strict(),ay=f.union([f.object({}).strict(),f.object({summary:f.object({final_score:f.number().nonnegative(),pass_score:f.number().nonnegative(),group_count:f.number().int().nonnegative(),problem_group_count:f.number().int().nonnegative()}).strict(),dimensions:f.array(sy)}).strict()]),jm=f.object({quality_info:iy,quality_detail:ay}).strict().superRefine((e,n)=>{let s="summary"in e.quality_detail;e.quality_info.status!=="failed"&&!s&&n.addIssue({code:"custom",message:"nonfailed quality tasks require complete detail",path:["quality_detail"]}),e.quality_info.status==="failed"&&s&&n.addIssue({code:"custom",message:"failed quality tasks require empty detail",path:["quality_detail"]})}),uO=f.object({item_code:f.string().min(1),remediation_items:f.unknown().nullable()}).strict(),oy=f.object({item_code:f.string().min(1),repair_status:f.enum(["succeeded","failed"]),message:f.string().min(1).optional(),error_code:f.string().min(1).optional(),metadata:f.record(f.string(),f.unknown()).optional()}).strict(),Mm=f.object({items:f.array(oy)}).strict(),_O=f.object({task_code:f.string().min(1),status:Nm,result:Mm.optional()}).strict().superRefine((e,n)=>{e.status==="succeeded"&&e.result===void 0&&n.addIssue({code:"custom",path:["result"],message:"succeeded repair tasks require a complete result"}),(e.status==="pending"||e.status==="running")&&e.result!==void 0&&n.addIssue({code:"custom",path:["result"],message:"nonterminal repair tasks cannot expose a result"})}),St=f.object({id:Qa,tenant_id:f.string().min(1),site_id:T,status:Jb,current_step:ey,quality_task_code:f.string().uuid().nullable(),quality_task_status:Ns,repair_task_code:f.string().min(1).nullable(),repair_task_status:Nm,publish_deployment_id:Je.nullable(),domain_hostname:f.string().min(1).nullable(),domain_operation_type:ya.nullable(),domain_operation_payload:f.record(f.string(),f.unknown()).nullable(),domain_preparation_operation_id:f.string().min(1).nullable(),domain_operation_id:f.string().min(1).nullable(),revision:f.number().int().positive(),created_at:f.string().min(1),updated_at:f.string().min(1),completed_at:f.string().min(1).nullable(),canceled_at:f.string().min(1).nullable()}).strict().superRefine((e,n)=>{if(e.domain_operation_type===null){e.domain_operation_payload!==null&&n.addIssue({code:"custom",path:["domain_operation_payload"],message:"domain_operation_payload must be null without an active domain operation"}),e.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}e.domain_hostname===null&&n.addIssue({code:"custom",path:["domain_hostname"],message:"an active domain operation requires a hostname"}),e.domain_operation_payload===null&&n.addIssue({code:"custom",path:["domain_operation_payload"],message:"an active domain operation requires a payload"})}),gO=f.object({}).strict(),hO=f.object({expected_revision:f.number().int().nonnegative(),current_step:f.enum(["domain","gsc","publish"]),skip_domain_binding:f.boolean().optional()}).strict(),SO=f.object({expected_revision:f.number().int().nonnegative()}).strict(),ry=f.object({workflow:St.nullable(),can_cancel:f.boolean()}).strict(),fO=M(ry).strict(),cy=f.object({workflow:St,can_cancel:f.boolean()}).strict(),bO=M(cy).strict(),my=f.object({workflow:St,deployment:f.lazy(()=>ft)}).strict(),yO=M(my).strict(),ly=f.object({workflow:St,can_cancel:f.boolean(),quality_result:jm.optional(),repair_result:Mm.optional(),final_quality_result:jm.optional(),message:f.string().min(1).optional()}).strict(),xO=M(ly).strict();function py(e){return"summary"in e.quality_detail?e.quality_detail.dimensions.flatMap(n=>n.remediation_items.filter(s=>s.status==="succeeded"&&s.score<s.total_score&&s.auto_fix).map(s=>({item_code:s.item_code,remediation_items:s.remediation_items}))):[]}function dy(e,n){let s=e.map(r=>r.item_code),a=n.items.map(r=>r.item_code);if(new Set(s).size!==s.length||new Set(a).size!==a.length||s.length!==a.length)return!1;let i=new Set(s);return n.items.every(r=>i.has(r.item_code)&&r.repair_status==="succeeded")}function EO(e,n){if(!("summary"in e.quality_detail))return null;let s=py(e);if(s.length===0)return e;if(n===void 0||!dy(s,n))return null;let a=new Set(n.items.map(r=>r.item_code)),i=e.quality_detail.dimensions.map(r=>{let m=r.remediation_items.map(I=>a.has(I.item_code)?{...I,score:I.total_score,is_repaired:!0,result_text:""}:{...I}),c=r.groups.map(I=>{let R=m.filter(w=>w.group_code===I.group_code);return R.length===0?{...I}:{...I,score:R.reduce((w,F)=>w+F.score,0),result_text:R.map(w=>w.result_text).filter(Boolean).join("\u3001")}}),p=c.reduce((I,R)=>I+R.score,0);return{...r,score:p,repaired_score:p,problem_group_count:c.filter(I=>I.score!==I.total_score).length,remediation_items:m,groups:c}});return{quality_info:{...e.quality_info},quality_detail:{...e.quality_detail,summary:{...e.quality_detail.summary,final_score:Math.round(i.reduce((r,m)=>r+m.score,0)/i.length),problem_group_count:i.reduce((r,m)=>r+m.problem_group_count,0)},dimensions:i}}}var uy=we.object({hostname:we.string().min(1),expected_revision:we.number().int().nonnegative()}).strict(),Um=we.object({workflow:St,operation:js}).strict(),_y=M(Um).strict(),gy=we.object({expected_revision:we.number().int().nonnegative()}).strict(),hy=we.object({workflow:St,operation:js}).strict(),Sy=M(hy).strict(),xa=we.object({workflow:St,operation:js.nullable()}).strict(),fy=M(xa).strict(),by=xa,yy=M(by).strict(),PO=M(Om).strict(),xy=we.object({published:we.boolean(),hostname:we.string(),url:we.string(),sandbox_url:we.union([we.string().url(),we.literal("")])}).strict().superRefine((e,n)=>{e.published||(e.hostname!==""&&n.addIssue({code:"custom",path:["hostname"],message:"unpublished sites must not include a hostname"}),e.url!==""&&n.addIssue({code:"custom",path:["url"],message:"unpublished sites must not include a URL"}))}),wO=M(xy).strict(),CO=uy,vO=Um,DO=_y,OO=xa,jO=fy,NO=yy,LO=gy,MO=Sy;import{z as Ne}from"zod";var Ey=["started","success","failed","canceled"],Ea=Ne.enum(Ey),Ry=["inactive","pending_binding","active"],Ra=Ne.enum(Ry),Iy=["domain","url_prefix"],Ia=Ne.enum(Iy),Ty=["not_connected","authorizing","matching_property","ready","failed","canceled","domain_mismatch"],Ta=Ne.enum(Ty),Ze=Ne.string().nullable(),qm=Ne.object({}).strict(),ka=Ne.object({authorize_url:Ne.string().url(),custom_domain:Ze}).strict(),Fm=M(ka),ky=Ne.object({auth_status:Ea,binding_status:Ra,credential_connected:Ne.boolean(),custom_domain:Ze,gsc_site_url:Ze,property_type:Ia.nullable(),auth_error_code:Ze,auth_error_message:Ze}).strict(),Gm=Ne.object({auth_status:Ea,binding_status:Ra,credential_connected:Ne.boolean(),custom_domain:Ze,gsc_site_url:Ze,property_type:Ia.nullable(),auth_error_code:Ze,auth_error_message:Ze,current_domain:Ze,state:Ta,ready:Ne.boolean()}).strict().superRefine((e,n)=>{let s=Py(e,e.current_domain),a=s==="ready";e.state!==s&&n.addIssue({code:"custom",path:["state"],message:`state must equal ${s} for the supplied GSC facts`}),e.ready!==a&&n.addIssue({code:"custom",path:["ready"],message:`ready must equal ${String(a)} for the supplied GSC facts`})}),Ay=M(Gm);function On(e){let n=e?.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 Py(e,n){let s=e.gsc_site_url?.trim()??"",a=On(e.custom_domain),i=On(n??("current_domain"in e?e.current_domain:void 0)),r=a.length>0&&i.length>0&&a===i,m=wy(s,e.property_type,i);return e.auth_status==="canceled"?"canceled":e.auth_status==="failed"?"failed":e.auth_status==="started"?"authorizing":!e.credential_connected||e.binding_status==="inactive"?"not_connected":s.length===0||e.property_type===null?"matching_property":!r||!m?"domain_mismatch":e.binding_status==="pending_binding"?"matching_property":e.auth_status==="success"&&e.binding_status==="active"&&e.credential_connected&&s.length>0&&r&&m?"ready":"failed"}function wy(e,n,s){let a=e?.trim()??"",i=On(s);if(!a||!i||!n)return!1;if(n==="domain"){let r=/^sc-domain:(.+)$/i.exec(a);if(!r)return!1;let m=r[1].trim();if(!m||/[/:?#]/.test(m))return!1;let c=On(m);return c?i===c||i.endsWith(`.${c}`):!1}try{let r=new URL(a);return r.protocol!=="https:"||r.username||r.password||r.port||r.pathname!=="/"||r.search||r.hash?!1:On(r.hostname)===i}catch{return!1}}var GO=qm,KO=ka,WO=Fm,zO=Ta,BO=Ea,HO=Ra,VO=Ia,$O=Ta,YO=qm,XO=ka,QO=Fm,ZO=ky,JO=Gm,ej=Ay;var Km=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,Wm="VCP_E2B_PREVIEW_PROXY_DOMAIN must be a valid hostname.";function Cy(e){let n=e?.trim().toLowerCase()??"";if(!n)return null;if(n.length>253||!n.includes(".")||!n.split(".").every(s=>Km.test(s)))throw new Error(Wm);return n}function nj(e){let n=Cy(e.proxyDomain);if(!n)return null;let s=e.sandboxId.trim();if(!Km.test(s))throw new Error("sandboxId must be a valid DNS label.");if(`${s}.${n}`.length>253)throw new Error(Wm);return`https://${s}.${n}/`}function ij(e){for(let n of e.targets)if(!(n.kind==="shared"?e.ledger.shared.some(a=>a.kind==="shared"&&a.target_id===n.target_id&&a.filled!==!0):e.ledger.pages.some(a=>a.omissions.some(i=>i.kind===n.kind&&i.target_id===n.target_id&&i.filled!==!0))))return{ok:!1,target_id:n.target_id};return{ok:!0}}function vy(e,n,s=e){let a=new Map(e.map(c=>[c.slug,c])),i=new Map(s.map(c=>[c.id,c])),r=new Map(e.map(c=>{let p=i.get(c.id);return p&&p.slug!==null&&p.slug!==c.slug?[p.slug,c]:null}).filter(c=>c!==null)),m=new Set(s.map(c=>c.slug).filter(c=>c!==null&&!a.has(c)));return{primaryLinks:zm(n.primaryLinks,e,a,r,m,i,"showInHeader"),footerLinks:zm(n.footerLinks,e,a,r,m,i,"showInFooter")}}function zm(e,n,s,a,i,r,m){let c=new Set,p=[];for(let[F,B]of e.entries()){let ee=Dy(B.href),pe=ee===null?void 0:s.get(ee)??a.get(ee);if(ee!==null&&i.has(ee)&&!s.has(ee)&&!a.has(ee))continue;if(pe?.slug==="/"){p.push({kind:"independent",link:{...B,label:Bm(B,pe,r)}});continue}if(!pe){p.push({kind:"independent",link:B});continue}if(!pe.navigation[m])continue;c.add(pe.slug);let Xt=ee===pe.slug?B.href:Oy(B.href,pe.slug);p.push({kind:"page",page:pe,link:{...B,label:Bm(B,pe,r),href:Xt},index:F})}let I=p.filter(F=>F.kind==="page").sort((F,B)=>F.page.navigation.order-B.page.navigation.order||F.index-B.index),R=0,w=p.map(F=>F.kind==="page"?I[R++].link:F.link);for(let F of[...n].filter(B=>B.slug!=="/"&&B.navigation[m]).sort((B,ee)=>B.navigation.order-ee.navigation.order))c.has(F.slug)||w.push({label:F.title,href:F.slug});return w}function Bm(e,n,s){let a=s.get(n.id);return e.label===(a?.title??n.title)?n.title:e.label}function Dy(e){if(!e.startsWith("/")||e.startsWith("//"))return null;let n=e.search(/[?#]/u);return n===-1?e:e.slice(0,n)}function Oy(e,n){let s=e.search(/[?#]/u);return s===-1?n:`${n}${e.slice(s)}`}function Ls(e){return e.trim().normalize("NFKC").toLowerCase()}function jy(e){let n=e?.toLowerCase();return n?.startsWith("zh")?"\u9996\u9875":n?.startsWith("ja")?"\u30DB\u30FC\u30E0":n?.startsWith("ko")?"\uD648":"Home"}function Ny(e){let n=e?.toLowerCase();return n?.startsWith("zh")?"\u66F4\u591A":n?.startsWith("ja")?"\u305D\u306E\u4ED6":n?.startsWith("ko")?"\uB354\uBCF4\uAE30":n?.startsWith("fr")?"Plus":n?.startsWith("de")?"Mehr":n?.startsWith("es")?"M\xE1s":"More"}function Ly(e){return e.map(n=>n.navigation.showInHeader===!0?n:{...n,navigation:{...n.navigation,showInHeader:!0}})}function jn(e){return e.parent_page_id??null}function Ms(e,n){let s=jn(e);return s===null?!0:!n.some(a=>a.id===s)}function Hm(e,n){return e.filter(s=>jn(s)===n&&s.id!==n)}function Vm(e){let n=e.filter(m=>Ms(m,e)),s=n.filter(m=>m.slug==="/"),a=n.filter(m=>m.slug!=="/"),i=[],r=new Set;for(let m of[...s,...a])if(!r.has(m.id)){i.push(m),r.add(m.id);for(let c of Hm(e,m.id))r.has(c.id)||(i.push(c),r.add(c.id))}for(let m of e)r.has(m.id)||(i.push(m),r.add(m.id));return i}function My(e){if(!e.startsWith("/")||e.startsWith("//"))return null;let n=e.search(/[?#]/);return n===-1?e:e.slice(0,n)}function Uy(e,n){let s=Vm(n),a=new Map;s.forEach((m,c)=>{m.slug!==null&&!a.has(m.slug)&&a.set(m.slug,c)});let i=[],r=[];for(let m of e){let c=My(m.href),p=c===null?void 0:a.get(c);p===void 0?r.push(m):i.push({link:m,rank:p})}return i.sort((m,c)=>m.rank-c.rank),[...i.map(m=>m.link),...r]}function qy(e){let n=e.filter(s=>Ms(s,e)).length;return{top_level_pages:n,sub_pages:e.length-n,total_pages:e.length,content_items:e.reduce((s,a)=>s+a.blocks.length,0)}}function Fy(e,n={}){let s=[],a=new Map(e.map(m=>[m.id,m])),i=e.filter(m=>m.slug==="/");i.length!==1?s.push({code:"missing_home",page_id:null,message:"The structure must contain exactly one home page."}):n.expectedHomeTitle&&Ls(i[0].title)!==Ls(n.expectedHomeTitle)&&s.push({code:"home_renamed",page_id:i[0].id,message:`The home page must keep its fixed name '${n.expectedHomeTitle}'.`});for(let m of e){m.title.trim().length===0&&s.push({code:"empty_title",page_id:m.id,message:"Page name is empty."}),m.slug&&n.reservedSlugs?.includes(m.slug)&&s.push({code:"reserved_slug",page_id:m.id,message:`Slug '${m.slug}' is reserved by the site's applications.`});let c=jn(m);if(c===null)continue;if(m.slug==="/"){s.push({code:"home_has_parent",page_id:m.id,message:"The home page cannot have a parent."});continue}if(c===m.id){s.push({code:"self_parent",page_id:m.id,message:"A page cannot be its own parent."});continue}let p=a.get(c);if(!p){s.push({code:"parent_not_found",page_id:m.id,message:`Parent page '${c}' does not exist.`});continue}if(p.slug==="/"){s.push({code:"home_has_children",page_id:m.id,message:"The home page cannot have sub pages."});continue}jn(p)!==null&&s.push({code:"depth_exceeded",page_id:m.id,message:"At most two levels are allowed."})}let r=new Map;for(let m of e){let c=Ms(m,e)?"__top__":jn(m),p=Ls(m.title);if(p.length===0)continue;let I=r.get(c)??new Map,R=I.get(p);R!==void 0&&R!==m.id?s.push({code:"duplicate_sibling_title",page_id:m.id,message:`Page name '${m.title}' is already used at the same level.`}):I.set(p,m.id),r.set(c,I)}return s}var Gy=16,Ky=/[ᄀ-ᅟ⺀-〾ぁ-㏿㐀-䶿一-鿿ꀀ-가-힣豈-︰--⦆¢-₩]/u;function Wy(e){let n=0;for(let s of e)n+=Ky.test(s)?2:1;return n}function zy(e){let n=e.normalize("NFKC").trim().replace(/\s+/g," ").toLowerCase();return n.length>3&&n.endsWith("s")?n.slice(0,-1):n}import{z as y}from"zod";var $m=20*1024*1024,By=$m,Ym=["jpg","jpeg","png","gif","webp","bmp"],Xm=["mp4","avi","mov","webm","mkv"],Qm=["mp3","wav","aac","flac","ogg","wma","m4a"],Zm=["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","md","csv"],Jm=[...Zm,"zip","rar","json","xmind","psd","ai","fig","sketch"],Hy=[...Ym,...Xm,...Qm,...Jm],el=["image/jpeg","image/png","image/gif","image/webp","image/bmp"],tl=["video/mp4","video/x-msvideo","video/quicktime","video/webm","video/x-matroska"],nl=["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"],Vy=[...el,...tl,...nl],sl=y.enum(["image","video","audio","file"]),il=y.enum(["external","ai_generated","unsplash"]),Aa=y.object({resource_id:y.string().min(1),name:y.string().min(1).max(255),url:y.string().url(),thumbnail_url:y.union([y.string().url(),y.literal("")]),mime_type:y.string().trim().min(3).max(127),size:y.number().int().nonnegative(),width:y.number().int().positive().nullable(),height:y.number().int().positive().nullable(),source:il,created_at:y.string().min(1).nullable()}),$y=y.object({page:y.coerce.number().int().min(1).default(1),page_size:y.coerce.number().int().min(1).max(100).default(24),keyword:y.string().trim().max(100).optional(),file_type:sl.default("image")}),Yy=y.object({code:y.literal(0),message:y.string(),data:y.object({items:y.array(Aa),page:y.number().int().min(1),page_size:y.number().int().min(1),total:y.number().int().nonnegative()})}),Xy=y.object({code:y.literal(0),message:y.string(),data:Aa}),Bt=4,Qy="site.image_generation.max",Zy=y.object({quantity:y.number().int().min(1).max(Bt)}),Pa=y.object({available:y.boolean(),remaining:y.number().nonnegative().nullable(),unlimited:y.boolean(),max_quantity:y.number().int().min(0).max(Bt)}),Jy=y.object({code:y.literal(0),message:y.string(),data:Pa}),ex=y.object({pageName:y.string().trim().min(1).max(255),pageType:y.string().trim().min(1).max(40),sectionTitle:y.string().trim().max(500),nearbyTitle:y.string().trim().max(500),nearbyBody:y.string().trim().max(2e3),prompt:y.string().trim().min(1).max(2e3),aspectRatio:y.string().regex(/^\d{1,2}:\d{1,2}$/)}),al=y.discriminatedUnion("ok",[y.object({index:y.number().int().min(0).max(Bt-1),ok:y.literal(!0),url:y.httpUrl(),request_id:y.string().uuid()}),y.object({index:y.number().int().min(0).max(Bt-1),ok:y.literal(!1),error:y.enum(["quota","generate","network"]),message:y.string().trim().min(1).max(500),request_id:y.string().uuid().nullable()})]),tx=y.object({code:y.literal(0),message:y.string(),data:y.object({quota:Pa,items:y.array(al).max(Bt)})}),ol=y.object({provider_id:y.string().min(1),url:y.string().url(),thumbnail_url:y.string().url(),width:y.number().int().positive(),height:y.number().int().positive(),alt:y.string(),photographer_name:y.string().min(1),photographer_url:y.string().url(),photo_url:y.string().url(),download_location:y.string().url(),dominant_color:y.string().nullable()}),nx=y.object({query:y.string().trim().min(1).max(100),page:y.coerce.number().int().min(1).default(1),page_size:y.coerce.number().int().min(1).max(30).default(18),orientation:y.enum(["landscape","portrait","squarish"]).optional()}),sx=y.object({code:y.literal(0),message:y.string(),data:y.object({items:y.array(ol),page:y.number().int().min(1),page_size:y.number().int().min(1),total:y.number().int().nonnegative(),total_pages:y.number().int().nonnegative()})}),rl=y.string().url().refine(cx,{message:"download_location must be an official Unsplash download URL"}),ix=y.object({download_location:rl}),ax=y.object({code:y.literal(0),message:y.string(),data:y.object({reported:y.boolean()})}),ox=y.object({source_id:y.number().int().positive(),source_title:y.string().min(1).max(255),source_url:et,resource_id:y.number().int().positive()}),rx=y.object({code:y.literal(0),message:y.string(),data:y.object({reported:y.boolean()})});function cx(e){if(!URL.canParse(e))return!1;let n=new URL(e);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 mx=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(e=>e.colorSeeds!==void 0||e.surfaceMode!==void 0||e.fonts!==void 0,{message:"colorSeeds, surfaceMode, or fonts is required"}),lx=Ce.object({ok:Ce.literal(!0),design_plan_version:Ce.number().int().positive(),snapshot_id:k,site_design_context:Ce.lazy(()=>Us).optional(),changed_files:Ce.array(Ce.string().min(1)).optional()});var va=t.object({heading:t.string().min(1).max(160).optional(),body:t.string().min(1).max(160).optional(),paletteIntent:t.string().min(1).max(400).optional(),surfaceMode:t.enum(["light","dark"]).optional(),radius:t.enum(["none","sm","md","lg","xl"]).optional(),density:t.enum(["compact","comfortable","airy","editorial"]).optional(),motionPreset:t.enum(["subtle","moderate","expressive"]).optional(),colorSeeds:t.object({primary:t.string().min(1).max(40),accent:t.string().min(1).max(40),foreground:t.string().min(1).max(40).optional(),neutral:t.string().min(1).max(40).optional(),supporting:t.array(t.string().min(1).max(40)).max(4).optional()}).optional(),imagePalette:t.object({background:t.string().min(1).max(40).optional(),foreground:t.string().min(1).max(40).optional(),card:t.string().min(1).max(40).optional(),muted:t.string().min(1).max(40).optional(),border:t.string().min(1).max(40).optional()}).optional(),themeId:t.string().min(1).max(60).optional(),themeDescription:t.string().min(1).max(400).optional(),aestheticNote:t.string().min(1).max(300).optional()}),wa=t.enum(["material","reference","brief","industry"]),px=t.object({market:t.object({value:t.string().min(1).max(200),source:wa}),customer:t.object({value:t.string().min(1).max(200),source:wa}),purpose:t.object({options:t.array(t.string().min(1).max(60)).min(2).max(4),selected:t.string().min(1).max(60),source:wa})}),dx=t.enum(["text-options","motion-slider","positioning"]),Da=t.enum(["none","subtle","moderate","expressive"]),ux=t.enum(["compact","comfortable","airy","editorial"]),_x=Da,ul=t.object({skill_name:t.string().min(1),rationale:t.string().min(4).max(200),confidence:t.enum(["high","medium","low"]).optional(),displayName:t.object({zh:t.string().min(1),en:t.string().min(1)}).partial().optional()}),gx=t.object({value:t.string(),label:t.string(),desc:t.string().optional(),impact:t.string().optional(),isRecommended:t.boolean().optional(),preselect:t.boolean().optional(),visualHints:va.optional(),conversionHints:Rt.optional()}),hx=t.object({id:t.string(),type:dx,question:t.string(),tag:t.string(),aiThinking:t.string(),options:t.array(gx),source:t.enum(["ai-detected","always-ask"]),sourceDetail:t.string(),positioning:px.optional()}),Oa=t.object({questions:t.array(hx).min(1).max(6)}),Gj=t.object({tenant_id:t.string().min(1),site_id:T,brief_id:Dt,brief:t.string().min(20).max(1e3),site_default_locale:fe.optional(),owner_locale:fe.optional(),input_context:t.object({facts:t.array(Fn).max(120),conflicts:t.array(Kn).max(20),reference:Gn.optional(),sources:t.array(t.object({type:$s,title:t.string().max(120).optional(),status:Ys})).max(16).optional()}).optional()}),_l=t.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),Kj=t.discriminatedUnion("type",[t.object({type:t.literal("run.started"),runId:K,at:t.string().min(1)}),t.object({type:t.literal("skill.selecting"),category:t.literal("page-generation"),available:t.array(t.object({id:t.string().min(1),name:t.string().min(1)})).max(20),at:t.string().min(1)}),t.object({type:t.literal("skill.selected"),category:t.literal("page-generation"),selected:t.object({id:t.string().min(1),name:t.string().min(1),reason:t.string().min(1).max(200)}),at:t.string().min(1)}),t.object({type:t.literal("clarify.partial"),object:t.unknown(),at:t.string().min(1)}),t.object({type:t.literal("clarify.archetype_proposals"),proposals:t.array(ul).min(1).max(5),at:t.string().min(1)}),t.object({type:t.literal("clarify.finished"),questions_id:t.string().min(1),at:t.string().min(1)}),t.object({type:t.literal("run.failed"),error_code:t.string().min(1),message:t.string().min(1),error_category:_l.optional(),retryable:t.boolean().optional(),attempts:t.number().int().positive().optional(),at:t.string().min(1)}),t.object({type:t.literal("run.finished"),at:t.string().min(1)})]),Wj="SITE_PLANNING_INPUT_FROZEN",zj="SITE_PLANNING_LOCKED",Bj="SITE_STRUCTURE_CONFIRMATION_REQUIRED",Hj="SITE_STRUCTURE_CONFIRMATION_STALE",cl="SITE_STRUCTURE_INVALID",Vj=t.object({tenant_id:t.string().min(1),name:t.string().min(1).max(120),brief:t.string().min(20).max(1e3)}),$j=t.object({name:t.string().min(1).max(120),brief:t.string().min(20).max(1e3)}),Yj=t.object({name:t.string().min(1).max(120)}),Xj=t.object({name:t.string().min(1).max(120),default_locale:fe.optional()}),Qj=t.object({body:t.string().min(20).max(1e3)}),Zj=t.object({body:t.string().min(20).max(1e3)}),ja=t.string().url().refine(e=>{try{let n=new URL(e).protocol;return n==="http:"||n==="https:"}catch{return!1}},{message:"URL must use http or https protocol"}),Jj=t.object({tenant_id:t.string().min(1),site_id:T.optional(),site_url:ja,site_name:t.string().trim().min(1).max(255).optional()}),eN=M(qo),tN=M(Fo),nN=M(Go),sN=M(tr),iN=M(nr),aN=M(sr),oN=M(ar),rN=M(or),cN=M(rr),mN=M(t.object({site_id:T,site_url:ja})),yt=t.object({id:T,tenant_id:t.string().min(1),name:t.string().min(1),slug:t.string().min(1),status:ki,deployment_status:Ai,archived_at:t.string().min(1).nullable(),current_sitemap_id:Ae.nullable(),confirmed_sitemap_id:Ae.nullable().optional(),confirmed_sitemap_version:t.number().int().positive().nullable().optional(),structure_confirmed_at:t.string().min(1).nullable().optional(),migration_content_requested:t.boolean().optional(),current_snapshot_id:k.nullable(),published_deployment_id:Je.nullable().optional(),deployed_url:t.string().url().nullable(),default_locale:fe,owner_locale:fe.optional(),cms_site_id:bo.nullable().optional(),cms_site_url:ja.nullable().optional(),parent_site_id:T.nullable().optional(),mount_path:t.string().min(1).nullable().optional(),schema_version:t.literal(1),created_at:t.string().min(1),updated_at:t.string().min(1)}),Na=t.object({id:Dt,tenant_id:t.string().min(1),site_id:T,body:t.string().min(1),source:t.enum(["user","import","system"]),created_at:t.string().min(1),updated_at:t.string().min(1)}),lN=t.object({site:yt,brief:Na,next_step:t.literal("clarify")}),pN=t.object({site:yt,brief:Na}),dN=t.object({brief:Na}),Sx=t.enum(["queued","running","succeeded","failed","cancelled"]),gl=t.enum(["clarify","sitemap","workspace"]),hl=t.enum(["clarify","sitemap","initial_generation","iteration","landing_page","fill_in"]),Sl=t.enum(["clarify","sitemap","workspace","summarize"]),Be=t.object({id:K,tenant_id:t.string().min(1),site_id:T,agent_type:gl,run_kind:hl,status:Sx,model_route:Sl,started_at:t.string().min(1).nullable(),finished_at:t.string().min(1).nullable(),error_code:t.string().min(1).nullable(),created_at:t.string().min(1),thread_id:He.nullable().optional()}),uN=t.object({agent_run:Be}).strict(),fx=t.enum(["workspace","landing_page","external"]),bx=t.enum(["user","background"]),fl=t.enum(["active","archived"]),Ks=t.object({id:He,tenant_id:t.string().min(1),site_id:T,kind:fx,origin:bx,subject_key:t.string().min(1).max(200),title:t.string().min(1).max(200),status:fl,external_thread_id:t.string().min(1).max(200).nullable(),last_run_id:K.nullable(),last_activity_at:t.string().min(1),created_at:t.string().min(1),updated_at:t.string().min(1)}),_N=t.object({agent_run:Be,thread:Ks.nullable()}),gN=t.object({run_id:K.optional(),site_id:T,agent_type:gl,run_kind:hl.optional(),model_route:Sl,input:t.record(t.string(),t.unknown()).optional()}).superRefine((e,n)=>{Nn(e.input)&&n.addIssue({code:"custom",path:["input"],message:"Agent run input must not contain secrets"})}),hN=t.object({agent_run:Be,next_step:t.literal("stream_events")}),bl=t.enum(["draft","candidate","deleting","current","failed"]),ct=t.object({id:k,tenant_id:t.string().min(1),site_id:T,version:t.number().int().positive(),manifest_hash:t.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:t.string().min(1),template_version:We.nullable().optional(),reason:t.enum(["initial_generation","workspace_edit","pre_deploy","manual_save","rollback","template_upgrade","subsite_clone"]),status:bl,created_at:t.string().min(1)}),SN=t.object({snapshot_id:k,creation_key:t.string().min(1),manifest_hash:t.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:t.string().min(1),template_version:We.optional(),reason:ct.shape.reason,status:t.enum(["draft","candidate","current","failed"]).default("candidate"),source_run_id:K.optional()}),fN=t.object({site:yt,snapshot:ct,next_step:t.literal("workspace")}),bN=t.object({expected_manifest_hash:ct.shape.manifest_hash,manifest_hash:ct.shape.manifest_hash,object_key:ct.shape.object_key}).strict(),yN=t.union([t.object({base_snapshot_id:k.nullable(),source_run_id:K.optional()}).strict(),t.object({skip_base_check:t.literal(!0)}).strict()]),yx=t.object({site:yt,snapshot:ct,next_step:t.literal("workspace")}),xN=t.object({snapshot:ct}),EN=t.object({status:t.literal("deleting"),snapshot_id:k,object_key:t.string().min(1)}),RN=t.object({status:t.literal("deleted"),snapshot_id:k}),Ws=t.object({id:Ya,tenant_id:t.string().min(1),site_id:T,snapshot_id:k,version:t.number().int().positive(),accepted_commit:t.string().min(1),source_run_id:K.nullable(),created_at:t.string().min(1)}),xx=Ws.extend({reason:ct.shape.reason,status:bl}),IN=t.object({accepted_commit:t.string().min(1),source_run_id:K.optional()}),TN=t.object({site_version:Ws,next_step:t.literal("workspace")}),kN=t.object({owner_id:t.string().min(1)}).strict(),AN=t.discriminatedUnion("acquired",[t.object({acquired:t.literal(!0)}).strict(),t.object({acquired:t.literal(!1)}).strict()]),PN=t.object({owner_id:t.string().min(1)}).strict(),wN=t.object({released:t.literal(!0)}).strict(),CN="TEMPLATE_UPGRADE_LOCK_LOST",vN=t.object({base_snapshot_id:k,accepted_commit:Ws.shape.accepted_commit,owner_id:t.string().min(1)}).strict(),DN=yx.strict(),ON=t.object({site_versions:t.array(xx)}),jN=t.object({site:yt,snapshot:ct,site_version:Ws,next_step:t.literal("workspace")}),NN=t.object({snapshot_id:k,force_rehydrate:t.boolean().optional()}),Ex=t.discriminatedUnion("status",[t.object({status:t.literal("ready"),snapshot_id:k,preview_url:t.string().min(1),launch_id:t.string().min(1).optional()}),t.object({status:t.literal("failed"),code:t.string().min(1),message:t.string().min(1),retryable:t.boolean()})]),LN=t.object({tenant_id:t.string().min(1),site_id:T,snapshot_id:k}).strict(),MN=Ex,La=t.enum(jt),yl=t.enum(["quality_check","publish"]),ft=t.object({id:Je,tenant_id:t.string().min(1),site_id:T,snapshot_id:k,type:yl.default("publish"),version:t.number().int().positive(),status:La,provider:t.enum(["cloudflare"]),url:t.string().url().nullable(),error_code:t.string().min(1).nullable(),provider_deployment_id:t.string().min(1).nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}),UN=t.object({tenant_id:t.string().min(1),site_id:T,expected_snapshot_id:k}).strict(),qN=t.object({deployment:ft}),FN=t.object({tenant_id:t.string().min(1),site_id:T,deployment_id:Je}).strict(),GN=t.object({deployment:ft}),KN=t.object({}).strict(),WN=t.object({snapshot_id:k.optional()}).strict(),Rx=t.object({deployment:ft}),zN=M(Rx),BN=t.object({deployment:ft.nullable()}),HN=t.object({deployment:ft}),ml=t.object({id:Je,type:yl.default("publish"),status:La,url:t.string().url().nullable(),error_code:t.string().min(1).nullable(),provider_deployment_id:t.string().min(1).nullable()}),Ix=t.object({current:ml.nullable(),latest_released:ml.nullable()}),VN=M(Ix),Tx=t.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),Ht=t.object({id:t.string().min(1),tenant_id:t.string().min(1),site_id:T,deployment_id:Je,seq:t.number().int().positive(),sent_at:t.string().min(1)}),qs=t.object({deployment:ft,steps:$r.default([])}),$N=t.discriminatedUnion("type",[Ht.extend({type:t.literal("deployment.snapshot"),payload:qs}),Ht.extend({type:t.literal("deployment.status.changed"),payload:qs}),Ht.extend({type:t.literal("deployment.finished"),payload:qs}),Ht.extend({type:t.literal("deployment.failed"),payload:qs}),Ht.extend({type:t.literal("deployment.realtime.recovered"),payload:t.object({action:t.literal("refresh")})}),Ht.extend({type:t.literal("server.error"),payload:t.object({code:t.string().min(1),message:t.string().min(1),retryable:t.boolean()})})]),YN=t.object({tenant_id:t.string().min(1),site_id:T,deployment_id:Je,status:La,updated_at:t.string().min(1)}),kx="vcp:deployments",XN={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:kx,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...Tx.options]},Ax=t.object({error:t.object({code:t.string().min(1),message:t.string().min(1),details:t.unknown().optional(),request_id:t.string().min(1).optional(),retryable:t.boolean().default(!1)})}),QN=t.object({error:Ax.shape.error.extend({code:t.literal("AGENT_RUN_IN_FLIGHT"),details:t.object({code:t.literal("AGENT_RUN_IN_FLIGHT"),message:t.string().min(1),agent_run:Be})})}),ZN=t.object({colors:t.record(t.string(),t.string()).default({}),typography:t.record(t.string(),t.string()).default({}),spacing:t.record(t.string(),t.string()).default({}),motion:t.record(t.string(),t.string()).default({})}),Px=t.object({theme_id:t.string().min(1),paletteIntent:t.string().min(1),tone:t.string().min(1),mediaMood:t.string().min(1),motionLevel:Da.optional(),userVisualHints:va.optional()}),wx=t.object({key:t.string().min(1).max(64).optional(),question:t.string().min(1),answer:t.string().min(1)}),JN=t.object({query:t.string().min(1),keywords:t.array(t.string()).default([]),orientation:t.enum(["landscape","portrait","square"]).optional(),role:t.enum(["hero","section","card","gallery","testimonial","decorative"]),altHint:t.string().min(1)}),eL=t.object({id:t.string().min(1),role:t.enum(["site_background","nav_background","footer_background"]),query:t.string().min(1),keywords:t.array(t.string()).default([]),treatment:t.enum(["cover","fixed-cover","subtle-texture"]),altHint:t.string().optional()}),Cx=t.object({provider:t.enum(["unsplash","pexels"]),providerLabel:t.enum(["Unsplash","Pexels"]),providerHref:t.string().url(),photoHref:t.string().url().optional(),photographerName:t.string().optional(),photographerHref:t.string().url().optional(),requiresAttribution:t.boolean()}),tL=t.object({src:t.string().min(1),alt:t.string().min(1),width:t.number().int().positive().optional(),height:t.number().int().positive().optional(),provider:t.enum(["unsplash","pexels","placeholder"]).optional(),providerId:t.string().optional(),photoUrl:t.string().url().optional(),photographer:t.string().optional(),photographerUrl:t.string().url().optional(),credit:t.string().optional(),dominantColor:t.string().optional(),attribution:Cx.optional()}),vx=t.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),Vt=t.object({id:t.string().min(1),name:t.string().min(1),category:t.literal("page-generation"),version:t.string().min(1).optional(),reason:t.string().min(1).max(200),source:vx.default("system_recommended")}),J=t.string().min(1).max(2e3),ll=t.string().min(1).max(120),Us=t.object({visualDirection:J,brandFeeling:J,paletteIntent:J,typographyIntent:J,density:ux,motionLevel:_x,motionPreset:t.enum(["subtle","moderate","expressive"]).optional(),mediaStrategy:J,compositionRules:t.array(J).max(20),avoidPatterns:t.array(J).max(20),fonts:t.object({heading:t.string().min(1),body:t.string().min(1)}).optional(),colorSeeds:t.object({primary:t.string().min(1).max(40),accent:t.string().min(1).max(40),foreground:t.string().min(1).max(40).optional(),neutral:t.string().min(1).max(40).optional(),supporting:t.array(t.string().min(1).max(40)).max(4).optional()}).optional(),surfaceMode:t.enum(["light","dark"]).optional(),radius:t.enum(["none","sm","md","lg","xl"]).optional(),imagePalette:t.object({background:t.string().min(1).max(40).optional(),foreground:t.string().min(1).max(40).optional(),card:t.string().min(1).max(40).optional(),muted:t.string().min(1).max(40).optional(),border:t.string().min(1).max(40).optional()}).optional()}),Ma=160,xl=t.object({routeGoal:J,narrativeArc:J,firstViewportIntent:J,visualContinuity:J,sectionRhythm:J,avoidPatterns:t.array(J).max(20),displayTitle:t.string().min(1).max(40).optional(),displayDescription:t.string().min(1).max(Ma).optional(),metaTitle:t.string().min(1).max(120).optional(),metaDescription:t.string().min(1).max(320).optional(),primaryKeyword:t.string().min(1).max(160).optional(),longTailKeywords:t.array(t.string().min(1).max(160)).max(3).optional()}),El=t.enum(["model_call","validation","repair","preview","worker_group"]),bt=t.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),Rl=t.object({sectionRole:J,contentIntent:J,layoutIntent:J,visualIntent:J,mediaIntent:J,motionIntent:J,copyTone:J,displayTitle:t.string().min(1).max(40).optional(),displayDescription:t.string().min(1).max(Ma).optional(),ctaIntent:J.optional(),continuityWithPrevious:J.optional(),avoidRepeating:t.array(J).max(20).optional(),industryRecipeRefs:t.array(ll).max(12).optional(),templateRecipeRefs:t.array(ll).max(12).optional()}),Il=t.object({siteName:t.string().min(1).max(120),tagline:t.string().min(1).max(200).optional(),primaryCta:t.object({label:t.string().min(1).max(60),target:t.string().min(1).max(200)}).optional(),trustSignals:t.array(t.string().min(1).max(60)).max(6).optional(),industry:t.string().min(1).max(40).optional()}),Dx=t.enum(["solid","floating"]),Ox=t.enum(["background","card","primary","frosted"]),jx=t.enum(["sticky","hide-on-scroll","static"]),Nx=t.enum(["bar","island"]),Lx=t.object({variant:Dx,surface:Ox.optional(),behavior:jx.optional(),shape:Nx.optional()}),Mx=t.object({form:J,layoutIntent:J,scrollBehavior:J,shell:Lx.optional(),avoidPatterns:t.array(J).max(10).optional()}),Ux=t.enum(["background","card","primary","inverse"]),qx=t.object({surface:Ux}),Fx=t.object({form:J,composition:J,shell:qx.optional(),avoidPatterns:t.array(J).max(10).optional()}),Gx=t.object({pattern:J,intent:J}),Tl=t.object({header:Mx,footer:Fx,mobileNav:Gx}),kl=t.object({schemaVersion:t.literal(1).default(1),siteDesignContext:Us,routeCards:t.record(t.string().min(1),xl),blockContexts:t.record(t.string().min(1),Rl),selectedSkillPacks:t.array(Vt).max(3).optional(),branding:Il.optional(),chromeDesign:Tl.optional()}),nL=t.object({siteDesignContext:Us.omit({imagePalette:!0}).optional(),routeCards:t.record(t.string().min(1),xl).optional(),blockContexts:t.record(t.string().min(1),Rl).optional(),branding:Il.optional(),chromeDesign:Tl.optional()}),Ie=t.string().trim().min(1),Ua=t.object({id:Ie,label:t.string().trim().min(1),type:t.string(),variant:t.string().optional(),order:t.number(),props:t.record(t.string(),t.unknown()),meta:t.object({aiGenerated:t.boolean(),userEdited:t.boolean(),lastEditedAt:t.string(),lastEditedBy:t.enum(["ai","user"]),userInstruction:t.string().optional()}).optional()}).strict(),qa=t.string().regex(ln,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),Kx=new RegExp(`^/(?:${Lt}(?:/${Lt})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),Wx=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,zx=t.union([t.string().regex(Kx),t.string().regex(Wx)]),pl=t.object({label:t.string(),href:zx}).passthrough(),Bx=t.object({primaryLinks:t.array(pl),footerLinks:t.array(pl)}),Al=t.object({showInHeader:t.boolean(),showInFooter:t.boolean(),order:t.number()}).strict(),Fa=t.object({id:Ie,slug:qa,title:t.string().trim().min(1),blocks:t.array(Ua).min(1),navigation:Al,parent_page_id:Ie.nullable().optional()}).strict(),Hx=Ua.extend({type:t.string().nullable()}).strict(),Vx=Fa.extend({slug:qa.nullable(),navigation:Al.extend({showInHeader:t.boolean().nullable(),showInFooter:t.boolean().nullable()}).strict(),blocks:t.array(Hx).min(1)}).strict(),$x=Ua.extend({id:t.string()}),Yx=Fa.omit({parent_page_id:!0}).extend({id:t.string(),slug:t.string().min(1),blocks:t.array($x).min(1),parent_page_id:t.string().nullable().optional()}),dl=t.object({label:t.string(),href:t.string().min(1)}),Xx=t.object({primaryLinks:t.array(dl),footerLinks:t.array(dl)}),Qx=t.discriminatedUnion("kind",[t.object({kind:t.literal("brief_clarify"),brief_id:Dt,answer_ids:t.array(t.string().min(1)).max(10)}).strict(),t.object({kind:t.literal("step5_strategy"),strategy_version_id:t.string().uuid(),strategy_version:t.number().int().positive(),strategy_checksum:t.string().regex(/^[a-f0-9]{64}$/)}).strict()]),Fs=t.object({site_name:t.string().min(1).max(80).optional(),version:t.number().int().positive(),pages:t.array(Fa).min(1),navigation:Bx,integrations:t.object({cms:t.unknown().optional(),analytics:t.unknown().optional()}).optional(),meta:t.object({generatedAt:t.string(),generatedBy:t.literal("sitemap-agent"),source_brief_id:t.string().optional(),source_answer_ids:t.array(t.string()).optional(),source:Qx.optional()}),skillSelection:Vt,visualTheme:Px.optional(),userChoices:t.array(wx).optional(),confirmedChoices:t.object({conversion:Rt.optional()}).optional(),seoKeywords:t.union([t.array(sn).min(1),t.array(Jn).min(1).max(50)]).optional()}).strict(),$t=Fs.superRefine((e,n)=>{Cl(e.pages,n)}),Dn=Fs.extend({pages:t.array(Vx).min(1)}).strict().superRefine((e,n)=>{Cl(e.pages,n)}),Zx=t.enum(["slug","showInHeader","showInFooter"]),Jx=t.object({page_id:Ie,fields:t.array(Zx).min(1).max(3)}).strict(),eE=t.object({page_id:Ie,block_id:Ie,fields:t.tuple([t.literal("type")])}).strict(),Pl=100,wl=500,tE=t.object({pages:t.array(Jx).max(Pl),blocks:t.array(eE).max(wl)}).strict().superRefine((e,n)=>{let s=new Set;e.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;e.blocks.forEach((i,r)=>{let m=`${i.page_id}\0${i.block_id}`;a.has(m)&&n.addIssue({code:"custom",path:["blocks",r],message:`Duplicate block target '${i.page_id}/${i.block_id}'.`}),a.add(m)})}),sL=t.object({sitemap:Dn,targets:tE,reserved_slugs:t.array(qa).optional()}).strict(),iL=t.object({pages:t.array(t.object({page_id:Ie,slug:t.string().min(1).optional(),show_in_header:t.boolean().optional(),show_in_footer:t.boolean().optional()}).strict()).max(Pl),blocks:t.array(t.object({page_id:Ie,block_id:Ie,type:t.string().trim().min(1)}).strict()).max(wl)}).strict().superRefine((e,n)=>{let s=new Set;e.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;e.blocks.forEach((i,r)=>{let m=`${i.page_id}\0${i.block_id}`;a.has(m)&&n.addIssue({code:"custom",path:["blocks",r],message:`Duplicate block output '${i.page_id}/${i.block_id}'.`}),a.add(m)})}),aL=t.object({sitemap:$t}).strict();function Cl(e,n){let s=new Map,a=new Map,i=new Map,r=0;e.forEach((p,I)=>{let R=s.get(p.id);if(R!==void 0?n.addIssue({code:"custom",path:["pages",I,"id"],message:`Duplicate page id '${p.id}' (first used at pages.${R}.id).`}):s.set(p.id,I),p.blocks.forEach((F,B)=>{let ee=a.get(F.id);ee!==void 0?n.addIssue({code:"custom",path:["pages",I,"blocks",B,"id"],message:`Duplicate block id '${F.id}' (first used at pages.${ee.pageIndex}.blocks.${ee.blockIndex}.id).`}):a.set(F.id,{pageIndex:I,blockIndex:B})}),p.slug===null)return;p.slug==="/"&&(r+=1);let w=i.get(p.slug);w!==void 0?n.addIssue({code:"custom",path:["pages",I,"slug"],message:`Duplicate page slug '${p.slug}' (first used at pages.${w}.slug).`}):i.set(p.slug,I)}),(r!==1||e[0]?.slug!=="/")&&n.addIssue({code:"custom",path:["pages"],message:"Sitemap must contain exactly one home page at pages[0] with slug '/'.",params:{errorCode:cl}});let m=new Map(e.map((p,I)=>[p.id,{page:p,index:I}])),c=(p,I)=>n.addIssue({code:"custom",path:p,message:I,params:{errorCode:cl}});e.forEach((p,I)=>{let R=p.parent_page_id??null;if(R===null)return;let w=["pages",I,"parent_page_id"];if(p.slug==="/"){c(w,"The home page cannot have a parent.");return}if(R===p.id){c(w,`Page '${p.id}' cannot be its own parent.`);return}let F=m.get(R);if(!F){c(w,`Parent page '${R}' does not exist.`);return}if(F.page.slug==="/"){c(w,"The home page cannot have sub pages.");return}(F.page.parent_page_id??null)!==null&&c(w,`Sitemap allows at most two levels; parent '${R}' must be a top-level page.`)})}var oL=Fs.omit({skillSelection:!0,visualTheme:!0,userChoices:!0,confirmedChoices:!0,seoKeywords:!0}).extend({meta:Fs.shape.meta.omit({source:!0}),site_name:t.string().min(1).max(80),pages:t.array(Yx).min(1),navigation:Xx}),nE=t.enum(["ai","user"]),Yt=t.object({site_id:T,page_id:Ie,edited_by:nE.default("ai"),source_agent_run_id:K.optional()}),rL=Yt.extend({block_id:Ie,target_index:t.number().int().min(0)}),sE=Yt.extend({block_id:Ie}),iE=Yt.extend({block_id:Ie,instruction:t.string()}),cL=Yt.extend({block_id:Ie,variant:t.string().min(1).nullable()}),mL=Yt.extend({block_id:Ie,props:t.record(t.string(),t.unknown()),mode:t.enum(["replace","merge"]).default("replace")}),lL=Yt.extend({block:t.object({id:Ie,label:t.string().trim().min(1),type:t.string().min(1),variant:t.string().min(1).optional(),props:t.record(t.string(),t.unknown()).default({}),insert_index:t.number().int().min(0).optional()})}),aE=t.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),pL=t.discriminatedUnion("operation",[t.object({operation:t.literal("delete_block"),input:sE}).strict(),t.object({operation:t.literal("update_block_instruction"),input:iE}).strict()]),oE=t.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"]),rE=t.object({status:t.literal("updated"),operation:aE,site_id:T,sitemap_id:Ae,version:t.number().int().positive(),changed_pages:t.array(Ie).min(1),requires_code_patch:t.literal(!0)}),cE=t.object({status:t.literal("failed"),code:oE,message:t.string().min(1),retryable:t.boolean().default(!1),details:t.unknown().optional()}),dL=t.discriminatedUnion("status",[rE,cE]),Ga=t.object({question_id:t.string().min(1),value:t.string().min(1),label:t.string().min(1).optional(),question:t.string().min(1).optional(),option_label:t.string().min(1).optional(),motion_level:Da.optional(),visual_tonality:va.optional(),conversion:Rt.optional(),positioning:t.object({market:t.string().min(1).max(200),customer:t.string().min(1).max(200),purpose:t.string().min(1).max(60)}).optional()}),mE=t.object({id:t.string().trim().min(1).max(128),type:t.literal(1),search_intent:t.string().trim().min(1).max(255),path:t.string().trim().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),channel:t.string().trim().min(1).max(80),content_format:t.string().trim().min(1).max(80),priority:t.enum(["P0","P1","P2","P3"])}).strict(),uL=t.object({source:t.object({kind:t.literal("step5_strategy")}).strict()}).strict(),lE=t.object({item_key:Xn,title:t.string().trim().min(1).max(200),selected_option_id:rn,selected_label:t.string().trim().min(1).max(200),selected_value:t.string().trim().min(1).max(500),selected_description:t.string().trim().min(1).max(2e3),impact:t.string().trim().min(1).max(500).optional(),customer_note:t.string().trim().min(1).max(200).optional(),market_type:Qn.optional(),markets:t.array(Zn).max(32).optional(),sections:t.array(t.object({id:t.string().min(1),label:t.string().min(1)}).strict()).optional()}).strict(),pE=t.object({kind:t.literal("step5_strategy"),site_name:t.string().trim().min(1).max(80).optional(),strategy_version_id:t.string().uuid(),strategy_version:t.number().int().positive(),strategy_checksum:t.string().regex(/^[a-f0-9]{64}$/),decisions:t.array(lE).min(Yn).max(ve),seo_keywords:t.array(Jn).min(1).max(50).optional(),enterprise_keywords:t.array(sn).min(1).optional()}).strict().superRefine((e,n)=>{let s=e.decisions.map(i=>i.item_key);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["decisions"],message:"Step5 sitemap decisions must use unique strategy keys."}),on.forEach(i=>{s.includes(i)||n.addIssue({code:"custom",path:["decisions"],message:`Step5 sitemap decisions are missing ${i}.`})});let a=It.filter(i=>s.includes(i));e.decisions.forEach((i,r)=>{i.item_key!==a[r]&&n.addIssue({code:"custom",path:["decisions",r,"item_key"],message:"Step5 sitemap decisions must use the canonical order."})})}),vl=t.object({tenant_id:t.string().min(1),site_id:T,brief_id:Dt,brief:t.string().min(20).max(1e3),answers:t.array(Ga).min(1).max(10),skillSelection:Vt,site_default_locale:fe.optional(),owner_locale:fe.optional(),cms_site_id:t.string().min(1).nullish(),intent_pages:t.array(mE).max(wo).optional(),reference:Gn.optional(),input_context:t.object({facts:t.array(Fn).max(120),conflicts:t.array(Kn).max(20)}).optional(),business_facts:ro.optional(),extra_requirement:t.string().trim().min(1).max(Ot).optional(),migration_products_enabled:t.boolean().optional()}),dE=vl.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:pE}).strict(),_L=t.union([vl,dE]),Dl=t.enum(["planning","generating","validating","ready"]),uE=t.enum(["salvaged","deterministic_fallback"]),_E=t.enum(["model_exception_settled_prefix","model_exception_safe_root"]),Ol={outcome:uE.optional(),reason:_E.optional(),attempts:t.number().int().positive().optional()};function jl(e,n){if(e.type!=="sitemap.generated")return;let s=e.outcome!==void 0,a=e.reason!==void 0;s!==a&&n.addIssue({code:"custom",path:[s?"reason":"outcome"],message:"sitemap.generated outcome and reason must be provided together"})}var gE=t.discriminatedUnion("type",[t.object({type:t.literal("run.started"),runId:K,at:t.string().min(1)}),t.object({type:t.literal("sitemap.generating"),stage:Dl,message:t.string().min(1).optional(),at:t.string().min(1)}),t.object({type:t.literal("sitemap.partial"),object:t.unknown(),at:t.string().min(1)}),t.object({type:t.literal("sitemap.generated"),sitemap_id:Ae,sitemap:$t,...Ol,at:t.string().min(1)}),t.object({type:t.literal("sitemap.clamped"),reason:t.enum(["page_early_stop","finalize_best_effort"]),original_page_count:t.number().int().nonnegative().optional(),final_page_count:t.number().int().nonnegative().optional(),original_block_count:t.number().int().nonnegative().optional(),final_block_count:t.number().int().nonnegative().optional(),at:t.string().min(1)}),t.object({type:t.literal("media_resolution.started"),slot_count:t.number().int().nonnegative(),at:t.string().min(1)}),t.object({type:t.literal("media_resolution.finished"),slot_count:t.number().int().nonnegative(),provider_counts:t.object({unsplash:t.number().int().nonnegative(),pexels:t.number().int().nonnegative(),placeholder:t.number().int().nonnegative()}),fallback_count:t.number().int().nonnegative(),error_codes:t.array(t.string()),at:t.string().min(1)}),t.object({type:t.literal("snapshot.created"),snapshot_id:k,manifest_hash:t.string().regex(/^sha256:[a-f0-9]{64}$/),at:t.string().min(1)}),t.object({type:t.literal("run.failed"),error_code:t.string().min(1),message:t.string().min(1),at:t.string().min(1)}),t.object({type:t.literal("run.finished"),snapshot_id:k.optional(),at:t.string().min(1)})]),gL=gE.superRefine(jl),Nl=t.object({id:Ae,tenant_id:t.string().min(1),site_id:T,version:t.number().int().positive(),source_agent_run_id:K.nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}).strict();function Ll(e,n){e.version!==e.sitemap.version&&n.addIssue({code:"custom",path:["sitemap","version"],message:`Sitemap JSON version ${e.sitemap.version} must equal record version ${e.version}.`})}var Ml=Nl.extend({sitemap:$t}).superRefine(Ll),hE=Nl.extend({sitemap:Dn}).superRefine(Ll),hL=t.object({sitemap_id:Ae,creation_key:t.string().min(1),sitemap:$t,source_agent_run_id:K.optional()}),SL=t.object({sitemap_id:Ae,creation_key:t.string().min(1),sitemap:Dn,expected_current_sitemap_id:Ae,expected_current_sitemap_version:t.number().int().positive(),migration_content_requested:t.boolean().optional()}),fL=t.object({sitemap_id:Ae,creation_key:t.string().min(1),sitemap:$t,source_agent_run_id:K}),bL=t.object({site:yt,sitemap:Ml,next_step:t.literal("workspace")}).strict(),yL=t.object({site:yt,sitemap:hE,next_step:t.literal("workspace")}).strict(),xL=t.object({site:yt,sitemap:Ml,next_step:t.literal("sitemap_review")}).strict(),SE=t.object({id:$a,tenant_id:t.string().min(1),site_id:T,brief_id:Dt,questions:Oa,answers:t.array(Ga),selected_archetype:Vt.optional(),completed_at:t.string().min(1).nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}),EL=t.object({answers:t.array(Ga).min(1),questions:Oa,selected_archetype:Vt.optional()}),RL=t.object({clarify_session:SE}),IL=t.object({questions:Oa,selected_archetype:Vt}),fE=t.object({id:Bs,tenant_id:t.string().min(1),site_id:T,version:t.number().int().positive(),design_plan:kl,source_agent_run_id:K.nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}),TL=t.object({design_plan_id:Bs.optional(),design_plan:kl,source_agent_run_id:K.optional()}),kL=t.object({design_plan:fE}),zs=t.enum(["initial_generation","iteration","landing_page","fill_in"]),bE=t.object({label:t.string().min(1).max(48),prompt:t.string().min(1).max(160)}).strict(),yE=t.enum(["model","derived","mixed","advisor"]),Ul=t.object({suggestions:t.array(bE).min(1).max(4),source:yE}).strict(),xE=t.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),EE=t.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"]),RE=t.enum(["progress","assistant_final"]),ql=t.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","workspace.generation_ledger","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"]),IE=t.object({id:t.string().min(1),title:t.string().min(1),status:t.enum(["pending","running","completed","failed"])}),vt=t.enum(["pending","running","completed","completed_with_skips","failed","skipped"]),Ka=t.enum(["style_media","chrome","sections","layout","pages","detect_typecheck","repair","finalize","sitemap_resync","preview"]),Wa=t.object({code:t.string().min(1),message:t.string().min(1),path:t.string().min(1).optional(),task_id:t.string().min(1).optional(),details:t.record(t.string(),t.unknown()).optional()}),Re=t.string().min(1).refine(e=>Ql(e),{message:"Snapshot file paths must be safe relative POSIX paths without traversal."}),za=t.object({deduped_paths:t.array(Re),skipped_tasks:t.array(t.string().min(1)),failed_tasks:t.array(t.string().min(1)),fallback_files:t.array(t.string().min(1)),applied_paths:t.array(Re)}),Ba=t.object({group_id:t.string().min(1),phase:Ka,title:t.string().min(1),status:vt,task_ids:t.array(t.string().min(1)),depends_on_groups:t.array(t.string().min(1)),target_paths:t.array(Re)}),TE=t.enum(["style","media","chrome","section","layout","page"]),Ha=t.object({task_id:t.string().min(1),group_id:t.string().min(1),kind:TE,target_path:Re,block_id:t.string().min(1).optional(),block_type:t.string().min(1).optional(),block_variant:t.string().min(1).optional(),block_order:t.number().int().nonnegative().optional(),user_instruction:t.string().min(1).optional(),page_id:t.string().min(1).optional(),page_slug:t.string().min(1).optional(),page_title:t.string().min(1).optional(),title:t.string().min(1).max(60).optional(),description:t.string().min(1).max(Ma).optional(),status:vt,required_reads:t.array(Re).optional(),search_params_sections:t.array(Re).optional(),standard_form_view:Re.optional(),breadcrumb:t.object({trail:t.array(t.object({name:t.string().min(1),href:t.string().min(1).nullable(),omitted_href:t.string().min(1).optional()}).strict()).min(1),current:t.string().min(1)}).strict().optional()}),Va=t.object({from_group_id:t.string().min(1),to_group_id:t.string().min(1),reason:t.enum(["style_media","chrome","sections","layout","page_composition","quality_gate"])}),AL=t.object({plan_id:t.string().min(1),run_kind:zs,model_route:t.object({planner:t.literal("workspace_planner"),worker:t.literal("workspace")}),groups:t.array(Ba),tasks:t.array(Ha),dependencies:t.array(Va),expected_outputs:t.array(Re),diagnostics:za}),PL=t.object({task_id:t.string().min(1),patch:t.unknown().optional(),snapshot_id:k.optional(),read_files:t.array(Re),diagnostics:t.array(Wa),status:vt}),Fl=t.object({worker_count:t.number().int().nonnegative(),task_count:t.number().int().nonnegative(),group_count:t.number().int().nonnegative()}),Gl=t.object({pending:t.number().int().nonnegative(),running:t.number().int().nonnegative(),completed:t.number().int().nonnegative(),completed_with_skips:t.number().int().nonnegative(),failed:t.number().int().nonnegative(),skipped:t.number().int().nonnegative()}),kE=t.object({type:t.literal("text"),text:t.string(),state:t.enum(["streaming","done"]).optional()}),AE=t.object({type:t.literal("reasoning"),text:t.string(),state:t.enum(["streaming","done"]).optional(),providerMetadata:t.record(t.string(),t.unknown()).optional()}),PE=t.object({type:t.literal("file"),mediaType:t.string().min(1),filename:t.string().min(1).optional(),url:t.string().min(1)}),wE=t.object({type:t.literal("source-url"),sourceId:t.string().min(1),url:t.string().min(1),title:t.string().min(1).optional(),providerMetadata:t.record(t.string(),t.unknown()).optional()}),CE=t.object({type:t.literal("source-document"),sourceId:t.string().min(1),mediaType:t.string().min(1),title:t.string().min(1),filename:t.string().min(1).optional(),providerMetadata:t.record(t.string(),t.unknown()).optional()}),vE=t.object({type:t.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:t.string().min(1).optional(),data:t.unknown()}),DE=t.object({type:t.string().regex(/^tool-[a-zA-Z0-9_-]+$/),toolCallId:t.string().min(1),state:t.enum(["input-streaming","input-available","output-available","output-error"]),input:t.unknown().optional(),output:t.unknown().optional(),errorText:t.string().min(1).optional()}),OE=t.object({type:t.literal("error"),errorText:t.string().min(1)}),jE=t.object({type:t.literal("step-start")}),Gs=t.union([kE,AE,PE,wE,CE,vE,DE,OE,jE]),NE=t.string().min(1).max(512).refine(e=>Ql(e)&&!/^[A-Za-z]:\//.test(e),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),LE=t.array(NE).min(1).max(64),ME=t.array(t.string().min(1).max(120)).min(1).max(64),UE=t.discriminatedUnion("type",[t.object({type:t.literal("run.started"),runId:K,at:t.string().min(1)}),t.object({type:t.literal("message.delta"),text:t.string().min(1),history_purpose:RE.optional(),at:t.string().min(1)}),t.object({type:t.literal("user.message"),client_message_id:t.string().min(1),message_id:t.string().min(1),parts:t.array(Gs).min(1),in_reply_to_tool_call_id:t.string().min(1).optional(),interaction_response:os.optional(),at:t.string().min(1)}),t.object({type:t.literal("plan.updated"),steps:t.array(IE),at:t.string().min(1)}),t.object({type:t.literal("clarify.partial"),object:t.unknown(),at:t.string().min(1)}),t.object({type:t.literal("clarify.archetype_proposals"),proposals:t.array(ul).min(1).max(5),at:t.string().min(1)}),t.object({type:t.literal("clarify.finished"),questions_id:t.string().min(1),at:t.string().min(1)}),t.object({type:t.literal("sitemap.generating"),stage:Dl,message:t.string().min(1).optional(),at:t.string().min(1)}),t.object({type:t.literal("sitemap.partial"),object:t.unknown(),at:t.string().min(1)}),t.object({type:t.literal("sitemap.generated"),sitemap_id:Ae,sitemap:$t,...Ol,at:t.string().min(1)}),t.object({type:t.literal("sitemap.clamped"),reason:t.enum(["page_early_stop","finalize_best_effort"]),original_page_count:t.number().int().nonnegative().optional(),final_page_count:t.number().int().nonnegative().optional(),original_block_count:t.number().int().nonnegative().optional(),final_block_count:t.number().int().nonnegative().optional(),at:t.string().min(1)}).strict(),t.object({type:t.literal("sitemap.updated"),sitemap_id:Ae,version:t.number().int().positive(),reason:t.string().min(1),at:t.string().min(1)}),t.object({type:t.literal("sitemap.resync.failed"),error_code:t.string().min(1),message:t.string().min(1),retryable:t.boolean(),diagnostics:t.unknown().optional(),at:t.string().min(1)}),t.object({type:t.literal("sitemap.resync.warning"),code:t.string().min(1),message:t.string().min(1),diagnostics:t.unknown().optional(),at:t.string().min(1)}),t.object({type:t.literal("block.changed"),block_id:t.string().min(1),change_type:t.enum(["add","update","delete","move"]),at:t.string().min(1)}),t.object({type:t.literal("tool.started"),tool_call_id:t.string().min(1),name:t.string().min(1),summary:t.string().min(1),at:t.string().min(1)}),t.object({type:t.literal("tool.finished"),tool_call_id:t.string().min(1),name:t.string().min(1),result_summary:t.string().min(1),interaction_request:vi.optional(),at:t.string().min(1)}),t.object({type:t.literal("workspace.plan.created"),plan_id:t.string().min(1),run_kind:zs,groups:t.array(Ba),tasks:t.array(Ha),dependencies:t.array(Va),expected_outputs:t.array(Re),diagnostics:za,summary:Fl,at:t.string().min(1)}).strict(),t.object({type:t.literal("workspace.worker.updated"),group_id:t.string().min(1),phase:Ka,status:vt,task_counts:Gl,target_paths:t.array(Re),diagnostics:t.array(t.string().min(1)),at:t.string().min(1)}).strict(),t.object({type:t.literal("workspace.task.updated"),task_id:t.string().min(1),group_id:t.string().min(1),status:vt,target_path:Re,read_files_count:t.number().int().nonnegative(),diagnostics:t.array(t.string().min(1)),diagnostic_details:t.array(Wa).optional(),at:t.string().min(1)}).strict(),t.object({type:t.literal("workspace.degraded"),reason:t.enum(["block_placeholder","form_placeholder","patch_protected_dropped","preview_health_degraded","preview_build_failed","design_plan_fallback","generated_code_rescue","cms_page_directory_degraded","form_prebuild_skipped","form_section_fallback","first_settings_sync_failed","component_omitted","page_omitted","shared_fallback"]),degraded_block_ids:t.array(t.string().min(1)).min(1).optional(),dropped_files:t.array(t.string().min(1)).min(1).optional(),degraded_file_paths:LE.optional(),degraded_page_ids:ME.optional(),snapshot_id:k.optional(),code:t.string().min(1).optional(),message:t.string().min(1).optional(),diagnostics:t.string().min(1).optional(),retryable:t.boolean().optional(),at:t.string().min(1)}).strict().superRefine((e,n)=>{let s=e.reason==="generated_code_rescue",a=e.reason==="page_omitted",i=e.reason==="shared_fallback";if(!s){if(e.degraded_file_paths!==void 0&&n.addIssue({code:"custom",path:["degraded_file_paths"],message:"degraded_file_paths is only allowed for generated_code_rescue"}),e.degraded_page_ids!==void 0&&!a&&n.addIssue({code:"custom",path:["degraded_page_ids"],message:"degraded_page_ids is only allowed for generated_code_rescue or page_omitted"}),i)for(let r of["degraded_block_ids","dropped_files","snapshot_id","code","diagnostics","retryable"])e[r]!==void 0&&n.addIssue({code:"custom",path:[r],message:`${r} is not allowed for shared_fallback`});return}e.degraded_file_paths===void 0&&n.addIssue({code:"custom",path:["degraded_file_paths"],message:"generated_code_rescue requires degraded_file_paths"});for(let r of["degraded_block_ids","dropped_files","snapshot_id","code","message","diagnostics","retryable"])e[r]!==void 0&&n.addIssue({code:"custom",path:[r],message:`${r} is not allowed for generated_code_rescue`})}),t.object({type:t.literal("workspace.design_plan.outcome"),design_plan_outcome:xE,reason:EE,gate_diagnostics:t.object({gate:t.enum(["quality","schema"]),issue_codes:t.array(t.string().min(1)).max(20),issue_paths:t.array(t.string()).max(20),finish_reason:t.string().min(1).optional()}).strict().optional(),media_floor:t.object({total_blocks:t.number().int().min(0),media_bearing_blocks:t.number().int().min(0),hero_total:t.number().int().min(0),hero_media_bearing:t.number().int().min(0),pages_without_media:t.array(t.string().min(1)).max(50),met:t.boolean()}).strict().optional(),at:t.string().min(1)}).strict(),Ul.extend({type:t.literal("workspace.suggestions"),at:t.string().min(1)}).strict(),mo,t.object({type:t.literal("file.changed"),path:t.string().min(1),change_type:t.enum(["create","update","delete"]),diff:t.string().optional(),at:t.string().min(1)}),t.object({type:t.literal("snapshot.created"),snapshot_id:k,manifest_hash:t.string().regex(/^sha256:[a-f0-9]{64}$/),at:t.string().min(1)}),t.object({type:t.literal("snapshot.finalized"),snapshot_id:k,at:t.string().min(1)}),t.object({type:t.literal("preview.preparing"),at:t.string().min(1)}),t.object({type:t.literal("preview.ready"),url:t.string().url(),at:t.string().min(1),launch_id:t.string().min(1).optional()}),t.object({type:t.literal("preview.build.started"),snapshot_id:k,at:t.string().min(1)}),t.object({type:t.literal("preview.build.succeeded"),snapshot_id:k,at:t.string().min(1)}),t.object({type:t.literal("preview.build.failed"),snapshot_id:k,message:t.string().min(1),diagnostics:t.string().min(1),retryable:t.boolean(),at:t.string().min(1)}),t.object({type:t.literal("run.failed"),error_code:t.string().min(1),message:t.string().min(1),error_category:_l.optional(),retryable:t.boolean().optional(),attempts:t.number().int().positive().optional(),outcome:t.literal("retained_previous").optional(),details:t.record(t.string(),t.unknown()).optional(),at:t.string().min(1)}),t.object({type:t.literal("run.finished"),snapshot_id:k.optional(),degraded_reason:Qt.optional(),build_verified:t.boolean().optional(),generation_ledger:tn.optional(),at:t.string().min(1)}),t.object({type:t.literal("media_resolution.started"),slot_count:t.number().int().nonnegative(),at:t.string().datetime()}),t.object({type:t.literal("media_resolution.finished"),slot_count:t.number().int().nonnegative(),provider_counts:t.object({unsplash:t.number().int().nonnegative(),pexels:t.number().int().nonnegative(),placeholder:t.number().int().nonnegative()}),fallback_count:t.number().int().nonnegative(),error_codes:t.array(t.string()),at:t.string().datetime()}),t.object({type:t.literal("skill.selecting"),category:t.literal("page-generation"),available:t.array(t.object({id:t.string().min(1),name:t.string().min(1)})).max(20),at:t.string().min(1)}),t.object({type:t.literal("skill.selected"),category:t.literal("page-generation"),selected:t.object({id:t.string().min(1),name:t.string().min(1),reason:t.string().min(1).max(200)}),at:t.string().min(1)}),t.object({type:t.literal("activity.started"),activity_id:t.string().min(1),parent_activity_id:t.string().min(1).optional(),kind:El,title:t.string().min(1).max(200),detail:t.string().max(360).optional(),title_code:bt.optional(),detail_code:bt.optional(),locks_input:t.boolean(),at:t.string().min(1)}),t.object({type:t.literal("activity.updated"),activity_id:t.string().min(1),title:t.string().min(1).max(200).optional(),detail:t.string().max(360).optional(),title_code:bt.optional(),detail_code:bt.optional(),at:t.string().min(1)}),t.object({type:t.literal("activity.finished"),activity_id:t.string().min(1),at:t.string().min(1)}),t.object({type:t.literal("activity.failed"),activity_id:t.string().min(1),detail:t.string().max(360).optional(),at:t.string().min(1)})]),Kl=UE.superRefine(jl).superRefine((e,n)=>{if(e.type==="user.message"&&e.interaction_response&&!e.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"}),e.type!=="tool.finished")return;let s=e.name==="prepare_product_search_entry";s!==!!e.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"})}),Ca=t.object({id:Xa,tenant_id:t.string().min(1),site_id:T,agent_run_id:K,sequence:t.number().int().positive(),event_type:ql,payload:Kl,created_at:t.string().min(1),thread_id:He.nullable().optional()}),wL=t.object({event_type:ql,payload:Kl}).superRefine((e,n)=>{e.event_type!==e.payload.type&&n.addIssue({code:"custom",path:["payload","type"],message:"payload.type must match event_type"}),Nn(e.payload)&&n.addIssue({code:"custom",path:["payload"],message:"AgentEvent payload must not contain secrets"})}),CL=t.discriminatedUnion("status",[t.object({status:t.literal("appended"),agent_run:Be,event:Ca,next_cursor:t.number().int().nonnegative()}),t.object({status:t.literal("duplicate_ignored"),agent_run:Be,event:Ca,next_cursor:t.number().int().nonnegative()})]),vL=t.object({events:t.array(Ca),next_cursor:t.number().int().nonnegative().optional()}),DL=t.object({after_sequence:t.coerce.number().int().nonnegative().default(0)}),OL=t.object({run_id:K.optional(),thread_id:He.optional()}).superRefine((e,n)=>{e.run_id&&e.thread_id&&n.addIssue({code:"custom",path:["thread_id"],message:"run_id and thread_id are mutually exclusive"})}),jL=t.enum(["implemented","skeleton","planned"]),NL=t.enum(["GET","POST","PUT","PATCH","DELETE"]),LL=[{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:"Accept 1\u20133 Page Template items as one asynchronous Workspace task (HTTP 202).",status:"implemented",request_body_schema:"PageTemplateCreateRequestSchema",response_schema:"PageTemplateCreateResponseSchema",notes:["Internal bearer plus tenant context; API starts one new background thread/run with its fixed system identity. Poll GET /internal/external-site-edits/:task_id; no external IDs or callbacks. Manifest-gated whole-batch success commits exactly one snapshot."]},{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:"/agent-runs/workspace/stop",tag:"agent-runs",summary:"Request a soft stop of the active first-generation or fill-in run for a site.",status:"implemented",request_body_schema:"StopWorkspaceGenerationRequestSchema",response_schema:"StopWorkspaceGenerationResponseSchema",notes:["Browser surface with the same tenant scoping as POST /agent-runs/workspace/cancel: only the active initial_generation / fill_in run of a site in the caller's tenant is touched.","A run holding a live lease gets stop_requested_at instead of a terminal event, so it keeps the pages it already saved and closes itself: status=requested, or already_requested on a repeat (the first stop timestamp is never moved).","A run whose lease has lapsed has no process left to honour the flag, so it is closed immediately (run.failed, site lock released) and the answer is status=stopped. Nothing in flight returns no_active_run with run_id null."]},{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:"POST",path:"/internal/agent-runs/claim-stale-workspace-runs",tag:"agent-runs",summary:"Claim stale workspace runs for resumption (internal maintenance, cross-tenant sweep).",status:"implemented",response_schema:"ClaimStaleWorkspaceRunsResponseSchema",notes:["Internal maintenance endpoint guarded by InternalAgentAuthGuard; same trust boundary as fail-stale-in-flight and not exposed to the browser.","Re-issues a fresh lease_owner (fencing token) and increments resume_count in one UPDATE for each resumable initial run; a lease expiring only means the work was interrupted, not that the run failed. Initial runs that used up WORKSPACE_MAX_RESUME_COUNT and interrupted fill-in runs are failed instead and are absent from the response."]},{method:"GET",path:"/internal/agent-runs/:run_id/context",tag:"agent-runs",summary:"Resolve run thread context (internal, Agent Runtime).",status:"implemented",response_schema:"AgentRunContextResponseSchema",notes:["Internal endpoint guarded by InternalAgentAuthGuard; tenant comes from x-vcp-tenant-id.","Returns the run together with its thread (null = the site main thread); a run outside the tenant is 404."]},{method:"POST",path:"/internal/agent-runs/:run_id/heartbeat",tag:"agent-runs",summary:"Renew a workspace run lease (internal, Agent Runtime).",status:"implemented",request_body_schema:"WorkspaceRunHeartbeatRequestSchema",response_schema:"WorkspaceRunHeartbeatResponseSchema",notes:["Internal endpoint guarded by InternalAgentAuthGuard; tenant comes from x-vcp-tenant-id.","One CAS UPDATE checks that the run is still in flight and that lease_owner has not been re-issued: superseded means another attempt took over and this process must stop dispatching; not_active means the run already reached a terminal state."]},{method:"POST",path:"/internal/agent-runs/:run_id/page-checkpoints",tag:"agent-runs",summary:"Register a workspace page checkpoint (internal, Agent Runtime).",status:"implemented",request_body_schema:"RegisterWorkspacePageCheckpointRequestSchema",response_schema:"WorkspacePageCheckpointSchema",notes:["Internal endpoint guarded by InternalAgentAuthGuard; tenant comes from x-vcp-tenant-id.","Idempotent on (tenant_id, run_id, page_id, attempt): a conflict returns the existing row unchanged. The object must already be written to storage \u2014 a failed registration means the page was not saved. A lease_owner that no longer matches the run is 409, and a run in a terminal state is 409."]},{method:"GET",path:"/internal/agent-runs/:run_id/page-checkpoints",tag:"agent-runs",summary:"List workspace page checkpoints (internal, Agent Runtime).",status:"implemented",response_schema:"ListWorkspacePageCheckpointsResponseSchema",notes:["Internal endpoint guarded by InternalAgentAuthGuard; returns one row per page_id (the highest attempt). A run outside the tenant returns no checkpoints."]},{method:"GET",path:"/internal/agent-runs/:run_id/run-control",tag:"agent-runs",summary:"Read workspace run control input (internal, Agent Runtime).",status:"implemented",response_schema:"WorkspaceRunControlInputResponseSchema",notes:["Internal endpoint guarded by InternalAgentAuthGuard; AgentRunRecord carries no input, so the lease owner, stop flag, resume count and fill-in inputs stored on the run row are read here. A run outside the tenant, or one that is not a workspace run, is 404."]},{method:"GET",path:"/deployments",tag:"deployments",summary:"Deployment resource summary endpoint until publish APIs land.",status:"skeleton"},{method:"GET",path:"/sites/:site_id/generation-ledger",tag:"sites",summary:"Read the stored generation ledger of a site (omitted deliverables and fill-in progress).",status:"implemented",response_schema:"SiteGenerationLedgerResponseSchema",notes:["One ledger per (tenant_id, site_id), written when an initial_generation / fill_in run.finished carries generation_ledger. A site that has never finished such a run returns ledger null with source_run_id and updated_at null."]},{method:"POST",path:"/sites/:site_id/generation/fill-in",tag:"sites",summary:"Start a fill-in run for deliverables the generation ledger still lists as omitted.",status:"implemented",request_body_schema:"StartFillInRequestSchema",response_schema:"StartFillInResponseSchema",notes:["Every target must still be listed as an unfilled omission in the site ledger; otherwise 400 FILL_IN_TARGET_NOT_OMITTED with details.target_id. A site with no ledger at all is rejected with the same code.","The site must be workspace_ready; otherwise 409 FILL_IN_NOT_AVAILABLE.","A fill-in run does not take the per-site workspace_run operation lock: while it runs the user keeps browsing. client_run_key makes the POST idempotent \u2014 repeating it returns the existing in-flight run and does not dispatch it again; another in-flight workspace run on the same site is rejected with 409 WORKSPACE_RUN_IN_FLIGHT."]},{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:"/sites/:site_id/workspace/attachments",tag:"workspace",summary:"Upload a chat image attachment for the Workspace conversation.",status:"implemented",response_schema:"WorkspaceAttachmentSchema",notes:["multipart/form-data with a single `file`; the response `image_url` is referenced by a `file` part of the next client message."]},{method:"POST",path:"/sites/:site_id/workspace/attachments/from-url",tag:"workspace",summary:"Capture a screenshot of a web page and store it as a chat image attachment.",status:"implemented",request_body_schema:"WorkspaceAttachmentFromUrlRequestSchema",response_schema:"WorkspaceAttachmentSchema",notes:["The screenshot becomes an ordinary attachment: same quotas, same `file` part reference, never placed on the site.","Capture runs through the ingestion service (SSRF guard, concurrency gate, Firecrawl credits)."]},{method:"GET",path:"/sites/:site_id/workspace/attachments/:attachment_id/image",tag:"workspace",summary:"Read the bytes of a chat image attachment (owner thumbnails and replay).",status:"implemented"},{method:"DELETE",path:"/sites/:site_id/workspace/attachments/:attachment_id",tag:"workspace",summary:"Delete an unsent chat image attachment.",status:"implemented",notes:["Attachments already sent with a message return 409 WORKSPACE_ATTACHMENT_BOUND."]},{method:"GET",path:"/internal/workspace-attachments/:site_id/:attachment_id",tag:"workspace",summary:"Internal side-channel for the Workspace Agent to read a chat image attachment.",status:"implemented"},{method:"GET",path:"/sites/:site_id/threads",tag:"workspace",summary:"List a site's named Agent threads (workspace conversations).",status:"implemented",response_schema:"SiteThreadListResponseSchema",notes:["The browser can only list threads that belong to the current site."]},{method:"POST",path:"/sites/:site_id/threads",tag:"workspace",summary:"Create a new named Agent thread for a site.",status:"implemented",request_body_schema:"CreateSiteThreadRequestSchema",response_schema:"SiteThreadResponseSchema",notes:["The created thread is scoped to the current site; the browser cannot create a thread for another site."]},{method:"PATCH",path:"/sites/:site_id/threads/:thread_id",tag:"workspace",summary:"Rename or archive an Agent thread.",status:"implemented",request_body_schema:"UpdateSiteThreadRequestSchema",response_schema:"SiteThreadResponseSchema",notes:["The server verifies the thread belongs to the current site and tenant before applying the update."]},{method:"GET",path:"/sites/:site_id/workspace/runs/active",tag:"workspace",summary:"Look up the site's current in-flight Workspace Agent run across all threads.",status:"implemented",response_schema:"ActiveWorkspaceRunResponseSchema",notes:["Scoped to the current site regardless of thread; the browser cannot query another site's active run."]},{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:"GET",path:"/internal/sites/:site_id/active-domain",tag:"internal/active-domain",summary:"Read whether an internal site has an active primary domain.",status:"implemented",response_schema:"GetActiveSiteDomainResponseSchema"},{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:"Read the current publish workflow domain operation.",status:"implemented",response_schema:"GetSitePublishDomainOperationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflows/:workflow_id/domain/operation/reconcile",tag:"publish-workflow",summary:"Recover or reconcile the current publish workflow domain operation.",status:"implemented",response_schema:"ReconcileSitePublishDomainOperationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflows/:workflow_id/domain/remediation/confirm",tag:"publish-workflow",summary:"Confirm the current DNS remediation plan.",status:"implemented",request_body_schema:"ConfirmSitePublishDomainRemediationRequestSchema",response_schema:"ConfirmSitePublishDomainRemediationResponseSchema"},{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:"SitePublishWorkflowQualityResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/:workflow_id/repair-task",tag:"publish-workflow",summary:"Idempotently create the publish repair task.",status:"implemented",request_body_schema:"SitePublishWorkflowRevisionRequestSchema",response_schema:"SitePublishWorkflowQualityResponseSchema"},{method:"GET",path:"/sites/:site_id/publish-workflow/:workflow_id",tag:"publish-workflow",summary:"Read and reconcile a site publish workflow quality task.",status:"implemented",response_schema:"SitePublishWorkflowQualityResponseSchema"},{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"}],ML=[{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"]}],qE=t.object({id:t.string().min(1),role:t.enum(["system","user","assistant"]),metadata:t.unknown().optional(),parts:t.array(Gs).min(1)}),Wl=qE.extend({role:t.literal("user")}).superRefine((e,n)=>{let s=0;for(let[a,i]of e.parts.entries()){if(i.type!=="file")continue;s+=1;let r=i;Oi.safeParse(r.mediaType).success||n.addIssue({code:"custom",path:["parts",a,"mediaType"],message:"Attachment mediaType must be image/png, image/jpeg or image/webp"}),(typeof r.url!="string"||ji(r.url)===null)&&n.addIssue({code:"custom",path:["parts",a,"url"],message:"Attachment url must be a workspace attachment image path"})}s>Di&&n.addIssue({code:"custom",path:["parts"],message:`A message may carry at most ${Di} attachments`})}),UL=t.object({base_snapshot_id:k.optional(),message:Wl.optional(),thread_id:He.optional(),client_run_key:t.string().min(1).max(200).optional()}).superRefine((e,n)=>{Nn(e.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),FE=t.object({path:t.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:K,base_snapshot_id:k,run_kind:zs}),qL=t.object({agent_run:Be,websocket:FE,next_step:t.literal("workspace_socket")}),FL=t.object({agent_run:Be}),GL=t.object({thread_id:He.optional()}),KL=t.object({agent_run:Be.nullable(),thread:Ks.nullable()}),WL=t.object({status:fl.default("active")}),zL=t.object({threads:t.array(Ks)}),BL=t.object({title:t.string().trim().min(1).max(200)}).strict(),HL=t.object({title:t.string().trim().min(1).max(200).optional(),status:t.literal("archived").optional()}).strict().refine(e=>e.title!==void 0||e.status!==void 0,{message:"title or status is required"}),VL=t.object({thread:Ks}),$L=t.object({agent_type:t.enum(["clarify","sitemap","workspace"]),thread_id:He.optional()}),YL=t.object({agent_run:Be}),XL=t.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"]),ae=t.object({id:t.string().min(1),tenant_id:t.string().min(1),site_id:T,run_id:K.optional(),correlation_id:t.string().min(1).optional(),seq:t.number().int().positive().optional(),sent_at:t.string().min(1)}),GE=t.object({key:t.string().min(1),label:t.string().min(1),source_file:t.string().min(1).optional(),component_name:t.string().min(1).optional(),opening_element_range:t.object({start_line:t.number().int().positive(),start_column:t.number().int().nonnegative(),end_line:t.number().int().positive(),end_column:t.number().int().nonnegative()}).optional(),structural_path:t.string().min(1).optional(),text_preview:t.string().min(1).optional()}),KE=t.discriminatedUnion("type",[ae.extend({type:t.literal("client.message.create"),payload:t.object({client_message_id:t.string().min(1),in_reply_to_tool_call_id:t.string().min(1).optional(),current_route_id:hn.optional(),interaction_response:os.optional(),selected_component:GE.optional(),message:Wl,base_snapshot_id:k.optional()}).superRefine((e,n)=>{e.interaction_response&&!e.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"})})}),ae.extend({type:t.literal("client.run.cancel"),payload:t.object({run_id:K,reason:t.string().min(1).optional()})}),ae.extend({type:t.literal("client.tool.approve"),payload:t.object({tool_call_id:t.string().min(1),decision:t.enum(["approve","reject"]),reason:t.string().min(1).optional()})}),jr]),WE=t.discriminatedUnion("type",[ae.extend({type:t.literal("server.run.started"),payload:t.object({run_id:K,agent_type:t.literal("workspace")})}),ae.extend({type:t.literal("server.user.message"),payload:t.object({client_message_id:t.string().min(1),message_id:t.string().min(1),parts:t.array(Gs).min(1),in_reply_to_tool_call_id:t.string().min(1).optional(),interaction_response:os.optional()})}),ae.extend({type:t.literal("server.assistant.delta"),payload:t.object({message_id:t.string().min(1),parts:t.array(Gs).min(1),status:t.enum(["streaming","ready"])})}),ae.extend({type:t.literal("server.tool.started"),payload:t.object({tool_call_id:t.string().min(1),name:t.string().min(1),summary:t.string().min(1)})}),ae.extend({type:t.literal("server.tool.completed"),payload:t.object({tool_call_id:t.string().min(1),name:t.string().min(1),result_summary:t.string().min(1),interaction_request:vi.optional()})}),ae.extend({type:t.literal("server.workspace.suggestions"),payload:Ul.extend({run_id:K}).strict()}),ae.extend({type:t.literal("workspace.plan.created"),payload:t.object({plan_id:t.string().min(1),run_kind:zs,groups:t.array(Ba),tasks:t.array(Ha),dependencies:t.array(Va),expected_outputs:t.array(Re),diagnostics:za,summary:Fl})}),ae.extend({type:t.literal("workspace.worker.updated"),payload:t.object({group_id:t.string().min(1),phase:Ka,status:vt,task_counts:Gl,target_paths:t.array(Re),diagnostics:t.array(t.string().min(1))})}),ae.extend({type:t.literal("workspace.task.updated"),payload:t.object({task_id:t.string().min(1),group_id:t.string().min(1),status:vt,target_path:Re,read_files_count:t.number().int().nonnegative(),diagnostics:t.array(t.string().min(1)),diagnostic_details:t.array(Wa).optional()})}),ae.extend({type:t.literal("server.patch.applied"),payload:t.object({patch_batch_id:t.string().min(1),changed_files:t.array(t.string().min(1)),sitemap_resync_queued:t.boolean()})}),ae.extend({type:t.literal("server.sitemap.updated"),payload:t.object({sitemap_id:Ae,version:t.number().int().positive(),reason:t.string().min(1)})}),ae.extend({type:t.literal("server.snapshot.created"),payload:t.object({snapshot_id:k,manifest_hash:t.string().regex(/^sha256:[a-f0-9]{64}$/)})}),ae.extend({type:t.literal("server.snapshot.finalized"),payload:t.object({snapshot_id:k})}),ae.extend({type:t.literal("server.preview.invalidated"),payload:t.object({reason:t.string().min(1),next_preview_url:t.string().url().optional(),launch_id:t.string().min(1).optional()})}),ae.extend({type:t.literal("preview.build.started"),payload:t.object({snapshot_id:k})}),ae.extend({type:t.literal("preview.build.succeeded"),payload:t.object({snapshot_id:k})}),ae.extend({type:t.literal("preview.build.failed"),payload:t.object({snapshot_id:k,message:t.string().min(1),diagnostics:t.string().min(1),retryable:t.boolean()})}),ae.extend({type:t.literal("server.run.finished"),payload:t.object({run_id:K,snapshot_id:k,degraded_reason:Qt.optional(),build_verified:t.boolean().optional()})}),ae.extend({type:t.literal("server.run.failed"),payload:t.object({run_id:K,error_code:t.string().min(1),message:t.string().min(1),retryable:t.boolean(),outcome:t.literal("retained_previous").optional(),details:t.record(t.string(),t.unknown()).optional()})}),ae.extend({type:t.literal("server.error"),payload:t.object({code:t.string().min(1),message:t.string().min(1),retryable:t.boolean()})}),ae.extend({type:t.literal("server.activity.started"),payload:t.object({activity_id:t.string().min(1),parent_activity_id:t.string().min(1).optional(),kind:El,title:t.string().min(1).max(200),title_code:bt.optional(),detail:t.string().max(360).optional(),detail_code:bt.optional(),locks_input:t.boolean()})}),ae.extend({type:t.literal("server.activity.updated"),payload:t.object({activity_id:t.string().min(1),title:t.string().min(1).max(200).optional(),title_code:bt.optional(),detail:t.string().max(360).optional(),detail_code:bt.optional()})}),ae.extend({type:t.literal("server.activity.finished"),payload:t.object({activity_id:t.string().min(1)})}),ae.extend({type:t.literal("server.activity.failed"),payload:t.object({activity_id:t.string().min(1),detail:t.string().max(360).optional()})})]),zE=WE.superRefine((e,n)=>{if(e.type==="server.user.message"&&e.payload.interaction_response&&!e.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"}),e.type!=="server.tool.completed")return;let s=e.payload.name==="prepare_product_search_entry";s!==!!e.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"})}),QL=t.union([KE,zE]),ZL={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."]},zl=t.string().regex(/^sha256:[a-f0-9]{64}$/),BE=t.enum(["create","update","delete","str_replace"]),Bl=t.enum(["sitemap_resync","smoke_test","prepare_preview"]),HE=t.object({old_string:t.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:t.string().describe("Replacement text. May be empty to delete the matched text."),replace_all:t.boolean().optional()}).strict(),VE=t.object({path:Re,operation:BE,expected_hash:zl.optional(),full_content:t.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:t.array(HE).min(1).max(20).optional()}).strict().superRefine((e,n)=>{let s=e.full_content!==void 0;if(e.operation==="delete"){s&&n.addIssue({code:"custom",path:["full_content"],message:"delete patches must not include full_content"}),e.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"});return}if(aR(e.path)||n.addIssue({code:"custom",path:["path"],message:"Static App Router page paths must use lowercase ASCII kebab-case public segments."}),e.operation==="str_replace"){e.full_content!==void 0&&n.addIssue({code:"custom",path:["full_content"],message:"str_replace patches must not include full_content"}),(!e.edits||e.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"}),e.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"})}),$E=t.object({kind:t.enum(["block","page","site","chrome"]),id:t.string().min(1).max(120)}),YE=t.object({base_key:t.string().min(1).max(120).regex(/^[A-Za-z0-9._:-]+$/).refine(e=>!e.includes(".."),{message:"base_key must not contain '..'"}),owner:$E,count:t.number().int().min(1).max(12),query:t.string().min(1).max(400),role:t.enum(["hero","section","card","gallery","testimonial","decorative","site_background","nav_background","footer_background"]),orientation:t.enum(["landscape","portrait","square"]).optional(),altHint:t.string().min(1).max(300)}),Hl=t.object({site_id:T,base_snapshot_id:k,reason:t.string().min(1),patches:t.array(VE).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:t.array(YE).max(24).optional(),post_actions:t.array(Bl).optional()});function Vl(e,n){let s=new Set;for(let[a,i]of e.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 JL=Hl.superRefine(Vl),eM=Hl.omit({base_snapshot_id:!0}).extend({site_id:T.optional()}).superRefine(Vl),XE=Se,QE=t.object({path:XE,operation:t.enum(["upsert","delete"]).optional()}),$l=t.enum(["sync_cms_pages","sync_cms_navigation"]),tM=t.object({files:t.array(QE).min(1),post_actions:t.array($l).optional()}).strict().overwrite(e=>e.post_actions?{...e,post_actions:[...new Set(e.post_actions)]}:e),ZE=t.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"]),JE=t.object({status:t.literal("applied"),patch_batch_id:t.string().min(1),site_id:T,base_snapshot_id:k,snapshot_id:k,manifest_hash:zl,object_key:t.string().min(1),changed_files:t.array(Re).min(1),post_actions_queued:t.array(Bl),dropped_protected_files:t.array(t.string().min(1)).min(1).optional()}),eR=t.object({status:t.literal("failed"),code:ZE,message:t.string().min(1),retryable:t.boolean().default(!1),details:t.unknown().optional()}),nM=t.discriminatedUnion("status",[JE,eR]),sM=t.object({ok:t.literal(!0),post_actions:t.array(t.object({action:$l,status:t.enum(["succeeded","failed"])}).strict()).default([])}),Yl=Se,tR=t.enum(["text","binary"]),Xl=t.object({path:Yl,kind:tR,language:t.string().min(1).nullable(),size_bytes:t.number().int().nonnegative()}),iM=t.object({path:Yl}),nR=Xl.extend({kind:t.literal("text"),language:t.string().min(1),content:t.string()}),sR=Xl.extend({kind:t.literal("binary"),language:t.null(),mime_type:t.string().min(1),content_base64:t.string().min(1)}),aM=t.union([nR,sR]);function Nn(e){return typeof e=="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(e):!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>Nn(n)):Object.entries(e).some(([n,s])=>iR(n)||Nn(s))}function iR(e){let n=e.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 Ql(e){let n=e.split("/");return e.length>0&&!e.startsWith("/")&&!e.includes("\\")&&n.every(s=>s!==""&&s!=="."&&s!=="..")}function aR(e){if(/^(?:src\/)?app\/\.vcp\//.test(e))return Un(e);let n=/^app\/(?:(.*)\/)?page\.(?:tsx|jsx)$/.exec(e);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)||ln.test(`/${r}`))}var Zl=t.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),oR=t.object({id:Ln,tenant_id:t.string().min(1),site_id:T,sandbox_id:t.string().min(1).nullable(),status:Zl,source_snapshot_id:k.nullable(),last_snapshot_id:k.nullable(),preview_url:t.string().url().nullable(),browser_preview_url:t.string().url().nullable().optional(),launch_id:t.string().min(1).nullable().optional(),last_activity_at:t.string().min(1).nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}),oM=t.object({session_id:Ln.optional(),sandbox_id:t.string().min(1).optional(),source_snapshot_id:k.optional(),last_snapshot_id:k,expected_current_snapshot_id:k.optional(),expected_ready_session_id:Ln.optional(),expected_ready_session_last_snapshot_id:k.optional(),status:Zl,preview_url:t.string().url().optional(),launch_id:t.string().min(1).optional()}),rM=t.object({preview_session:oR,next_step:t.literal("preview")}),cM=t.object({failed_count:t.number().int().nonnegative()}),mM=t.object({site_id:T}),lM=t.object({status:t.enum(["cancelled","stop_requested","no_active_run"]),agent_run:Be.nullable()});export{qc as AESTHETIC_NOTE_MAX_LENGTH,Qy as AI_IMAGE_GENERATION_ENTITLEMENT,Bt as AI_IMAGE_GENERATION_MAX_QUANTITY,tf as APPLICATION_LIBRARY_ERROR_CODES,xN as AbandonSiteSnapshotResponseSchema,xy as ActiveSiteDomainDataSchema,KL as ActiveWorkspaceRunResponseSchema,El as ActivityKindSchema,bt as ActivityTitleCodeSchema,x1 as AdvanceSiteWorkflowRequestSchema,_l as AgentErrorCategorySchema,Xa as AgentEventIdSchema,Ca as AgentEventRecordSchema,Kl as AgentEventSchema,ql as AgentEventTypeSchema,RE as AgentMessageHistoryPurposeSchema,Sl as AgentModelRouteSchema,IE as AgentPlanStepSchema,_N as AgentRunContextResponseSchema,K as AgentRunIdSchema,hl as AgentRunKindSchema,Be as AgentRunRecordSchema,Sx as AgentRunStatusSchema,gl as AgentRunTypeSchema,He as AgentThreadIdSchema,fx as AgentThreadKindSchema,bx as AgentThreadOriginSchema,Ks as AgentThreadRecordSchema,fl as AgentThreadStatusSchema,Zy as AiImageGenerationPrecheckRequestSchema,Jy as AiImageGenerationPrecheckResponseSchema,Pa as AiImageGenerationQuotaSchema,vE as AiSdkUiDataPartSchema,OE as AiSdkUiErrorPartSchema,PE as AiSdkUiFilePartSchema,Gs as AiSdkUiMessagePartSchema,qE as AiSdkUiMessageSchema,AE as AiSdkUiReasoningPartSchema,CE as AiSdkUiSourceDocumentPartSchema,wE as AiSdkUiSourceUrlPartSchema,jE as AiSdkUiStepStartPartSchema,kE as AiSdkUiTextPartSchema,DE as AiSdkUiToolPartSchema,jL as ApiContractStatusSchema,Ax as ApiErrorEnvelopeSchema,M as ApiResponseSchema,wL as AppendAgentEventRequestSchema,CL as AppendAgentEventResponseSchema,mv as ApplicationCreateResponseSchema,rf as ApplicationLibraryApplicationSchema,lv as ApplicationLibraryApplicationsDataSchema,Bc as ApplicationLibraryErrorCodeSchema,dv as ApplicationLibraryErrorResponseSchema,pv as ApplicationLibraryTemplatesDataSchema,Vc as ApplicationTemplateCatalogDataSchema,nf as ApplicationTemplateCatalogItemSchema,ef as ApplicationTemplateConsumeDataSchema,cv as ApplicationTemplateCreateRequestSchema,af as ApplicationTemplateCreateResponseSchema,sf as ApplicationTemplateCreatedApplicationSchema,Es as ApplicationTemplateDigestSchema,YS as ApplicationTemplateFieldSchema,JS as ApplicationTemplateReferenceSchema,of as ApplicationTemplateSourceSchema,Rs as ApplicationTemplateStableKeySchema,oa as ApplicationTemplateV1Schema,ZE as ApplyPatchBatchErrorCodeSchema,eR as ApplyPatchBatchFailureSchema,JL as ApplyPatchBatchInputSchema,VE as ApplyPatchBatchPatchSchema,Bl as ApplyPatchBatchPostActionSchema,nM as ApplyPatchBatchResultSchema,JE as ApplyPatchBatchSuccessSchema,eM as ApplyPatchBatchToolInputSchema,HE as ApplyPatchEditSchema,BE as ApplyPatchOperationSchema,ul as ArchetypeProposalSchema,xR as AuditLogIdSchema,mR as AuthIdentityIdSchema,uR as AuthLoginCodeIdSchema,dR as AuthOidcStateIdSchema,lR as AuthSessionIdSchema,pR as AuthTokenIdSchema,_R as AuthWsTicketIdSchema,rb as BINDING_STATUSES,Rl as BlockGenerationContextSchema,JN as BlockMediaIntentSchema,Ua as BlockSchema,zg as BlockingSubsiteSchema,Il as BrandingSchema,Dt as BriefIdSchema,Na as BriefRecordSchema,ro as BusinessFactsSchema,YP as CHAT_COPY,$P as CLARIFICATION_COPY,Of as CMS_FORM_FIELD_TYPES,yc as CMS_MAIN_PRODUCTS_MAX_LENGTH,Hd as CMS_PAGE_DIRECTORY_MAX_DEPTH,Bd as CMS_PAGE_DIRECTORY_MAX_NODES,Ho as CMS_PAGE_URL_PATH_MAX_LENGTH,S0 as COMPONENT_I18N_FILE_SUFFIX,ms as COMPONENT_I18N_NAMESPACE,rp as CONVERSION_CTA_LABEL_MAX_LENGTH,Tb as CRAWLER_INTERNAL_ERROR_CODES,gc as CURRENT_EDIT_ENGINE_VERSION,mM as CancelActiveWorkspaceRunRequestSchema,lM as CancelActiveWorkspaceRunResponseSchema,Um as CheckSitePublishDomainDataSchema,uy as CheckSitePublishDomainRequestSchema,_y as CheckSitePublishDomainResponseSchema,Tl as ChromeDesignSchema,Fx as ChromeFooterDesignSchema,qx as ChromeFooterShellSchema,Mx as ChromeHeaderDesignSchema,Lx as ChromeHeaderShellSchema,Gx as ChromeMobileNavDesignSchema,l0 as ClaimStaleWorkspaceRunsResponseSchema,gx as ClarifyQuestionOptionSchema,hx as ClarifyQuestionSchema,dx as ClarifyQuestionTypeSchema,Oa as ClarifyQuestionsSchema,Gj as ClarifyRunInputSchema,$a as ClarifySessionIdSchema,SE as ClarifySessionRecordSchema,Kj as ClarifyStreamEventSchema,bv as CmsApplicationCoreInputSchema,yv as CmsApplicationCoreResultSchema,xv as CmsApplicationSeedInputSchema,Ev as CmsApplicationSeedResultSchema,ER as CmsCollectionBindingIdSchema,gD as CmsCollectionBindingSchema,im as CmsFormSchemaProjectionSchema,_i as CmsManagedPageTypeSchema,Yd as CmsPageDirectoryGroupSchema,Vo as CmsPageDirectoryNodeSchema,zo as CmsPageDirectorySchema,gi as CmsPageTypeSchema,et as CmsPageUrlPathSchema,bo as CmsSiteIdSchema,Eb as CompanyInfoSchema,CD as CompanyInfoTaskCreateRequestSchema,vD as CompanyInfoTaskCreateResponseSchema,DD as CompanyInfoTaskResponseSchema,xC as CompleteCustomerMaterialsRequestSchema,EC as CompleteDiagnosisRequestSchema,RN as CompleteSiteSnapshotDeletionResponseSchema,E1 as CompleteSiteWorkflowRequestSchema,RC as CompleteStrategyRequestSchema,yC as CompleteWebsiteScanRequestSchema,b0 as ComponentI18nResourcesSchema,ek as ComposeDesignerPageResourceBodySchema,hy as ConfirmSitePublishDomainRemediationDataSchema,gy as ConfirmSitePublishDomainRemediationRequestSchema,Sy as ConfirmSitePublishDomainRemediationResponseSchema,SL as ConfirmSiteStructureRequestSchema,iv as ConnectDynamicCollectionInputSchema,kv as ConnectFormInputSchema,Rt as ConversionHintsSchema,kb as CrawlerInternalErrorCodeSchema,OD as CrawlerInternalErrorSchema,zt as CrawlerTaskCodeSchema,xD as CrawlerTaskCreateRequestSchema,ID as CrawlerTaskCreateResponseSchema,_b as CrawlerTaskFailureErrorCodeSchema,bm as CrawlerTaskFailureStageSchema,hb as CrawlerTaskPageSchema,ED as CrawlerTaskPagesQuerySchema,AD as CrawlerTaskPagesResponseSchema,kD as CrawlerTaskStatusResponseSchema,wt as CrawlerTaskUuidSchema,QN as CreateAgentRunConflictResponseSchema,gN as CreateAgentRunRequestSchema,hN as CreateAgentRunResponseSchema,KN as CreateDeploymentRequestSchema,Rx as CreateDeploymentResponseSchema,gI as CreateDocumentUploadRequestSchema,AR as CreateExternalSiteEditRequestSchema,PR as CreateExternalSiteEditResponseSchema,xI as CreateImageUploadRequestSchema,lI as CreateInputSourceRequestSchema,WN as CreateQualityCheckDeploymentRequestSchema,$j as CreateSiteBriefRequestSchema,lN as CreateSiteBriefResponseSchema,Yj as CreateSiteDraftRequestSchema,Vj as CreateSiteInputSchema,BL as CreateSiteThreadRequestSchema,b1 as CreateSiteWorkflowRequestSchema,Sp as CreateTextInputSourceRequestSchema,fp as CreateUrlInputSourceRequestSchema,BN as CurrentDeploymentResponseSchema,_C as CustomerMaterialsDraftResponseSchema,$i as CustomerMaterialsDraftSchema,gC as CustomerMaterialsNullableResponseSchema,Yi as CustomerMaterialsRecordSchema,uC as CustomerMaterialsResponseSchema,IS as CustomerMaterialsStatusSchema,TS as DEFAULT_FONTS,Dc as DEFAULT_SITE_DESIGN_RADIUS_ID,Wp as DEFAULT_SITE_LOCALE,ow as DEFAULT_SUBSITE_PALETTE,DA as DEPLOYMENT_ACTIVE_STATUSES,ut as DEPLOYMENT_LIFECYCLE_TRANSITIONS,J_ as DEPLOYMENT_PROGRESS_STEP_CODES,kx as DEPLOYMENT_REALTIME_CHANNEL,jt as DEPLOYMENT_STATUSES,OA as DEPLOYMENT_TERMINAL_STATUSES,Lg as DEPLOYMENT_TRANSITION_ERROR_CODE,XN as DEPLOYMENT_WEBSOCKET_CONTRACT,TT as DESIGNER_COMPONENT_LIBRARY_ERROR_CODES,YT as DESIGNER_PAGE_LIBRARY_ERROR_CODES,pI as DOCUMENT_EXTENSION_WHITELIST,dI as DOCUMENT_MIME_WHITELIST,Kb as DOMAIN_DNS_PURPOSES,Bb as DOMAIN_DNS_REMEDIATION_STATUSES,Wb as DOMAIN_DNS_VERIFICATION_STATUSES,Ub as DOMAIN_OBSERVED_STATUSES,Fb as DOMAIN_ROUTING_MODES,FT as DeleteDesignerPageErrorDetailsSchema,LT as DeleteDesignerPageRequestSchema,MT as DeleteDesignerPageResponseSchema,su as DeleteDesignerPageResultSchema,EN as DeleteSiteSnapshotResponseSchema,Je as DeploymentIdSchema,gR as DeploymentJobIdSchema,eg as DeploymentProgressStepCodeSchema,ng as DeploymentProgressStepSchema,tg as DeploymentProgressStepStatusSchema,$r as DeploymentProgressStepsSchema,ft as DeploymentRecordSchema,YN as DeploymentRedisPubSubEventSchema,La as DeploymentStatusSchema,ml as DeploymentStatusSummarySchema,Fi as DeploymentTransitionError,yl as DeploymentTypeSchema,qs as DeploymentWsDeploymentPayloadSchema,$N as DeploymentWsServerMessageSchema,Tx as DeploymentWsServerMessageTypeSchema,xE as DesignPlanGenerationOutcomeSchema,EE as DesignPlanGenerationReasonSchema,Bs as DesignPlanIdSchema,nL as DesignPlanPatchSchema,fE as DesignPlanRecordSchema,kl as DesignPlanSchema,ZN as DesignTokensSchema,zd as DesignerComponentCatalogItemSchema,qo as DesignerComponentCategoriesDataSchema,Uo as DesignerComponentCategoryNodeSchema,kt as DesignerComponentExactVersionSchema,Go as DesignerComponentInstallDataSchema,Fo as DesignerComponentsDataSchema,mu as DesignerPageCatalogItemSchema,tr as DesignerPageCategoriesDataSchema,er as DesignerPageCategoryNodeSchema,eu as DesignerPageDeleteBlockReasonSchema,Jd as DesignerPageDisabledReasonSchema,mn as DesignerPageExactVersionSchema,Qo as DesignerPageGroupSchema,sr as DesignerPageInstallDataSchema,Xo as DesignerPageNodeSchema,ar as DesignerPageResourcePreparationDataSchema,cu as DesignerPageResourceSourceSchema,hu as DesignerPageResourceTemplateSchema,At as DesignerPageResourceTypeSchema,nr as DesignerPagesDataSchema,li as DesignerResourceVersionSchema,or as DesignerSitePagesDataSchema,QT as DesignerSiteRouteIdSchema,Om as DomainConfigurationSchema,ba as DomainDnsPurposeSchema,Qb as DomainDnsRecordSchema,Xb as DomainDnsRemediationChangeSchema,Cm as DomainDnsRemediationRecordSchema,vm as DomainDnsRemediationResultSchema,Hb as DomainDnsRemediationStatusSchema,Yb as DomainDnsVerificationObservationSchema,wm as DomainDnsVerificationResultSchema,zb as DomainDnsVerificationStatusSchema,qb as DomainObservedStatusSchema,$b as DomainOperationErrorSchema,js as DomainOperationSchema,Vb as DomainOperationStatusSchema,ya as DomainOperationTypeSchema,Dm as DomainRecordSchema,Gb as DomainRoutingModeSchema,QP as EDIT_ENGINE_VERSION_HEADER,ZP as EDIT_ENGINE_VERSION_SOURCE_HEADER,BP as ERROR_COPY,np as EXTERNAL_SITE_EDIT_INFRASTRUCTURE_REASONS,tp as EXTERNAL_SITE_EDIT_PROMPT_MAX_LENGTH,Vi as EditEngineVersionParseError,rr as EnhanceDesignerPageResourceBodySchema,cN as EnhanceDesignerPageResourceResponseSchema,vR as ExternalSiteEditCallbackAckSchema,CR as ExternalSiteEditCallbackPayloadSchema,sp as ExternalSiteEditCallbackStatusSchema,Qt as ExternalSiteEditDegradedReasonSchema,Et as ExternalSiteEditExternalIdSchema,eo as ExternalSiteEditOutcomeSchema,Ja as ExternalSiteEditTaskIdSchema,Mn as ExternalSiteEditTaskSchema,ip as ExternalSiteEditTaskStatusSchema,Jj as ExternalSyncSiteRequestSchema,mN as ExternalSyncSiteResponseSchema,_p as ExtractedFactKindSchema,Fn as ExtractedFactSchema,aa as FIELD_TYPES,n0 as FILL_IN_NOT_AVAILABLE_ERROR_CODE,i0 as FILL_IN_TARGET_MODIFIED_ERROR_CODE,s0 as FILL_IN_TARGET_NOT_OMITTED_ERROR_CODE,wc as FONT_PAIRINGS,Qi as FONT_PAIRING_IDS,Bf as FORM_DESIGN_ERROR_CODES,zf as FORM_DESIGN_FAILURE_STAGES,Kf as FORM_DESIGN_OPERATION_STAGES,Wf as FORM_DESIGN_OPERATION_STATUSES,Ts as FORM_FIELD_TYPES,jf as FORM_SPEC_FIELD_TYPE_TO_CMS,Zc as FORM_SPEC_FILE_MIN_RUNTIME_VERSION,Tf as FORM_SPEC_LOCALIZABLE_FIELD_PATHS,Qc as FORM_SPEC_MULTISTEP_MIN_RUNTIME_VERSION,Mv as FORM_TEMPLATE_CATEGORY_COUNTS,Lv as FORM_TEMPLATE_CATEGORY_SLUGS,cM as FailStaleInFlightWorkspaceRunsResponseSchema,xs as FieldDeclSchema,sc as FillInTargetSchema,WD as FirecrawlBatchCreateRequestSchema,zD as FirecrawlBatchCreatedResponseSchema,wb as FirecrawlBatchErrorSchema,HD as FirecrawlBatchErrorsResponseSchema,Pb as FirecrawlBatchPageSchema,BD as FirecrawlBatchStatusResponseSchema,UD as FirecrawlCrawlCreateRequestSchema,qD as FirecrawlCrawlCreatedResponseSchema,FD as FirecrawlCrawlStatusResponseSchema,Im as FirecrawlJobStatusSchema,LD as FirecrawlMapRequestSchema,MD as FirecrawlMapResponseSchema,VD as FirecrawlQueueStatusResponseSchema,GD as FirecrawlScrapeRequestSchema,KD as FirecrawlScrapeResponseSchema,Ux as FooterShellSurfaceSchema,gf as FormBlockIdSchema,As as FormDefinitionIdSchema,qf as FormDesignAffectedFilesSchema,ha as FormDesignErrorCodeSchema,$v as FormDesignErrorSchema,rm as FormDesignFailureStageSchema,oe as FormDesignHashSchema,Gv as FormDesignOpenResponseSchema,Ff as FormDesignOperationFingerprintInputSchema,la as FormDesignOperationIdSchema,cm as FormDesignOperationNextActionSchema,SR as FormDesignOperationRecordIdSchema,Hv as FormDesignOperationRecordSchema,Sa as FormDesignOperationResponseSchema,lm as FormDesignOperationSchema,ga as FormDesignOperationStageSchema,om as FormDesignOperationStatusSchema,Vv as FormDesignOperationTransitionRequestSchema,mm as FormDesignPreviewRefreshStatusSchema,Wv as FormDesignQueryResponseSchema,zv as FormDesignResumeRequestSchema,Bv as FormDesignResumeResponseSchema,Gf as FormDesignSaveRequestSchema,Kv as FormDesignSaveResponseSchema,am as FormDesignSharedImpactSchema,_a as FormDesignStandardizationSchema,uf as FormFieldDeclSchema,Cn as FormFieldNameSchema,pa as FormOptionValueSchema,hf as FormSpecBindingSchema,ff as FormSpecFieldNodeSchema,yf as FormSpecNodeSchema,Sf as FormSpecOptionSchema,bf as FormSpecStepBreakNodeSchema,ua as FormSpecV1Schema,Uv as FormTemplateCatalogResponseSchema,sm as FormTemplateCategorySlugSchema,vf as FormTemplateCategoryV1Schema,ht as FormTemplateTextSchema,Df as FormTemplateV1Schema,Ey as GSC_AUTH_STATUSES,Ry as GSC_BINDING_STATUSES,Iy as GSC_PROPERTY_TYPES,ex as GenerateAiImagesRequestSchema,tx as GenerateAiImagesResponseSchema,al as GeneratedAiImageResultSchema,wO as GetActiveSiteDomainResponseSchema,HN as GetDeploymentResponseSchema,Ix as GetDeploymentsStatusResponseSchema,wR as GetExternalSiteEditResponseSchema,PO as GetSiteDomainConfigurationResponseSchema,xa as GetSitePublishDomainOperationDataSchema,fy as GetSitePublishDomainOperationResponseSchema,Mw as GetTemplateUpgradeReportQuerySchema,Uw as GetTemplateUpgradeReportResponseSchema,XO as GoogleSearchConsoleAuthStartDataSchema,YO as GoogleSearchConsoleAuthStartRequestSchema,QO as GoogleSearchConsoleAuthStartResponseSchema,BO as GoogleSearchConsoleAuthStatusSchema,HO as GoogleSearchConsoleBindingStatusSchema,VO as GoogleSearchConsolePropertyTypeSchema,$O as GoogleSearchConsoleStateSchema,JO as GoogleSearchConsoleStatusDataSchema,ZO as GoogleSearchConsoleStatusInputSchema,ej as GoogleSearchConsoleStatusResponseSchema,KO as GscAuthStartDataSchema,GO as GscAuthStartRequestSchema,WO as GscAuthStartResponseSchema,Ea as GscAuthStatusSchema,Ra as GscBindingStatusSchema,Ia as GscPropertyTypeSchema,ky as GscStateInputSchema,zO as GscStateSchema,Gm as GscStatusDataSchema,Ay as GscStatusResponseSchema,Bo as HOME_PAGE_URL_PATH,jx as HeaderShellBehaviorSchema,Nx as HeaderShellShapeSchema,Ox as HeaderShellSurfaceSchema,Dx as HeaderShellVariantSchema,cb as HomeUrlCrawlerTaskCreateRequestSchema,Ti as HttpUrlSchema,SI as IMAGE_EXTENSION_WHITELIST,fI as IMAGE_MIME_WHITELIST,Mo as INSERT_NEW_COMPONENT_CATEGORY_GROUP_KEY,Jo as INSERT_NEW_PAGE_CATEGORY_GROUP_KEY,BA as INTERNAL_RUN_LEASE_OWNER_HEADER,zp as ISO_639_3_TO_SITE_LOCALE,bp as ImageRoleSchema,Wl as InboundUserMessageSchema,JC as IndustryClassificationRequestSchema,ev as IndustryClassificationResultSchema,BS as IndustryConfidenceSchema,Hc as InitializationResultSchema,up as InputBundleStatusSchema,Kn as InputConflictSchema,EI as InputContextBundleSchema,xt as InputContextSourceIdSchema,hp as InputSourceSchema,Ys as InputSourceStatusSchema,$s as InputSourceTypeSchema,Tw as InspectTemplateUpgradeStateRequestSchema,kw as InspectTemplateUpgradeStateResponseSchema,wT as InstallDesignerComponentBodySchema,nN as InstallDesignerComponentResponseSchema,ZT as InstallDesignerPageBodySchema,aN as InstallDesignerPageResponseSchema,zN as InternalCreateDeploymentResponseSchema,UN as InternalEnsureSubsitePublishRequestSchema,qN as InternalEnsureSubsitePublishResponseSchema,V as InternalEntityIdSchema,VN as InternalGetDeploymentsStatusResponseSchema,FN as InternalGetSubsitePublishStatusRequestSchema,GN as InternalGetSubsitePublishStatusResponseSchema,LN as InternalPrepareSubsitePreviewRequestSchema,MN as InternalPrepareSubsitePreviewResponseSchema,xS as KNOWLEDGE_CATEGORY_CODES,xc as KnowledgeCategoryCodeSchema,rC as KnowledgeContextReadinessSchema,RS as KnowledgeSourceReadinessSchema,Ec as KnowledgeSourceReadinessStatusSchema,aC as KnowledgeTaskStatusBatchSchema,ES as KnowledgeTaskStatusSchema,Up as LEGACY_SITE_LOCALE_CODES,$L as LatestAgentRunQuerySchema,YL as LatestAgentRunResponseSchema,GL as LatestWorkspaceRunQuerySchema,FL as LatestWorkspaceRunResponseSchema,eO as LauncherPromptTemplateApplyRequestSchema,tO as LauncherPromptTemplateApplyResponseSchema,Ob as LauncherPromptTemplateCatalogItemSchema,ZD as LauncherPromptTemplateCatalogQuerySchema,JD as LauncherPromptTemplateCatalogSchema,vb as LauncherPromptTemplateKindSchema,Db as LauncherPromptTemplateLocaleSchema,Os as LauncherPromptTemplateTypeSchema,DL as ListAgentEventsQuerySchema,vL as ListAgentEventsResponseSchema,eN as ListDesignerComponentCategoriesResponseSchema,PT as ListDesignerComponentsQuerySchema,tN as ListDesignerComponentsResponseSchema,sN as ListDesignerPageCategoriesResponseSchema,XT as ListDesignerPagesQuerySchema,iN as ListDesignerPagesResponseSchema,rN as ListDesignerSitePagesResponseSchema,$y as ListMediaLibraryAssetsQuerySchema,Yy as ListMediaLibraryAssetsResponseSchema,OL as ListSiteAgentEventsQuerySchema,ON as ListSiteVersionsResponseSchema,qw as ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema,Fw as ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema,c0 as ListWorkspacePageCheckpointsResponseSchema,_I as MAX_DOCUMENT_SOURCES_PER_SITE,uI as MAX_DOCUMENT_UPLOAD_BYTES,yI as MAX_IMAGE_SOURCES_PER_SITE,bI as MAX_IMAGE_UPLOAD_BYTES,Gy as MAX_NAV_LABEL_WIDTH,F1 as MAX_UNBOUND_WORKSPACE_ATTACHMENTS_PER_SITE,Di as MAX_WORKSPACE_ATTACHMENTS_PER_MESSAGE,V1 as MAX_WORKSPACE_URL_CAPTURES_PER_SITE_HOUR,Qm as MEDIA_LIBRARY_AUDIO_EXTENSIONS,nl as MEDIA_LIBRARY_AUDIO_MIME_TYPES,Zm as MEDIA_LIBRARY_DOCUMENT_EXTENSIONS,Hy as MEDIA_LIBRARY_EXTENSIONS,Jm as MEDIA_LIBRARY_FILE_EXTENSIONS,Ym as MEDIA_LIBRARY_IMAGE_EXTENSIONS,By as MEDIA_LIBRARY_IMAGE_MAX_BYTES,el as MEDIA_LIBRARY_IMAGE_MIME_TYPES,$m as MEDIA_LIBRARY_MAX_BYTES,Vy as MEDIA_LIBRARY_MIME_TYPES,Xm as MEDIA_LIBRARY_VIDEO_EXTENSIONS,tl as MEDIA_LIBRARY_VIDEO_MIME_TYPES,E0 as MIGRATION_PRODUCTS_CMS_DETAIL_PAGE_TITLE,x0 as MIGRATION_PRODUCTS_DETAIL_PREFIX,T0 as MIGRATION_PRODUCTS_DETAIL_VIEW_VARIANT,I0 as MIGRATION_PRODUCTS_LIST_VIEW_VARIANT,Gg as MIGRATION_PRODUCTS_ROUTE,at as MIGRATION_PRODUCTS_SLUG,R0 as MIGRATION_PRODUCTS_VIEW_BLOCK_TYPE,df as MODEL_DECLARABLE_FORM_FIELD_TYPES,NS as MOTION_PRESETS,Ji as MOTION_PRESET_IDS,tL as MediaAssetSchema,Cx as MediaAttributionSchema,Aa as MediaLibraryAssetSchema,sl as MediaLibraryFileTypeSchema,il as MediaLibrarySourceSchema,$E as MediaRequestOwnerSchema,yR as MediaResolutionCacheIdSchema,AT as MockDesignerComponentInsertDataSchema,kT as MockDesignerComponentInsertRequestSchema,Da as MotionLevelSchema,Jf as NAV_ITEMS_LOCALIZABLE_FIELD_PATHS,eb as NAV_ITEMS_MACHINE_FIELD_PATHS,wS as NEXT_FONT_DISPLAY_NAMES,En as NEXT_FONT_REGISTRY,Bp as NON_LATIN_SITE_LOCALE_CODES,iD as NavItemSchema,Yf as PAGE_SEO_LOCALIZABLE_FIELD_PATHS,Xf as PAGE_SEO_MACHINE_FIELD_PATHS,ln as PAGE_SLUG_PATTERN,Lt as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,no as PAGE_TEMPLATE_BATCH_MAX_ITEMS,lD as PLATFORM_MATERIALIZED_EXEMPTIONS,ib as PLATFORM_MATERIALIZED_FILES,ab as PLATFORM_MATERIALIZED_FILE_PATTERNS,mD as PLATFORM_MATERIALIZERS,cr as PLATFORM_OWNED_PAGE_SLUGS,Su as PLATFORM_OWNED_ROUTE_FILE_PATHS,nu as PageDirectoryReconcileFailedPageSchema,hi as PageDirectoryReconcileResultSchema,KT as PageDirectoryReconcileStateSchema,tu as PageDirectoryReconcileStatusSchema,db as PageDiscoveryCoverageEntrySchema,TD as PageDiscoveryCoverageReasonSchema,ym as PageDiscoveryCoverageSchema,Al as PageNavigationSchema,fi as PageResourceArtifactSchema,uu as PageResourceComponentReferenceSchema,_u as PageResourceComponentSchema,pu as PageResourceDraftPageSchema,du as PageResourceDraftSchema,ts as PageResourceFinalRouteSchema,gu as PageResourcePageSchema,lu as PageResourcePageSelectionSchema,ir as PageResourceRouteMappingSchema,Fa as PageSchema,nD as PageSeoDeclSchema,qa as PageSlugSchema,au as PageTargetKindSchema,di as PageTargetProjectionHashSchema,Zo as PageTargetSchema,ou as PageTargetSeoSchema,GT as PageTargetSetSchema,io as PageTemplateBatchManifestSchema,UR as PageTemplateCleanupRequestSchema,GR as PageTemplateCleanupResponseSchema,to as PageTemplateCreateItemSchema,LR as PageTemplateCreateRequestSchema,qR as PageTemplateCreateResponseSchema,KR as PageTemplateErrorCodeSchema,Ge as PageTemplateIdSchema,Zt as PageTemplatePagePathSchema,MR as PageTemplatePromoteRequestSchema,FR as PageTemplatePromoteResponseSchema,ap as PageTemplateTaskSchema,EL as PersistClarifyAnswersRequestSchema,RL as PersistClarifyAnswersResponseSchema,fL as PersistGeneratedSitemapDraftRequestSchema,xL as PersistGeneratedSitemapDraftResponseSchema,oM as PersistPreviewSessionRequestSchema,rM as PersistPreviewSessionResponseSchema,TL as PersistSiteDesignPlanRequestSchema,kL as PersistSiteDesignPlanResponseSchema,yL as PersistSiteSitemapDraftResponseSchema,hL as PersistSiteSitemapRequestSchema,bL as PersistSiteSitemapResponseSchema,SN as PersistSiteSnapshotRequestSchema,fN as PersistSiteSnapshotResponseSchema,px as PositioningPrefillSchema,wa as PositioningSourceSchema,JT as PrepareDesignerPageBodySchema,oN as PrepareDesignerPageResponseSchema,Qw as PrepareSiteBuildInitialGenerationBaseRequestSchema,Zw as PrepareSiteBuildInitialGenerationBaseResultSchema,Iw as PrepareTemplateUpgradeStateRequestSchema,iS as PrepareTemplateUpgradeStateResponseSchema,NN as PrepareVersionPreviewRequestSchema,Ex as PrepareVersionPreviewResponseSchema,Hr as ProductSearchAppConfigDraftSchema,Ci as ProductSearchAppSlugSchema,M1 as ProductSearchContractFixtureSchema,z_ as ProductSearchDraftConfigSchema,De as ProductSearchFieldNameSchema,K_ as ProductSearchFilterMetaSchema,vi as ProductSearchInteractionRequestSchema,os as ProductSearchInteractionResponseSchema,L1 as ProductSearchPopularTermsReadSchema,Br as ProductSearchPopularTermsSchema,$_ as ProductSearchRequestSchema,X_ as ProductSearchResponseSchema,hn as ProductSearchRouteIdSchema,G_ as ProductSearchValueShapeSchema,yN as PromoteSiteSnapshotRequestSchema,yx as PromoteSiteSnapshotResponseSchema,vN as PromoteTemplateUpgradeSnapshotRequestSchema,DN as PromoteTemplateUpgradeSnapshotResponseSchema,Lm as QualityRunningStatusSchema,VP as REFUSAL_COPY,LL as REST_API_ENDPOINTS,Qf as ROOT_LAYOUT_METADATA_LOCALIZABLE_FIELD_PATHS,Zf as ROOT_LAYOUT_METADATA_MACHINE_FIELD_PATHS,by as ReconcileSitePublishDomainOperationDataSchema,yy as ReconcileSitePublishDomainOperationResponseSchema,IN as RecordSnapshotVersionRequestSchema,TN as RecordSnapshotVersionResponseSchema,Nw as RecordTemplateUpgradeEventRequestSchema,Lw as RecordTemplateUpgradeEventResponseSchema,Aw as RecordTemplateUpgradeFailureRequestSchema,Pw as RecordTemplateUpgradeFailureResponseSchema,ww as RecordTemplateUpgradeSuccessRequestSchema,Cw as RecordTemplateUpgradeSuccessResponseSchema,UT as RecoverDesignerPageProjectionRequestSchema,qT as RecoverDesignerPageProjectionResponseSchema,iu as RecoverDesignerPageProjectionResultSchema,gp as ReferencePagePatternSchema,Gn as ReferenceSignalsSchema,ox as RegisterMediaResourceReferenceRequestSchema,rx as RegisterMediaResourceReferenceResponseSchema,R1 as RegisterWorkflowTaskCommandRequestSchema,j_ as RegisterWorkflowTaskRequestSchema,r0 as RegisterWorkspacePageCheckpointRequestSchema,PN as ReleaseTemplateUpgradeLockRequestSchema,wN as ReleaseTemplateUpgradeLockResponseSchema,k1 as ReplaceCrawlWorkflowTaskCommandRequestSchema,L_ as ReplaceCrawlWorkflowTaskRequestSchema,T1 as ReplaceWorkflowTaskCommandRequestSchema,N_ as ReplaceWorkflowTaskRequestSchema,sv as ResolvedFieldSchema,Av as ResolvedFormFieldSchema,NL as RestApiMethodSchema,jN as RestoreSiteSnapshotResponseSchema,sD as RootLayoutMetadataSchema,xl as RouteGenerationCardSchema,wg as RuleEngineInputSchema,Og as RuleEngineScoreRecordSchema,qi as RuleScoreDimensionKeySchema,Dg as RuleScoreDimensionSchema,nn as SELECTABLE_SITE_LOCALE_CODES,wl as SITEMAP_RESOLVER_MAX_BLOCK_TARGETS,Pl as SITEMAP_RESOLVER_MAX_PAGE_TARGETS,Yw as SITE_BUILD_CONTEXT_FILE_PATH,Xw as SITE_BUILD_CONTEXT_MAX_BYTES,E_ as SITE_BUILD_STATUSES,Ur as SITE_BUILD_STATUS_CODES,R_ as SITE_DEPLOYMENT_STATUSES,qr as SITE_DEPLOYMENT_STATUS_CODES,Zi as SITE_DESIGN_DENSITY_IDS,vc as SITE_DESIGN_RADIUS_IDS,Y0 as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,Md as SITE_EDIT_MATERIALIZATION_MAX_FILE_CONTENT_BYTES,ci as SITE_EDIT_MATERIALIZATION_MAX_FILE_COUNT,mi as SITE_EDIT_MATERIALIZATION_MAX_TOTAL_CONTENT_BYTES,Rr as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,Nk as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,Ah as SITE_EDIT_RUNTIME_CONTAINER_TAGS,Ph as SITE_EDIT_RUNTIME_TEXT_TAGS,kh as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,kk as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,xp as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,lo as SITE_EDIT_SOURCE_ALLOWED_DIRS,yp as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,Qs as SITE_EDIT_SOURCE_DELETE_CAPABILITY,Ep as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,Ot as SITE_EXTRA_REQUIREMENT_MAX_LENGTH,D0 as SITE_HAS_ACTIVE_SUBSITES_ERROR_CODE,O0 as SITE_HAS_SUBSITES_ERROR_CODE,qp as SITE_LOCALE_CODES,tD as SITE_LOCALIZATION_STRUCTURES,Wj as SITE_PLANNING_FROZEN_ERROR_CODE,zj as SITE_PLANNING_LOCKED_ERROR_CODE,Bj as SITE_STRUCTURE_CONFIRMATION_REQUIRED_ERROR_CODE,Hj as SITE_STRUCTURE_CONFIRMATION_STALE_ERROR_CODE,cl as SITE_STRUCTURE_INVALID_ERROR_CODE,I_ as SITE_WORKFLOW_STATUSES,Fr as SITE_WORKFLOW_STATUS_CODES,ML as SSE_STREAMS,hd as STEP5_GEO_QUESTION_TYPES,$p as STEP5_KEYWORD_CATEGORIES,Xp as STEP5_OPTIONAL_STRATEGY_KEYS,wo as STEP5_PRIMARY_INTENT_PAGE_LIMIT,Yn as STEP5_REQUIRED_STRATEGY_COUNT,on as STEP5_REQUIRED_STRATEGY_KEYS,Ao as STEP5_SEMRUSH_MIN_RELEVANCE_SCORE,nd as STEP5_SEMRUSH_SEARCH_INTENTS,sd as STEP5_SEO_ALLOWED_INTENT_CODES,nT as STEP5_SEO_ALLOWED_SEARCH_INTENTS,rT as STEP5_SEO_KEYWORD_DEFAULT,yd as STEP5_SEO_KEYWORD_MAX,bd as STEP5_SEO_KEYWORD_MIN,$n as STEP5_SEO_MAX_KEYWORD_DIFFICULTY,xo as STEP5_SEO_MIN_FIT,Vn as STEP5_SEO_MIN_SEARCH_VOLUME,fd as STEP5_SEO_PAYLOAD_SCHEMA_VERSION,Od as STEP5_SSE_EVENT_NAMES,ve as STEP5_STRATEGY_COUNT,It as STEP5_STRATEGY_KEYS,Ro as STEP5_STRATEGY_OPTION_IDS,Nc as STEP6_AI_THEME_IDS,ea as STEP6_AI_THEME_PRESETS,Lc as STEP6_GENERATED_THEME_ID_PATTERN,Gh as SUBSITE_GLOSSARY_ENTRY_MAX_CHARS,Kh as SUBSITE_GLOSSARY_MAX_ENTRIES,Zh as SUBSITE_MOUNT_PATH_PATTERN,Vh as SUBSITE_PALETTE_NOTE_MAX_CHARS,Jh as SUBSITE_RESERVED_MOUNT_SEGMENTS,KI as SUPPORTED_SITE_LOCALES,Ln as SandboxSessionIdSchema,oR as SandboxSessionSchema,Zl as SandboxSessionStatusSchema,Zj as SaveBriefDraftRequestSchema,dN as SaveBriefDraftResponseSchema,QR as SaveSiteExtraRequirementRequestSchema,nx as SearchUnsplashMediaQuerySchema,sx as SearchUnsplashMediaResponseSchema,fS as SiteBuildContextFileSchema,SS as SiteBuildContextPayloadSchema,hS as SiteBuildContextProvenanceSchema,gS as SiteBuildContextProvenanceSourceSchema,ki as SiteBuildStatusSchema,j0 as SiteDeletionBlockedDetailsSchema,Ai as SiteDeploymentStatusSchema,Us as SiteDesignContextSchema,ux as SiteDesignDensitySchema,_x as SiteDesignMotionLevelSchema,ds as SiteEditBoundaryKindSchema,Vg as SiteEditCapabilityConstraintSchema,Bg as SiteEditCapabilityModeSchema,ps as SiteEditCapabilityModeViewSchema,U0 as SiteEditCapabilityReadRequestSchema,Eu as SiteEditClassNameSourceDiagnosticSchema,tt as SiteEditClassNameSourceRangeSchema,_r as SiteEditClassNameSourceSchema,lk as SiteEditClassNameSourceStyleContextSchema,ur as SiteEditClassNameSourceStylesheetSchema,yi as SiteEditClassNameSourceWriteIntentSchema,ak as SiteEditCommandDiagnosticSchema,yu as SiteEditCommandErrorSchema,q as SiteEditCompositionContextSchema,ce as SiteEditCompositionSelectorSchema,Hg as SiteEditConstraintKindSchema,l_ as SiteEditDeletePageSourceOutputSchema,fh as SiteEditDynamicConfidenceSchema,yh as SiteEditDynamicDataBindingSchema,lc as SiteEditDynamicDataDetailSchema,pc as SiteEditDynamicDataSummarySchema,bh as SiteEditDynamicEvidenceSchema,mc as SiteEditDynamicSourceKindSchema,hh as SiteEditDynamicSourceTypeSchema,Sh as SiteEditDynamicTargetKindSchema,Gi as SiteEditEffectiveWriteTargetSchema,B0 as SiteEditEventSchema,Hs as SiteEditExecutionSceneSchema,gs as SiteEditExternalSourceKindSchema,_k as SiteEditGetClassNameSourceCommandResultSchema,dk as SiteEditGetClassNameSourceInputSchema,uk as SiteEditGetClassNameSourceResultSchema,AP as SiteEditGetDocumentInputSchema,PP as SiteEditGetObjectEditContextInputSchema,NI as SiteEditGetSourceFileInputSchema,jI as SiteEditGetSourceTreeInputSchema,pk as SiteEditGetStyleContextInputSchema,_s as SiteEditHistoryProvenanceSchema,Zg as SiteEditHistoryReadOnlyRecoveryStatusSchema,$g as SiteEditHistoryRecoveryCodeSchema,Yg as SiteEditHistoryRecoveryDiagnosticSchema,Q0 as SiteEditHistoryResultSchema,X0 as SiteEditHistoryStatusModeSchema,eh as SiteEditHistoryStatusSchema,Xg as SiteEditHistoryUnavailableReasonSchema,Jg as SiteEditHistoryUnavailableStatusSchema,Qg as SiteEditHistoryWritableStatusSchema,WP as SiteEditInitializeSessionInputSchema,r_ as SiteEditInsertNodeSpecSchema,m_ as SiteEditInsertPageResourceOutputSchema,Wd as SiteEditMaterializationDataRequirementsSchema,Kd as SiteEditMaterializationEntrySchema,Gd as SiteEditMaterializationExportSchema,Fd as SiteEditMaterializationFileSchema,Lo as SiteEditMaterializationPathTemplateSchema,Tt as SiteEditMaterializationSchema,Cr as SiteEditMaterializedComponentNodeSpecSchema,kr as SiteEditMoveTargetSchema,pn as SiteEditMutationContextSchema,us as SiteEditNodeCapabilitySnapshotSchema,CP as SiteEditObjectCapabilitiesSchema,DP as SiteEditObjectDetailSchema,jP as SiteEditObjectEditContextSchema,NP as SiteEditObjectStyleDetailSchema,OP as SiteEditObjectSummarySchema,Qk as SiteEditOperationCommandResultSchema,vr as SiteEditOperationErrorCodeSchema,Dr as SiteEditOperationErrorSchema,p_ as SiteEditOperationOutputSchema,c_ as SiteEditOperationParamsSchema,Ii as SiteEditOperationPayloadSchema,Ri as SiteEditOperationRequestSchema,o_ as SiteEditOperationResultTargetSchema,Ut as SiteEditOperationSelectionRefSchema,gh as SiteEditOperationSummarySchema,a_ as SiteEditOperationTargetSchema,_n as SiteEditOperationTypeSchema,Pt as SiteEditOperationValueSchema,Lk as SiteEditPageCompositionAnyVersionSchema,Wu as SiteEditPageCompositionAtomicKindSchema,Vu as SiteEditPageCompositionBoundaryModeSchema,Nu as SiteEditPageCompositionBusinessMemberSchema,Ou as SiteEditPageCompositionContainerSchema,un as SiteEditPageCompositionDiagnosticSchema,ss as SiteEditPageCompositionErrorCodeSchema,yr as SiteEditPageCompositionPlacementTargetSchema,Lu as SiteEditPageCompositionPlacementUnitSchema,Gu as SiteEditPageCompositionRuntimeRefSchema,Fu as SiteEditPageCompositionSchema,Ku as SiteEditPageCompositionSourceMemberKindSchema,ju as SiteEditPageCompositionSourceMemberSchema,Ir as SiteEditPageCompositionSourceRangeSchema,Uu as SiteEditPageCompositionSupportedSchema,qu as SiteEditPageCompositionUnsupportedSchema,Hu as SiteEditPageCompositionV2BusinessMemberSchema,zu as SiteEditPageCompositionV2ContainerSchema,Yu as SiteEditPageCompositionV2PlacementRelationSchema,Qu as SiteEditPageCompositionV2PlacementSchema,$u as SiteEditPageCompositionV2PlacementUnitSchema,t_ as SiteEditPageCompositionV2Schema,Bu as SiteEditPageCompositionV2SourceMemberSchema,Ju as SiteEditPageCompositionV2SupportedSchema,e_ as SiteEditPageCompositionV2UnsupportedSchema,Xu as SiteEditPageCompositionV2WriteModeSchema,Zu as SiteEditPageCompositionVisualAnchorSchema,Mu as SiteEditPagePlacementOptionSchema,br as SiteEditPagePlacementSchema,Er as SiteEditPageUnitResultTargetSchema,xr as SiteEditPageUnitTargetSchema,ch as SiteEditPatchPlanPatchSchema,rP as SiteEditPatchPlanSchema,Ki as SiteEditPropertiesSchema,wu as SiteEditPropertyChangeSchema,ah as SiteEditPropertyCreationSchema,sh as SiteEditPropertyItemSchema,th as SiteEditPropertyResolutionSchema,nh as SiteEditPropertySourceSchema,ih as SiteEditPropertySpreadSchema,yn as SiteEditProvenanceChainSchema,Rh as SiteEditProvenanceHopSchema,wP as SiteEditRenderDocumentSchema,bn as SiteEditRenderEntryRefSchema,xh as SiteEditRenderEntrySchema,cc as SiteEditRenderPageCompositionSchema,uh as SiteEditRenderPageCompositionSupportedSchema,_h as SiteEditRenderPageCompositionUnsupportedSchema,dh as SiteEditRenderPagePlacementSchema,Ak as SiteEditRequiredMutationContextEnvelopeSchema,MI as SiteEditResolveSourceLocationInputSchema,uc as SiteEditSemanticSourceSchema,hr as SiteEditSetPropsParamsSchema,Xk as SiteEditSignedOperationRequestSchema,po as SiteEditSourceDeleteCapabilitySchema,Ip as SiteEditSourceDirectoryPathSchema,wp as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,Cp as SiteEditSourceFileBinaryResponseSchema,DI as SiteEditSourceFileKindSchema,Tp as SiteEditSourceFileListItemSchema,LI as SiteEditSourceFileResponseSchema,Pp as SiteEditSourceFileTextResponseSchema,Ei as SiteEditSourceIdentitySchema,vp as SiteEditSourceLocationRangeSchema,UI as SiteEditSourceLocationSchema,Th as SiteEditSourceLocatorRangeSchema,Bi as SiteEditSourceLocatorSchema,Se as SiteEditSourcePathSchema,uo as SiteEditSourceTreeNodeSchema,OI as SiteEditSourceTreeResponseSchema,kp as SiteEditSourceTreeTruncationReasonSchema,Ap as SiteEditSourceTreeTruncationSchema,wr as SiteEditStyleBreakpointSchema,Sr as SiteEditStyleDraftPropertySchema,vP as SiteEditStyleModelSchema,Ar as SiteEditStylePropertySchema,_c as SiteEditStyleSourceSchema,Pr as SiteEditStyleStateModeSchema,zi as SiteEditTextSegmentSchema,dc as SiteEditTextSourceSchema,Eh as SiteEditWriteTargetSchema,ZR as SiteExtraRequirementResponseSchema,op as SiteExtraRequirementSchema,u0 as SiteGenerationLedgerResponseSchema,T as SiteIdSchema,fe as SiteLocaleSchema,eL as SiteMediaIntentSchema,hR as SiteOperationLockIdSchema,pS as SitePreviewActivateErrorCodeSchema,uS as SitePreviewActivateFailedSchema,dS as SitePreviewActivateReadySchema,Ww as SitePreviewActivateResponseSchema,vO as SitePublishDomainCheckDataSchema,CO as SitePublishDomainCheckRequestSchema,DO as SitePublishDomainCheckResponseSchema,OO as SitePublishDomainOperationDataSchema,jO as SitePublishDomainOperationResponseSchema,NO as SitePublishDomainReconcileOperationResponseSchema,LO as SitePublishDomainRemediationConfirmRequestSchema,MO as SitePublishDomainRemediationConfirmResponseSchema,Ns as SitePublishQualityTaskStatusSchema,uO as SitePublishRepairInputItemSchema,oy as SitePublishRepairResultItemSchema,Mm as SitePublishRepairResultSchema,_O as SitePublishRepairTaskSnapshotSchema,Nm as SitePublishRepairTaskStatusSchema,fO as SitePublishWorkflowActiveResponseSchema,Qa as SitePublishWorkflowIdSchema,cy as SitePublishWorkflowMutationDataSchema,bO as SitePublishWorkflowMutationResponseSchema,my as SitePublishWorkflowPublishDataSchema,yO as SitePublishWorkflowPublishResponseSchema,ly as SitePublishWorkflowQualityDataSchema,xO as SitePublishWorkflowQualityResponseSchema,St as SitePublishWorkflowRecordSchema,SO as SitePublishWorkflowRevisionRequestSchema,Jb as SitePublishWorkflowStatusSchema,ey as SitePublishWorkflowStepSchema,yt as SiteRecordSchema,fR as SiteTemplateUpgradeStateIdSchema,WL as SiteThreadListQuerySchema,zL as SiteThreadListResponseSchema,VL as SiteThreadResponseSchema,Ya as SiteVersionIdSchema,xx as SiteVersionListItemSchema,Ws as SiteVersionRecordSchema,Ve as SiteWorkflowIdSchema,O_ as SiteWorkflowRecordSchema,S1 as SiteWorkflowSnapshotResponseSchema,wi as SiteWorkflowSnapshotSchema,T_ as SiteWorkflowStatusSchema,Za as SiteWorkflowTaskRefIdSchema,f1 as SiteWorkflowTaskRefResponseSchema,Wr as SiteWorkflowTaskRefSchema,lL as SitemapAddBlockInputSchema,Ga as SitemapAnswerSchema,cL as SitemapChangeBlockVariantInputSchema,sE as SitemapDeleteBlockInputSchema,Hx as SitemapDraftBlockSchema,Vx as SitemapDraftPageSchema,hE as SitemapDraftRecordSchema,Dn as SitemapDraftSchema,nE as SitemapEditActorSchema,oE as SitemapEditErrorCodeSchema,cE as SitemapEditFailureSchema,aE as SitemapEditOperationSchema,dL as SitemapEditResultSchema,rE as SitemapEditSuccessSchema,_L as SitemapGenerationInputSchema,uE as SitemapGenerationOutcomeSchema,_E as SitemapGenerationReasonSchema,Dl as SitemapGenerationStageSchema,Ae as SitemapIdSchema,mE as SitemapIntentPageSchema,oL as SitemapModelOutputSchema,Yx as SitemapModelPageSchema,rL as SitemapMoveBlockInputSchema,zx as SitemapNavigationHrefSchema,Ie as SitemapNodeIdSchema,Ml as SitemapRecordSchema,iL as SitemapResolverModelOutputSchema,sL as SitemapResolverRequestSchema,aL as SitemapResolverResponseSchema,tE as SitemapResolverTargetsSchema,vl as SitemapRunInputSchema,$t as SitemapSchema,Qx as SitemapSourceProvenanceSchema,gL as SitemapStreamEventSchema,RD as SitemapTaskCreateRequestSchema,PD as SitemapTaskCreateResponseSchema,yb as SitemapTaskFailureErrorCodeSchema,wD as SitemapTaskResponseSchema,iE as SitemapUpdateBlockInstructionInputSchema,mL as SitemapUpdateBlockPropsInputSchema,wx as SitemapUserChoiceSchema,Vt as SkillSelectionSchema,vx as SkillSelectionSourceSchema,zl as SnapshotContentHashSchema,Re as SnapshotFilePathSchema,k as SnapshotIdSchema,ct as SnapshotRecordSchema,bl as SnapshotStatusSchema,_0 as StartFillInRequestSchema,uN as StartFillInResponseSchema,ka as StartGscAuthDataSchema,qm as StartGscAuthRequestSchema,Fm as StartGscAuthResponseSchema,A1 as StartSiteBuildRequestSchema,Jw as StartSiteBuildResponseSchema,bS as StartSiteBuildResultSchema,gO as StartSitePublishWorkflowRequestSchema,UL as StartWorkspaceRunRequestSchema,qL as StartWorkspaceRunResponseSchema,Qr as Step2AiCrawlabilityAssessmentSchema,mg as Step2FinalResultDataSourceSchema,cs as Step2FinalResultRequestSchema,dA as Step2FinalResultResponseSchema,pA as Step2FinalResultSaveResponseSchema,cg as Step2FinalResultSaveResultSchema,Ni as Step2FinalResultTypeSchema,pg as Step2FinalResultViewSchema,Xr as Step2FinalScanCardKeySchema,Li as Step2FinalScanCardSchema,rg as Step2FinalScanResultSchema,xn as Step2KnowledgeOpaqueIdSchema,oC as Step2KnowledgeScopeSchema,dt as Step2PageRoleSchema,gA as Step2PageSelectionRequestSchema,hA as Step2PageSelectionResponseSchema,ig as Step2SiteInitializationCrawlerErrorCodeSchema,sg as Step2SiteInitializationStatusSchema,lA as Step2SiteInitializationTaskResponseSchema,ag as Step2SiteInitializationTaskSchema,Mi as Step3AgentAnalysisSchema,fg as Step3AnalysisFindingSchema,RA as Step3AnalysisJobResponseSchema,tc as Step3AnalysisJobSchema,Jr as Step3AnalysisJobStatusSchema,IA as Step3AnalysisLatestResponseSchema,Zr as Step3AnalysisProgressSchema,xg as Step3AnalysisResultSchema,EA as Step3AnalysisScheduleResponseSchema,Sg as Step3AnalysisScheduleSchema,TA as Step3AnalysisSseFrameSchema,yA as Step3AnalysisStartRequestSchema,ec as Step3AnalysisSummarySchema,hg as Step3AnalystSchema,xA as Step3AnalystsResponseSchema,wA as Step4DiagnosisResponseSchema,ii as Step5ActiveStrategyKeySchema,uT as Step5CommitStrategyRequestSchema,_T as Step5CommitStrategyResponseSchema,vd as Step5CommittedVersionSchema,Ad as Step5DecisionCustomPayloadInputSchema,kd as Step5DecisionCustomPayloadSchema,rn as Step5DecisionSelectionIdSchema,ed as Step5EvidenceReferenceSchema,gd as Step5GenerationStatusSchema,Po as Step5GeoQuestionSchema,wd as Step5JobStatusSchema,Yp as Step5KeywordCategorySchema,sn as Step5KeywordEntrySchema,ti as Step5KeywordLibrarySchema,XI as Step5KeywordSearchBodySchema,Hn as Step5KeywordSelectionSchema,Td as Step5LegacyDecisionCustomPayloadInputSchema,Id as Step5LegacyDecisionCustomPayloadSchema,xd as Step5LegacySeoKeywordInputSchema,vo as Step5LegacySeoKeywordSchema,Zn as Step5MarketCountrySchema,Qn as Step5MarketTypeSchema,yo as Step5OptionPresentationSchema,si as Step5OutputLocaleSchema,lT as Step5RegenerateItemRequestSchema,pT as Step5SaveDecisionRequestSchema,dT as Step5SaveDecisionResponseSchema,rd as Step5SemrushEmptyReasonCodeSchema,od as Step5SemrushIntentGroupSchema,pd as Step5SemrushKeywordCandidateSchema,dd as Step5SemrushKeywordCandidateSearchDataSchema,sT as Step5SemrushKeywordCandidateSearchRequestSchema,iT as Step5SemrushKeywordCandidateSearchResponseSchema,ad as Step5SemrushKeywordRecommendationSchema,_d as Step5SemrushKeywordSelectionDataSchema,ud as Step5SemrushKeywordSelectionItemSchema,aT as Step5SemrushKeywordSelectionRequestSchema,oT as Step5SemrushKeywordSelectionResponseSchema,id as Step5SemrushRecommendationSeedSchema,md as Step5SemrushRecommendationSnapshotSchema,td as Step5SemrushRecommendationStatusSchema,To as Step5SemrushSearchIntentSchema,cd as Step5SemrushSelectionSummarySchema,Ed as Step5SemrushSnapshotRefSchema,Co as Step5SeoGeoPlanRowSchema,Jn as Step5SeoKeywordSchema,Rd as Step5SeoPayloadV2InputSchema,oi as Step5SeoPayloadV2Schema,lE as Step5SitemapDecisionSchema,dE as Step5SitemapRunInputSchema,pE as Step5SitemapSourceSchema,uL as Step5SitemapStartRequestSchema,cT as Step5StartStrategyRequestSchema,mT as Step5StartStrategyResponseSchema,Pd as Step5StrategyDecisionInputSchema,ri as Step5StrategyDecisionSchema,ai as Step5StrategyItemSchema,Do as Step5StrategyJobSchema,Xn as Step5StrategyKeySchema,Io as Step5StrategyOptionIdSchema,Qp as Step5StrategyOptionSchema,Zp as Step5StrategyPlanSchema,Dd as Step5StrategySnapshotDataSchema,hT as Step5StrategySseFrameSchema,Cd as Step5StrategyVersionSnapshotSchema,Jp as Step5StructureDetailSchema,FS as Step6AiThemeCandidateSchema,ys as Step6ColorSeedsSchema,YC as Step6DesignAgentRecommendationsResponseSchema,KC as Step6DesignRecommendationGenerationInputSchema,sa as Step6DesignRecommendationModelOutputSchema,GS as Step6DesignRecommendationSchema,UC as Step6DesignRecommendationsRequestSchema,qC as Step6DesignRecommendationsResponseSchema,Gc as Step6DesignSelectionSchema,Fc as Step6GeneratedThemeCardSchema,zS as Step6GptDesignRecommendationModelOutputSchema,p0 as StopWorkspaceGenerationRequestSchema,d0 as StopWorkspaceGenerationResponseSchema,sw as SubsiteGlossariesSchema,zh as SubsiteGlossaryEntrySchema,hs as SubsiteHexColorSchema,yw as SubsiteMountPathSchema,aw as SubsitePaletteLocalizationSchema,Bh as SubsitePaletteModeSchema,Hh as SubsitePaletteSeedsSchema,iw as SubsiteSiteInfoSchema,lw as SubsiteSyncDiffComputeRequestSchema,pw as SubsiteSyncDiffComputeResponseSchema,Xh as SubsiteSyncDiffErrorCodeSchema,dw as SubsiteSyncDiffErrorResponseSchema,hw as SubsiteVisibleTextExportRequestSchema,Sw as SubsiteVisibleTextExportResponseSchema,x_ as TASK_EXECUTION_STATUSES,Gr as TASK_EXECUTION_STATUS_CODES,CN as TEMPLATE_UPGRADE_LOCK_LOST_ERROR_CODE,ta as THEME_PRESETS,jc as THEME_PRESET_IDS,Mr as TaskExecutionStatusSchema,cS as TemplateUpgradeCasOutcomeSchema,Sc as TemplateUpgradeErrorCodeSchema,mS as TemplateUpgradeOutcomeCountsSchema,oS as TemplateUpgradeOutcomeSchema,lS as TemplateUpgradeSnapshotDeletionCandidateSchema,Gt as TemplateUpgradeStateSchema,nS as TemplateUpgradeStatusSchema,rS as TemplateUpgradeValidationStageSchema,We as TemplateVersionSchema,kN as TryAcquireTemplateUpgradeLockRequestSchema,AN as TryAcquireTemplateUpgradeLockResponseSchema,Lh as USER_STOPPED_RUN_ERROR_CODES,rl as UnsplashDownloadLocationSchema,ol as UnsplashMediaAssetSchema,Qj as UpdateBriefRequestSchema,pN as UpdateBriefResponseSchema,IL as UpdateClarifyArchetypeRequestSchema,bN as UpdateCurrentSnapshotManifestRequestSchema,WT as UpdatePageDirectoryReconcileStateRequestSchema,hO as UpdateSitePublishWorkflowStepRequestSchema,Xj as UpdateSiteRequestSchema,HL as UpdateSiteThreadRequestSchema,y1 as UpdateSiteWorkflowWebsiteRequestSchema,FC as UpdateStep6DesignSelectionRequestSchema,GC as UpdateStep6DesignSelectionResponseSchema,I1 as UpdateWorkflowTaskStatusRequestSchema,Xy as UploadMediaLibraryAssetResponseSchema,sO as UpstreamPromptTemplateCatalogDataSchema,nO as UpstreamPromptTemplateConsumeDataSchema,mb as UrlListCrawlerTaskCreateRequestSchema,bR as UsageRecordIdSchema,ix as UseUnsplashMediaRequestSchema,ax as UseUnsplashMediaResponseSchema,cR as UserIdSchema,Ty as VCP_GSC_STATES,Ta as VcpGscStateSchema,ny as VcpQualityRemediationItemSchema,jm as VcpQualityResultSchema,va as VisualHintsSchema,Px as VisualThemeSchema,h1 as WORKFLOW_DEFINITIONS_V1,Pi as WORKFLOW_DEFINITION_REGISTRY,f_ as WORKFLOW_FLOW_TYPES,k_ as WORKFLOW_MENU_STATES,b_ as WORKFLOW_NODE_CODES,y_ as WORKFLOW_TASK_TYPES,H1 as WORKSPACE_ATTACHMENT_BOUND_ERROR_CODE,J1 as WORKSPACE_ATTACHMENT_CAPTURE_BUDGET_ERROR_CODE,Q1 as WORKSPACE_ATTACHMENT_CAPTURE_BUSY_ERROR_CODE,X1 as WORKSPACE_ATTACHMENT_CAPTURE_FAILED_ERROR_CODE,Z1 as WORKSPACE_ATTACHMENT_CAPTURE_TIMEOUT_ERROR_CODE,eA as WORKSPACE_ATTACHMENT_CAPTURE_UNAVAILABLE_ERROR_CODE,B1 as WORKSPACE_ATTACHMENT_LIMIT_ERROR_CODE,Q_ as WORKSPACE_ATTACHMENT_MEDIA_TYPES,K1 as WORKSPACE_ATTACHMENT_TARGET_BASE64_BYTES,z1 as WORKSPACE_ATTACHMENT_TOO_LARGE_ERROR_CODE,G1 as WORKSPACE_ATTACHMENT_UNBOUND_TTL_MS,W1 as WORKSPACE_ATTACHMENT_UNSUPPORTED_FORMAT_ERROR_CODE,Y1 as WORKSPACE_ATTACHMENT_URL_REJECTED_ERROR_CODE,QA as WORKSPACE_CHECK_INCOMPLETE_ERROR_CODE,JA as WORKSPACE_FILL_IN_INTERRUPTED_ERROR_CODE,ZA as WORKSPACE_GENERATION_STOPPED_ERROR_CODE,YA as WORKSPACE_MAX_PAGE_ATTEMPTS,$A as WORKSPACE_MAX_RESUME_COUNT,VA as WORKSPACE_RUN_HEARTBEAT_INTERVAL_MS,HA as WORKSPACE_RUN_LEASE_MS,e0 as WORKSPACE_RUN_LEASE_SUPERSEDED_ERROR_CODE,t0 as WORKSPACE_RUN_NOT_ACTIVE_ERROR_CODE,XA as WORKSPACE_RUN_RESUME_EXHAUSTED_ERROR_CODE,$1 as WORKSPACE_URL_CAPTURE_WINDOW_MS,ZL as WORKSPACE_WEBSOCKET_CONTRACT,Nr as WorkflowClientCapabilitiesSchema,Kr as WorkflowDefinitionVersionSchema,is as WorkflowFlowTypeSchema,D_ as WorkflowMenuItemSchema,A_ as WorkflowMenuStateSchema,gn as WorkflowNodeCodeSchema,Lr as WorkflowTaskTypeSchema,nA as WorkspaceAttachmentFromUrlRequestSchema,Oi as WorkspaceAttachmentMediaTypeSchema,tA as WorkspaceAttachmentSchema,KE as WorkspaceClientMessageSchema,mx as WorkspaceDesignApplyRequestSchema,lx as WorkspaceDesignApplyResponseSchema,Wa as WorkspaceDiagnosticSchema,QE as WorkspaceDirectEditFileSchema,XE as WorkspaceDirectEditPathSchema,$l as WorkspaceDirectEditPostActionSchema,tM as WorkspaceDirectEditRequestSchema,sM as WorkspaceDirectEditResponseSchema,za as WorkspaceExecutionDiagnosticsSchema,AL as WorkspaceExecutionPlanSchema,mo as WorkspaceGenerationLedgerEventSchema,tn as WorkspaceGenerationLedgerSchema,YE as WorkspaceMediaRequestSchema,mp as WorkspaceOmissionKindSchema,lp as WorkspaceOmissionReasonSchema,co as WorkspaceOmissionSchema,nc as WorkspacePageCheckpointSchema,dp as WorkspacePageOutcomeSchema,pp as WorkspacePageResultSchema,Va as WorkspacePlanDependencySchema,Fl as WorkspacePlanSummarySchema,TE as WorkspacePlanTaskKindSchema,Ha as WorkspacePlanTaskSchema,u_ as WorkspaceResourceKindSchema,g_ as WorkspaceResourceNavigationSelectionSchema,jr as WorkspaceResourceOperationClientMessageSchema,__ as WorkspaceResourceOperationSummarySchema,h_ as WorkspaceResourceOperationTransientInputSchema,m0 as WorkspaceRunControlInputResponseSchema,a0 as WorkspaceRunHeartbeatRequestSchema,o0 as WorkspaceRunHeartbeatResponseSchema,zs as WorkspaceRunKindSchema,Ug as WorkspaceRunResumePrincipalSchema,GE as WorkspaceSelectedComponentSchema,zE as WorkspaceServerMessageSchema,pL as WorkspaceSitemapEditRequestSchema,FE as WorkspaceSocketDescriptorSchema,sR as WorkspaceSourceFileBinaryResponseSchema,tR as WorkspaceSourceFileKindSchema,Xl as WorkspaceSourceFileListItemSchema,iM as WorkspaceSourceFilePathQuerySchema,aM as WorkspaceSourceFileResponseSchema,nR as WorkspaceSourceFileTextResponseSchema,Yl as WorkspaceSourcePathSchema,bE as WorkspaceSuggestionSchema,Ul as WorkspaceSuggestionsSchema,yE as WorkspaceSuggestionsSourceSchema,Gl as WorkspaceTaskCountsSchema,QL as WorkspaceWebSocketMessageSchema,XL as WorkspaceWebSocketMessageTypeSchema,Ba as WorkspaceWorkerGroupSchema,Ka as WorkspaceWorkerPhaseSchema,PL as WorkspaceWorkerResultSchema,vt as WorkspaceWorkerStatusSchema,gv as applicationTemplateCatalogDataSchema,_v as applicationTemplateConsumeDataSchema,uv as applicationTemplateV1Schema,MA as assertDeploymentTransition,ij as assertFillInTargetsOmitted,D1 as assertSiteBuildStatusTransition,v1 as assertTaskExecutionStatusTransition,nj as buildE2bBrowserPreviewUrl,EO as buildFinalSitePublishQualityResult,WC as buildStep6FallbackThemeCards,fa as canonicalizeFormDesignJson,iO as canonicalizeLauncherPromptTemplateOperation,pr as canonicalizePageSlug,xi as classifySiteEditPropertyName,jT as cmsPagePreviewUrlPath,bT as compareTemplateVersions,mP as composeSiteEditRepeatInstanceKey,Zv as computeFormDesignOperationFingerprint,Xs as computeSiteEditCompositionKey,Du as computeSiteEditSourceIdentityKey,Nn as containsSensitiveData,aI as countLedgerAccessiblePages,oI as countLedgerProcessedPages,qy as countSitemapStructure,xu as createSiteEditCommandFailureSchema,dr as createSiteEditCommandResultSchema,bi as createSiteEditCommandSuccessSchema,BC as defaultStep6Selection,Py as deriveVcpGscState,wy as doesGscPropertyMatchDomain,Wy as estimateNavLabelWidth,U_ as findWorkflowDefinition,M_ as findWorkflowDefinitionInRegistry,Xi as fontStack,$f as formDesignOperationFingerprintInput,UA as getDeploymentHappyPathTransitions,NA as getDeploymentTransitionPredecessors,jA as getDeploymentTransitionTargets,Cc as getFontPairing,Oc as getMotionPreset,Mc as getSiteDesignThemeRadius,Js as getSiteEditSourceDeleteProtectionReason,py as getSitePublishRepairItems,AC as getThemePreset,q_ as getWorkflowDefinition,w1 as getWorkflowNodeIndex,BR as hasAnyBusinessFact,rw as hasLockedSeeds,Qv as hashAffectedFormDesignFiles,Xv as hashCmsFormSchemaProjection,Ps as hashFormDesignJson,Yv as hashFormSpec,jy as homeLabelForLocale,mr as isCanonicalPageSlug,_S as isCmsMainProductsWithinLimit,OT as isCmsPageSelectable,Ko as isCmsTemplateUrlPath,hI as isConsentGranted,Mg as isDeploymentActiveStatus,LA as isDeploymentTerminalStatus,qh as isExactEditEngineVersion,kR as isExternalSiteEditInfrastructureReason,jv as isFormSpecLocalizableFieldPath,gT as isKnownStep5SseEventName,P0 as isMigrationProductsPresetBlockLabel,A0 as isMigrationProductsPresetPageTitle,BI as isNonLatinSiteLocale,Un as isPageTemplateCandidateEntryPath,pD as isPlatformMaterializedFile,tS as isReservedSubsiteMountSegment,Op as isSiteEditDesignDocumentPath,qd as isSiteEditMaterializationPathTemplate,Oh as isSiteEditRuntimeContainerTag,jh as isSiteEditRuntimeTextTag,MP as isSiteEditRuntimeVoidElementTag,qI as isSiteEditSourceDeleteProtectedPath,Dp as isSiteEditSourceDirectoryPath,_o as isSiteEditSourcePath,Zs as isSiteEditTextSourcePath,dy as isSitePublishRepairResultSuccessful,oD as isSiteStructureKnownFieldPath,aD as isSiteStructureLocalizableFieldPath,tT as isStep5RequiredStrategyKey,ko as isStep5SeoAllowedIntentCode,Ms as isTopLevelPage,HP as isUserStoppedRunErrorCode,C1 as isWorkflowTaskTypeForNode,Hm as listChildPages,lh as makeSiteEditRepeatInstanceKey,Ly as markAllPagesInHeader,k0 as migrationProductsCopyForLocale,Ny as moreLabelForLocale,zy as navLabelCollisionKey,Rv as normalizeCmsApplicationSlug,SD as normalizeCmsPublicApiBase,nm as normalizeFormOptionLabelIdentity,On as normalizeGscDomain,so as normalizePageTemplatePagePath,Oo as normalizeStep5SeoKeyword,Ls as normalizeStructureTitle,Uy as orderNavigationLinksByStructure,Vm as orderSitemapPagesForDisplay,bu as pageSlugToRouteFilePath,NT as parseCmsPageDirectory,f0 as parseComponentI18nResourcesJson,Cy as parseE2bPreviewProxyDomain,Fh as parseExactEditEngineVersion,AI as parseSiteEditCompositionKey,ph as parseSiteEditRepeatInstanceKey,Ck as parseSiteEditSourceIdentityKey,ji as parseWorkspaceAttachmentImagePath,Fv as projectFormSpecToCmsSchema,iA as readWorkspaceAttachmentReferences,vy as reconcileSitemapNavigation,kS as resolveFont,PS as resolveFontDisplayName,qv as resolveFormTemplateText,P1 as resolvePublishedWorkflowDefinition,nI as resolveRedisConnectionConfig,JP as resolveRequestedEditEngineVersion,fo as resolveSelectableSiteLocale,UP as resolveSiteEditRuntimeOperationSummary,zI as resolveSiteLocaleFromIso6393,WI as resolveSiteTextDirection,KS as resolveStep6RadiusId,ew as resolveSystemCurrentEditEngineVersion,F_ as selectPublishedWorkflowDefinition,RI as selectReferenceVisualImage,c1 as siteBuildStatusFromCode,d1 as siteBuildStatusToCode,m1 as siteDeploymentStatusFromCode,u1 as siteDeploymentStatusToCode,jS as siteFontVariables,l1 as siteWorkflowStatusFromCode,_1 as siteWorkflowStatusToCode,Wh as splitSubsiteGlossaryEntry,WS as step6GptVisualIdentity,lP as stripSiteEditRepeatInstanceKeys,p1 as taskExecutionStatusFromCode,g1 as taskExecutionStatusToCode,zC as toStep6GenerationVisualHints,lr as tryCanonicalizeAsciiPageSlug,oc as validateComponentI18nResources,Nv as validateFormSpecIdentityTransition,Fy as validateSitemapStructure,sA as workspaceAttachmentImagePath};
|
|
1
|
+
import{z as t}from"zod";import{z as ie}from"zod";import{z as Z}from"zod";import{z as Jl}from"zod";var V=Jl.uuidv7(),cR=V,mR=V,lR=V,pR=V,dR=V,uR=V,_R=V,T=V,Dt=V,$a=V,Ae=V,Bs=V,k=V,Ya=V,K=V,Xa=V,He=V,Ln=V,Je=V,gR=V,hR=V,Qa=V,Ve=V,Za=V,SR=V,fR=V,bR=V,xt=V,yR=V,xR=V,ER=V;var Ja=V,Hs=Z.enum(["external_site_edit","page_template_create"]),ep=200,Et=Z.string().min(1).max(ep),tp=4e3,eo=Z.enum(["succeeded","degraded","no_changes","failed"]),Qt=Z.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"]),np=["sandbox_unavailable"];function kR(e){return e!=null&&np.includes(e)}var sp=Z.enum(["pending","delivered","failed"]),ip=Z.enum(["running","succeeded","degraded","no_changes","failed"]),AR=Z.object({site_id:T,external_run_id:Et,external_thread_id:Et,prompt:Z.string().min(1).max(tp),thread_title:Z.string().trim().min(1).max(200).optional()}).strict(),Mn=Z.object({id:Ja,execution_scene:Hs.default("external_site_edit"),site_id:T,external_run_id:Z.string().min(1).nullable(),external_thread_id:Z.string().min(1).nullable(),status:ip,outcome:eo.nullable(),degraded_reason:Qt.nullable(),vcp_run_id:K.nullable(),vcp_thread_id:He.nullable(),base_snapshot_id:k,snapshot_id:k.nullable(),preview_url:Z.string().url().nullable(),summary:Z.string().nullable(),error_code:Z.string().nullable(),build_verified:Z.boolean().nullable(),callback_status:sp.nullable(),created_at:Z.string().min(1),started_at:Z.string().min(1).nullable(),finished_at:Z.string().min(1).nullable()}).strict().superRefine((e,n)=>{e.execution_scene==="page_template_create"?((e.external_run_id===null!=(e.external_thread_id===null)||e.callback_status!==null)&&n.addIssue({code:"custom",message:"Page Template tasks require paired external identities and no callback"}),(!["running","succeeded","failed"].includes(e.status)||e.outcome!==null&&!["succeeded","failed"].includes(e.outcome)||e.degraded_reason!==null)&&n.addIssue({code:"custom",message:"Page Template tasks require strict whole-batch outcomes"})):(!e.external_run_id||!e.external_thread_id||!e.callback_status)&&n.addIssue({code:"custom",message:"External edit tasks require external identity and callback status"})}),PR=Z.object({task:Mn}).strict(),wR=Z.object({task:Mn}).strict(),CR=Z.object({task_id:Ja,external_run_id:Z.string().min(1),external_thread_id:Z.string().min(1),site_id:T,vcp_run_id:K.nullable(),outcome:eo,degraded_reason:Qt.nullable(),snapshot_id:k.nullable(),preview_url:Z.string().url().nullable(),summary:Z.string().nullable(),error_code:Z.string().nullable(),build_verified:Z.boolean().nullable(),retryable:Z.boolean(),finished_at:Z.string().min(1)}).strict(),vR=Z.object({received:Z.literal(!0)}).strict();var Ge=ie.string().min(1).max(191).refine(e=>{if(/[^\x20-\x7e\xa0-\xff]/.test(e)||e.startsWith(" ")||e.endsWith(" ")||new TextEncoder().encode(e).length>191)return!1;try{return new Headers({"x-template-id":e}).get("x-template-id")===e}catch{return!1}},{message:"template_id must round-trip through HTTP headers and fit a 255-byte base64url filename"}),Zt=ie.string().min(1).refine(e=>e.startsWith("/")&&!e.startsWith("//")&&!/[?#\\\x00-\x20\x7f]/.test(e)&&!e.startsWith("/.vcp")&&!e.split("/").some(n=>{try{let s=decodeURIComponent(n);return s==="."||s===".."||/[/\\\x00-\x1f\x7f]/.test(s)||s.startsWith(".vcp")}catch{return!0}}),{message:"page_path must start with / and must not contain ? or #"});function Un(e){let n=/^(?:src\/)?app\/\.vcp\/page-templates\/(.+)\/page\.tsx$/.exec(e);if(!n)return!1;let s=n[1].split("/"),a=s.pop();if(!/^[A-Za-z0-9_-]{1,255}$/.test(a)||!Zt.safeParse(`/${s.join("/")}`).success||s.some(i=>!i||/[\[\]()%]/.test(i)||i.startsWith("_")||i.startsWith("@")))return!1;try{let i=atob(a.replace(/-/g,"+").replace(/_/g,"/")),r=Uint8Array.from(i,c=>c.charCodeAt(0)),m=new TextDecoder("utf-8",{fatal:!0}).decode(r);return Ge.safeParse(m).success&&btoa(String.fromCharCode(...new TextEncoder().encode(m))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")===a}catch{return!1}}var to=ie.object({page_path:Zt,template_id:Ge,instruction:ie.string().min(1).refine(e=>e.trim().length>0)}).strict(),no=3;function so(e){return e.replace(/\/+$/,"")||"/"}var LR=ie.object({external_run_id:Et,external_thread_id:Et,items:ie.array(to).min(1).max(no)}).strict().transform(e=>({external_run_id:e.external_run_id,external_thread_id:e.external_thread_id,items:e.items.map(n=>({...n,page_path:so(n.page_path)}))})).superRefine((e,n)=>{let s=new Set;e.items.forEach((a,i)=>{let r=JSON.stringify([a.page_path,a.template_id]);s.has(r)&&n.addIssue({code:"custom",path:["items",i],message:"Duplicate normalized page_path/template_id identity"}),s.add(r)})}),io=ie.object({items:ie.array(to).min(1).max(no)}).strict().refine(e=>e.items.every(n=>n.page_path===so(n.page_path))&&new Set(e.items.map(n=>JSON.stringify([n.page_path,n.template_id]))).size===e.items.length,{message:"Batch Manifest must contain unique normalized identities"}),ao=e=>[...new Set(e)],MR=ie.object({page_path:Zt,template_id:Ge,exit_template_ids:ie.array(Ge).default([]).transform(ao)}).strict().refine(e=>!e.exit_template_ids.includes(e.template_id),{path:["exit_template_ids"],message:"exit_template_ids must not contain the promoted template"}),UR=ie.object({page_path:Zt,template_ids:ie.array(Ge).min(1).transform(ao)}).strict(),oo={ok:ie.literal(!0),site_id:T,page_path:Zt,route_id:ie.string().min(1),snapshot_id:k},ap=Mn.safeExtend({execution_scene:ie.literal("page_template_create"),external_run_id:Et,external_thread_id:Et,callback_status:ie.null(),status:ie.enum(["running","succeeded","failed"]),outcome:ie.enum(["succeeded","failed"]).nullable(),degraded_reason:ie.null()}),qR=ie.object({task:ap}).strict(),FR=ie.object({...oo,promoted_template_id:Ge,deleted_template_ids:ie.array(Ge),status:ie.literal("promoted")}).strict(),GR=ie.object({...oo,deleted_template_ids:ie.array(Ge),status:ie.literal("cleaned")}).strict(),KR=ie.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_SNAPSHOT_CONFLICT","PAGE_TEMPLATE_DYNAMIC_ROUTE_UNSUPPORTED","PAGE_TEMPLATE_SOURCE_UNSUPPORTED","PAGE_TEMPLATE_GENERATION_FAILED","PAGE_TEMPLATE_PATCH_FAILED"]);import{z as qn}from"zod";var ro=qn.object({primary_products:qn.string().trim().min(1).max(1e3).optional(),current_markets:qn.string().trim().min(1).max(1e3).optional(),qualifications:qn.string().trim().min(1).max(1e3).optional()}).strict();function BR(e){return Object.values(e).some(n=>typeof n=="string"&&n.trim().length>0)}import{z as Jt}from"zod";import{z as Vs}from"zod";var M=e=>Vs.object({code:Vs.number().int(),data:e,message:Vs.string()});var Ot=2e3,op=Jt.object({note:Jt.string().trim().max(Ot),updated_at:Jt.string().min(1)}).strict(),QR=Jt.object({note:Jt.string().trim().max(Ot)}).strict(),ZR=M(op.nullable());import{z as en}from"zod";var rp=40,Rt=en.object({protocol:en.enum(["phone","form","download","route","external"]),ctaLabel:en.string().min(1).max(rp),ctaTarget:en.string().min(1).max(200).optional(),requiresOwnerDetail:en.boolean().optional()});var jt=["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 nI(e){let n=e.VCP_REDIS_URL??e.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:e.VCP_REDIS_HOST??"127.0.0.1",port:cp(e.VCP_REDIS_PORT,56379)}}function cp(e,n){if(!e)return n;let s=Number(e);return Number.isInteger(s)&&s>0?s:n}import{z as te}from"zod";var mp=te.enum(["component","page","shared"]),lp=te.enum(["generation_failed","repair_exhausted","page_unusable","check_incomplete","design_missing","chrome_fallback","style_fallback","resume_exhausted","user_stopped","conflict"]),co=te.object({kind:mp,target_id:te.string().min(1),page_id:te.string().min(1).nullable(),reason:lp,repair_attempts:te.number().int().nonnegative(),message:te.string().min(1),filled:te.boolean().optional()}).strict(),pp=te.enum(["complete","partial","omitted","check_incomplete","pending"]),dp=te.object({page_id:te.string().min(1),slug:te.string().min(1),title:te.string().min(1),parent_page_id:te.string().min(1).nullable(),result:pp,attempts:te.number().int().nonnegative(),omissions:te.array(co)}).strict(),tn=te.object({schema_version:te.literal(1),sitemap_id:te.string().min(1),confirmed_page_ids:te.array(te.string().min(1)).min(1),pages:te.array(dp),shared:te.array(co),stopped_by_user:te.boolean(),resume_count:te.number().int().nonnegative(),home_replaced_by:te.string().min(1).nullable(),updated_at:te.string().min(1)}).strict(),mo=te.object({type:te.literal("workspace.generation_ledger"),ledger:tn,at:te.string().min(1)}).strict();function aI(e){return e.pages.filter(n=>n.result==="complete"||n.result==="partial").length}function oI(e){return e.pages.filter(n=>n.result==="complete"||n.result==="partial"||n.omissions.some(s=>s.kind==="page")).length}import{z as j}from"zod";var $s=j.enum(["text","url","document","image"]),Ys=j.enum(["pending","ready","failed"]),up=j.enum(["pending","ready","failed"]),_p=j.enum(["product","price","contact","copy","audience","other"]),Fn=j.object({fact:j.string().min(1).max(300),kind:_p,source_id:xt,quote:j.string().min(1).max(500),trust:j.enum(["verbatim","ocr"]).default("verbatim")}),gp=j.object({page_type:j.string().min(1).max(40),sections:j.array(j.string().min(1).max(40)).max(12)}),Gn=j.object({source_id:xt,nav_structure:j.array(j.string().min(1).max(30)).max(12),page_patterns:j.array(gp).max(10),tone:j.array(j.string().min(1).max(20)).max(8),screenshot_ref:j.string().optional()}),hp=j.object({source_id:xt,type:$s,status:Ys,title:j.string().max(120).optional(),original_ref:j.string().min(1),source_metadata:j.record(j.string(),j.unknown()),error_code:j.string().optional(),submitted:j.boolean().optional()}),Kn=j.object({topic:j.string().min(1).max(80),variants:j.array(j.object({value:j.string().min(1).max(300),source_id:xt})).min(2)}),Sp=j.object({type:j.literal("text"),content:j.string().min(20).max(1e4),title:j.string().min(1).max(120).optional()}).strict(),fp=j.object({type:j.literal("url"),url:j.string().url().max(2048),rights_ack:j.boolean().optional(),title:j.string().min(1).max(120).optional()}).strict(),lI=j.discriminatedUnion("type",[Sp,fp]),pI=[".docx",".html",".md",".txt"],dI=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],uI=10*1024*1024,_I=2,gI=j.object({consent_cross_border:j.union([j.literal(!0),j.literal("true")]),consent_text_version:j.string().min(1).max(120),title:j.string().min(1).max(120).optional()}).strict();function hI(e){return e===!0||e==="true"}var SI=[".png",".jpg",".jpeg",".webp"],fI=["image/png","image/jpeg","image/webp","application/octet-stream"],bI=8*1024*1024,yI=10,bp=j.enum(["asset","reference"]),xI=j.object({image_role:bp,title:j.string().min(1).max(120).optional()}).strict(),EI=j.object({version:j.literal(1),site_id:T,tenant_id:j.string().min(1),user_prompt:j.string(),status:up,sources:j.array(hp).max(16),facts:j.array(Fn).max(120),reference:Gn.optional(),conflicts:j.array(Kn).max(20)}).superRefine((e,n)=>{let s=new Map(e.sources.map(a=>[a.source_id,a]));for(let[a,i]of e.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(e.reference){let a=s.get(e.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 RI(e){for(let n of e.sources)if(n.type==="image"&&n.status==="ready"&&n.source_metadata?.image_role==="reference")return{source_id:n.source_id};return e.reference?.screenshot_ref?{source_id:e.reference.source_id}:null}import{z as D}from"zod";import{z as Wn}from"zod";var ce=Wn.object({routeId:Wn.string().min(1),templateId:Ge.optional()}).strict(),q=Wn.object({routeId:Wn.string().min(1),effectiveTemplateId:Ge.optional()}).strict();function Xs(e){return JSON.stringify([e.routeId,e.effectiveTemplateId??null])}function AI(e){let n;try{n=JSON.parse(e)}catch{return null}if(!Array.isArray(n)||n.length!==2)return null;let[s,a]=n,i=q.safeParse(a===null?{routeId:s}:{routeId:s,effectiveTemplateId:a});return i.success?i.data:null}var yp=["design.md","DESIGN.md"],lo=["components/site","src/components/site","lib/generated","src/lib/generated","public"],xp=["app/globals.css","src/app/globals.css"],Ep=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],Rp=new Set(Ep),Qs="source-delete",po=D.literal(Qs),Se=D.string().min(1).refine(_o,"Invalid site edit source path"),Ip=D.string().min(1).refine(Dp,"Invalid site edit source directory path"),DI=D.enum(["text","binary"]),zn=D.object({composition:q,path:Se,language:D.string().min(1).nullable(),sizeBytes:D.number().int().nonnegative(),contentHash:D.string().min(1).optional()}).strict(),Tp=D.discriminatedUnion("kind",[zn.extend({kind:D.literal("text"),language:D.string().min(1),readonly:D.boolean().default(!1)}),zn.extend({kind:D.literal("binary"),language:D.null(),mimeType:D.string().min(1).optional(),readonly:D.literal(!0)})]),uo=D.lazy(()=>D.discriminatedUnion("kind",[D.object({kind:D.literal("directory"),name:D.string().min(1),path:Ip,children:D.array(uo)}),D.object({kind:D.literal("file"),name:D.string().min(1),path:Se,file:Tp}).superRefine((e,n)=>{e.path!==e.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),kp=D.enum(["max-files","max-depth","max-total-bytes"]),Ap=D.object({reasons:D.array(kp).min(1),maxFiles:D.number().int().positive(),maxDepth:D.number().int().positive(),maxTotalBytes:D.number().int().positive()}),OI=D.object({composition:q,nodes:D.array(uo),defaultPath:Se.optional(),totalFiles:D.number().int().nonnegative(),truncated:Ap.optional()}).strict(),jI=D.object({composition:ce}).strict(),NI=D.object({path:Se,composition:ce}).strict(),Pp=zn.extend({kind:D.literal("text"),language:D.string().min(1),readonly:D.boolean().default(!1),content:D.string()}),wp=D.enum(["too-large","unsupported-mime","bytes-unavailable"]),Cp=zn.extend({kind:D.literal("binary"),language:D.null(),readonly:D.literal(!0),mimeType:D.string().min(1),contentBase64:D.string().min(1).optional(),previewUnavailableReason:wp.optional()}),LI=D.discriminatedUnion("kind",[Pp,Cp]),MI=D.object({key:D.string().min(1),composition:ce}).strict(),vp=D.object({startLine:D.number().int().positive(),startColumn:D.number().int().nonnegative(),endLine:D.number().int().positive(),endColumn:D.number().int().nonnegative()}),UI=D.object({key:D.string().min(1),composition:q,sourceFile:Se,componentName:D.string().min(1),openingElementRange:vp,structuralPath:D.string().min(1),textPreview:D.string().min(1).optional()}).strict();function _o(e){return!Bn(e)&&!jp(e)||So(e)?!1:ei(e)||ho(e)||go(e)||lo.some(n=>e===n||e.startsWith(`${n}/`))}function Zs(e){return ei(e)||Rp.has(Lp(e))}function Dp(e){return!Bn(e)&&!Np(e)||So(e)?!1:e==="app"||e.startsWith("app/")||e==="src"||e==="src/app"||e.startsWith("src/app/")||lo.some(n=>e===n||e.startsWith(`${n}/`)||n.startsWith(`${e}/`))}function Op(e){return ei(e)}function Js(e){return _o(e)?Op(e)?"design-document":go(e)?"route-entry":ho(e)?"app-global-style":e.toLowerCase()==="lib/generated/media-assets.ts"||e.toLowerCase()==="src/lib/generated/media-assets.ts"?"generated-media-manifest":null:null}function qI(e){return Js(e)!==null}function go(e){return/^(?:src\/)?app\/(?:.*\/)?page\.[cm]?[jt]sx?$/.test(e.toLowerCase())}function jp(e){return Un(e)&&Bn(e.replace("/.vcp/","/_vcp/"))}function Np(e){return/^(?:src\/)?app\/\.vcp(?:\/page-templates(?:\/.+)?)?$/i.test(e)?Bn(e.replace("/.vcp","/_vcp")):!1}function ho(e){return xp.some(n=>n.toLowerCase()===e.toLowerCase())}function Lp(e){let n=e.split("/").at(-1)??e,s=n.lastIndexOf(".");return s>0?n.slice(s).toLowerCase():""}function ei(e){return!e.includes("/")&&yp.some(n=>n.toLowerCase()===e.toLowerCase())}function So(e){let n=e.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 Bn(e){return!e||e.startsWith("/")||e.includes("\\")?!1:e.split("/").every(n=>!(n.length===0||n==="."||n===".."||n.startsWith(".")||n==="package.json"||n==="node_modules"||n==="recipes"||n.startsWith(".env")))}import{z as Mp}from"zod";var nn=["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"],Up=["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"],qp=[...nn,...Up],Fp=new Set(["ar","fa","he"]),KI=[{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"}],Gp={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"},Kp=new Set(nn);function fo(e){return Kp.has(e)?e:Gp[e]}var Wp="en";function WI(e){let n=e.toLowerCase().split("-",1)[0]??"";return Fp.has(n)?"rtl":"ltr"}var zp={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 zI(e){return zp[e]??Wp}var Bp=["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"],Hp=new Set(Bp);function BI(e){return Hp.has(e)}var fe=Mp.enum(qp);import{z as Vp}from"zod";var bo=Vp.string().uuid();import{z as o}from"zod";import{z as Y}from"zod";var mt=Y.string().trim().min(1).max(128),Nt=Y.string().trim().min(1).max(500),$p=["\u4EA7\u54C1","\u90E8\u4EF6/\u8017\u6750","\u5E94\u7528\u65B9\u6848","\u5B9A\u5236/OEM","\u670D\u52A1","\u8D44\u8D28/\u80FD\u529B"],Yp=Y.enum($p),sn=Y.object({id:mt,keyword:Y.string().trim().min(1).max(255),business_id:mt,business_name:Y.string().trim().min(1).max(255),category:Yp,selling_points:Y.string().trim().max(2e3),section_id:mt,content_usage:Y.enum(["product","category","solution","service","capability","article","faq"]),intent:Nt,semantic_group:mt,primary_business:Y.boolean(),monthly_volume:Y.number().int().min(1),keyword_difficulty:Y.number().min(0).max(100).nullable(),variants:Y.array(Y.string().trim().min(1).max(255)),source:Y.literal("semrush"),source_evidence:Y.array(Nt).min(1)}).strict(),ti=Y.object({schema_version:Y.literal(1),snapshot_id:mt,dependency_hash:Y.string().regex(/^[a-f0-9]{64}$/),language:Y.string().trim().min(2).max(35),database:Y.string().regex(/^[a-z]{2}$/),generated_at:Y.string().datetime({offset:!0}),entries:Y.array(sn),candidates:Y.array(sn),search_result_ids:Y.array(mt).optional()}).strict().superRefine((e,n)=>{for(let s of["entries","candidates"]){let a=e[s];(new Set(a.map(i=>i.id)).size!==a.length||new Set(a.map(i=>i.keyword.normalize("NFKC").trim().toLowerCase())).size!==a.length)&&n.addIssue({code:"custom",path:[s],message:"\u5173\u952E\u8BCD\u4E0D\u80FD\u91CD\u590D"})}}),Hn=Y.object({snapshot_id:mt,entry_ids:Y.array(mt).min(1)}).strict().superRefine((e,n)=>{new Set(e.entry_ids).size!==e.entry_ids.length&&n.addIssue({code:"custom",path:["entry_ids"],message:"\u5173\u952E\u8BCD\u4E0D\u80FD\u91CD\u590D"})}),XI=Y.object({expected_revision:Y.number().int().nonnegative(),business_subject:Y.string().trim().min(1).max(255)}).strict(),yo=Y.object({points:Y.array(Nt).length(3),comparison:Y.array(Y.object({dimension:Nt,recommended:Nt,alternative:Nt}).strict()).min(1).max(4)}).strict();var ue=o.string().trim().min(1).max(128),lt=o.string().trim().min(1).max(200),Ke=o.string().trim().min(1).max(2e3),ni=o.string().trim().max(200),an=o.string().regex(/^[a-f0-9]{64}$/),si=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","keywords","risk"],ve=It.length,Xp=["keywords"],on=It.filter(e=>!Xp.includes(e)),Yn=on.length,ii=o.enum(It);function tT(e){return on.some(n=>n===e)}var Xn=o.enum([...It,"seogeo","content","conversion"]),Ro=["recommended","conservative","focused"],Io=o.enum(Ro),rn=o.union([Io,o.literal("confirmed")]),Qn=o.enum(["single_country","regional_combination","multi_market"]),Zn=o.object({code:o.string().trim().regex(/^[A-Z]{2}$/),name_zh:lt,name_en:lt,region:lt}).strict(),Qp=o.object({id:Io,presentation:yo.nullish(),sections:o.array(o.object({id:o.string().trim().min(1).max(128),label:o.string().trim().min(1).max(200)}).strict()).max(30).optional(),label:lt,note:Ke,impact:o.string().trim().max(500).nullish(),set_value:o.string().trim().max(500).nullish(),site_locale:fe.nullish(),market_type:Qn.nullish(),markets:o.array(Zn).max(32).optional()}).loose(),Zp=o.object({lead:o.string().trim().min(1).max(500),title:lt,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((e,n)=>{e.rows.forEach((s,a)=>{s.length!==e.columns.length&&n.addIssue({code:"custom",path:["rows",a],message:"Each Step5 plan row must match the column count."})})}),Jp=o.object({goal:Ke,issue:Ke,criteria:o.array(Ke).min(1).max(12),resources:o.array(Ke).min(1).max(12),risks:o.array(Ke).min(1).max(12),execution:o.object({standard:o.array(Ke).min(1).max(12),acceptance:o.array(Ke).min(1).max(12),downstream:o.array(Ke).min(1).max(12)}).strict()}).strict(),ed=o.object({source_type:o.enum(["step2","step3"]),source_id:ue,field_path:o.string().trim().max(300).nullish()}).strict(),td=o.enum(["ready","disabled","empty","timeout","rate_limited","quota_exhausted","failed"]),nd=["INFORMATIONAL","NAVIGATIONAL","COMMERCIAL","TRANSACTIONAL"],To=o.enum(nd),Vn=50,$n=60,xo=7,nT=["COMMERCIAL","TRANSACTIONAL"],sd=["C","T"];function ko(e){return sd.includes(e)}var id=o.object({id:ue,term:o.string().trim().min(1).max(255),source_type:o.enum(["step2","step3","step5"]),source_id:ue,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(),ad=o.object({keyword:o.string().trim().min(1).max(255),normalized_keyword:o.string().trim().min(1).max(255),intents:o.array(To).min(1).max(4),search_volume:o.number().int().min(Vn),keyword_difficulty:o.number().min(0).max($n),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(),od=o.object({id:ue,intent:To,title:lt,landing_page_type:o.enum(["blog","product","category","landing"]),keywords:o.array(ad).min(1).max(100)}).strict(),rd=o.enum(["NO_SEEDS","NO_PROVIDER_CANDIDATES","NO_METRIC_ELIGIBLE_CANDIDATES","NO_COMMERCIAL_INTENT_CANDIDATES","NO_FIT_ELIGIBLE_CANDIDATES"]),cd=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((e,n)=>{let s=[e.fetched_count,e.unique_count,e.metric_gate_pass_count,e.commercial_intent_pass_count,e.fit_pass_count,e.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."})}),Eo={provider:o.literal("semrush"),api_version:o.literal("v4"),fetched_at:o.string().datetime({offset:!0}),context_hash:an,status:td,seeds:o.array(id).max(20),intent_groups:o.array(od).max(16),selection_summary:cd.optional(),empty_reason_code:rd.nullish(),error_code:o.string().trim().regex(/^[A-Z0-9_]+$/).max(64).nullish()},md=o.discriminatedUnion("schema_version",[o.object({schema_version:o.literal(1),...Eo,database:o.string().trim().regex(/^[A-Z]{2}$/),country:o.string().trim().regex(/^[A-Z]{2}$/)}).strict(),o.object({schema_version:o.literal(2),...Eo,database:o.string().trim().regex(/^[a-z]{2}$/),country:o.string().trim().regex(/^[A-Z]{2}$/)}).strict()]).superRefine((e,n)=>{if(e.schema_version===1&&e.database!==e.country&&n.addIssue({code:"custom",path:["database"],message:"Semrush database must match the ISO country code."}),e.status==="ready"&&e.intent_groups.length===0&&n.addIssue({code:"custom",path:["intent_groups"],message:"Ready Semrush recommendations require an intent group."}),e.status==="ready"&&e.error_code&&n.addIssue({code:"custom",path:["error_code"],message:"Ready Semrush recommendations cannot contain an error code."}),e.empty_reason_code&&e.status!=="empty"&&n.addIssue({code:"custom",path:["empty_reason_code"],message:"Semrush empty reason is only valid for an empty snapshot."}),e.selection_summary){let s=e.intent_groups.reduce((a,i)=>a+i.keywords.length,0);e.selection_summary.selected_count!==s&&n.addIssue({code:"custom",path:["selection_summary","selected_count"],message:"Semrush selected count must match the persisted keywords."})}}),Ao=0,ld=o.union([o.literal(Ao),o.literal(1)]),sT=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(Vn),max_keyword_difficulty:o.number().finite().min(0).max(100).default($n),min_relevance_score:ld.default(Ao)}).strict(),pd=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(),dd=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(pd).max(100),result_count:o.number().int().nonnegative()}).strict(),iT=o.object({code:o.literal(0),message:o.string(),data:dd}).strict(),aT=o.object({snapshot_id:o.string().uuid(),selected_keywords:o.array(o.string().trim().min(2).max(160)).min(1).max(50)}).strict(),ud=o.object({candidate_id:ue,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(),_d=o.object({selection_batch_id:ue,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(ud).max(50)}).strict().superRefine((e,n)=>{e.selected_count!==e.items.length&&n.addIssue({code:"custom",path:["selected_count"],message:"selected_count must equal items.length."})}),oT=o.object({code:o.literal(0),message:o.string(),data:_d}).strict(),gd=o.enum(["ok","degraded"]),hd=["category","selection","application","parameter","cost","trust","compliance","delivery"],Po=o.object({id:ue,question:o.string().trim().min(8).max(300).refine(e=>/^[\x20-\x7E]+$/.test(e)),question_type:o.enum(hd),intent_strength:o.enum(["high","medium","low"]),source:o.enum(["ai_generation","user_input"])}).strict(),Sd=Po.extend({source:o.literal("ai_generation")}).strict(),ai=o.object({key:Xn,position:o.number().int().min(1).max(11),category:lt,title:lt,summary:Ke,rationale:Ke,parameter:o.string().trim().max(500).nullish(),options:o.array(Qp).max(3),keyword_library:ti.nullish(),plan:Zp.nullish(),structure_detail:Jp.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(ed).min(1).max(8),semrush_recommendations:md.nullish(),seo_payload:o.lazy(()=>oi).nullish(),geo_questions:o.array(Sd).max(20).optional(),generation_status:gd.optional()}).loose().superRefine((e,n)=>{let s=It.indexOf(e.key)+1;s>0&&e.position!==s&&n.addIssue({code:"custom",path:["position"],message:`Step5 strategy ${e.key} uses an invalid position.`}),e.key!=="keywords"&&e.keyword_library&&n.addIssue({code:"custom",path:["keyword_library"],message:"Only the keywords card can carry an enterprise keyword library."}),e.options.length!==(e.key==="keywords"?0:3)&&n.addIssue({code:"custom",path:["options"],message:"Keywords use no options; ordinary cards require three options."}),e.key==="keywords"&&(e.note_tips.length||e.geo_questions?.length||e.seo_payload||e.semrush_recommendations)&&n.addIssue({code:"custom",message:"The enterprise keyword library cannot carry legacy SEO/GEO content."}),e.options.forEach((a,i)=>{a.id!==Ro[i]&&n.addIssue({code:"custom",path:["options",i,"id"],message:"Step5 strategy options must use the canonical order."})}),e.semrush_recommendations&&e.key!=="seogeo"&&n.addIssue({code:"custom",path:["semrush_recommendations"],message:"Semrush recommendations are only valid for the seogeo item."}),e.seo_payload&&e.key!=="seogeo"&&n.addIssue({code:"custom",path:["seo_payload"],message:"SEO payloads are only valid for the seogeo item."}),(e.geo_questions?.length??0)>0&&e.key!=="seogeo"&&n.addIssue({code:"custom",path:["geo_questions"],message:"GEO questions are only valid for the seogeo item."}),e.structure_detail&&e.key!=="structure"&&n.addIssue({code:"custom",path:["structure_detail"],message:"Structure detail is only valid for the structure item."}),e.geo_questions&&new Set(e.geo_questions.map(a=>a.question.trim().toLocaleLowerCase())).size!==e.geo_questions.length&&n.addIssue({code:"custom",path:["geo_questions"],message:"GEO citation questions must be unique."})}),wo=9,Co=o.object({id:ue,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(),fd=2,bd=0,rT=20,yd=50,vo=o.object({id:ue,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(),xd=vo.superRefine((e,n)=>{ko(e.intent_code)||n.addIssue({code:"custom",path:["intent_code"],message:"New legacy SEO keyword selections must use commercial or transactional intent."})}),Jn=o.object({id:ue,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((e,n)=>{let s=Oo(e.keyword);e.normalized_keyword!==s&&n.addIssue({code:"custom",path:["normalized_keyword"],message:"normalized_keyword must match the canonical keyword form."})}),Ed=o.object({request_id:o.string().trim().min(1).max(128),snapshot_id:ue,selected_keywords:o.array(o.string().trim().min(2).max(160)).min(1).max(50)}).strict(),oi=o.object({schema_version:o.literal(fd),seo_keywords:o.array(Jn).min(bd).max(yd),semrush_snapshot_refs:o.array(Ed).max(20).optional(),geo_questions:o.array(Po).max(20).optional()}).strict().superRefine(jd),Rd=oi.superRefine((e,n)=>{e.seo_keywords.forEach((s,a)=>{ko(s.intc)||n.addIssue({code:"custom",path:["seo_keywords",a,"intc"],message:"New SEO keyword selections must use commercial or transactional intent."})})}),Id=o.object({rows:o.array(Co).max(100).optional(),seo_keywords:o.array(vo).max(100).optional()}).strict(),Td=o.object({rows:o.array(Co).max(100).optional(),seo_keywords:o.array(xd).max(100).optional()}).strict(),kd=o.union([oi,Id]),Ad=o.union([Rd,Td]),Pd=o.object({item_key:ii,selected_option_id:rn,note:ni,custom_payload:Ad.optional(),keyword_selection:Hn.optional()}).strict().superRefine((e,n)=>{(e.custom_payload||(e.item_key==="keywords"?e.selected_option_id!=="confirmed"||e.note!==""||!e.keyword_selection:e.selected_option_id==="confirmed"||e.keyword_selection!==void 0))&&n.addIssue({code:"custom",message:"\u666E\u901A\u5361\u4EC5\u63A5\u53D7\u65B9\u6848\u4E0E\u5907\u6CE8\uFF1B\u4F01\u4E1A\u5173\u952E\u8BCD\u5E93\u4EC5\u63A5\u53D7\u5DF2\u751F\u6210\u5FEB\u7167\u4E2D\u7684\u5173\u952E\u8BCD ID"})}),ri=o.object({item_key:ii,selected_option_id:rn,note:ni,custom_payload:kd.optional(),keyword_selection:Hn.optional(),keyword_library:ti.optional(),market_type:Qn.nullish(),markets:o.array(Zn).max(32).optional(),selected_value:o.unknown().nullable(),accepted_at:o.string().datetime({offset:!0})}).loose(),wd=o.enum(["running","succeeded","failed"]),Cd=o.object({schema_version:o.literal(1),source_job_id:ue,site_id:ue,output_locale:si.optional(),items:o.array(ai).length(ve),decisions:o.array(ri).min(Yn).max(ve)}).loose(),vd=o.object({strategy_version_id:ue,site_id:ue,source_job_id:ue,output_locale:si.optional(),version:o.number().int().positive(),checksum:an,snapshot:Cd,committed_at:o.string().datetime({offset:!0})}).loose(),Do=o.object({job_id:ue,site_id:ue,output_locale:si.optional(),status:wd,keyword_library_needs_update:o.boolean().optional(),revision:o.number().int().nonnegative(),items:o.array(ai).max(ve),decisions:o.array(ri).max(ve),output_checksum:an.nullish(),error_code:o.string().trim().max(64).nullish(),error_message:o.string().trim().max(500).nullish(),committed_version:vd.nullish()}).loose().superRefine((e,n)=>{let s=e.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=e.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."})}),cT=o.object({force_refresh:o.boolean().optional().default(!1)}).strict(),mT=Do.extend({cached:o.boolean()}).strict(),lT=o.object({expected_revision:o.number().int().nonnegative()}).strict(),pT=o.object({expected_revision:o.number().int().nonnegative(),selected_option_id:rn,note:ni,keyword_selection:Hn.optional()}).strict().superRefine((e,n)=>{(e.selected_option_id==="confirmed"?!e.keyword_selection||e.note!=="":e.keyword_selection)&&n.addIssue({code:"custom",message:"\u4F01\u4E1A\u5173\u952E\u8BCD\u53EA\u63A5\u53D7\u5DF2\u751F\u6210\u6761\u76EE\u7684 ID\uFF1B\u666E\u901A\u7B56\u7565\u53EA\u63A5\u53D7\u65B9\u6848\u548C\u5907\u6CE8"})}),dT=o.object({revision:o.number().int().positive(),decision:ri}).strict(),uT=o.object({idempotency_key:o.string().trim().min(8).max(128),expected_revision:o.number().int().nonnegative(),decisions:o.array(Pd).min(Yn).max(ve)}).strict().superRefine((e,n)=>{let s=e.decisions.map(a=>a.item_key);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["decisions"],message:"Step5 commit decisions must use unique strategy keys."}),on.forEach(a=>{s.includes(a)||n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit is missing ${a}.`})})}),_T=o.object({strategy_version_id:ue,version:o.number().int().positive(),checksum:an,next_path:o.string().trim().min(1).max(500)}).strict(),Dd=Do.extend({completed:o.number().int().min(0).max(ve),total:o.literal(ve)}).loose(),Od=["snapshot","strategy_item_start","strategy_item_done","strategy_items_invalidated","strategy_generation_done","failed"];function gT(e){return typeof e=="string"&&Od.includes(e)}var hT=o.discriminatedUnion("event",[o.object({id:o.number().int().nonnegative(),event:o.literal("snapshot"),data:Dd}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_item_start"),data:o.object({key:ii,position:o.number().int().min(1).max(ve)}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_item_done"),data:o.object({item:ai}).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(ve)}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_generation_done"),data:o.object({item_count:o.literal(ve),schema_version:o.literal(1),checksum:an}).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 jd(e,n){let s=new Set;e.seo_keywords.forEach((r,m)=>{s.has(r.normalized_keyword)&&n.addIssue({code:"custom",path:["seo_keywords",m,"normalized_keyword"],message:"SEO keywords must be unique after Unicode normalization."}),s.add(r.normalized_keyword),(r.monthly_volume===null||r.monthly_volume<Vn)&&n.addIssue({code:"custom",path:["seo_keywords",m,"monthly_volume"],message:`Selected SEO keywords require monthly_volume >= ${Vn}.`}),(r.keyword_difficulty===null||r.keyword_difficulty>$n)&&n.addIssue({code:"custom",path:["seo_keywords",m,"keyword_difficulty"],message:`Selected SEO keywords require keyword_difficulty <= ${$n}.`}),(r.fit===null||r.fit<xo)&&n.addIssue({code:"custom",path:["seo_keywords",m,"fit"],message:`Selected SEO keywords require fit >= ${xo.toFixed(1)}.`})});let a=new Set((e.semrush_snapshot_refs??[]).flatMap(r=>r.selected_keywords.map(Oo)));e.seo_keywords.forEach((r,m)=>{r.source==="semrush"&&!a.has(r.normalized_keyword)&&n.addIssue({code:"custom",path:["seo_keywords",m,"source"],message:"Semrush keywords must reference a persisted Semrush snapshot selection."})});let i=(e.geo_questions??[]).map(r=>r.question.trim().toLocaleLowerCase());new Set(i).size!==i.length&&n.addIssue({code:"custom",path:["geo_questions"],message:"GEO citation questions must be unique."})}function Oo(e){return e.normalize("NFKC").trim().replace(/\s+/g," ").toLowerCase()}import{z as Nd}from"zod";var We=Nd.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 bT(e,n){let s=We.safeParse(e),a=We.safeParse(n);if(!s.success||!a.success)return null;let i=jo(s.data),r=jo(a.data);for(let c=0;c<3;c+=1){let p=No(i.release[c],r.release[c]);if(p!==0)return p}if(!i.prerelease&&!r.prerelease)return 0;if(!i.prerelease)return 1;if(!r.prerelease)return-1;let m=Math.max(i.prerelease.length,r.prerelease.length);for(let c=0;c<m;c+=1){let p=i.prerelease[c],I=r.prerelease[c];if(p===void 0)return-1;if(I===void 0)return 1;if(p===I)continue;let R=/^\d+$/u.test(p),w=/^\d+$/u.test(I);return R&&w?No(BigInt(p),BigInt(I)):R?-1:w?1:Ld(p,I)}return 0}function jo(e){let n=e.indexOf("+"),s=n===-1?e:e.slice(0,n),a=s.indexOf("-"),i=a===-1?s:s.slice(0,a),r=a===-1?void 0:s.slice(a+1),[m,c,p]=i.split(".");return{release:[BigInt(m),BigInt(c),BigInt(p)],...r?{prerelease:r.split(".")}:{}}}function No(e,n){return e<n?-1:e>n?1:0}function Ld(e,n){return e<n?-1:e>n?1:0}import{z as $}from"zod";import{z as Te}from"zod";var ci=64,Md=512*1024,mi=4*1024*1024,Ud=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function qd(e){return Ud.test(e)}var Lo=Te.string().min(1).refine(qd,{message:"Materialization pathTemplate must be a safe relative path."}),Fd=Te.object({pathTemplate:Lo,content:Te.string(),role:Te.string().min(1).optional()}).strict(),Gd=Te.union([Te.object({kind:Te.literal("default")}).strict(),Te.object({kind:Te.literal("named"),name:Te.string().min(1)}).strict()]),Kd=Te.object({pathTemplate:Lo,export:Gd}).strict(),Wd=Te.array(Te.never()).optional(),Tt=Te.object({instanceBaseName:Te.string().min(1),files:Te.array(Fd).min(1).max(ci),entry:Kd,dataRequirements:Wd}).strict().superRefine((e,n)=>{let s=new Set,a=e.entry.pathTemplate,i=0;for(let[r,m]of e.files.entries()){s.has(m.pathTemplate)&&n.addIssue({code:"custom",path:["files",r,"pathTemplate"],message:`Duplicate materialization pathTemplate: ${m.pathTemplate}`}),s.add(m.pathTemplate);let c=new TextEncoder().encode(m.content).length;c>Md&&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>mi&&n.addIssue({code:"custom",path:["files"],message:"Materialization exceeds the total content byte limit."})});var Mo="insertNewComponent",TT={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"},li=$.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),Uo=$.lazy(()=>$.object({id:$.string().uuid(),key:$.string().min(1),name:$.string(),children:$.array(Uo)}).strict()),qo=$.object({category_group_key:$.literal(Mo),categories:$.array(Uo)}).strict(),zd=$.object({resource_id:$.string().min(1),name:$.string(),description:$.string().nullable(),thumbnail_url:$.string().nullable(),resolved_version:li,category_id:$.string().uuid().nullable()}).strict(),Fo=$.object({category_group_key:$.literal(Mo),items:$.array(zd),next_cursor:$.string().min(1).nullable()}).strict(),kT=$.object({resource_id:$.string().min(1),resolved_version:li,anchor_block_id:$.string().min(1),placement:$.enum(["before","after"])}).strict(),AT=$.object({status:$.literal("mock_acknowledged")}).strict(),PT=$.object({category_id:$.string().uuid().optional(),include_descendants:$.enum(["true","false"]).optional().transform(e=>e==="true"),limit:$.coerce.number().int().min(1).max(100).optional().default(20),cursor:$.string().min(1).optional()}).strict().superRefine((e,n)=>{e.include_descendants&&!e.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),kt=li,wT=$.object({version:kt}).strict(),Go=$.object({resource_id:$.string().min(1),resolved_version:kt,revision_id:$.string().uuid().optional(),digest_sha256:$.string().regex(/^[a-f0-9]{64}$/),materialization:Tt}).strict();import{z as x}from"zod";import{z as h}from"zod";var Bo="/",Ho=255,Bd=5e3,Hd=64;function Vd(e){if(!e.startsWith("/")||e.includes("//")||/[?#\\\s\u0000-\u001f\u007f]/u.test(e))return!1;try{let n=decodeURIComponent(e);return n.includes("//")||/[?#\\\s\u0000-\u001f\u007f]/u.test(n)||n.split("/").length!==e.split("/").length||/%25/iu.test(e)?!1:n.split("/").every(s=>![".",".."].includes(s))}catch{return!1}}var et=h.string().min(1).max(Ho).refine(Vd,"url_path must be a safe site-relative path"),ui=h.string().max(Ho),es=h.preprocess(e=>e===0?!1:e===1?!0:e,h.boolean()),cn=h.union([h.url(),et]),_i=h.enum(["landing_page","general_page","detail_page"]),gi=h.enum([..._i.options,"list_page","category_page","tag_page","author_page","search_page","date_page"]);function OT(e){return e.vcp_managed&&e.url!==null&&_i.safeParse(e.page_type).success&&et.safeParse(e.url_path).success}function Ko(e){return e.includes("{")||e.includes("}")}function jT(e){if(!Ko(e.url_path))return Wo(e.url_path);if(e.url===null)return null;let n=/^[a-z][a-z0-9+.-]*:\/\//iu.test(e.url)?$d(e.url):e.url;return n===null||Ko(n)?null:Wo(n)}function Wo(e){let n=et.safeParse(e);return n.success?n.data:null}function $d(e){try{return new URL(e).pathname}catch{return null}}var Vo=h.lazy(()=>h.object({cms_page_id:h.number().int().positive(),title:h.string().trim().min(1).max(255),url_path:ui,url:cn.nullable(),page_type:gi,vcp_managed:es,children:h.array(Vo)}).strict()),Yd=h.object({group_id:h.string().min(1),title:h.string().trim().min(1).max(255),collection_slug:h.string(),pages:h.array(Vo)}).strict(),zo=h.object({groups:h.array(Yd)}).strict(),$o=h.lazy(()=>h.object({id:h.number().int().positive(),title:h.string().trim().min(1).max(120),url_path:ui,parent_id:h.number().int().nonnegative(),group_type:h.string().min(1),page_type:gi,plugin_id:h.number().int().nonnegative(),is_default:es,is_published:es,url:cn.nullable(),vcp_managed:es,children:h.array($o)})),Xd=h.object({plugin_id:h.number().int().nonnegative(),slug:h.string(),group_name:h.string().trim().min(1).max(255),pages:h.array($o)}).passthrough(),Qd=h.array(Xd);function Yo(e){return{cms_page_id:e.id,title:e.title,url_path:e.url_path,url:e.url,page_type:e.page_type,vcp_managed:e.vcp_managed,children:e.children.map(n=>Yo(n))}}function NT(e){if(!Zd(e))return null;let n=zo.safeParse(e);if(n.success)return n.data;let s=Qd.safeParse(e);if(!s.success)return null;let a=zo.safeParse({groups:s.data.map(i=>({group_id:String(i.plugin_id),title:i.group_name,collection_slug:i.slug,pages:i.pages.map(Yo)}))});return a.success?a.data:null}function Zd(e){let n=Array.isArray(e)?e:pi(e)&&Array.isArray(e.groups)?e.groups:[],s=[];for(let i of n)if(!(!pi(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>Bd||i.depth>Hd)return!1;if(!(!pi(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 pi(e){return typeof e=="object"&&e!==null}var Jd=h.enum(["invalid_url_path","missing_url","not_vcp_managed","unsupported_page_type","page_not_generated"]),eu=h.enum(["home_page","invalid_url_path","not_selectable","not_vcp_managed","page_has_children","last_selectable_page","cms_unbound","unsupported_page_type"]),Xo=h.lazy(()=>h.object({cms_page_id:h.number().int().positive().nullable(),title:h.string().trim().min(1).max(255),url_path:ui,preview_url_path:et.nullable(),url:cn.nullable(),page_type:gi,vcp_managed:h.boolean(),selectable:h.boolean(),disabled_reason:Jd.nullable(),can_delete:h.boolean(),delete_block_reason:eu.nullable(),has_cms_children:h.boolean(),children:h.array(Xo)}).strict()),Qo=h.object({group_id:h.string().min(1),title:h.string().trim().min(1).max(255),pages:h.array(Xo)}).strict(),LT=h.object({base_snapshot_id:k,expected_url_path:et}).strict(),tu=h.enum(["succeeded","failed"]),nu=h.object({url_path:et,phase:h.enum(["ensure","binding","delete"]),code:h.string().min(1),message:h.string().min(1)}).strict(),hi=h.object({status:tu,checked_count:h.number().int().nonnegative(),ensured_count:h.number().int().nonnegative(),deleted_count:h.number().int().nonnegative(),already_absent_count:h.number().int().nonnegative(),failed_pages:h.array(nu),warnings:h.array(h.string().min(1))}).strict(),su=h.object({result_snapshot_id:k,deleted_files:h.array(h.string().min(1)),updated_files:h.array(h.string().min(1)),preserved_shared_files:h.array(h.string().min(1)),warnings:h.array(h.string().min(1)),next_url:cn.nullable(),previous_url:cn.nullable(),cms_reconcile_result:hi}).strict(),MT=h.object({code:h.literal(0),message:h.string(),data:su}).strict(),UT=h.object({snapshot_id:k}).strict(),iu=h.object({snapshot_id:k,warnings:h.array(h.string().min(1)),cms_reconcile_result:hi}).strict(),qT=h.object({code:h.literal(0),message:h.string(),data:iu}).strict(),FT=h.object({source_committed:h.boolean(),result_snapshot_id:k.optional(),cms_reconcile_result:hi.optional()}).strict().superRefine((e,n)=>{e.source_committed&&!e.result_snapshot_id&&n.addIssue({code:"custom",path:["result_snapshot_id"],message:"committed source requires result_snapshot_id"})}),au=_i,ou=h.object({title:h.string().min(1).max(255).optional(),description:h.string().min(1).max(1e3).optional(),keywords:h.string().min(1).max(255).optional(),meta_tags_json:h.record(h.string(),h.unknown()).optional(),schema_json:h.union([h.record(h.string(),h.unknown()),h.array(h.unknown())]).optional(),breadcrumbs_json:h.array(h.unknown()).optional()}).strict(),Zo=h.object({url_path:et,title:h.string().trim().min(1).max(255),kind:au,route_file:h.string().min(1),collection_id:h.string().trim().min(1).optional(),seo:ou.optional()}).strict().superRefine((e,n)=>{e.kind==="detail_page"&&e.seo&&n.addIssue({code:"custom",path:["seo"],message:"detail_page target cannot carry seo (owned by the collection binding flow)"}),e.kind==="detail_page"&&!e.collection_id&&n.addIssue({code:"custom",path:["collection_id"],message:"detail_page target requires collection_id"}),e.kind!=="detail_page"&&e.collection_id&&n.addIssue({code:"custom",path:["collection_id"],message:`${e.kind} target cannot have collection_id`}),e.kind==="landing_page"!=(e.url_path===Bo)&&n.addIssue({code:"custom",path:["kind"],message:"The home target must be the only landing_page target."})}),ru=h.object({complete:h.literal(!0),targets:h.array(Zo)}).strict().superRefine((e,n)=>{e.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."}),e.targets.filter(a=>a.url_path===Bo).length!==1&&n.addIssue({code:"custom",path:["targets"],message:"A complete page target set must contain exactly one home page."})}),GT=h.discriminatedUnion("complete",[ru,h.object({complete:h.literal(!1),targets:h.array(Zo),errors:h.array(h.string().min(1)).min(1)}).strict()]),di=h.string().regex(/^sha256:[0-9a-f]{64}$/),KT=h.object({projection_hash:di.nullable()}).strict(),WT=h.object({expected_projection_hash:di.nullable(),projection_hash:di}).strict();var Jo="insertNewPage",YT={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"},At=x.enum(["page","pages"]),cu=x.object({resource_id:x.string().min(1),resource_type:At,resolved_version:kt,template_page_id:x.string().min(1)}).strict(),er=x.lazy(()=>x.object({id:x.string().uuid(),key:x.string().min(1),name:x.string(),children:x.array(er)}).strict()),tr=x.object({category_group_key:x.literal(Jo),categories:x.array(er)}).strict(),mu=x.object({resource_id:x.string().min(1),resource_type:At,name:x.string(),description:x.string().nullable(),thumbnail_url:x.string().nullable(),preview_images:x.array(x.object({url:x.string().min(1),page_id:x.string().min(1).nullable(),is_primary:x.boolean()}).strict()).optional(),resolved_version:kt,category_id:x.string().uuid().nullable()}).strict(),nr=x.object({category_group_key:x.literal(Jo),items:x.array(mu),next_cursor:x.string().min(1).nullable()}).strict(),XT=x.object({category_id:x.string().uuid().optional(),include_descendants:x.enum(["true","false"]).optional().transform(e=>e==="true"),limit:x.coerce.number().int().min(1).max(100).optional().default(20),cursor:x.string().min(1).optional()}).strict().superRefine((e,n)=>{e.include_descendants&&!e.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),mn=kt,ts=x.string().regex(/^\/[a-z0-9]+(?:-[a-z0-9]+)*$/),QT=x.string().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),lu=x.object({template_page_id:x.string().min(1),title:x.string().trim().min(1).max(120),final_route:ts}).strict(),pu=x.object({template_page_id:x.string().min(1),title:x.string().trim().min(1).max(120),source:cu.optional(),blocks:x.array(x.discriminatedUnion("kind",[x.object({kind:x.literal("package-component"),instance_id:x.string().min(1),component_id:x.string().min(1),label:x.string().trim().min(1).max(120)}).strict(),x.object({kind:x.literal("component-resource"),instance_id:x.string().min(1),resource_id:x.string().min(1),resolved_version:kt,label:x.string().trim().min(1).max(120)}).strict()])).optional(),route:x.object({input:x.string(),append_random_suffix:x.boolean().optional(),random_suffix_length:x.number().int().min(4).max(16).optional(),final:ts}).strict()}).strict(),du=x.object({resource_id:x.string().min(1),resource_type:At,resolved_version:mn,pages:x.array(pu).min(1)}).strict().superRefine((e,n)=>{pt(e.pages.map(s=>s.template_page_id),"pages",n),pt(e.pages.map(s=>s.route.final),"routes",n);for(let[s,a]of e.pages.entries()){if(!a.blocks)continue;let i=new Set;for(let[r,m]of a.blocks.entries())i.has(m.instance_id)&&n.addIssue({code:"custom",path:["pages",s,"blocks",r,"instance_id"],message:`Duplicate block instance identifier within page: ${m.instance_id}`}),i.add(m.instance_id)}});function Si(e,n){e.resource_type==="page"&&e.pages.length!==1&&n.addIssue({code:"custom",path:["pages"],message:"page resources must contain exactly one page"}),e.resource_type==="pages"&&e.pages.length<2&&n.addIssue({code:"custom",path:["pages"],message:"pages resources must contain at least two pages"})}function pt(e,n,s){let a=new Set;for(let[i,r]of e.entries())a.has(r)&&s.addIssue({code:"custom",path:[n,i],message:`Duplicate ${n} identifier: ${r}`}),a.add(r)}var ZT=x.object({resource_type:At,version:mn,pages:x.array(lu).min(1)}).strict().superRefine((e,n)=>{Si(e,n),pt(e.pages.map(s=>s.template_page_id),"pages",n),pt(e.pages.map(s=>s.final_route),"routes",n)}),uu=x.object({instance_id:x.string().min(1),component_id:x.string().min(1)}).strict(),_u=x.object({component_id:x.string().min(1),materialization:Tt}).strict(),gu=x.object({template_page_id:x.string().min(1),title:x.string().trim().min(1).max(120),final_route:ts,materialization:Tt,components:x.array(uu)}).strict(),fi=x.object({resource_id:x.string().min(1),resource_type:At,resolved_version:mn,revision_id:x.string().uuid().optional(),digest_sha256:x.string().regex(/^[a-f0-9]{64}$/),components:x.array(_u),pages:x.array(gu).min(1),project_dependencies:x.record(x.string(),x.never()).optional()}).strict().superRefine((e,n)=>{Si(e,n);let s=e.components.map(i=>i.component_id),a=new Set(s);pt(s,"components",n),pt(e.pages.map(i=>i.template_page_id),"pages",n),pt(e.pages.map(i=>i.final_route),"routes",n);for(let[i,r]of e.pages.entries()){let m=new Set;for(let[c,p]of r.components.entries())a.has(p.component_id)||n.addIssue({code:"custom",path:["pages",i,"components",c,"component_id"],message:`Unknown component reference: ${p.component_id}`}),m.has(p.instance_id)&&n.addIssue({code:"custom",path:["pages",i,"components",c,"instance_id"],message:`Duplicate component instance identifier within page: ${p.instance_id}`}),m.add(p.instance_id)}}),sr=fi,ir=x.object({template_page_id:x.string().min(1),title:x.string().trim().min(1).max(120),final_route:ts,route_file_path:x.string().regex(/^app\/[a-z0-9]+(?:-[a-z0-9]+)*\/page\.tsx$/)}).strict(),hu=x.object({template_page_id:x.string().min(1),title:x.string().trim().min(1).max(120),composition_supported:x.boolean(),blocks:x.array(x.object({instance_id:x.string().min(1),component_id:x.string().min(1),label:x.string().trim().min(1).max(120)}).strict())}).strict(),ar=x.object({resource_id:x.string().min(1),resource_type:At,resolved_version:mn,pages:x.array(hu).min(1)}).strict().superRefine((e,n)=>{Si(e,n),pt(e.pages.map(s=>s.template_page_id),"pages",n)}),JT=x.object({resource_type:At,version:mn}).strict(),ek=x.object({draft:du}).strict(),or=x.object({groups:x.array(Qo)}).strict(),rr=x.object({candidate:x.record(x.string(),x.unknown())}).strict();var Lt="[a-z0-9]+(?:-[a-z0-9]+)*",ln=new RegExp(`^/(?:${Lt}(?:/${Lt})*)?$`),cr=["/privacy","/cookie-policy","/system/not-found"],Su=cr.map(e=>`app/${e.slice(1)}/page.tsx`);function fu(e){return e.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function mr(e){return typeof e=="string"&&ln.test(e)}function lr(e){if(typeof e!="string")return null;let n=e.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(fu).filter(c=>c.length>0);if(r.length===0)return null;let m=`/${r.join("/")}`;return mr(m)?m:null}function pr(e){let n=lr(e);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function bu(e){let n=pr(e);return n==="/"?"app/page.tsx":`app/${n.slice(1)}/page.tsx`}import{z as ne}from"zod";import{z as _}from"zod";import{z as Le}from"zod";var yu=Le.object({code:Le.string().min(1),message:Le.string().min(1)}),ak=Le.object({code:Le.string().min(1),message:Le.string().min(1)});function bi(e){return Le.object({ok:Le.literal(!0),composition:q,data:e}).strict()}function xu(e){let n={ok:Le.literal(!1),composition:q,error:yu.extend({code:e.codeSchema})};return e.currentSchema&&(n.current=e.currentSchema.optional()),e.diagnosticsSchema&&(n.diagnostics=Le.array(e.diagnosticsSchema).optional()),e.dataSchema&&(n.data=e.dataSchema.optional()),Le.object(n).strict()}function dr(e){return Le.discriminatedUnion("ok",[bi(e.dataSchema),xu({codeSchema:e.codeSchema,currentSchema:e.currentSchema,diagnosticsSchema:e.diagnosticsSchema,dataSchema:e.failureDataSchema})])}import{z as X}from"zod";var tt=X.object({start:X.number().int().nonnegative(),end:X.number().int().nonnegative()}).superRefine((e,n)=>{e.end<e.start&&n.addIssue({code:"custom",path:["end"],message:"end must be greater than or equal to start"})}),Eu=X.object({code:X.enum(["missing-class-name","unsupported-attribute-name","source-locator-warning","invalid-new-attr","version-conflict","write-failed"]),message:X.string().min(1)}),ur=X.object({path:X.string().min(1),content:X.string(),hash:X.string().min(1).optional()}),lk=X.object({composition:q,revision:X.string().min(1),entryCss:ur,stylesheets:X.array(ur).default([])}).strict(),pk=X.object({composition:ce}).strict(),dk=X.object({key:X.string().min(1),composition:ce}).strict(),_r=X.object({key:X.string().min(1),composition:q,filePath:X.string().min(1),componentName:X.string().min(1),sourceKind:X.enum(["missing","stringLiteral","expression"]),attrRaw:X.string().min(1).nullable(),valueRaw:X.string().min(1).nullable(),attrRange:tt.nullable(),openingElementRange:tt,version:X.object({documentVersion:X.number().int().nonnegative(),contentHash:X.string().min(1)}),diagnostics:X.array(Eu),computedStyle:X.record(X.string(),X.string()).optional()}).strict().superRefine((e,n)=>{if(e.sourceKind==="missing"){(e.attrRaw!==null||e.valueRaw!==null||e.attrRange!==null)&&n.addIssue({code:"custom",message:"missing className source must not include attr raw or range"});return}(e.attrRaw===null||e.valueRaw===null||e.attrRange===null)&&n.addIssue({code:"custom",message:"present className source must include attr raw and ranges"})}),uk=_r,_k=bi(_r),yi=X.object({source:X.enum(["style-panel","class-source-editor"]),operation:X.enum(["replace-static-classname","replace-expression","create-attribute","remove-attribute"])});import{z as $e}from"zod";var Ru=new Set(["children","key","ref","dangerouslysetinnerhtml"]),Iu=new Set(["data-designer-hover-outline","data-designer-select-outline"]),Tu=/^[A-Za-z_$][A-Za-z0-9_$:-]*$/u;function ku(e){return{code:"protected-attribute",message:`Property is protected from generic site editing: ${e}`}}function Au(){return{code:"invalid-attribute-name",message:"Property name must be a valid single JSX attribute name"}}function Pu(e){let n=e.toLowerCase();return Ru.has(n)||n.startsWith("data-vcp-")||Iu.has(n)||/^on[a-z]/iu.test(e)}function xi(e){if(!Tu.test(e))return{owner:"blocked",name:e,diagnostic:Au()};if(Pu(e))return{owner:"blocked",name:e,diagnostic:ku(e)};let n=e.toLowerCase();return n==="classname"||n==="class"?{owner:"class-name-source",name:e}:n==="style"?{owner:"style",name:e}:{owner:"generic",name:e}}import{z as nt}from"zod";var Pt=nt.lazy(()=>nt.union([nt.string(),nt.number().finite(),nt.boolean(),nt.null(),nt.array(Pt),nt.record(nt.string(),Pt)]));var gr=$e.string().min(1),wu=$e.discriminatedUnion("operation",[$e.object({operation:$e.literal("set"),name:gr,value:Pt}).strict(),$e.object({operation:$e.literal("remove"),name:gr}).strict()]).superRefine((e,n)=>{let s=xi(e.name);s.owner==="blocked"&&n.addIssue({code:"custom",path:["name"],message:s.diagnostic?.message??"Property is not available for site editing"})}),hr=$e.object({kind:$e.literal("set-props"),scope:$e.enum(["selection","template"]),changes:$e.array(wu).min(1)}).strict().superRefine((e,n)=>{let s=new Map;for(let[a,i]of e.changes.entries()){let r=xi(i.name),m=Cu(r),c=s.get(m);c!==void 0?n.addIssue({code:"custom",path:["changes",a,"name"],message:`Duplicate property change; first declared at index ${c}`}):s.set(m,a)}});function Cu(e){return e.owner==="class-name-source"||e.owner==="style"?`owner:${e.owner}`:`name:${e.name}`}import{z as vu}from"zod";var Sr=vu.enum(["src","alt","poster","href","width","height"]);import{z as Mt}from"zod";var pn=Mt.object({editingSessionId:Mt.string().min(1),lockId:Mt.string().min(1),ownerId:Mt.string().min(1),leaseAssertion:Mt.string().min(1)}).strict(),kk="signed-designer-mutations-v1",Ak=Mt.object({mutationContext:pn}).strict();import{z as u}from"zod";import{z as dn}from"zod";var ns="::",Ei=dn.object({file:dn.string().min(1),component:dn.string().min(1),structuralPath:dn.string().min(1),key:dn.string().min(1)}).superRefine((e,n)=>{let s=Du(e.file,e.component,e.structuralPath);e.key!==s&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function Du(e,n,s){return`${e}${ns}${n}${ns}${s}`}function Ck(e){let[n,s,...a]=e.split(ns);return!n||!s||a.length===0?null:{file:n,component:s,structuralPath:a.join(ns)}}var ss=u.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"]),un=u.object({code:u.string().min(1),message:u.string().min(1)}).strict(),Ou=u.union([u.object({kind:u.literal("virtual-route-root"),key:u.string().min(1)}).strict(),u.object({kind:u.literal("jsx-container"),key:u.string().min(1),sourceMemberKey:u.string().min(1),sourceFile:u.string().min(1),componentName:u.string().min(1).optional()}).strict(),u.object({kind:u.literal("starter-placeholder"),key:u.string().min(1),sourceFile:u.string().min(1).optional()}).strict()]),ju=u.object({key:u.string().min(1),kind:u.enum(["jsx-element","jsx-fragment","jsx-expression","null-return","starter-placeholder"]),containerKey:u.string().min(1),label:u.string().min(1),sourceFile:u.string().min(1).optional(),isAtomic:u.boolean()}).strict(),Nu=u.object({key:u.string().min(1),sourceMemberKey:u.string().min(1),containerKey:u.string().min(1),label:u.string().min(1),isIndependent:u.boolean()}).strict(),Lu=u.object({key:u.string().min(1),containerKey:u.string().min(1),businessMemberKeys:u.array(u.string().min(1)),isMultiMember:u.boolean()}).strict(),br=u.object({kind:u.literal("page-composition"),placementKey:u.string().min(1),documentVersion:u.number().int().nonnegative(),composition:ce}).strict(),Mu=u.object({kind:u.literal("page-composition"),placementKey:u.string().min(1),documentVersion:u.number().int().nonnegative(),composition:q,placementUnitKey:u.string().min(1),relation:u.enum(["before","after","prepend","append"])}).strict(),yr=u.object({kind:u.literal("page-composition"),placementKey:u.string().min(1),documentVersion:u.number().int().nonnegative(),composition:ce,placementUnitKey:u.string().min(1),relation:u.enum(["before","after","prepend","append"])}).strict(),xr=u.object({kind:u.literal("page-unit"),composition:ce,placementUnitKey:u.string().min(1)}).strict(),Er=u.object({kind:u.literal("page-unit"),composition:q,placementUnitKey:u.string().min(1)}).strict();function st(e,n,s,a,i){let r=new Set;for(let[m,c]of e.entries()){let p=a(c);r.has(p)&&n.addIssue({code:"custom",path:[s,m,i],message:`Duplicate ${s} key: ${p}`}),r.add(p)}}var Uu=u.object({status:u.literal("supported"),version:u.number().int().nonnegative(),composition:q,container:Ou,sourceMembers:u.array(ju),businessMembers:u.array(Nu),placementUnits:u.array(Lu),placements:u.array(Mu)}).strict().superRefine((e,n)=>{st(e.sourceMembers,n,"sourceMembers",c=>c.key,"key"),st(e.businessMembers,n,"businessMembers",c=>c.key,"key"),st(e.placementUnits,n,"placementUnits",c=>c.key,"key"),st(e.placements,n,"placements",c=>c.placementKey,"placementKey");let s=new Set(e.sourceMembers.map(c=>c.key)),a=new Set(e.placementUnits.map(c=>c.key)),i=new Map(e.sourceMembers.map(c=>[c.key,c])),r=new Map(e.businessMembers.map(c=>[c.key,c]));for(let[c,p]of e.sourceMembers.entries()){p.containerKey!==e.container.key&&!s.has(p.containerKey)&&n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member parent must reference the page container or another source member."}),p.containerKey===p.key&&n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member cannot contain itself."});let I=new Set([p.key]),R=p.containerKey;for(;R!==e.container.key;){if(I.has(R)){n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member hierarchy must be acyclic."});break}I.add(R);let w=i.get(R);if(!w)break;R=w.containerKey}}e.container.kind==="jsx-container"&&!s.has(e.container.sourceMemberKey)&&n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."});for(let[c,p]of e.businessMembers.entries())s.has(p.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",c,"sourceMemberKey"],message:"Business member must reference a source member."}),a.has(p.containerKey)||n.addIssue({code:"custom",path:["businessMembers",c,"containerKey"],message:"Business member must reference a placement unit container."});for(let[c,p]of e.placementUnits.entries()){let I=i.get(p.containerKey);I?I.containerKey!==e.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 R=new Set;for(let[w,F]of p.businessMemberKeys.entries()){let B=r.get(F);if(!B){n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",w],message:"Placement unit must reference existing business members."});continue}R.has(F)&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",w],message:"Placement unit cannot reference the same business member twice."}),R.add(F),B.containerKey!==p.key&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",w],message:"Business member containerKey must match its placement unit."});let ee=B.sourceMemberKey,pe=new Set;for(;ee&&ee!==p.containerKey&&!pe.has(ee);)pe.add(ee),ee=i.get(ee)?.containerKey;ee!==p.containerKey&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",w],message:"Placement unit business members must belong to its source subtree."})}}for(let[c,p]of e.businessMembers.entries())e.placementUnits.find(R=>R.key===p.containerKey)?.businessMemberKeys.includes(p.key)||n.addIssue({code:"custom",path:["businessMembers",c,"containerKey"],message:"Business member must be listed by its placement unit container."});let m=new Map;for(let c of e.placementUnits)m.set(c.containerKey,(m.get(c.containerKey)??0)+1);for(let[c,p]of e.sourceMembers.entries())p.containerKey===e.container.key&&m.get(p.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,p]of e.placements.entries())Tr(p.composition,e.composition)||n.addIssue({code:"custom",path:["placements",c,"composition"],message:"Page placement composition must match page composition."}),p.documentVersion!==e.version&&n.addIssue({code:"custom",path:["placements",c,"documentVersion"],message:"Page placement version must match page composition version."}),a.has(p.placementUnitKey)||n.addIssue({code:"custom",path:["placements",c,"placementUnitKey"],message:"Placement option must reference an existing placement unit."})}),qu=u.object({status:u.literal("unsupported"),version:u.number().int().nonnegative(),composition:q,reason:ss,diagnostics:u.array(un)}).strict(),Fu=u.discriminatedUnion("status",[Uu,qu]),Rr=2,Nk="page-composition-v2",Ir=u.object({start:u.number().int().nonnegative(),end:u.number().int().nonnegative(),startLine:u.number().int().positive().optional(),startColumn:u.number().int().nonnegative().optional(),endLine:u.number().int().positive().optional(),endColumn:u.number().int().nonnegative().optional()}).strict().superRefine((e,n)=>{e.end<e.start&&n.addIssue({code:"custom",path:["end"],message:"Source range end must be greater than or equal to start."});let s=[e.startLine,e.startColumn,e.endLine,e.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."}),e.startLine!==void 0&&e.endLine!==void 0&&e.endLine<e.startLine&&n.addIssue({code:"custom",path:["endLine"],message:"Source range endLine must not precede startLine."}),e.startLine!==void 0&&e.endLine===e.startLine&&e.startColumn!==void 0&&e.endColumn!==void 0&&e.endColumn<e.startColumn&&n.addIssue({code:"custom",path:["endColumn"],message:"Source range endColumn must not precede startColumn."})}),Gu=u.object({key:u.string().min(1),instanceIndex:u.number().int().nonnegative().optional(),instanceCount:u.number().int().positive().optional(),textSegmentIndex:u.number().int().nonnegative().optional()}).strict().superRefine((e,n)=>{e.instanceIndex!==void 0&&e.instanceCount!==void 0&&e.instanceIndex>=e.instanceCount&&n.addIssue({code:"custom",path:["instanceIndex"],message:"instanceIndex must be lower than instanceCount."})}),Ku=u.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),Wu=u.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),zu=u.discriminatedUnion("kind",[u.object({kind:u.literal("virtual-route-root"),key:u.null(),routeReturn:u.object({sourceIdentity:Ei,sourceRange:Ir}).strict()}).strict(),u.object({kind:u.literal("jsx-container"),key:u.string().min(1),sourceMemberKey:u.string().min(1)}).strict(),u.object({kind:u.literal("starter-placeholder"),key:u.string().min(1),sourceMemberKey:u.string().min(1),replacementMode:u.literal("replace")}).strict()]),Bu=u.object({key:u.string().min(1),kind:Ku,parentKey:u.string().min(1).nullable(),childKeys:u.array(u.string().min(1)),order:u.number().int().nonnegative(),label:u.string().min(1),sourceIdentity:Ei,sourceRange:Ir.nullable(),atomicKind:Wu}).strict().superRefine((e,n)=>{let s=e.kind==="component-call"||e.kind==="native-jsx"?"none":e.kind;e.atomicKind!==s&&n.addIssue({code:"custom",path:["atomicKind"],message:`atomicKind must be ${s} for ${e.kind}.`});let a=new Set;for(let[i,r]of e.childKeys.entries())a.has(r)&&n.addIssue({code:"custom",path:["childKeys",i],message:`Duplicate child source member key: ${r}`}),a.add(r)}),Hu=u.object({key:u.string().min(1),sourceMemberKey:u.string().min(1),placementUnitKey:u.string().min(1),label:u.string().min(1),isIndependent:u.boolean()}).strict(),Vu=u.enum(["independent","atomic","container"]),$u=u.object({key:u.string().min(1),containerKey:u.string().min(1).nullable(),sourceMemberKeys:u.array(u.string().min(1)).min(1),businessMemberKeys:u.array(u.string().min(1)),order:u.number().int().nonnegative(),boundaryMode:Vu,isIndependent:u.boolean(),isMultiMember:u.boolean()}).strict().superRefine((e,n)=>{fr(e.sourceMemberKeys,n,"sourceMemberKeys","source member"),fr(e.businessMemberKeys,n,"businessMemberKeys","business member");let s=e.sourceMemberKeys.length>1||e.businessMemberKeys.length>1;e.isMultiMember!==s&&n.addIssue({code:"custom",path:["isMultiMember"],message:"isMultiMember must reflect the source and business member cardinality."});let a=e.boundaryMode==="independent";e.isIndependent!==a&&n.addIssue({code:"custom",path:["isIndependent"],message:"isIndependent must match boundaryMode."})}),Yu=u.enum(["before","after","prepend","append","replace"]),Xu=u.enum(["insert-sibling","insert-child","replace-placeholder"]),Qu=u.object({kind:u.literal("page-composition"),placementKey:u.string().min(1),documentVersion:u.number().int().nonnegative(),composition:q,placementUnitKey:u.string().min(1),containerKey:u.string().min(1).nullable(),relation:Yu,writeMode:Xu}).strict().superRefine((e,n)=>{let s=e.relation==="before"||e.relation==="after"?"insert-sibling":e.relation==="prepend"||e.relation==="append"?"insert-child":"replace-placeholder";e.writeMode!==s&&n.addIssue({code:"custom",path:["writeMode"],message:`writeMode must be ${s} for ${e.relation}.`})}),Zu=u.object({key:u.string().min(1),placementUnitKey:u.string().min(1),runtimeRefs:u.array(Gu).min(1)}).strict(),Ju=u.object({schemaVersion:u.literal(Rr),status:u.literal("supported"),version:u.number().int().nonnegative(),composition:q,container:zu,sourceMembers:u.array(Bu),businessMembers:u.array(Hu),placementUnits:u.array($u),placements:u.array(Qu),visualAnchors:u.array(Zu).optional(),diagnostics:u.array(un)}).strict().superRefine((e,n)=>{n_(e,n)}),e_=u.object({schemaVersion:u.literal(Rr),status:u.literal("unsupported"),version:u.number().int().nonnegative(),composition:q,reason:ss,diagnostics:u.array(un)}).strict(),t_=u.discriminatedUnion("status",[Ju,e_]),Lk=u.union([t_,Fu]);function fr(e,n,s,a){let i=new Set;for(let[r,m]of e.entries())i.has(m)&&n.addIssue({code:"custom",path:[s,r],message:`Duplicate ${a} key: ${m}`}),i.add(m)}function Tr(e,n){return Xs(e)===Xs(n)}function n_(e,n){st(e.sourceMembers,n,"sourceMembers",R=>R.key,"key"),st(e.businessMembers,n,"businessMembers",R=>R.key,"key"),st(e.placementUnits,n,"placementUnits",R=>R.key,"key"),st(e.placements,n,"placements",R=>R.placementKey,"placementKey"),st(e.visualAnchors??[],n,"visualAnchors",R=>R.key,"key"),s_(e,n);let s=new Map(e.sourceMembers.map(R=>[R.key,R])),a=new Map(e.businessMembers.map(R=>[R.key,R])),i=new Map(e.placementUnits.map(R=>[R.key,R]));i_(e,s,n),e.container.kind!=="virtual-route-root"&&(s.has(e.container.sourceMemberKey)||n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."}));let r=new Map,m=new Map,c=new Set;for(let[R,w]of e.placementUnits.entries()){w.containerKey!==e.container.key&&n.addIssue({code:"custom",path:["placementUnits",R,"containerKey"],message:"Placement unit containerKey must match the page container."});let F=`${w.containerKey??"<virtual>"}:${w.order}`;c.has(F)&&n.addIssue({code:"custom",path:["placementUnits",R,"order"],message:"Placement unit order must be unique within its container."}),c.add(F);for(let[B,ee]of w.sourceMemberKeys.entries()){s.has(ee)||n.addIssue({code:"custom",path:["placementUnits",R,"sourceMemberKeys",B],message:"Placement unit must reference existing source members."});let pe=r.get(ee);pe&&pe!==w.key&&n.addIssue({code:"custom",path:["placementUnits",R,"sourceMemberKeys",B],message:`Source member is already assigned to ${pe}.`}),r.set(ee,w.key)}for(let[B,ee]of w.businessMemberKeys.entries()){let pe=a.get(ee);if(!pe){n.addIssue({code:"custom",path:["placementUnits",R,"businessMemberKeys",B],message:"Placement unit must reference existing business members."});continue}pe.placementUnitKey!==w.key&&n.addIssue({code:"custom",path:["placementUnits",R,"businessMemberKeys",B],message:"Placement unit and business member must reference each other."}),w.sourceMemberKeys.includes(pe.sourceMemberKey)||n.addIssue({code:"custom",path:["placementUnits",R,"businessMemberKeys",B],message:"Business member sourceMemberKey must belong to the placement unit."});let Xt=m.get(ee);Xt&&Xt!==w.key&&n.addIssue({code:"custom",path:["placementUnits",R,"businessMemberKeys",B],message:`Business member is already assigned to ${Xt}.`}),m.set(ee,w.key)}}for(let[R,w]of e.businessMembers.entries()){s.has(w.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",R,"sourceMemberKey"],message:"Business member must reference a source member."});let F=i.get(w.placementUnitKey);if(!F){n.addIssue({code:"custom",path:["businessMembers",R,"placementUnitKey"],message:"Business member must reference a placement unit."});continue}F.businessMemberKeys.includes(w.key)||n.addIssue({code:"custom",path:["businessMembers",R,"placementUnitKey"],message:"Business member and placement unit must reference each other."}),F.sourceMemberKeys.includes(w.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",R,"sourceMemberKey"],message:"Business member sourceMemberKey must belong to its placement unit."});let B=F.isIndependent&&F.businessMemberKeys.length===1;w.isIndependent!==B&&n.addIssue({code:"custom",path:["businessMembers",R,"isIndependent"],message:"Business member independence must match its placement unit boundary."})}let p=new Set;for(let[R,w]of e.placements.entries()){w.documentVersion!==e.version&&n.addIssue({code:"custom",path:["placements",R,"documentVersion"],message:"Page placement version must match page composition version."}),Tr(w.composition,e.composition)||n.addIssue({code:"custom",path:["placements",R,"composition"],message:"Page placement composition must match page composition."});let F=i.get(w.placementUnitKey);F?w.containerKey!==F.containerKey&&n.addIssue({code:"custom",path:["placements",R,"containerKey"],message:"Placement containerKey must match its placement unit."}):n.addIssue({code:"custom",path:["placements",R,"placementUnitKey"],message:"Placement option must reference a placement unit."});let B=`${w.placementUnitKey}:${w.relation}`;p.has(B)&&n.addIssue({code:"custom",path:["placements",R,"relation"],message:"A placement unit cannot expose the same relation more than once."}),p.add(B),w.relation==="replace"&&e.container.kind!=="starter-placeholder"&&n.addIssue({code:"custom",path:["placements",R,"relation"],message:"replace is only valid for a starter placeholder container."}),e.container.kind==="starter-placeholder"&&w.relation!=="replace"&&n.addIssue({code:"custom",path:["placements",R,"relation"],message:"Starter placeholder placements must use replace."})}let I=new Set;for(let[R,w]of(e.visualAnchors??[]).entries())i.has(w.placementUnitKey)||n.addIssue({code:"custom",path:["visualAnchors",R,"placementUnitKey"],message:"Visual anchor must reference a placement unit."}),I.has(w.placementUnitKey)&&n.addIssue({code:"custom",path:["visualAnchors",R,"placementUnitKey"],message:"A placement unit may expose only one visual anchor."}),I.add(w.placementUnitKey)}function s_(e,n){let s=[];e.container.key!==null&&s.push({key:e.container.key,path:["container","key"],namespace:"container"});for(let[i,r]of e.sourceMembers.entries())s.push({key:r.key,path:["sourceMembers",i,"key"],namespace:"source member"});for(let[i,r]of e.businessMembers.entries())s.push({key:r.key,path:["businessMembers",i,"key"],namespace:"business member"});for(let[i,r]of e.placementUnits.entries())s.push({key:r.key,path:["placementUnits",i,"key"],namespace:"placement unit"});for(let[i,r]of(e.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 i_(e,n,s){let a=new Set;for(let[i,r]of e.sourceMembers.entries()){let m=`${r.parentKey??"<root>"}:${r.order}`;if(a.has(m)&&s.addIssue({code:"custom",path:["sourceMembers",i,"order"],message:"Source member order must be unique among siblings."}),a.add(m),r.parentKey===r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member cannot be its own parent."}),r.parentKey!==null){let I=n.get(r.parentKey);I?I.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[I,R]of r.childKeys.entries()){if(R===r.key){s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",I],message:"Source member cannot be its own child."});continue}let w=n.get(R);w?w.parentKey!==r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",I],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",I],message:"Source child key must reference a source member."})}let c=new Set,p=r;for(;p;){if(c.has(p.key)){s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member graph must be acyclic."});break}c.add(p.key),p=p.parentKey===null?void 0:n.get(p.parentKey)}}}var _n=_.enum(["update-text","update-array-item","remove-node","insert-child","replace-node","move-node","set-class-name-source","set-props","apply-style-draft","source-edit","insert-page-resource","delete-page-source"]),a_=_.discriminatedUnion("kind",[_.object({kind:_.literal("node"),key:_.string().min(1)}).strict(),xr,_.object({kind:_.literal("route"),composition:ce}).strict(),_.object({kind:_.literal("source-file"),path:Se}).strict(),_.object({kind:_.literal("source-batch"),paths:_.array(Se).min(1)}).superRefine((e,n)=>{let s=new Set;for(let[a,i]of e.paths.entries())s.has(i)&&n.addIssue({code:"custom",path:["paths",a],message:`Duplicate source target path: ${i}`}),s.add(i)}).strict(),_.object({kind:_.literal("project")}).strict()]),o_=_.discriminatedUnion("kind",[_.object({kind:_.literal("node"),key:_.string().min(1)}).strict(),Er,_.object({kind:_.literal("route"),composition:q}).strict(),_.object({kind:_.literal("source-file"),path:Se}).strict(),_.object({kind:_.literal("source-batch"),paths:_.array(Se).min(1)}).strict(),_.object({kind:_.literal("project")}).strict()]),Ar=_.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"]),Pr=_.enum(["hover","active","focus","disabled"]),wr=_.enum(["sm","md","lg","xl","2xl"]),kr=_.union([_.object({relation:_.enum(["before","after"]),anchorKey:_.string().min(1)}),_.object({relation:_.enum(["prepend","append"]),parentKey:_.string().min(1)}),yr]),Cr=_.object({kind:_.literal("component-call"),component:_.never().optional(),materialization:Tt,props:_.record(_.string(),_.never()).optional()}).strict(),r_=_.union([_.object({kind:_.literal("native-tag"),tag:_.string().min(1),text:_.string().optional()}),_.object({kind:_.literal("component-call"),component:_.object({source:_.string().min(1),exportName:_.string().min(1)}),materialization:_.never().optional(),props:_.record(_.string(),_.unknown()).optional()}).strict(),Cr]),c_=_.discriminatedUnion("kind",[_.object({kind:_.literal("update-text"),segmentIndex:_.number().int().min(0),value:_.string()}),_.object({kind:_.literal("update-array-item"),segmentIndex:_.number().int().min(0),index:_.number().int().min(0),value:_.string()}),_.object({kind:_.literal("remove-node")}),_.object({kind:_.literal("insert-child"),node:r_,position:_.union([kr,br])}),_.object({kind:_.literal("replace-node"),node:Cr}),_.object({kind:_.literal("move-node"),target:kr,preserveBindings:_.boolean().optional()}),_.object({kind:_.literal("set-class-name-source"),filePath:_.string().min(1),expectedVersion:_.object({documentVersion:_.number().int().nonnegative(),contentHash:_.string().min(1)}),oldAttrRaw:_.string().min(1).nullable(),oldAttrRange:tt.nullable(),openingElementRange:tt,newAttrRaw:_.string().min(1).nullable(),intent:yi}),hr,_.object({kind:_.literal("apply-style-draft"),className:_.object({filePath:_.string().min(1),expectedVersion:_.object({documentVersion:_.number().int().nonnegative(),contentHash:_.string().min(1)}),oldAttrRaw:_.string().min(1).nullable(),oldAttrRange:tt.nullable(),openingElementRange:tt,newAttrRaw:_.string().min(1).nullable(),intent:yi}).optional(),props:_.partialRecord(Sr,_.string()).optional()}).superRefine((e,n)=>{!e.className&&!e.props&&n.addIssue({code:"custom",message:"apply-style-draft requires className or props"})}),_.object({kind:_.literal("source-edit"),conflictPolicy:_.enum(["compare-and-swap","overwrite"]),edits:_.array(_.discriminatedUnion("operation",[_.object({operation:_.literal("upsert"),path:Se,content:_.string(),baseContentHash:_.string().min(1).nullable().optional()}).strict().superRefine((e,n)=>{Zs(e.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit upsert only accepts allowlisted text source files"}),e.content.includes("\0")&&n.addIssue({code:"custom",path:["content"],message:"source-edit content must be valid text"})}),_.object({operation:_.literal("delete"),path:Se,capability:po,confirmDelete:_.literal(!0),confirmPath:Se,baseContentHash:_.string().min(1).nullable().optional()}).strict().superRefine((e,n)=>{e.capability!==Qs&&n.addIssue({code:"custom",path:["capability"],message:"delete requires source-delete capability"}),e.confirmPath!==e.path&&n.addIssue({code:"custom",path:["confirmPath"],message:"delete confirmation path must match edit path"}),Zs(e.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit delete only accepts allowlisted text source files"});let s=Js(e.path);s&&n.addIssue({code:"custom",path:["path"],message:`Protected source file cannot be deleted: ${e.path} (${s})`})})])).min(1),reason:_.string().min(1).optional()}).strict().superRefine((e,n)=>{let s=new Set;for(let[a,i]of e.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),e.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"})}),_.object({kind:_.literal("insert-page-resource"),artifact:fi}).strict(),_.object({kind:_.literal("delete-page-source"),expectedUrlPath:_.string().startsWith("/")}).strict()]),vr=_.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"]),Dr=_.object({code:vr,message:_.string().min(1),details:_.record(_.string(),_.unknown()).optional()}),Ut=_.object({key:_.string().min(1),instanceIndex:_.number().int().nonnegative().optional(),instanceCount:_.number().int().positive().optional()}),Ri=_.object({id:_.string().min(1),siteId:T,baseSnapshotId:k,composition:ce,kind:_n,target:a_,documentVersion:_.number().int().nonnegative(),selectionRef:Ut.optional(),mutationContext:pn.optional(),params:c_}).strict().superRefine((e,n)=>{if(e.kind!==e.params.kind&&n.addIssue({code:"custom",path:["params","kind"],message:"params.kind must match operation kind"}),e.kind==="source-edit"){if(e.target.kind!=="source-file"&&e.target.kind!=="source-batch")n.addIssue({code:"custom",path:["target","kind"],message:"source-edit requires a source-file or source-batch target"});else if(e.params.kind==="source-edit"){let s=e.params.edits.map(i=>i.path),a=e.target.kind==="source-file"?[e.target.path]:e.target.paths;d_(s,a)||n.addIssue({code:"custom",path:["target"],message:"source-edit target paths must match edit paths"})}}else(e.target.kind==="source-file"||e.target.kind==="source-batch")&&n.addIssue({code:"custom",path:["target","kind"],message:"source targets are only valid for source-edit"});e.target.kind==="page-unit"&&(e.kind!=="insert-child"&&e.kind!=="replace-node"&&e.kind!=="move-node"&&e.kind!=="remove-node"&&n.addIssue({code:"custom",path:["target","kind"],message:"page-unit target is only valid for page-level operations"}),e.kind==="move-node"&&e.params.kind==="move-node"&&(!("kind"in e.params.target)||e.params.target.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","target","kind"],message:"page-unit move-node target requires page-composition placement"})),e.params.kind==="insert-child"&&"kind"in e.params.position&&e.params.position.kind==="page-composition"&&e.target.kind!=="page-unit"&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-composition position requires page-unit target"}),e.kind==="replace-node"&&e.target.kind!=="page-unit"&&n.addIssue({code:"custom",path:["target","kind"],message:"replace-node requires a page-unit target"}),e.kind==="insert-page-resource"||e.kind==="delete-page-source"?e.target.kind!=="project"&&n.addIssue({code:"custom",path:["target","kind"],message:`${e.kind} requires a project target`}):e.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project target is only valid for insert-page-resource or delete-page-source"}),e.kind==="insert-child"&&e.target.kind==="page-unit"&&e.params.kind==="insert-child"&&(!("kind"in e.params.position)||e.params.position.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-unit target requires page-composition position"})}),Xk=Ri,m_=_.object({kind:_.literal("insert-page-resource"),package_instance_id:_.string().min(1),pages:_.array(ir).min(1)}).strict().superRefine((e,n)=>{let s=new Set,a=new Set;for(let[i,r]of e.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)}),l_=_.object({kind:_.literal("delete-page-source"),deleted_files:_.array(_.string().min(1)),updated_files:_.array(_.string().min(1)),preserved_shared_files:_.array(_.string().min(1)),warnings:_.array(_.string().min(1))}).strict(),p_=_.discriminatedUnion("kind",[m_,l_]),Or=_.object({requestId:_.string().min(1),kind:_n,composition:q,target:o_,resultVersion:_.number().int().nonnegative(),affectedFiles:_.array(_.string().min(1)).optional(),selectionRef:Ut.optional(),output:p_.optional()}).strict(),Ii=Or.superRefine((e,n)=>{let s=e.kind==="insert-page-resource"||e.kind==="delete-page-source";s&&e.target.kind!=="project"?n.addIssue({code:"custom",path:["target","kind"],message:`${e.kind} result requires a project target`}):!s&&e.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project result target requires a project operation"}),s&&!e.output&&n.addIssue({code:"custom",path:["output"],message:`${e.kind} result requires typed output`}),e.output&&e.output.kind!==e.kind&&n.addIssue({code:"custom",path:["output","kind"],message:"output.kind must match operation kind"})}),Qk=dr({dataSchema:Ii,codeSchema:vr,failureDataSchema:Or.partial()});function d_(e,n){return e.length===n.length&&e.every((s,a)=>s===n[a])}var u_=ne.enum(["component","page","pages"]),__=ne.object({resource_kind:u_,resource_name:ne.string().trim().min(1).max(200),file_count:ne.number().int().min(1).max(64),total_bytes:ne.number().int().min(0).max(4*1024*1024),content_digest:ne.string().regex(/^sha256:[a-f0-9]{64}$/),custom_prompt:ne.string().trim().min(1).max(4e3).optional(),final_routes:ne.array(ne.string().min(1)).max(64)}).strict(),g_=ne.discriminatedUnion("kind",[ne.object({kind:ne.literal("none")}).strict(),ne.object({kind:ne.literal("primary"),items:ne.array(ne.object({label:ne.string().trim().min(1).max(120),href:ne.string().startsWith("/").max(200)}).strict()).min(1).max(64)}).strict().superRefine((e,n)=>{let s=new Set;for(let[a,i]of e.items.entries())s.has(i.href)&&n.addIssue({code:"custom",path:["items",a,"href"],message:`Duplicate navigation href: ${i.href}`}),s.add(i.href)})]),h_=ne.object({base_snapshot_id:ne.string().min(1),operation:Ri,navigation_selection:g_.optional()}).strict().superRefine((e,n)=>{e.base_snapshot_id!==e.operation.baseSnapshotId&&n.addIssue({code:"custom",path:["operation","baseSnapshotId"],message:"Resource operation baseSnapshotId must match base_snapshot_id."})});function S_(e){return(e.kind==="insert-child"||e.kind==="replace-node")&&(e.params.kind==="insert-child"||e.params.kind==="replace-node")&&e.params.node.kind==="component-call"&&"materialization"in e.params.node&&e.params.node.materialization?[e.params.node.materialization]:e.kind==="insert-page-resource"&&e.params.kind==="insert-page-resource"?[...e.params.artifact.components.map(n=>n.materialization),...e.params.artifact.pages.map(n=>n.materialization)]:[]}var jr=ne.object({id:ne.string().min(1),tenant_id:ne.string().min(1),site_id:ne.string().min(1),run_id:ne.string().min(1).optional(),correlation_id:ne.string().min(1).optional(),sent_at:ne.string().min(1),type:ne.literal("client.resource.operation.create"),payload:ne.object({client_message_id:ne.string().min(1),display:__,transient_resource_input:h_}).strict()}).strict().superRefine((e,n)=>{let{display:s,transient_resource_input:a}=e.payload;e.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."}),(s.resource_kind==="component"?a.operation.kind==="insert-child"||a.operation.kind==="replace-node":a.operation.kind==="insert-page-resource")||n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","kind"],message:s.resource_kind==="component"?"component resources require insert-child or replace-node.":`${s.resource_kind} resources require insert-page-resource.`});let m=S_(a.operation).flatMap(p=>p.files),c=m.reduce((p,I)=>p+new TextEncoder().encode(I.content).byteLength,0);if(m.length>ci&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate file count limit."}),c>mi&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate content byte limit."}),s.file_count!==m.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 p=a.operation.params.artifact;p.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 I=p.pages.map(R=>R.final_route);(I.length!==s.final_routes.length||I.some((R,w)=>R!==s.final_routes[w]))&&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 p=new Set(s.final_routes);for(let[I,R]of a.navigation_selection.items.entries())p.has(R.href)||n.addIssue({code:"custom",path:["payload","transient_resource_input","navigation_selection","items",I,"href"],message:"Navigation selection href must reference a final resource route."})}});import{z as P}from"zod";var f_=["with_website","without_website"],is=P.enum(f_),Ti=P.string().trim().url().refine(e=>{let n=new URL(e).protocol;return n==="http:"||n==="https:"},{message:"Website must use the http or https protocol."}),b_=["welcome","website_scan","customer_materials","analysis","diagnosis","strategy","structure_planning","preview_personalization","publishing"],gn=P.enum(b_),y_=["company_info","website_crawl","website_basic_info_extract","website_metrics_evaluate","intelligent_analysis","strategy_recommendation"],Lr=P.enum(y_),x_=["started","running","succeeded","failed","invalidated"],Mr=P.enum(x_),E_=["draft","structure_saved","generating","workspace_ready"],ki=P.enum(E_),R_=["not_deployed","deploying","deployed"],Ai=P.enum(R_),I_=["active","completed"],T_=P.enum(I_),k_=["completed","current","locked"],A_=P.enum(k_),Ur={draft:10,structure_saved:20,generating:30,workspace_ready:40},qr={not_deployed:10,deploying:20,deployed:30},Fr={active:10,completed:20},Gr={started:10,running:20,succeeded:30,failed:40,invalidated:50};function as(e){return new Map(Object.entries(e).map(([n,s])=>[s,n]))}var P_=as(Ur),w_=as(qr),C_=as(Fr),v_=as(Gr);function c1(e){let n=P_.get(e);if(!n)throw new Error(`Unknown site build status code: ${e}`);return n}function m1(e){let n=w_.get(e);if(!n)throw new Error(`Unknown site deployment status code: ${e}`);return n}function l1(e){let n=C_.get(e);if(!n)throw new Error(`Unknown site workflow status code: ${e}`);return n}function p1(e){let n=v_.get(e);if(!n)throw new Error(`Unknown task execution status code: ${e}`);return n}function d1(e){return Ur[e]}function u1(e){return qr[e]}function _1(e){return Fr[e]}function g1(e){return Gr[e]}var Pi=[{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}]}}],h1=Pi[0].definitions,Kr=P.number().int().min(1),D_=P.object({id:V,flow_type:is,definition_version:Kr,node_code:gn,label:P.string().min(1),sort_order:P.number().int().min(1),is_enabled:P.boolean(),state:A_}),Wr=P.object({id:Za,tenant_id:P.string().min(1),site_id:T,workflow_id:Ve,node_code:gn,task_type:Lr,external_task_id:P.string().min(1),execution_status:Mr,idempotency_key:P.string().min(1),attempt_no:P.number().int().min(1),source_crawl_task_ref_id:P.string().uuid().nullable(),succeeded_at:P.string().min(1).nullable(),superseded_at:P.string().min(1).nullable(),site_url:P.string().url().nullable(),created_at:P.string().min(1),updated_at:P.string().min(1)}),O_=P.object({id:Ve,tenant_id:P.string().min(1),site_id:T,flow_type:is,website:Ti.nullable(),definition_version:Kr,current_node_code:gn,status:T_,started_at:P.string().min(1),completed_at:P.string().min(1).nullable(),created_at:P.string().min(1),updated_at:P.string().min(1)}),wi=P.object({workflow:O_,menu:P.array(D_),task_refs:P.array(Wr),site:P.object({default_locale:fe.optional(),status:ki,deployment_status:Ai,archived_at:P.string().min(1).nullable(),current_sitemap_id:P.string().nullable().optional(),current_sitemap_version:P.number().int().positive().nullable().optional(),confirmed_sitemap_id:P.string().nullable().optional(),confirmed_sitemap_version:P.number().int().positive().nullable().optional(),structure_confirmed_at:P.string().min(1).nullable().optional(),current_snapshot_id:P.string().nullable(),deployed_url:P.string().url().nullable(),cms_site_id:P.string().min(1).nullish()})}),S1=M(wi),f1=M(Wr),Nr=P.array(P.string().min(1).max(64)).max(16).optional(),b1=P.discriminatedUnion("flow_type",[P.object({flow_type:P.literal("with_website"),website:Ti,client_capabilities:Nr}).strict(),P.object({flow_type:P.literal("without_website"),website:P.null().optional(),client_capabilities:Nr}).strict()]),y1=P.object({expected_current_node:P.literal("website_scan"),website:Ti}).strict(),x1=P.object({expected_current_node:gn}).strict(),E1=P.object({expected_current_node:P.literal("publishing")}).strict(),j_=P.object({node_code:gn,task_type:Lr,external_task_id:P.string().min(1).max(255),idempotency_key:P.string().min(1).max(255),site_url:P.string().url().optional()}),R1=j_.extend({workflow_id:Ve}).strict(),I1=P.object({external_task_id:P.string().min(1).max(255),execution_status:Mr}),N_=P.object({previous_external_task_id:P.string().min(1).max(255),external_task_id:P.string().min(1).max(255),idempotency_key:P.string().min(1).max(255),site_url:P.string().url().optional()}),T1=N_.extend({workflow_id:Ve}).strict(),L_=P.object({previous_external_task_id:P.string().min(1).max(255),external_task_id:P.string().min(1).max(255),idempotency_key:P.string().min(1).max(255),site_url:P.string().url()}),k1=L_.extend({workflow_id:Ve}).strict(),A1=P.object({}).strict();function M_(e,n,s){return e.find(a=>a.definition_version===s)?.definitions[n]}function U_(e,n){return M_(Pi,e,n)}function q_(e,n=1){let s=U_(e,n);if(!s)throw new Error(`Unknown workflow definition: ${e} v${n}.`);return s}function F_(e,n,s){let a=new Set(s);return e.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 P1(e,n){return F_(Pi,e,n)}function w1(e,n){return q_(e).findIndex(s=>s.node_code===n)}function C1(e,n){return e==="website_scan"?n==="website_crawl"||n==="website_basic_info_extract"||n==="website_metrics_evaluate":e==="customer_materials"?n==="company_info":e==="analysis"?n==="intelligent_analysis":e==="strategy"?n==="strategy_recommendation":!1}function v1(e,n){if(e===n)return n;if(!{started:["running","succeeded","failed","invalidated"],running:["succeeded","failed","invalidated"],succeeded:["invalidated"],failed:["invalidated"],invalidated:[]}[e].includes(n))throw new Error(`Invalid task execution status transition: ${e} -> ${n}`);return n}function D1(e,n){if(e===n)return n;if(!{draft:["structure_saved"],structure_saved:["generating","draft"],generating:["workspace_ready","structure_saved"],workspace_ready:[]}[e].includes(n))throw new Error(`Invalid site build status transition: ${e} -> ${n}`);return n}import{z as E}from"zod";var Ci=E.string().min(1).max(120).regex(/^[a-z][a-z0-9_-]*$/),De=E.string().min(1).max(120).regex(/^[A-Za-z_][A-Za-z0-9_]*$/),G_=E.enum(["text","select","multi_select","tags","category_list","boolean","number"]),hn=E.string().min(1).max(512).regex(/^\/(?:[^?#]*)$/),K_=E.object({minimum:E.number().finite(),maximum:E.number().finite(),step:E.number().finite().positive()}).strict().refine(e=>e.minimum<e.maximum,{message:"minimum must be less than maximum"}),W_=E.string().trim().min(1).max(100),Br=E.array(W_).max(5).refine(e=>new Set(e.map(n=>n.toLowerCase())).size===e.length,{message:"popular_terms must be unique ignoring case"}),L1=E.array(E.string()).max(20).transform(e=>{let n=new Set;return e.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)}),Hr=E.object({filter_enabled:E.boolean(),selected_fields:E.array(De).max(64),selected_card_fields:E.array(De).max(64).default([]),popular_terms_enabled:E.boolean().default(!1),popular_terms:Br.optional()}).strict(),z_=E.object({app_slug:Ci}).extend(Hr.shape).strict(),vi=E.object({kind:E.literal("product_search_confirmation"),baseline_snapshot_id:k,target_route_id:hn,applications:E.array(E.object({app_slug:Ci,label:E.string().min(1).max(200),popular_terms:Br.default([]),current_config:Hr.nullable().default(null),affected_routes:E.array(hn).max(64).default([]),fields:E.array(E.object({field_name:De,label:E.string().min(1).max(200),value_shape:G_,option_count:E.number().int().nonnegative().optional(),filter_meta:K_.optional()}).strict()).max(64)}).strict()).min(1).max(12),current_config:z_.nullable().optional(),affected_routes:E.array(hn).min(1).max(64).optional()}).strict(),B_=E.object({kind:E.literal("product_search_confirmation"),action:E.enum(["confirm","modify"]),app_slug:Ci,filter_enabled:E.boolean(),popular_terms_enabled:E.boolean().default(!1),selected_fields:E.array(De).max(64),selected_card_fields:E.array(De).max(64).default([])}).strict().superRefine((e,n)=>{e.filter_enabled&&e.selected_fields.length===0&&n.addIssue({code:"custom",path:["selected_fields"],message:"selected_fields must not be empty while filters are enabled"}),new Set(e.selected_fields).size!==e.selected_fields.length&&n.addIssue({code:"custom",path:["selected_fields"],message:"selected_fields must be unique"}),new Set(e.selected_card_fields).size!==e.selected_card_fields.length&&n.addIssue({code:"custom",path:["selected_card_fields"],message:"selected_card_fields must be unique"})}),os=E.union([B_,E.object({kind:E.literal("product_search_confirmation"),action:E.literal("cancel")}).strict()]),Sn=E.union([E.string().max(255),E.number().finite(),E.boolean()]),H_=E.object({values:E.array(Sn).min(1).max(20).refine(e=>new Set(e.map(n=>`${typeof n}:${String(n)}`)).size===e.length,{message:"values must be unique"})}).strict(),V_=E.object({min:E.number().finite().optional(),max:E.number().finite().optional(),include_unlabeled:E.boolean().optional()}).strict().refine(e=>e.min!==void 0||e.max!==void 0||e.include_unlabeled===!0,{message:"a numeric boundary or include_unlabeled is required"}).refine(e=>e.min===void 0||e.max===void 0||e.min<=e.max,{message:"min must not be greater than max"}),$_=E.object({q:E.string().max(200),page:E.number().int().min(1).max(500),page_size:E.union([E.literal(9),E.literal(20)]),sort:E.enum(["published_at_desc","published_at_asc","product_name_asc","product_name_desc"]),filters:E.record(De,E.union([H_,V_])).superRefine((e,n)=>{Object.keys(e).length>12&&n.addIssue({code:"custom",message:"filters must contain at most 12 fields"})}),display_fields:E.array(De).max(64).default([]),missing_count_fields:E.array(De).max(12).default([]),relaxation_count_fields:E.array(De).max(12).default([]),facets:E.array(E.object({field:De,query:E.string().max(100),page:E.number().int().min(1).max(100),page_size:E.literal(10),include_values:E.array(Sn).max(20)}).strict()).max(8)}).strict(),zr=E.object({value:Sn,label:E.string().max(200),count:E.number().int().nonnegative()}).strict(),Y_=E.union([Sn,E.array(Sn).max(50)]),X_=E.object({items:E.array(E.object({id:E.number().int().positive(),thumbnail:E.string().max(2048).nullable(),title:E.string().max(300),summary:E.string().max(2e3),category:E.string().max(300).nullable(),field_values:E.record(De,Y_).default({}),url:E.string().min(1).max(2048)}).strict()).max(20),page:E.object({total:E.number().int().nonnegative(),page:E.number().int().positive(),page_size:E.union([E.literal(9),E.literal(20)])}).strict(),facets:E.array(E.object({field:De,total:E.number().int().nonnegative(),page:E.number().int().positive(),page_size:E.literal(10),values:E.array(zr).max(10),selected_values:E.array(zr).max(20)}).strict()).max(8),missing_counts:E.record(De,E.number().int().nonnegative()).default({}),relaxation_counts:E.record(De,E.number().int().nonnegative()).default({})}).strict(),M1=E.object({contract_version:E.literal(1),request:$_,response:X_}).strict();import{z as je}from"zod";var Di=4,F1=20,G1=1440*60*1e3,K1=1e6,Q_=["image/png","image/jpeg","image/webp"],Oi=je.enum(Q_),W1="WORKSPACE_ATTACHMENT_UNSUPPORTED_FORMAT",z1="WORKSPACE_ATTACHMENT_TOO_LARGE",B1="WORKSPACE_ATTACHMENT_LIMIT",H1="WORKSPACE_ATTACHMENT_BOUND",V1=10,$1=3600*1e3,Y1="WORKSPACE_ATTACHMENT_URL_REJECTED",X1="WORKSPACE_ATTACHMENT_CAPTURE_FAILED",Q1="WORKSPACE_ATTACHMENT_CAPTURE_BUSY",Z1="WORKSPACE_ATTACHMENT_CAPTURE_TIMEOUT",J1="WORKSPACE_ATTACHMENT_CAPTURE_BUDGET_EXCEEDED",eA="WORKSPACE_ATTACHMENT_CAPTURE_UNAVAILABLE",tA=je.object({attachment_id:je.string().min(1),media_type:Oi,width:je.number().int().positive(),height:je.number().int().positive(),size_bytes:je.number().int().nonnegative(),filename:je.string().min(1).max(120),image_url:je.string().min(1),source_url:je.string().min(1).optional(),created_at:je.string().min(1)}).strict(),nA=je.object({url:je.string().url().max(2048),full_page:je.boolean().optional()}).strict(),Vr="[A-Za-z0-9_-]+",Z_=new RegExp(`^/sites/(${Vr})/workspace/attachments/(${Vr})/image$`);function sA(e,n){return`/sites/${encodeURIComponent(e)}/workspace/attachments/${encodeURIComponent(n)}/image`}function ji(e){let n=Z_.exec(e);return n?{site_id:n[1],attachment_id:n[2]}:null}function iA(e){let n=[];for(let s of e){if(s.type!=="file"||typeof s.url!="string")continue;let a=ji(s.url);a&&n.push({attachment_id:a.attachment_id,site_id:a.site_id,media_type:typeof s.mediaType=="string"?s.mediaType:"",filename:typeof s.filename=="string"&&s.filename.trim()!==""?s.filename:"image",url:s.url})}return n}import{z as fn}from"zod";var J_=["deployment_queued","prepare_source","build_artifact","publish_site","site_released","cleanup_release"],eg=fn.enum(J_),tg=fn.enum(["running","succeeded","failed"]),ng=fn.object({code:eg,status:tg,message:fn.string().trim().min(1)}).strict(),$r=fn.array(ng);import{z as A}from"zod";var sg=A.enum(["pending","running","succeeded","failed"]),ig=A.enum(["TASK_FAILED","WEBSITE_UNREACHABLE"]),ag=A.object({task_id:A.string().uuid(),site_url:A.string().url(),crawler_task_id:A.string().min(1).max(255).nullable(),crawler_error_code:ig.nullable().optional(),crawler_failure_stage:A.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]).nullable().optional(),page_count:A.number().int().min(0).max(20),status:sg,error:A.string().nullable(),created_at:A.string().min(1),updated_at:A.string().min(1)}),lA=M(ag),Ni=A.enum(["existing_site","new_site"]),Xr=A.enum(["google_indexing","ai_recommendation","qualification_verifiability","content_freshness","inquiry_form","inquiry_response","privacy_compliance","prohibited_content"]),Yr=A.object({observed_result:A.enum(["pass","fail","unknown"])}).strict(),Qr=A.object({kind:A.literal("ai_crawlability"),checks:A.object({ai_access_guidance:Yr,structured_data_presence:Yr}).strict()}).strict(),Li=A.object({label:A.string().trim(),value:A.union([A.string(),A.number(),A.boolean(),A.null()]),summary:A.string().trim(),tone:A.enum(["good","warn","bad","unknown"]),status:A.enum(["ok","unknown"]),assessment:Qr.optional()}),rs=A.object({key:A.string().trim().min(1).max(100),label:A.string().trim().min(1).max(100),value:A.union([A.string().max(1e3),A.number(),A.boolean(),A.null()]),tone:A.enum(["good","warn","bad","unknown"]),status:A.enum(["ok","unknown"]),evidence:A.string().trim().max(2e3).optional(),assessment:Qr.optional()}).strict(),og=A.object({url:A.string().url().max(2048),title:A.string().trim().max(300),words:A.number().int().nonnegative().max(1e7)}).strict(),rg=A.object({site_url:A.string().url().max(2048),scanned_at:A.string().datetime({offset:!0}),reach:A.array(rs).max(64),trust:A.array(rs).max(64),convert:A.array(rs).max(64),safe:A.array(rs).max(64),pages:A.array(og).max(100)}).strict(),cs=A.object({company_task_id:A.string().min(1).max(128),scan_task_id:A.string().min(1).max(128),type:Ni,result:A.object({company_name:A.string(),website:A.string().url().optional(),primary_product:A.string(),current_market:A.string(),qualifications:A.string(),scan_cards:A.record(A.string(),Li),scan_result:rg.optional()})}),cg=A.object({saved:A.literal(!0),company_task_id:A.string().min(1).max(128),scan_task_id:A.string().min(1).max(128)}),pA=M(cg),mg=A.enum(["snapshot","task"]),lg=cs.shape.result.extend({type:Ni,structured_facts:A.unknown().optional()}).extend({company_name:A.string(),primary_product:A.string(),current_market:A.string(),qualifications:A.string()}),pg=A.object({site_id:A.string().min(1).max(128),company_task_id:A.string().min(1).max(128),scan_task_id:A.string().min(1).max(128),type:Ni,data_source:mg,result:lg}),dA=M(pg.nullable());import{z as be}from"zod";var dt=be.enum(["company","product_service","case_qualification","market","contact_inquiry","privacy_compliance","news_freshness"]),dg=be.object({ordinal:be.number().int().min(1).max(1e4),path:be.string().min(1).max(2048).refine(e=>!gg(e),{message:"path must be a site-relative path, not an absolute URL"}),last_modified:be.string().max(64).nullable()}).strict(),gA=be.object({candidates:be.array(dg).min(1).max(1e4),selection_limit:be.number().int().min(1).max(19)}).strict().superRefine((e,n)=>{let s=e.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}}),ug=be.object({ordinal:be.number().int().positive().max(1e4),roles:be.array(dt).min(1).max(7)}).strict(),_g=be.object({role:dt,status:be.enum(["selected","not_found"]),selected_ordinals:be.array(be.number().int().positive().max(1e4)).max(19)}).strict(),hA=be.object({selections:be.array(ug).max(19),coverage:be.array(_g).length(7)}).strict().superRefine((e,n)=>{let s=new Set;for(let[i,r]of e.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 dt.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 e.selections)for(let r of i.roles){let m=a.get(r)??new Set;m.add(i.ordinal),a.set(r,m)}for(let[i,r]of e.coverage.entries()){let m=a.get(r.role);r.selected_ordinals.some(p=>!m?.has(p))&&n.addIssue({code:"custom",path:["coverage",i,"selected_ordinals"],message:"selected_ordinals must reference selections carrying the same role"})}});function gg(e){let n=e.toLowerCase();return n.startsWith("http://")||n.startsWith("https://")||e.startsWith("//")}import{z as S}from"zod";var yA=S.object({force_refresh:S.boolean().optional()}),Jr=S.enum(["running","succeeded","failed"]),hg=S.object({agent_id:S.string().min(1),name:S.string().min(1),icon:S.string().min(1),capability:S.string().min(1),data_source:S.string().min(1),output_topics:S.string().min(1)}),Sg=S.object({site_mode:S.enum(["existing_site","new_site"]),scan_required:S.boolean(),scheduled_agent_ids:S.array(S.string().min(1)),omitted_agent_ids:S.array(S.string().min(1)),next_stage:S.enum(["diagnostic_report","strategy"])}),fg=S.object({t:S.string(),d:S.string(),evidence:S.object({from:S.string(),url:S.string().nullable().optional(),value:S.string().nullable().optional()})}),bg=S.enum(["complete","partial","insufficient_data","failed"]),yg=S.enum(["ok","failed","insufficient_data"]),Mi=S.object({agent_id:S.string().min(1),name:S.string().min(1),icon:S.string().min(1),status:yg,topics:S.array(S.object({topic_id:S.string().min(1),status:bg,evidence_refs:S.array(S.string())})).length(3),findings:S.array(fg).max(3),elapsed_ms:S.number().nonnegative(),note:S.string().optional(),error:S.string().optional()}),ec=S.object({total:S.number().int().nonnegative(),ok:S.number().int().nonnegative(),degraded:S.number().int().nonnegative(),total_findings:S.number().int().nonnegative(),elapsed_ms:S.number().nonnegative(),site_mode:S.enum(["existing_site","new_site"]).optional(),scheduled_agent_ids:S.array(S.string()).optional(),omitted_agent_ids:S.array(S.string()).optional(),scheduled:S.number().int().nonnegative().optional(),complete:S.number().int().nonnegative().optional(),partial:S.number().int().nonnegative().optional(),insufficient:S.number().int().nonnegative().optional(),failed:S.number().int().nonnegative().optional(),next_stage:S.enum(["diagnostic_report","strategy"]).optional()}),xg=S.object({agents_done:S.boolean(),analysis:S.record(S.string(),Mi),step4_scoring_input:S.unknown().optional(),summary:ec}),tc=S.object({job_id:S.string().min(1),site_id:S.string().min(1),model_version:S.string().min(1),output_locale:S.string().min(2),cached:S.boolean().optional(),status:Jr,result:xg.nullable().optional(),error:S.string().nullable().optional()}),xA=M(S.array(hg)),EA=M(Sg),RA=M(tc),IA=M(tc.nullable()),it=S.object({id:S.union([S.number().int().nonnegative(),S.string().regex(/^(0|[1-9]\d*)$/u).transform(Number)]).pipe(S.number().int().nonnegative())}),Zr=S.object({percent:S.number().int().min(0).max(100),phase:S.enum(["preparing","analyzing","finalizing","completed","failed"]),stage:S.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:S.number().int().nonnegative(),agents_total:S.number().int().nonnegative(),agent_id:S.string().min(1).optional()}),TA=S.discriminatedUnion("event",[it.extend({event:S.literal("snapshot"),data:S.object({job_id:S.string().min(1),status:Jr,done:S.number().int().nonnegative(),total:S.number().int().nonnegative(),results:S.array(Mi),progress:Zr.optional()})}),it.extend({event:S.literal("progress"),data:Zr}),it.extend({event:S.literal("preparing_started"),data:S.object({stage:S.literal("baseline")})}),it.extend({event:S.literal("preparing_progress"),data:S.object({stage:S.enum(["context","external_evidence"])})}),it.extend({event:S.literal("preparing_done"),data:S.object({evidence_count:S.number().int().nonnegative(),rule_count:S.number().int().nonnegative(),degraded_capabilities:S.array(S.string())})}),it.extend({event:S.literal("agent_start"),data:S.object({agent_id:S.string().min(1),name:S.string().min(1),icon:S.string().min(1)})}),it.extend({event:S.literal("agent_done"),data:Mi}),it.extend({event:S.literal("done"),data:S.object({agents_done:S.literal(!0),summary:ec})}),it.extend({event:S.literal("failed"),data:S.object({message:S.string().min(1)})})]);import{z as O}from"zod";var qi=O.enum(["reach","trust","convert","safe"]),ke=O.number().finite(),Eg=O.number().finite().positive(),Ui=["reach","trust","convert","safe"],Rg=17,Ig=O.enum(["passed","partial","failed"]),Tg=O.object({landing_page_mode:O.enum(["intent_dynamic","static","none"]),ab_test_enabled:O.boolean()}).strict(),kg=O.union([O.boolean(),O.number().finite(),Ig,Tg]).nullable(),Ag=O.union([O.boolean(),O.number().finite()]).nullable(),Pg=O.object({competitor_avg:O.number().finite(),score_items:O.record(O.string(),kg),penalty_items:O.record(O.string(),Ag),red_texts:O.array(O.string())}).strict(),wg=O.record(qi,Pg),Cg=O.object({key:qi,score:ke,pass_score:ke,gap:ke}),vg=O.object({key:O.string(),title:O.string(),is_redline_option:O.boolean().optional(),score:ke,max_score:Eg,pass_score:ke,passed:O.boolean(),description:O.string()}),Dg=O.object({key:qi,title:O.string(),alias:O.string(),slogan:O.string(),score:ke,max_score:O.literal(100),pass_score:ke,competitor_average:ke,status:O.enum(["reached","near","not_reached"]),status_name:O.enum(["\u8FBE\u6807","\u63A5\u8FD1","\u672A\u8FBE\u6807"]),summary:O.string(),sub_dimensions:O.array(vg),red_texts:O.array(O.string()),redline_hit:O.boolean().optional()}),Og=O.object({id:O.number().int().positive(),task_code:O.string().min(1).max(128),is_sync:O.literal(0),status:O.literal("succeeded"),rules:wg,scores_list:O.object({overview:O.object({pass_scores:O.object({reach:ke,trust:ke,convert:ke,safe:ke}),total_score:ke,total_pass_score:ke,score_gap:ke,competitor_average_score:ke,scoring_criteria_text:O.string().min(1),gap_dimensions:O.array(Cg).max(4),overall_passed:O.boolean(),all_scores_passed:O.boolean(),diagnosis_passed:O.boolean(),commitment_eligible:O.boolean(),safe_redline_hit:O.boolean()}),dimensions:O.array(Dg).length(4)}),created_at:O.string().datetime({offset:!0}),updated_at:O.string().datetime({offset:!0})}).superRefine((e,n)=>{jg(e.scores_list.dimensions)||n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include each canonical score dimension."}),e.scores_list.dimensions.reduce((a,i)=>a+i.sub_dimensions.length,0)!==Rg&&n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include 17 subdimensions in total."});for(let[a,i]of e.scores_list.dimensions.entries()){if(i.redline_hit===void 0)continue;let r=i.sub_dimensions.findIndex(m=>m.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."})}}),wA=M(Og);function jg(e){let n=e.map(s=>s.key);return n.length===Ui.length&&new Set(n).size===Ui.length&&Ui.every(s=>n.includes(s))}var ut={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 e of Object.values(ut))Object.freeze(e);Object.freeze(ut);var DA=Object.freeze(jt.filter(e=>ut[e].length>0)),OA=Object.freeze(jt.filter(e=>ut[e].length===0)),Ng=Object.freeze(["preparing_source","building","artifact_ready","deploying","released"]),Lg="DEPLOYMENT_TRANSITION_INVALID",Fi=class extends Error{constructor(n,s){super(`Invalid deployment transition: ${n} -> ${s}`),this.currentStatus=n,this.nextStatus=s,this.code=Lg,this.name="DeploymentTransitionError"}};function jA(e){return ut[e]}function NA(e){return jt.filter(n=>ut[n].some(s=>s===e))}function Mg(e){return ut[e].length>0}function LA(e){return!Mg(e)}function MA(e,n){if(!ut[e].some(s=>s===n))throw new Fi(e,n);return n}function UA(){return Ng}import{z as U}from"zod";var BA="x-vcp-run-lease-owner",HA=600*1e3,VA=60*1e3,$A=3,YA=2,XA="WORKSPACE_RUN_RESUME_EXHAUSTED",QA="WORKSPACE_CHECK_INCOMPLETE",ZA="WORKSPACE_GENERATION_STOPPED",JA="WORKSPACE_FILL_IN_INTERRUPTED",e0="WORKSPACE_RUN_LEASE_SUPERSEDED",t0="WORKSPACE_RUN_NOT_ACTIVE",n0="FILL_IN_NOT_AVAILABLE",s0="FILL_IN_TARGET_NOT_OMITTED",i0="FILL_IN_TARGET_MODIFIED",Ug=U.object({authMode:U.enum(["disabled-dev","internal-service","oidc"]),user_id:U.string().min(1),external_user_id:U.string().min(1).optional(),email:U.string().min(1).optional(),display_name:U.string().min(1).optional()}).strict(),a0=U.object({run_id:K,lease_owner:U.string().min(1),lease_ms:U.number().int().positive().max(1800*1e3).optional()}).strict(),o0=U.object({status:U.enum(["renewed","not_active","superseded"]),expires_at:U.string().min(1).nullable(),stop_requested:U.boolean()}).strict(),nc=U.object({run_id:K,page_id:U.string().min(1),attempt:U.number().int().positive(),snapshot_id:k,object_key:U.string().min(1),manifest_hash:U.string().min(1),file_paths:U.array(U.string().min(1)).min(1),created_at:U.string().min(1)}).strict(),r0=nc.omit({created_at:!0}).extend({lease_owner:U.string().min(1)}).strict(),c0=U.object({checkpoints:U.array(nc)}).strict(),sc=U.object({kind:U.enum(["page","component","shared"]),target_id:U.string().min(1)}).strict(),m0=U.object({run_id:K,site_id:T,tenant_id:U.string().min(1),run_kind:U.enum(["initial_generation","iteration","landing_page","fill_in"]),status:U.enum(["queued","running","succeeded","failed","cancelled"]),base_snapshot_id:k.nullable(),lease_owner:U.string().min(1).nullable(),resume_count:U.number().int().nonnegative(),stop_requested:U.boolean(),reuse_from_run_id:K.nullable(),source_run_id:K.nullable(),fill_in_targets:U.array(sc),execution_scene:Hs.nullable().optional(),page_template_manifest:io.nullable().optional()}).strict().superRefine((e,n)=>{e.execution_scene==="page_template_create"?(e.run_kind!=="iteration"||!e.page_template_manifest)&&n.addIssue({code:"custom",message:"Page Template execution requires an iteration run with its authoritative manifest"}):e.page_template_manifest&&n.addIssue({code:"custom",message:"Only Page Template execution has a batch manifest"})}),l0=U.object({runs:U.array(U.object({run_id:K,site_id:T,tenant_id:U.string().min(1),run_kind:U.literal("initial_generation"),base_snapshot_id:k,sitemap_id:Ae,resume_count:U.number().int().nonnegative(),lease_owner:U.string().min(1),stop_requested:U.boolean(),resume_principal:Ug}).strict())}).strict(),p0=U.object({site_id:T}).strict(),d0=U.object({status:U.enum(["requested","already_requested","stopped","no_active_run"]),run_id:K.nullable()}).strict(),u0=U.object({ledger:tn.nullable(),source_run_id:K.nullable(),updated_at:U.string().min(1).nullable()}).strict(),_0=U.object({targets:U.array(sc).min(1).max(50),client_run_key:U.string().min(1).max(400)}).strict();import{z as qg}from"zod";var S0=".i18n.json",ms="translation",ic=new Set(["__proto__","constructor","prototype"]);function oc(e){if(!ls(e)||Object.keys(e).length===0)return _t("I18N_ROOT_INVALID","Component i18n resources must be a non-empty object.",[]);for(let[n,s]of Object.entries(e)){if(ic.has(n))return ac([n]);if(!Fg(n))return _t("I18N_LOCALE_INVALID",`Component i18n locale must be canonical BCP-47: ${n}`,[n]);if(!ls(s))return _t("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]!==ms)return _t("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let i=s[ms];if(!ls(i))return _t("I18N_RESOURCE_TREE_INVALID",`Component i18n translation namespace for ${n} must be an object.`,[n,ms]);let r=[{value:i,path:[n,ms]}];for(;r.length>0;){let m=r.pop();for(let[c,p]of Object.entries(m.value)){let I=[...m.path,c];if(ic.has(c))return ac(I);if(typeof p!="string"){if(!ls(p))return _t("I18N_RESOURCE_TREE_INVALID","Component i18n resource leaves must be strings.",I);r.push({value:p,path:I})}}}}return{success:!0,data:e}}function f0(e){let n;try{n=JSON.parse(e)}catch{return _t("I18N_JSON_INVALID","Component i18n resource file must contain valid JSON.",[])}return oc(n)}var b0=qg.custom(e=>oc(e).success,"Invalid component i18n resources.");function Fg(e){try{let n=Intl.getCanonicalLocales(e);return n.length===1&&n[0]===e}catch{return!1}}function ls(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=Object.getPrototypeOf(e);return n===Object.prototype||n===null}function ac(e){return _t("I18N_RESOURCE_KEY_FORBIDDEN",`Component i18n resource key is forbidden: ${e.at(-1)??""}`,e)}function _t(e,n,s){return{success:!1,error:{code:e,message:n,path:s}}}var at="products",Gg=`/${at}`,x0=Gg,E0=`${at} detail`,R0="cms_collection_view",I0="list",T0="detail",Ye={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"}},Kg=new Set(Object.values(Ye).map(e=>e.pageTitle)),Wg=new Set(Object.values(Ye).flatMap(e=>[e.blockLabel,e.detailBlockLabel,e.heroBlockLabel]));function k0(e){let n=e?.trim().toLowerCase()??"";if(n==="zh-tw"||n==="zh-hk"||n==="zh-mo")return Ye.zhHant;if(n.startsWith("zh"))return Ye.zhHans;switch(n.split("-")[0]){case"de":return Ye.de;case"fr":return Ye.fr;case"es":return Ye.es;case"ja":return Ye.ja;case"ko":return Ye.ko;case"en":default:return Ye.en}}function A0(e){return Kg.has(e.trim())}function P0(e){return Wg.has(e.trim())}import{z as qt}from"zod";var D0="SITE_HAS_ACTIVE_SUBSITES",O0="SITE_HAS_SUBSITES",zg=qt.object({site_id:T,name:qt.string().min(1),mount_path:qt.string().min(1),archived_at:qt.string().nullable()}),j0=qt.object({subsites:qt.array(zg)});import{z as ye}from"zod";var U0=ye.object({key:ye.string().min(1),composition:ce}).strict(),ds=ye.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),Bg=ye.enum(["direct","proxy","upstream","readonly","unsupported"]),Hg=ye.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),ps=ye.object({mode:Bg,reasonCode:ye.string().min(1).optional()}),Vg=ye.object({kind:Hg,message:ye.string().min(1)}),us=ye.object({composition:q,key:ye.string().min(1),canUpdateText:ye.boolean(),canInsertChild:ye.boolean(),canMove:ye.boolean(),canRemove:ye.boolean(),editModes:ye.object({updateText:ps.optional(),insertChild:ps.optional(),move:ps.optional(),remove:ps.optional()}).optional(),constraints:ye.array(Vg)}).strict();import{z as H}from"zod";var B0=H.discriminatedUnion("type",[H.object({type:H.literal("site-edit.document.changed"),siteId:T,snapshotId:k,composition:q,version:H.number().int().nonnegative(),at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.operation.planned"),siteId:T,operationId:H.string().min(1),baseSnapshotId:k,composition:q,changedFiles:H.array(H.string().min(1)),at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.operation.completed"),siteId:T,composition:q,result:Ii,at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.operation.failed"),siteId:T,composition:q,requestId:H.string().min(1),error:Dr,at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.capability.changed"),siteId:T,composition:q,keys:H.array(H.string().min(1)),at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.graph.invalidated"),siteId:T,composition:q,at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.graph.ready"),siteId:T,composition:q,version:H.number().int().nonnegative(),at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.graph.error"),siteId:T,composition:q,message:H.string().min(1),at:H.string().min(1)}).strict(),H.object({type:H.literal("site-edit.snapshot.changed"),siteId:T,composition:q,snapshotId:k,previousSnapshotId:H.string().min(1).nullable(),at:H.string().min(1)}).strict()]);import{z as se}from"zod";var Y0="durable-history-v1",_s=se.object({initiatingComposition:q.optional(),affectedCompositions:se.array(q)}).strict(),X0=se.enum(["writable","read-only-recovery","unavailable"]),$g=se.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),Yg=se.object({code:$g,message:se.string().min(1),occurredAt:se.iso.datetime().optional()}).strict(),Xg=se.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),rc={revision:se.number().int().nonnegative(),undoDepth:se.number().int().nonnegative(),redoDepth:se.number().int().nonnegative()},Qg=se.object({mode:se.literal("writable"),composition:q,...rc,canUndo:se.boolean(),canRedo:se.boolean(),provenance:_s.optional()}).strict().superRefine((e,n)=>{e.canUndo!==e.undoDepth>0&&n.addIssue({code:"custom",path:["canUndo"],message:"canUndo must reflect undoDepth."}),e.canRedo!==e.redoDepth>0&&n.addIssue({code:"custom",path:["canRedo"],message:"canRedo must reflect redoDepth."})}),Zg=se.object({mode:se.literal("read-only-recovery"),composition:q,...rc,canUndo:se.literal(!1),canRedo:se.literal(!1),recoveryDiagnostic:Yg,provenance:_s.optional()}).strict(),Jg=se.object({mode:se.literal("unavailable"),composition:q,revision:se.literal(0),undoDepth:se.literal(0),redoDepth:se.literal(0),canUndo:se.literal(!1),canRedo:se.literal(!1),reason:Xg,provenance:_s.optional()}).strict(),eh=se.discriminatedUnion("mode",[Qg,Zg,Jg]),Q0=se.object({composition:q,status:eh,provenance:_s}).strict();import{z as W}from"zod";var gs=W.enum(["api-field","cms-field","i18n-message","config-entry"]),Gi=W.object({kind:W.enum(["jsx-node","value-path","route-export","external-entry"]),file:W.string().min(1).optional(),isProxy:W.boolean(),displayPath:W.string().min(1).optional(),sourceType:gs.optional(),sourceId:W.string().min(1).optional()}),th=W.discriminatedUnion("status",[W.object({status:W.literal("resolved"),value:Pt}).strict(),W.object({status:W.literal("undefined")}).strict(),W.object({status:W.literal("unresolved")}).strict()]),nh=W.object({kind:W.enum(["literal","boolean-shorthand","expression","binding","repeat-template"]),raw:W.string().optional()}).strict(),sh=W.object({name:W.string().min(1),source:nh,resolution:th,editMode:W.enum(["direct","proxy","upstream","readonly","unsupported"]),sourceScope:W.enum(["node","repeat-item","repeat-template"]),allowedWriteScopes:W.array(W.enum(["selection","template"])),effectiveWriteTarget:Gi.optional(),diagnostics:W.array(W.object({code:W.string().min(1),message:W.string().min(1)}).strict())}).strict(),ih=W.object({raw:W.string().min(1),sourceRange:tt,order:W.number().int().nonnegative(),diagnostics:W.array(W.object({code:W.string().min(1),message:W.string().min(1)}).strict())}).strict(),ah=W.object({selection:W.enum(["direct","materialize","unsupported"]),template:W.enum(["direct","unsupported"])}).strict(),Ki=W.object({documentVersion:W.number().int().nonnegative(),selectionRef:Ut.optional(),items:W.array(sh),spreads:W.array(ih),creation:ah}).strict().superRefine((e,n)=>{let s=e.selectionRef;s&&s.instanceIndex!==void 0&&s.instanceCount!==void 0&&s.instanceIndex>=s.instanceCount&&n.addIssue({code:"custom",path:["selectionRef","instanceIndex"],message:"instanceIndex must be smaller than instanceCount"})});import{z as xe}from"zod";var oh=xe.string().min(1).refine(e=>!e.startsWith("/")&&!e.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),rh=xe.string().regex(/^sha256:[a-f0-9]{64}$/),ch=xe.object({path:oh,operation:xe.enum(["create","update","delete"]),expectedHash:rh.optional(),fullContent:xe.string().optional()}).superRefine((e,n)=>{e.operation==="delete"&&e.fullContent!==void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"delete patches must not include fullContent"}),e.operation!=="delete"&&e.fullContent===void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"create/update patches must include fullContent"})}),mh=xe.object({siteId:T,baseSnapshotId:k,operationId:xe.string().min(1),reason:xe.string().min(1),patches:xe.array(ch).min(1),changedCompositions:xe.array(q),changedRouteIds:xe.array(xe.string().min(1)).optional(),diagnostics:xe.array(xe.object({code:xe.string().min(1),message:xe.string().min(1),path:xe.string().min(1).optional()})).default([])}).strict().superRefine((e,n)=>{let s=new Set;for(let[i,r]of e.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(e.changedCompositions.map(i=>i.routeId))];e.changedRouteIds!==void 0&&(e.changedRouteIds.length!==a.length||e.changedRouteIds.some((i,r)=>i!==a[r]))&&n.addIssue({code:"custom",path:["changedRouteIds"],message:"changedRouteIds must be the stable deduplicated route projection of changedCompositions."})}),rP=mh.transform(e=>({...e,changedRouteIds:[...new Set(e.changedCompositions.map(n=>n.routeId))]}));var Wi="::repeat-item#";function lh(e,n){return`${e}${Wi}${n}`}function mP(e,n){return n.reduce((s,a)=>lh(s,a),e)}function ph(e){if(typeof e!="string"||e.length===0)return null;let n=[],s=e;for(;;){let a=s.lastIndexOf(Wi);if(a<0)break;let i=Number(s.slice(a+Wi.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 lP(e){return ph(e)?.baseKey??e??null}import{z as l}from"zod";import{z as Pe}from"zod";var dh=Pe.object({placementKey:Pe.string().min(1),placementUnitKey:Pe.string().min(1),relation:Pe.enum(["before","after","prepend","append"])}).strict(),uh=Pe.object({status:Pe.literal("supported"),containerKey:Pe.string().min(1),hasBusinessMembers:Pe.boolean(),placementUnitKeys:Pe.array(Pe.string().min(1)),placements:Pe.array(dh)}).strict().superRefine((e,n)=>{let s=new Set(e.placementUnitKeys);s.size!==e.placementUnitKeys.length&&n.addIssue({code:"custom",path:["placementUnitKeys"],message:"Render page composition placement unit keys must be unique."});let a=new Set;e.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."})})}),_h=Pe.object({status:Pe.literal("unsupported"),reason:ss,diagnostics:Pe.array(un)}).strict(),cc=Pe.discriminatedUnion("status",[uh,_h]);var gh=l.object({canUpdateText:l.boolean(),canInsertChild:l.boolean(),canMove:l.boolean(),canRemove:l.boolean()}),mc=l.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),hh=l.enum(["cms-field","api-field"]),Sh=l.enum(["text","attribute","richtext","repeat-region","conditional-region","component-prop"]),fh=l.enum(["exact","safe-derived","partial","unknown"]),bh=l.object({file:l.string().min(1),symbol:l.string().min(1).optional(),reason:l.string().min(1)}),yh=l.object({sourceKind:mc,sourceType:hh,endpointPattern:l.string().min(1).optional(),operation:l.string().min(1).optional(),collection:l.string().min(1).optional(),fieldPath:l.string().min(1).optional(),valuePath:l.string().min(1).optional(),targetKind:Sh,targetName:l.string().min(1),confidence:fh,readonly:l.literal(!0),evidence:l.array(bh)}),lc=l.object({hasDynamicData:l.boolean(),bindings:l.array(yh)}),pc=l.object({hasDynamicData:l.boolean(),sourceKinds:l.array(mc),collections:l.array(l.string().min(1)).min(1).optional(),primaryEndpoint:l.string().min(1).optional(),primaryCollection:l.string().min(1).optional(),primaryFieldPath:l.string().min(1).optional()}),xh=l.object({key:l.string().min(1),pageCompositionUnitKey:l.string().min(1).optional(),operationSummary:gh,dynamicDataSummary:pc.optional()}).strict(),AP=l.object({composition:ce}).strict(),PP=l.object({key:l.string().min(1),composition:ce,selectionRef:Ut.optional()}).strict(),wP=l.object({siteId:T,snapshotId:k,composition:q,version:l.number().int().nonnegative(),entries:l.array(xh),pageComposition:cc}).strict(),dc=l.object({kind:l.enum(["literal","binding","imported-binding","repeat-template"]),file:l.string().min(1),expression:l.string().min(1),bindingName:l.string().min(1).optional(),path:l.array(l.union([l.string(),l.number()])).optional()}),zi=l.object({index:l.number().int().min(0),value:l.string(),editable:l.boolean(),source:dc.nullable()}),bn=l.object({key:l.string().min(1),label:l.string().min(1),tag:l.string().min(1)}),CP=l.object({composition:q,key:l.string().min(1),canUpdateText:l.boolean(),canInsertChild:l.boolean(),canMove:l.boolean(),canRemove:l.boolean(),boundaryKind:ds.nullable(),isOpaque:l.boolean()}).strict(),Eh=l.object({kind:l.enum(["jsx-node","component-proxy","value-binding","route-export"]),file:l.string().min(1),componentName:l.string().min(1),isProxy:l.boolean()}),uc=l.object({kind:l.union([l.enum(["jsx-literal","component-prop","binding","imported-binding","object-field","array-item","repeat-template","conditional-branch"]),gs]),file:l.string().min(1),displayPath:l.string().min(1),externalSource:l.object({sourceType:gs,sourceId:l.string().min(1),adapterId:l.string().min(1).optional()}).optional()}),Rh=l.object({kind:uc.shape.kind,file:l.string().min(1),displayName:l.string().min(1),canEditHere:l.boolean()}),yn=l.object({finalSource:uc.nullable(),chain:l.array(Rh),confidence:l.enum(["exact","safe-derived","partial","unknown"]),editMode:l.enum(["direct","proxy","upstream","readonly","unsupported"]),diagnostics:l.array(l.object({code:l.string().min(1),message:l.string().min(1)}))}),Ih=l.object({kind:l.literal("css-style-model"),properties:l.array(l.object({property:Ar,value:l.union([l.string(),l.number(),l.boolean(),l.null()]),resolvedValue:l.union([l.string(),l.number(),l.boolean(),l.null()]).optional(),breakpoint:wr.optional(),state:Pr.optional(),variants:l.array(l.string().min(1)).optional(),options:l.array(l.union([l.string(),l.number()])).optional(),editable:l.boolean(),diagnostics:l.array(l.object({code:l.string().min(1),message:l.string().min(1)})).optional(),operationBoundary:l.array(_n).optional()}))}),vP=l.union([l.record(l.string(),l.unknown()),Ih]),_c=l.object({kind:l.literal("class-name-source"),className:l.string(),sourceKind:l.enum(["missing","static-attribute","static-expression","dynamic-expression"]),editable:l.boolean(),operationBoundary:l.array(_n),sourcePath:l.string().min(1).optional(),diagnostics:l.array(l.object({code:l.enum(["missing-class-name","dynamic-binding","non-string-binding"]),message:l.string().min(1)})).optional()}),Th=l.object({startLine:l.number().int().positive(),startColumn:l.number().int().nonnegative(),endLine:l.number().int().positive(),endColumn:l.number().int().nonnegative()}),Bi=l.object({sourceFile:l.string().min(1),componentName:l.string().min(1),openingElementRange:Th,structuralPath:l.string().min(1),textPreview:l.string().min(1).optional()}),DP=l.object({composition:q,key:l.string().min(1),tag:l.string().min(1),componentName:l.string().min(1),sourceFile:l.string().min(1),sourceLocator:Bi.optional(),label:l.string().min(1),capabilities:us,writeTarget:Eh,effectiveWriteTarget:Gi.optional(),provenanceChain:yn.optional(),componentSemantic:l.record(l.string(),l.unknown()).optional(),contentModel:l.record(l.string(),l.unknown()).optional(),mediaModel:l.record(l.string(),l.unknown()).optional(),styleSource:_c.optional(),conditional:l.record(l.string(),l.unknown()).optional(),dynamicData:lc.optional(),properties:Ki.optional(),textSegments:l.array(zi),boundaryKind:ds.nullable(),isOpaque:l.boolean(),ancestors:l.array(bn),children:l.array(bn),siblings:l.array(bn)}).strict(),OP=l.object({composition:q,key:l.string().min(1),tag:l.string().min(1),label:l.string().min(1),sourceLocator:Bi.optional(),capabilities:l.object({constraints:us.shape.constraints}),isOpaque:l.boolean(),provenanceChain:l.object({editMode:yn.shape.editMode,diagnostics:yn.shape.diagnostics}).optional(),dynamicDataSummary:pc.optional(),ancestors:l.array(bn)}).strict(),jP=l.object({composition:q,key:l.string().min(1),tag:l.string().min(1),label:l.string().min(1),sourceLocator:Bi.optional(),isOpaque:l.boolean(),ancestors:l.array(bn),componentName:l.string().min(1),sourceFile:l.string().min(1),capabilities:us,provenanceChain:l.object({editMode:yn.shape.editMode,diagnostics:yn.shape.diagnostics}).optional(),textSegments:l.array(l.object({index:zi.shape.index,editable:zi.shape.editable,sourceKind:dc.shape.kind.nullable()})),dynamicData:lc.optional(),properties:Ki.optional(),boundaryKind:ds.nullable()}).strict(),NP=l.object({composition:q,key:l.string().min(1),mediaModel:l.record(l.string(),l.unknown()).optional(),styleSource:_c.optional()}).strict();var kh=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Ah=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],Ph=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],wh=new Set(kh),Ch=new Set(Ah),vh=new Set(Ph),Dh={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function MP(e){return wh.has(Hi(e))}function Oh(e){return Ch.has(Hi(e))}function jh(e){return vh.has(Hi(e))}function UP(e){let{operationSummary:n}=e;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:e.fallbackMode!=="preview"?{...Dh}:{canUpdateText:jh(e.tagName),canInsertChild:Oh(e.tagName),canMove:!1,canRemove:!1}}function Hi(e){return e?.trim().toLowerCase()??""}import{z as Nh}from"zod";var WP=Nh.object({composition:ce,mutationContext:pn.optional()}).strict();var BP={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_RUN_INPUT_REQUIRED:"Nothing to work on: the request had no instruction, so no edit was started. Describe the change you want and send it.",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_CHECK_INCOMPLETE:"The check couldn't complete, so no page was delivered this round. Please regenerate the site.",WORKSPACE_RUN_RESUME_EXHAUSTED:"Generation was interrupted several times and stopped. Everything already saved is kept; you can regenerate the missing pages.",WORKSPACE_GENERATION_STOPPED:"You stopped this generation before any page was ready. Nothing was lost \u2014 start it again when you want.",WORKSPACE_FILL_IN_INTERRUPTED:"The fill-in run was interrupted and stopped. Your site is unchanged; select the targets again to retry.",WORKSPACE_RUN_LEASE_SUPERSEDED:"Another attempt took over this run, so this one stopped. Reload to see the current progress.",FILL_IN_NOT_AVAILABLE:"Fill-in is available after the site has been generated.",FILL_IN_TARGET_NOT_OMITTED:"One of the selected items is no longer listed as missing. Reload the omissions list and try again.",FILL_IN_TARGET_MODIFIED:"One of the selected items was changed or removed after generation, so it was not filled in. Your edits are kept.",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.",WORKSPACE_THREAD_NOT_FOUND:"That conversation no longer exists. Switching back to the default conversation.",WORKSPACE_THREAD_ARCHIVED:"This conversation is archived. Start a new one to continue.",WORKSPACE_THREAD_BUSY:"This conversation is still running. Wait for it to finish before archiving.",WORKSPACE_THREAD_READ_ONLY:"Background conversations are read-only here.",WORKSPACE_THREAD_INVALID:"This conversation can't accept new requests right now. Refresh and 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."},Lh=["WORKSPACE_RUN_CANCELLED","WORKSPACE_GENERATION_STOPPED"],Mh=new Set(Lh);function HP(e){return typeof e=="string"&&Mh.has(e)}var VP={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."},$P={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},YP={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var gc="0.10.6",QP="x-vcp-edit-engine-version",ZP="x-vcp-edit-engine-version-source",Vi=class extends Error{constructor(n="Invalid edit-engine version."){super(n),this.code="EDIT_ENGINE_VERSION_INVALID",this.name="EditEngineVersionParseError"}},Uh=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/;function qh(e){return Uh.test(e)}function Fh(e){if(typeof e!="string"||!qh(e))throw new Vi;return e}function JP(e){return e==null?{version:gc,source:"fallback_current"}:{version:Fh(e),source:"explicit"}}function ew(){return{version:gc,source:"system_current"}}import{z as ze}from"zod";var Gh=200,Kh=200;function Wh(e){let n=e.indexOf(":");if(n<=0)return null;let s=e.slice(0,n).trim(),a=e.slice(n+1).trim();return s.length===0||a.length===0?null:{source:s,target:a}}var zh=ze.string().min(3).max(Gh).refine(e=>Wh(e)!==null,{message:'glossary entries must be "source:target" pairs split on a half-width colon, e.g. "\u7C73:Rice"'}),sw=ze.array(zh).max(Kh),iw=ze.object({website_name:ze.string().min(1).max(200),website_industry:ze.string().min(1).max(200).optional(),website_description:ze.string().min(1).max(1e3).optional()}),Bh=ze.enum(["regional","fonts_only"]),hs=ze.string().regex(/^#[0-9a-fA-F]{6}$/,'color must be a "#rrggbb" value'),Hh=ze.object({primary:hs.optional(),accent:hs.optional(),foreground:hs.optional(),neutral:hs.optional()}),Vh=600,aw=ze.object({mode:Bh.default("regional"),seeds:Hh.optional(),note:ze.string().min(1).max(Vh).optional()}),ow={mode:"regional"};function rw(e){return e===void 0?!1:Object.values(e).some(n=>typeof n=="string"&&n.length>0)}import{z as Oe}from"zod";var $h=Oe.string().trim().min(1),Ft=Oe.string().uuid(),Yh=Oe.string().min(1).max(2048).refine(e=>e.startsWith("/")||e.includes("\\")?!1:e.split("/").every(n=>n.length>0&&n!=="."&&n!==".."),"object_key must be a relative snapshot store path without empty, '.' or '..' segments"),hc=Oe.object({snapshot_id:Ft,object_key:Yh}),lw=Oe.object({tenant_id:$h,parent_site_id:Ft,subsite_site_id:Ft,base:hc,target:hc}),pw=Oe.object({subsite_site_id:Ft,pending_pages:Oe.array(Oe.string().min(1)),hash_diverged_count:Oe.number().int().nonnegative(),child_only_count:Oe.number().int().nonnegative(),base_snapshot_id:Ft,target_snapshot_id:Ft}),Xh=Oe.enum(["SUBSITE_DIFF_REQUEST_INVALID","SUBSITE_DIFF_STORE_NOT_CONFIGURED","SUBSITE_DIFF_MANIFEST_MISSING","SUBSITE_DIFF_MANIFEST_INVALID"]),dw=Oe.object({error_code:Xh,message:Oe.string().min(1),side:Oe.enum(["base","target"]).optional()});import{z as _e}from"zod";var hw=_e.object({tenant_id:_e.string().min(1),site_id:T,snapshot_id:k,manifest_hash:_e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:_e.string().min(1).max(2048),page_slug:_e.string().max(512).optional()}),Sw=_e.object({site_id:T,snapshot_id:k,unit_count:_e.number().int().nonnegative(),file_count:_e.number().int().nonnegative(),markdown:_e.string().min(1),page_slug:_e.string().optional(),page_file:_e.string().optional(),entries:_e.array(_e.object({id:_e.string().min(1),file_path:_e.string().min(1),line:_e.number().int().nullable(),kind:_e.string().min(1),text:_e.string(),media_key:_e.string().optional()})).optional()});import{z as Qh}from"zod";var Zh=/^\/[a-z0-9][a-z0-9-]{0,30}$/,Jh=Object.freeze(["api","_next","assets","static","robots.txt","sitemap.xml",".well-known"]),eS=new Set(Jh);function tS(e){return eS.has(e)}var yw=Qh.string().regex(Zh).refine(e=>!tS(e.slice(1)),{message:"mount_path must not use a reserved segment (api, _next, assets, static, robots.txt, sitemap.xml, .well-known)"});import{z as me}from"zod";var nS=me.enum(["active","paused","blocked"]),Sc=me.enum(["typecheck_failed","health_failed","validation_failed"]),sS={status:nS,attempts:me.number().int().nonnegative(),attempted_template_version:We.nullable(),last_error_code:Sc.nullable()},Gt=me.object(sS).strict(),Ss=me.object({template_id:me.string().trim().min(1),target_template_version:We}).strict(),Iw=Ss,iS=me.discriminatedUnion("action",[me.object({action:me.literal("proceed"),state:Gt.extend({status:me.literal("active")})}).strict(),me.object({action:me.literal("skip_not_newer"),state:Gt.extend({status:me.literal("active")})}).strict(),me.object({action:me.literal("skip_paused"),state:Gt.extend({status:me.literal("paused")})}).strict(),me.object({action:me.literal("skip_blocked"),state:Gt.extend({status:me.literal("blocked")})}).strict()]),Tw=Ss,kw=iS,Aw=Ss.extend({error_code:Sc}),Pw=me.object({state:Gt}).strict(),ww=Ss,Cw=me.object({state:Gt}).strict();import{z}from"zod";var aS=744*60*60*1e3,oS=z.enum(["eligible","fast_path","upgraded","skipped","lock_skipped","cas_aborted","validation_failed","blocked","paused"]),rS=z.enum(["typecheck","build","health","validation"]),cS=z.enum(["not_attempted","promoted","aborted"]),Nw=z.object({template_id:z.string().trim().min(1).max(128),from_version:We.nullable(),to_version:We,outcome:oS,attempt:z.number().int().nonnegative().max(2147483647),duration_ms:z.number().int().nonnegative().max(2147483647),replaced_group_count:z.number().int().nonnegative().max(2147483647),skipped_group_count:z.number().int().nonnegative().max(2147483647),validation_stage:rS.nullable(),cas_outcome:cS.nullable()}).strict(),Lw=z.object({recorded:z.literal(!0)}).strict(),fc=z.object({from:z.iso.datetime(),to:z.iso.datetime()}).strict().refine(({from:e,to:n})=>Date.parse(e)<Date.parse(n),{message:"from must be earlier than to",path:["to"]}).refine(({from:e,to:n})=>Date.parse(n)-Date.parse(e)<=aS,{message:"report window must not exceed 31 days",path:["to"]}),Mw=fc,mS=z.object({eligible:z.number().int().nonnegative(),fast_path:z.number().int().nonnegative(),upgraded:z.number().int().nonnegative(),skipped:z.number().int().nonnegative(),lock_skipped:z.number().int().nonnegative(),cas_aborted:z.number().int().nonnegative(),validation_failed:z.number().int().nonnegative(),blocked:z.number().int().nonnegative(),paused:z.number().int().nonnegative()}).strict(),Uw=z.object({window:fc,outcome_counts:mS,current_state_counts:z.object({blocked:z.number().int().nonnegative(),paused:z.number().int().nonnegative()}).strict(),duration_ms:z.object({p50:z.number().int().nonnegative().nullable(),p95:z.number().int().nonnegative().nullable(),sample_count:z.number().int().nonnegative()}).strict()}).strict(),qw=z.object({older_than:z.iso.datetime(),limit:z.coerce.number().int().min(1).max(200).default(50),include_candidates:z.enum(["true","false"]).default("false").transform(e=>e==="true")}).strict(),lS=z.object({site_id:T,snapshot_id:k,status:z.enum(["candidate","deleting"]),created_at:z.iso.datetime()}).strict(),Fw=z.object({snapshots:z.array(lS)}).strict();import{z as ot}from"zod";var pS=ot.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"]),dS=ot.object({status:ot.literal("ready"),preview_url:ot.string().url()}).strict(),uS=ot.object({status:ot.literal("failed"),code:pS,message:ot.string().min(1),retryable:ot.boolean()}).strict(),Ww=ot.discriminatedUnion("status",[dS,uS]);import{z as de}from"zod";var Yw="build-context.json",Xw=2e5,bc=de.string().regex(/^sha256:[a-f0-9]{64}$/u),yc=1e3;function _S(e){return Array.from(e).length<=yc}var gS=de.object({kind:de.enum(["customer_materials","website_scan_diagnosis","committed_strategy"]),digest:bc}).strict(),hS=de.object({schema_version:de.literal(1),flow_type:is,sources:de.array(gS).min(2).max(2)}).strict().superRefine((e,n)=>{let s=new Set(e.sources.map(i=>i.kind)),a=e.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."})}),SS=de.object({schema_version:de.literal(1),seed:bc.optional(),cms_settings:de.object({main_products:de.string().trim().min(1).refine(_S,{message:`main_products must contain at most ${yc} characters`}).optional()}).strict().optional(),provenance:hS.optional()}).strict(),fS=de.object({schema_version:de.literal(1),site_id:T,workflow_id:Ve,brief:de.string().min(1),source:de.enum(["business_provider","mock"]),payload:SS}).strict().superRefine((e,n)=>{e.source==="business_provider"&&!e.payload.provenance&&n.addIssue({code:"custom",path:["payload","provenance"],message:"Business site-build context requires persisted provenance."})}),Qw=de.object({source_snapshot_id:k,source_run_id:K,build_context:fS,page_slugs:de.array(de.string().min(1)).optional()}).strict(),Zw=de.object({disposition:de.enum(["reused","rebased"]),snapshot_id:k}).strict(),bS=de.object({snapshot:wi,workspace_run_id:K.nullable()}).strict(),Jw=M(bS);import{z as Xe}from"zod";import{z as Me}from"zod";import{z as le}from"zod";import{z as yS}from"zod";var xS=["company_profile","product_manual","product_list","customer_case","product_help","qualification","industry_material"],xc=yS.enum(xS);var Ec=le.enum(["pending","running","ready","failed","missing"]),ES=le.object({task_id:le.string().min(1).max(500),status:Ec}).strict(),aC=le.object({items:le.array(ES).max(100)}).strict(),xn=le.string().trim().min(1).max(255),oC=le.object({knowledge_site_id:xn,source_ids:le.array(xn).min(1).max(200)}).strict().superRefine((e,n)=>{new Set(e.source_ids).size!==e.source_ids.length&&n.addIssue({code:"custom",message:"Knowledge source IDs must be unique.",path:["source_ids"]})}),RS=le.object({source_file_id:xn,category_code:xc.nullable(),category_confirmed:le.boolean(),status:Ec}).strict(),rC=le.object({ready:le.boolean(),files:le.array(RS),counts:le.object({total:le.number().int().nonnegative(),pending:le.number().int().nonnegative(),running:le.number().int().nonnegative(),ready:le.number().int().nonnegative(),failed:le.number().int().nonnegative(),missing:le.number().int().nonnegative(),unclassified:le.number().int().nonnegative()}).strict()}).strict();var ge=e=>Me.string().trim().max(e),Rc=Me.array(Me.string().trim().min(1).max(120)).max(20),$i=Me.object({company_name:Me.string().trim().min(1).max(200),brand_name:ge(200),primary_products:Me.string().trim().min(1).max(1e3),industry:ge(200),applications:ge(1e3),business_summary:ge(2e3),registered_capital:ge(200).default(""),legal_representative:ge(200).default(""),target_markets:Rc,customer_industries:ge(1e3),customer_roles:ge(1e3),buying_scenarios:ge(2e3),differentiators:ge(2e3),competitors:ge(1e3),trust_proof:ge(2e3),customer_cases:ge(3e3),channels:Rc,expected_domain:ge(255),brand_tone:ge(500),contact_name:ge(200),contact_info:ge(500),timezone:ge(100),launch_timing:ge(200),input_source_ids:Me.array(xn).max(50)}).strict(),IS=Me.enum(["draft","submitted"]),Yi=$i.extend({id:V,tenant_id:Me.string().min(1),site_id:T,workflow_id:Ve,status:IS,submitted_at:Me.string().min(1).nullable(),created_at:Me.string().min(1),updated_at:Me.string().min(1)}).strict(),uC=M(Yi),_C=M(Yi),gC=M(Yi.nullable());var yC=cs.extend({expected_current_node:Xe.literal("website_scan"),type:Xe.literal("existing_site"),result:cs.shape.result.extend({website:Xe.string().url(),scan_cards:Xe.partialRecord(Xr,Li).refine(e=>Object.keys(e).length>0,{message:"At least one recognized scan card is required."})}).strict()}).strict(),xC=Xe.object({expected_current_node:Xe.literal("customer_materials"),materials:$i}).strict(),EC=Xe.object({expected_current_node:Xe.literal("diagnosis")}).strict(),RC=Xe.object({expected_current_node:Xe.literal("strategy")}).strict();import{z as C}from"zod";var En={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}},TS={heading:"Inter",body:"Inter"},Ic=En.Inter;function fs(e){return e.trim().replace(/\s+/g,"_").toLowerCase()}var Pc=(()=>{let e=new Map;for(let[n,s]of Object.entries(En))e.set(fs(n),s),e.set(fs(s.import),s);return e})();function kS(e){return typeof e!="string"||e.trim().length===0?Ic:Pc.get(fs(e))??Ic}var AS=(()=>{let e=new Map;for(let[n,s]of Object.entries(En))e.set(s.import,n);return e})();function PS(e){if(typeof e!="string"||e.trim().length===0)return"Inter";let n=Pc.get(fs(e));return n?AS.get(n.import)??"Inter":"Inter"}var wS=Object.keys(En),Tc='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',kc='Georgia, "Times New Roman", serif',Ac='"SFMono-Regular", Consolas, monospace',CS=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),vS=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(e=>e.toLowerCase())),DS=new Set(["JetBrains Mono","IBM Plex Mono"].map(e=>e.toLowerCase()));function OS(e){let n=e.toLowerCase();return DS.has(n)||n.includes("mono")?"mono":vS.has(n)||n.includes("serif")?"serif":"sans"}function Xi(e,n){let s=p=>(p??"").trim().replace(/^['"]|['"]$/g,"").replace(/[^A-Za-z0-9 _-]+/g,"").trim().slice(0,60),a=s(e),i=s(n),r=p=>CS.has(p.toLowerCase());if(a&&r(a)){let p=a.toLowerCase();return p.includes("mono")?Ac:p.includes("serif")?kc:Tc}let m=a;m||(m=r(i)?"":i),m||(m="Inter");let c=OS(m);return c==="mono"?`"${m}", ${Ac}`:c==="serif"?`"${m}", ${kc}`:`"${m}", ${Tc}`}function jS(e){return{"--site-font-sans":Xi(e?.body,"Inter"),"--site-font-heading":Xi(e?.heading,e?.body??"Inter")}}var Qi=["archivo-inter","playfair-source-sans","space-grotesk-manrope","fraunces-libre-franklin","noto-serif-sc-noto-sans-sc","noto-sans-sc"],wc=[{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 Cc(e){let n=wc.find(s=>s.id===e);if(!n)throw new Error(`Unknown font pairing: ${e}`);return n}var Zi=["compact","comfortable","airy"],vc=["none","sm","md","lg","xl"],Dc="lg",Ji=["subtle","moderate","expressive"],NS=[{id:"subtle",motionLevel:"subtle"},{id:"moderate",motionLevel:"moderate"},{id:"expressive",motionLevel:"expressive"}];function Oc(e){let n=NS.find(s=>s.id===e);if(!n)throw new Error(`Unknown motion preset: ${e}`);return n}var jc=["ocean","forest","clay","violet","graphite","crimson"],Nc=["ai-forest","ai-navy","ai-steel"],Lc=/^gen-[0-9a-f]{8}$/,ea=[{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"}],ta=[{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 AC(e){let n=ta.find(s=>s.id===e);if(!n)throw new Error(`Unknown theme preset: ${e}`);return n}function Mc(e){return ta.find(n=>n.id===e)?.radius??ea.find(n=>n.id===e)?.radius}var na=C.string().regex(/^#[0-9A-F]{6}$/i),Rn=C.string().trim().min(1).max(500),Uc=C.string().datetime({offset:!0}),LS=C.enum(jc),MS=C.enum(Nc),US=C.string().regex(Lc),In=C.union([LS,MS,US]),Tn=C.enum(Qi),kn=C.enum(Ji),An=C.enum(Zi),bs=C.enum(vc),qc=300,qS=C.string().trim().min(1).max(qc),ys=C.object({primary:na,accent:na,foreground:na}).strict(),FS=C.object({id:In,rank:C.number().int().min(1).max(3),name:C.string().trim().min(1).max(120),description:C.string().trim().min(1).max(240),color_seeds:ys,surface_mode:C.enum(["light","dark"]),radius:bs,font_pairing_id:Tn,motion_preset_id:kn,density:An,reason:Rn}).strict(),Fc=C.object({name:C.string().trim().min(1).max(120),description:C.string().trim().min(1).max(240),reason:Rn,color_seeds:ys,surface_mode:C.enum(["light","dark"]),radius:bs,font_pairing_id:Tn,motion_preset_id:kn,density:An}).strict(),Gc=C.object({version:C.number().int().min(1),recommendation_id:C.string().uuid(),theme_preset_id:In,color_seeds:ys,surface_mode:C.enum(["light","dark"]),font_pairing_id:Tn,motion_preset_id:kn,density:An,radius:bs.optional(),aesthetic_note:qS.optional(),updated_at:Uc}).strict(),GS=C.object({id:C.string().uuid(),version:C.number().int().min(1),catalog_version:C.string().trim().min(1).max(80),source:C.object({mode:C.enum(["ai","fallback"]),fallback_reason:C.string().trim().min(1).max(80).nullable()}).strict(),inputs:C.object({industry:C.string().trim().min(1).max(160).optional(),site_language:C.string().trim().min(2).max(35),owner_locale:fe.optional(),strategy_version:C.number().int().min(1),input_digest:C.string().regex(/^sha256:[a-f0-9]{64}$/)}).strict(),theme:C.object({recommended_id:In,candidate_ids:C.array(In).length(3),candidates:C.array(FS).length(3)}).strict().superRefine((e,n)=>{e.recommended_id!==e.candidate_ids[0]&&n.addIssue({code:"custom",path:["recommended_id"],message:"recommended_id must be the first candidate"}),e.candidates.some((s,a)=>s.id!==e.candidate_ids[a]||s.rank!==a+1)&&n.addIssue({code:"custom",path:["candidates"],message:"Candidates must follow candidate_ids order."})}),font:C.object({recommended_id:Tn,reason:Rn}).strict(),motion:C.object({recommended_id:kn,reason:Rn}).strict(),density:C.object({recommended_id:An,reason:Rn}).strict(),conversion:Rt.optional(),generated_at:Uc}).strict(),UC=C.object({force_refresh:C.boolean().optional()}).strict(),qC=C.object({request_id:C.string().trim().min(1).max(160),site_id:T,cached:C.boolean(),recommendation:GS,selection:Gc}).strict(),FC=C.object({recommendation_id:C.string().uuid(),expected_version:C.number().int().min(1),theme_preset_id:In,color_seeds:ys,surface_mode:C.enum(["light","dark"]),font_pairing_id:Tn,motion_preset_id:kn,density:An,radius:bs.optional(),aesthetic_note:C.string().trim().max(qc).optional()}).strict(),GC=C.object({selection:Gc}).strict(),KC=C.object({tenant_id:C.string().trim().min(1).max(160),site_id:T,site_language:C.string().trim().min(2).max(35),owner_locale:fe,industry:C.string().trim().min(1).max(160).optional(),strategy_version_id:C.string().uuid(),strategy_version:C.number().int().min(1),strategy_checksum:C.string().regex(/^[a-f0-9]{64}$/),strategy_summary:C.array(C.string().trim().min(1).max(500)).min(1).max(ve),reference_image_source_id:xt.optional(),owner_whole_site_request:C.string().trim().min(1).max(Ot).optional()}).strict(),sa=C.object({theme_candidates:C.array(Fc).length(3),conversion:Rt.optional()}).strict().superRefine((e,n)=>{let s=new Set;e.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 WC(){return ea.map(e=>Fc.parse({name:e.name,description:e.description,reason:e.fallbackReason,color_seeds:e.colorSeeds,surface_mode:e.surfaceMode,radius:e.radius,font_pairing_id:Qi[0],motion_preset_id:Ji[0],density:Zi[1]}))}function KS(e){return e.radius??Mc(e.theme_preset_id)??"lg"}function zC(e){let n=Cc(e.font_pairing_id),s=Oc(e.motion_preset_id);return{colorSeeds:e.color_seeds,surfaceMode:e.surface_mode,fonts:{heading:n.heading,body:n.body},density:e.density,motionLevel:s.motionLevel,motionPreset:s.id,radius:KS(e)}}function BC(e,n){let s=e.theme.candidates[0];return{version:1,recommendation_id:e.id,theme_preset_id:s.id,color_seeds:s.color_seeds,surface_mode:s.surface_mode,font_pairing_id:e.font.recommended_id,motion_preset_id:e.motion.recommended_id,density:e.density.recommended_id,radius:s.radius,updated_at:n.toISOString()}}import{z as ia}from"zod";function WS(e){return JSON.stringify([e.color_seeds.primary.toUpperCase(),e.color_seeds.accent.toUpperCase(),e.color_seeds.foreground.toUpperCase(),e.surface_mode,e.font_pairing_id,e.radius,e.motion_preset_id,e.density])}var zS=ia.object(sa.shape).strict().superRefine((e,n)=>{let s=new Set;e.theme_candidates.forEach((a,i)=>{let r=WS(a);s.has(r)&&n.addIssue({code:"custom",path:["theme_candidates",i],message:"Theme candidates must have pairwise distinct visual identities"}),s.add(r)})}),YC=ia.union([sa,zS.safeExtend({model_profile:ia.literal("azure-gpt")})]);import{z as gt}from"zod";var JC=gt.object({site_id:T,site_language:gt.string().trim().min(2).max(35),business_facts:gt.array(gt.string().trim().min(1).max(1e3)).min(1).max(8)}).strict(),BS=gt.enum(["high","medium","low"]),ev=gt.object({skill_name:gt.string().trim().min(1).max(80).nullable(),confidence:BS,reason:gt.string().trim().min(1).max(240)}).strict();import{z as Q}from"zod";var aa=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],xs=Q.object({name:Q.string().min(1).max(100),type:Q.enum(aa),label:Q.string().min(1).max(255),required:Q.boolean().optional(),options:Q.array(Q.string()).optional()}),sv=Q.object({name:Q.string(),cms_type:Q.string(),label:Q.string().optional(),required:Q.boolean().optional(),value_shape:Q.string().optional(),front_display:Q.enum(["visible","internal","forbidden"]).optional(),choices:Q.array(Q.object({value:Q.union([Q.string(),Q.number()]),label:Q.string()})).optional()}),iv=Q.object({route_file_path:Q.string().min(1),target_component_path:Q.string().min(1),content_type_hint:Q.string().min(1),collection_purpose:Q.enum(["generic","product"]).optional(),required_fields:Q.array(xs).optional(),mode:Q.enum(["bind_existing","provision"]),list_mode:Q.enum(["page","embedded"]).optional(),fields:Q.array(xs).optional(),seed_records:Q.array(Q.record(Q.string(),Q.unknown())).optional()});import{z as N}from"zod";var Pn=N.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),Es=N.string().regex(/^[a-f0-9]{64}$/),Rs=N.string().regex(/^[a-z][a-z0-9-]{0,99}$/),Is=N.string().regex(/^[a-z0-9]{1,30}$/),qe=e=>N.string().max(e).refine(n=>n.trim().length>0,"Value must not be blank"),Kc=N.object({id:N.string().uuid(),key:qe(100),name:qe(255)}).strict(),zc=new Set(["title","summary","description","category","thumbnail","url","admin_id"]),HS=new Set(["title","summary","description","image_query"]),VS=new Set(["category","thumbnail","url","admin_id","page","pages","route","path","component","components","snapshot","run","site_id","cms_site_id","tenant_id","token","secret","password","authorization","headers","__proto__","prototype","constructor"]),Wc=new Set(["select","multiselect"]),$S=new Set(["title","text","richtext","date","datetime","url","email","color"]),YS=N.object({name:qe(100),label:qe(255),type:N.enum(aa),required:N.boolean().optional(),options:N.array(qe(100)).max(100).optional()}).strict().superRefine((e,n)=>{let s=e.options??[];Wc.has(e.type)&&s.length===0&&n.addIssue({code:"custom",path:["options"],message:"Choice fields require at least one option"}),!Wc.has(e.type)&&s.length>0&&n.addIssue({code:"custom",path:["options"],message:"Only choice fields may declare options"}),new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["options"],message:"Field options must be unique"}),zc.has(e.name)&&n.addIssue({code:"custom",path:["name"],message:"Reserved CMS field names cannot be declared"})}),XS=N.array(YS).min(1).max(200),QS=N.array(N.record(N.string(),N.unknown())).max(1e3);function Ue(e,n,s){e.addIssue({code:"custom",path:n,message:s})}var ZS=N.object({name:qe(30),slug:Is,collection_purpose:N.enum(["generic","product"]).optional(),fields:XS,seed_records:QS}).strict().superRefine((e,n)=>{let s=e.fields.map(i=>i.name);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["fields"],message:"Field names must be unique"}),s.some(i=>!zc.has(i))||n.addIssue({code:"custom",path:["fields"],message:"At least one custom field is required"});let a=new Map(e.fields.map(i=>[i.name,i]));e.seed_records.forEach((i,r)=>{for(let[m,c]of Object.entries(i)){let p=["seed_records",r,m];if(VS.has(m)){Ue(n,p,"Seed cannot write reserved or runtime-owned fields");continue}if(m==="image_query"){(typeof c!="string"||c.trim()==="")&&Ue(n,p,"image_query must be a non-empty string");continue}if(HS.has(m)){typeof c!="string"&&Ue(n,p,"Seed skeleton text fields must be strings");continue}let I=a.get(m);if(!I){Ue(n,p,"Seed contains an undeclared field");continue}if(c==null){Ue(n,p,"Seed field values must not be null");continue}if(I.type==="select")(typeof c!="string"||!(I.options??[]).includes(c))&&Ue(n,p,"Seed select value must be one of the declared options");else if(I.type==="multiselect")(!Array.isArray(c)||c.length===0||c.some(R=>typeof R!="string"||!(I.options??[]).includes(R)))&&Ue(n,p,"Seed multiselect value must contain only declared options");else if(I.type==="number")(typeof c!="number"||!Number.isFinite(c))&&Ue(n,p,"Seed number values must be finite numbers");else if(I.type==="boolean")typeof c!="boolean"&&Ue(n,p,"Seed boolean values must be booleans");else if(I.type==="tag"){let R=Array.isArray(c)?c:[c];(R.length===0||R.some(w=>typeof w!="string"||w.trim()===""))&&Ue(n,p,"Seed tag values must be non-empty strings")}else $S.has(I.type)&&typeof c!="string"&&Ue(n,p,"Seed text-like values must be strings")}for(let m of e.fields)m.required&&!(m.name in i)&&Ue(n,["seed_records",r,m.name],"Required fields must be present in every seed record")}),new TextEncoder().encode(JSON.stringify(e)).byteLength>1024*1024&&n.addIssue({code:"custom",path:[],message:"Application template must not exceed 1048576 UTF-8 bytes"})}),oa=N.object({schema_version:N.literal(1),application:ZS}).strict(),JS=N.object({templateId:N.string().uuid(),stableKey:Rs,resolvedVersion:Pn,digest:Es,template:oa}).strict(),ef=JS,tf={alreadyCreated:"APPLICATION_ALREADY_CREATED",slugConflict:"APPLICATION_SLUG_CONFLICT",createInProgress:"APPLICATION_CREATE_IN_PROGRESS",cmsUnbound:"APPLICATION_CMS_UNBOUND",templateVersionUnavailable:"APPLICATION_TEMPLATE_VERSION_UNAVAILABLE",createFailed:"APPLICATION_CREATE_FAILED",createResultUnknown:"APPLICATION_CREATE_RESULT_UNKNOWN"},Bc=N.enum(Object.values(tf)),Hc=N.object({category_status:N.enum(["succeeded","failed","not_attempted"]),seed_status:N.enum(["skipped","succeeded","partial","failed"]),requested_count:N.number().int().nonnegative(),written_count:N.number().int().nonnegative().nullable(),published_count:N.number().int().nonnegative().nullable(),errors:N.array(N.object({stage:N.enum(["category","seed","receipt"]),code:qe(100)}).strict()).max(20)}).strict(),nf=N.object({templateId:N.string().uuid(),stableKey:Rs,title:qe(200),description:N.string().max(1e3),thumbnailUrl:N.string().url().nullable(),resolvedVersion:Pn,digest:Es,application:N.object({name:qe(30),slug:Is}).strict(),categories:N.array(Kc),tags:N.array(Kc),status:N.enum(["available","creating","created","conflict","failed"]),errorCode:Bc.nullable().optional(),template:oa.optional()}).strict(),Vc=N.object({items:N.array(nf)}).strict(),cv=N.object({version:Pn}).strict(),sf=N.object({app_slug:Is,name:qe(30),template:N.object({stable_key:Rs,version:Pn,digest:Es}).strict()}).strict(),af=N.object({status:N.literal("created"),application:sf,initialization:Hc}).strict(),mv=af,of=N.object({stable_key:Rs,version:Pn,digest:Es,created_at:N.string().datetime().nullable(),initialization:Hc.nullable()}).strict(),rf=N.object({app_slug:Is,name:qe(30),collection_slug:N.string().min(1),detail_prefix:N.string().min(1).optional(),source:of.nullable()}).strict(),lv=N.object({applications:N.array(rf)}).strict(),pv=Vc,dv=N.object({code:Bc,message:qe(500)}).strict(),uv=oa,_v=ef,gv=Vc;import{z as re}from"zod";var $c=e=>re.string().max(e).refine(n=>n.trim().length>0,"Value must not be blank"),cf=xs.strict(),Xc=re.array(cf).min(1).max(200),mf=re.array(re.record(re.string(),re.unknown())).max(1e3),lf=re.string().regex(/^[a-z0-9]{1,30}$/),ra=re.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),bv=re.object({name:$c(30),slug:$c(50),collection_purpose:re.enum(["generic","product"]).optional(),fields:Xc}).strict(),Yc=re.object({collection_slug:lf,detail_prefix:re.string().min(1).max(255),plugin_id:ra.optional()}).strict(),yv=re.discriminatedUnion("kind",[Yc.extend({kind:re.literal("created")}),Yc.extend({kind:re.literal("exists")})]),xv=re.object({fields:Xc,seed_records:mf,category_id:ra}).strict(),pf=re.record(re.string().min(1),re.string().min(1).nullable()),Ev=re.object({ids:re.array(ra).max(1e3),urls:pf,failed:re.array(re.unknown()).max(1e3)}).strict();function Rv(e){return e.replace(/[^a-zA-Z0-9]/g,"").toLowerCase().slice(0,30)}import{z as he}from"zod";var Ts=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number","file"],df=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number"],uf=he.object({name:he.string().min(1).max(100),type:he.enum(df),label:he.string().min(1).max(255),required:he.boolean().optional(),options:he.array(he.string()).optional()}),_f=he.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),kv=he.object({mode:he.enum(["bind_existing","provision"],{error:'mode is required. Use "bind_existing" or "provision". Never call connect_form with {}.'}),form_hint:he.string().min(1).optional(),name:he.string().min(1).max(255).optional(),component_slug:_f,description:he.string().min(1).max(1e3).optional(),fields:he.array(uf).optional()}).superRefine((e,n)=>{e.mode==="bind_existing"&&!e.form_hint?.trim()&&n.addIssue({code:"custom",path:["form_hint"],message:"form_hint is required for bind_existing"}),e.mode==="provision"&&!e.name?.trim()&&n.addIssue({code:"custom",path:["name"],message:"name is required for provision"})}),Av=he.object({name:he.string(),label:he.string(),cms_type:he.string(),required:he.boolean()});import{z as d}from"zod";var wn=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,Wt=/^[A-Za-z][A-Za-z0-9_-]{0,127}$/,ks=/^[A-Za-z][A-Za-z0-9_]{0,99}$/,em=/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/,ma=/^[a-z][a-z0-9-]{0,99}$/,tm=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,Qc=2,Zc=3,As=d.string().regex(wn),gf=d.string().regex(wn),la=d.string().regex(wn),Cn=d.string().regex(ks),pa=d.string().regex(em),hf=d.discriminatedUnion("status",[d.object({status:d.literal("unbound"),form_code:d.null()}).strict(),d.object({status:d.literal("bound"),form_code:d.string().regex(Wt)}).strict(),d.object({status:d.literal("missing"),form_code:d.string().regex(Wt)}).strict()]),Sf=d.object({value:pa,label:d.string().trim().min(1).max(255)}).strict(),ff=d.object({kind:d.literal("field"),field_name:Cn,type:d.enum(Ts),label:d.string().trim().min(1).max(255),required:d.boolean(),span:d.enum(["full","half"]),options:d.array(Sf).max(100),max_files:d.number().int().min(1).max(5).optional()}).strict(),bf=d.object({kind:d.literal("step-break"),step_id:d.string().regex(wn)}).strict(),yf=d.discriminatedUnion("kind",[ff,bf]),xf=d.object({field_name:Cn,type:d.enum(Ts),last_label:d.string().max(255)}).strict(),Ef=d.object({field_name:Cn,value:pa,last_label:d.string().max(255)}).strict(),Rf=d.discriminatedUnion("kind",[d.object({kind:d.literal("custom")}).strict(),d.object({kind:d.literal("template"),slug:d.string().regex(ma),version:d.string().regex(tm)}).strict()]),If={select:2,radio:2,multiselect:1,DropdownSelection:2,RadioButton:2,Checkbox:1};function Qe(e){return e.toLowerCase()}function nm(e,n){return e.trim().toLocaleLowerCase(n)}function Kt(e,n){return`${Qe(e)}\0${n}`}function Ee(e,n,s,a){let i=new Set;for(let r of e){if(i.has(r)){a.addIssue({code:"custom",path:n,message:s});return}i.add(r)}}function da(e,n,s,a){let i=If[e]??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 ua=d.object({schema_version:d.literal(1),min_runtime_version:d.number().int().positive(),form_definition_id:As,binding:hf,content_locale:fe,features:d.object({multistep:d.boolean()}).strict(),copy:d.object({title:d.string().max(255),description:d.string().max(1e3),submit_button:d.string().trim().min(1).max(100),success_message:d.string().trim().min(1).max(500),error_message:d.string().max(500)}).strict(),layout:d.object({columns:d.enum(["one","two"])}).strict(),nodes:d.array(yf).min(1).max(200),source:Rf,retired:d.object({fields:d.array(xf).max(1e3),options:d.array(Ef).max(5e3)}).strict(),compatibility:d.object({standardization_version:d.number().int().positive(),diagnostics:d.array(d.string().trim().min(1).max(500)).max(100)}).strict()}).strict().superRefine((e,n)=>{let s=e.nodes.flatMap((c,p)=>c.kind==="field"?[[p,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=e.nodes.filter(c=>c.kind==="step-break");!e.features.multistep&&i.length>0&&n.addIssue({code:"custom",path:["nodes"],message:"step-break requires the multistep feature"}),e.features.multistep&&(e.min_runtime_version<Qc&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`multistep requires runtime version ${Qc}`}),i.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"multistep requires at least one step-break"}));for(let[c,p]of e.nodes.entries())p.kind==="step-break"&&(c===0||c===e.nodes.length-1||e.nodes[c-1]?.kind==="step-break"||e.nodes[c+1]?.kind==="step-break")&&n.addIssue({code:"custom",path:["nodes",c],message:"step-break must separate two non-empty steps"});Ee(i.map(c=>c.step_id),["nodes"],"step_id must be unique",n),Ee(a.map(c=>Qe(c.field_name)),["nodes"],"field_name must be unique",n),Ee(e.retired.fields.map(c=>Qe(c.field_name)),["retired","fields"],"retired field_name must be unique",n);let r=new Set(e.retired.fields.map(c=>Qe(c.field_name)));for(let[c,p]of s)r.has(Qe(p.field_name))&&n.addIssue({code:"custom",path:["nodes",c,"field_name"],message:"retired field_name cannot be reused"}),da(p.type,p.options.length,["nodes",c,"options"],n),p.type==="file"?e.min_runtime_version<Zc&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`file fields require runtime version ${Zc}`}):p.max_files!==void 0&&n.addIssue({code:"custom",path:["nodes",c,"max_files"],message:"max_files is only valid for file fields"}),Ee(p.options.map(I=>I.value),["nodes",c,"options"],"option value must be unique within a field",n),Ee(p.options.map(I=>nm(I.label,e.content_locale)),["nodes",c,"options"],"option label must be unique within a field",n);Ee(e.retired.options.map(c=>Kt(c.field_name,c.value)),["retired","options"],"retired option identity must be unique",n);let m=new Set(e.retired.options.map(c=>Kt(c.field_name,c.value)));for(let[c,p]of s)for(let[I,R]of p.options.entries())m.has(Kt(p.field_name,R.value))&&n.addIssue({code:"custom",path:["nodes",c,"options",I,"value"],message:"retired option value cannot be reused"})}),Tf=["copy.title","copy.description","copy.submit_button","copy.success_message","copy.error_message","nodes.*.label","nodes.*.options.*.label"],kf=new Set(Tf);function jv(e){let n=e.map(s=>typeof s=="number"||/^\d+$/.test(s)?"*":s).join(".");return kf.has(n)}function Nv(e,n){let s=[],a=e.nodes.filter(c=>c.kind==="field"),i=new Map(n.nodes.filter(c=>c.kind==="field").map(c=>[Qe(c.field_name),c])),r=new Map(n.retired.fields.map(c=>[Qe(c.field_name),c])),m=new Map(n.retired.options.map(c=>[Kt(c.field_name,c.value),c]));for(let c of a){let p=Qe(c.field_name),I=i.get(p),R=r.get(p);I&&I.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),I&&I.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),!I&&R&&R.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),!I&&R&&R.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),!I&&!r.has(p)&&s.push({code:"FIELD_RETIREMENT_MISSING",field_name:c.field_name});let w=new Set(I?.options.map(F=>F.value)??[]);for(let F of c.options){let B=m.get(Kt(c.field_name,F.value));!w.has(F.value)&&B&&B.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),!w.has(F.value)&&!B&&s.push({code:"OPTION_RETIREMENT_MISSING",field_name:c.field_name,value:F.value})}}for(let c of e.retired.fields){let p=r.get(Qe(c.field_name));p&&p.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),p&&p.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),p||s.push({code:"FIELD_RETIREMENT_MISSING",field_name:c.field_name})}for(let c of e.retired.options){let p=m.get(Kt(c.field_name,c.value));p&&p.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),p||s.push({code:"OPTION_RETIREMENT_MISSING",field_name:c.field_name,value:c.value})}return s}var Af=d.enum(nn),ht=d.object({english:d.string().max(1e3),translations:d.partialRecord(Af,d.string().max(1e3)).optional()}).strict(),Pf=d.object({template_option_key:d.string().regex(em),label:ht}).strict(),wf=d.object({template_field_key:d.string().regex(ks),type:d.enum(Ts),label:ht,required:d.boolean(),span:d.enum(["full","half"]),options:d.array(Pf).max(100)}).strict(),Cf=d.object({template_step_key:d.string().regex(ks),after_field_key:d.string().regex(ks)}).strict(),Lv=["lead-generation","trial-and-samples","quote-and-commerce","appointments-and-visits","resources-and-subscriptions","service-and-channel"],Mv=[1,1,1,1,1,1],sm=d.string().regex(ma),vf=d.object({schema_version:d.literal(1),slug:sm,name:ht,template_count:d.number().int().min(0).max(500)}).strict().superRefine((e,n)=>{e.name.english.trim()===""&&n.addIssue({code:"custom",path:["name","english"],message:"English category name is required"})}),Df=d.object({schema_version:d.literal(1),slug:d.string().regex(ma),version:d.string().regex(tm),category:sm,copy:d.object({title:ht,description:ht,submit_button:ht,success_message:ht,error_message:ht}).strict(),layout:d.object({columns:d.enum(["one","two"])}).strict(),fields:d.array(wf).min(1).max(200),step_breaks:d.array(Cf).max(20).optional()}).strict().superRefine((e,n)=>{for(let r of["title","description","submit_button","success_message","error_message"])e.copy[r].english.trim()===""&&n.addIssue({code:"custom",path:["copy",r,"english"],message:"English baseline text is required"});Ee(e.fields.map(r=>r.template_field_key),["fields"],"template_field_key must be unique",n);let s=new Map(e.fields.map((r,m)=>[r.template_field_key,m])),a=e.step_breaks??[];Ee(a.map(r=>r.template_step_key),["step_breaks"],"template_step_key must be unique",n),Ee(a.map(r=>r.after_field_key),["step_breaks"],"step breaks must not share an anchor field",n);let i=-1;for(let[r,m]of a.entries()){let c=s.get(m.after_field_key);c===void 0||c>=e.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}e.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,m]of e.fields.entries()){m.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",r,"label","english"],message:"English field label is required"}),da(m.type,m.options.length,["fields",r,"options"],n),Ee(m.options.map(c=>c.template_option_key),["fields",r,"options"],"template_option_key must be unique within a field",n),Ee(m.options.map(c=>c.label.english.trim().toLowerCase()),["fields",r,"options"],"English option labels must be unique within a field",n);for(let[c,p]of m.options.entries())p.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",r,"options",c,"label","english"],message:"English option label is required"})}}),Uv=d.object({schema_version:d.literal(1),visibility:d.enum(["internal","public"]),categories:d.array(vf).max(500),templates:d.array(Df).max(500)}).strict().superRefine((e,n)=>{let s=(i,r)=>{let m=nn.filter(c=>!i.translations?.[c]?.trim());m.length>0&&n.addIssue({code:"custom",path:[...r,"translations"],message:`public template copy is missing locales: ${m.join(", ")}`})};Ee(e.categories.map(i=>i.slug),["categories"],"template category slug must be unique",n);let a=new Set(e.categories.map(i=>i.slug));for(let[i,r]of e.categories.entries()){let m=e.templates.filter(c=>c.category===r.slug).length;r.template_count!==m&&n.addIssue({code:"custom",path:["categories",i,"template_count"],message:"template_count must match catalog templates"})}Ee(e.templates.map(i=>i.slug),["templates"],"template slug must be unique",n);for(let[i,r]of e.templates.entries())a.has(r.category)||n.addIssue({code:"custom",path:["templates",i,"category"],message:"template category must exist in catalog categories"});if(e.visibility==="public"){for(let[i,r]of e.categories.entries())s(r.name,["categories",i,"name"]);for(let[i,r]of e.templates.entries()){for(let[m,c]of Object.entries(r.copy))s(c,["templates",i,"copy",m]);for(let[m,c]of r.fields.entries()){s(c.label,["templates",i,"fields",m,"label"]);for(let[p,I]of c.options.entries())s(I.label,["templates",i,"fields",m,"options",p,"label"])}}}});function qv(e,n){let s=fo(n),a=s?e.translations?.[s]:void 0;return a!==void 0&&a.trim()!==""?a:e.english}var Of=["Text","Summary","Email","Phone","DropdownSelection","RadioButton","Checkbox","Boolean","Date","Num","MultipleFile","SpecificFile"],jf={text:"Text",textarea:"Summary",email:"Email",phone:"Phone",select:"DropdownSelection",radio:"RadioButton",multiselect:"Checkbox",boolean:"Boolean",date:"Date",number:"Num",file:"MultipleFile"},Nf=d.object({value:pa,label:d.string().trim().min(1).max(255)}).strict(),Lf=d.object({field_name:Cn,field_type:d.enum(Of),field_label:d.string().trim().min(1).max(255),is_required:d.boolean(),sort_order:d.number().int().nonnegative(),options:d.array(Nf).max(100)}).strict(),im=d.object({version:d.literal(1),locale:fe,fields:d.array(Lf).min(1).max(200)}).strict().superRefine((e,n)=>{Ee(e.fields.map(s=>Qe(s.field_name)),["fields"],"field_name must be unique",n);for(let[s,a]of e.fields.entries())da(a.field_type,a.options.length,["fields",s,"options"],n),Ee(a.options.map(i=>i.value),["fields",s,"options"],"option value must be unique within a field",n),Ee(a.options.map(i=>nm(i.label,e.locale)),["fields",s,"options"],"option label must be unique within a field",n)});function Fv(e){let n=e.nodes.filter(s=>s.kind==="field").map((s,a)=>({field_name:s.field_name,field_type:s.type==="file"&&s.max_files===1?"SpecificFile":jf[s.type],field_label:s.label,is_required:s.required,sort_order:a,options:s.options.map(i=>({...i}))}));return im.parse({version:1,locale:e.content_locale,fields:n})}var oe=d.string().regex(/^sha256:[0-9a-f]{64}$/),Mf=d.union([Se,d.enum(["app/api/forms/[code]/route.ts","hooks/use-cms-form-submit.ts","lib/cms/forms.ts","lib/cms/client.ts"])]),Uf=d.object({path:Mf,content_hash:oe.nullable()}).strict(),qf=d.array(Uf).min(1).max(500).superRefine((e,n)=>{Ee(e.map(s=>s.path),[],"affected file paths must be unique",n)}),_a=d.object({grade:d.enum(["standard","A","B","C"]),required:d.boolean(),pending_confirmations:d.array(d.object({item_id:d.string().regex(wn),field_name:Cn.optional(),kind:d.enum(["form_copy","layout","field_label","field_type","field_required","field_options"]),message:d.string().trim().min(1).max(500)}).strict().superRefine((e,n)=>{e.kind.startsWith("field_")&&!e.field_name&&n.addIssue({code:"custom",path:["field_name"],message:"field confirmation items require field_name"})})).max(200)}).strict().superRefine((e,n)=>{let s=e.grade==="standard";s===e.required&&n.addIssue({code:"custom",path:["required"],message:s?"standard forms do not require standardization confirmation":"legacy forms require standardization confirmation"}),e.grade==="C"&&e.pending_confirmations.length===0&&n.addIssue({code:"custom",path:["pending_confirmations"],message:"grade C requires at least one pending confirmation"}),e.grade!=="C"&&e.pending_confirmations.length>0&&n.addIssue({code:"custom",path:["pending_confirmations"],message:"only grade C can contain pending confirmations"})}),Ff=d.object({site_id:T,form_definition_id:As,base_snapshot_id:k,expected_form_spec_hash:oe,expected_cms_schema_hash:oe.nullable(),draft_form_spec_hash:oe,desired_cms_schema_hash:oe,affected_files_hash:oe,shared_reference_hash:oe,shared_reference_count:d.number().int().positive(),confirm_shared_update:d.boolean(),recreate_missing_binding:d.boolean(),standardization:_a,confirm_standardization:d.boolean()}).strict(),am=d.object({reference_hash:oe,page_count:d.number().int().positive(),block_count:d.number().int().positive()}).strict().refine(e=>e.page_count<=e.block_count,{message:"page_count cannot exceed block_count"}),Gv=d.object({site_id:T,form_block_id:gf,base_snapshot_id:k,form_spec:ua,runtime_upgrade_required:d.boolean(),expected_form_spec_hash:oe,expected_cms_schema_hash:oe.nullable(),affected_files_hash:oe,shared_impact:am,standardization:_a}).strict(),Gf=d.object({operation_id:la,operation_fingerprint:oe,site_id:T,form_definition_id:As,base_snapshot_id:k,expected_form_spec_hash:oe,expected_cms_schema_hash:oe.nullable(),draft_form_spec:ua,draft_form_spec_hash:oe,desired_cms_schema_hash:oe,affected_files_hash:oe,shared_impact:am,confirm_shared_update:d.boolean(),recreate_missing_binding:d.boolean(),standardization:_a,confirm_standardization:d.boolean()}).strict().superRefine((e,n)=>{e.form_definition_id!==e.draft_form_spec.form_definition_id&&n.addIssue({code:"custom",path:["form_definition_id"],message:"form_definition_id must match draft_form_spec"}),e.shared_impact.block_count>1&&!e.confirm_shared_update&&n.addIssue({code:"custom",path:["confirm_shared_update"],message:"shared definition updates require explicit confirmation"});let s=e.draft_form_spec.binding.status==="missing";s!==e.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=e.draft_form_spec.binding.status==="bound",i=a&&e.standardization.required&&(e.standardization.grade==="B"||e.standardization.grade==="C");(a&&!i&&e.expected_cms_schema_hash===null||!a&&e.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"}),e.confirm_standardization!==e.standardization.required&&n.addIssue({code:"custom",path:["confirm_standardization"],message:e.standardization.required?"legacy standardization requires explicit confirmation":"standard forms cannot claim legacy standardization confirmation"})}),Kf=["created","validated","binding_reserved","candidate_ready","cms_applied","snapshot_promoted","committed","compensating","recovery_required","failed"],ga=d.enum(Kf),Wf=["pending","running","succeeded","failed","recovery_required"],om=d.enum(Wf),zf=["candidate_abandon","snapshot_reconcile","cms_restore"],rm=d.enum(zf),Bf=["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"],ha=d.enum(Bf),cm=d.enum(["wait","resume","retry_new_operation","manual_recovery","none"]),mm=d.enum(["not_started","pending","succeeded","failed"]),lm=d.object({operation_id:la,operation_fingerprint:oe,site_id:T,form_definition_id:As,stage:ga,status:om,base_snapshot_id:k,candidate_snapshot_id:k.nullable(),before_form_code:d.string().regex(Wt).nullable(),materialized_form_code:d.string().regex(Wt).nullable(),expected_form_spec_hash:oe,draft_form_spec_hash:oe,materialized_form_spec_hash:oe.nullable(),expected_cms_schema_hash:oe.nullable(),desired_cms_schema_hash:oe,retry_count:d.number().int().nonnegative(),failure_stage:rm.nullable(),last_error_code:ha.nullable(),retryable:d.boolean(),next_action:cm,preview_refresh_status:mm,created_at:d.string().datetime({offset:!0}),updated_at:d.string().datetime({offset:!0})}).strict().superRefine((e,n)=>{if(!(e.stage!=="committed"&&e.status!=="succeeded")){(e.stage!=="committed"||e.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"])e[s]===null&&n.addIssue({code:"custom",path:[s],message:`${s} is required for a committed success`});(e.failure_stage!==null||e.last_error_code!==null||e.retryable||e.next_action!=="none")&&n.addIssue({code:"custom",path:["next_action"],message:"a committed success cannot retain an error or retry action"})}}),Sa=d.object({operation:lm}).strict(),Kv=Sa,Wv=Sa,zv=d.object({operation_fingerprint:oe}).strict(),Bv=Sa,Hf=d.preprocess(e=>!e||typeof e!="object"||Array.isArray(e)||"standardization"in e||"confirm_standardization"in e?e:{...e,standardization:{grade:"standard",required:!1,pending_confirmations:[]},confirm_standardization:!1},Gf),Hv=d.object({operation:lm,request:Hf,cms_replace_result:d.unknown().nullable()}).strict(),Vf=d.object({stage:ga.optional(),status:om.optional(),candidate_snapshot_id:k.nullable().optional(),before_form_code:d.string().regex(Wt).nullable().optional(),materialized_form_code:d.string().regex(Wt).nullable().optional(),materialized_form_spec_hash:oe.nullable().optional(),retry_count:d.number().int().nonnegative().optional(),failure_stage:rm.nullable().optional(),last_error_code:ha.nullable().optional(),retryable:d.boolean().optional(),next_action:cm.optional(),preview_refresh_status:mm.optional()}).strict(),Vv=d.object({expected_updated_at:d.string().datetime({offset:!0}),operation:Vf,cms_replace_result:d.unknown().nullable().optional()}).strict().refine(e=>Object.keys(e.operation).length>0||Object.hasOwn(e,"cms_replace_result"),{message:"transition must change operation state or CMS result"}),$v=d.object({code:ha,message:d.string().trim().min(1).max(500),retryable:d.boolean(),operation_id:la.optional(),stage:ga.optional()}).strict();function $f(e){return Ff.parse({site_id:e.site_id,form_definition_id:e.form_definition_id,base_snapshot_id:e.base_snapshot_id,expected_form_spec_hash:e.expected_form_spec_hash,expected_cms_schema_hash:e.expected_cms_schema_hash,draft_form_spec_hash:e.draft_form_spec_hash,desired_cms_schema_hash:e.desired_cms_schema_hash,affected_files_hash:e.affected_files_hash,shared_reference_hash:e.shared_impact.reference_hash,shared_reference_count:e.shared_impact.block_count,confirm_shared_update:e.confirm_shared_update,recreate_missing_binding:e.recreate_missing_binding,standardization:e.standardization,confirm_standardization:e.confirm_standardization})}function Jc(e){for(let n=0;n<e.length;n+=1){let s=e.charCodeAt(n);if(s>=55296&&s<=56319){let a=e.charCodeAt(n+1);if(n+1>=e.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 ca(e,n){if(e===null)return"null";if(typeof e=="boolean")return e?"true":"false";if(typeof e=="number"){if(!Number.isFinite(e))throw new TypeError("canonical JSON numbers must be finite");return JSON.stringify(e)}if(typeof e=="string")return Jc(e),JSON.stringify(e);if(typeof e!="object")throw new TypeError("value is not valid JSON");if(n.has(e))throw new TypeError("canonical JSON cannot contain cycles");n.add(e);try{if(Array.isArray(e)){let r=[];for(let m=0;m<e.length;m+=1){if(!(m in e))throw new TypeError("canonical JSON cannot contain sparse arrays");r.push(ca(e[m],n))}return`[${r.join(",")}]`}let s=Object.getPrototypeOf(e);if(s!==Object.prototype&&s!==null)throw new TypeError("canonical JSON objects must be plain records");let a=e;return`{${Object.keys(a).sort().map(r=>(Jc(r),`${JSON.stringify(r)}:${ca(a[r],n)}`)).join(",")}}`}finally{n.delete(e)}}function fa(e){return ca(e,new Set)}async function Ps(e){let n=fa(e),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 Yv(e){return Ps(ua.parse(e))}async function Xv(e){return Ps(im.parse(e))}async function Qv(e){let n=qf.parse(e).map(s=>({...s})).sort((s,a)=>s.path<a.path?-1:s.path>a.path?1:0);return Ps({version:1,files:n})}async function Zv(e){return Ps($f(e))}import{z as v}from"zod";var tD=["page-seo","root-layout-metadata","nav-items"],nD=v.object({path:v.string(),title:v.string(),description:v.string().optional(),keywords:v.string().optional(),meta_tags_json:v.record(v.string(),v.record(v.string(),v.string())).nullish(),schema_json:v.union([v.record(v.string(),v.unknown()),v.array(v.record(v.string(),v.unknown())),v.string()]).nullish(),breadcrumbs_json:v.array(v.object({name:v.string().optional(),text:v.string().optional(),url:v.string().nullish()})).nullish()}),sD=v.object({metadataBase:v.string().optional(),title:v.union([v.string(),v.object({default:v.string().optional(),template:v.string().optional(),absolute:v.string().optional()})]).optional(),description:v.string().optional(),keywords:v.string().optional(),openGraph:v.object({title:v.string().optional(),description:v.string().optional(),type:v.string().optional(),siteName:v.string().optional(),url:v.string().optional(),locale:v.string().optional(),images:v.array(v.union([v.string(),v.object({url:v.string(),alt:v.string().optional()})])).optional()}).optional(),twitter:v.object({card:v.string().optional(),title:v.string().optional(),description:v.string().optional(),images:v.array(v.string()).optional()}).optional(),alternates:v.object({canonical:v.string().optional()}).optional()}),pm=()=>v.object({label:v.string(),href:v.string().optional(),targetType:v.enum(["page","anchor","external","email","phone","file","group"]).optional(),role:v.enum(["link","cta"]).optional(),openInNewTab:v.boolean().optional(),nofollow:v.boolean().optional(),description:v.string().optional(),badge:v.string().optional(),iconKey:v.string().optional()}),iD=pm().extend({children:v.array(pm()).optional()}),Yf=["title","description","keywords","breadcrumbs_json.*.name","breadcrumbs_json.*.text"],Xf=["path","meta_tags_json.**","schema_json.**","breadcrumbs_json.*.url"],Qf=["title","title.default","title.template","title.absolute","description","keywords","openGraph.title","openGraph.description","openGraph.siteName","openGraph.images.*.alt","twitter.title","twitter.description"],Zf=["metadataBase","openGraph.type","openGraph.url","openGraph.locale","openGraph.images.*","openGraph.images.*.url","twitter.card","twitter.images.*","alternates.canonical"],Jf=["label","description","badge"],eb=["href","targetType","role","iconKey"],dm={"page-seo":{localizable:Yf,machine:Xf},"root-layout-metadata":{localizable:Qf,machine:Zf},"nav-items":{localizable:Jf,machine:eb}},um="*",_m="**",tb="children";function nb(e){return typeof e=="number"||/^\d+$/.test(e)?um:e}function gm(e,n){let s=n.map(nb);return e!=="nav-items"?s:s.filter(a=>a!==um&&a!==tb)}function hm(e,n){let s=e.split(".");for(let a=0;a<s.length;a+=1){if(s[a]===_m)return!0;if(a>=n.length||s[a]!==n[a])return!1}return s.length===n.length}function sb(e,n){let s=e.split(".");if(n.length>=s.length)return!1;for(let a=0;a<n.length;a+=1){if(s[a]===_m)return!0;if(s[a]!==n[a])return!1}return!0}function aD(e,n){let s=gm(e,n);return s.length===0?!1:dm[e].localizable.some(a=>hm(a,s))}function oD(e,n){let s=gm(e,n);if(s.length===0)return!0;let{localizable:a,machine:i}=dm[e];return[...a,...i].some(r=>hm(r,s)||sb(r,s))}var mD=["product-search","migration-products","standard-form","form-submission-infrastructure"],ib=[{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/${at}.ts`,materializer:"migration-products"},{path:`components/site/generated/${at}-list.tsx`,materializer:"migration-products"},{path:`components/site/generated/${at}-list-view.tsx`,materializer:"migration-products"},{path:`components/site/generated/${at}-detail-view.tsx`,materializer:"migration-products"},{path:`app/${at}/[slug]/page.tsx`,materializer:"migration-products"},{path:`components/site/generated/${at}-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"}],ab=[{prefix:"components/site/generated/forms/form-",suffix:".tsx",materializer:"standard-form"}],lD=[{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 ob(e){return e.length>0&&!e.includes("/")&&!e.includes(".")}function pD(e){return ib.some(n=>n.path===e)?!0:ab.some(n=>!e.startsWith(n.prefix)||!e.endsWith(n.suffix)?!1:ob(e.slice(n.prefix.length,e.length-n.suffix.length)))}import{z as rt}from"zod";var rb=["provisioning","cms_app_created","seeded","ready","failed"],gD=rt.object({tenant_id:rt.string().min(1),site_id:T,collection_slug:rt.string().min(1),cms_collection_id:rt.string().min(1).nullable(),status:rt.enum(rb),owned_by_vcp:rt.boolean(),run_id:K.nullable(),last_error:rt.string().nullable(),created_at:rt.string().datetime(),updated_at:rt.string().datetime()});var Sm="/vibe/v1";function SD(e){let n=e?.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(Sm)?a:Sm,s.href.replace(/\/+$/,"")}catch{return n}}import{z as g}from"zod";var ws=g.string().url().refine(Ab,{message:"URL must use http or https"}),fm=g.string().trim().pipe(ws),cb=g.object({task_type:g.literal("home_url"),task_url:fm,planned_num:g.number().int().min(1).max(20).optional()}).strict(),mb=g.object({task_type:g.literal("url_list"),urls:g.array(ws).min(1).max(1e4)}).strict(),xD=g.discriminatedUnion("task_type",[cb,mb]),ED=g.object({page:g.coerce.number().int().positive().default(1),page_size:g.coerce.number().int().min(1).max(20).default(20)}).strict(),RD=g.object({home_url:fm}).strict(),wt=g.string().uuid(),zt=g.string().uuid(),ID=g.object({task_uuid:wt}).strict(),bm=g.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]),lb=g.object({task_uuid:wt,status:g.literal("NOT_STARTED"),total:g.literal(0)}).strict(),pb=g.object({task_uuid:wt,status:g.literal("PROCESSING"),total:g.literal(0)}).strict(),TD=g.enum(["no_suitable_page_candidate","page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"]),db=g.discriminatedUnion("status",[g.object({role:dt,status:g.literal("selected"),reason_code:g.null()}).strict(),g.object({role:dt,status:g.literal("not_found"),reason_code:g.literal("no_suitable_page_candidate")}).strict(),g.object({role:dt,status:g.literal("unknown"),reason_code:g.enum(["page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"])}).strict()]),ym=g.array(db).length(7).superRefine((e,n)=>{let s=new Set(e.map(a=>a.role));s.size!==e.length&&n.addIssue({code:"custom",message:"discovery coverage roles must be unique"});for(let a of dt.options)s.has(a)||n.addIssue({code:"custom",message:`discovery coverage is missing role ${a}`})}),ub=g.object({task_uuid:wt,status:g.literal("SUCCEEDED"),total:g.number().int().positive(),discovery_coverage:ym.optional()}).strict(),_b=g.enum(["TASK_FAILED","PROVIDER_CAPABILITY_LIMIT","WEBSITE_UNREACHABLE"]),gb=g.object({task_uuid:wt,status:g.literal("FAILED"),total:g.literal(0),error_code:_b,error_message:g.string().min(1),failure_stage:bm}).strict(),kD=g.discriminatedUnion("status",[lb,pb,ub,gb]),hb=g.object({url:ws,raw_html:g.string().min(1)}).strict(),AD=g.object({task_uuid:wt,status:g.literal("SUCCEEDED"),page:g.number().int().positive(),page_size:g.number().int().min(1).max(20),total:g.number().int().positive(),total_pages:g.number().int().positive(),pages:g.array(hb).max(20),discovery_coverage:ym.optional()}).strict().superRefine((e,n)=>{e.total_pages!==Math.ceil(e.total/e.page_size)&&n.addIssue({code:"custom",path:["total_pages"],message:"total_pages must equal ceil(total / page_size)"}),e.pages.length>e.page_size&&n.addIssue({code:"custom",path:["pages"],message:"pages must not exceed page_size"})}),PD=g.object({task_code:zt}).strict(),Sb=g.object({task_code:zt,status:g.literal("NOT_STARTED")}).strict(),fb=g.object({task_code:zt,status:g.literal("PROCESSING")}).strict(),bb=g.object({task_code:zt,status:g.literal("SUCCEEDED"),urls:g.array(ws)}).strict(),yb=g.literal("SITEMAP_DISCOVERY_FAILED"),xb=g.object({task_code:zt,status:g.literal("FAILED"),error_code:yb,error_message:g.string().min(1)}).strict(),wD=g.discriminatedUnion("status",[Sb,fb,bb,xb]),CD=g.object({company_name:g.string().regex(/\S/u)}).strict(),Eb=g.object({company_name:g.string(),brand_name:g.string(),main_products:g.array(g.string()),industry:g.array(g.string()),subfields:g.array(g.string()),business_intro:g.string(),registered_capital:g.string(),legal_representative:g.string(),target_markets:g.array(g.string()),target_customer_industries:g.array(g.string()),target_customer_roles:g.array(g.string()),purchase_scenarios:g.string(),differentiators:g.array(g.string()),competitors:g.array(g.object({name:g.string(),official_url:g.string()}).strict()).max(3),qualifications:g.array(g.string()),representative_cases:g.array(g.string()),acquisition_channels:g.array(g.string()),desired_domain:g.string(),brand_tone:g.string(),timezone:g.string()}).strict(),Cs=g.object({company_uuid:g.string().uuid(),company_info:Eb,created_at:g.string().datetime(),updated_at:g.string().datetime()}),Rb=Cs.extend({status:g.literal("NOT_STARTED"),last_error_code:g.null(),last_error_message:g.null(),started_at:g.null(),completed_at:g.null()}).strict(),Ib=Cs.extend({status:g.literal("PROCESSING"),last_error_code:g.null(),last_error_message:g.null(),started_at:g.string().datetime(),completed_at:g.null()}).strict(),xm=Cs.extend({status:g.literal("SUCCEEDED"),last_error_code:g.null(),last_error_message:g.null(),started_at:g.string().datetime(),completed_at:g.string().datetime()}).strict(),Em=Cs.extend({status:g.literal("FAILED"),last_error_code:g.string().min(1),last_error_message:g.string().min(1),started_at:g.string().datetime(),completed_at:g.string().datetime()}).strict(),vD=g.discriminatedUnion("status",[xm,Em]),DD=g.discriminatedUnion("status",[Rb,Ib,xm,Em]),Tb=["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"],kb=g.enum(Tb),OD=g.object({error_code:kb,error_message:g.string().min(1),failure_stage:bm.optional(),task_uuid:wt.optional(),task_code:zt.optional()}).strict();function Ab(e){try{let n=new URL(e).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as L}from"zod";var Fe=L.string().url().refine(Cb,{message:"URL must use http or https"}),Rm=L.string().min(1).max(512),vs=L.string().datetime({offset:!0}),Im=L.enum(["scraping","completed","failed","expired"]),LD=L.object({url:Fe,ignore_cache:L.boolean(),sitemap:L.enum(["include","skip"]),include_subdomains:L.boolean(),ignore_query_parameters:L.boolean(),limit:L.number().int().min(1).max(1e5)}).strict(),MD=L.object({links:L.array(Fe).max(1e5)}).strict(),UD=L.object({url:Fe,limit:L.number().int().min(1).max(1e5),max_discovery_depth:L.literal(1),crawl_entire_domain:L.literal(!1),allow_subdomains:L.literal(!0),sitemap:L.literal("skip")}).strict(),qD=L.object({crawl_id:Rm,expires_at:vs.optional()}).strict(),FD=L.object({status:Im,urls:L.array(Fe).max(1e5),next:Fe.optional(),expires_at:vs}).strict(),GD=L.object({url:Fe,formats:L.tuple([L.literal("rawHtml")]),only_main_content:L.literal(!1),max_age:L.number().int().nonnegative()}).strict(),KD=L.object({url:Fe,raw_html:L.string().min(1),status_code:L.number().int().min(100).max(599).nullable()}).strict(),WD=L.object({urls:L.array(Fe).min(1).max(1e4),formats:L.tuple([L.literal("rawHtml")]),ignore_invalid_urls:L.literal(!1),max_age:L.number().int().nonnegative(),max_concurrency:L.number().int().positive().optional()}).strict(),zD=L.object({batch_id:Rm,expires_at:vs.optional()}).strict(),Pb=L.object({url:Fe,raw_html:L.string().min(1)}).strict(),BD=L.object({status:Im,total:L.number().int().nonnegative(),completed:L.number().int().nonnegative(),pages:L.array(Pb).max(1e4),next:Fe.optional(),expires_at:vs}).strict().superRefine((e,n)=>{e.completed>e.total&&n.addIssue({code:"custom",path:["completed"],message:"completed must not exceed total"})}),wb=L.object({url:Fe,error_message:L.string().min(1)}).strict(),HD=L.object({errors:L.array(wb).max(1e4),robots_blocked:L.array(Fe).max(1e4)}).strict(),VD=L.object({active:L.number().int().nonnegative(),waiting:L.number().int().nonnegative(),max_concurrency:L.number().int().positive()}).strict();function Cb(e){try{let n=new URL(e).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as b}from"zod";var km=b.lazy(()=>Dn),vb=b.enum(["page","block"]),Os=b.enum(["component","page","pages"]),Db=b.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),Ct=Db,Am=b.object({requested_locale:Ct,resolved_locale:Ct,fallback_used:b.boolean()}).strict(),vn=b.object({id:b.string().uuid(),key:b.string().min(1),name:b.string().min(1)}).strict(),Ds=vn.extend({color:b.string().nullable()}).strict(),ZD=b.object({kind:vb,category_id:b.string().uuid().optional(),tag_id:b.string().uuid().optional(),search:b.string().trim().min(1).max(200).optional(),limit:b.coerce.number().int().min(1).max(50).default(20),cursor:b.string().min(1).optional()}).strict(),Ob=b.object({stable_key:b.string().min(1),type:Os,title:b.string().min(1).max(200),description:b.string().max(1e3),thumbnail_url:b.string().url().nullable(),resolved_version:b.number().int().positive(),content_schema_version:b.literal(3),category:vn.nullable(),tags:b.array(Ds),page_count:b.number().int().nonnegative(),component_count:b.number().int().nonnegative(),locale:Am}).strict(),JD=b.object({items:b.array(Ob),facets:b.object({categories:b.array(vn),tags:b.array(Ds)}).strict(),next_cursor:b.string().nullable()}).strict(),eO=b.object({operation_id:b.string().uuidv7(),resolved_version:b.number().int().positive(),base_sitemap_id:b.string().uuid(),base_sitemap_version:b.number().int().positive(),sitemap:km,target_page_id:b.string().min(1).optional()}).strict(),tO=b.object({next_sitemap:km,applied:b.object({stable_key:b.string().min(1),resolved_version:b.number().int().positive(),template_type:Os,page_ids:b.array(b.string().min(1)),block_ids:b.array(b.string().min(1))}).strict(),locale:Am,warnings:b.array(b.string())}).strict(),Pm=b.object({nodeId:b.string().uuid(),type:b.string().trim().min(1).max(100),label:b.string().trim().min(1).max(200),variant:b.string().trim().min(1).max(100).optional(),order:b.number().int().nonnegative(),props:b.record(b.string(),b.unknown()),thumbnail:b.string().url().optional(),source:b.unknown().optional()}).strict(),Tm=b.object({nodeId:b.string().uuid().optional(),slug:b.string().regex(/^\/$|^\/[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*$/u),navigation:b.object({showInHeader:b.boolean(),showInFooter:b.boolean(),order:b.number().int().nonnegative()}).strict(),components:b.array(Pm).min(1).max(100),thumbnail:b.string().url().optional(),source:b.unknown().optional()}).strict(),jb=b.union([Pm,Tm,b.object({pages:b.array(Tm).min(1).max(50),thumbnail:b.string().url().optional(),source:b.unknown().optional()}).strict()]),Nb=b.object({title:b.string().min(1).max(200),description:b.string().min(1).max(1e3),prompt:b.string().min(1).max(8192)}).strict(),Lb=b.object({locale:Ct,title:b.string().min(1).max(200),content:b.object({description:b.string().min(1).max(1e3),prompt:b.string().min(1).max(8192),nodes:b.record(b.string().uuid(),Nb)}).strict()}).strict(),nO=b.object({templateId:b.string().uuid(),stableKey:b.string().min(1),type:Os,resolvedVersion:b.number().int().positive(),contentSchemaVersion:b.literal(3),structure:jb,requestedLocale:Ct,resolvedLocale:Ct,fallbackUsed:b.boolean(),contents:b.array(Lb).length(1)}).strict().superRefine((e,n)=>{(e.type==="component"&&!("type"in e.structure)||e.type==="page"&&!("components"in e.structure)||e.type==="pages"&&!("pages"in e.structure))&&n.addIssue({code:"custom",path:["structure"],message:"Template type and structure must match."});let s=Mb(e.structure),a=new Set(Object.keys(e.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."}),e.contents[0]?.locale!==e.resolvedLocale&&n.addIssue({code:"custom",path:["contents"],message:"Resolved locale must match returned content."}),e.fallbackUsed!==(e.requestedLocale!==e.resolvedLocale)&&n.addIssue({code:"custom",path:["fallbackUsed"],message:"fallbackUsed must match locale resolution."})}),sO=b.object({items:b.array(b.object({stableKey:b.string().min(1),type:Os,title:b.string().min(1).max(200),description:b.string().max(1e3),thumbnailUrl:b.string().url().nullable(),resolvedVersion:b.number().int().positive(),contentSchemaVersion:b.literal(3),category:vn.nullable(),tags:b.array(Ds),pageCount:b.number().int().nonnegative(),componentCount:b.number().int().nonnegative(),requestedLocale:Ct,resolvedLocale:Ct,fallbackUsed:b.boolean()}).strict()),facets:b.object({categories:b.array(vn),tags:b.array(Ds)}).strict(),nextCursor:b.string().nullable()}).strict().superRefine((e,n)=>{e.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 Mb(e){if("type"in e)return new Set([e.nodeId]);let n="pages"in e?e.pages:[e];return new Set(n.flatMap(s=>[...s.nodeId?[s.nodeId]:[],...s.components.map(a=>a.nodeId)]))}function iO(e){return fa({tenant_id:e.tenant_id,site_id:e.site_id,stable_key:e.stable_key,resolved_version:e.request.resolved_version,base_sitemap_id:e.request.base_sitemap_id,base_sitemap_version:e.request.base_sitemap_version,sitemap:e.request.sitemap,target_page_id:e.request.target_page_id??null})}import{z as G}from"zod";var Ub=["pending_dns","active","failed","removing"],qb=G.enum(Ub),Fb=["serve_site","redirect_301"],Gb=G.enum(Fb),Kb=["traffic","ownership","certificate_delegation"],ba=G.enum(Kb),Wb=["pending","verified"],zb=G.enum(Wb),Bb=["not_applicable","unavailable","not_needed","auto_applied","confirmation_required","blocked"],Hb=G.enum(Bb),ya=G.enum(["prepare_configuration","apply_configuration","verify_dns","remediate_dns","confirm_dns_remediation"]),Vb=G.enum(["accepted","running","succeeded","failed"]),$b=G.object({code:G.string().min(1),message:G.string().min(1)}).strict(),Yb=G.object({purpose:ba,verified:G.boolean(),observedValues:G.array(G.string())}).strict(),wm=G.object({ready:G.boolean(),providerReady:G.boolean(),dnsVerified:G.boolean(),records:G.array(Yb)}).strict(),Cm=G.object({type:G.string().min(1),name:G.string().min(1),value:G.string().min(1),ttl:G.number().nullable()}).strict(),Xb=G.object({purpose:ba,action:G.enum(["none","create","update","blocked"]),before:Cm.nullable(),after:Cm.nullable()}).strict(),vm=G.object({domainId:G.string().min(1),status:Hb,changes:G.array(Xb)}).strict(),Qb=G.object({purpose:ba,type:G.string().min(1),name:G.string().min(1),value:G.string().min(1),verificationStatus:zb}).strict(),Dm=G.object({id:G.string().min(1),hostname:G.string().min(1),isPrimary:G.boolean(),routingMode:Gb,observedStatus:qb,lastVerifiedAt:G.string().datetime().nullable(),dnsRecords:G.array(Qb)}).strict().superRefine((e,n)=>{Zb(e.hostname)||n.addIssue({code:"custom",path:["hostname"],message:"hostname must be a canonical ASCII hostname"}),e.isPrimary&&e.routingMode!=="serve_site"&&n.addIssue({code:"custom",path:["routingMode"],message:"a primary domain must serve the site"}),!e.isPrimary&&e.routingMode!=="redirect_301"&&n.addIssue({code:"custom",path:["routingMode"],message:"a non-primary domain must redirect with 301"})}),Om=G.object({primaryDomain:Dm.nullable(),redirectDomains:G.array(Dm)}).strict().superRefine((e,n)=>{e.primaryDomain!==null&&(!e.primaryDomain.isPrimary||e.primaryDomain.routingMode!=="serve_site")&&n.addIssue({code:"custom",path:["primaryDomain"],message:"primaryDomain must be primary and serve the site"});for(let[a,i]of e.redirectDomains.entries())(i.isPrimary||i.routingMode!=="redirect_301")&&n.addIssue({code:"custom",path:["redirectDomains",a],message:"redirectDomains must be non-primary 301 redirects"});e.primaryDomain!==null&&e.redirectDomains.some(i=>i.hostname===e.primaryDomain?.hostname)&&n.addIssue({code:"custom",path:["redirectDomains"],message:"primaryDomain must not also be a redirect"});let s=[...e.primaryDomain===null?[]:[e.primaryDomain.hostname],...e.redirectDomains.map(a=>a.hostname)];new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["redirectDomains"],message:"domain hostnames must be unique"})}),js=G.object({id:G.string().min(1),type:ya,status:Vb,error:$b.nullable(),result:G.union([wm,vm]).nullable().optional()}).strict().superRefine((e,n)=>{if(e.status==="failed"&&e.error===null&&n.addIssue({code:"custom",path:["error"],message:"failed operations must include a stable error"}),e.status!=="failed"&&e.error!==null&&n.addIssue({code:"custom",path:["error"],message:"non-failed operations must not include an error"}),!(e.result===void 0||e.result===null)){if(e.status!=="succeeded"){n.addIssue({code:"custom",path:["result"],message:"operation results only belong to succeeded operations"});return}if(e.type==="verify_dns"){wm.safeParse(e.result).success||n.addIssue({code:"custom",path:["result"],message:"verify_dns operations require a DNS verification result"});return}if(e.type==="remediate_dns"){vm.safeParse(e.result).success||n.addIssue({code:"custom",path:["result"],message:"remediate_dns operations require a DNS remediation result"});return}n.addIssue({code:"custom",path:["result"],message:"only verify_dns and remediate_dns operations may carry a result"})}});function Zb(e){if(e!==e.trim()||e!==e.toLowerCase()||e.length>253||e.endsWith("."))return!1;let n=e.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 we}from"zod";import{z as f}from"zod";var Jb=f.enum(["active","completed","canceled"]),ey=f.enum(["quality","domain","gsc","publish"]),Ns=f.enum(["pending","running","succeeded","failed"]),Nm=Ns,Lm=f.enum(["pending","running","completed"]),ty=f.object({group_code:f.string().min(1),name:f.string().min(1),score:f.number().nonnegative(),total_score:f.number().nonnegative(),pass_score:f.number().nonnegative(),running_status:Lm,result_text:f.string()}).strict(),ny=f.object({id:f.number().int().positive().optional(),quality_task_id:f.number().int().positive(),item_code:f.string().min(1),status:Ns,is_repaired:f.boolean(),total_score:f.number().nonnegative(),score:f.number().nonnegative(),check_result:f.unknown().nullable(),remediation_items:f.unknown().nullable(),result_text:f.string(),created_at:f.string().min(1),updated_at:f.string().min(1),item_name:f.string().min(1),dimension_code:f.enum(["reach","trust","convert","safe"]),group_code:f.string().min(1),auto_fix:f.boolean()}).strict(),sy=f.object({dimension_code:f.enum(["reach","trust","convert","safe"]),name:f.string().min(1),alias_en:f.string().min(1),description:f.string(),tips:f.string(),score:f.number().nonnegative(),repaired_score:f.number().nonnegative(),total_score:f.number().nonnegative(),pass_score:f.number().nonnegative(),running_status:Lm,problem_group_count:f.number().int().nonnegative(),remediation_items:f.array(ny),groups:f.array(ty)}).strict(),iy=f.object({id:f.number().int().positive(),task_code:f.string().uuid(),scene_code:f.enum(["site_publish","vcp_published_pages","content_publish"]),tenant_id:f.string().min(1),vcp_site_id:T,cms_site_id:f.string().min(1),checked_url:f.string().url(),quality_params:f.record(f.string(),f.unknown()).nullable(),status:Ns,error_info:f.record(f.string(),f.unknown()).nullable(),created_at:f.string().min(1),updated_at:f.string().min(1)}).strict(),ay=f.union([f.object({}).strict(),f.object({summary:f.object({final_score:f.number().nonnegative(),pass_score:f.number().nonnegative(),group_count:f.number().int().nonnegative(),problem_group_count:f.number().int().nonnegative()}).strict(),dimensions:f.array(sy)}).strict()]),jm=f.object({quality_info:iy,quality_detail:ay}).strict().superRefine((e,n)=>{let s="summary"in e.quality_detail;e.quality_info.status!=="failed"&&!s&&n.addIssue({code:"custom",message:"nonfailed quality tasks require complete detail",path:["quality_detail"]}),e.quality_info.status==="failed"&&s&&n.addIssue({code:"custom",message:"failed quality tasks require empty detail",path:["quality_detail"]})}),uO=f.object({item_code:f.string().min(1),remediation_items:f.unknown().nullable()}).strict(),oy=f.object({item_code:f.string().min(1),repair_status:f.enum(["succeeded","failed"]),message:f.string().min(1).optional(),error_code:f.string().min(1).optional(),metadata:f.record(f.string(),f.unknown()).optional()}).strict(),Mm=f.object({items:f.array(oy)}).strict(),_O=f.object({task_code:f.string().min(1),status:Nm,result:Mm.optional()}).strict().superRefine((e,n)=>{e.status==="succeeded"&&e.result===void 0&&n.addIssue({code:"custom",path:["result"],message:"succeeded repair tasks require a complete result"}),(e.status==="pending"||e.status==="running")&&e.result!==void 0&&n.addIssue({code:"custom",path:["result"],message:"nonterminal repair tasks cannot expose a result"})}),St=f.object({id:Qa,tenant_id:f.string().min(1),site_id:T,status:Jb,current_step:ey,quality_task_code:f.string().uuid().nullable(),quality_task_status:Ns,repair_task_code:f.string().min(1).nullable(),repair_task_status:Nm,publish_deployment_id:Je.nullable(),domain_hostname:f.string().min(1).nullable(),domain_operation_type:ya.nullable(),domain_operation_payload:f.record(f.string(),f.unknown()).nullable(),domain_preparation_operation_id:f.string().min(1).nullable(),domain_operation_id:f.string().min(1).nullable(),revision:f.number().int().positive(),created_at:f.string().min(1),updated_at:f.string().min(1),completed_at:f.string().min(1).nullable(),canceled_at:f.string().min(1).nullable()}).strict().superRefine((e,n)=>{if(e.domain_operation_type===null){e.domain_operation_payload!==null&&n.addIssue({code:"custom",path:["domain_operation_payload"],message:"domain_operation_payload must be null without an active domain operation"}),e.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}e.domain_hostname===null&&n.addIssue({code:"custom",path:["domain_hostname"],message:"an active domain operation requires a hostname"}),e.domain_operation_payload===null&&n.addIssue({code:"custom",path:["domain_operation_payload"],message:"an active domain operation requires a payload"})}),gO=f.object({}).strict(),hO=f.object({expected_revision:f.number().int().nonnegative(),current_step:f.enum(["domain","gsc","publish"]),skip_domain_binding:f.boolean().optional()}).strict(),SO=f.object({expected_revision:f.number().int().nonnegative()}).strict(),ry=f.object({workflow:St.nullable(),can_cancel:f.boolean()}).strict(),fO=M(ry).strict(),cy=f.object({workflow:St,can_cancel:f.boolean()}).strict(),bO=M(cy).strict(),my=f.object({workflow:St,deployment:f.lazy(()=>ft)}).strict(),yO=M(my).strict(),ly=f.object({workflow:St,can_cancel:f.boolean(),quality_result:jm.optional(),repair_result:Mm.optional(),final_quality_result:jm.optional(),message:f.string().min(1).optional()}).strict(),xO=M(ly).strict();function py(e){return"summary"in e.quality_detail?e.quality_detail.dimensions.flatMap(n=>n.remediation_items.filter(s=>s.status==="succeeded"&&s.score<s.total_score&&s.auto_fix).map(s=>({item_code:s.item_code,remediation_items:s.remediation_items}))):[]}function dy(e,n){let s=e.map(r=>r.item_code),a=n.items.map(r=>r.item_code);if(new Set(s).size!==s.length||new Set(a).size!==a.length||s.length!==a.length)return!1;let i=new Set(s);return n.items.every(r=>i.has(r.item_code)&&r.repair_status==="succeeded")}function EO(e,n){if(!("summary"in e.quality_detail))return null;let s=py(e);if(s.length===0)return e;if(n===void 0||!dy(s,n))return null;let a=new Set(n.items.map(r=>r.item_code)),i=e.quality_detail.dimensions.map(r=>{let m=r.remediation_items.map(I=>a.has(I.item_code)?{...I,score:I.total_score,is_repaired:!0,result_text:""}:{...I}),c=r.groups.map(I=>{let R=m.filter(w=>w.group_code===I.group_code);return R.length===0?{...I}:{...I,score:R.reduce((w,F)=>w+F.score,0),result_text:R.map(w=>w.result_text).filter(Boolean).join("\u3001")}}),p=c.reduce((I,R)=>I+R.score,0);return{...r,score:p,repaired_score:p,problem_group_count:c.filter(I=>I.score!==I.total_score).length,remediation_items:m,groups:c}});return{quality_info:{...e.quality_info},quality_detail:{...e.quality_detail,summary:{...e.quality_detail.summary,final_score:Math.round(i.reduce((r,m)=>r+m.score,0)/i.length),problem_group_count:i.reduce((r,m)=>r+m.problem_group_count,0)},dimensions:i}}}var uy=we.object({hostname:we.string().min(1),expected_revision:we.number().int().nonnegative()}).strict(),Um=we.object({workflow:St,operation:js}).strict(),_y=M(Um).strict(),gy=we.object({expected_revision:we.number().int().nonnegative()}).strict(),hy=we.object({workflow:St,operation:js}).strict(),Sy=M(hy).strict(),xa=we.object({workflow:St,operation:js.nullable()}).strict(),fy=M(xa).strict(),by=xa,yy=M(by).strict(),PO=M(Om).strict(),xy=we.object({published:we.boolean(),hostname:we.string(),url:we.string(),sandbox_url:we.union([we.string().url(),we.literal("")])}).strict().superRefine((e,n)=>{e.published||(e.hostname!==""&&n.addIssue({code:"custom",path:["hostname"],message:"unpublished sites must not include a hostname"}),e.url!==""&&n.addIssue({code:"custom",path:["url"],message:"unpublished sites must not include a URL"}))}),wO=M(xy).strict(),CO=uy,vO=Um,DO=_y,OO=xa,jO=fy,NO=yy,LO=gy,MO=Sy;import{z as Ne}from"zod";var Ey=["started","success","failed","canceled"],Ea=Ne.enum(Ey),Ry=["inactive","pending_binding","active"],Ra=Ne.enum(Ry),Iy=["domain","url_prefix"],Ia=Ne.enum(Iy),Ty=["not_connected","authorizing","matching_property","ready","failed","canceled","domain_mismatch"],Ta=Ne.enum(Ty),Ze=Ne.string().nullable(),qm=Ne.object({}).strict(),ka=Ne.object({authorize_url:Ne.string().url(),custom_domain:Ze}).strict(),Fm=M(ka),ky=Ne.object({auth_status:Ea,binding_status:Ra,credential_connected:Ne.boolean(),custom_domain:Ze,gsc_site_url:Ze,property_type:Ia.nullable(),auth_error_code:Ze,auth_error_message:Ze}).strict(),Gm=Ne.object({auth_status:Ea,binding_status:Ra,credential_connected:Ne.boolean(),custom_domain:Ze,gsc_site_url:Ze,property_type:Ia.nullable(),auth_error_code:Ze,auth_error_message:Ze,current_domain:Ze,state:Ta,ready:Ne.boolean()}).strict().superRefine((e,n)=>{let s=Py(e,e.current_domain),a=s==="ready";e.state!==s&&n.addIssue({code:"custom",path:["state"],message:`state must equal ${s} for the supplied GSC facts`}),e.ready!==a&&n.addIssue({code:"custom",path:["ready"],message:`ready must equal ${String(a)} for the supplied GSC facts`})}),Ay=M(Gm);function On(e){let n=e?.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 Py(e,n){let s=e.gsc_site_url?.trim()??"",a=On(e.custom_domain),i=On(n??("current_domain"in e?e.current_domain:void 0)),r=a.length>0&&i.length>0&&a===i,m=wy(s,e.property_type,i);return e.auth_status==="canceled"?"canceled":e.auth_status==="failed"?"failed":e.auth_status==="started"?"authorizing":!e.credential_connected||e.binding_status==="inactive"?"not_connected":s.length===0||e.property_type===null?"matching_property":!r||!m?"domain_mismatch":e.binding_status==="pending_binding"?"matching_property":e.auth_status==="success"&&e.binding_status==="active"&&e.credential_connected&&s.length>0&&r&&m?"ready":"failed"}function wy(e,n,s){let a=e?.trim()??"",i=On(s);if(!a||!i||!n)return!1;if(n==="domain"){let r=/^sc-domain:(.+)$/i.exec(a);if(!r)return!1;let m=r[1].trim();if(!m||/[/:?#]/.test(m))return!1;let c=On(m);return c?i===c||i.endsWith(`.${c}`):!1}try{let r=new URL(a);return r.protocol!=="https:"||r.username||r.password||r.port||r.pathname!=="/"||r.search||r.hash?!1:On(r.hostname)===i}catch{return!1}}var GO=qm,KO=ka,WO=Fm,zO=Ta,BO=Ea,HO=Ra,VO=Ia,$O=Ta,YO=qm,XO=ka,QO=Fm,ZO=ky,JO=Gm,ej=Ay;var Km=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,Wm="VCP_E2B_PREVIEW_PROXY_DOMAIN must be a valid hostname.";function Cy(e){let n=e?.trim().toLowerCase()??"";if(!n)return null;if(n.length>253||!n.includes(".")||!n.split(".").every(s=>Km.test(s)))throw new Error(Wm);return n}function nj(e){let n=Cy(e.proxyDomain);if(!n)return null;let s=e.sandboxId.trim();if(!Km.test(s))throw new Error("sandboxId must be a valid DNS label.");if(`${s}.${n}`.length>253)throw new Error(Wm);return`https://${s}.${n}/`}function ij(e){for(let n of e.targets)if(!(n.kind==="shared"?e.ledger.shared.some(a=>a.kind==="shared"&&a.target_id===n.target_id&&a.filled!==!0):e.ledger.pages.some(a=>a.omissions.some(i=>i.kind===n.kind&&i.target_id===n.target_id&&i.filled!==!0))))return{ok:!1,target_id:n.target_id};return{ok:!0}}function vy(e,n,s=e){let a=new Map(e.map(c=>[c.slug,c])),i=new Map(s.map(c=>[c.id,c])),r=new Map(e.map(c=>{let p=i.get(c.id);return p&&p.slug!==null&&p.slug!==c.slug?[p.slug,c]:null}).filter(c=>c!==null)),m=new Set(s.map(c=>c.slug).filter(c=>c!==null&&!a.has(c)));return{primaryLinks:zm(n.primaryLinks,e,a,r,m,i,"showInHeader"),footerLinks:zm(n.footerLinks,e,a,r,m,i,"showInFooter")}}function zm(e,n,s,a,i,r,m){let c=new Set,p=[];for(let[F,B]of e.entries()){let ee=Dy(B.href),pe=ee===null?void 0:s.get(ee)??a.get(ee);if(ee!==null&&i.has(ee)&&!s.has(ee)&&!a.has(ee))continue;if(pe?.slug==="/"){p.push({kind:"independent",link:{...B,label:Bm(B,pe,r)}});continue}if(!pe){p.push({kind:"independent",link:B});continue}if(!pe.navigation[m])continue;c.add(pe.slug);let Xt=ee===pe.slug?B.href:Oy(B.href,pe.slug);p.push({kind:"page",page:pe,link:{...B,label:Bm(B,pe,r),href:Xt},index:F})}let I=p.filter(F=>F.kind==="page").sort((F,B)=>F.page.navigation.order-B.page.navigation.order||F.index-B.index),R=0,w=p.map(F=>F.kind==="page"?I[R++].link:F.link);for(let F of[...n].filter(B=>B.slug!=="/"&&B.navigation[m]).sort((B,ee)=>B.navigation.order-ee.navigation.order))c.has(F.slug)||w.push({label:F.title,href:F.slug});return w}function Bm(e,n,s){let a=s.get(n.id);return e.label===(a?.title??n.title)?n.title:e.label}function Dy(e){if(!e.startsWith("/")||e.startsWith("//"))return null;let n=e.search(/[?#]/u);return n===-1?e:e.slice(0,n)}function Oy(e,n){let s=e.search(/[?#]/u);return s===-1?n:`${n}${e.slice(s)}`}function Ls(e){return e.trim().normalize("NFKC").toLowerCase()}function jy(e){let n=e?.toLowerCase();return n?.startsWith("zh")?"\u9996\u9875":n?.startsWith("ja")?"\u30DB\u30FC\u30E0":n?.startsWith("ko")?"\uD648":"Home"}function Ny(e){let n=e?.toLowerCase();return n?.startsWith("zh")?"\u66F4\u591A":n?.startsWith("ja")?"\u305D\u306E\u4ED6":n?.startsWith("ko")?"\uB354\uBCF4\uAE30":n?.startsWith("fr")?"Plus":n?.startsWith("de")?"Mehr":n?.startsWith("es")?"M\xE1s":"More"}function Ly(e){return e.map(n=>n.navigation.showInHeader===!0?n:{...n,navigation:{...n.navigation,showInHeader:!0}})}function jn(e){return e.parent_page_id??null}function Ms(e,n){let s=jn(e);return s===null?!0:!n.some(a=>a.id===s)}function Hm(e,n){return e.filter(s=>jn(s)===n&&s.id!==n)}function Vm(e){let n=e.filter(m=>Ms(m,e)),s=n.filter(m=>m.slug==="/"),a=n.filter(m=>m.slug!=="/"),i=[],r=new Set;for(let m of[...s,...a])if(!r.has(m.id)){i.push(m),r.add(m.id);for(let c of Hm(e,m.id))r.has(c.id)||(i.push(c),r.add(c.id))}for(let m of e)r.has(m.id)||(i.push(m),r.add(m.id));return i}function My(e){if(!e.startsWith("/")||e.startsWith("//"))return null;let n=e.search(/[?#]/);return n===-1?e:e.slice(0,n)}function Uy(e,n){let s=Vm(n),a=new Map;s.forEach((m,c)=>{m.slug!==null&&!a.has(m.slug)&&a.set(m.slug,c)});let i=[],r=[];for(let m of e){let c=My(m.href),p=c===null?void 0:a.get(c);p===void 0?r.push(m):i.push({link:m,rank:p})}return i.sort((m,c)=>m.rank-c.rank),[...i.map(m=>m.link),...r]}function qy(e){let n=e.filter(s=>Ms(s,e)).length;return{top_level_pages:n,sub_pages:e.length-n,total_pages:e.length,content_items:e.reduce((s,a)=>s+a.blocks.length,0)}}function Fy(e,n={}){let s=[],a=new Map(e.map(m=>[m.id,m])),i=e.filter(m=>m.slug==="/");i.length!==1?s.push({code:"missing_home",page_id:null,message:"The structure must contain exactly one home page."}):n.expectedHomeTitle&&Ls(i[0].title)!==Ls(n.expectedHomeTitle)&&s.push({code:"home_renamed",page_id:i[0].id,message:`The home page must keep its fixed name '${n.expectedHomeTitle}'.`});for(let m of e){m.title.trim().length===0&&s.push({code:"empty_title",page_id:m.id,message:"Page name is empty."}),m.slug&&n.reservedSlugs?.includes(m.slug)&&s.push({code:"reserved_slug",page_id:m.id,message:`Slug '${m.slug}' is reserved by the site's applications.`});let c=jn(m);if(c===null)continue;if(m.slug==="/"){s.push({code:"home_has_parent",page_id:m.id,message:"The home page cannot have a parent."});continue}if(c===m.id){s.push({code:"self_parent",page_id:m.id,message:"A page cannot be its own parent."});continue}let p=a.get(c);if(!p){s.push({code:"parent_not_found",page_id:m.id,message:`Parent page '${c}' does not exist.`});continue}if(p.slug==="/"){s.push({code:"home_has_children",page_id:m.id,message:"The home page cannot have sub pages."});continue}jn(p)!==null&&s.push({code:"depth_exceeded",page_id:m.id,message:"At most two levels are allowed."})}let r=new Map;for(let m of e){let c=Ms(m,e)?"__top__":jn(m),p=Ls(m.title);if(p.length===0)continue;let I=r.get(c)??new Map,R=I.get(p);R!==void 0&&R!==m.id?s.push({code:"duplicate_sibling_title",page_id:m.id,message:`Page name '${m.title}' is already used at the same level.`}):I.set(p,m.id),r.set(c,I)}return s}var Gy=16,Ky=/[ᄀ-ᅟ⺀-〾ぁ-㏿㐀-䶿一-鿿ꀀ-가-힣豈-︰--⦆¢-₩]/u;function Wy(e){let n=0;for(let s of e)n+=Ky.test(s)?2:1;return n}function zy(e){let n=e.normalize("NFKC").trim().replace(/\s+/g," ").toLowerCase();return n.length>3&&n.endsWith("s")?n.slice(0,-1):n}import{z as y}from"zod";var $m=20*1024*1024,By=$m,Ym=["jpg","jpeg","png","gif","webp","bmp"],Xm=["mp4","avi","mov","webm","mkv"],Qm=["mp3","wav","aac","flac","ogg","wma","m4a"],Zm=["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","md","csv"],Jm=[...Zm,"zip","rar","json","xmind","psd","ai","fig","sketch"],Hy=[...Ym,...Xm,...Qm,...Jm],el=["image/jpeg","image/png","image/gif","image/webp","image/bmp"],tl=["video/mp4","video/x-msvideo","video/quicktime","video/webm","video/x-matroska"],nl=["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"],Vy=[...el,...tl,...nl],sl=y.enum(["image","video","audio","file"]),il=y.enum(["external","ai_generated","unsplash"]),Aa=y.object({resource_id:y.string().min(1),name:y.string().min(1).max(255),url:y.string().url(),thumbnail_url:y.union([y.string().url(),y.literal("")]),mime_type:y.string().trim().min(3).max(127),size:y.number().int().nonnegative(),width:y.number().int().positive().nullable(),height:y.number().int().positive().nullable(),source:il,created_at:y.string().min(1).nullable()}),$y=y.object({page:y.coerce.number().int().min(1).default(1),page_size:y.coerce.number().int().min(1).max(100).default(24),keyword:y.string().trim().max(100).optional(),file_type:sl.default("image")}),Yy=y.object({code:y.literal(0),message:y.string(),data:y.object({items:y.array(Aa),page:y.number().int().min(1),page_size:y.number().int().min(1),total:y.number().int().nonnegative()})}),Xy=y.object({code:y.literal(0),message:y.string(),data:Aa}),Bt=4,Qy="site.image_generation.max",Zy=y.object({quantity:y.number().int().min(1).max(Bt)}),Pa=y.object({available:y.boolean(),remaining:y.number().nonnegative().nullable(),unlimited:y.boolean(),max_quantity:y.number().int().min(0).max(Bt)}),Jy=y.object({code:y.literal(0),message:y.string(),data:Pa}),ex=y.object({pageName:y.string().trim().min(1).max(255),pageType:y.string().trim().min(1).max(40),sectionTitle:y.string().trim().max(500),nearbyTitle:y.string().trim().max(500),nearbyBody:y.string().trim().max(2e3),prompt:y.string().trim().min(1).max(2e3),aspectRatio:y.string().regex(/^\d{1,2}:\d{1,2}$/)}),al=y.discriminatedUnion("ok",[y.object({index:y.number().int().min(0).max(Bt-1),ok:y.literal(!0),url:y.httpUrl(),request_id:y.string().uuid()}),y.object({index:y.number().int().min(0).max(Bt-1),ok:y.literal(!1),error:y.enum(["quota","generate","network"]),message:y.string().trim().min(1).max(500),request_id:y.string().uuid().nullable()})]),tx=y.object({code:y.literal(0),message:y.string(),data:y.object({quota:Pa,items:y.array(al).max(Bt)})}),ol=y.object({provider_id:y.string().min(1),url:y.string().url(),thumbnail_url:y.string().url(),width:y.number().int().positive(),height:y.number().int().positive(),alt:y.string(),photographer_name:y.string().min(1),photographer_url:y.string().url(),photo_url:y.string().url(),download_location:y.string().url(),dominant_color:y.string().nullable()}),nx=y.object({query:y.string().trim().min(1).max(100),page:y.coerce.number().int().min(1).default(1),page_size:y.coerce.number().int().min(1).max(30).default(18),orientation:y.enum(["landscape","portrait","squarish"]).optional()}),sx=y.object({code:y.literal(0),message:y.string(),data:y.object({items:y.array(ol),page:y.number().int().min(1),page_size:y.number().int().min(1),total:y.number().int().nonnegative(),total_pages:y.number().int().nonnegative()})}),rl=y.string().url().refine(cx,{message:"download_location must be an official Unsplash download URL"}),ix=y.object({download_location:rl}),ax=y.object({code:y.literal(0),message:y.string(),data:y.object({reported:y.boolean()})}),ox=y.object({source_id:y.number().int().positive(),source_title:y.string().min(1).max(255),source_url:et,resource_id:y.number().int().positive()}),rx=y.object({code:y.literal(0),message:y.string(),data:y.object({reported:y.boolean()})});function cx(e){if(!URL.canParse(e))return!1;let n=new URL(e);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 mx=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(e=>e.colorSeeds!==void 0||e.surfaceMode!==void 0||e.fonts!==void 0,{message:"colorSeeds, surfaceMode, or fonts is required"}),lx=Ce.object({ok:Ce.literal(!0),design_plan_version:Ce.number().int().positive(),snapshot_id:k,site_design_context:Ce.lazy(()=>Us).optional(),changed_files:Ce.array(Ce.string().min(1)).optional()});var va=t.object({heading:t.string().min(1).max(160).optional(),body:t.string().min(1).max(160).optional(),paletteIntent:t.string().min(1).max(400).optional(),surfaceMode:t.enum(["light","dark"]).optional(),radius:t.enum(["none","sm","md","lg","xl"]).optional(),density:t.enum(["compact","comfortable","airy","editorial"]).optional(),motionPreset:t.enum(["subtle","moderate","expressive"]).optional(),colorSeeds:t.object({primary:t.string().min(1).max(40),accent:t.string().min(1).max(40),foreground:t.string().min(1).max(40).optional(),neutral:t.string().min(1).max(40).optional(),supporting:t.array(t.string().min(1).max(40)).max(4).optional()}).optional(),imagePalette:t.object({background:t.string().min(1).max(40).optional(),foreground:t.string().min(1).max(40).optional(),card:t.string().min(1).max(40).optional(),muted:t.string().min(1).max(40).optional(),border:t.string().min(1).max(40).optional()}).optional(),themeId:t.string().min(1).max(60).optional(),themeDescription:t.string().min(1).max(400).optional(),aestheticNote:t.string().min(1).max(300).optional()}),wa=t.enum(["material","reference","brief","industry"]),px=t.object({market:t.object({value:t.string().min(1).max(200),source:wa}),customer:t.object({value:t.string().min(1).max(200),source:wa}),purpose:t.object({options:t.array(t.string().min(1).max(60)).min(2).max(4),selected:t.string().min(1).max(60),source:wa})}),dx=t.enum(["text-options","motion-slider","positioning"]),Da=t.enum(["none","subtle","moderate","expressive"]),ux=t.enum(["compact","comfortable","airy","editorial"]),_x=Da,ul=t.object({skill_name:t.string().min(1),rationale:t.string().min(4).max(200),confidence:t.enum(["high","medium","low"]).optional(),displayName:t.object({zh:t.string().min(1),en:t.string().min(1)}).partial().optional()}),gx=t.object({value:t.string(),label:t.string(),desc:t.string().optional(),impact:t.string().optional(),isRecommended:t.boolean().optional(),preselect:t.boolean().optional(),visualHints:va.optional(),conversionHints:Rt.optional()}),hx=t.object({id:t.string(),type:dx,question:t.string(),tag:t.string(),aiThinking:t.string(),options:t.array(gx),source:t.enum(["ai-detected","always-ask"]),sourceDetail:t.string(),positioning:px.optional()}),Oa=t.object({questions:t.array(hx).min(1).max(6)}),Gj=t.object({tenant_id:t.string().min(1),site_id:T,brief_id:Dt,brief:t.string().min(20).max(1e3),site_default_locale:fe.optional(),owner_locale:fe.optional(),input_context:t.object({facts:t.array(Fn).max(120),conflicts:t.array(Kn).max(20),reference:Gn.optional(),sources:t.array(t.object({type:$s,title:t.string().max(120).optional(),status:Ys})).max(16).optional()}).optional()}),_l=t.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),Kj=t.discriminatedUnion("type",[t.object({type:t.literal("run.started"),runId:K,at:t.string().min(1)}),t.object({type:t.literal("skill.selecting"),category:t.literal("page-generation"),available:t.array(t.object({id:t.string().min(1),name:t.string().min(1)})).max(20),at:t.string().min(1)}),t.object({type:t.literal("skill.selected"),category:t.literal("page-generation"),selected:t.object({id:t.string().min(1),name:t.string().min(1),reason:t.string().min(1).max(200)}),at:t.string().min(1)}),t.object({type:t.literal("clarify.partial"),object:t.unknown(),at:t.string().min(1)}),t.object({type:t.literal("clarify.archetype_proposals"),proposals:t.array(ul).min(1).max(5),at:t.string().min(1)}),t.object({type:t.literal("clarify.finished"),questions_id:t.string().min(1),at:t.string().min(1)}),t.object({type:t.literal("run.failed"),error_code:t.string().min(1),message:t.string().min(1),error_category:_l.optional(),retryable:t.boolean().optional(),attempts:t.number().int().positive().optional(),at:t.string().min(1)}),t.object({type:t.literal("run.finished"),at:t.string().min(1)})]),Wj="SITE_PLANNING_INPUT_FROZEN",zj="SITE_PLANNING_LOCKED",Bj="SITE_STRUCTURE_CONFIRMATION_REQUIRED",Hj="SITE_STRUCTURE_CONFIRMATION_STALE",cl="SITE_STRUCTURE_INVALID",Vj=t.object({tenant_id:t.string().min(1),name:t.string().min(1).max(120),brief:t.string().min(20).max(1e3)}),$j=t.object({name:t.string().min(1).max(120),brief:t.string().min(20).max(1e3)}),Yj=t.object({name:t.string().min(1).max(120)}),Xj=t.object({name:t.string().min(1).max(120),default_locale:fe.optional()}),Qj=t.object({body:t.string().min(20).max(1e3)}),Zj=t.object({body:t.string().min(20).max(1e3)}),ja=t.string().url().refine(e=>{try{let n=new URL(e).protocol;return n==="http:"||n==="https:"}catch{return!1}},{message:"URL must use http or https protocol"}),Jj=t.object({tenant_id:t.string().min(1),site_id:T.optional(),site_url:ja,site_name:t.string().trim().min(1).max(255).optional()}),eN=M(qo),tN=M(Fo),nN=M(Go),sN=M(tr),iN=M(nr),aN=M(sr),oN=M(ar),rN=M(or),cN=M(rr),mN=M(t.object({site_id:T,site_url:ja})),yt=t.object({id:T,tenant_id:t.string().min(1),name:t.string().min(1),slug:t.string().min(1),status:ki,deployment_status:Ai,archived_at:t.string().min(1).nullable(),current_sitemap_id:Ae.nullable(),confirmed_sitemap_id:Ae.nullable().optional(),confirmed_sitemap_version:t.number().int().positive().nullable().optional(),structure_confirmed_at:t.string().min(1).nullable().optional(),migration_content_requested:t.boolean().optional(),current_snapshot_id:k.nullable(),published_deployment_id:Je.nullable().optional(),deployed_url:t.string().url().nullable(),default_locale:fe,owner_locale:fe.optional(),cms_site_id:bo.nullable().optional(),cms_site_url:ja.nullable().optional(),parent_site_id:T.nullable().optional(),mount_path:t.string().min(1).nullable().optional(),schema_version:t.literal(1),created_at:t.string().min(1),updated_at:t.string().min(1)}),Na=t.object({id:Dt,tenant_id:t.string().min(1),site_id:T,body:t.string().min(1),source:t.enum(["user","import","system"]),created_at:t.string().min(1),updated_at:t.string().min(1)}),lN=t.object({site:yt,brief:Na,next_step:t.literal("clarify")}),pN=t.object({site:yt,brief:Na}),dN=t.object({brief:Na}),Sx=t.enum(["queued","running","succeeded","failed","cancelled"]),gl=t.enum(["clarify","sitemap","workspace"]),hl=t.enum(["clarify","sitemap","initial_generation","iteration","landing_page","fill_in"]),Sl=t.enum(["clarify","sitemap","workspace","summarize"]),Be=t.object({id:K,tenant_id:t.string().min(1),site_id:T,agent_type:gl,run_kind:hl,status:Sx,model_route:Sl,started_at:t.string().min(1).nullable(),finished_at:t.string().min(1).nullable(),error_code:t.string().min(1).nullable(),created_at:t.string().min(1),thread_id:He.nullable().optional()}),uN=t.object({agent_run:Be}).strict(),fx=t.enum(["workspace","landing_page","external"]),bx=t.enum(["user","background"]),fl=t.enum(["active","archived"]),Ks=t.object({id:He,tenant_id:t.string().min(1),site_id:T,kind:fx,origin:bx,subject_key:t.string().min(1).max(200),title:t.string().min(1).max(200),status:fl,external_thread_id:t.string().min(1).max(200).nullable(),last_run_id:K.nullable(),last_activity_at:t.string().min(1),created_at:t.string().min(1),updated_at:t.string().min(1)}),_N=t.object({agent_run:Be,thread:Ks.nullable()}),gN=t.object({run_id:K.optional(),site_id:T,agent_type:gl,run_kind:hl.optional(),model_route:Sl,input:t.record(t.string(),t.unknown()).optional()}).superRefine((e,n)=>{Nn(e.input)&&n.addIssue({code:"custom",path:["input"],message:"Agent run input must not contain secrets"})}),hN=t.object({agent_run:Be,next_step:t.literal("stream_events")}),bl=t.enum(["draft","candidate","deleting","current","failed"]),ct=t.object({id:k,tenant_id:t.string().min(1),site_id:T,version:t.number().int().positive(),manifest_hash:t.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:t.string().min(1),template_version:We.nullable().optional(),reason:t.enum(["initial_generation","workspace_edit","pre_deploy","manual_save","rollback","template_upgrade","subsite_clone"]),status:bl,created_at:t.string().min(1)}),SN=t.object({snapshot_id:k,creation_key:t.string().min(1),manifest_hash:t.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:t.string().min(1),template_version:We.optional(),reason:ct.shape.reason,status:t.enum(["draft","candidate","current","failed"]).default("candidate"),source_run_id:K.optional()}),fN=t.object({site:yt,snapshot:ct,next_step:t.literal("workspace")}),bN=t.object({expected_manifest_hash:ct.shape.manifest_hash,manifest_hash:ct.shape.manifest_hash,object_key:ct.shape.object_key}).strict(),yN=t.union([t.object({base_snapshot_id:k.nullable(),source_run_id:K.optional()}).strict(),t.object({skip_base_check:t.literal(!0)}).strict()]),yx=t.object({site:yt,snapshot:ct,next_step:t.literal("workspace")}),xN=t.object({snapshot:ct}),EN=t.object({status:t.literal("deleting"),snapshot_id:k,object_key:t.string().min(1)}),RN=t.object({status:t.literal("deleted"),snapshot_id:k}),Ws=t.object({id:Ya,tenant_id:t.string().min(1),site_id:T,snapshot_id:k,version:t.number().int().positive(),accepted_commit:t.string().min(1),source_run_id:K.nullable(),created_at:t.string().min(1)}),xx=Ws.extend({reason:ct.shape.reason,status:bl}),IN=t.object({accepted_commit:t.string().min(1),source_run_id:K.optional()}),TN=t.object({site_version:Ws,next_step:t.literal("workspace")}),kN=t.object({owner_id:t.string().min(1)}).strict(),AN=t.discriminatedUnion("acquired",[t.object({acquired:t.literal(!0)}).strict(),t.object({acquired:t.literal(!1)}).strict()]),PN=t.object({owner_id:t.string().min(1)}).strict(),wN=t.object({released:t.literal(!0)}).strict(),CN="TEMPLATE_UPGRADE_LOCK_LOST",vN=t.object({base_snapshot_id:k,accepted_commit:Ws.shape.accepted_commit,owner_id:t.string().min(1)}).strict(),DN=yx.strict(),ON=t.object({site_versions:t.array(xx)}),jN=t.object({site:yt,snapshot:ct,site_version:Ws,next_step:t.literal("workspace")}),NN=t.object({snapshot_id:k,force_rehydrate:t.boolean().optional()}),Ex=t.discriminatedUnion("status",[t.object({status:t.literal("ready"),snapshot_id:k,preview_url:t.string().min(1),launch_id:t.string().min(1).optional()}),t.object({status:t.literal("failed"),code:t.string().min(1),message:t.string().min(1),retryable:t.boolean()})]),LN=t.object({tenant_id:t.string().min(1),site_id:T,snapshot_id:k}).strict(),MN=Ex,La=t.enum(jt),yl=t.enum(["quality_check","publish"]),ft=t.object({id:Je,tenant_id:t.string().min(1),site_id:T,snapshot_id:k,type:yl.default("publish"),version:t.number().int().positive(),status:La,provider:t.enum(["cloudflare"]),url:t.string().url().nullable(),error_code:t.string().min(1).nullable(),provider_deployment_id:t.string().min(1).nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}),UN=t.object({tenant_id:t.string().min(1),site_id:T,expected_snapshot_id:k}).strict(),qN=t.object({deployment:ft}),FN=t.object({tenant_id:t.string().min(1),site_id:T,deployment_id:Je}).strict(),GN=t.object({deployment:ft}),KN=t.object({}).strict(),WN=t.object({snapshot_id:k.optional()}).strict(),Rx=t.object({deployment:ft}),zN=M(Rx),BN=t.object({deployment:ft.nullable()}),HN=t.object({deployment:ft}),ml=t.object({id:Je,type:yl.default("publish"),status:La,url:t.string().url().nullable(),error_code:t.string().min(1).nullable(),provider_deployment_id:t.string().min(1).nullable()}),Ix=t.object({current:ml.nullable(),latest_released:ml.nullable()}),VN=M(Ix),Tx=t.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),Ht=t.object({id:t.string().min(1),tenant_id:t.string().min(1),site_id:T,deployment_id:Je,seq:t.number().int().positive(),sent_at:t.string().min(1)}),qs=t.object({deployment:ft,steps:$r.default([])}),$N=t.discriminatedUnion("type",[Ht.extend({type:t.literal("deployment.snapshot"),payload:qs}),Ht.extend({type:t.literal("deployment.status.changed"),payload:qs}),Ht.extend({type:t.literal("deployment.finished"),payload:qs}),Ht.extend({type:t.literal("deployment.failed"),payload:qs}),Ht.extend({type:t.literal("deployment.realtime.recovered"),payload:t.object({action:t.literal("refresh")})}),Ht.extend({type:t.literal("server.error"),payload:t.object({code:t.string().min(1),message:t.string().min(1),retryable:t.boolean()})})]),YN=t.object({tenant_id:t.string().min(1),site_id:T,deployment_id:Je,status:La,updated_at:t.string().min(1)}),kx="vcp:deployments",XN={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:kx,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...Tx.options]},Ax=t.object({error:t.object({code:t.string().min(1),message:t.string().min(1),details:t.unknown().optional(),request_id:t.string().min(1).optional(),retryable:t.boolean().default(!1)})}),QN=t.object({error:Ax.shape.error.extend({code:t.literal("AGENT_RUN_IN_FLIGHT"),details:t.object({code:t.literal("AGENT_RUN_IN_FLIGHT"),message:t.string().min(1),agent_run:Be})})}),ZN=t.object({colors:t.record(t.string(),t.string()).default({}),typography:t.record(t.string(),t.string()).default({}),spacing:t.record(t.string(),t.string()).default({}),motion:t.record(t.string(),t.string()).default({})}),Px=t.object({theme_id:t.string().min(1),paletteIntent:t.string().min(1),tone:t.string().min(1),mediaMood:t.string().min(1),motionLevel:Da.optional(),userVisualHints:va.optional()}),wx=t.object({key:t.string().min(1).max(64).optional(),question:t.string().min(1),answer:t.string().min(1)}),JN=t.object({query:t.string().min(1),keywords:t.array(t.string()).default([]),orientation:t.enum(["landscape","portrait","square"]).optional(),role:t.enum(["hero","section","card","gallery","testimonial","decorative"]),altHint:t.string().min(1)}),eL=t.object({id:t.string().min(1),role:t.enum(["site_background","nav_background","footer_background"]),query:t.string().min(1),keywords:t.array(t.string()).default([]),treatment:t.enum(["cover","fixed-cover","subtle-texture"]),altHint:t.string().optional()}),Cx=t.object({provider:t.enum(["unsplash","pexels"]),providerLabel:t.enum(["Unsplash","Pexels"]),providerHref:t.string().url(),photoHref:t.string().url().optional(),photographerName:t.string().optional(),photographerHref:t.string().url().optional(),requiresAttribution:t.boolean()}),tL=t.object({src:t.string().min(1),alt:t.string().min(1),width:t.number().int().positive().optional(),height:t.number().int().positive().optional(),provider:t.enum(["unsplash","pexels","placeholder"]).optional(),providerId:t.string().optional(),photoUrl:t.string().url().optional(),photographer:t.string().optional(),photographerUrl:t.string().url().optional(),credit:t.string().optional(),dominantColor:t.string().optional(),attribution:Cx.optional()}),vx=t.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),Vt=t.object({id:t.string().min(1),name:t.string().min(1),category:t.literal("page-generation"),version:t.string().min(1).optional(),reason:t.string().min(1).max(200),source:vx.default("system_recommended")}),J=t.string().min(1).max(2e3),ll=t.string().min(1).max(120),Us=t.object({visualDirection:J,brandFeeling:J,paletteIntent:J,typographyIntent:J,density:ux,motionLevel:_x,motionPreset:t.enum(["subtle","moderate","expressive"]).optional(),mediaStrategy:J,compositionRules:t.array(J).max(20),avoidPatterns:t.array(J).max(20),fonts:t.object({heading:t.string().min(1),body:t.string().min(1)}).optional(),colorSeeds:t.object({primary:t.string().min(1).max(40),accent:t.string().min(1).max(40),foreground:t.string().min(1).max(40).optional(),neutral:t.string().min(1).max(40).optional(),supporting:t.array(t.string().min(1).max(40)).max(4).optional()}).optional(),surfaceMode:t.enum(["light","dark"]).optional(),radius:t.enum(["none","sm","md","lg","xl"]).optional(),imagePalette:t.object({background:t.string().min(1).max(40).optional(),foreground:t.string().min(1).max(40).optional(),card:t.string().min(1).max(40).optional(),muted:t.string().min(1).max(40).optional(),border:t.string().min(1).max(40).optional()}).optional()}),Ma=160,xl=t.object({routeGoal:J,narrativeArc:J,firstViewportIntent:J,visualContinuity:J,sectionRhythm:J,avoidPatterns:t.array(J).max(20),displayTitle:t.string().min(1).max(40).optional(),displayDescription:t.string().min(1).max(Ma).optional(),metaTitle:t.string().min(1).max(120).optional(),metaDescription:t.string().min(1).max(320).optional(),primaryKeyword:t.string().min(1).max(160).optional(),longTailKeywords:t.array(t.string().min(1).max(160)).max(3).optional()}),El=t.enum(["model_call","validation","repair","preview","worker_group"]),bt=t.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),Rl=t.object({sectionRole:J,contentIntent:J,layoutIntent:J,visualIntent:J,mediaIntent:J,motionIntent:J,copyTone:J,displayTitle:t.string().min(1).max(40).optional(),displayDescription:t.string().min(1).max(Ma).optional(),ctaIntent:J.optional(),continuityWithPrevious:J.optional(),avoidRepeating:t.array(J).max(20).optional(),industryRecipeRefs:t.array(ll).max(12).optional(),templateRecipeRefs:t.array(ll).max(12).optional()}),Il=t.object({siteName:t.string().min(1).max(120),tagline:t.string().min(1).max(200).optional(),primaryCta:t.object({label:t.string().min(1).max(60),target:t.string().min(1).max(200)}).optional(),trustSignals:t.array(t.string().min(1).max(60)).max(6).optional(),industry:t.string().min(1).max(40).optional()}),Dx=t.enum(["solid","floating"]),Ox=t.enum(["background","card","primary","frosted"]),jx=t.enum(["sticky","hide-on-scroll","static"]),Nx=t.enum(["bar","island"]),Lx=t.object({variant:Dx,surface:Ox.optional(),behavior:jx.optional(),shape:Nx.optional()}),Mx=t.object({form:J,layoutIntent:J,scrollBehavior:J,shell:Lx.optional(),avoidPatterns:t.array(J).max(10).optional()}),Ux=t.enum(["background","card","primary","inverse"]),qx=t.object({surface:Ux}),Fx=t.object({form:J,composition:J,shell:qx.optional(),avoidPatterns:t.array(J).max(10).optional()}),Gx=t.object({pattern:J,intent:J}),Tl=t.object({header:Mx,footer:Fx,mobileNav:Gx}),kl=t.object({schemaVersion:t.literal(1).default(1),siteDesignContext:Us,routeCards:t.record(t.string().min(1),xl),blockContexts:t.record(t.string().min(1),Rl),selectedSkillPacks:t.array(Vt).max(3).optional(),branding:Il.optional(),chromeDesign:Tl.optional()}),nL=t.object({siteDesignContext:Us.omit({imagePalette:!0}).optional(),routeCards:t.record(t.string().min(1),xl).optional(),blockContexts:t.record(t.string().min(1),Rl).optional(),branding:Il.optional(),chromeDesign:Tl.optional()}),Ie=t.string().trim().min(1),Ua=t.object({id:Ie,label:t.string().trim().min(1),type:t.string(),variant:t.string().optional(),order:t.number(),props:t.record(t.string(),t.unknown()),meta:t.object({aiGenerated:t.boolean(),userEdited:t.boolean(),lastEditedAt:t.string(),lastEditedBy:t.enum(["ai","user"]),userInstruction:t.string().optional()}).optional()}).strict(),qa=t.string().regex(ln,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),Kx=new RegExp(`^/(?:${Lt}(?:/${Lt})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),Wx=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,zx=t.union([t.string().regex(Kx),t.string().regex(Wx)]),pl=t.object({label:t.string(),href:zx}).passthrough(),Bx=t.object({primaryLinks:t.array(pl),footerLinks:t.array(pl)}),Al=t.object({showInHeader:t.boolean(),showInFooter:t.boolean(),order:t.number()}).strict(),Fa=t.object({id:Ie,slug:qa,title:t.string().trim().min(1),blocks:t.array(Ua).min(1),navigation:Al,parent_page_id:Ie.nullable().optional()}).strict(),Hx=Ua.extend({type:t.string().nullable()}).strict(),Vx=Fa.extend({slug:qa.nullable(),navigation:Al.extend({showInHeader:t.boolean().nullable(),showInFooter:t.boolean().nullable()}).strict(),blocks:t.array(Hx).min(1)}).strict(),$x=Ua.extend({id:t.string()}),Yx=Fa.omit({parent_page_id:!0}).extend({id:t.string(),slug:t.string().min(1),blocks:t.array($x).min(1),parent_page_id:t.string().nullable().optional()}),dl=t.object({label:t.string(),href:t.string().min(1)}),Xx=t.object({primaryLinks:t.array(dl),footerLinks:t.array(dl)}),Qx=t.discriminatedUnion("kind",[t.object({kind:t.literal("brief_clarify"),brief_id:Dt,answer_ids:t.array(t.string().min(1)).max(10)}).strict(),t.object({kind:t.literal("step5_strategy"),strategy_version_id:t.string().uuid(),strategy_version:t.number().int().positive(),strategy_checksum:t.string().regex(/^[a-f0-9]{64}$/)}).strict()]),Fs=t.object({site_name:t.string().min(1).max(80).optional(),version:t.number().int().positive(),pages:t.array(Fa).min(1),navigation:Bx,integrations:t.object({cms:t.unknown().optional(),analytics:t.unknown().optional()}).optional(),meta:t.object({generatedAt:t.string(),generatedBy:t.literal("sitemap-agent"),source_brief_id:t.string().optional(),source_answer_ids:t.array(t.string()).optional(),source:Qx.optional()}),skillSelection:Vt,visualTheme:Px.optional(),userChoices:t.array(wx).optional(),confirmedChoices:t.object({conversion:Rt.optional()}).optional(),seoKeywords:t.union([t.array(sn).min(1),t.array(Jn).min(1).max(50)]).optional()}).strict(),$t=Fs.superRefine((e,n)=>{Cl(e.pages,n)}),Dn=Fs.extend({pages:t.array(Vx).min(1)}).strict().superRefine((e,n)=>{Cl(e.pages,n)}),Zx=t.enum(["slug","showInHeader","showInFooter"]),Jx=t.object({page_id:Ie,fields:t.array(Zx).min(1).max(3)}).strict(),eE=t.object({page_id:Ie,block_id:Ie,fields:t.tuple([t.literal("type")])}).strict(),Pl=100,wl=500,tE=t.object({pages:t.array(Jx).max(Pl),blocks:t.array(eE).max(wl)}).strict().superRefine((e,n)=>{let s=new Set;e.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;e.blocks.forEach((i,r)=>{let m=`${i.page_id}\0${i.block_id}`;a.has(m)&&n.addIssue({code:"custom",path:["blocks",r],message:`Duplicate block target '${i.page_id}/${i.block_id}'.`}),a.add(m)})}),sL=t.object({sitemap:Dn,targets:tE,reserved_slugs:t.array(qa).optional()}).strict(),iL=t.object({pages:t.array(t.object({page_id:Ie,slug:t.string().min(1).optional(),show_in_header:t.boolean().optional(),show_in_footer:t.boolean().optional()}).strict()).max(Pl),blocks:t.array(t.object({page_id:Ie,block_id:Ie,type:t.string().trim().min(1)}).strict()).max(wl)}).strict().superRefine((e,n)=>{let s=new Set;e.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;e.blocks.forEach((i,r)=>{let m=`${i.page_id}\0${i.block_id}`;a.has(m)&&n.addIssue({code:"custom",path:["blocks",r],message:`Duplicate block output '${i.page_id}/${i.block_id}'.`}),a.add(m)})}),aL=t.object({sitemap:$t}).strict();function Cl(e,n){let s=new Map,a=new Map,i=new Map,r=0;e.forEach((p,I)=>{let R=s.get(p.id);if(R!==void 0?n.addIssue({code:"custom",path:["pages",I,"id"],message:`Duplicate page id '${p.id}' (first used at pages.${R}.id).`}):s.set(p.id,I),p.blocks.forEach((F,B)=>{let ee=a.get(F.id);ee!==void 0?n.addIssue({code:"custom",path:["pages",I,"blocks",B,"id"],message:`Duplicate block id '${F.id}' (first used at pages.${ee.pageIndex}.blocks.${ee.blockIndex}.id).`}):a.set(F.id,{pageIndex:I,blockIndex:B})}),p.slug===null)return;p.slug==="/"&&(r+=1);let w=i.get(p.slug);w!==void 0?n.addIssue({code:"custom",path:["pages",I,"slug"],message:`Duplicate page slug '${p.slug}' (first used at pages.${w}.slug).`}):i.set(p.slug,I)}),(r!==1||e[0]?.slug!=="/")&&n.addIssue({code:"custom",path:["pages"],message:"Sitemap must contain exactly one home page at pages[0] with slug '/'.",params:{errorCode:cl}});let m=new Map(e.map((p,I)=>[p.id,{page:p,index:I}])),c=(p,I)=>n.addIssue({code:"custom",path:p,message:I,params:{errorCode:cl}});e.forEach((p,I)=>{let R=p.parent_page_id??null;if(R===null)return;let w=["pages",I,"parent_page_id"];if(p.slug==="/"){c(w,"The home page cannot have a parent.");return}if(R===p.id){c(w,`Page '${p.id}' cannot be its own parent.`);return}let F=m.get(R);if(!F){c(w,`Parent page '${R}' does not exist.`);return}if(F.page.slug==="/"){c(w,"The home page cannot have sub pages.");return}(F.page.parent_page_id??null)!==null&&c(w,`Sitemap allows at most two levels; parent '${R}' must be a top-level page.`)})}var oL=Fs.omit({skillSelection:!0,visualTheme:!0,userChoices:!0,confirmedChoices:!0,seoKeywords:!0}).extend({meta:Fs.shape.meta.omit({source:!0}),site_name:t.string().min(1).max(80),pages:t.array(Yx).min(1),navigation:Xx}),nE=t.enum(["ai","user"]),Yt=t.object({site_id:T,page_id:Ie,edited_by:nE.default("ai"),source_agent_run_id:K.optional()}),rL=Yt.extend({block_id:Ie,target_index:t.number().int().min(0)}),sE=Yt.extend({block_id:Ie}),iE=Yt.extend({block_id:Ie,instruction:t.string()}),cL=Yt.extend({block_id:Ie,variant:t.string().min(1).nullable()}),mL=Yt.extend({block_id:Ie,props:t.record(t.string(),t.unknown()),mode:t.enum(["replace","merge"]).default("replace")}),lL=Yt.extend({block:t.object({id:Ie,label:t.string().trim().min(1),type:t.string().min(1),variant:t.string().min(1).optional(),props:t.record(t.string(),t.unknown()).default({}),insert_index:t.number().int().min(0).optional()})}),aE=t.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),pL=t.discriminatedUnion("operation",[t.object({operation:t.literal("delete_block"),input:sE}).strict(),t.object({operation:t.literal("update_block_instruction"),input:iE}).strict()]),oE=t.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"]),rE=t.object({status:t.literal("updated"),operation:aE,site_id:T,sitemap_id:Ae,version:t.number().int().positive(),changed_pages:t.array(Ie).min(1),requires_code_patch:t.literal(!0)}),cE=t.object({status:t.literal("failed"),code:oE,message:t.string().min(1),retryable:t.boolean().default(!1),details:t.unknown().optional()}),dL=t.discriminatedUnion("status",[rE,cE]),Ga=t.object({question_id:t.string().min(1),value:t.string().min(1),label:t.string().min(1).optional(),question:t.string().min(1).optional(),option_label:t.string().min(1).optional(),motion_level:Da.optional(),visual_tonality:va.optional(),conversion:Rt.optional(),positioning:t.object({market:t.string().min(1).max(200),customer:t.string().min(1).max(200),purpose:t.string().min(1).max(60)}).optional()}),mE=t.object({id:t.string().trim().min(1).max(128),type:t.literal(1),search_intent:t.string().trim().min(1).max(255),path:t.string().trim().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),channel:t.string().trim().min(1).max(80),content_format:t.string().trim().min(1).max(80),priority:t.enum(["P0","P1","P2","P3"])}).strict(),uL=t.object({source:t.object({kind:t.literal("step5_strategy")}).strict()}).strict(),lE=t.object({item_key:Xn,title:t.string().trim().min(1).max(200),selected_option_id:rn,selected_label:t.string().trim().min(1).max(200),selected_value:t.string().trim().min(1).max(500),selected_description:t.string().trim().min(1).max(2e3),impact:t.string().trim().min(1).max(500).optional(),customer_note:t.string().trim().min(1).max(200).optional(),market_type:Qn.optional(),markets:t.array(Zn).max(32).optional(),sections:t.array(t.object({id:t.string().min(1),label:t.string().min(1)}).strict()).optional()}).strict(),pE=t.object({kind:t.literal("step5_strategy"),site_name:t.string().trim().min(1).max(80).optional(),strategy_version_id:t.string().uuid(),strategy_version:t.number().int().positive(),strategy_checksum:t.string().regex(/^[a-f0-9]{64}$/),decisions:t.array(lE).min(Yn).max(ve),seo_keywords:t.array(Jn).min(1).max(50).optional(),enterprise_keywords:t.array(sn).min(1).optional()}).strict().superRefine((e,n)=>{let s=e.decisions.map(i=>i.item_key);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["decisions"],message:"Step5 sitemap decisions must use unique strategy keys."}),on.forEach(i=>{s.includes(i)||n.addIssue({code:"custom",path:["decisions"],message:`Step5 sitemap decisions are missing ${i}.`})});let a=It.filter(i=>s.includes(i));e.decisions.forEach((i,r)=>{i.item_key!==a[r]&&n.addIssue({code:"custom",path:["decisions",r,"item_key"],message:"Step5 sitemap decisions must use the canonical order."})})}),vl=t.object({tenant_id:t.string().min(1),site_id:T,brief_id:Dt,brief:t.string().min(20).max(1e3),answers:t.array(Ga).min(1).max(10),skillSelection:Vt,site_default_locale:fe.optional(),owner_locale:fe.optional(),cms_site_id:t.string().min(1).nullish(),intent_pages:t.array(mE).max(wo).optional(),reference:Gn.optional(),input_context:t.object({facts:t.array(Fn).max(120),conflicts:t.array(Kn).max(20)}).optional(),business_facts:ro.optional(),extra_requirement:t.string().trim().min(1).max(Ot).optional(),migration_products_enabled:t.boolean().optional()}),dE=vl.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:pE}).strict(),_L=t.union([vl,dE]),Dl=t.enum(["planning","generating","validating","ready"]),uE=t.enum(["salvaged","deterministic_fallback"]),_E=t.enum(["model_exception_settled_prefix","model_exception_safe_root"]),Ol={outcome:uE.optional(),reason:_E.optional(),attempts:t.number().int().positive().optional()};function jl(e,n){if(e.type!=="sitemap.generated")return;let s=e.outcome!==void 0,a=e.reason!==void 0;s!==a&&n.addIssue({code:"custom",path:[s?"reason":"outcome"],message:"sitemap.generated outcome and reason must be provided together"})}var gE=t.discriminatedUnion("type",[t.object({type:t.literal("run.started"),runId:K,at:t.string().min(1)}),t.object({type:t.literal("sitemap.generating"),stage:Dl,message:t.string().min(1).optional(),at:t.string().min(1)}),t.object({type:t.literal("sitemap.partial"),object:t.unknown(),at:t.string().min(1)}),t.object({type:t.literal("sitemap.generated"),sitemap_id:Ae,sitemap:$t,...Ol,at:t.string().min(1)}),t.object({type:t.literal("sitemap.clamped"),reason:t.enum(["page_early_stop","finalize_best_effort"]),original_page_count:t.number().int().nonnegative().optional(),final_page_count:t.number().int().nonnegative().optional(),original_block_count:t.number().int().nonnegative().optional(),final_block_count:t.number().int().nonnegative().optional(),at:t.string().min(1)}),t.object({type:t.literal("media_resolution.started"),slot_count:t.number().int().nonnegative(),at:t.string().min(1)}),t.object({type:t.literal("media_resolution.finished"),slot_count:t.number().int().nonnegative(),provider_counts:t.object({unsplash:t.number().int().nonnegative(),pexels:t.number().int().nonnegative(),placeholder:t.number().int().nonnegative()}),fallback_count:t.number().int().nonnegative(),error_codes:t.array(t.string()),at:t.string().min(1)}),t.object({type:t.literal("snapshot.created"),snapshot_id:k,manifest_hash:t.string().regex(/^sha256:[a-f0-9]{64}$/),at:t.string().min(1)}),t.object({type:t.literal("run.failed"),error_code:t.string().min(1),message:t.string().min(1),at:t.string().min(1)}),t.object({type:t.literal("run.finished"),snapshot_id:k.optional(),at:t.string().min(1)})]),gL=gE.superRefine(jl),Nl=t.object({id:Ae,tenant_id:t.string().min(1),site_id:T,version:t.number().int().positive(),source_agent_run_id:K.nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}).strict();function Ll(e,n){e.version!==e.sitemap.version&&n.addIssue({code:"custom",path:["sitemap","version"],message:`Sitemap JSON version ${e.sitemap.version} must equal record version ${e.version}.`})}var Ml=Nl.extend({sitemap:$t}).superRefine(Ll),hE=Nl.extend({sitemap:Dn}).superRefine(Ll),hL=t.object({sitemap_id:Ae,creation_key:t.string().min(1),sitemap:$t,source_agent_run_id:K.optional()}),SL=t.object({sitemap_id:Ae,creation_key:t.string().min(1),sitemap:Dn,expected_current_sitemap_id:Ae,expected_current_sitemap_version:t.number().int().positive(),migration_content_requested:t.boolean().optional()}),fL=t.object({sitemap_id:Ae,creation_key:t.string().min(1),sitemap:$t,source_agent_run_id:K}),bL=t.object({site:yt,sitemap:Ml,next_step:t.literal("workspace")}).strict(),yL=t.object({site:yt,sitemap:hE,next_step:t.literal("workspace")}).strict(),xL=t.object({site:yt,sitemap:Ml,next_step:t.literal("sitemap_review")}).strict(),SE=t.object({id:$a,tenant_id:t.string().min(1),site_id:T,brief_id:Dt,questions:Oa,answers:t.array(Ga),selected_archetype:Vt.optional(),completed_at:t.string().min(1).nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}),EL=t.object({answers:t.array(Ga).min(1),questions:Oa,selected_archetype:Vt.optional()}),RL=t.object({clarify_session:SE}),IL=t.object({questions:Oa,selected_archetype:Vt}),fE=t.object({id:Bs,tenant_id:t.string().min(1),site_id:T,version:t.number().int().positive(),design_plan:kl,source_agent_run_id:K.nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}),TL=t.object({design_plan_id:Bs.optional(),design_plan:kl,source_agent_run_id:K.optional()}),kL=t.object({design_plan:fE}),zs=t.enum(["initial_generation","iteration","landing_page","fill_in"]),bE=t.object({label:t.string().min(1).max(48),prompt:t.string().min(1).max(160)}).strict(),yE=t.enum(["model","derived","mixed","advisor"]),Ul=t.object({suggestions:t.array(bE).min(1).max(4),source:yE}).strict(),xE=t.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),EE=t.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"]),RE=t.enum(["progress","assistant_final"]),ql=t.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","workspace.generation_ledger","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"]),IE=t.object({id:t.string().min(1),title:t.string().min(1),status:t.enum(["pending","running","completed","failed"])}),vt=t.enum(["pending","running","completed","completed_with_skips","failed","skipped"]),Ka=t.enum(["style_media","chrome","sections","layout","pages","detect_typecheck","repair","finalize","sitemap_resync","preview"]),Wa=t.object({code:t.string().min(1),message:t.string().min(1),path:t.string().min(1).optional(),task_id:t.string().min(1).optional(),details:t.record(t.string(),t.unknown()).optional()}),Re=t.string().min(1).refine(e=>Ql(e),{message:"Snapshot file paths must be safe relative POSIX paths without traversal."}),za=t.object({deduped_paths:t.array(Re),skipped_tasks:t.array(t.string().min(1)),failed_tasks:t.array(t.string().min(1)),fallback_files:t.array(t.string().min(1)),applied_paths:t.array(Re)}),Ba=t.object({group_id:t.string().min(1),phase:Ka,title:t.string().min(1),status:vt,task_ids:t.array(t.string().min(1)),depends_on_groups:t.array(t.string().min(1)),target_paths:t.array(Re)}),TE=t.enum(["style","media","chrome","section","layout","page"]),Ha=t.object({task_id:t.string().min(1),group_id:t.string().min(1),kind:TE,target_path:Re,block_id:t.string().min(1).optional(),block_type:t.string().min(1).optional(),block_variant:t.string().min(1).optional(),block_order:t.number().int().nonnegative().optional(),user_instruction:t.string().min(1).optional(),page_id:t.string().min(1).optional(),page_slug:t.string().min(1).optional(),page_title:t.string().min(1).optional(),title:t.string().min(1).max(60).optional(),description:t.string().min(1).max(Ma).optional(),status:vt,required_reads:t.array(Re).optional(),search_params_sections:t.array(Re).optional(),standard_form_view:Re.optional(),breadcrumb:t.object({trail:t.array(t.object({name:t.string().min(1),href:t.string().min(1).nullable(),omitted_href:t.string().min(1).optional()}).strict()).min(1),current:t.string().min(1)}).strict().optional()}),Va=t.object({from_group_id:t.string().min(1),to_group_id:t.string().min(1),reason:t.enum(["style_media","chrome","sections","layout","page_composition","quality_gate"])}),AL=t.object({plan_id:t.string().min(1),run_kind:zs,model_route:t.object({planner:t.literal("workspace_planner"),worker:t.literal("workspace")}),groups:t.array(Ba),tasks:t.array(Ha),dependencies:t.array(Va),expected_outputs:t.array(Re),diagnostics:za}),PL=t.object({task_id:t.string().min(1),patch:t.unknown().optional(),snapshot_id:k.optional(),read_files:t.array(Re),diagnostics:t.array(Wa),status:vt}),Fl=t.object({worker_count:t.number().int().nonnegative(),task_count:t.number().int().nonnegative(),group_count:t.number().int().nonnegative()}),Gl=t.object({pending:t.number().int().nonnegative(),running:t.number().int().nonnegative(),completed:t.number().int().nonnegative(),completed_with_skips:t.number().int().nonnegative(),failed:t.number().int().nonnegative(),skipped:t.number().int().nonnegative()}),kE=t.object({type:t.literal("text"),text:t.string(),state:t.enum(["streaming","done"]).optional()}),AE=t.object({type:t.literal("reasoning"),text:t.string(),state:t.enum(["streaming","done"]).optional(),providerMetadata:t.record(t.string(),t.unknown()).optional()}),PE=t.object({type:t.literal("file"),mediaType:t.string().min(1),filename:t.string().min(1).optional(),url:t.string().min(1)}),wE=t.object({type:t.literal("source-url"),sourceId:t.string().min(1),url:t.string().min(1),title:t.string().min(1).optional(),providerMetadata:t.record(t.string(),t.unknown()).optional()}),CE=t.object({type:t.literal("source-document"),sourceId:t.string().min(1),mediaType:t.string().min(1),title:t.string().min(1),filename:t.string().min(1).optional(),providerMetadata:t.record(t.string(),t.unknown()).optional()}),vE=t.object({type:t.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:t.string().min(1).optional(),data:t.unknown()}),DE=t.object({type:t.string().regex(/^tool-[a-zA-Z0-9_-]+$/),toolCallId:t.string().min(1),state:t.enum(["input-streaming","input-available","output-available","output-error"]),input:t.unknown().optional(),output:t.unknown().optional(),errorText:t.string().min(1).optional()}),OE=t.object({type:t.literal("error"),errorText:t.string().min(1)}),jE=t.object({type:t.literal("step-start")}),Gs=t.union([kE,AE,PE,wE,CE,vE,DE,OE,jE]),NE=t.string().min(1).max(512).refine(e=>Ql(e)&&!/^[A-Za-z]:\//.test(e),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),LE=t.array(NE).min(1).max(64),ME=t.array(t.string().min(1).max(120)).min(1).max(64),UE=t.discriminatedUnion("type",[t.object({type:t.literal("run.started"),runId:K,at:t.string().min(1)}),t.object({type:t.literal("message.delta"),text:t.string().min(1),history_purpose:RE.optional(),at:t.string().min(1)}),t.object({type:t.literal("user.message"),client_message_id:t.string().min(1),message_id:t.string().min(1),parts:t.array(Gs).min(1),in_reply_to_tool_call_id:t.string().min(1).optional(),interaction_response:os.optional(),at:t.string().min(1)}),t.object({type:t.literal("plan.updated"),steps:t.array(IE),at:t.string().min(1)}),t.object({type:t.literal("clarify.partial"),object:t.unknown(),at:t.string().min(1)}),t.object({type:t.literal("clarify.archetype_proposals"),proposals:t.array(ul).min(1).max(5),at:t.string().min(1)}),t.object({type:t.literal("clarify.finished"),questions_id:t.string().min(1),at:t.string().min(1)}),t.object({type:t.literal("sitemap.generating"),stage:Dl,message:t.string().min(1).optional(),at:t.string().min(1)}),t.object({type:t.literal("sitemap.partial"),object:t.unknown(),at:t.string().min(1)}),t.object({type:t.literal("sitemap.generated"),sitemap_id:Ae,sitemap:$t,...Ol,at:t.string().min(1)}),t.object({type:t.literal("sitemap.clamped"),reason:t.enum(["page_early_stop","finalize_best_effort"]),original_page_count:t.number().int().nonnegative().optional(),final_page_count:t.number().int().nonnegative().optional(),original_block_count:t.number().int().nonnegative().optional(),final_block_count:t.number().int().nonnegative().optional(),at:t.string().min(1)}).strict(),t.object({type:t.literal("sitemap.updated"),sitemap_id:Ae,version:t.number().int().positive(),reason:t.string().min(1),at:t.string().min(1)}),t.object({type:t.literal("sitemap.resync.failed"),error_code:t.string().min(1),message:t.string().min(1),retryable:t.boolean(),diagnostics:t.unknown().optional(),at:t.string().min(1)}),t.object({type:t.literal("sitemap.resync.warning"),code:t.string().min(1),message:t.string().min(1),diagnostics:t.unknown().optional(),at:t.string().min(1)}),t.object({type:t.literal("block.changed"),block_id:t.string().min(1),change_type:t.enum(["add","update","delete","move"]),at:t.string().min(1)}),t.object({type:t.literal("tool.started"),tool_call_id:t.string().min(1),name:t.string().min(1),summary:t.string().min(1),at:t.string().min(1)}),t.object({type:t.literal("tool.finished"),tool_call_id:t.string().min(1),name:t.string().min(1),result_summary:t.string().min(1),interaction_request:vi.optional(),at:t.string().min(1)}),t.object({type:t.literal("workspace.plan.created"),plan_id:t.string().min(1),run_kind:zs,groups:t.array(Ba),tasks:t.array(Ha),dependencies:t.array(Va),expected_outputs:t.array(Re),diagnostics:za,summary:Fl,at:t.string().min(1)}).strict(),t.object({type:t.literal("workspace.worker.updated"),group_id:t.string().min(1),phase:Ka,status:vt,task_counts:Gl,target_paths:t.array(Re),diagnostics:t.array(t.string().min(1)),at:t.string().min(1)}).strict(),t.object({type:t.literal("workspace.task.updated"),task_id:t.string().min(1),group_id:t.string().min(1),status:vt,target_path:Re,read_files_count:t.number().int().nonnegative(),diagnostics:t.array(t.string().min(1)),diagnostic_details:t.array(Wa).optional(),at:t.string().min(1)}).strict(),t.object({type:t.literal("workspace.degraded"),reason:t.enum(["block_placeholder","form_placeholder","patch_protected_dropped","preview_health_degraded","preview_build_failed","design_plan_fallback","generated_code_rescue","cms_page_directory_degraded","form_prebuild_skipped","form_section_fallback","first_settings_sync_failed","component_omitted","page_omitted","shared_fallback"]),degraded_block_ids:t.array(t.string().min(1)).min(1).optional(),dropped_files:t.array(t.string().min(1)).min(1).optional(),degraded_file_paths:LE.optional(),degraded_page_ids:ME.optional(),snapshot_id:k.optional(),code:t.string().min(1).optional(),message:t.string().min(1).optional(),diagnostics:t.string().min(1).optional(),retryable:t.boolean().optional(),at:t.string().min(1)}).strict().superRefine((e,n)=>{let s=e.reason==="generated_code_rescue",a=e.reason==="page_omitted",i=e.reason==="shared_fallback";if(!s){if(e.degraded_file_paths!==void 0&&n.addIssue({code:"custom",path:["degraded_file_paths"],message:"degraded_file_paths is only allowed for generated_code_rescue"}),e.degraded_page_ids!==void 0&&!a&&n.addIssue({code:"custom",path:["degraded_page_ids"],message:"degraded_page_ids is only allowed for generated_code_rescue or page_omitted"}),i)for(let r of["degraded_block_ids","dropped_files","snapshot_id","code","diagnostics","retryable"])e[r]!==void 0&&n.addIssue({code:"custom",path:[r],message:`${r} is not allowed for shared_fallback`});return}e.degraded_file_paths===void 0&&n.addIssue({code:"custom",path:["degraded_file_paths"],message:"generated_code_rescue requires degraded_file_paths"});for(let r of["degraded_block_ids","dropped_files","snapshot_id","code","message","diagnostics","retryable"])e[r]!==void 0&&n.addIssue({code:"custom",path:[r],message:`${r} is not allowed for generated_code_rescue`})}),t.object({type:t.literal("workspace.design_plan.outcome"),design_plan_outcome:xE,reason:EE,gate_diagnostics:t.object({gate:t.enum(["quality","schema"]),issue_codes:t.array(t.string().min(1)).max(20),issue_paths:t.array(t.string()).max(20),finish_reason:t.string().min(1).optional()}).strict().optional(),media_floor:t.object({total_blocks:t.number().int().min(0),media_bearing_blocks:t.number().int().min(0),hero_total:t.number().int().min(0),hero_media_bearing:t.number().int().min(0),pages_without_media:t.array(t.string().min(1)).max(50),met:t.boolean()}).strict().optional(),at:t.string().min(1)}).strict(),Ul.extend({type:t.literal("workspace.suggestions"),at:t.string().min(1)}).strict(),mo,t.object({type:t.literal("file.changed"),path:t.string().min(1),change_type:t.enum(["create","update","delete"]),diff:t.string().optional(),at:t.string().min(1)}),t.object({type:t.literal("snapshot.created"),snapshot_id:k,manifest_hash:t.string().regex(/^sha256:[a-f0-9]{64}$/),at:t.string().min(1)}),t.object({type:t.literal("snapshot.finalized"),snapshot_id:k,at:t.string().min(1)}),t.object({type:t.literal("preview.preparing"),at:t.string().min(1)}),t.object({type:t.literal("preview.ready"),url:t.string().url(),at:t.string().min(1),launch_id:t.string().min(1).optional()}),t.object({type:t.literal("preview.build.started"),snapshot_id:k,at:t.string().min(1)}),t.object({type:t.literal("preview.build.succeeded"),snapshot_id:k,at:t.string().min(1)}),t.object({type:t.literal("preview.build.failed"),snapshot_id:k,message:t.string().min(1),diagnostics:t.string().min(1),retryable:t.boolean(),at:t.string().min(1)}),t.object({type:t.literal("run.failed"),error_code:t.string().min(1),message:t.string().min(1),error_category:_l.optional(),retryable:t.boolean().optional(),attempts:t.number().int().positive().optional(),outcome:t.literal("retained_previous").optional(),details:t.record(t.string(),t.unknown()).optional(),at:t.string().min(1)}),t.object({type:t.literal("run.finished"),snapshot_id:k.optional(),degraded_reason:Qt.optional(),build_verified:t.boolean().optional(),generation_ledger:tn.optional(),at:t.string().min(1)}),t.object({type:t.literal("media_resolution.started"),slot_count:t.number().int().nonnegative(),at:t.string().datetime()}),t.object({type:t.literal("media_resolution.finished"),slot_count:t.number().int().nonnegative(),provider_counts:t.object({unsplash:t.number().int().nonnegative(),pexels:t.number().int().nonnegative(),placeholder:t.number().int().nonnegative()}),fallback_count:t.number().int().nonnegative(),error_codes:t.array(t.string()),at:t.string().datetime()}),t.object({type:t.literal("skill.selecting"),category:t.literal("page-generation"),available:t.array(t.object({id:t.string().min(1),name:t.string().min(1)})).max(20),at:t.string().min(1)}),t.object({type:t.literal("skill.selected"),category:t.literal("page-generation"),selected:t.object({id:t.string().min(1),name:t.string().min(1),reason:t.string().min(1).max(200)}),at:t.string().min(1)}),t.object({type:t.literal("activity.started"),activity_id:t.string().min(1),parent_activity_id:t.string().min(1).optional(),kind:El,title:t.string().min(1).max(200),detail:t.string().max(360).optional(),title_code:bt.optional(),detail_code:bt.optional(),locks_input:t.boolean(),at:t.string().min(1)}),t.object({type:t.literal("activity.updated"),activity_id:t.string().min(1),title:t.string().min(1).max(200).optional(),detail:t.string().max(360).optional(),title_code:bt.optional(),detail_code:bt.optional(),at:t.string().min(1)}),t.object({type:t.literal("activity.finished"),activity_id:t.string().min(1),at:t.string().min(1)}),t.object({type:t.literal("activity.failed"),activity_id:t.string().min(1),detail:t.string().max(360).optional(),at:t.string().min(1)})]),Kl=UE.superRefine(jl).superRefine((e,n)=>{if(e.type==="user.message"&&e.interaction_response&&!e.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"}),e.type!=="tool.finished")return;let s=e.name==="prepare_product_search_entry";s!==!!e.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"})}),Ca=t.object({id:Xa,tenant_id:t.string().min(1),site_id:T,agent_run_id:K,sequence:t.number().int().positive(),event_type:ql,payload:Kl,created_at:t.string().min(1),thread_id:He.nullable().optional()}),wL=t.object({event_type:ql,payload:Kl}).superRefine((e,n)=>{e.event_type!==e.payload.type&&n.addIssue({code:"custom",path:["payload","type"],message:"payload.type must match event_type"}),Nn(e.payload)&&n.addIssue({code:"custom",path:["payload"],message:"AgentEvent payload must not contain secrets"})}),CL=t.discriminatedUnion("status",[t.object({status:t.literal("appended"),agent_run:Be,event:Ca,next_cursor:t.number().int().nonnegative()}),t.object({status:t.literal("duplicate_ignored"),agent_run:Be,event:Ca,next_cursor:t.number().int().nonnegative()})]),vL=t.object({events:t.array(Ca),next_cursor:t.number().int().nonnegative().optional()}),DL=t.object({after_sequence:t.coerce.number().int().nonnegative().default(0)}),OL=t.object({run_id:K.optional(),thread_id:He.optional()}).superRefine((e,n)=>{e.run_id&&e.thread_id&&n.addIssue({code:"custom",path:["thread_id"],message:"run_id and thread_id are mutually exclusive"})}),jL=t.enum(["implemented","skeleton","planned"]),NL=t.enum(["GET","POST","PUT","PATCH","DELETE"]),LL=[{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:"Accept 1\u20133 Page Template items as one asynchronous Workspace task (HTTP 202).",status:"implemented",request_body_schema:"PageTemplateCreateRequestSchema",response_schema:"PageTemplateCreateResponseSchema",notes:["Internal bearer plus tenant context; API starts one new background thread/run with its fixed system identity. Poll GET /internal/external-site-edits/:task_id; no external IDs or callbacks. Manifest-gated whole-batch success commits exactly one snapshot."]},{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:"/agent-runs/workspace/stop",tag:"agent-runs",summary:"Request a soft stop of the active first-generation or fill-in run for a site.",status:"implemented",request_body_schema:"StopWorkspaceGenerationRequestSchema",response_schema:"StopWorkspaceGenerationResponseSchema",notes:["Browser surface with the same tenant scoping as POST /agent-runs/workspace/cancel: only the active initial_generation / fill_in run of a site in the caller's tenant is touched.","A run holding a live lease gets stop_requested_at instead of a terminal event, so it keeps the pages it already saved and closes itself: status=requested, or already_requested on a repeat (the first stop timestamp is never moved).","A run whose lease has lapsed has no process left to honour the flag, so it is closed immediately (run.failed, site lock released) and the answer is status=stopped. Nothing in flight returns no_active_run with run_id null."]},{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:"POST",path:"/internal/agent-runs/claim-stale-workspace-runs",tag:"agent-runs",summary:"Claim stale workspace runs for resumption (internal maintenance, cross-tenant sweep).",status:"implemented",response_schema:"ClaimStaleWorkspaceRunsResponseSchema",notes:["Internal maintenance endpoint guarded by InternalAgentAuthGuard; same trust boundary as fail-stale-in-flight and not exposed to the browser.","Re-issues a fresh lease_owner (fencing token) and increments resume_count in one UPDATE for each resumable initial run; a lease expiring only means the work was interrupted, not that the run failed. Initial runs that used up WORKSPACE_MAX_RESUME_COUNT and interrupted fill-in runs are failed instead and are absent from the response."]},{method:"GET",path:"/internal/agent-runs/:run_id/context",tag:"agent-runs",summary:"Resolve run thread context (internal, Agent Runtime).",status:"implemented",response_schema:"AgentRunContextResponseSchema",notes:["Internal endpoint guarded by InternalAgentAuthGuard; tenant comes from x-vcp-tenant-id.","Returns the run together with its thread (null = the site main thread); a run outside the tenant is 404."]},{method:"POST",path:"/internal/agent-runs/:run_id/heartbeat",tag:"agent-runs",summary:"Renew a workspace run lease (internal, Agent Runtime).",status:"implemented",request_body_schema:"WorkspaceRunHeartbeatRequestSchema",response_schema:"WorkspaceRunHeartbeatResponseSchema",notes:["Internal endpoint guarded by InternalAgentAuthGuard; tenant comes from x-vcp-tenant-id.","One CAS UPDATE checks that the run is still in flight and that lease_owner has not been re-issued: superseded means another attempt took over and this process must stop dispatching; not_active means the run already reached a terminal state."]},{method:"POST",path:"/internal/agent-runs/:run_id/page-checkpoints",tag:"agent-runs",summary:"Register a workspace page checkpoint (internal, Agent Runtime).",status:"implemented",request_body_schema:"RegisterWorkspacePageCheckpointRequestSchema",response_schema:"WorkspacePageCheckpointSchema",notes:["Internal endpoint guarded by InternalAgentAuthGuard; tenant comes from x-vcp-tenant-id.","Idempotent on (tenant_id, run_id, page_id, attempt): a conflict returns the existing row unchanged. The object must already be written to storage \u2014 a failed registration means the page was not saved. A lease_owner that no longer matches the run is 409, and a run in a terminal state is 409."]},{method:"GET",path:"/internal/agent-runs/:run_id/page-checkpoints",tag:"agent-runs",summary:"List workspace page checkpoints (internal, Agent Runtime).",status:"implemented",response_schema:"ListWorkspacePageCheckpointsResponseSchema",notes:["Internal endpoint guarded by InternalAgentAuthGuard; returns one row per page_id (the highest attempt). A run outside the tenant returns no checkpoints."]},{method:"GET",path:"/internal/agent-runs/:run_id/run-control",tag:"agent-runs",summary:"Read workspace run control input (internal, Agent Runtime).",status:"implemented",response_schema:"WorkspaceRunControlInputResponseSchema",notes:["Internal endpoint guarded by InternalAgentAuthGuard; AgentRunRecord carries no input, so the lease owner, stop flag, resume count and fill-in inputs stored on the run row are read here. A run outside the tenant, or one that is not a workspace run, is 404."]},{method:"GET",path:"/deployments",tag:"deployments",summary:"Deployment resource summary endpoint until publish APIs land.",status:"skeleton"},{method:"GET",path:"/sites/:site_id/generation-ledger",tag:"sites",summary:"Read the stored generation ledger of a site (omitted deliverables and fill-in progress).",status:"implemented",response_schema:"SiteGenerationLedgerResponseSchema",notes:["One ledger per (tenant_id, site_id), written when an initial_generation / fill_in run.finished carries generation_ledger. A site that has never finished such a run returns ledger null with source_run_id and updated_at null."]},{method:"POST",path:"/sites/:site_id/generation/fill-in",tag:"sites",summary:"Start a fill-in run for deliverables the generation ledger still lists as omitted.",status:"implemented",request_body_schema:"StartFillInRequestSchema",response_schema:"StartFillInResponseSchema",notes:["Every target must still be listed as an unfilled omission in the site ledger; otherwise 400 FILL_IN_TARGET_NOT_OMITTED with details.target_id. A site with no ledger at all is rejected with the same code.","The site must be workspace_ready; otherwise 409 FILL_IN_NOT_AVAILABLE.","A fill-in run does not take the per-site workspace_run operation lock: while it runs the user keeps browsing. client_run_key makes the POST idempotent \u2014 repeating it returns the existing in-flight run and does not dispatch it again; another in-flight workspace run on the same site is rejected with 409 WORKSPACE_RUN_IN_FLIGHT."]},{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:"/sites/:site_id/workspace/attachments",tag:"workspace",summary:"Upload a chat image attachment for the Workspace conversation.",status:"implemented",response_schema:"WorkspaceAttachmentSchema",notes:["multipart/form-data with a single `file`; the response `image_url` is referenced by a `file` part of the next client message."]},{method:"POST",path:"/sites/:site_id/workspace/attachments/from-url",tag:"workspace",summary:"Capture a screenshot of a web page and store it as a chat image attachment.",status:"implemented",request_body_schema:"WorkspaceAttachmentFromUrlRequestSchema",response_schema:"WorkspaceAttachmentSchema",notes:["The screenshot becomes an ordinary attachment: same quotas, same `file` part reference, never placed on the site.","Capture runs through the ingestion service (SSRF guard, concurrency gate, Firecrawl credits)."]},{method:"GET",path:"/sites/:site_id/workspace/attachments/:attachment_id/image",tag:"workspace",summary:"Read the bytes of a chat image attachment (owner thumbnails and replay).",status:"implemented"},{method:"DELETE",path:"/sites/:site_id/workspace/attachments/:attachment_id",tag:"workspace",summary:"Delete an unsent chat image attachment.",status:"implemented",notes:["Attachments already sent with a message return 409 WORKSPACE_ATTACHMENT_BOUND."]},{method:"GET",path:"/internal/workspace-attachments/:site_id/:attachment_id",tag:"workspace",summary:"Internal side-channel for the Workspace Agent to read a chat image attachment.",status:"implemented"},{method:"GET",path:"/sites/:site_id/threads",tag:"workspace",summary:"List a site's named Agent threads (workspace conversations).",status:"implemented",response_schema:"SiteThreadListResponseSchema",notes:["The browser can only list threads that belong to the current site."]},{method:"POST",path:"/sites/:site_id/threads",tag:"workspace",summary:"Create a new named Agent thread for a site.",status:"implemented",request_body_schema:"CreateSiteThreadRequestSchema",response_schema:"SiteThreadResponseSchema",notes:["The created thread is scoped to the current site; the browser cannot create a thread for another site."]},{method:"PATCH",path:"/sites/:site_id/threads/:thread_id",tag:"workspace",summary:"Rename or archive an Agent thread.",status:"implemented",request_body_schema:"UpdateSiteThreadRequestSchema",response_schema:"SiteThreadResponseSchema",notes:["The server verifies the thread belongs to the current site and tenant before applying the update."]},{method:"GET",path:"/sites/:site_id/workspace/runs/active",tag:"workspace",summary:"Look up the site's current in-flight Workspace Agent run across all threads.",status:"implemented",response_schema:"ActiveWorkspaceRunResponseSchema",notes:["Scoped to the current site regardless of thread; the browser cannot query another site's active run."]},{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:"GET",path:"/internal/sites/:site_id/active-domain",tag:"internal/active-domain",summary:"Read whether an internal site has an active primary domain.",status:"implemented",response_schema:"GetActiveSiteDomainResponseSchema"},{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:"Read the current publish workflow domain operation.",status:"implemented",response_schema:"GetSitePublishDomainOperationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflows/:workflow_id/domain/operation/reconcile",tag:"publish-workflow",summary:"Recover or reconcile the current publish workflow domain operation.",status:"implemented",response_schema:"ReconcileSitePublishDomainOperationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflows/:workflow_id/domain/remediation/confirm",tag:"publish-workflow",summary:"Confirm the current DNS remediation plan.",status:"implemented",request_body_schema:"ConfirmSitePublishDomainRemediationRequestSchema",response_schema:"ConfirmSitePublishDomainRemediationResponseSchema"},{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:"SitePublishWorkflowQualityResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/:workflow_id/repair-task",tag:"publish-workflow",summary:"Idempotently create the publish repair task.",status:"implemented",request_body_schema:"SitePublishWorkflowRevisionRequestSchema",response_schema:"SitePublishWorkflowQualityResponseSchema"},{method:"GET",path:"/sites/:site_id/publish-workflow/:workflow_id",tag:"publish-workflow",summary:"Read and reconcile a site publish workflow quality task.",status:"implemented",response_schema:"SitePublishWorkflowQualityResponseSchema"},{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"}],ML=[{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"]}],qE=t.object({id:t.string().min(1),role:t.enum(["system","user","assistant"]),metadata:t.unknown().optional(),parts:t.array(Gs).min(1)}),Wl=qE.extend({role:t.literal("user")}).superRefine((e,n)=>{let s=0;for(let[a,i]of e.parts.entries()){if(i.type!=="file")continue;s+=1;let r=i;Oi.safeParse(r.mediaType).success||n.addIssue({code:"custom",path:["parts",a,"mediaType"],message:"Attachment mediaType must be image/png, image/jpeg or image/webp"}),(typeof r.url!="string"||ji(r.url)===null)&&n.addIssue({code:"custom",path:["parts",a,"url"],message:"Attachment url must be a workspace attachment image path"})}s>Di&&n.addIssue({code:"custom",path:["parts"],message:`A message may carry at most ${Di} attachments`})}),UL=t.object({base_snapshot_id:k.optional(),message:Wl.optional(),thread_id:He.optional(),client_run_key:t.string().min(1).max(200).optional()}).superRefine((e,n)=>{Nn(e.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),FE=t.object({path:t.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:K,base_snapshot_id:k,run_kind:zs}),qL=t.object({agent_run:Be,websocket:FE,next_step:t.literal("workspace_socket")}),FL=t.object({agent_run:Be}),GL=t.object({thread_id:He.optional()}),KL=t.object({agent_run:Be.nullable(),thread:Ks.nullable()}),WL=t.object({status:fl.default("active")}),zL=t.object({threads:t.array(Ks)}),BL=t.object({title:t.string().trim().min(1).max(200)}).strict(),HL=t.object({title:t.string().trim().min(1).max(200).optional(),status:t.literal("archived").optional()}).strict().refine(e=>e.title!==void 0||e.status!==void 0,{message:"title or status is required"}),VL=t.object({thread:Ks}),$L=t.object({agent_type:t.enum(["clarify","sitemap","workspace"]),thread_id:He.optional()}),YL=t.object({agent_run:Be}),XL=t.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"]),ae=t.object({id:t.string().min(1),tenant_id:t.string().min(1),site_id:T,run_id:K.optional(),correlation_id:t.string().min(1).optional(),seq:t.number().int().positive().optional(),sent_at:t.string().min(1)}),GE=t.object({key:t.string().min(1),label:t.string().min(1),source_file:t.string().min(1).optional(),component_name:t.string().min(1).optional(),opening_element_range:t.object({start_line:t.number().int().positive(),start_column:t.number().int().nonnegative(),end_line:t.number().int().positive(),end_column:t.number().int().nonnegative()}).optional(),structural_path:t.string().min(1).optional(),text_preview:t.string().min(1).optional()}),KE=t.discriminatedUnion("type",[ae.extend({type:t.literal("client.message.create"),payload:t.object({client_message_id:t.string().min(1),in_reply_to_tool_call_id:t.string().min(1).optional(),current_route_id:hn.optional(),interaction_response:os.optional(),selected_component:GE.optional(),message:Wl,base_snapshot_id:k.optional()}).superRefine((e,n)=>{e.interaction_response&&!e.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"})})}),ae.extend({type:t.literal("client.run.cancel"),payload:t.object({run_id:K,reason:t.string().min(1).optional()})}),ae.extend({type:t.literal("client.tool.approve"),payload:t.object({tool_call_id:t.string().min(1),decision:t.enum(["approve","reject"]),reason:t.string().min(1).optional()})}),jr]),WE=t.discriminatedUnion("type",[ae.extend({type:t.literal("server.run.started"),payload:t.object({run_id:K,agent_type:t.literal("workspace")})}),ae.extend({type:t.literal("server.user.message"),payload:t.object({client_message_id:t.string().min(1),message_id:t.string().min(1),parts:t.array(Gs).min(1),in_reply_to_tool_call_id:t.string().min(1).optional(),interaction_response:os.optional()})}),ae.extend({type:t.literal("server.assistant.delta"),payload:t.object({message_id:t.string().min(1),parts:t.array(Gs).min(1),status:t.enum(["streaming","ready"])})}),ae.extend({type:t.literal("server.tool.started"),payload:t.object({tool_call_id:t.string().min(1),name:t.string().min(1),summary:t.string().min(1)})}),ae.extend({type:t.literal("server.tool.completed"),payload:t.object({tool_call_id:t.string().min(1),name:t.string().min(1),result_summary:t.string().min(1),interaction_request:vi.optional()})}),ae.extend({type:t.literal("server.workspace.suggestions"),payload:Ul.extend({run_id:K}).strict()}),ae.extend({type:t.literal("workspace.plan.created"),payload:t.object({plan_id:t.string().min(1),run_kind:zs,groups:t.array(Ba),tasks:t.array(Ha),dependencies:t.array(Va),expected_outputs:t.array(Re),diagnostics:za,summary:Fl})}),ae.extend({type:t.literal("workspace.worker.updated"),payload:t.object({group_id:t.string().min(1),phase:Ka,status:vt,task_counts:Gl,target_paths:t.array(Re),diagnostics:t.array(t.string().min(1))})}),ae.extend({type:t.literal("workspace.task.updated"),payload:t.object({task_id:t.string().min(1),group_id:t.string().min(1),status:vt,target_path:Re,read_files_count:t.number().int().nonnegative(),diagnostics:t.array(t.string().min(1)),diagnostic_details:t.array(Wa).optional()})}),ae.extend({type:t.literal("server.patch.applied"),payload:t.object({patch_batch_id:t.string().min(1),changed_files:t.array(t.string().min(1)),sitemap_resync_queued:t.boolean()})}),ae.extend({type:t.literal("server.sitemap.updated"),payload:t.object({sitemap_id:Ae,version:t.number().int().positive(),reason:t.string().min(1)})}),ae.extend({type:t.literal("server.snapshot.created"),payload:t.object({snapshot_id:k,manifest_hash:t.string().regex(/^sha256:[a-f0-9]{64}$/)})}),ae.extend({type:t.literal("server.snapshot.finalized"),payload:t.object({snapshot_id:k})}),ae.extend({type:t.literal("server.preview.invalidated"),payload:t.object({reason:t.string().min(1),next_preview_url:t.string().url().optional(),launch_id:t.string().min(1).optional()})}),ae.extend({type:t.literal("preview.build.started"),payload:t.object({snapshot_id:k})}),ae.extend({type:t.literal("preview.build.succeeded"),payload:t.object({snapshot_id:k})}),ae.extend({type:t.literal("preview.build.failed"),payload:t.object({snapshot_id:k,message:t.string().min(1),diagnostics:t.string().min(1),retryable:t.boolean()})}),ae.extend({type:t.literal("server.run.finished"),payload:t.object({run_id:K,snapshot_id:k,degraded_reason:Qt.optional(),build_verified:t.boolean().optional()})}),ae.extend({type:t.literal("server.run.failed"),payload:t.object({run_id:K,error_code:t.string().min(1),message:t.string().min(1),retryable:t.boolean(),outcome:t.literal("retained_previous").optional(),details:t.record(t.string(),t.unknown()).optional()})}),ae.extend({type:t.literal("server.error"),payload:t.object({code:t.string().min(1),message:t.string().min(1),retryable:t.boolean()})}),ae.extend({type:t.literal("server.activity.started"),payload:t.object({activity_id:t.string().min(1),parent_activity_id:t.string().min(1).optional(),kind:El,title:t.string().min(1).max(200),title_code:bt.optional(),detail:t.string().max(360).optional(),detail_code:bt.optional(),locks_input:t.boolean()})}),ae.extend({type:t.literal("server.activity.updated"),payload:t.object({activity_id:t.string().min(1),title:t.string().min(1).max(200).optional(),title_code:bt.optional(),detail:t.string().max(360).optional(),detail_code:bt.optional()})}),ae.extend({type:t.literal("server.activity.finished"),payload:t.object({activity_id:t.string().min(1)})}),ae.extend({type:t.literal("server.activity.failed"),payload:t.object({activity_id:t.string().min(1),detail:t.string().max(360).optional()})})]),zE=WE.superRefine((e,n)=>{if(e.type==="server.user.message"&&e.payload.interaction_response&&!e.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"}),e.type!=="server.tool.completed")return;let s=e.payload.name==="prepare_product_search_entry";s!==!!e.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"})}),QL=t.union([KE,zE]),ZL={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."]},zl=t.string().regex(/^sha256:[a-f0-9]{64}$/),BE=t.enum(["create","update","delete","str_replace"]),Bl=t.enum(["sitemap_resync","smoke_test","prepare_preview"]),HE=t.object({old_string:t.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:t.string().describe("Replacement text. May be empty to delete the matched text."),replace_all:t.boolean().optional()}).strict(),VE=t.object({path:Re,operation:BE,expected_hash:zl.optional(),full_content:t.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:t.array(HE).min(1).max(20).optional()}).strict().superRefine((e,n)=>{let s=e.full_content!==void 0;if(e.operation==="delete"){s&&n.addIssue({code:"custom",path:["full_content"],message:"delete patches must not include full_content"}),e.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"});return}if(aR(e.path)||n.addIssue({code:"custom",path:["path"],message:"Static App Router page paths must use lowercase ASCII kebab-case public segments."}),e.operation==="str_replace"){e.full_content!==void 0&&n.addIssue({code:"custom",path:["full_content"],message:"str_replace patches must not include full_content"}),(!e.edits||e.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"}),e.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"})}),$E=t.object({kind:t.enum(["block","page","site","chrome"]),id:t.string().min(1).max(120)}),YE=t.object({base_key:t.string().min(1).max(120).regex(/^[A-Za-z0-9._:-]+$/).refine(e=>!e.includes(".."),{message:"base_key must not contain '..'"}),owner:$E,count:t.number().int().min(1).max(12),query:t.string().min(1).max(400),role:t.enum(["hero","section","card","gallery","testimonial","decorative","site_background","nav_background","footer_background"]),orientation:t.enum(["landscape","portrait","square"]).optional(),altHint:t.string().min(1).max(300)}),Hl=t.object({site_id:T,base_snapshot_id:k,reason:t.string().min(1),patches:t.array(VE).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:t.array(YE).max(24).optional(),post_actions:t.array(Bl).optional()});function Vl(e,n){let s=new Set;for(let[a,i]of e.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 JL=Hl.superRefine(Vl),eM=Hl.omit({base_snapshot_id:!0}).extend({site_id:T.optional()}).superRefine(Vl),XE=Se,QE=t.object({path:XE,operation:t.enum(["upsert","delete"]).optional()}),$l=t.enum(["sync_cms_pages","sync_cms_navigation"]),tM=t.object({files:t.array(QE).min(1),post_actions:t.array($l).optional()}).strict().overwrite(e=>e.post_actions?{...e,post_actions:[...new Set(e.post_actions)]}:e),ZE=t.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"]),JE=t.object({status:t.literal("applied"),patch_batch_id:t.string().min(1),site_id:T,base_snapshot_id:k,snapshot_id:k,manifest_hash:zl,object_key:t.string().min(1),changed_files:t.array(Re).min(1),post_actions_queued:t.array(Bl),dropped_protected_files:t.array(t.string().min(1)).min(1).optional()}),eR=t.object({status:t.literal("failed"),code:ZE,message:t.string().min(1),retryable:t.boolean().default(!1),details:t.unknown().optional()}),nM=t.discriminatedUnion("status",[JE,eR]),sM=t.object({ok:t.literal(!0),post_actions:t.array(t.object({action:$l,status:t.enum(["succeeded","failed"])}).strict()).default([])}),Yl=Se,tR=t.enum(["text","binary"]),Xl=t.object({path:Yl,kind:tR,language:t.string().min(1).nullable(),size_bytes:t.number().int().nonnegative()}),iM=t.object({path:Yl}),nR=Xl.extend({kind:t.literal("text"),language:t.string().min(1),content:t.string()}),sR=Xl.extend({kind:t.literal("binary"),language:t.null(),mime_type:t.string().min(1),content_base64:t.string().min(1)}),aM=t.union([nR,sR]);function Nn(e){return typeof e=="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(e):!e||typeof e!="object"?!1:Array.isArray(e)?e.some(n=>Nn(n)):Object.entries(e).some(([n,s])=>iR(n)||Nn(s))}function iR(e){let n=e.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 Ql(e){let n=e.split("/");return e.length>0&&!e.startsWith("/")&&!e.includes("\\")&&n.every(s=>s!==""&&s!=="."&&s!=="..")}function aR(e){if(/^(?:src\/)?app\/\.vcp\//.test(e))return Un(e);let n=/^app\/(?:(.*)\/)?page\.(?:tsx|jsx)$/.exec(e);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)||ln.test(`/${r}`))}var Zl=t.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),oR=t.object({id:Ln,tenant_id:t.string().min(1),site_id:T,sandbox_id:t.string().min(1).nullable(),status:Zl,source_snapshot_id:k.nullable(),last_snapshot_id:k.nullable(),preview_url:t.string().url().nullable(),browser_preview_url:t.string().url().nullable().optional(),launch_id:t.string().min(1).nullable().optional(),last_activity_at:t.string().min(1).nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}),oM=t.object({session_id:Ln.optional(),sandbox_id:t.string().min(1).optional(),source_snapshot_id:k.optional(),last_snapshot_id:k,expected_current_snapshot_id:k.optional(),expected_ready_session_id:Ln.optional(),expected_ready_session_last_snapshot_id:k.optional(),status:Zl,preview_url:t.string().url().optional(),launch_id:t.string().min(1).optional()}),rM=t.object({preview_session:oR,next_step:t.literal("preview")}),cM=t.object({failed_count:t.number().int().nonnegative()}),mM=t.object({site_id:T}),lM=t.object({status:t.enum(["cancelled","stop_requested","no_active_run"]),agent_run:Be.nullable()});export{qc as AESTHETIC_NOTE_MAX_LENGTH,Qy as AI_IMAGE_GENERATION_ENTITLEMENT,Bt as AI_IMAGE_GENERATION_MAX_QUANTITY,tf as APPLICATION_LIBRARY_ERROR_CODES,xN as AbandonSiteSnapshotResponseSchema,xy as ActiveSiteDomainDataSchema,KL as ActiveWorkspaceRunResponseSchema,El as ActivityKindSchema,bt as ActivityTitleCodeSchema,x1 as AdvanceSiteWorkflowRequestSchema,_l as AgentErrorCategorySchema,Xa as AgentEventIdSchema,Ca as AgentEventRecordSchema,Kl as AgentEventSchema,ql as AgentEventTypeSchema,RE as AgentMessageHistoryPurposeSchema,Sl as AgentModelRouteSchema,IE as AgentPlanStepSchema,_N as AgentRunContextResponseSchema,K as AgentRunIdSchema,hl as AgentRunKindSchema,Be as AgentRunRecordSchema,Sx as AgentRunStatusSchema,gl as AgentRunTypeSchema,He as AgentThreadIdSchema,fx as AgentThreadKindSchema,bx as AgentThreadOriginSchema,Ks as AgentThreadRecordSchema,fl as AgentThreadStatusSchema,Zy as AiImageGenerationPrecheckRequestSchema,Jy as AiImageGenerationPrecheckResponseSchema,Pa as AiImageGenerationQuotaSchema,vE as AiSdkUiDataPartSchema,OE as AiSdkUiErrorPartSchema,PE as AiSdkUiFilePartSchema,Gs as AiSdkUiMessagePartSchema,qE as AiSdkUiMessageSchema,AE as AiSdkUiReasoningPartSchema,CE as AiSdkUiSourceDocumentPartSchema,wE as AiSdkUiSourceUrlPartSchema,jE as AiSdkUiStepStartPartSchema,kE as AiSdkUiTextPartSchema,DE as AiSdkUiToolPartSchema,jL as ApiContractStatusSchema,Ax as ApiErrorEnvelopeSchema,M as ApiResponseSchema,wL as AppendAgentEventRequestSchema,CL as AppendAgentEventResponseSchema,mv as ApplicationCreateResponseSchema,rf as ApplicationLibraryApplicationSchema,lv as ApplicationLibraryApplicationsDataSchema,Bc as ApplicationLibraryErrorCodeSchema,dv as ApplicationLibraryErrorResponseSchema,pv as ApplicationLibraryTemplatesDataSchema,Vc as ApplicationTemplateCatalogDataSchema,nf as ApplicationTemplateCatalogItemSchema,ef as ApplicationTemplateConsumeDataSchema,cv as ApplicationTemplateCreateRequestSchema,af as ApplicationTemplateCreateResponseSchema,sf as ApplicationTemplateCreatedApplicationSchema,Es as ApplicationTemplateDigestSchema,YS as ApplicationTemplateFieldSchema,JS as ApplicationTemplateReferenceSchema,of as ApplicationTemplateSourceSchema,Rs as ApplicationTemplateStableKeySchema,oa as ApplicationTemplateV1Schema,ZE as ApplyPatchBatchErrorCodeSchema,eR as ApplyPatchBatchFailureSchema,JL as ApplyPatchBatchInputSchema,VE as ApplyPatchBatchPatchSchema,Bl as ApplyPatchBatchPostActionSchema,nM as ApplyPatchBatchResultSchema,JE as ApplyPatchBatchSuccessSchema,eM as ApplyPatchBatchToolInputSchema,HE as ApplyPatchEditSchema,BE as ApplyPatchOperationSchema,ul as ArchetypeProposalSchema,xR as AuditLogIdSchema,mR as AuthIdentityIdSchema,uR as AuthLoginCodeIdSchema,dR as AuthOidcStateIdSchema,lR as AuthSessionIdSchema,pR as AuthTokenIdSchema,_R as AuthWsTicketIdSchema,rb as BINDING_STATUSES,Rl as BlockGenerationContextSchema,JN as BlockMediaIntentSchema,Ua as BlockSchema,zg as BlockingSubsiteSchema,Il as BrandingSchema,Dt as BriefIdSchema,Na as BriefRecordSchema,ro as BusinessFactsSchema,YP as CHAT_COPY,$P as CLARIFICATION_COPY,Of as CMS_FORM_FIELD_TYPES,yc as CMS_MAIN_PRODUCTS_MAX_LENGTH,Hd as CMS_PAGE_DIRECTORY_MAX_DEPTH,Bd as CMS_PAGE_DIRECTORY_MAX_NODES,Ho as CMS_PAGE_URL_PATH_MAX_LENGTH,S0 as COMPONENT_I18N_FILE_SUFFIX,ms as COMPONENT_I18N_NAMESPACE,rp as CONVERSION_CTA_LABEL_MAX_LENGTH,Tb as CRAWLER_INTERNAL_ERROR_CODES,gc as CURRENT_EDIT_ENGINE_VERSION,mM as CancelActiveWorkspaceRunRequestSchema,lM as CancelActiveWorkspaceRunResponseSchema,Um as CheckSitePublishDomainDataSchema,uy as CheckSitePublishDomainRequestSchema,_y as CheckSitePublishDomainResponseSchema,Tl as ChromeDesignSchema,Fx as ChromeFooterDesignSchema,qx as ChromeFooterShellSchema,Mx as ChromeHeaderDesignSchema,Lx as ChromeHeaderShellSchema,Gx as ChromeMobileNavDesignSchema,l0 as ClaimStaleWorkspaceRunsResponseSchema,gx as ClarifyQuestionOptionSchema,hx as ClarifyQuestionSchema,dx as ClarifyQuestionTypeSchema,Oa as ClarifyQuestionsSchema,Gj as ClarifyRunInputSchema,$a as ClarifySessionIdSchema,SE as ClarifySessionRecordSchema,Kj as ClarifyStreamEventSchema,bv as CmsApplicationCoreInputSchema,yv as CmsApplicationCoreResultSchema,xv as CmsApplicationSeedInputSchema,Ev as CmsApplicationSeedResultSchema,ER as CmsCollectionBindingIdSchema,gD as CmsCollectionBindingSchema,im as CmsFormSchemaProjectionSchema,_i as CmsManagedPageTypeSchema,Yd as CmsPageDirectoryGroupSchema,Vo as CmsPageDirectoryNodeSchema,zo as CmsPageDirectorySchema,gi as CmsPageTypeSchema,et as CmsPageUrlPathSchema,bo as CmsSiteIdSchema,Eb as CompanyInfoSchema,CD as CompanyInfoTaskCreateRequestSchema,vD as CompanyInfoTaskCreateResponseSchema,DD as CompanyInfoTaskResponseSchema,xC as CompleteCustomerMaterialsRequestSchema,EC as CompleteDiagnosisRequestSchema,RN as CompleteSiteSnapshotDeletionResponseSchema,E1 as CompleteSiteWorkflowRequestSchema,RC as CompleteStrategyRequestSchema,yC as CompleteWebsiteScanRequestSchema,b0 as ComponentI18nResourcesSchema,ek as ComposeDesignerPageResourceBodySchema,hy as ConfirmSitePublishDomainRemediationDataSchema,gy as ConfirmSitePublishDomainRemediationRequestSchema,Sy as ConfirmSitePublishDomainRemediationResponseSchema,SL as ConfirmSiteStructureRequestSchema,iv as ConnectDynamicCollectionInputSchema,kv as ConnectFormInputSchema,Rt as ConversionHintsSchema,kb as CrawlerInternalErrorCodeSchema,OD as CrawlerInternalErrorSchema,zt as CrawlerTaskCodeSchema,xD as CrawlerTaskCreateRequestSchema,ID as CrawlerTaskCreateResponseSchema,_b as CrawlerTaskFailureErrorCodeSchema,bm as CrawlerTaskFailureStageSchema,hb as CrawlerTaskPageSchema,ED as CrawlerTaskPagesQuerySchema,AD as CrawlerTaskPagesResponseSchema,kD as CrawlerTaskStatusResponseSchema,wt as CrawlerTaskUuidSchema,QN as CreateAgentRunConflictResponseSchema,gN as CreateAgentRunRequestSchema,hN as CreateAgentRunResponseSchema,KN as CreateDeploymentRequestSchema,Rx as CreateDeploymentResponseSchema,gI as CreateDocumentUploadRequestSchema,AR as CreateExternalSiteEditRequestSchema,PR as CreateExternalSiteEditResponseSchema,xI as CreateImageUploadRequestSchema,lI as CreateInputSourceRequestSchema,WN as CreateQualityCheckDeploymentRequestSchema,$j as CreateSiteBriefRequestSchema,lN as CreateSiteBriefResponseSchema,Yj as CreateSiteDraftRequestSchema,Vj as CreateSiteInputSchema,BL as CreateSiteThreadRequestSchema,b1 as CreateSiteWorkflowRequestSchema,Sp as CreateTextInputSourceRequestSchema,fp as CreateUrlInputSourceRequestSchema,BN as CurrentDeploymentResponseSchema,_C as CustomerMaterialsDraftResponseSchema,$i as CustomerMaterialsDraftSchema,gC as CustomerMaterialsNullableResponseSchema,Yi as CustomerMaterialsRecordSchema,uC as CustomerMaterialsResponseSchema,IS as CustomerMaterialsStatusSchema,TS as DEFAULT_FONTS,Dc as DEFAULT_SITE_DESIGN_RADIUS_ID,Wp as DEFAULT_SITE_LOCALE,ow as DEFAULT_SUBSITE_PALETTE,DA as DEPLOYMENT_ACTIVE_STATUSES,ut as DEPLOYMENT_LIFECYCLE_TRANSITIONS,J_ as DEPLOYMENT_PROGRESS_STEP_CODES,kx as DEPLOYMENT_REALTIME_CHANNEL,jt as DEPLOYMENT_STATUSES,OA as DEPLOYMENT_TERMINAL_STATUSES,Lg as DEPLOYMENT_TRANSITION_ERROR_CODE,XN as DEPLOYMENT_WEBSOCKET_CONTRACT,TT as DESIGNER_COMPONENT_LIBRARY_ERROR_CODES,YT as DESIGNER_PAGE_LIBRARY_ERROR_CODES,pI as DOCUMENT_EXTENSION_WHITELIST,dI as DOCUMENT_MIME_WHITELIST,Kb as DOMAIN_DNS_PURPOSES,Bb as DOMAIN_DNS_REMEDIATION_STATUSES,Wb as DOMAIN_DNS_VERIFICATION_STATUSES,Ub as DOMAIN_OBSERVED_STATUSES,Fb as DOMAIN_ROUTING_MODES,FT as DeleteDesignerPageErrorDetailsSchema,LT as DeleteDesignerPageRequestSchema,MT as DeleteDesignerPageResponseSchema,su as DeleteDesignerPageResultSchema,EN as DeleteSiteSnapshotResponseSchema,Je as DeploymentIdSchema,gR as DeploymentJobIdSchema,eg as DeploymentProgressStepCodeSchema,ng as DeploymentProgressStepSchema,tg as DeploymentProgressStepStatusSchema,$r as DeploymentProgressStepsSchema,ft as DeploymentRecordSchema,YN as DeploymentRedisPubSubEventSchema,La as DeploymentStatusSchema,ml as DeploymentStatusSummarySchema,Fi as DeploymentTransitionError,yl as DeploymentTypeSchema,qs as DeploymentWsDeploymentPayloadSchema,$N as DeploymentWsServerMessageSchema,Tx as DeploymentWsServerMessageTypeSchema,xE as DesignPlanGenerationOutcomeSchema,EE as DesignPlanGenerationReasonSchema,Bs as DesignPlanIdSchema,nL as DesignPlanPatchSchema,fE as DesignPlanRecordSchema,kl as DesignPlanSchema,ZN as DesignTokensSchema,zd as DesignerComponentCatalogItemSchema,qo as DesignerComponentCategoriesDataSchema,Uo as DesignerComponentCategoryNodeSchema,kt as DesignerComponentExactVersionSchema,Go as DesignerComponentInstallDataSchema,Fo as DesignerComponentsDataSchema,mu as DesignerPageCatalogItemSchema,tr as DesignerPageCategoriesDataSchema,er as DesignerPageCategoryNodeSchema,eu as DesignerPageDeleteBlockReasonSchema,Jd as DesignerPageDisabledReasonSchema,mn as DesignerPageExactVersionSchema,Qo as DesignerPageGroupSchema,sr as DesignerPageInstallDataSchema,Xo as DesignerPageNodeSchema,ar as DesignerPageResourcePreparationDataSchema,cu as DesignerPageResourceSourceSchema,hu as DesignerPageResourceTemplateSchema,At as DesignerPageResourceTypeSchema,nr as DesignerPagesDataSchema,li as DesignerResourceVersionSchema,or as DesignerSitePagesDataSchema,QT as DesignerSiteRouteIdSchema,Om as DomainConfigurationSchema,ba as DomainDnsPurposeSchema,Qb as DomainDnsRecordSchema,Xb as DomainDnsRemediationChangeSchema,Cm as DomainDnsRemediationRecordSchema,vm as DomainDnsRemediationResultSchema,Hb as DomainDnsRemediationStatusSchema,Yb as DomainDnsVerificationObservationSchema,wm as DomainDnsVerificationResultSchema,zb as DomainDnsVerificationStatusSchema,qb as DomainObservedStatusSchema,$b as DomainOperationErrorSchema,js as DomainOperationSchema,Vb as DomainOperationStatusSchema,ya as DomainOperationTypeSchema,Dm as DomainRecordSchema,Gb as DomainRoutingModeSchema,QP as EDIT_ENGINE_VERSION_HEADER,ZP as EDIT_ENGINE_VERSION_SOURCE_HEADER,BP as ERROR_COPY,np as EXTERNAL_SITE_EDIT_INFRASTRUCTURE_REASONS,tp as EXTERNAL_SITE_EDIT_PROMPT_MAX_LENGTH,Vi as EditEngineVersionParseError,rr as EnhanceDesignerPageResourceBodySchema,cN as EnhanceDesignerPageResourceResponseSchema,vR as ExternalSiteEditCallbackAckSchema,CR as ExternalSiteEditCallbackPayloadSchema,sp as ExternalSiteEditCallbackStatusSchema,Qt as ExternalSiteEditDegradedReasonSchema,Et as ExternalSiteEditExternalIdSchema,eo as ExternalSiteEditOutcomeSchema,Ja as ExternalSiteEditTaskIdSchema,Mn as ExternalSiteEditTaskSchema,ip as ExternalSiteEditTaskStatusSchema,Jj as ExternalSyncSiteRequestSchema,mN as ExternalSyncSiteResponseSchema,_p as ExtractedFactKindSchema,Fn as ExtractedFactSchema,aa as FIELD_TYPES,n0 as FILL_IN_NOT_AVAILABLE_ERROR_CODE,i0 as FILL_IN_TARGET_MODIFIED_ERROR_CODE,s0 as FILL_IN_TARGET_NOT_OMITTED_ERROR_CODE,wc as FONT_PAIRINGS,Qi as FONT_PAIRING_IDS,Bf as FORM_DESIGN_ERROR_CODES,zf as FORM_DESIGN_FAILURE_STAGES,Kf as FORM_DESIGN_OPERATION_STAGES,Wf as FORM_DESIGN_OPERATION_STATUSES,Ts as FORM_FIELD_TYPES,jf as FORM_SPEC_FIELD_TYPE_TO_CMS,Zc as FORM_SPEC_FILE_MIN_RUNTIME_VERSION,Tf as FORM_SPEC_LOCALIZABLE_FIELD_PATHS,Qc as FORM_SPEC_MULTISTEP_MIN_RUNTIME_VERSION,Mv as FORM_TEMPLATE_CATEGORY_COUNTS,Lv as FORM_TEMPLATE_CATEGORY_SLUGS,cM as FailStaleInFlightWorkspaceRunsResponseSchema,xs as FieldDeclSchema,sc as FillInTargetSchema,WD as FirecrawlBatchCreateRequestSchema,zD as FirecrawlBatchCreatedResponseSchema,wb as FirecrawlBatchErrorSchema,HD as FirecrawlBatchErrorsResponseSchema,Pb as FirecrawlBatchPageSchema,BD as FirecrawlBatchStatusResponseSchema,UD as FirecrawlCrawlCreateRequestSchema,qD as FirecrawlCrawlCreatedResponseSchema,FD as FirecrawlCrawlStatusResponseSchema,Im as FirecrawlJobStatusSchema,LD as FirecrawlMapRequestSchema,MD as FirecrawlMapResponseSchema,VD as FirecrawlQueueStatusResponseSchema,GD as FirecrawlScrapeRequestSchema,KD as FirecrawlScrapeResponseSchema,Ux as FooterShellSurfaceSchema,gf as FormBlockIdSchema,As as FormDefinitionIdSchema,qf as FormDesignAffectedFilesSchema,ha as FormDesignErrorCodeSchema,$v as FormDesignErrorSchema,rm as FormDesignFailureStageSchema,oe as FormDesignHashSchema,Gv as FormDesignOpenResponseSchema,Ff as FormDesignOperationFingerprintInputSchema,la as FormDesignOperationIdSchema,cm as FormDesignOperationNextActionSchema,SR as FormDesignOperationRecordIdSchema,Hv as FormDesignOperationRecordSchema,Sa as FormDesignOperationResponseSchema,lm as FormDesignOperationSchema,ga as FormDesignOperationStageSchema,om as FormDesignOperationStatusSchema,Vv as FormDesignOperationTransitionRequestSchema,mm as FormDesignPreviewRefreshStatusSchema,Wv as FormDesignQueryResponseSchema,zv as FormDesignResumeRequestSchema,Bv as FormDesignResumeResponseSchema,Gf as FormDesignSaveRequestSchema,Kv as FormDesignSaveResponseSchema,am as FormDesignSharedImpactSchema,_a as FormDesignStandardizationSchema,uf as FormFieldDeclSchema,Cn as FormFieldNameSchema,pa as FormOptionValueSchema,hf as FormSpecBindingSchema,ff as FormSpecFieldNodeSchema,yf as FormSpecNodeSchema,Sf as FormSpecOptionSchema,bf as FormSpecStepBreakNodeSchema,ua as FormSpecV1Schema,Uv as FormTemplateCatalogResponseSchema,sm as FormTemplateCategorySlugSchema,vf as FormTemplateCategoryV1Schema,ht as FormTemplateTextSchema,Df as FormTemplateV1Schema,Ey as GSC_AUTH_STATUSES,Ry as GSC_BINDING_STATUSES,Iy as GSC_PROPERTY_TYPES,ex as GenerateAiImagesRequestSchema,tx as GenerateAiImagesResponseSchema,al as GeneratedAiImageResultSchema,wO as GetActiveSiteDomainResponseSchema,HN as GetDeploymentResponseSchema,Ix as GetDeploymentsStatusResponseSchema,wR as GetExternalSiteEditResponseSchema,PO as GetSiteDomainConfigurationResponseSchema,xa as GetSitePublishDomainOperationDataSchema,fy as GetSitePublishDomainOperationResponseSchema,Mw as GetTemplateUpgradeReportQuerySchema,Uw as GetTemplateUpgradeReportResponseSchema,XO as GoogleSearchConsoleAuthStartDataSchema,YO as GoogleSearchConsoleAuthStartRequestSchema,QO as GoogleSearchConsoleAuthStartResponseSchema,BO as GoogleSearchConsoleAuthStatusSchema,HO as GoogleSearchConsoleBindingStatusSchema,VO as GoogleSearchConsolePropertyTypeSchema,$O as GoogleSearchConsoleStateSchema,JO as GoogleSearchConsoleStatusDataSchema,ZO as GoogleSearchConsoleStatusInputSchema,ej as GoogleSearchConsoleStatusResponseSchema,KO as GscAuthStartDataSchema,GO as GscAuthStartRequestSchema,WO as GscAuthStartResponseSchema,Ea as GscAuthStatusSchema,Ra as GscBindingStatusSchema,Ia as GscPropertyTypeSchema,ky as GscStateInputSchema,zO as GscStateSchema,Gm as GscStatusDataSchema,Ay as GscStatusResponseSchema,Bo as HOME_PAGE_URL_PATH,jx as HeaderShellBehaviorSchema,Nx as HeaderShellShapeSchema,Ox as HeaderShellSurfaceSchema,Dx as HeaderShellVariantSchema,cb as HomeUrlCrawlerTaskCreateRequestSchema,Ti as HttpUrlSchema,SI as IMAGE_EXTENSION_WHITELIST,fI as IMAGE_MIME_WHITELIST,Mo as INSERT_NEW_COMPONENT_CATEGORY_GROUP_KEY,Jo as INSERT_NEW_PAGE_CATEGORY_GROUP_KEY,BA as INTERNAL_RUN_LEASE_OWNER_HEADER,zp as ISO_639_3_TO_SITE_LOCALE,bp as ImageRoleSchema,Wl as InboundUserMessageSchema,JC as IndustryClassificationRequestSchema,ev as IndustryClassificationResultSchema,BS as IndustryConfidenceSchema,Hc as InitializationResultSchema,up as InputBundleStatusSchema,Kn as InputConflictSchema,EI as InputContextBundleSchema,xt as InputContextSourceIdSchema,hp as InputSourceSchema,Ys as InputSourceStatusSchema,$s as InputSourceTypeSchema,Tw as InspectTemplateUpgradeStateRequestSchema,kw as InspectTemplateUpgradeStateResponseSchema,wT as InstallDesignerComponentBodySchema,nN as InstallDesignerComponentResponseSchema,ZT as InstallDesignerPageBodySchema,aN as InstallDesignerPageResponseSchema,zN as InternalCreateDeploymentResponseSchema,UN as InternalEnsureSubsitePublishRequestSchema,qN as InternalEnsureSubsitePublishResponseSchema,V as InternalEntityIdSchema,VN as InternalGetDeploymentsStatusResponseSchema,FN as InternalGetSubsitePublishStatusRequestSchema,GN as InternalGetSubsitePublishStatusResponseSchema,LN as InternalPrepareSubsitePreviewRequestSchema,MN as InternalPrepareSubsitePreviewResponseSchema,xS as KNOWLEDGE_CATEGORY_CODES,xc as KnowledgeCategoryCodeSchema,rC as KnowledgeContextReadinessSchema,RS as KnowledgeSourceReadinessSchema,Ec as KnowledgeSourceReadinessStatusSchema,aC as KnowledgeTaskStatusBatchSchema,ES as KnowledgeTaskStatusSchema,Up as LEGACY_SITE_LOCALE_CODES,$L as LatestAgentRunQuerySchema,YL as LatestAgentRunResponseSchema,GL as LatestWorkspaceRunQuerySchema,FL as LatestWorkspaceRunResponseSchema,eO as LauncherPromptTemplateApplyRequestSchema,tO as LauncherPromptTemplateApplyResponseSchema,Ob as LauncherPromptTemplateCatalogItemSchema,ZD as LauncherPromptTemplateCatalogQuerySchema,JD as LauncherPromptTemplateCatalogSchema,vb as LauncherPromptTemplateKindSchema,Db as LauncherPromptTemplateLocaleSchema,Os as LauncherPromptTemplateTypeSchema,DL as ListAgentEventsQuerySchema,vL as ListAgentEventsResponseSchema,eN as ListDesignerComponentCategoriesResponseSchema,PT as ListDesignerComponentsQuerySchema,tN as ListDesignerComponentsResponseSchema,sN as ListDesignerPageCategoriesResponseSchema,XT as ListDesignerPagesQuerySchema,iN as ListDesignerPagesResponseSchema,rN as ListDesignerSitePagesResponseSchema,$y as ListMediaLibraryAssetsQuerySchema,Yy as ListMediaLibraryAssetsResponseSchema,OL as ListSiteAgentEventsQuerySchema,ON as ListSiteVersionsResponseSchema,qw as ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema,Fw as ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema,c0 as ListWorkspacePageCheckpointsResponseSchema,_I as MAX_DOCUMENT_SOURCES_PER_SITE,uI as MAX_DOCUMENT_UPLOAD_BYTES,yI as MAX_IMAGE_SOURCES_PER_SITE,bI as MAX_IMAGE_UPLOAD_BYTES,Gy as MAX_NAV_LABEL_WIDTH,F1 as MAX_UNBOUND_WORKSPACE_ATTACHMENTS_PER_SITE,Di as MAX_WORKSPACE_ATTACHMENTS_PER_MESSAGE,V1 as MAX_WORKSPACE_URL_CAPTURES_PER_SITE_HOUR,Qm as MEDIA_LIBRARY_AUDIO_EXTENSIONS,nl as MEDIA_LIBRARY_AUDIO_MIME_TYPES,Zm as MEDIA_LIBRARY_DOCUMENT_EXTENSIONS,Hy as MEDIA_LIBRARY_EXTENSIONS,Jm as MEDIA_LIBRARY_FILE_EXTENSIONS,Ym as MEDIA_LIBRARY_IMAGE_EXTENSIONS,By as MEDIA_LIBRARY_IMAGE_MAX_BYTES,el as MEDIA_LIBRARY_IMAGE_MIME_TYPES,$m as MEDIA_LIBRARY_MAX_BYTES,Vy as MEDIA_LIBRARY_MIME_TYPES,Xm as MEDIA_LIBRARY_VIDEO_EXTENSIONS,tl as MEDIA_LIBRARY_VIDEO_MIME_TYPES,E0 as MIGRATION_PRODUCTS_CMS_DETAIL_PAGE_TITLE,x0 as MIGRATION_PRODUCTS_DETAIL_PREFIX,T0 as MIGRATION_PRODUCTS_DETAIL_VIEW_VARIANT,I0 as MIGRATION_PRODUCTS_LIST_VIEW_VARIANT,Gg as MIGRATION_PRODUCTS_ROUTE,at as MIGRATION_PRODUCTS_SLUG,R0 as MIGRATION_PRODUCTS_VIEW_BLOCK_TYPE,df as MODEL_DECLARABLE_FORM_FIELD_TYPES,NS as MOTION_PRESETS,Ji as MOTION_PRESET_IDS,tL as MediaAssetSchema,Cx as MediaAttributionSchema,Aa as MediaLibraryAssetSchema,sl as MediaLibraryFileTypeSchema,il as MediaLibrarySourceSchema,$E as MediaRequestOwnerSchema,yR as MediaResolutionCacheIdSchema,AT as MockDesignerComponentInsertDataSchema,kT as MockDesignerComponentInsertRequestSchema,Da as MotionLevelSchema,Jf as NAV_ITEMS_LOCALIZABLE_FIELD_PATHS,eb as NAV_ITEMS_MACHINE_FIELD_PATHS,wS as NEXT_FONT_DISPLAY_NAMES,En as NEXT_FONT_REGISTRY,Bp as NON_LATIN_SITE_LOCALE_CODES,iD as NavItemSchema,Yf as PAGE_SEO_LOCALIZABLE_FIELD_PATHS,Xf as PAGE_SEO_MACHINE_FIELD_PATHS,ln as PAGE_SLUG_PATTERN,Lt as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,no as PAGE_TEMPLATE_BATCH_MAX_ITEMS,lD as PLATFORM_MATERIALIZED_EXEMPTIONS,ib as PLATFORM_MATERIALIZED_FILES,ab as PLATFORM_MATERIALIZED_FILE_PATTERNS,mD as PLATFORM_MATERIALIZERS,cr as PLATFORM_OWNED_PAGE_SLUGS,Su as PLATFORM_OWNED_ROUTE_FILE_PATHS,nu as PageDirectoryReconcileFailedPageSchema,hi as PageDirectoryReconcileResultSchema,KT as PageDirectoryReconcileStateSchema,tu as PageDirectoryReconcileStatusSchema,db as PageDiscoveryCoverageEntrySchema,TD as PageDiscoveryCoverageReasonSchema,ym as PageDiscoveryCoverageSchema,Al as PageNavigationSchema,fi as PageResourceArtifactSchema,uu as PageResourceComponentReferenceSchema,_u as PageResourceComponentSchema,pu as PageResourceDraftPageSchema,du as PageResourceDraftSchema,ts as PageResourceFinalRouteSchema,gu as PageResourcePageSchema,lu as PageResourcePageSelectionSchema,ir as PageResourceRouteMappingSchema,Fa as PageSchema,nD as PageSeoDeclSchema,qa as PageSlugSchema,au as PageTargetKindSchema,di as PageTargetProjectionHashSchema,Zo as PageTargetSchema,ou as PageTargetSeoSchema,GT as PageTargetSetSchema,io as PageTemplateBatchManifestSchema,UR as PageTemplateCleanupRequestSchema,GR as PageTemplateCleanupResponseSchema,to as PageTemplateCreateItemSchema,LR as PageTemplateCreateRequestSchema,qR as PageTemplateCreateResponseSchema,KR as PageTemplateErrorCodeSchema,Ge as PageTemplateIdSchema,Zt as PageTemplatePagePathSchema,MR as PageTemplatePromoteRequestSchema,FR as PageTemplatePromoteResponseSchema,ap as PageTemplateTaskSchema,EL as PersistClarifyAnswersRequestSchema,RL as PersistClarifyAnswersResponseSchema,fL as PersistGeneratedSitemapDraftRequestSchema,xL as PersistGeneratedSitemapDraftResponseSchema,oM as PersistPreviewSessionRequestSchema,rM as PersistPreviewSessionResponseSchema,TL as PersistSiteDesignPlanRequestSchema,kL as PersistSiteDesignPlanResponseSchema,yL as PersistSiteSitemapDraftResponseSchema,hL as PersistSiteSitemapRequestSchema,bL as PersistSiteSitemapResponseSchema,SN as PersistSiteSnapshotRequestSchema,fN as PersistSiteSnapshotResponseSchema,px as PositioningPrefillSchema,wa as PositioningSourceSchema,JT as PrepareDesignerPageBodySchema,oN as PrepareDesignerPageResponseSchema,Qw as PrepareSiteBuildInitialGenerationBaseRequestSchema,Zw as PrepareSiteBuildInitialGenerationBaseResultSchema,Iw as PrepareTemplateUpgradeStateRequestSchema,iS as PrepareTemplateUpgradeStateResponseSchema,NN as PrepareVersionPreviewRequestSchema,Ex as PrepareVersionPreviewResponseSchema,Hr as ProductSearchAppConfigDraftSchema,Ci as ProductSearchAppSlugSchema,M1 as ProductSearchContractFixtureSchema,z_ as ProductSearchDraftConfigSchema,De as ProductSearchFieldNameSchema,K_ as ProductSearchFilterMetaSchema,vi as ProductSearchInteractionRequestSchema,os as ProductSearchInteractionResponseSchema,L1 as ProductSearchPopularTermsReadSchema,Br as ProductSearchPopularTermsSchema,$_ as ProductSearchRequestSchema,X_ as ProductSearchResponseSchema,hn as ProductSearchRouteIdSchema,G_ as ProductSearchValueShapeSchema,yN as PromoteSiteSnapshotRequestSchema,yx as PromoteSiteSnapshotResponseSchema,vN as PromoteTemplateUpgradeSnapshotRequestSchema,DN as PromoteTemplateUpgradeSnapshotResponseSchema,Lm as QualityRunningStatusSchema,VP as REFUSAL_COPY,LL as REST_API_ENDPOINTS,Qf as ROOT_LAYOUT_METADATA_LOCALIZABLE_FIELD_PATHS,Zf as ROOT_LAYOUT_METADATA_MACHINE_FIELD_PATHS,by as ReconcileSitePublishDomainOperationDataSchema,yy as ReconcileSitePublishDomainOperationResponseSchema,IN as RecordSnapshotVersionRequestSchema,TN as RecordSnapshotVersionResponseSchema,Nw as RecordTemplateUpgradeEventRequestSchema,Lw as RecordTemplateUpgradeEventResponseSchema,Aw as RecordTemplateUpgradeFailureRequestSchema,Pw as RecordTemplateUpgradeFailureResponseSchema,ww as RecordTemplateUpgradeSuccessRequestSchema,Cw as RecordTemplateUpgradeSuccessResponseSchema,UT as RecoverDesignerPageProjectionRequestSchema,qT as RecoverDesignerPageProjectionResponseSchema,iu as RecoverDesignerPageProjectionResultSchema,gp as ReferencePagePatternSchema,Gn as ReferenceSignalsSchema,ox as RegisterMediaResourceReferenceRequestSchema,rx as RegisterMediaResourceReferenceResponseSchema,R1 as RegisterWorkflowTaskCommandRequestSchema,j_ as RegisterWorkflowTaskRequestSchema,r0 as RegisterWorkspacePageCheckpointRequestSchema,PN as ReleaseTemplateUpgradeLockRequestSchema,wN as ReleaseTemplateUpgradeLockResponseSchema,k1 as ReplaceCrawlWorkflowTaskCommandRequestSchema,L_ as ReplaceCrawlWorkflowTaskRequestSchema,T1 as ReplaceWorkflowTaskCommandRequestSchema,N_ as ReplaceWorkflowTaskRequestSchema,sv as ResolvedFieldSchema,Av as ResolvedFormFieldSchema,NL as RestApiMethodSchema,jN as RestoreSiteSnapshotResponseSchema,sD as RootLayoutMetadataSchema,xl as RouteGenerationCardSchema,wg as RuleEngineInputSchema,Og as RuleEngineScoreRecordSchema,qi as RuleScoreDimensionKeySchema,Dg as RuleScoreDimensionSchema,nn as SELECTABLE_SITE_LOCALE_CODES,wl as SITEMAP_RESOLVER_MAX_BLOCK_TARGETS,Pl as SITEMAP_RESOLVER_MAX_PAGE_TARGETS,Yw as SITE_BUILD_CONTEXT_FILE_PATH,Xw as SITE_BUILD_CONTEXT_MAX_BYTES,E_ as SITE_BUILD_STATUSES,Ur as SITE_BUILD_STATUS_CODES,R_ as SITE_DEPLOYMENT_STATUSES,qr as SITE_DEPLOYMENT_STATUS_CODES,Zi as SITE_DESIGN_DENSITY_IDS,vc as SITE_DESIGN_RADIUS_IDS,Y0 as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,Md as SITE_EDIT_MATERIALIZATION_MAX_FILE_CONTENT_BYTES,ci as SITE_EDIT_MATERIALIZATION_MAX_FILE_COUNT,mi as SITE_EDIT_MATERIALIZATION_MAX_TOTAL_CONTENT_BYTES,Rr as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,Nk as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,Ah as SITE_EDIT_RUNTIME_CONTAINER_TAGS,Ph as SITE_EDIT_RUNTIME_TEXT_TAGS,kh as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,kk as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,xp as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,lo as SITE_EDIT_SOURCE_ALLOWED_DIRS,yp as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,Qs as SITE_EDIT_SOURCE_DELETE_CAPABILITY,Ep as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,Ot as SITE_EXTRA_REQUIREMENT_MAX_LENGTH,D0 as SITE_HAS_ACTIVE_SUBSITES_ERROR_CODE,O0 as SITE_HAS_SUBSITES_ERROR_CODE,qp as SITE_LOCALE_CODES,tD as SITE_LOCALIZATION_STRUCTURES,Wj as SITE_PLANNING_FROZEN_ERROR_CODE,zj as SITE_PLANNING_LOCKED_ERROR_CODE,Bj as SITE_STRUCTURE_CONFIRMATION_REQUIRED_ERROR_CODE,Hj as SITE_STRUCTURE_CONFIRMATION_STALE_ERROR_CODE,cl as SITE_STRUCTURE_INVALID_ERROR_CODE,I_ as SITE_WORKFLOW_STATUSES,Fr as SITE_WORKFLOW_STATUS_CODES,ML as SSE_STREAMS,hd as STEP5_GEO_QUESTION_TYPES,$p as STEP5_KEYWORD_CATEGORIES,Xp as STEP5_OPTIONAL_STRATEGY_KEYS,wo as STEP5_PRIMARY_INTENT_PAGE_LIMIT,Yn as STEP5_REQUIRED_STRATEGY_COUNT,on as STEP5_REQUIRED_STRATEGY_KEYS,Ao as STEP5_SEMRUSH_MIN_RELEVANCE_SCORE,nd as STEP5_SEMRUSH_SEARCH_INTENTS,sd as STEP5_SEO_ALLOWED_INTENT_CODES,nT as STEP5_SEO_ALLOWED_SEARCH_INTENTS,rT as STEP5_SEO_KEYWORD_DEFAULT,yd as STEP5_SEO_KEYWORD_MAX,bd as STEP5_SEO_KEYWORD_MIN,$n as STEP5_SEO_MAX_KEYWORD_DIFFICULTY,xo as STEP5_SEO_MIN_FIT,Vn as STEP5_SEO_MIN_SEARCH_VOLUME,fd as STEP5_SEO_PAYLOAD_SCHEMA_VERSION,Od as STEP5_SSE_EVENT_NAMES,ve as STEP5_STRATEGY_COUNT,It as STEP5_STRATEGY_KEYS,Ro as STEP5_STRATEGY_OPTION_IDS,Nc as STEP6_AI_THEME_IDS,ea as STEP6_AI_THEME_PRESETS,Lc as STEP6_GENERATED_THEME_ID_PATTERN,Gh as SUBSITE_GLOSSARY_ENTRY_MAX_CHARS,Kh as SUBSITE_GLOSSARY_MAX_ENTRIES,Zh as SUBSITE_MOUNT_PATH_PATTERN,Vh as SUBSITE_PALETTE_NOTE_MAX_CHARS,Jh as SUBSITE_RESERVED_MOUNT_SEGMENTS,KI as SUPPORTED_SITE_LOCALES,Ln as SandboxSessionIdSchema,oR as SandboxSessionSchema,Zl as SandboxSessionStatusSchema,Zj as SaveBriefDraftRequestSchema,dN as SaveBriefDraftResponseSchema,QR as SaveSiteExtraRequirementRequestSchema,nx as SearchUnsplashMediaQuerySchema,sx as SearchUnsplashMediaResponseSchema,fS as SiteBuildContextFileSchema,SS as SiteBuildContextPayloadSchema,hS as SiteBuildContextProvenanceSchema,gS as SiteBuildContextProvenanceSourceSchema,ki as SiteBuildStatusSchema,j0 as SiteDeletionBlockedDetailsSchema,Ai as SiteDeploymentStatusSchema,Us as SiteDesignContextSchema,ux as SiteDesignDensitySchema,_x as SiteDesignMotionLevelSchema,ds as SiteEditBoundaryKindSchema,Vg as SiteEditCapabilityConstraintSchema,Bg as SiteEditCapabilityModeSchema,ps as SiteEditCapabilityModeViewSchema,U0 as SiteEditCapabilityReadRequestSchema,Eu as SiteEditClassNameSourceDiagnosticSchema,tt as SiteEditClassNameSourceRangeSchema,_r as SiteEditClassNameSourceSchema,lk as SiteEditClassNameSourceStyleContextSchema,ur as SiteEditClassNameSourceStylesheetSchema,yi as SiteEditClassNameSourceWriteIntentSchema,ak as SiteEditCommandDiagnosticSchema,yu as SiteEditCommandErrorSchema,q as SiteEditCompositionContextSchema,ce as SiteEditCompositionSelectorSchema,Hg as SiteEditConstraintKindSchema,l_ as SiteEditDeletePageSourceOutputSchema,fh as SiteEditDynamicConfidenceSchema,yh as SiteEditDynamicDataBindingSchema,lc as SiteEditDynamicDataDetailSchema,pc as SiteEditDynamicDataSummarySchema,bh as SiteEditDynamicEvidenceSchema,mc as SiteEditDynamicSourceKindSchema,hh as SiteEditDynamicSourceTypeSchema,Sh as SiteEditDynamicTargetKindSchema,Gi as SiteEditEffectiveWriteTargetSchema,B0 as SiteEditEventSchema,Hs as SiteEditExecutionSceneSchema,gs as SiteEditExternalSourceKindSchema,_k as SiteEditGetClassNameSourceCommandResultSchema,dk as SiteEditGetClassNameSourceInputSchema,uk as SiteEditGetClassNameSourceResultSchema,AP as SiteEditGetDocumentInputSchema,PP as SiteEditGetObjectEditContextInputSchema,NI as SiteEditGetSourceFileInputSchema,jI as SiteEditGetSourceTreeInputSchema,pk as SiteEditGetStyleContextInputSchema,_s as SiteEditHistoryProvenanceSchema,Zg as SiteEditHistoryReadOnlyRecoveryStatusSchema,$g as SiteEditHistoryRecoveryCodeSchema,Yg as SiteEditHistoryRecoveryDiagnosticSchema,Q0 as SiteEditHistoryResultSchema,X0 as SiteEditHistoryStatusModeSchema,eh as SiteEditHistoryStatusSchema,Xg as SiteEditHistoryUnavailableReasonSchema,Jg as SiteEditHistoryUnavailableStatusSchema,Qg as SiteEditHistoryWritableStatusSchema,WP as SiteEditInitializeSessionInputSchema,r_ as SiteEditInsertNodeSpecSchema,m_ as SiteEditInsertPageResourceOutputSchema,Wd as SiteEditMaterializationDataRequirementsSchema,Kd as SiteEditMaterializationEntrySchema,Gd as SiteEditMaterializationExportSchema,Fd as SiteEditMaterializationFileSchema,Lo as SiteEditMaterializationPathTemplateSchema,Tt as SiteEditMaterializationSchema,Cr as SiteEditMaterializedComponentNodeSpecSchema,kr as SiteEditMoveTargetSchema,pn as SiteEditMutationContextSchema,us as SiteEditNodeCapabilitySnapshotSchema,CP as SiteEditObjectCapabilitiesSchema,DP as SiteEditObjectDetailSchema,jP as SiteEditObjectEditContextSchema,NP as SiteEditObjectStyleDetailSchema,OP as SiteEditObjectSummarySchema,Qk as SiteEditOperationCommandResultSchema,vr as SiteEditOperationErrorCodeSchema,Dr as SiteEditOperationErrorSchema,p_ as SiteEditOperationOutputSchema,c_ as SiteEditOperationParamsSchema,Ii as SiteEditOperationPayloadSchema,Ri as SiteEditOperationRequestSchema,o_ as SiteEditOperationResultTargetSchema,Ut as SiteEditOperationSelectionRefSchema,gh as SiteEditOperationSummarySchema,a_ as SiteEditOperationTargetSchema,_n as SiteEditOperationTypeSchema,Pt as SiteEditOperationValueSchema,Lk as SiteEditPageCompositionAnyVersionSchema,Wu as SiteEditPageCompositionAtomicKindSchema,Vu as SiteEditPageCompositionBoundaryModeSchema,Nu as SiteEditPageCompositionBusinessMemberSchema,Ou as SiteEditPageCompositionContainerSchema,un as SiteEditPageCompositionDiagnosticSchema,ss as SiteEditPageCompositionErrorCodeSchema,yr as SiteEditPageCompositionPlacementTargetSchema,Lu as SiteEditPageCompositionPlacementUnitSchema,Gu as SiteEditPageCompositionRuntimeRefSchema,Fu as SiteEditPageCompositionSchema,Ku as SiteEditPageCompositionSourceMemberKindSchema,ju as SiteEditPageCompositionSourceMemberSchema,Ir as SiteEditPageCompositionSourceRangeSchema,Uu as SiteEditPageCompositionSupportedSchema,qu as SiteEditPageCompositionUnsupportedSchema,Hu as SiteEditPageCompositionV2BusinessMemberSchema,zu as SiteEditPageCompositionV2ContainerSchema,Yu as SiteEditPageCompositionV2PlacementRelationSchema,Qu as SiteEditPageCompositionV2PlacementSchema,$u as SiteEditPageCompositionV2PlacementUnitSchema,t_ as SiteEditPageCompositionV2Schema,Bu as SiteEditPageCompositionV2SourceMemberSchema,Ju as SiteEditPageCompositionV2SupportedSchema,e_ as SiteEditPageCompositionV2UnsupportedSchema,Xu as SiteEditPageCompositionV2WriteModeSchema,Zu as SiteEditPageCompositionVisualAnchorSchema,Mu as SiteEditPagePlacementOptionSchema,br as SiteEditPagePlacementSchema,Er as SiteEditPageUnitResultTargetSchema,xr as SiteEditPageUnitTargetSchema,ch as SiteEditPatchPlanPatchSchema,rP as SiteEditPatchPlanSchema,Ki as SiteEditPropertiesSchema,wu as SiteEditPropertyChangeSchema,ah as SiteEditPropertyCreationSchema,sh as SiteEditPropertyItemSchema,th as SiteEditPropertyResolutionSchema,nh as SiteEditPropertySourceSchema,ih as SiteEditPropertySpreadSchema,yn as SiteEditProvenanceChainSchema,Rh as SiteEditProvenanceHopSchema,wP as SiteEditRenderDocumentSchema,bn as SiteEditRenderEntryRefSchema,xh as SiteEditRenderEntrySchema,cc as SiteEditRenderPageCompositionSchema,uh as SiteEditRenderPageCompositionSupportedSchema,_h as SiteEditRenderPageCompositionUnsupportedSchema,dh as SiteEditRenderPagePlacementSchema,Ak as SiteEditRequiredMutationContextEnvelopeSchema,MI as SiteEditResolveSourceLocationInputSchema,uc as SiteEditSemanticSourceSchema,hr as SiteEditSetPropsParamsSchema,Xk as SiteEditSignedOperationRequestSchema,po as SiteEditSourceDeleteCapabilitySchema,Ip as SiteEditSourceDirectoryPathSchema,wp as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,Cp as SiteEditSourceFileBinaryResponseSchema,DI as SiteEditSourceFileKindSchema,Tp as SiteEditSourceFileListItemSchema,LI as SiteEditSourceFileResponseSchema,Pp as SiteEditSourceFileTextResponseSchema,Ei as SiteEditSourceIdentitySchema,vp as SiteEditSourceLocationRangeSchema,UI as SiteEditSourceLocationSchema,Th as SiteEditSourceLocatorRangeSchema,Bi as SiteEditSourceLocatorSchema,Se as SiteEditSourcePathSchema,uo as SiteEditSourceTreeNodeSchema,OI as SiteEditSourceTreeResponseSchema,kp as SiteEditSourceTreeTruncationReasonSchema,Ap as SiteEditSourceTreeTruncationSchema,wr as SiteEditStyleBreakpointSchema,Sr as SiteEditStyleDraftPropertySchema,vP as SiteEditStyleModelSchema,Ar as SiteEditStylePropertySchema,_c as SiteEditStyleSourceSchema,Pr as SiteEditStyleStateModeSchema,zi as SiteEditTextSegmentSchema,dc as SiteEditTextSourceSchema,Eh as SiteEditWriteTargetSchema,ZR as SiteExtraRequirementResponseSchema,op as SiteExtraRequirementSchema,u0 as SiteGenerationLedgerResponseSchema,T as SiteIdSchema,fe as SiteLocaleSchema,eL as SiteMediaIntentSchema,hR as SiteOperationLockIdSchema,pS as SitePreviewActivateErrorCodeSchema,uS as SitePreviewActivateFailedSchema,dS as SitePreviewActivateReadySchema,Ww as SitePreviewActivateResponseSchema,vO as SitePublishDomainCheckDataSchema,CO as SitePublishDomainCheckRequestSchema,DO as SitePublishDomainCheckResponseSchema,OO as SitePublishDomainOperationDataSchema,jO as SitePublishDomainOperationResponseSchema,NO as SitePublishDomainReconcileOperationResponseSchema,LO as SitePublishDomainRemediationConfirmRequestSchema,MO as SitePublishDomainRemediationConfirmResponseSchema,Ns as SitePublishQualityTaskStatusSchema,uO as SitePublishRepairInputItemSchema,oy as SitePublishRepairResultItemSchema,Mm as SitePublishRepairResultSchema,_O as SitePublishRepairTaskSnapshotSchema,Nm as SitePublishRepairTaskStatusSchema,fO as SitePublishWorkflowActiveResponseSchema,Qa as SitePublishWorkflowIdSchema,cy as SitePublishWorkflowMutationDataSchema,bO as SitePublishWorkflowMutationResponseSchema,my as SitePublishWorkflowPublishDataSchema,yO as SitePublishWorkflowPublishResponseSchema,ly as SitePublishWorkflowQualityDataSchema,xO as SitePublishWorkflowQualityResponseSchema,St as SitePublishWorkflowRecordSchema,SO as SitePublishWorkflowRevisionRequestSchema,Jb as SitePublishWorkflowStatusSchema,ey as SitePublishWorkflowStepSchema,yt as SiteRecordSchema,fR as SiteTemplateUpgradeStateIdSchema,WL as SiteThreadListQuerySchema,zL as SiteThreadListResponseSchema,VL as SiteThreadResponseSchema,Ya as SiteVersionIdSchema,xx as SiteVersionListItemSchema,Ws as SiteVersionRecordSchema,Ve as SiteWorkflowIdSchema,O_ as SiteWorkflowRecordSchema,S1 as SiteWorkflowSnapshotResponseSchema,wi as SiteWorkflowSnapshotSchema,T_ as SiteWorkflowStatusSchema,Za as SiteWorkflowTaskRefIdSchema,f1 as SiteWorkflowTaskRefResponseSchema,Wr as SiteWorkflowTaskRefSchema,lL as SitemapAddBlockInputSchema,Ga as SitemapAnswerSchema,cL as SitemapChangeBlockVariantInputSchema,sE as SitemapDeleteBlockInputSchema,Hx as SitemapDraftBlockSchema,Vx as SitemapDraftPageSchema,hE as SitemapDraftRecordSchema,Dn as SitemapDraftSchema,nE as SitemapEditActorSchema,oE as SitemapEditErrorCodeSchema,cE as SitemapEditFailureSchema,aE as SitemapEditOperationSchema,dL as SitemapEditResultSchema,rE as SitemapEditSuccessSchema,_L as SitemapGenerationInputSchema,uE as SitemapGenerationOutcomeSchema,_E as SitemapGenerationReasonSchema,Dl as SitemapGenerationStageSchema,Ae as SitemapIdSchema,mE as SitemapIntentPageSchema,oL as SitemapModelOutputSchema,Yx as SitemapModelPageSchema,rL as SitemapMoveBlockInputSchema,zx as SitemapNavigationHrefSchema,Ie as SitemapNodeIdSchema,Ml as SitemapRecordSchema,iL as SitemapResolverModelOutputSchema,sL as SitemapResolverRequestSchema,aL as SitemapResolverResponseSchema,tE as SitemapResolverTargetsSchema,vl as SitemapRunInputSchema,$t as SitemapSchema,Qx as SitemapSourceProvenanceSchema,gL as SitemapStreamEventSchema,RD as SitemapTaskCreateRequestSchema,PD as SitemapTaskCreateResponseSchema,yb as SitemapTaskFailureErrorCodeSchema,wD as SitemapTaskResponseSchema,iE as SitemapUpdateBlockInstructionInputSchema,mL as SitemapUpdateBlockPropsInputSchema,wx as SitemapUserChoiceSchema,Vt as SkillSelectionSchema,vx as SkillSelectionSourceSchema,zl as SnapshotContentHashSchema,Re as SnapshotFilePathSchema,k as SnapshotIdSchema,ct as SnapshotRecordSchema,bl as SnapshotStatusSchema,_0 as StartFillInRequestSchema,uN as StartFillInResponseSchema,ka as StartGscAuthDataSchema,qm as StartGscAuthRequestSchema,Fm as StartGscAuthResponseSchema,A1 as StartSiteBuildRequestSchema,Jw as StartSiteBuildResponseSchema,bS as StartSiteBuildResultSchema,gO as StartSitePublishWorkflowRequestSchema,UL as StartWorkspaceRunRequestSchema,qL as StartWorkspaceRunResponseSchema,Qr as Step2AiCrawlabilityAssessmentSchema,mg as Step2FinalResultDataSourceSchema,cs as Step2FinalResultRequestSchema,dA as Step2FinalResultResponseSchema,pA as Step2FinalResultSaveResponseSchema,cg as Step2FinalResultSaveResultSchema,Ni as Step2FinalResultTypeSchema,pg as Step2FinalResultViewSchema,Xr as Step2FinalScanCardKeySchema,Li as Step2FinalScanCardSchema,rg as Step2FinalScanResultSchema,xn as Step2KnowledgeOpaqueIdSchema,oC as Step2KnowledgeScopeSchema,dt as Step2PageRoleSchema,gA as Step2PageSelectionRequestSchema,hA as Step2PageSelectionResponseSchema,ig as Step2SiteInitializationCrawlerErrorCodeSchema,sg as Step2SiteInitializationStatusSchema,lA as Step2SiteInitializationTaskResponseSchema,ag as Step2SiteInitializationTaskSchema,Mi as Step3AgentAnalysisSchema,fg as Step3AnalysisFindingSchema,RA as Step3AnalysisJobResponseSchema,tc as Step3AnalysisJobSchema,Jr as Step3AnalysisJobStatusSchema,IA as Step3AnalysisLatestResponseSchema,Zr as Step3AnalysisProgressSchema,xg as Step3AnalysisResultSchema,EA as Step3AnalysisScheduleResponseSchema,Sg as Step3AnalysisScheduleSchema,TA as Step3AnalysisSseFrameSchema,yA as Step3AnalysisStartRequestSchema,ec as Step3AnalysisSummarySchema,hg as Step3AnalystSchema,xA as Step3AnalystsResponseSchema,wA as Step4DiagnosisResponseSchema,ii as Step5ActiveStrategyKeySchema,uT as Step5CommitStrategyRequestSchema,_T as Step5CommitStrategyResponseSchema,vd as Step5CommittedVersionSchema,Ad as Step5DecisionCustomPayloadInputSchema,kd as Step5DecisionCustomPayloadSchema,rn as Step5DecisionSelectionIdSchema,ed as Step5EvidenceReferenceSchema,gd as Step5GenerationStatusSchema,Po as Step5GeoQuestionSchema,wd as Step5JobStatusSchema,Yp as Step5KeywordCategorySchema,sn as Step5KeywordEntrySchema,ti as Step5KeywordLibrarySchema,XI as Step5KeywordSearchBodySchema,Hn as Step5KeywordSelectionSchema,Td as Step5LegacyDecisionCustomPayloadInputSchema,Id as Step5LegacyDecisionCustomPayloadSchema,xd as Step5LegacySeoKeywordInputSchema,vo as Step5LegacySeoKeywordSchema,Zn as Step5MarketCountrySchema,Qn as Step5MarketTypeSchema,yo as Step5OptionPresentationSchema,si as Step5OutputLocaleSchema,lT as Step5RegenerateItemRequestSchema,pT as Step5SaveDecisionRequestSchema,dT as Step5SaveDecisionResponseSchema,rd as Step5SemrushEmptyReasonCodeSchema,od as Step5SemrushIntentGroupSchema,pd as Step5SemrushKeywordCandidateSchema,dd as Step5SemrushKeywordCandidateSearchDataSchema,sT as Step5SemrushKeywordCandidateSearchRequestSchema,iT as Step5SemrushKeywordCandidateSearchResponseSchema,ad as Step5SemrushKeywordRecommendationSchema,_d as Step5SemrushKeywordSelectionDataSchema,ud as Step5SemrushKeywordSelectionItemSchema,aT as Step5SemrushKeywordSelectionRequestSchema,oT as Step5SemrushKeywordSelectionResponseSchema,id as Step5SemrushRecommendationSeedSchema,md as Step5SemrushRecommendationSnapshotSchema,td as Step5SemrushRecommendationStatusSchema,To as Step5SemrushSearchIntentSchema,cd as Step5SemrushSelectionSummarySchema,Ed as Step5SemrushSnapshotRefSchema,Co as Step5SeoGeoPlanRowSchema,Jn as Step5SeoKeywordSchema,Rd as Step5SeoPayloadV2InputSchema,oi as Step5SeoPayloadV2Schema,lE as Step5SitemapDecisionSchema,dE as Step5SitemapRunInputSchema,pE as Step5SitemapSourceSchema,uL as Step5SitemapStartRequestSchema,cT as Step5StartStrategyRequestSchema,mT as Step5StartStrategyResponseSchema,Pd as Step5StrategyDecisionInputSchema,ri as Step5StrategyDecisionSchema,ai as Step5StrategyItemSchema,Do as Step5StrategyJobSchema,Xn as Step5StrategyKeySchema,Io as Step5StrategyOptionIdSchema,Qp as Step5StrategyOptionSchema,Zp as Step5StrategyPlanSchema,Dd as Step5StrategySnapshotDataSchema,hT as Step5StrategySseFrameSchema,Cd as Step5StrategyVersionSnapshotSchema,Jp as Step5StructureDetailSchema,FS as Step6AiThemeCandidateSchema,ys as Step6ColorSeedsSchema,YC as Step6DesignAgentRecommendationsResponseSchema,KC as Step6DesignRecommendationGenerationInputSchema,sa as Step6DesignRecommendationModelOutputSchema,GS as Step6DesignRecommendationSchema,UC as Step6DesignRecommendationsRequestSchema,qC as Step6DesignRecommendationsResponseSchema,Gc as Step6DesignSelectionSchema,Fc as Step6GeneratedThemeCardSchema,zS as Step6GptDesignRecommendationModelOutputSchema,p0 as StopWorkspaceGenerationRequestSchema,d0 as StopWorkspaceGenerationResponseSchema,sw as SubsiteGlossariesSchema,zh as SubsiteGlossaryEntrySchema,hs as SubsiteHexColorSchema,yw as SubsiteMountPathSchema,aw as SubsitePaletteLocalizationSchema,Bh as SubsitePaletteModeSchema,Hh as SubsitePaletteSeedsSchema,iw as SubsiteSiteInfoSchema,lw as SubsiteSyncDiffComputeRequestSchema,pw as SubsiteSyncDiffComputeResponseSchema,Xh as SubsiteSyncDiffErrorCodeSchema,dw as SubsiteSyncDiffErrorResponseSchema,hw as SubsiteVisibleTextExportRequestSchema,Sw as SubsiteVisibleTextExportResponseSchema,x_ as TASK_EXECUTION_STATUSES,Gr as TASK_EXECUTION_STATUS_CODES,CN as TEMPLATE_UPGRADE_LOCK_LOST_ERROR_CODE,ta as THEME_PRESETS,jc as THEME_PRESET_IDS,Mr as TaskExecutionStatusSchema,cS as TemplateUpgradeCasOutcomeSchema,Sc as TemplateUpgradeErrorCodeSchema,mS as TemplateUpgradeOutcomeCountsSchema,oS as TemplateUpgradeOutcomeSchema,lS as TemplateUpgradeSnapshotDeletionCandidateSchema,Gt as TemplateUpgradeStateSchema,nS as TemplateUpgradeStatusSchema,rS as TemplateUpgradeValidationStageSchema,We as TemplateVersionSchema,kN as TryAcquireTemplateUpgradeLockRequestSchema,AN as TryAcquireTemplateUpgradeLockResponseSchema,Lh as USER_STOPPED_RUN_ERROR_CODES,rl as UnsplashDownloadLocationSchema,ol as UnsplashMediaAssetSchema,Qj as UpdateBriefRequestSchema,pN as UpdateBriefResponseSchema,IL as UpdateClarifyArchetypeRequestSchema,bN as UpdateCurrentSnapshotManifestRequestSchema,WT as UpdatePageDirectoryReconcileStateRequestSchema,hO as UpdateSitePublishWorkflowStepRequestSchema,Xj as UpdateSiteRequestSchema,HL as UpdateSiteThreadRequestSchema,y1 as UpdateSiteWorkflowWebsiteRequestSchema,FC as UpdateStep6DesignSelectionRequestSchema,GC as UpdateStep6DesignSelectionResponseSchema,I1 as UpdateWorkflowTaskStatusRequestSchema,Xy as UploadMediaLibraryAssetResponseSchema,sO as UpstreamPromptTemplateCatalogDataSchema,nO as UpstreamPromptTemplateConsumeDataSchema,mb as UrlListCrawlerTaskCreateRequestSchema,bR as UsageRecordIdSchema,ix as UseUnsplashMediaRequestSchema,ax as UseUnsplashMediaResponseSchema,cR as UserIdSchema,Ty as VCP_GSC_STATES,Ta as VcpGscStateSchema,ny as VcpQualityRemediationItemSchema,jm as VcpQualityResultSchema,va as VisualHintsSchema,Px as VisualThemeSchema,h1 as WORKFLOW_DEFINITIONS_V1,Pi as WORKFLOW_DEFINITION_REGISTRY,f_ as WORKFLOW_FLOW_TYPES,k_ as WORKFLOW_MENU_STATES,b_ as WORKFLOW_NODE_CODES,y_ as WORKFLOW_TASK_TYPES,H1 as WORKSPACE_ATTACHMENT_BOUND_ERROR_CODE,J1 as WORKSPACE_ATTACHMENT_CAPTURE_BUDGET_ERROR_CODE,Q1 as WORKSPACE_ATTACHMENT_CAPTURE_BUSY_ERROR_CODE,X1 as WORKSPACE_ATTACHMENT_CAPTURE_FAILED_ERROR_CODE,Z1 as WORKSPACE_ATTACHMENT_CAPTURE_TIMEOUT_ERROR_CODE,eA as WORKSPACE_ATTACHMENT_CAPTURE_UNAVAILABLE_ERROR_CODE,B1 as WORKSPACE_ATTACHMENT_LIMIT_ERROR_CODE,Q_ as WORKSPACE_ATTACHMENT_MEDIA_TYPES,K1 as WORKSPACE_ATTACHMENT_TARGET_BASE64_BYTES,z1 as WORKSPACE_ATTACHMENT_TOO_LARGE_ERROR_CODE,G1 as WORKSPACE_ATTACHMENT_UNBOUND_TTL_MS,W1 as WORKSPACE_ATTACHMENT_UNSUPPORTED_FORMAT_ERROR_CODE,Y1 as WORKSPACE_ATTACHMENT_URL_REJECTED_ERROR_CODE,QA as WORKSPACE_CHECK_INCOMPLETE_ERROR_CODE,JA as WORKSPACE_FILL_IN_INTERRUPTED_ERROR_CODE,ZA as WORKSPACE_GENERATION_STOPPED_ERROR_CODE,YA as WORKSPACE_MAX_PAGE_ATTEMPTS,$A as WORKSPACE_MAX_RESUME_COUNT,VA as WORKSPACE_RUN_HEARTBEAT_INTERVAL_MS,HA as WORKSPACE_RUN_LEASE_MS,e0 as WORKSPACE_RUN_LEASE_SUPERSEDED_ERROR_CODE,t0 as WORKSPACE_RUN_NOT_ACTIVE_ERROR_CODE,XA as WORKSPACE_RUN_RESUME_EXHAUSTED_ERROR_CODE,$1 as WORKSPACE_URL_CAPTURE_WINDOW_MS,ZL as WORKSPACE_WEBSOCKET_CONTRACT,Nr as WorkflowClientCapabilitiesSchema,Kr as WorkflowDefinitionVersionSchema,is as WorkflowFlowTypeSchema,D_ as WorkflowMenuItemSchema,A_ as WorkflowMenuStateSchema,gn as WorkflowNodeCodeSchema,Lr as WorkflowTaskTypeSchema,nA as WorkspaceAttachmentFromUrlRequestSchema,Oi as WorkspaceAttachmentMediaTypeSchema,tA as WorkspaceAttachmentSchema,KE as WorkspaceClientMessageSchema,mx as WorkspaceDesignApplyRequestSchema,lx as WorkspaceDesignApplyResponseSchema,Wa as WorkspaceDiagnosticSchema,QE as WorkspaceDirectEditFileSchema,XE as WorkspaceDirectEditPathSchema,$l as WorkspaceDirectEditPostActionSchema,tM as WorkspaceDirectEditRequestSchema,sM as WorkspaceDirectEditResponseSchema,za as WorkspaceExecutionDiagnosticsSchema,AL as WorkspaceExecutionPlanSchema,mo as WorkspaceGenerationLedgerEventSchema,tn as WorkspaceGenerationLedgerSchema,YE as WorkspaceMediaRequestSchema,mp as WorkspaceOmissionKindSchema,lp as WorkspaceOmissionReasonSchema,co as WorkspaceOmissionSchema,nc as WorkspacePageCheckpointSchema,dp as WorkspacePageOutcomeSchema,pp as WorkspacePageResultSchema,Va as WorkspacePlanDependencySchema,Fl as WorkspacePlanSummarySchema,TE as WorkspacePlanTaskKindSchema,Ha as WorkspacePlanTaskSchema,u_ as WorkspaceResourceKindSchema,g_ as WorkspaceResourceNavigationSelectionSchema,jr as WorkspaceResourceOperationClientMessageSchema,__ as WorkspaceResourceOperationSummarySchema,h_ as WorkspaceResourceOperationTransientInputSchema,m0 as WorkspaceRunControlInputResponseSchema,a0 as WorkspaceRunHeartbeatRequestSchema,o0 as WorkspaceRunHeartbeatResponseSchema,zs as WorkspaceRunKindSchema,Ug as WorkspaceRunResumePrincipalSchema,GE as WorkspaceSelectedComponentSchema,zE as WorkspaceServerMessageSchema,pL as WorkspaceSitemapEditRequestSchema,FE as WorkspaceSocketDescriptorSchema,sR as WorkspaceSourceFileBinaryResponseSchema,tR as WorkspaceSourceFileKindSchema,Xl as WorkspaceSourceFileListItemSchema,iM as WorkspaceSourceFilePathQuerySchema,aM as WorkspaceSourceFileResponseSchema,nR as WorkspaceSourceFileTextResponseSchema,Yl as WorkspaceSourcePathSchema,bE as WorkspaceSuggestionSchema,Ul as WorkspaceSuggestionsSchema,yE as WorkspaceSuggestionsSourceSchema,Gl as WorkspaceTaskCountsSchema,QL as WorkspaceWebSocketMessageSchema,XL as WorkspaceWebSocketMessageTypeSchema,Ba as WorkspaceWorkerGroupSchema,Ka as WorkspaceWorkerPhaseSchema,PL as WorkspaceWorkerResultSchema,vt as WorkspaceWorkerStatusSchema,gv as applicationTemplateCatalogDataSchema,_v as applicationTemplateConsumeDataSchema,uv as applicationTemplateV1Schema,MA as assertDeploymentTransition,ij as assertFillInTargetsOmitted,D1 as assertSiteBuildStatusTransition,v1 as assertTaskExecutionStatusTransition,nj as buildE2bBrowserPreviewUrl,EO as buildFinalSitePublishQualityResult,WC as buildStep6FallbackThemeCards,fa as canonicalizeFormDesignJson,iO as canonicalizeLauncherPromptTemplateOperation,pr as canonicalizePageSlug,xi as classifySiteEditPropertyName,jT as cmsPagePreviewUrlPath,bT as compareTemplateVersions,mP as composeSiteEditRepeatInstanceKey,Zv as computeFormDesignOperationFingerprint,Xs as computeSiteEditCompositionKey,Du as computeSiteEditSourceIdentityKey,Nn as containsSensitiveData,aI as countLedgerAccessiblePages,oI as countLedgerProcessedPages,qy as countSitemapStructure,xu as createSiteEditCommandFailureSchema,dr as createSiteEditCommandResultSchema,bi as createSiteEditCommandSuccessSchema,BC as defaultStep6Selection,Py as deriveVcpGscState,wy as doesGscPropertyMatchDomain,Wy as estimateNavLabelWidth,U_ as findWorkflowDefinition,M_ as findWorkflowDefinitionInRegistry,Xi as fontStack,$f as formDesignOperationFingerprintInput,UA as getDeploymentHappyPathTransitions,NA as getDeploymentTransitionPredecessors,jA as getDeploymentTransitionTargets,Cc as getFontPairing,Oc as getMotionPreset,Mc as getSiteDesignThemeRadius,Js as getSiteEditSourceDeleteProtectionReason,py as getSitePublishRepairItems,AC as getThemePreset,q_ as getWorkflowDefinition,w1 as getWorkflowNodeIndex,BR as hasAnyBusinessFact,rw as hasLockedSeeds,Qv as hashAffectedFormDesignFiles,Xv as hashCmsFormSchemaProjection,Ps as hashFormDesignJson,Yv as hashFormSpec,jy as homeLabelForLocale,mr as isCanonicalPageSlug,_S as isCmsMainProductsWithinLimit,OT as isCmsPageSelectable,Ko as isCmsTemplateUrlPath,hI as isConsentGranted,Mg as isDeploymentActiveStatus,LA as isDeploymentTerminalStatus,qh as isExactEditEngineVersion,kR as isExternalSiteEditInfrastructureReason,jv as isFormSpecLocalizableFieldPath,gT as isKnownStep5SseEventName,P0 as isMigrationProductsPresetBlockLabel,A0 as isMigrationProductsPresetPageTitle,BI as isNonLatinSiteLocale,Un as isPageTemplateCandidateEntryPath,pD as isPlatformMaterializedFile,tS as isReservedSubsiteMountSegment,Op as isSiteEditDesignDocumentPath,qd as isSiteEditMaterializationPathTemplate,Oh as isSiteEditRuntimeContainerTag,jh as isSiteEditRuntimeTextTag,MP as isSiteEditRuntimeVoidElementTag,qI as isSiteEditSourceDeleteProtectedPath,Dp as isSiteEditSourceDirectoryPath,_o as isSiteEditSourcePath,Zs as isSiteEditTextSourcePath,dy as isSitePublishRepairResultSuccessful,oD as isSiteStructureKnownFieldPath,aD as isSiteStructureLocalizableFieldPath,tT as isStep5RequiredStrategyKey,ko as isStep5SeoAllowedIntentCode,Ms as isTopLevelPage,HP as isUserStoppedRunErrorCode,C1 as isWorkflowTaskTypeForNode,Hm as listChildPages,lh as makeSiteEditRepeatInstanceKey,Ly as markAllPagesInHeader,k0 as migrationProductsCopyForLocale,Ny as moreLabelForLocale,zy as navLabelCollisionKey,Rv as normalizeCmsApplicationSlug,SD as normalizeCmsPublicApiBase,nm as normalizeFormOptionLabelIdentity,On as normalizeGscDomain,so as normalizePageTemplatePagePath,Oo as normalizeStep5SeoKeyword,Ls as normalizeStructureTitle,Uy as orderNavigationLinksByStructure,Vm as orderSitemapPagesForDisplay,bu as pageSlugToRouteFilePath,NT as parseCmsPageDirectory,f0 as parseComponentI18nResourcesJson,Cy as parseE2bPreviewProxyDomain,Fh as parseExactEditEngineVersion,AI as parseSiteEditCompositionKey,ph as parseSiteEditRepeatInstanceKey,Ck as parseSiteEditSourceIdentityKey,ji as parseWorkspaceAttachmentImagePath,Fv as projectFormSpecToCmsSchema,iA as readWorkspaceAttachmentReferences,vy as reconcileSitemapNavigation,kS as resolveFont,PS as resolveFontDisplayName,qv as resolveFormTemplateText,P1 as resolvePublishedWorkflowDefinition,nI as resolveRedisConnectionConfig,JP as resolveRequestedEditEngineVersion,fo as resolveSelectableSiteLocale,UP as resolveSiteEditRuntimeOperationSummary,zI as resolveSiteLocaleFromIso6393,WI as resolveSiteTextDirection,KS as resolveStep6RadiusId,ew as resolveSystemCurrentEditEngineVersion,F_ as selectPublishedWorkflowDefinition,RI as selectReferenceVisualImage,c1 as siteBuildStatusFromCode,d1 as siteBuildStatusToCode,m1 as siteDeploymentStatusFromCode,u1 as siteDeploymentStatusToCode,jS as siteFontVariables,l1 as siteWorkflowStatusFromCode,_1 as siteWorkflowStatusToCode,Wh as splitSubsiteGlossaryEntry,WS as step6GptVisualIdentity,lP as stripSiteEditRepeatInstanceKeys,p1 as taskExecutionStatusFromCode,g1 as taskExecutionStatusToCode,zC as toStep6GenerationVisualHints,lr as tryCanonicalizeAsciiPageSlug,oc as validateComponentI18nResources,Nv as validateFormSpecIdentityTransition,Fy as validateSitemapStructure,sA as workspaceAttachmentImagePath};
|