@vcp-dev/contracts 0.10.23 → 0.10.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,11 +1,68 @@
1
- import{z as t}from"zod";import{z as re}from"zod";import{z as j}from"zod";import{z as rd}from"zod";var Q=rd.uuidv7(),PT=Q,vT=Q,CT=Q,DT=Q,OT=Q,NT=Q,jT=Q,T=Q,$t=Q,La=Q,Te=Q,bi=Q,k=Q,Ma=Q,V=Q,Ua=Q,tt=Q,as=Q,ct=Q,LT=Q,MT=Q,rs=Q,nt=Q,Fa=Q,UT=Q,FT=Q,GT=Q,xn=Q,qT=Q,WT=Q,KT=Q;var Ga=Q,yi=j.enum(["external_site_edit","page_template_create"]),cd=200,jt=j.string().min(1).max(cd),md=4e3,qa=j.enum(["succeeded","degraded","no_changes","failed"]),En=j.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"]),Rn=j.object({code:j.enum(["preexisting_placeholder_media"]),block_ids:j.array(j.string().min(1))}).strict(),ld=["sandbox_unavailable"];function VT(e){return e!=null&&ld.includes(e)}var pd=j.enum(["pending","delivered","failed"]),dd=j.enum(["running","succeeded","degraded","no_changes","failed"]),$T=j.object({site_id:T,external_run_id:jt,external_thread_id:jt,prompt:j.string().min(1).max(md),thread_title:j.string().trim().min(1).max(200).optional()}).strict(),xi=j.enum(["added","modified","deleted"]),ud=j.enum(["landing_page","general_page","detail_page"]),_d=j.enum(["header","footer","styles","layout"]),Wa={block_id:j.string().min(1),type:j.string().min(1),change:xi},Ka={slug:j.string().min(1),title:j.string().min(1),page_type:ud,change:xi},gd=j.object({kind:_d,change:xi}).strict(),Ba={site_wide:j.array(gd),unclassified_count:j.number().int().nonnegative()},hd=j.object(Wa).strict(),Sd=j.object({...Ka,sections:j.array(hd)}).strict(),fd=j.object({pages:j.array(Sd),...Ba}).strict(),bd=j.object({...Wa,label:j.string().min(1)}).strict(),yd=j.object({page_id:j.number().int().positive().nullable(),...Ka,sections:j.array(bd)}).strict(),za=j.object({pages:j.array(yd),...Ba}).strict(),YT={pages:[],site_wide:[],unclassified_count:0},XT=j.object({base_snapshot_id:k,target_snapshot_id:k}).strict(),QT=j.object({data:fd}).strict(),cs=j.object({id:Ga,execution_scene:yi.default("external_site_edit"),site_id:T,external_run_id:j.string().min(1).nullable(),external_thread_id:j.string().min(1).nullable(),status:dd,outcome:qa.nullable(),degraded_reason:En.nullable(),vcp_run_id:V.nullable(),vcp_thread_id:tt.nullable(),base_snapshot_id:k,snapshot_id:k.nullable(),preview_url:j.string().url().nullable(),summary:j.string().nullable(),error_code:j.string().nullable(),build_verified:j.boolean().nullable(),callback_status:pd.nullable(),created_at:j.string().min(1),started_at:j.string().min(1).nullable(),finished_at:j.string().min(1).nullable(),changes:za.nullable().default(null),advisories:j.array(Rn).nullable().default(null)}).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.changes!==null&&n.addIssue({code:"custom",message:"Page Template tasks never carry changes"}),e.advisories!==null&&e.status!=="succeeded"&&n.addIssue({code:"custom",message:"Page Template advisories belong to succeeded tasks only"})):e.advisories!==null?n.addIssue({code:"custom",message:"External edit tasks never carry advisories"}):(!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"})}),ZT=j.object({task:cs}).strict(),JT=j.object({task:cs}).strict(),ek=j.object({task_id:Ga,external_run_id:j.string().min(1),external_thread_id:j.string().min(1),site_id:T,vcp_run_id:V.nullable(),outcome:qa,degraded_reason:En.nullable(),snapshot_id:k.nullable(),preview_url:j.string().url().nullable(),summary:j.string().nullable(),error_code:j.string().nullable(),build_verified:j.boolean().nullable(),retryable:j.boolean(),finished_at:j.string().min(1),changes:za.nullable().default(null)}).strict(),tk=j.object({received:j.literal(!0)}).strict();var $e=re.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"}),In=re.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 Ha(e){return/^\[\[\.\.\.[^\[\]]+\]\]$|^\[[^\[\]]+\]$/.test(e)}function ms(e){let n=/^(?:src\/)?app\/\.vcp\/page-templates\/(.+)\/page\.tsx$/.exec(e);if(!n)return!1;let s=n[1].split("/"),i=s.some(Ha),o=i?s[0]:s.pop(),a=i?s.slice(1):s;if(i&&a.length===0||!/^[A-Za-z0-9_-]{1,255}$/.test(o)||!In.safeParse(`/${a.join("/")}`).success||a.some(c=>c?c.includes("[")||c.includes("]")?!Ha(c):/[\[\]()%]/.test(c)||c.startsWith("_")||c.startsWith("@"):!0))return!1;try{let c=atob(o.replace(/-/g,"+").replace(/_/g,"/")),r=Uint8Array.from(c,S=>S.charCodeAt(0)),m=new TextDecoder("utf-8",{fatal:!0}).decode(r);return $e.safeParse(m).success&&btoa(String.fromCharCode(...new TextEncoder().encode(m))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")===o}catch{return!1}}var Va=re.object({page_path:In,template_id:$e,instruction:re.string().min(1).refine(e=>e.trim().length>0)}).strict(),$a=3;function Ya(e){return e.replace(/\/+$/,"")||"/"}var ak=re.object({external_run_id:jt,external_thread_id:jt,items:re.array(Va).min(1).max($a)}).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:Ya(n.page_path)}))})).superRefine((e,n)=>{let s=new Set;e.items.forEach((i,o)=>{let a=JSON.stringify([i.page_path,i.template_id]);s.has(a)&&n.addIssue({code:"custom",path:["items",o],message:"Duplicate normalized page_path/template_id identity"}),s.add(a)})}),Xa=re.object({items:re.array(Va).min(1).max($a)}).strict().refine(e=>e.items.every(n=>n.page_path===Ya(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"}),Qa=e=>[...new Set(e)],rk=re.object({page_path:In,template_id:$e,exit_template_ids:re.array($e).default([]).transform(Qa)}).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"}),ck=re.object({page_path:In,template_ids:re.array($e).min(1).transform(Qa)}).strict(),Za={ok:re.literal(!0),site_id:T,page_path:In,route_id:re.string().min(1),snapshot_id:k,advisories:re.array(Rn).default([])},xd=cs.safeExtend({execution_scene:re.literal("page_template_create"),external_run_id:jt,external_thread_id:jt,callback_status:re.null(),status:re.enum(["running","succeeded","failed"]),outcome:re.enum(["succeeded","failed"]).nullable(),degraded_reason:re.null(),changes:re.null().default(null)}),mk=re.object({task:xd}).strict(),lk=re.object({...Za,promoted_template_id:$e,deleted_template_ids:re.array($e),status:re.literal("promoted")}).strict(),pk=re.object({...Za,deleted_template_ids:re.array($e),status:re.literal("cleaned")}).strict(),dk=re.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_SOURCE_UNSUPPORTED","PAGE_TEMPLATE_GENERATION_FAILED","PAGE_TEMPLATE_PATCH_FAILED"]);import{z as ls}from"zod";var Ja=ls.object({primary_products:ls.string().trim().min(1).max(1e3).optional(),current_markets:ls.string().trim().min(1).max(1e3).optional(),qualifications:ls.string().trim().min(1).max(1e3).optional()}).strict();function gk(e){return Object.values(e).some(n=>typeof n=="string"&&n.trim().length>0)}import{z as mt}from"zod";var er={autoplay:mt.boolean().optional(),intervalMs:mt.number().int().min(5e3).max(15e3).optional(),loop:mt.boolean().optional()},ps=mt.discriminatedUnion("kind",[mt.object({kind:mt.literal("media-carousel"),presentation:mt.enum(["flat","angled"]).optional(),...er}).strict(),mt.object({kind:mt.literal("category-carousel"),...er}).strict()]);import{z as Tn}from"zod";var Ed=40,Lt=Tn.object({protocol:Tn.enum(["phone","form","download","route","external"]),ctaLabel:Tn.string().min(1).max(Ed),ctaTarget:Tn.string().min(1).max(200).optional(),requiresOwnerDetail:Tn.boolean().optional()});var Yt=["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 xk(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:Rd(e.VCP_REDIS_PORT,56379)}}function Rd(e,n){if(!e)return n;let s=Number(e);return Number.isInteger(s)&&s>0?s:n}import{z as oe}from"zod";var Id=oe.enum(["component","page","shared"]),Td=oe.enum(["generation_failed","repair_exhausted","page_unusable","check_incomplete","design_missing","chrome_fallback","style_fallback","resume_exhausted","user_stopped","conflict"]),tr=oe.object({kind:Id,target_id:oe.string().min(1),page_id:oe.string().min(1).nullable(),reason:Td,repair_attempts:oe.number().int().nonnegative(),message:oe.string().min(1),filled:oe.boolean().optional()}).strict(),kd=oe.enum(["complete","partial","omitted","check_incomplete","pending"]),Ad=oe.object({page_id:oe.string().min(1),slug:oe.string().min(1),title:oe.string().min(1),parent_page_id:oe.string().min(1).nullable(),result:kd,attempts:oe.number().int().nonnegative(),omissions:oe.array(tr)}).strict(),kn=oe.object({schema_version:oe.literal(1),sitemap_id:oe.string().min(1),confirmed_page_ids:oe.array(oe.string().min(1)).min(1),pages:oe.array(Ad),shared:oe.array(tr),stopped_by_user:oe.boolean(),resume_count:oe.number().int().nonnegative(),home_replaced_by:oe.string().min(1).nullable(),updated_at:oe.string().min(1)}).strict(),nr=oe.object({type:oe.literal("workspace.generation_ledger"),ledger:kn,at:oe.string().min(1)}).strict();function Ik(e){return e.pages.filter(n=>n.result==="complete"||n.result==="partial").length}function Tk(e){return e.pages.filter(n=>n.result==="complete"||n.result==="partial"||n.omissions.some(s=>s.kind==="page")).length}import{z as F}from"zod";var Ei=F.enum(["text","url","document","image"]),Ri=F.enum(["pending","ready","failed"]),wd=F.enum(["pending","ready","failed"]),Pd=F.enum(["product","price","contact","copy","audience","other"]),ds=F.object({fact:F.string().min(1).max(300),kind:Pd,source_id:xn,quote:F.string().min(1).max(500),trust:F.enum(["verbatim","ocr"]).default("verbatim")}),vd=F.object({page_type:F.string().min(1).max(40),sections:F.array(F.string().min(1).max(40)).max(12)}),us=F.object({source_id:xn,nav_structure:F.array(F.string().min(1).max(30)).max(12),page_patterns:F.array(vd).max(10),tone:F.array(F.string().min(1).max(20)).max(8),screenshot_ref:F.string().optional()}),Cd=F.object({source_id:xn,type:Ei,status:Ri,title:F.string().max(120).optional(),original_ref:F.string().min(1),source_metadata:F.record(F.string(),F.unknown()),error_code:F.string().optional(),submitted:F.boolean().optional()}),_s=F.object({topic:F.string().min(1).max(80),variants:F.array(F.object({value:F.string().min(1).max(300),source_id:xn})).min(2)}),Dd=F.object({type:F.literal("text"),content:F.string().min(20).max(1e4),title:F.string().min(1).max(120).optional()}).strict(),Od=F.object({type:F.literal("url"),url:F.string().url().max(2048),rights_ack:F.boolean().optional(),title:F.string().min(1).max(120).optional()}).strict(),Pk=F.discriminatedUnion("type",[Dd,Od]),vk=[".docx",".html",".md",".txt"],Ck=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],Dk=10*1024*1024,Ok=2,Nk=F.object({consent_cross_border:F.union([F.literal(!0),F.literal("true")]),consent_text_version:F.string().min(1).max(120),title:F.string().min(1).max(120).optional()}).strict();function jk(e){return e===!0||e==="true"}var Lk=[".png",".jpg",".jpeg",".webp"],Mk=["image/png","image/jpeg","image/webp","application/octet-stream"],Uk=8*1024*1024,Fk=10,Nd=F.enum(["asset","reference"]),Gk=F.object({image_role:Nd,title:F.string().min(1).max(120).optional()}).strict(),qk=F.object({version:F.literal(1),site_id:T,tenant_id:F.string().min(1),user_prompt:F.string(),status:wd,sources:F.array(Cd).max(16),facts:F.array(ds).max(120),reference:us.optional(),conflicts:F.array(_s).max(20)}).superRefine((e,n)=>{let s=new Map(e.sources.map(i=>[i.source_id,i]));for(let[i,o]of e.facts.entries()){let a=s.get(o.source_id);(!a||a.type==="url")&&n.addIssue({code:"custom",path:["facts",i,"source_id"],message:"facts must reference a text/document/image source (never url)"})}if(e.reference){let i=s.get(e.reference.source_id),o=i?.type==="image"&&i.source_metadata.image_role==="reference";(!i||i.type!=="url"&&!o)&&n.addIssue({code:"custom",path:["reference","source_id"],message:"reference must point at a url source or reference image source"})}});function Wk(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 L}from"zod";import{z as gs}from"zod";var _e=gs.object({routeId:gs.string().min(1),templateId:$e.optional()}).strict(),B=gs.object({routeId:gs.string().min(1),effectiveTemplateId:$e.optional()}).strict();function Ii(e){return JSON.stringify([e.routeId,e.effectiveTemplateId??null])}function Hk(e){let n;try{n=JSON.parse(e)}catch{return null}if(!Array.isArray(n)||n.length!==2)return null;let[s,i]=n,o=B.safeParse(i===null?{routeId:s}:{routeId:s,effectiveTemplateId:i});return o.success?o.data:null}var jd=["design.md","DESIGN.md"],sr=["components/site","src/components/site","lib/generated","src/lib/generated","public"],Ld=["components/system/not-found-content.tsx","src/components/system/not-found-content.tsx"],Md=["app/globals.css","src/app/globals.css"],Ud=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],Fd=new Set(Ud),Ti="source-delete",ir=L.literal(Ti),xe=L.string().min(1).refine(ar,"Invalid site edit source path"),Gd=L.string().min(1).refine($d,"Invalid site edit source directory path"),Qk=L.enum(["text","binary"]),hs=L.object({composition:B,path:xe,language:L.string().min(1).nullable(),sizeBytes:L.number().int().nonnegative(),contentHash:L.string().min(1).optional()}).strict(),qd=L.discriminatedUnion("kind",[hs.extend({kind:L.literal("text"),language:L.string().min(1),readonly:L.boolean().default(!1)}),hs.extend({kind:L.literal("binary"),language:L.null(),mimeType:L.string().min(1).optional(),readonly:L.literal(!0)})]),or=L.lazy(()=>L.discriminatedUnion("kind",[L.object({kind:L.literal("directory"),name:L.string().min(1),path:Gd,children:L.array(or)}),L.object({kind:L.literal("file"),name:L.string().min(1),path:xe,file:qd}).superRefine((e,n)=>{e.path!==e.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),Wd=L.enum(["max-files","max-depth","max-total-bytes"]),Kd=L.object({reasons:L.array(Wd).min(1),maxFiles:L.number().int().positive(),maxDepth:L.number().int().positive(),maxTotalBytes:L.number().int().positive()}),Zk=L.object({composition:B,nodes:L.array(or),defaultPath:xe.optional(),totalFiles:L.number().int().nonnegative(),truncated:Kd.optional()}).strict(),Jk=L.object({composition:_e}).strict(),e0=L.object({path:xe,composition:_e}).strict(),Bd=hs.extend({kind:L.literal("text"),language:L.string().min(1),readonly:L.boolean().default(!1),content:L.string()}),zd=L.enum(["too-large","unsupported-mime","bytes-unavailable"]),Hd=hs.extend({kind:L.literal("binary"),language:L.null(),readonly:L.literal(!0),mimeType:L.string().min(1),contentBase64:L.string().min(1).optional(),previewUnavailableReason:zd.optional()}),t0=L.discriminatedUnion("kind",[Bd,Hd]),n0=L.object({key:L.string().min(1),composition:_e}).strict(),Vd=L.object({startLine:L.number().int().positive(),startColumn:L.number().int().nonnegative(),endLine:L.number().int().positive(),endColumn:L.number().int().nonnegative()}),s0=L.object({key:L.string().min(1),composition:B,sourceFile:xe,componentName:L.string().min(1),openingElementRange:Vd,structuralPath:L.string().min(1),textPreview:L.string().min(1).optional()}).strict();function ar(e){return!Ss(e)&&!Xd(e)||lr(e)?!1:wi(e)||mr(e)||cr(e)||rr(e)||sr.some(n=>e===n||e.startsWith(`${n}/`))}function ki(e){return wi(e)||Fd.has(Zd(e))}function $d(e){return!Ss(e)&&!Qd(e)||lr(e)?!1:e==="app"||e.startsWith("app/")||e==="src"||e==="src/app"||e.startsWith("src/app/")||sr.some(n=>e===n||e.startsWith(`${n}/`)||n.startsWith(`${e}/`))}function Yd(e){return wi(e)}function Ai(e){return ar(e)?Yd(e)?"design-document":cr(e)?"route-entry":mr(e)?"app-global-style":e.toLowerCase()==="lib/generated/media-assets.ts"||e.toLowerCase()==="src/lib/generated/media-assets.ts"?"generated-media-manifest":rr(e)?"system-page":null:null}function rr(e){return Ld.includes(e)}function i0(e){return Ai(e)!==null}function cr(e){return/^(?:src\/)?app\/(?:.*\/)?page\.[cm]?[jt]sx?$/.test(e.toLowerCase())}function Xd(e){return ms(e)&&Ss(e.replace("/.vcp/","/_vcp/"))}function Qd(e){return/^(?:src\/)?app\/\.vcp(?:\/page-templates(?:\/.+)?)?$/i.test(e)?Ss(e.replace("/.vcp","/_vcp")):!1}function mr(e){return Md.some(n=>n.toLowerCase()===e.toLowerCase())}function Zd(e){let n=e.split("/").at(-1)??e,s=n.lastIndexOf(".");return s>0?n.slice(s).toLowerCase():""}function wi(e){return!e.includes("/")&&jd.some(n=>n.toLowerCase()===e.toLowerCase())}function lr(e){let n=e.toLowerCase(),s=n.split("/"),o=(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:o==="server"||o==="db"||o==="database"||o==="auth"||o==="secret"||o==="secrets"||o==="token"||o==="tokens"||o==="credential"||o==="credentials"||s.includes("server")||s.includes("secrets")}function Ss(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 Jd}from"zod";var An=["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"],eu=["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"],tu=[...An,...eu],nu=new Set(["ar","fa","he"]),r0=[{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"}],su={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"},iu=new Set(An);function pr(e){return iu.has(e)?e:su[e]}var ou="en";function c0(e){let n=e.toLowerCase().split("-",1)[0]??"";return nu.has(n)?"rtl":"ltr"}var au={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 m0(e){return au[e]??ou}var ru=["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"],cu=new Set(ru);function l0(e){return cu.has(e)}var Ee=Jd.enum(tu);import{z as mu}from"zod";var dr=mu.string().uuid();import{z as f}from"zod";import{z as ee}from"zod";var xt=ee.string().trim().min(1).max(128),Xt=ee.string().trim().min(1).max(500),lu=["\u4EA7\u54C1","\u90E8\u4EF6/\u8017\u6750","\u5E94\u7528\u65B9\u6848","\u5B9A\u5236/OEM","\u670D\u52A1","\u8D44\u8D28/\u80FD\u529B"],pu=ee.enum(lu),wn=ee.object({id:xt,keyword:ee.string().trim().min(1).max(255),business_id:xt,business_name:ee.string().trim().min(1).max(255),category:pu,selling_points:ee.string().trim().max(2e3),section_id:xt,content_usage:ee.enum(["product","category","solution","service","capability","article","faq"]),intent:Xt,semantic_group:xt,primary_business:ee.boolean(),monthly_volume:ee.number().int().min(1),keyword_difficulty:ee.number().min(0).max(100).nullable(),variants:ee.array(ee.string().trim().min(1).max(255)),source:ee.literal("semrush"),source_evidence:ee.array(Xt).min(1)}).strict(),Pi=ee.object({schema_version:ee.literal(1),snapshot_id:xt,dependency_hash:ee.string().regex(/^[a-f0-9]{64}$/),language:ee.string().trim().min(2).max(35),database:ee.string().regex(/^[a-z]{2}$/),generated_at:ee.string().datetime({offset:!0}),entries:ee.array(wn),candidates:ee.array(wn),search_result_ids:ee.array(xt).optional()}).strict().superRefine((e,n)=>{for(let s of["entries","candidates"]){let i=e[s];(new Set(i.map(o=>o.id)).size!==i.length||new Set(i.map(o=>o.keyword.normalize("NFKC").trim().toLowerCase())).size!==i.length)&&n.addIssue({code:"custom",path:[s],message:"\u5173\u952E\u8BCD\u4E0D\u80FD\u91CD\u590D"})}}),fs=ee.object({snapshot_id:xt,entry_ids:ee.array(xt).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"})}),g0=ee.object({expected_revision:ee.number().int().nonnegative(),business_subject:ee.string().trim().min(1).max(255)}).strict(),ur=ee.object({points:ee.array(Xt).length(3),comparison:ee.array(ee.object({dimension:Xt,recommended:Xt,alternative:Xt}).strict()).min(1).max(4)}).strict();var lt=f.string().trim().min(1).max(128),Mt=f.string().trim().min(1).max(200),Ye=f.string().trim().min(1).max(2e3),vi=f.string().trim().max(200),bs=f.string().regex(/^[a-f0-9]{64}$/),Ci=f.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),Qt=["market","persona","product","brand","competition","structure","language","keywords","risk"],De=Qt.length,du=["keywords"],Pn=Qt.filter(e=>!du.includes(e)),ys=Pn.length,xs=f.enum(Qt);function y0(e){return Pn.some(n=>n===e)}var Es=xs,_r=["recommended","conservative","focused"],gr=f.enum(_r),vn=f.union([gr,f.literal("confirmed")]),Rs=f.enum(["single_country","regional_combination","multi_market"]),Is=f.object({code:f.string().trim().regex(/^[A-Z]{2}$/),name_zh:Mt,name_en:Mt,region:Mt}).strict(),uu=f.object({id:gr,presentation:ur.nullish(),sections:f.array(f.object({id:f.string().trim().min(1).max(128),label:f.string().trim().min(1).max(200)}).strict()).max(30).optional(),label:Mt,note:Ye,impact:f.string().trim().max(500).nullish(),set_value:f.string().trim().max(500).nullish(),site_locale:Ee.nullish(),market_type:Rs.nullish(),markets:f.array(Is).max(32).optional()}).loose(),_u=f.object({lead:f.string().trim().min(1).max(500),title:Mt,columns:f.array(f.string().trim().min(1).max(80)).min(1).max(8),rows:f.array(f.array(f.string().trim().max(500)).min(1).max(8)).max(100)}).strict().superRefine((e,n)=>{e.rows.forEach((s,i)=>{s.length!==e.columns.length&&n.addIssue({code:"custom",path:["rows",i],message:"Each Step5 plan row must match the column count."})})}),gu=f.object({goal:Ye,issue:Ye,criteria:f.array(Ye).min(1).max(12),resources:f.array(Ye).min(1).max(12),risks:f.array(Ye).min(1).max(12),execution:f.object({standard:f.array(Ye).min(1).max(12),acceptance:f.array(Ye).min(1).max(12),downstream:f.array(Ye).min(1).max(12)}).strict()}).strict(),hu=f.object({source_type:f.enum(["step2","step3"]),source_id:lt,field_path:f.string().trim().max(300).nullish()}).strict(),Su=f.enum(["ok","degraded"]),Di=f.object({key:Es,position:f.number().int().min(1).max(De),category:Mt,title:Mt,summary:Ye,rationale:Ye,parameter:f.string().trim().max(500).nullish(),options:f.array(uu).max(3),keyword_library:Pi.nullish(),plan:_u.nullish(),structure_detail:gu.nullish(),note_tips:f.array(f.string().trim().min(1).max(200)).max(6),note_placeholder:f.string().trim().min(1).max(300),evidence_refs:f.array(hu).min(1).max(8),generation_status:Su.optional()}).loose().superRefine((e,n)=>{let s=Qt.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.options.forEach((i,o)=>{i.id!==_r[o]&&n.addIssue({code:"custom",path:["options",o,"id"],message:"Step5 strategy options must use the canonical order."})}),e.structure_detail&&e.key!=="structure"&&n.addIssue({code:"custom",path:["structure_detail"],message:"Structure detail is only valid for the structure item."})}),fu=f.object({item_key:xs,selected_option_id:vn,note:vi,keyword_selection:fs.optional()}).strict().superRefine((e,n)=>{(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"})}),Oi=f.object({item_key:xs,selected_option_id:vn,note:vi,keyword_selection:fs.optional(),keyword_library:Pi.optional(),market_type:Rs.nullish(),markets:f.array(Is).max(32).optional(),selected_value:f.unknown().nullable(),accepted_at:f.string().datetime({offset:!0})}).loose(),bu=f.enum(["running","succeeded","failed"]),yu=f.object({schema_version:f.literal(1),source_job_id:lt,site_id:lt,output_locale:Ci.optional(),items:f.array(Di).length(De),decisions:f.array(Oi).min(ys).max(De)}).loose(),xu=f.object({strategy_version_id:lt,site_id:lt,source_job_id:lt,output_locale:Ci.optional(),version:f.number().int().positive(),checksum:bs,snapshot:yu,committed_at:f.string().datetime({offset:!0})}).loose(),hr=f.object({job_id:lt,site_id:lt,output_locale:Ci.optional(),status:bu,keyword_library_needs_update:f.boolean().optional(),revision:f.number().int().nonnegative(),items:f.array(Di).max(De),decisions:f.array(Oi).max(De),output_checksum:bs.nullish(),error_code:f.string().trim().max(64).nullish(),error_message:f.string().trim().max(500).nullish(),committed_version:xu.nullish()}).loose().superRefine((e,n)=>{let s=e.items.map(o=>o.key);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["items"],message:"Step5 job items must have unique keys."});let i=e.decisions.map(o=>o.item_key);new Set(i).size!==i.length&&n.addIssue({code:"custom",path:["decisions"],message:"Step5 job decisions must have unique item keys."})}),x0=f.object({force_refresh:f.boolean().optional().default(!1)}).strict(),E0=hr.extend({cached:f.boolean()}).strict(),R0=f.object({expected_revision:f.number().int().nonnegative()}).strict(),I0=f.object({expected_revision:f.number().int().nonnegative(),selected_option_id:vn,note:vi,keyword_selection:fs.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"})}),T0=f.object({revision:f.number().int().positive(),decision:Oi}).strict(),k0=f.object({idempotency_key:f.string().trim().min(8).max(128),expected_revision:f.number().int().nonnegative(),decisions:f.array(fu).min(ys).max(De)}).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 commit decisions must use unique strategy keys."}),Pn.forEach(i=>{s.includes(i)||n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit is missing ${i}.`})})}),A0=f.object({strategy_version_id:lt,version:f.number().int().positive(),checksum:bs,next_path:f.string().trim().min(1).max(500)}).strict(),Eu=hr.extend({completed:f.number().int().min(0).max(De),total:f.literal(De)}).loose(),Ru=["snapshot","strategy_item_start","strategy_item_done","strategy_items_invalidated","strategy_generation_done","failed"];function w0(e){return typeof e=="string"&&Ru.includes(e)}var P0=f.discriminatedUnion("event",[f.object({id:f.number().int().nonnegative(),event:f.literal("snapshot"),data:Eu}).strict(),f.object({id:f.number().int().positive(),event:f.literal("strategy_item_start"),data:f.object({key:xs,position:f.number().int().min(1).max(De)}).strict()}).strict(),f.object({id:f.number().int().positive(),event:f.literal("strategy_item_done"),data:f.object({item:Di}).strict()}).strict(),f.object({id:f.number().int().positive(),event:f.literal("strategy_items_invalidated"),data:f.object({after_position:f.number().int().min(0).max(De)}).strict()}).strict(),f.object({id:f.number().int().positive(),event:f.literal("strategy_generation_done"),data:f.object({item_count:f.literal(De),schema_version:f.literal(1),checksum:bs}).strict()}).strict(),f.object({id:f.number().int().positive(),event:f.literal("failed"),data:f.object({code:f.string().trim().min(1).max(64),message:f.string().trim().min(1).max(500),retryable:f.boolean(),item_key:Es.optional()}).loose()}).loose()]);import{z as Iu}from"zod";var Xe=Iu.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 D0(e,n){let s=Xe.safeParse(e),i=Xe.safeParse(n);if(!s.success||!i.success)return null;let o=Sr(s.data),a=Sr(i.data);for(let r=0;r<3;r+=1){let m=fr(o.release[r],a.release[r]);if(m!==0)return m}if(!o.prerelease&&!a.prerelease)return 0;if(!o.prerelease)return 1;if(!a.prerelease)return-1;let c=Math.max(o.prerelease.length,a.prerelease.length);for(let r=0;r<c;r+=1){let m=o.prerelease[r],S=a.prerelease[r];if(m===void 0)return-1;if(S===void 0)return 1;if(m===S)continue;let g=/^\d+$/u.test(m),w=/^\d+$/u.test(S);return g&&w?fr(BigInt(m),BigInt(S)):g?-1:w?1:Tu(m,S)}return 0}function Sr(e){let n=e.indexOf("+"),s=n===-1?e:e.slice(0,n),i=s.indexOf("-"),o=i===-1?s:s.slice(0,i),a=i===-1?void 0:s.slice(i+1),[c,r,m]=o.split(".");return{release:[BigInt(c),BigInt(r),BigInt(m)],...a?{prerelease:a.split(".")}:{}}}function fr(e,n){return e<n?-1:e>n?1:0}function Tu(e,n){return e<n?-1:e>n?1:0}import{z as Z}from"zod";import{z as ve}from"zod";var Ni=64,ku=512*1024,ji=4*1024*1024,Au=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function wu(e){return Au.test(e)}var br=ve.string().min(1).refine(wu,{message:"Materialization pathTemplate must be a safe relative path."}),Pu=ve.object({pathTemplate:br,content:ve.string(),role:ve.string().min(1).optional()}).strict(),vu=ve.union([ve.object({kind:ve.literal("default")}).strict(),ve.object({kind:ve.literal("named"),name:ve.string().min(1)}).strict()]),Cu=ve.object({pathTemplate:br,export:vu}).strict(),Du=ve.array(ve.never()).optional(),Ut=ve.object({instanceBaseName:ve.string().min(1),files:ve.array(Pu).min(1).max(Ni),entry:Cu,dataRequirements:Du}).strict().superRefine((e,n)=>{let s=new Set,i=e.entry.pathTemplate,o=0;for(let[a,c]of e.files.entries()){s.has(c.pathTemplate)&&n.addIssue({code:"custom",path:["files",a,"pathTemplate"],message:`Duplicate materialization pathTemplate: ${c.pathTemplate}`}),s.add(c.pathTemplate);let r=new TextEncoder().encode(c.content).length;r>ku&&n.addIssue({code:"custom",path:["files",a,"content"],message:"Materialization file content exceeds the per-file byte limit."}),o+=r}s.has(i)||n.addIssue({code:"custom",path:["entry","pathTemplate"],message:"Materialization entry pathTemplate must match a file."}),o>ji&&n.addIssue({code:"custom",path:["files"],message:"Materialization exceeds the total content byte limit."})});var yr="insertNewComponent",U0={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=Z.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),xr=Z.lazy(()=>Z.object({id:Z.string().uuid(),key:Z.string().min(1),name:Z.string(),children:Z.array(xr)}).strict()),Er=Z.object({category_group_key:Z.literal(yr),categories:Z.array(xr)}).strict(),Ou=Z.object({resource_id:Z.string().min(1),name:Z.string(),description:Z.string().nullable(),thumbnail_url:Z.string().nullable(),resolved_version:Li,category_id:Z.string().uuid().nullable()}).strict(),Rr=Z.object({category_group_key:Z.literal(yr),items:Z.array(Ou),next_cursor:Z.string().min(1).nullable()}).strict(),F0=Z.object({resource_id:Z.string().min(1),resolved_version:Li,anchor_block_id:Z.string().min(1),placement:Z.enum(["before","after"])}).strict(),G0=Z.object({status:Z.literal("mock_acknowledged")}).strict(),q0=Z.object({category_id:Z.string().uuid().optional(),include_descendants:Z.enum(["true","false"]).optional().transform(e=>e==="true"),limit:Z.coerce.number().int().min(1).max(100).optional().default(20),cursor:Z.string().min(1).optional()}).strict().superRefine((e,n)=>{e.include_descendants&&!e.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),Ft=Li,W0=Z.object({version:Ft}).strict(),Ir=Z.object({resource_id:Z.string().min(1),resolved_version:Ft,revision_id:Z.string().uuid().optional(),digest_sha256:Z.string().regex(/^[a-f0-9]{64}$/),materialization:Ut}).strict();import{z as E}from"zod";import{z as h}from"zod";var Ar="/",wr=255,Nu=2048,ju=5e3,Lu=64;function Pr(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 Gt=h.string().min(1).max(wr).refine(Pr,"url_path must be a safe site-relative path"),Fi=h.string().min(1).max(Nu).refine(Pr,"url must be a safe site-relative path"),Gi=h.string().max(wr),Ts=h.preprocess(e=>e===0?!1:e===1?!0:e,h.boolean()),Cn=h.union([h.url(),Fi]),qi=h.enum(["landing_page","general_page","detail_page"]),Wi=h.enum([...qi.options,"list_page","category_page","tag_page","author_page","search_page","date_page"]);function H0(e){return e.vcp_managed&&e.url!==null&&qi.safeParse(e.page_type).success&&Gt.safeParse(e.url_path).success}function Tr(e){return e.includes("{")||e.includes("}")}function V0(e){if(!Tr(e.url_path))return Mu(e.url_path);if(e.url===null)return null;let n=/^[a-z][a-z0-9+.-]*:\/\//iu.test(e.url)?Uu(e.url):e.url;if(n===null||Tr(n))return null;let s=Fi.safeParse(n);return s.success?s.data:null}function Mu(e){let n=Gt.safeParse(e);return n.success?n.data:null}function Uu(e){try{return new URL(e).pathname}catch{return null}}var vr=h.lazy(()=>h.object({cms_page_id:h.number().int().positive(),title:h.string().trim().min(1).max(255),url_path:Gi,url:Cn.nullable(),page_type:Wi,vcp_managed:Ts,children:h.array(vr)}).strict()),Fu=h.object({group_id:h.string().min(1),title:h.string().trim().min(1).max(255),collection_slug:h.string(),pages:h.array(vr)}).strict(),kr=h.object({groups:h.array(Fu)}).strict(),Cr=h.lazy(()=>h.object({id:h.number().int().positive(),title:h.string().trim().min(1).max(120),url_path:Gi,parent_id:h.number().int().nonnegative(),group_type:h.string().min(1),page_type:Wi,plugin_id:h.number().int().nonnegative(),is_default:Ts,is_published:Ts,url:Cn.nullable(),vcp_managed:Ts,children:h.array(Cr)})),Gu=h.object({plugin_id:h.number().int().nonnegative(),slug:h.string(),group_name:h.string().trim().min(1).max(255),pages:h.array(Cr)}).passthrough(),qu=h.array(Gu);function Dr(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=>Dr(n))}}function $0(e){if(!Wu(e))return null;let n=kr.safeParse(e);if(n.success)return n.data;let s=qu.safeParse(e);if(!s.success)return null;let i=kr.safeParse({groups:s.data.map(o=>({group_id:String(o.plugin_id),title:o.group_name,collection_slug:o.slug,pages:o.pages.map(Dr)}))});return i.success?i.data:null}function Wu(e){let n=Array.isArray(e)?e:Mi(e)&&Array.isArray(e.groups)?e.groups:[],s=[];for(let o of n)if(!(!Mi(o)||!Array.isArray(o.pages)))for(let a of o.pages)s.push({node:a,depth:1});let i=0;for(;s.length>0;){let o=s.pop();if(i+=1,i>ju||o.depth>Lu)return!1;if(!(!Mi(o.node)||!Array.isArray(o.node.children)))for(let a of o.node.children)s.push({node:a,depth:o.depth+1})}return!0}function Mi(e){return typeof e=="object"&&e!==null}var Ku=h.enum(["invalid_url_path","missing_url","not_vcp_managed","unsupported_page_type","page_not_generated"]),Bu=h.enum(["home_page","invalid_url_path","not_selectable","not_vcp_managed","page_has_children","last_selectable_page","cms_unbound","unsupported_page_type"]),Or=h.lazy(()=>h.object({cms_page_id:h.number().int().positive().nullable(),title:h.string().trim().min(1).max(255),url_path:Gi,preview_url_path:Fi.nullable(),url:Cn.nullable(),page_type:Wi,vcp_managed:h.boolean(),selectable:h.boolean(),disabled_reason:Ku.nullable(),can_delete:h.boolean(),delete_block_reason:Bu.nullable(),has_cms_children:h.boolean(),children:h.array(Or)}).strict()),Nr=h.object({group_id:h.string().min(1),title:h.string().trim().min(1).max(255),pages:h.array(Or)}).strict(),Y0=h.object({base_snapshot_id:k,expected_url_path:Gt}).strict(),zu=h.enum(["succeeded","failed"]),Hu=h.object({url_path:Gt,phase:h.enum(["ensure","binding","delete"]),code:h.string().min(1),message:h.string().min(1)}).strict(),Ki=h.object({status:zu,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(Hu),warnings:h.array(h.string().min(1))}).strict(),Vu=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:Ki}).strict(),X0=h.object({code:h.literal(0),message:h.string(),data:Vu}).strict(),Q0=h.object({snapshot_id:k}).strict(),$u=h.object({snapshot_id:k,warnings:h.array(h.string().min(1)),cms_reconcile_result:Ki}).strict(),Z0=h.object({code:h.literal(0),message:h.string(),data:$u}).strict(),J0=h.object({source_committed:h.boolean(),result_snapshot_id:k.optional(),cms_reconcile_result:Ki.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"})}),Yu=qi,Xu=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(),jr=h.object({url_path:Gt,title:h.string().trim().min(1).max(255),kind:Yu,route_file:h.string().min(1),collection_id:h.string().trim().min(1).optional(),seo:Xu.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===Ar)&&n.addIssue({code:"custom",path:["kind"],message:"The home target must be the only landing_page target."})}),Qu=h.object({complete:h.literal(!0),targets:h.array(jr)}).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(i=>i.url_path===Ar).length!==1&&n.addIssue({code:"custom",path:["targets"],message:"A complete page target set must contain exactly one home page."})}),eA=h.discriminatedUnion("complete",[Qu,h.object({complete:h.literal(!1),targets:h.array(jr),errors:h.array(h.string().min(1)).min(1)}).strict()]),Ui=h.string().regex(/^sha256:[0-9a-f]{64}$/),tA=h.object({projection_hash:Ui.nullable()}).strict(),nA=h.object({expected_projection_hash:Ui.nullable(),projection_hash:Ui}).strict(),sA=h.object({clean_snapshot_id:h.string().uuid().nullable()}).strict(),iA=h.object({clean_snapshot_id:h.string().uuid()}).strict();var Lr="insertNewPage",lA={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"},qt=E.enum(["page","pages"]),Zu=E.object({resource_id:E.string().min(1),resource_type:qt,resolved_version:Ft,template_page_id:E.string().min(1)}).strict(),Mr=E.lazy(()=>E.object({id:E.string().uuid(),key:E.string().min(1),name:E.string(),children:E.array(Mr)}).strict()),Ur=E.object({category_group_key:E.literal(Lr),categories:E.array(Mr)}).strict(),Ju=E.object({resource_id:E.string().min(1),resource_type:qt,name:E.string(),description:E.string().nullable(),thumbnail_url:E.string().nullable(),preview_images:E.array(E.object({url:E.string().min(1),page_id:E.string().min(1).nullable(),is_primary:E.boolean()}).strict()).optional(),resolved_version:Ft,category_id:E.string().uuid().nullable()}).strict(),Fr=E.object({category_group_key:E.literal(Lr),items:E.array(Ju),next_cursor:E.string().min(1).nullable()}).strict(),pA=E.object({category_id:E.string().uuid().optional(),include_descendants:E.enum(["true","false"]).optional().transform(e=>e==="true"),limit:E.coerce.number().int().min(1).max(100).optional().default(20),cursor:E.string().min(1).optional()}).strict().superRefine((e,n)=>{e.include_descendants&&!e.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),Dn=Ft,ks=E.string().regex(/^\/[a-z0-9]+(?:-[a-z0-9]+)*$/),dA=E.string().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),e_=E.object({template_page_id:E.string().min(1),title:E.string().trim().min(1).max(120),final_route:ks}).strict(),t_=E.object({template_page_id:E.string().min(1),title:E.string().trim().min(1).max(120),source:Zu.optional(),blocks:E.array(E.discriminatedUnion("kind",[E.object({kind:E.literal("package-component"),instance_id:E.string().min(1),component_id:E.string().min(1),label:E.string().trim().min(1).max(120)}).strict(),E.object({kind:E.literal("component-resource"),instance_id:E.string().min(1),resource_id:E.string().min(1),resolved_version:Ft,label:E.string().trim().min(1).max(120)}).strict()])).optional(),route:E.object({input:E.string(),append_random_suffix:E.boolean().optional(),random_suffix_length:E.number().int().min(4).max(16).optional(),final:ks}).strict()}).strict(),n_=E.object({resource_id:E.string().min(1),resource_type:qt,resolved_version:Dn,pages:E.array(t_).min(1)}).strict().superRefine((e,n)=>{Et(e.pages.map(s=>s.template_page_id),"pages",n),Et(e.pages.map(s=>s.route.final),"routes",n);for(let[s,i]of e.pages.entries()){if(!i.blocks)continue;let o=new Set;for(let[a,c]of i.blocks.entries())o.has(c.instance_id)&&n.addIssue({code:"custom",path:["pages",s,"blocks",a,"instance_id"],message:`Duplicate block instance identifier within page: ${c.instance_id}`}),o.add(c.instance_id)}});function Bi(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 Et(e,n,s){let i=new Set;for(let[o,a]of e.entries())i.has(a)&&s.addIssue({code:"custom",path:[n,o],message:`Duplicate ${n} identifier: ${a}`}),i.add(a)}var uA=E.object({resource_type:qt,version:Dn,pages:E.array(e_).min(1)}).strict().superRefine((e,n)=>{Bi(e,n),Et(e.pages.map(s=>s.template_page_id),"pages",n),Et(e.pages.map(s=>s.final_route),"routes",n)}),s_=E.object({instance_id:E.string().min(1),component_id:E.string().min(1)}).strict(),i_=E.object({component_id:E.string().min(1),materialization:Ut}).strict(),o_=E.object({template_page_id:E.string().min(1),title:E.string().trim().min(1).max(120),final_route:ks,materialization:Ut,components:E.array(s_)}).strict(),zi=E.object({resource_id:E.string().min(1),resource_type:qt,resolved_version:Dn,revision_id:E.string().uuid().optional(),digest_sha256:E.string().regex(/^[a-f0-9]{64}$/),components:E.array(i_),pages:E.array(o_).min(1),project_dependencies:E.record(E.string(),E.never()).optional()}).strict().superRefine((e,n)=>{Bi(e,n);let s=e.components.map(o=>o.component_id),i=new Set(s);Et(s,"components",n),Et(e.pages.map(o=>o.template_page_id),"pages",n),Et(e.pages.map(o=>o.final_route),"routes",n);for(let[o,a]of e.pages.entries()){let c=new Set;for(let[r,m]of a.components.entries())i.has(m.component_id)||n.addIssue({code:"custom",path:["pages",o,"components",r,"component_id"],message:`Unknown component reference: ${m.component_id}`}),c.has(m.instance_id)&&n.addIssue({code:"custom",path:["pages",o,"components",r,"instance_id"],message:`Duplicate component instance identifier within page: ${m.instance_id}`}),c.add(m.instance_id)}}),Gr=zi,qr=E.object({template_page_id:E.string().min(1),title:E.string().trim().min(1).max(120),final_route:ks,route_file_path:E.string().regex(/^app\/[a-z0-9]+(?:-[a-z0-9]+)*\/page\.tsx$/)}).strict(),a_=E.object({template_page_id:E.string().min(1),title:E.string().trim().min(1).max(120),composition_supported:E.boolean(),blocks:E.array(E.object({instance_id:E.string().min(1),component_id:E.string().min(1),label:E.string().trim().min(1).max(120)}).strict())}).strict(),Wr=E.object({resource_id:E.string().min(1),resource_type:qt,resolved_version:Dn,pages:E.array(a_).min(1)}).strict().superRefine((e,n)=>{Bi(e,n),Et(e.pages.map(s=>s.template_page_id),"pages",n)}),_A=E.object({resource_type:qt,version:Dn}).strict(),gA=E.object({draft:n_}).strict(),Kr=E.object({groups:E.array(Nr)}).strict(),Br=E.object({candidate:E.record(E.string(),E.unknown())}).strict();var Zt="[a-z0-9]+(?:-[a-z0-9]+)*",On=new RegExp(`^/(?:${Zt}(?:/${Zt})*)?$`),zr=["/privacy","/cookie-policy","/system/not-found"],r_=zr.map(e=>`app/${e.slice(1)}/page.tsx`);function c_(e){return e.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Hr(e){return typeof e=="string"&&On.test(e)}function Vr(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 i=s.split("/");if(i.some(r=>r==="."||r===".."))return null;let o=s.toLowerCase();if(o==="index"||o==="home")return"/";let a=i.map(c_).filter(r=>r.length>0);if(a.length===0)return null;let c=`/${a.join("/")}`;return Hr(c)?c:null}function $r(e){let n=Vr(e);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function m_(e){let n=$r(e);return n==="/"?"app/page.tsx":`app/${n.slice(1)}/page.tsx`}import{z as ae}from"zod";import{z as u}from"zod";import{z as Oe}from"zod";var l_=Oe.object({code:Oe.string().min(1),message:Oe.string().min(1),details:Oe.record(Oe.string(),Oe.unknown()).optional()}),yA=Oe.object({code:Oe.string().min(1),message:Oe.string().min(1)});function Hi(e){return Oe.object({ok:Oe.literal(!0),composition:B,data:e}).strict()}function p_(e){let n={ok:Oe.literal(!1),composition:B,error:l_.extend({code:e.codeSchema})};return e.currentSchema&&(n.current=e.currentSchema.optional()),e.diagnosticsSchema&&(n.diagnostics=Oe.array(e.diagnosticsSchema).optional()),e.dataSchema&&(n.data=e.dataSchema.optional()),Oe.object(n).strict()}function Yr(e){return Oe.discriminatedUnion("ok",[Hi(e.dataSchema),p_({codeSchema:e.codeSchema,currentSchema:e.currentSchema,diagnosticsSchema:e.diagnosticsSchema,dataSchema:e.failureDataSchema})])}import{z as te}from"zod";var pt=te.object({start:te.number().int().nonnegative(),end:te.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"})}),d_=te.object({code:te.enum(["missing-class-name","unsupported-attribute-name","source-locator-warning","invalid-new-attr","version-conflict","write-failed"]),message:te.string().min(1)}),Xr=te.object({path:te.string().min(1),content:te.string(),hash:te.string().min(1).optional()}),TA=te.object({composition:B,revision:te.string().min(1),entryCss:Xr,stylesheets:te.array(Xr).default([])}).strict(),kA=te.object({composition:_e}).strict(),AA=te.object({key:te.string().min(1),composition:_e}).strict(),Qr=te.object({key:te.string().min(1),composition:B,filePath:te.string().min(1),componentName:te.string().min(1),sourceKind:te.enum(["missing","stringLiteral","expression"]),attrRaw:te.string().min(1).nullable(),valueRaw:te.string().min(1).nullable(),attrRange:pt.nullable(),openingElementRange:pt,version:te.object({documentVersion:te.number().int().nonnegative(),contentHash:te.string().min(1)}),diagnostics:te.array(d_),computedStyle:te.record(te.string(),te.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"})}),wA=Qr,PA=Hi(Qr),Vi=te.object({source:te.enum(["style-panel","class-source-editor"]),operation:te.enum(["replace-static-classname","replace-expression","create-attribute","remove-attribute"])});import{z as st}from"zod";var u_=new Set(["children","key","ref","dangerouslysetinnerhtml"]),__=new Set(["data-designer-hover-outline","data-designer-select-outline"]),g_=/^[A-Za-z_$][A-Za-z0-9_$:-]*$/u;function h_(e){return{code:"protected-attribute",message:`Property is protected from generic site editing: ${e}`}}function S_(){return{code:"invalid-attribute-name",message:"Property name must be a valid single JSX attribute name"}}function f_(e){let n=e.toLowerCase();return u_.has(n)||n.startsWith("data-vcp-")||__.has(n)||/^on[a-z]/iu.test(e)}function $i(e){if(!g_.test(e))return{owner:"blocked",name:e,diagnostic:S_()};if(f_(e))return{owner:"blocked",name:e,diagnostic:h_(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 dt}from"zod";var Wt=dt.lazy(()=>dt.union([dt.string(),dt.number().finite(),dt.boolean(),dt.null(),dt.array(Wt),dt.record(dt.string(),Wt)]));var Zr=st.string().min(1),b_=st.discriminatedUnion("operation",[st.object({operation:st.literal("set"),name:Zr,value:Wt}).strict(),st.object({operation:st.literal("remove"),name:Zr}).strict()]).superRefine((e,n)=>{let s=$i(e.name);s.owner==="blocked"&&n.addIssue({code:"custom",path:["name"],message:s.diagnostic?.message??"Property is not available for site editing"})}),Jr=st.object({kind:st.literal("set-props"),scope:st.enum(["selection","template"]),changes:st.array(b_).min(1)}).strict().superRefine((e,n)=>{let s=new Map;for(let[i,o]of e.changes.entries()){let a=$i(o.name),c=y_(a),r=s.get(c);r!==void 0?n.addIssue({code:"custom",path:["changes",i,"name"],message:`Duplicate property change; first declared at index ${r}`}):s.set(c,i)}});function y_(e){return e.owner==="class-name-source"||e.owner==="style"?`owner:${e.owner}`:`name:${e.name}`}import{z as x_}from"zod";var ec=x_.enum(["src","alt","poster","href","width","height"]);import{z as Jt}from"zod";var Nn=Jt.object({editingSessionId:Jt.string().min(1),lockId:Jt.string().min(1),ownerId:Jt.string().min(1),leaseAssertion:Jt.string().min(1)}).strict(),qA="signed-designer-mutations-v1",WA=Jt.object({mutationContext:Nn}).strict();import{z as d}from"zod";import{z as jn}from"zod";var As="::",Yi=jn.object({file:jn.string().min(1),component:jn.string().min(1),structuralPath:jn.string().min(1),key:jn.string().min(1)}).superRefine((e,n)=>{let s=E_(e.file,e.component,e.structuralPath);e.key!==s&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function E_(e,n,s){return`${e}${As}${n}${As}${s}`}function zA(e){let[n,s,...i]=e.split(As);return!n||!s||i.length===0?null:{file:n,component:s,structuralPath:i.join(As)}}var ws=d.enum(["VERSION_STALE","RECOVERY_REQUIRED","MULTIPLE_PAGE_RETURNS","INDIRECT_RETURN_ONLY","PAGE_CONTAINER_AMBIGUOUS","NO_SAFE_PAGE_PLACEMENT","MEMBER_NOT_INDEPENDENT","UNSUPPORTED_ROUTE_STRUCTURE","RUNTIME_ANCHOR_UNRESOLVED","ROUTE_RETURN_NOT_FOUND"]),Ln=d.object({code:d.string().min(1),message:d.string().min(1)}).strict(),R_=d.union([d.object({kind:d.literal("virtual-route-root"),key:d.string().min(1)}).strict(),d.object({kind:d.literal("jsx-container"),key:d.string().min(1),sourceMemberKey:d.string().min(1),sourceFile:d.string().min(1),componentName:d.string().min(1).optional()}).strict(),d.object({kind:d.literal("starter-placeholder"),key:d.string().min(1),sourceFile:d.string().min(1).optional()}).strict()]),I_=d.object({key:d.string().min(1),kind:d.enum(["jsx-element","jsx-fragment","jsx-expression","null-return","starter-placeholder"]),containerKey:d.string().min(1),label:d.string().min(1),sourceFile:d.string().min(1).optional(),isAtomic:d.boolean()}).strict(),T_=d.object({key:d.string().min(1),sourceMemberKey:d.string().min(1),containerKey:d.string().min(1),label:d.string().min(1),isIndependent:d.boolean()}).strict(),k_=d.object({key:d.string().min(1),containerKey:d.string().min(1),businessMemberKeys:d.array(d.string().min(1)),isMultiMember:d.boolean()}).strict(),nc=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:_e}).strict(),A_=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:B,placementUnitKey:d.string().min(1),relation:d.enum(["before","after","prepend","append"])}).strict(),sc=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:_e,placementUnitKey:d.string().min(1),relation:d.enum(["before","after","prepend","append"])}).strict(),ic=d.object({kind:d.literal("page-unit"),composition:_e,placementUnitKey:d.string().min(1)}).strict(),oc=d.object({kind:d.literal("page-unit"),composition:B,placementUnitKey:d.string().min(1)}).strict();function ut(e,n,s,i,o){let a=new Set;for(let[c,r]of e.entries()){let m=i(r);a.has(m)&&n.addIssue({code:"custom",path:[s,c,o],message:`Duplicate ${s} key: ${m}`}),a.add(m)}}var w_=d.object({status:d.literal("supported"),version:d.number().int().nonnegative(),composition:B,container:R_,sourceMembers:d.array(I_),businessMembers:d.array(T_),placementUnits:d.array(k_),placements:d.array(A_)}).strict().superRefine((e,n)=>{ut(e.sourceMembers,n,"sourceMembers",r=>r.key,"key"),ut(e.businessMembers,n,"businessMembers",r=>r.key,"key"),ut(e.placementUnits,n,"placementUnits",r=>r.key,"key"),ut(e.placements,n,"placements",r=>r.placementKey,"placementKey");let s=new Set(e.sourceMembers.map(r=>r.key)),i=new Set(e.placementUnits.map(r=>r.key)),o=new Map(e.sourceMembers.map(r=>[r.key,r])),a=new Map(e.businessMembers.map(r=>[r.key,r]));for(let[r,m]of e.sourceMembers.entries()){m.containerKey!==e.container.key&&!s.has(m.containerKey)&&n.addIssue({code:"custom",path:["sourceMembers",r,"containerKey"],message:"Source member parent must reference the page container or another source member."}),m.containerKey===m.key&&n.addIssue({code:"custom",path:["sourceMembers",r,"containerKey"],message:"Source member cannot contain itself."});let S=new Set([m.key]),g=m.containerKey;for(;g!==e.container.key;){if(S.has(g)){n.addIssue({code:"custom",path:["sourceMembers",r,"containerKey"],message:"Source member hierarchy must be acyclic."});break}S.add(g);let w=o.get(g);if(!w)break;g=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[r,m]of e.businessMembers.entries())s.has(m.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",r,"sourceMemberKey"],message:"Business member must reference a source member."}),i.has(m.containerKey)||n.addIssue({code:"custom",path:["businessMembers",r,"containerKey"],message:"Business member must reference a placement unit container."});for(let[r,m]of e.placementUnits.entries()){let S=o.get(m.containerKey);S?S.containerKey!==e.container.key&&n.addIssue({code:"custom",path:["placementUnits",r,"containerKey"],message:"Placement unit must reference a direct child of the page container."}):n.addIssue({code:"custom",path:["placementUnits",r,"containerKey"],message:"Placement unit containerKey must reference a source member."});let g=new Set;for(let[w,K]of m.businessMemberKeys.entries()){let H=a.get(K);if(!H){n.addIssue({code:"custom",path:["placementUnits",r,"businessMemberKeys",w],message:"Placement unit must reference existing business members."});continue}g.has(K)&&n.addIssue({code:"custom",path:["placementUnits",r,"businessMemberKeys",w],message:"Placement unit cannot reference the same business member twice."}),g.add(K),H.containerKey!==m.key&&n.addIssue({code:"custom",path:["placementUnits",r,"businessMemberKeys",w],message:"Business member containerKey must match its placement unit."});let ie=H.sourceMemberKey,Se=new Set;for(;ie&&ie!==m.containerKey&&!Se.has(ie);)Se.add(ie),ie=o.get(ie)?.containerKey;ie!==m.containerKey&&n.addIssue({code:"custom",path:["placementUnits",r,"businessMemberKeys",w],message:"Placement unit business members must belong to its source subtree."})}}for(let[r,m]of e.businessMembers.entries())e.placementUnits.find(g=>g.key===m.containerKey)?.businessMemberKeys.includes(m.key)||n.addIssue({code:"custom",path:["businessMembers",r,"containerKey"],message:"Business member must be listed by its placement unit container."});let c=new Map;for(let r of e.placementUnits)c.set(r.containerKey,(c.get(r.containerKey)??0)+1);for(let[r,m]of e.sourceMembers.entries())m.containerKey===e.container.key&&c.get(m.key)!==1&&n.addIssue({code:"custom",path:["sourceMembers",r,"key"],message:"Every direct source member must be owned by exactly one placement unit."});for(let[r,m]of e.placements.entries())cc(m.composition,e.composition)||n.addIssue({code:"custom",path:["placements",r,"composition"],message:"Page placement composition must match page composition."}),m.documentVersion!==e.version&&n.addIssue({code:"custom",path:["placements",r,"documentVersion"],message:"Page placement version must match page composition version."}),i.has(m.placementUnitKey)||n.addIssue({code:"custom",path:["placements",r,"placementUnitKey"],message:"Placement option must reference an existing placement unit."})}),P_=d.object({status:d.literal("unsupported"),version:d.number().int().nonnegative(),composition:B,reason:ws,diagnostics:d.array(Ln)}).strict(),v_=d.discriminatedUnion("status",[w_,P_]),ac=2,XA="page-composition-v2",rc=d.object({start:d.number().int().nonnegative(),end:d.number().int().nonnegative(),startLine:d.number().int().positive().optional(),startColumn:d.number().int().nonnegative().optional(),endLine:d.number().int().positive().optional(),endColumn:d.number().int().nonnegative().optional()}).strict().superRefine((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],i=s.some(a=>a!==void 0),o=s.every(a=>a!==void 0);i&&!o&&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."})}),C_=d.object({key:d.string().min(1),instanceIndex:d.number().int().nonnegative().optional(),instanceCount:d.number().int().positive().optional(),textSegmentIndex:d.number().int().nonnegative().optional()}).strict().superRefine((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."})}),D_=d.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),O_=d.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),N_=d.discriminatedUnion("kind",[d.object({kind:d.literal("virtual-route-root"),key:d.null(),routeReturn:d.object({sourceIdentity:Yi,sourceRange:rc}).strict()}).strict(),d.object({kind:d.literal("jsx-container"),key:d.string().min(1),sourceMemberKey:d.string().min(1)}).strict(),d.object({kind:d.literal("starter-placeholder"),key:d.string().min(1),sourceMemberKey:d.string().min(1),replacementMode:d.literal("replace")}).strict()]),j_=d.object({key:d.string().min(1),kind:D_,parentKey:d.string().min(1).nullable(),childKeys:d.array(d.string().min(1)),order:d.number().int().nonnegative(),label:d.string().min(1),sourceIdentity:Yi,sourceRange:rc.nullable(),atomicKind:O_}).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 i=new Set;for(let[o,a]of e.childKeys.entries())i.has(a)&&n.addIssue({code:"custom",path:["childKeys",o],message:`Duplicate child source member key: ${a}`}),i.add(a)}),L_=d.object({key:d.string().min(1),sourceMemberKey:d.string().min(1),placementUnitKey:d.string().min(1),label:d.string().min(1),isIndependent:d.boolean()}).strict(),M_=d.enum(["independent","atomic","container"]),U_=d.object({key:d.string().min(1),containerKey:d.string().min(1).nullable(),sourceMemberKeys:d.array(d.string().min(1)).min(1),businessMemberKeys:d.array(d.string().min(1)),order:d.number().int().nonnegative(),boundaryMode:M_,isIndependent:d.boolean(),isMultiMember:d.boolean()}).strict().superRefine((e,n)=>{tc(e.sourceMemberKeys,n,"sourceMemberKeys","source member"),tc(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 i=e.boundaryMode==="independent";e.isIndependent!==i&&n.addIssue({code:"custom",path:["isIndependent"],message:"isIndependent must match boundaryMode."})}),F_=d.enum(["before","after","prepend","append","replace"]),G_=d.enum(["insert-sibling","insert-child","replace-placeholder"]),q_=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:B,placementUnitKey:d.string().min(1),containerKey:d.string().min(1).nullable(),relation:F_,writeMode:G_}).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}.`})}),W_=d.object({key:d.string().min(1),placementUnitKey:d.string().min(1),runtimeRefs:d.array(C_).min(1)}).strict(),K_=d.object({schemaVersion:d.literal(ac),status:d.literal("supported"),version:d.number().int().nonnegative(),composition:B,container:N_,sourceMembers:d.array(j_),businessMembers:d.array(L_),placementUnits:d.array(U_),placements:d.array(q_),visualAnchors:d.array(W_).optional(),diagnostics:d.array(Ln)}).strict().superRefine((e,n)=>{H_(e,n)}),B_=d.object({schemaVersion:d.literal(ac),status:d.literal("unsupported"),version:d.number().int().nonnegative(),composition:B,reason:ws,diagnostics:d.array(Ln)}).strict(),z_=d.discriminatedUnion("status",[K_,B_]),QA=d.union([z_,v_]);function tc(e,n,s,i){let o=new Set;for(let[a,c]of e.entries())o.has(c)&&n.addIssue({code:"custom",path:[s,a],message:`Duplicate ${i} key: ${c}`}),o.add(c)}function cc(e,n){return Ii(e)===Ii(n)}function H_(e,n){ut(e.sourceMembers,n,"sourceMembers",g=>g.key,"key"),ut(e.businessMembers,n,"businessMembers",g=>g.key,"key"),ut(e.placementUnits,n,"placementUnits",g=>g.key,"key"),ut(e.placements,n,"placements",g=>g.placementKey,"placementKey"),ut(e.visualAnchors??[],n,"visualAnchors",g=>g.key,"key"),V_(e,n);let s=new Map(e.sourceMembers.map(g=>[g.key,g])),i=new Map(e.businessMembers.map(g=>[g.key,g])),o=new Map(e.placementUnits.map(g=>[g.key,g]));$_(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 a=new Map,c=new Map,r=new Set;for(let[g,w]of e.placementUnits.entries()){w.containerKey!==e.container.key&&n.addIssue({code:"custom",path:["placementUnits",g,"containerKey"],message:"Placement unit containerKey must match the page container."});let K=`${w.containerKey??"<virtual>"}:${w.order}`;r.has(K)&&n.addIssue({code:"custom",path:["placementUnits",g,"order"],message:"Placement unit order must be unique within its container."}),r.add(K);for(let[H,ie]of w.sourceMemberKeys.entries()){s.has(ie)||n.addIssue({code:"custom",path:["placementUnits",g,"sourceMemberKeys",H],message:"Placement unit must reference existing source members."});let Se=a.get(ie);Se&&Se!==w.key&&n.addIssue({code:"custom",path:["placementUnits",g,"sourceMemberKeys",H],message:`Source member is already assigned to ${Se}.`}),a.set(ie,w.key)}for(let[H,ie]of w.businessMemberKeys.entries()){let Se=i.get(ie);if(!Se){n.addIssue({code:"custom",path:["placementUnits",g,"businessMemberKeys",H],message:"Placement unit must reference existing business members."});continue}Se.placementUnitKey!==w.key&&n.addIssue({code:"custom",path:["placementUnits",g,"businessMemberKeys",H],message:"Placement unit and business member must reference each other."}),w.sourceMemberKeys.includes(Se.sourceMemberKey)||n.addIssue({code:"custom",path:["placementUnits",g,"businessMemberKeys",H],message:"Business member sourceMemberKey must belong to the placement unit."});let yn=c.get(ie);yn&&yn!==w.key&&n.addIssue({code:"custom",path:["placementUnits",g,"businessMemberKeys",H],message:`Business member is already assigned to ${yn}.`}),c.set(ie,w.key)}}for(let[g,w]of e.businessMembers.entries()){s.has(w.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",g,"sourceMemberKey"],message:"Business member must reference a source member."});let K=o.get(w.placementUnitKey);if(!K){n.addIssue({code:"custom",path:["businessMembers",g,"placementUnitKey"],message:"Business member must reference a placement unit."});continue}K.businessMemberKeys.includes(w.key)||n.addIssue({code:"custom",path:["businessMembers",g,"placementUnitKey"],message:"Business member and placement unit must reference each other."}),K.sourceMemberKeys.includes(w.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",g,"sourceMemberKey"],message:"Business member sourceMemberKey must belong to its placement unit."});let H=K.isIndependent&&K.businessMemberKeys.length===1;w.isIndependent!==H&&n.addIssue({code:"custom",path:["businessMembers",g,"isIndependent"],message:"Business member independence must match its placement unit boundary."})}let m=new Set;for(let[g,w]of e.placements.entries()){w.documentVersion!==e.version&&n.addIssue({code:"custom",path:["placements",g,"documentVersion"],message:"Page placement version must match page composition version."}),cc(w.composition,e.composition)||n.addIssue({code:"custom",path:["placements",g,"composition"],message:"Page placement composition must match page composition."});let K=o.get(w.placementUnitKey);K?w.containerKey!==K.containerKey&&n.addIssue({code:"custom",path:["placements",g,"containerKey"],message:"Placement containerKey must match its placement unit."}):n.addIssue({code:"custom",path:["placements",g,"placementUnitKey"],message:"Placement option must reference a placement unit."});let H=`${w.placementUnitKey}:${w.relation}`;m.has(H)&&n.addIssue({code:"custom",path:["placements",g,"relation"],message:"A placement unit cannot expose the same relation more than once."}),m.add(H),w.relation==="replace"&&e.container.kind!=="starter-placeholder"&&n.addIssue({code:"custom",path:["placements",g,"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",g,"relation"],message:"Starter placeholder placements must use replace."})}let S=new Set;for(let[g,w]of(e.visualAnchors??[]).entries())o.has(w.placementUnitKey)||n.addIssue({code:"custom",path:["visualAnchors",g,"placementUnitKey"],message:"Visual anchor must reference a placement unit."}),S.has(w.placementUnitKey)&&n.addIssue({code:"custom",path:["visualAnchors",g,"placementUnitKey"],message:"A placement unit may expose only one visual anchor."}),S.add(w.placementUnitKey)}function V_(e,n){let s=[];e.container.key!==null&&s.push({key:e.container.key,path:["container","key"],namespace:"container"});for(let[o,a]of e.sourceMembers.entries())s.push({key:a.key,path:["sourceMembers",o,"key"],namespace:"source member"});for(let[o,a]of e.businessMembers.entries())s.push({key:a.key,path:["businessMembers",o,"key"],namespace:"business member"});for(let[o,a]of e.placementUnits.entries())s.push({key:a.key,path:["placementUnits",o,"key"],namespace:"placement unit"});for(let[o,a]of(e.visualAnchors??[]).entries())s.push({key:a.key,path:["visualAnchors",o,"key"],namespace:"visual anchor"});let i=new Map;for(let o of s){let a=i.get(o.key);a?n.addIssue({code:"custom",path:o.path,message:`${o.namespace} key collides with ${a}: ${o.key}`}):i.set(o.key,o.namespace)}}function $_(e,n,s){let i=new Set;for(let[o,a]of e.sourceMembers.entries()){let c=`${a.parentKey??"<root>"}:${a.order}`;if(i.has(c)&&s.addIssue({code:"custom",path:["sourceMembers",o,"order"],message:"Source member order must be unique among siblings."}),i.add(c),a.parentKey===a.key&&s.addIssue({code:"custom",path:["sourceMembers",o,"parentKey"],message:"Source member cannot be its own parent."}),a.parentKey!==null){let S=n.get(a.parentKey);S?S.childKeys.includes(a.key)||s.addIssue({code:"custom",path:["sourceMembers",o,"parentKey"],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",o,"parentKey"],message:"Source member parentKey must reference a source member."})}for(let[S,g]of a.childKeys.entries()){if(g===a.key){s.addIssue({code:"custom",path:["sourceMembers",o,"childKeys",S],message:"Source member cannot be its own child."});continue}let w=n.get(g);w?w.parentKey!==a.key&&s.addIssue({code:"custom",path:["sourceMembers",o,"childKeys",S],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",o,"childKeys",S],message:"Source child key must reference a source member."})}let r=new Set,m=a;for(;m;){if(r.has(m.key)){s.addIssue({code:"custom",path:["sourceMembers",o,"parentKey"],message:"Source member graph must be acyclic."});break}r.add(m.key),m=m.parentKey===null?void 0:n.get(m.parentKey)}}}var Mn=u.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"]),Y_=u.discriminatedUnion("kind",[u.object({kind:u.literal("node"),key:u.string().min(1)}).strict(),ic,u.object({kind:u.literal("route"),composition:_e}).strict(),u.object({kind:u.literal("source-file"),path:xe}).strict(),u.object({kind:u.literal("source-batch"),paths:u.array(xe).min(1)}).superRefine((e,n)=>{let s=new Set;for(let[i,o]of e.paths.entries())s.has(o)&&n.addIssue({code:"custom",path:["paths",i],message:`Duplicate source target path: ${o}`}),s.add(o)}).strict(),u.object({kind:u.literal("project")}).strict()]),X_=u.discriminatedUnion("kind",[u.object({kind:u.literal("node"),key:u.string().min(1)}).strict(),oc,u.object({kind:u.literal("route"),composition:B}).strict(),u.object({kind:u.literal("source-file"),path:xe}).strict(),u.object({kind:u.literal("source-batch"),paths:u.array(xe).min(1)}).strict(),u.object({kind:u.literal("project")}).strict()]),lc=u.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"]),pc=u.enum(["hover","active","focus","disabled"]),dc=u.enum(["sm","md","lg","xl","2xl"]),mc=u.union([u.object({relation:u.enum(["before","after"]),anchorKey:u.string().min(1),parentKey:u.string().min(1)}),u.object({relation:u.enum(["prepend","append"]),parentKey:u.string().min(1)}),sc]),uc=u.object({kind:u.literal("component-call"),component:u.never().optional(),materialization:Ut,props:u.record(u.string(),u.never()).optional()}).strict(),Q_=u.union([u.object({kind:u.literal("native-tag"),tag:u.string().min(1),text:u.string().optional()}),u.object({kind:u.literal("component-call"),component:u.object({source:u.string().min(1),exportName:u.string().min(1)}),materialization:u.never().optional(),props:u.record(u.string(),u.unknown()).optional()}).strict(),uc]),Z_=u.discriminatedUnion("kind",[u.object({kind:u.literal("update-text"),segmentIndex:u.number().int().min(0),value:u.string()}),u.object({kind:u.literal("update-array-item"),segmentIndex:u.number().int().min(0),index:u.number().int().min(0),value:u.string()}),u.object({kind:u.literal("remove-node")}),u.object({kind:u.literal("insert-child"),node:Q_,position:u.union([mc,nc])}),u.object({kind:u.literal("replace-node"),node:uc}),u.object({kind:u.literal("move-node"),target:mc,preserveBindings:u.boolean().optional()}),u.object({kind:u.literal("set-class-name-source"),filePath:u.string().min(1),expectedVersion:u.object({documentVersion:u.number().int().nonnegative(),contentHash:u.string().min(1)}),oldAttrRaw:u.string().min(1).nullable(),oldAttrRange:pt.nullable(),openingElementRange:pt,newAttrRaw:u.string().min(1).nullable(),intent:Vi}),Jr,u.object({kind:u.literal("apply-style-draft"),className:u.object({filePath:u.string().min(1),expectedVersion:u.object({documentVersion:u.number().int().nonnegative(),contentHash:u.string().min(1)}),oldAttrRaw:u.string().min(1).nullable(),oldAttrRange:pt.nullable(),openingElementRange:pt,newAttrRaw:u.string().min(1).nullable(),intent:Vi}).optional(),props:u.partialRecord(ec,u.string()).optional()}).superRefine((e,n)=>{!e.className&&!e.props&&n.addIssue({code:"custom",message:"apply-style-draft requires className or props"})}),u.object({kind:u.literal("source-edit"),conflictPolicy:u.enum(["compare-and-swap","overwrite"]),edits:u.array(u.discriminatedUnion("operation",[u.object({operation:u.literal("upsert"),path:xe,content:u.string(),baseContentHash:u.string().min(1).nullable().optional()}).strict().superRefine((e,n)=>{ki(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"})}),u.object({operation:u.literal("delete"),path:xe,capability:ir,confirmDelete:u.literal(!0),confirmPath:xe,baseContentHash:u.string().min(1).nullable().optional()}).strict().superRefine((e,n)=>{e.capability!==Ti&&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"}),ki(e.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit delete only accepts allowlisted text source files"});let s=Ai(e.path);s&&n.addIssue({code:"custom",path:["path"],message:`Protected source file cannot be deleted: ${e.path} (${s})`})})])).min(1),reason:u.string().min(1).optional()}).strict().superRefine((e,n)=>{let s=new Set;for(let[i,o]of e.edits.entries())s.has(o.path)&&n.addIssue({code:"custom",path:["edits",i,"path"],message:`Duplicate source edit path: ${o.path}`}),s.add(o.path),e.conflictPolicy==="compare-and-swap"&&o.baseContentHash===void 0&&n.addIssue({code:"custom",path:["edits",i,"baseContentHash"],message:"source-edit compare-and-swap requires baseContentHash for every edit"})}),u.object({kind:u.literal("insert-page-resource"),artifact:zi}).strict(),u.object({kind:u.literal("delete-page-source"),expectedUrlPath:u.string().startsWith("/")}).strict()]),_c=u.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"]),gc=u.object({code:_c,message:u.string().min(1),details:u.record(u.string(),u.unknown()).optional()}),en=u.object({key:u.string().min(1),instanceIndex:u.number().int().nonnegative().optional(),instanceCount:u.number().int().positive().optional()}),Xi=u.object({id:u.string().min(1),siteId:T,baseSnapshotId:k,composition:_e,kind:Mn,target:Y_,documentVersion:u.number().int().nonnegative(),selectionRef:en.optional(),mutationContext:Nn.optional(),params:Z_}).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(o=>o.path),i=e.target.kind==="source-file"?[e.target.path]:e.target.paths;ng(s,i)||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"})}),p1=Xi,J_=u.object({kind:u.literal("insert-page-resource"),package_instance_id:u.string().min(1),pages:u.array(qr).min(1)}).strict().superRefine((e,n)=>{let s=new Set,i=new Set;for(let[o,a]of e.pages.entries())s.has(a.template_page_id)&&n.addIssue({code:"custom",path:["pages",o,"template_page_id"],message:`Duplicate template page route mapping: ${a.template_page_id}`}),i.has(a.final_route)&&n.addIssue({code:"custom",path:["pages",o,"final_route"],message:`Duplicate final route mapping: ${a.final_route}`}),s.add(a.template_page_id),i.add(a.final_route)}),eg=u.object({kind:u.literal("delete-page-source"),deleted_files:u.array(u.string().min(1)),updated_files:u.array(u.string().min(1)),preserved_shared_files:u.array(u.string().min(1)),warnings:u.array(u.string().min(1))}).strict(),tg=u.discriminatedUnion("kind",[J_,eg]),hc=u.object({requestId:u.string().min(1),kind:Mn,composition:B,target:X_,resultVersion:u.number().int().nonnegative(),affectedFiles:u.array(u.string().min(1)).optional(),selectionRef:en.optional(),output:tg.optional()}).strict(),Qi=hc.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"})}),d1=Yr({dataSchema:Qi,codeSchema:_c,failureDataSchema:hc.partial()});function ng(e,n){return e.length===n.length&&e.every((s,i)=>s===n[i])}var sg=ae.enum(["component","page","pages"]),ig=ae.object({resource_kind:sg,resource_name:ae.string().trim().min(1).max(200),file_count:ae.number().int().min(1).max(64),total_bytes:ae.number().int().min(0).max(4*1024*1024),content_digest:ae.string().regex(/^sha256:[a-f0-9]{64}$/),custom_prompt:ae.string().trim().min(1).max(4e3).optional(),final_routes:ae.array(ae.string().min(1)).max(64)}).strict(),og=ae.discriminatedUnion("kind",[ae.object({kind:ae.literal("none")}).strict(),ae.object({kind:ae.literal("primary"),items:ae.array(ae.object({label:ae.string().trim().min(1).max(120),href:ae.string().startsWith("/").max(200)}).strict()).min(1).max(64)}).strict().superRefine((e,n)=>{let s=new Set;for(let[i,o]of e.items.entries())s.has(o.href)&&n.addIssue({code:"custom",path:["items",i,"href"],message:`Duplicate navigation href: ${o.href}`}),s.add(o.href)})]),ag=ae.object({base_snapshot_id:ae.string().min(1),operation:Xi,navigation_selection:og.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 rg(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 Sc=ae.object({id:ae.string().min(1),tenant_id:ae.string().min(1),site_id:ae.string().min(1),run_id:ae.string().min(1).optional(),correlation_id:ae.string().min(1).optional(),sent_at:ae.string().min(1),type:ae.literal("client.resource.operation.create"),payload:ae.object({client_message_id:ae.string().min(1),display:ig,transient_resource_input:ag}).strict()}).strict().superRefine((e,n)=>{let{display:s,transient_resource_input:i}=e.payload;e.site_id!==i.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"?i.operation.kind==="insert-child"||i.operation.kind==="replace-node":i.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 c=rg(i.operation).flatMap(m=>m.files),r=c.reduce((m,S)=>m+new TextEncoder().encode(S.content).byteLength,0);if(c.length>Ni&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate file count limit."}),r>ji&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate content byte limit."}),s.file_count!==c.length&&n.addIssue({code:"custom",path:["payload","display","file_count"],message:"Resource summary file_count must match the transient operation."}),s.total_bytes!==r&&n.addIssue({code:"custom",path:["payload","display","total_bytes"],message:"Resource summary total_bytes must match the transient operation."}),i.operation.kind==="insert-page-resource"&&i.operation.params.kind==="insert-page-resource"){let m=i.operation.params.artifact;m.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 S=m.pages.map(g=>g.final_route);(S.length!==s.final_routes.length||S.some((g,w)=>g!==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(i.navigation_selection?.kind==="primary"){let m=new Set(s.final_routes);for(let[S,g]of i.navigation_selection.items.entries())m.has(g.href)||n.addIssue({code:"custom",path:["payload","transient_resource_input","navigation_selection","items",S,"href"],message:"Navigation selection href must reference a final resource route."})}});import{z as P}from"zod";import{z as Zi}from"zod";var M=e=>Zi.object({code:Zi.number().int(),data:e,message:Zi.string()});var cg=["with_website","without_website"],tn=P.enum(cg),Ji=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."}),mg=["welcome","website_scan","customer_materials","analysis","diagnosis","strategy","structure_planning","preview_personalization","publishing"],Rt=P.enum(mg),lg=["company_info","website_crawl","website_basic_info_extract","website_metrics_evaluate","intelligent_analysis","strategy_recommendation"],bc=P.enum(lg),pg=["started","running","succeeded","failed","invalidated"],yc=P.enum(pg),dg=["draft","structure_saved","generating","workspace_ready"],eo=P.enum(dg),ug=["not_deployed","deploying","deployed"],to=P.enum(ug),_g=["active","completed"],gg=P.enum(_g),hg=["completed","current","locked"],Sg=P.enum(hg),xc={draft:10,structure_saved:20,generating:30,workspace_ready:40},Ec={not_deployed:10,deploying:20,deployed:30},Rc={active:10,completed:20},Ic={started:10,running:20,succeeded:30,failed:40,invalidated:50};function Ps(e){return new Map(Object.entries(e).map(([n,s])=>[s,n]))}var fg=Ps(xc),bg=Ps(Ec),yg=Ps(Rc),xg=Ps(Ic);function T1(e){let n=fg.get(e);if(!n)throw new Error(`Unknown site build status code: ${e}`);return n}function k1(e){let n=bg.get(e);if(!n)throw new Error(`Unknown site deployment status code: ${e}`);return n}function A1(e){let n=yg.get(e);if(!n)throw new Error(`Unknown site workflow status code: ${e}`);return n}function w1(e){let n=xg.get(e);if(!n)throw new Error(`Unknown task execution status code: ${e}`);return n}function P1(e){return xc[e]}function v1(e){return Ec[e]}function C1(e){return Rc[e]}function D1(e){return Ic[e]}var no=[{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}]}}],O1=no[0].definitions,Tc=P.number().int().min(1),Eg=P.object({id:Q,flow_type:tn,definition_version:Tc,node_code:Rt,label:P.string().min(1),sort_order:P.number().int().min(1),is_enabled:P.boolean(),state:Sg}),kc=P.object({id:Fa,tenant_id:P.string().min(1),site_id:T,workflow_id:nt,node_code:Rt,task_type:bc,external_task_id:P.string().min(1),execution_status:yc,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)}),Rg=P.object({id:nt,tenant_id:P.string().min(1),site_id:T,flow_type:tn,website:Ji.nullable(),definition_version:Tc,current_node_code:Rt,status:gg,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)}),so=P.object({workflow:Rg,menu:P.array(Eg),task_refs:P.array(kc),site:P.object({default_locale:Ee.optional(),status:eo,deployment_status:to,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()})}),N1=M(so),j1=M(kc),fc=P.array(P.string().min(1).max(64)).max(16).optional(),L1=P.discriminatedUnion("flow_type",[P.object({flow_type:P.literal("with_website"),website:Ji,client_capabilities:fc}).strict(),P.object({flow_type:P.literal("without_website"),website:P.null().optional(),client_capabilities:fc}).strict()]),M1=P.object({expected_current_node:P.literal("website_scan"),website:Ji}).strict(),U1=P.object({expected_current_node:Rt}).strict(),F1=P.object({expected_current_node:P.literal("publishing")}).strict(),G1=P.object({publish_workflow_id:rs,expected_publish_revision:P.number().int().min(1)}).strict(),Ig=P.object({node_code:Rt,task_type:bc,external_task_id:P.string().min(1).max(255),idempotency_key:P.string().min(1).max(255),site_url:P.string().url().optional()}),q1=Ig.extend({workflow_id:nt}).strict(),W1=P.object({external_task_id:P.string().min(1).max(255),execution_status:yc}),Tg=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()}),K1=Tg.extend({workflow_id:nt}).strict(),kg=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()}),B1=kg.extend({workflow_id:nt}).strict(),z1=P.object({}).strict();function Ag(e,n,s){return e.find(i=>i.definition_version===s)?.definitions[n]}function wg(e,n){return Ag(no,e,n)}function Pg(e,n=1){let s=wg(e,n);if(!s)throw new Error(`Unknown workflow definition: ${e} v${n}.`);return s}function vg(e,n,s){let i=new Set(s);return e.filter(o=>o.published&&(o.required_client_capability===null||i.has(o.required_client_capability))).sort((o,a)=>a.definition_version-o.definition_version).map(o=>({definition_version:o.definition_version,items:o.definitions[n]}))[0]}function H1(e,n){return vg(no,e,n)}function V1(e,n){return Pg(e).findIndex(s=>s.node_code===n)}function $1(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 Y1(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 X1(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 R}from"zod";var io=R.string().min(1).max(120).regex(/^[a-z][a-z0-9_-]*$/),Le=R.string().min(1).max(120).regex(/^[A-Za-z_][A-Za-z0-9_]*$/),Cg=R.enum(["text","select","multi_select","tags","category_list","boolean","number"]),Un=R.string().min(1).max(512).regex(/^\/(?:[^?#]*)$/),Dg=R.object({minimum:R.number().finite(),maximum:R.number().finite(),step:R.number().finite().positive()}).strict().refine(e=>e.minimum<e.maximum,{message:"minimum must be less than maximum"}),Og=R.string().trim().min(1).max(100),wc=R.array(Og).max(5).refine(e=>new Set(e.map(n=>n.toLowerCase())).size===e.length,{message:"popular_terms must be unique ignoring case"}),ew=R.array(R.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 i=s.toLowerCase();return n.has(i)?!1:(n.add(i),!0)}).slice(0,5)}),Pc=R.object({filter_enabled:R.boolean(),selected_fields:R.array(Le).max(64),selected_card_fields:R.array(Le).max(64).default([]),popular_terms_enabled:R.boolean().default(!1),popular_terms:wc.optional()}).strict(),Ng=R.object({app_slug:io}).extend(Pc.shape).strict(),oo=R.object({kind:R.literal("product_search_confirmation"),baseline_snapshot_id:k,target_route_id:Un,applications:R.array(R.object({app_slug:io,label:R.string().min(1).max(200),popular_terms:wc.default([]),current_config:Pc.nullable().default(null),affected_routes:R.array(Un).max(64).default([]),fields:R.array(R.object({field_name:Le,label:R.string().min(1).max(200),value_shape:Cg,option_count:R.number().int().nonnegative().optional(),filter_meta:Dg.optional()}).strict()).max(64)}).strict()).min(1).max(12),current_config:Ng.nullable().optional(),affected_routes:R.array(Un).min(1).max(64).optional()}).strict(),jg=R.object({kind:R.literal("product_search_confirmation"),action:R.enum(["confirm","modify"]),app_slug:io,filter_enabled:R.boolean(),popular_terms_enabled:R.boolean().default(!1),selected_fields:R.array(Le).max(64),selected_card_fields:R.array(Le).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"})}),vs=R.union([jg,R.object({kind:R.literal("product_search_confirmation"),action:R.literal("cancel")}).strict()]),Fn=R.union([R.string().max(255),R.number().finite(),R.boolean()]),Lg=R.object({values:R.array(Fn).min(1).max(20).refine(e=>new Set(e.map(n=>`${typeof n}:${String(n)}`)).size===e.length,{message:"values must be unique"})}).strict(),Mg=R.object({min:R.number().finite().optional(),max:R.number().finite().optional(),include_unlabeled:R.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"}),Ug=R.object({q:R.string().max(200),page:R.number().int().min(1).max(500),page_size:R.union([R.literal(9),R.literal(20)]),sort:R.enum(["published_at_desc","published_at_asc","product_name_asc","product_name_desc"]),filters:R.record(Le,R.union([Lg,Mg])).superRefine((e,n)=>{Object.keys(e).length>12&&n.addIssue({code:"custom",message:"filters must contain at most 12 fields"})}),display_fields:R.array(Le).max(64).default([]),missing_count_fields:R.array(Le).max(12).default([]),relaxation_count_fields:R.array(Le).max(12).default([]),facets:R.array(R.object({field:Le,query:R.string().max(100),page:R.number().int().min(1).max(100),page_size:R.literal(10),include_values:R.array(Fn).max(20)}).strict()).max(8)}).strict(),Ac=R.object({value:Fn,label:R.string().max(200),count:R.number().int().nonnegative()}).strict(),Fg=R.union([Fn,R.array(Fn).max(50)]),Gg=R.object({items:R.array(R.object({id:R.number().int().positive(),thumbnail:R.string().max(2048).nullable(),title:R.string().max(300),summary:R.string().max(2e3),category:R.string().max(300).nullable(),field_values:R.record(Le,Fg).default({}),url:R.string().min(1).max(2048)}).strict()).max(20),page:R.object({total:R.number().int().nonnegative(),page:R.number().int().positive(),page_size:R.union([R.literal(9),R.literal(20)])}).strict(),facets:R.array(R.object({field:Le,total:R.number().int().nonnegative(),page:R.number().int().positive(),page_size:R.literal(10),values:R.array(Ac).max(10),selected_values:R.array(Ac).max(20)}).strict()).max(8),missing_counts:R.record(Le,R.number().int().nonnegative()).default({}),relaxation_counts:R.record(Le,R.number().int().nonnegative()).default({})}).strict(),tw=R.object({contract_version:R.literal(1),request:Ug,response:Gg}).strict();import{z as Ge}from"zod";var ao=4,iw=20,ow=1440*60*1e3,aw=1e6,qg=["image/png","image/jpeg","image/webp"],ro=Ge.enum(qg),rw="WORKSPACE_ATTACHMENT_UNSUPPORTED_FORMAT",cw="WORKSPACE_ATTACHMENT_TOO_LARGE",mw="WORKSPACE_ATTACHMENT_LIMIT",lw="WORKSPACE_ATTACHMENT_BOUND",pw=10,dw=3600*1e3,uw="WORKSPACE_ATTACHMENT_URL_REJECTED",_w="WORKSPACE_ATTACHMENT_CAPTURE_FAILED",gw="WORKSPACE_ATTACHMENT_CAPTURE_BUSY",hw="WORKSPACE_ATTACHMENT_CAPTURE_TIMEOUT",Sw="WORKSPACE_ATTACHMENT_CAPTURE_BUDGET_EXCEEDED",fw="WORKSPACE_ATTACHMENT_CAPTURE_UNAVAILABLE",bw=Ge.object({attachment_id:Ge.string().min(1),media_type:ro,width:Ge.number().int().positive(),height:Ge.number().int().positive(),size_bytes:Ge.number().int().nonnegative(),filename:Ge.string().min(1).max(120),image_url:Ge.string().min(1),source_url:Ge.string().min(1).optional(),created_at:Ge.string().min(1)}).strict(),yw=Ge.object({url:Ge.string().url().max(2048),full_page:Ge.boolean().optional()}).strict(),vc="[A-Za-z0-9_-]+",Wg=new RegExp(`^/sites/(${vc})/workspace/attachments/(${vc})/image$`);function xw(e,n){return`/sites/${encodeURIComponent(e)}/workspace/attachments/${encodeURIComponent(n)}/image`}function co(e){let n=Wg.exec(e);return n?{site_id:n[1],attachment_id:n[2]}:null}function Ew(e){let n=[];for(let s of e){if(s.type!=="file"||typeof s.url!="string")continue;let i=co(s.url);i&&n.push({attachment_id:i.attachment_id,site_id:i.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 Gn}from"zod";var Kg=["deployment_queued","prepare_source","build_artifact","publish_site","site_released","cleanup_release"],Bg=Gn.enum(Kg),zg=Gn.enum(["running","succeeded","failed"]),Hg=Gn.object({code:Bg,status:zg,message:Gn.string().trim().min(1)}).strict(),Cc=Gn.array(Hg);import{z as qn}from"zod";var Vg={slug:/^page_[0-9]+_slug$/,showInHeader:/^page_[0-9]+_show_in_header$/,showInFooter:/^page_[0-9]+_show_in_footer$/,type:/^block_[0-9]+_type$/};function Aw(e){let n={},s=new Set;for(let i of e){if(!Vg[i.field].test(i.key))throw new Error("Invalid Sitemap Resolver answer-sheet hole key.");if(s.has(i.key))throw new Error("Duplicate Sitemap Resolver answer-sheet hole key.");s.add(i.key),n[i.key]=i.field==="slug"?qn.string().min(1):i.field==="type"?qn.string().trim().min(1):qn.boolean()}return qn.object({answers:qn.object(n).strict()}).strict()}import{z as v}from"zod";var $g=v.enum(["pending","running","succeeded","failed"]),Yg=v.enum(["TASK_FAILED","WEBSITE_UNREACHABLE"]),Xg=v.object({task_id:v.string().uuid(),site_url:v.string().url(),crawler_task_id:v.string().min(1).max(255).nullable(),crawler_error_code:Yg.nullable().optional(),crawler_failure_stage:v.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]).nullable().optional(),page_count:v.number().int().min(0).max(20),status:$g,error:v.string().nullable(),created_at:v.string().min(1),updated_at:v.string().min(1)}),Cw=M(Xg),mo=v.enum(["existing_site","new_site"]),Oc=v.enum(["google_indexing","ai_recommendation","qualification_verifiability","content_freshness","inquiry_form","inquiry_response","privacy_compliance","prohibited_content"]),Dc=v.object({observed_result:v.enum(["pass","fail","unknown"])}).strict(),Nc=v.object({kind:v.literal("ai_crawlability"),checks:v.object({ai_access_guidance:Dc,structured_data_presence:Dc}).strict()}).strict(),lo=v.object({label:v.string().trim(),value:v.union([v.string(),v.number(),v.boolean(),v.null()]),summary:v.string().trim(),tone:v.enum(["good","warn","bad","unknown"]),status:v.enum(["ok","unknown"]),assessment:Nc.optional()}),Cs=v.object({key:v.string().trim().min(1).max(100),label:v.string().trim().min(1).max(100),value:v.union([v.string().max(1e3),v.number(),v.boolean(),v.null()]),tone:v.enum(["good","warn","bad","unknown"]),status:v.enum(["ok","unknown"]),evidence:v.string().trim().max(2e3).optional(),assessment:Nc.optional()}).strict(),Qg=v.object({url:v.string().url().max(2048),title:v.string().trim().max(300),words:v.number().int().nonnegative().max(1e7)}).strict(),Zg=v.object({site_url:v.string().url().max(2048),scanned_at:v.string().datetime({offset:!0}),reach:v.array(Cs).max(64),trust:v.array(Cs).max(64),convert:v.array(Cs).max(64),safe:v.array(Cs).max(64),pages:v.array(Qg).max(100)}).strict(),Ds=v.object({company_task_id:v.string().min(1).max(128),scan_task_id:v.string().min(1).max(128),type:mo,result:v.object({company_name:v.string(),website:v.string().url().optional(),primary_product:v.string(),current_market:v.string(),qualifications:v.string(),scan_cards:v.record(v.string(),lo),scan_result:Zg.optional()})}),Jg=v.object({saved:v.literal(!0),company_task_id:v.string().min(1).max(128),scan_task_id:v.string().min(1).max(128)}),Dw=M(Jg),eh=v.enum(["snapshot","task"]),th=Ds.shape.result.extend({type:mo,structured_facts:v.unknown().optional()}).extend({company_name:v.string(),primary_product:v.string(),current_market:v.string(),qualifications:v.string()}),nh=v.object({site_id:v.string().min(1).max(128),company_task_id:v.string().min(1).max(128),scan_task_id:v.string().min(1).max(128),type:mo,data_source:eh,result:th}),Ow=M(nh.nullable());import{z as Re}from"zod";var It=Re.enum(["company","product_service","case_qualification","market","contact_inquiry","privacy_compliance","news_freshness"]),sh=Re.object({ordinal:Re.number().int().min(1).max(1e4),path:Re.string().min(1).max(2048).refine(e=>!ah(e),{message:"path must be a site-relative path, not an absolute URL"}),last_modified:Re.string().max(64).nullable()}).strict(),Lw=Re.object({candidates:Re.array(sh).min(1).max(1e4),selection_limit:Re.number().int().min(1).max(19)}).strict().superRefine((e,n)=>{let s=e.candidates.map(i=>i.ordinal).sort((i,o)=>i-o);for(let[i,o]of s.entries())if(o!==i+1){n.addIssue({code:"custom",path:["candidates"],message:"candidates ordinals must be unique and consecutive from 1"});return}}),ih=Re.object({ordinal:Re.number().int().positive().max(1e4),roles:Re.array(It).min(1).max(7)}).strict(),oh=Re.object({role:It,status:Re.enum(["selected","not_found"]),selected_ordinals:Re.array(Re.number().int().positive().max(1e4)).max(19)}).strict(),Mw=Re.object({selections:Re.array(ih).max(19),coverage:Re.array(oh).length(7)}).strict().superRefine((e,n)=>{let s=new Set;for(let[o,a]of e.coverage.entries())s.has(a.role)&&n.addIssue({code:"custom",path:["coverage",o,"role"],message:"coverage roles must be unique"}),s.add(a.role);for(let o of It.options)s.has(o)||n.addIssue({code:"custom",path:["coverage"],message:`coverage must include every page role (missing ${o})`});let i=new Map;for(let o of e.selections)for(let a of o.roles){let c=i.get(a)??new Set;c.add(o.ordinal),i.set(a,c)}for(let[o,a]of e.coverage.entries()){let c=i.get(a.role);a.selected_ordinals.some(m=>!c?.has(m))&&n.addIssue({code:"custom",path:["coverage",o,"selected_ordinals"],message:"selected_ordinals must reference selections carrying the same role"})}});function ah(e){let n=e.toLowerCase();return n.startsWith("http://")||n.startsWith("https://")||e.startsWith("//")}import{z as b}from"zod";var qw=b.object({force_refresh:b.boolean().optional()}),Lc=b.enum(["running","succeeded","failed"]),rh=b.object({agent_id:b.string().min(1),name:b.string().min(1),icon:b.string().min(1),capability:b.string().min(1),data_source:b.string().min(1),output_topics:b.string().min(1)}),ch=b.object({site_mode:b.enum(["existing_site","new_site"]),scan_required:b.boolean(),scheduled_agent_ids:b.array(b.string().min(1)),omitted_agent_ids:b.array(b.string().min(1)),next_stage:b.enum(["diagnostic_report","strategy"])}),mh=b.object({t:b.string(),d:b.string(),evidence:b.object({from:b.string(),url:b.string().nullable().optional(),value:b.string().nullable().optional()})}),lh=b.enum(["complete","partial","insufficient_data","failed"]),ph=b.enum(["ok","failed","insufficient_data"]),po=b.object({agent_id:b.string().min(1),name:b.string().min(1),icon:b.string().min(1),status:ph,topics:b.array(b.object({topic_id:b.string().min(1),status:lh,evidence_refs:b.array(b.string())})).length(3),findings:b.array(mh).max(3),elapsed_ms:b.number().nonnegative(),note:b.string().optional(),error:b.string().optional()}),Mc=b.object({total:b.number().int().nonnegative(),ok:b.number().int().nonnegative(),degraded:b.number().int().nonnegative(),total_findings:b.number().int().nonnegative(),elapsed_ms:b.number().nonnegative(),site_mode:b.enum(["existing_site","new_site"]).optional(),scheduled_agent_ids:b.array(b.string()).optional(),omitted_agent_ids:b.array(b.string()).optional(),scheduled:b.number().int().nonnegative().optional(),complete:b.number().int().nonnegative().optional(),partial:b.number().int().nonnegative().optional(),insufficient:b.number().int().nonnegative().optional(),failed:b.number().int().nonnegative().optional(),next_stage:b.enum(["diagnostic_report","strategy"]).optional()}),dh=b.object({agents_done:b.boolean(),analysis:b.record(b.string(),po),step4_scoring_input:b.unknown().optional(),summary:Mc}),Uc=b.object({job_id:b.string().min(1),site_id:b.string().min(1),model_version:b.string().min(1),output_locale:b.string().min(2),cached:b.boolean().optional(),status:Lc,result:dh.nullable().optional(),error:b.string().nullable().optional()}),Ww=M(b.array(rh)),Kw=M(ch),Bw=M(Uc),zw=M(Uc.nullable()),_t=b.object({id:b.union([b.number().int().nonnegative(),b.string().regex(/^(0|[1-9]\d*)$/u).transform(Number)]).pipe(b.number().int().nonnegative())}),jc=b.object({percent:b.number().int().min(0).max(100),phase:b.enum(["preparing","analyzing","finalizing","completed","failed"]),stage:b.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:b.number().int().nonnegative(),agents_total:b.number().int().nonnegative(),agent_id:b.string().min(1).optional()}),Hw=b.discriminatedUnion("event",[_t.extend({event:b.literal("snapshot"),data:b.object({job_id:b.string().min(1),status:Lc,done:b.number().int().nonnegative(),total:b.number().int().nonnegative(),results:b.array(po),progress:jc.optional()})}),_t.extend({event:b.literal("progress"),data:jc}),_t.extend({event:b.literal("preparing_started"),data:b.object({stage:b.literal("baseline")})}),_t.extend({event:b.literal("preparing_progress"),data:b.object({stage:b.enum(["context","external_evidence"])})}),_t.extend({event:b.literal("preparing_done"),data:b.object({evidence_count:b.number().int().nonnegative(),rule_count:b.number().int().nonnegative(),degraded_capabilities:b.array(b.string())})}),_t.extend({event:b.literal("agent_start"),data:b.object({agent_id:b.string().min(1),name:b.string().min(1),icon:b.string().min(1)})}),_t.extend({event:b.literal("agent_done"),data:po}),_t.extend({event:b.literal("done"),data:b.object({agents_done:b.literal(!0),summary:Mc})}),_t.extend({event:b.literal("failed"),data:b.object({message:b.string().min(1)})})]);import{z as U}from"zod";var _o=U.enum(["reach","trust","convert","safe"]),Ce=U.number().finite(),uh=U.number().finite().positive(),uo=["reach","trust","convert","safe"],_h=17,gh=U.enum(["passed","partial","failed"]),hh=U.object({landing_page_mode:U.enum(["intent_dynamic","static","none"]),ab_test_enabled:U.boolean()}).strict(),Sh=U.union([U.boolean(),U.number().finite(),gh,hh]).nullable(),fh=U.union([U.boolean(),U.number().finite()]).nullable(),bh=U.object({competitor_avg:U.number().finite(),score_items:U.record(U.string(),Sh),penalty_items:U.record(U.string(),fh),red_texts:U.array(U.string())}).strict(),yh=U.record(_o,bh),xh=U.object({key:_o,score:Ce,pass_score:Ce,gap:Ce}),Eh=U.object({key:U.string(),title:U.string(),is_redline_option:U.boolean().optional(),score:Ce,max_score:uh,pass_score:Ce,passed:U.boolean(),description:U.string()}),Rh=U.object({key:_o,title:U.string(),alias:U.string(),slogan:U.string(),score:Ce,max_score:U.literal(100),pass_score:Ce,competitor_average:Ce,status:U.enum(["reached","near","not_reached"]),status_name:U.enum(["\u8FBE\u6807","\u63A5\u8FD1","\u672A\u8FBE\u6807"]),summary:U.string(),sub_dimensions:U.array(Eh),red_texts:U.array(U.string()),redline_hit:U.boolean().optional()}),Ih=U.object({id:U.number().int().positive(),task_code:U.string().min(1).max(128),is_sync:U.literal(0),status:U.literal("succeeded"),rules:yh,scores_list:U.object({overview:U.object({pass_scores:U.object({reach:Ce,trust:Ce,convert:Ce,safe:Ce}),total_score:Ce,total_pass_score:Ce,score_gap:Ce,competitor_average_score:Ce,scoring_criteria_text:U.string().min(1),gap_dimensions:U.array(xh).max(4),overall_passed:U.boolean(),all_scores_passed:U.boolean(),diagnosis_passed:U.boolean(),commitment_eligible:U.boolean(),safe_redline_hit:U.boolean()}),dimensions:U.array(Rh).length(4)}),created_at:U.string().datetime({offset:!0}),updated_at:U.string().datetime({offset:!0})}).superRefine((e,n)=>{Th(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((i,o)=>i+o.sub_dimensions.length,0)!==_h&&n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include 17 subdimensions in total."});for(let[i,o]of e.scores_list.dimensions.entries()){if(o.redline_hit===void 0)continue;let a=o.sub_dimensions.findIndex(c=>c.is_redline_option===void 0);a!==-1&&n.addIssue({code:"custom",path:["scores_list","dimensions",i,"sub_dimensions",a,"is_redline_option"],message:"subdimensions must define is_redline_option when redline_hit is defined."})}}),Xw=M(Ih);function Th(e){let n=e.map(s=>s.key);return n.length===uo.length&&new Set(n).size===uo.length&&uo.every(s=>n.includes(s))}var Tt={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(Tt))Object.freeze(e);Object.freeze(Tt);var Jw=Object.freeze(Yt.filter(e=>Tt[e].length>0)),eP=Object.freeze(Yt.filter(e=>Tt[e].length===0)),kh=Object.freeze(["preparing_source","building","artifact_ready","deploying","released"]),Ah="DEPLOYMENT_TRANSITION_INVALID",go=class extends Error{constructor(n,s){super(`Invalid deployment transition: ${n} -> ${s}`),this.currentStatus=n,this.nextStatus=s,this.code=Ah,this.name="DeploymentTransitionError"}};function tP(e){return Tt[e]}function nP(e){return Yt.filter(n=>Tt[n].some(s=>s===e))}function wh(e){return Tt[e].length>0}function sP(e){return!wh(e)}function iP(e,n){if(!Tt[e].some(s=>s===n))throw new go(e,n);return n}function oP(){return kh}import{converter as Ph,formatHex as vh,parse as Ch,wcagContrast as cP}from"culori";var mP=Ph("oklch");var I={paper:"oklch(0.92 0.008 250)",cream:"oklch(0.90 0.035 85)",sand:"oklch(0.75 0.05 78)",stone:"oklch(0.60 0.02 75)",ash:"oklch(0.60 0.012 250)",slate:"oklch(0.45 0.025 250)",charcoal:"oklch(0.30 0.015 255)",ink:"oklch(0.25 0.04 260)",sky:"oklch(0.72 0.12 230)",blue:"oklch(0.58 0.17 250)","medical blue":"oklch(0.58 0.12 235)",indigo:"oklch(0.50 0.18 280)",navy:"oklch(0.40 0.10 258)",ocean:"oklch(0.55 0.13 220)","slate blue":"oklch(0.46 0.06 245)",teal:"oklch(0.60 0.12 195)","soft aqua":"oklch(0.78 0.07 190)",mint:"oklch(0.78 0.10 165)",sage:"oklch(0.65 0.05 145)",green:"oklch(0.58 0.15 145)","clinical green":"oklch(0.62 0.12 155)",emerald:"oklch(0.60 0.16 155)",forest:"oklch(0.45 0.10 145)",olive:"oklch(0.58 0.08 115)",lime:"oklch(0.72 0.17 130)",yellow:"oklch(0.82 0.15 100)",gold:"oklch(0.72 0.14 85)",amber:"oklch(0.70 0.16 70)",orange:"oklch(0.66 0.18 55)",coral:"oklch(0.68 0.16 32)",terracotta:"oklch(0.55 0.12 42)",rust:"oklch(0.50 0.13 38)",brown:"oklch(0.45 0.07 55)",rose:"oklch(0.65 0.16 18)",red:"oklch(0.58 0.20 25)",crimson:"oklch(0.52 0.20 22)",wine:"oklch(0.42 0.13 18)",pink:"oklch(0.72 0.14 0)",magenta:"oklch(0.60 0.22 345)",lavender:"oklch(0.72 0.08 295)",violet:"oklch(0.58 0.19 295)",purple:"oklch(0.52 0.19 305)",plum:"oklch(0.45 0.13 325)",electric:"oklch(0.62 0.23 285)","clean white":"oklch(0.97 0.01 245)","cool gray":"oklch(0.62 0.02 245)",zinc:"oklch(0.60 0.012 250)",gray:"oklch(0.60 0.012 250)",grey:"oklch(0.60 0.012 250)",neutral:"oklch(0.60 0.005 250)",gunmetal:"oklch(0.30 0.015 255)"},Dh={\u84DD:I.blue,\u84DD\u8272:I.blue,\u5929\u84DD:I.sky,\u5929\u84DD\u8272:I.sky,\u6D45\u84DD:I.sky,\u6E56\u84DD:I.ocean,\u6D77\u84DD:I.ocean,\u6DF1\u84DD:I.navy,\u85CF\u84DD:I.navy,\u85CF\u9752:I.navy,\u6D77\u519B\u84DD:I.navy,\u6DF1\u6D77\u519B\u84DD:I.navy,\u5348\u591C\u84DD:I.navy,\u975B\u84DD:I.indigo,\u975B\u9752:I.indigo,\u94A2\u84DD:I["slate blue"],\u9752:I.teal,\u9752\u8272:I.teal,\u84DD\u7EFF:I.teal,\u7EFF:I.green,\u7EFF\u8272:I.green,\u6D45\u7EFF:I.mint,\u8584\u8377\u7EFF:I.mint,\u8349\u7EFF:I.lime,\u6A44\u6984\u7EFF:I.olive,\u58A8\u7EFF:I.forest,\u6DF1\u7EFF:I.forest,\u68EE\u6797\u7EFF:I.forest,\u7FE0\u7EFF:I.emerald,\u7956\u6BCD\u7EFF:I.emerald,\u9EC4:I.yellow,\u9EC4\u8272:I.yellow,\u91D1:I.gold,\u91D1\u8272:I.gold,\u91D1\u9EC4:I.gold,\u7425\u73C0:I.amber,\u7425\u73C0\u8272:I.amber,\u6A59:I.orange,\u6A59\u8272:I.orange,\u6A58\u8272:I.orange,\u6A58\u9EC4:I.orange,\u6D3B\u529B\u6A59:I.orange,\u6696\u6A59:I.orange,\u73CA\u745A:I.coral,\u73CA\u745A\u6A59:I.coral,\u9676\u571F:I.terracotta,\u8D64\u9676:I.terracotta,\u9508\u7EA2:I.rust,\u68D5:I.brown,\u68D5\u8272:I.brown,\u8910\u8272:I.brown,\u5496\u5561\u8272:I.brown,\u7EA2:I.red,\u7EA2\u8272:I.red,\u6731\u7EA2:I.red,\u7EEF\u7EA2:I.crimson,\u6DF1\u7EA2:I.crimson,\u9152\u7EA2:I.wine,\u73AB\u7470:I.rose,\u73AB\u7EA2:I.rose,\u7C89:I.pink,\u7C89\u8272:I.pink,\u7C89\u7EA2:I.pink,\u6D0B\u7EA2:I.magenta,\u54C1\u7EA2:I.magenta,\u7D2B:I.purple,\u7D2B\u8272:I.purple,\u6DE1\u7D2B:I.lavender,\u85B0\u8863\u8349:I.lavender,\u7D2B\u7F57\u5170:I.violet,\u6885\u7EA2:I.plum,\u7070:I.gray,\u7070\u8272:I.gray,\u6D45\u7070:I.gray,\u6DE1\u7070:I.gray,\u51B7\u7070:I["cool gray"],\u51B7\u7070\u767D:I["cool gray"],\u6696\u7070:I.stone,\u6DF1\u7070:I.slate,\u77F3\u58A8\u7070:I.slate,\u77F3\u677F\u7070:I.slate,\u70AD\u7070:I.charcoal,\u70AD\u9ED1:I.charcoal,\u58A8:I.ink,\u58A8\u8272:I.ink,\u9ED1:I.ink,\u9ED1\u8272:I.ink,\u767D:I["clean white"],\u767D\u8272:I["clean white"],\u7C73\u767D:I.cream,\u7C73\u8272:I.cream,\u8C61\u7259\u767D:I.cream,\u5976\u6CB9\u767D:I.cream,\u6C99\u8272:I.sand},lP={...I,...Dh};function ho(e){let n=Ch(e.trim());return n?vh(n)??null:null}var gt={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",weights:["400","500","600","700"]},"Noto Sans SC":{import:"Noto_Sans_SC",download:!1},"Noto Serif SC":{import:"Noto_Serif_SC",download:!1}},Oh={heading:"Inter",body:"Inter"},Fc=gt.Inter;function Os(e){return e.trim().replace(/\s+/g,"_").toLowerCase()}var Kc=(()=>{let e=new Map;for(let[n,s]of Object.entries(gt))e.set(Os(n),s),e.set(Os(s.import),s);return e})();function Nh(e){return typeof e!="string"||e.trim().length===0?Fc:Kc.get(Os(e))??Fc}var jh=(()=>{let e=new Map;for(let[n,s]of Object.entries(gt))e.set(s.import,n);return e})();function nn(e){if(typeof e!="string"||e.trim().length===0)return"Inter";let n=Kc.get(Os(e));return n?jh.get(n.import)??"Inter":"Inter"}var Lh=Object.keys(gt),Gc='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',qc='Georgia, "Times New Roman", serif',Wc='"SFMono-Regular", Consolas, monospace',Mh=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),Uh=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(e=>e.toLowerCase())),Fh=new Set(["JetBrains Mono","IBM Plex Mono"].map(e=>e.toLowerCase()));function Gh(e){let n=e.toLowerCase();return Fh.has(n)||n.includes("mono")?"mono":Uh.has(n)||n.includes("serif")?"serif":"sans"}function So(e,n){let s=m=>(m??"").trim().replace(/^['"]|['"]$/g,"").replace(/[^A-Za-z0-9 _-]+/g,"").trim().slice(0,60),i=s(e),o=s(n),a=m=>Mh.has(m.toLowerCase());if(i&&a(i)){let m=i.toLowerCase();return m.includes("mono")?Wc:m.includes("serif")?qc:Gc}let c=i;c||(c=a(o)?"":o),c||(c="Inter");let r=Gh(c);return r==="mono"?`"${c}", ${Wc}`:r==="serif"?`"${c}", ${qc}`:`"${c}", ${Gc}`}function qh(e){return{"--site-font-sans":So(e?.body,"Inter"),"--site-font-heading":So(e?.heading,e?.body??"Inter")}}var fo=["archivo-inter","playfair-source-sans","space-grotesk-manrope","fraunces-libre-franklin","noto-serif-sc-noto-sans-sc","noto-sans-sc"],Bc=[{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 zc(e){let n=Bc.find(s=>s.id===e);if(!n)throw new Error(`Unknown font pairing: ${e}`);return n}import{z as sn}from"zod";import{z as Wh}from"zod";var Kh=["light","standard","bold"],qe=Wh.enum(Kh),Ns="standard",Bh=new Set(["display","heading","title"]),Hc={light:{display:300,heading:400,title:400,ui:400,button:400,body:400,strong:600},standard:{display:600,heading:500,title:500,ui:400,button:500,body:400,strong:600},bold:{display:700,heading:700,title:700,ui:400,button:600,body:400,strong:700}},gP=Object.keys(Hc.standard).map(e=>`--site-weight-${e}`),hP="--site-leading-body",SP=["--site-leading-display","--site-leading-heading","--site-leading-title"];function Qe(e,n){let s=[];for(let i=e;i<=n;i+=100)s.push(i);return s}var zh={"Source Sans 3":Qe(200,900),"Space Grotesk":Qe(300,700),Manrope:Qe(200,800),"IBM Plex Sans":Qe(100,700),Oswald:Qe(200,700),"Bebas Neue":[400],"Playfair Display":Qe(400,900),Lora:Qe(400,700),"Cormorant Garamond":Qe(300,700),"JetBrains Mono":Qe(100,800),"IBM Plex Mono":[400,500,600,700],"DM Sans":Qe(100,1e3)};function bo(e){return e.trim().replace(/\s+/g,"_").toLowerCase()}var Hh=new Set(Object.entries(gt).flatMap(([e,n])=>[bo(e),bo(n.import)]));function yo(e){if(!(e in gt)&&!Hh.has(bo(e)))return null;let n=nn(e);return gt[n].download===!1?null:zh[n]??Qe(100,900)}function Vc(e,n){return!n||n.length===0?e:n.reduce((s,i)=>Math.abs(i-e)<Math.abs(s-e)?i:s,n[0])}function fP(e,n){let s=Hc[e??Ns],i=n?.heading?yo(n.heading):null,o=n?.body?yo(n.body):null,a={};for(let c of Object.keys(s)){let r=Bh.has(c)?i:o;a[`--site-weight-${c}`]=String(Vc(s[c],r))}return a}var Vh=/^(zh|ja|ko)(?:[-_]|$)/i,$h=/^(ar|fa|hi|bn|ta|si|th|lo|km|my|vi)(?:[-_]|$)/i;function $c(e){return Vh.test(e??"")?"dense":$h.test(e??"")?"tall":"default"}function Yh(e){return $c(e)==="dense"?"1.75":"1.5"}var Xh={default:["1.1","1.2","1.3"],dense:["1.2","1.3","1.4"]};function bP(e){let n=$c(e),s=Yh(e),[i,o,a]=n==="tall"?[s,s,s]:Xh[n];return{"--site-leading-display":i,"--site-leading-heading":o,"--site-leading-title":a}}function yP(e,n){let s=yo(e);return[...new Set(n.map(o=>Vc(o,s)))].sort((o,a)=>o-a).map(String)}var on="/* <cms-builder:site-design-notes>",Kt="</cms-builder:site-design-notes> */",xo="palette-inputs: ",Eo="type-inputs: ",kt=sn.string().min(1).max(40),Ro=sn.object({primarySource:sn.enum(["user","derived"]),neutral:kt.optional(),foreground:kt.optional(),supporting:sn.array(kt).max(4).optional(),imagePalette:sn.object({background:kt.optional(),foreground:kt.optional(),card:kt.optional(),muted:kt.optional(),border:kt.optional()}).optional()}),Qh=sn.object({weightStyle:qe}),Zh=e=>e.replaceAll("*/","* /").replace(/\s+/g," ").trim();function Jh(e){let n=e.lines.map(Zh).filter(Boolean).map(s=>` ${s}`);return e.paletteInputs&&n.push(` ${xo}${JSON.stringify(e.paletteInputs).replaceAll("*/","* /")}`),e.typeInputs&&n.push(` ${Eo}${JSON.stringify(e.typeInputs).replaceAll("*/","* /")}`),[on,...n,` ${Kt}`].join(`
2
- `)}function Io(e){let n=e.indexOf(on),s=e.indexOf(Kt,n+1);return n===-1||s===-1?null:{start:n,end:s+Kt.length}}function IP(e){let n=Io(e);if(!n)return e;let s=e.slice(0,n.start),i=e.slice(n.end);return s?(s.endsWith(`
3
- `)&&(s=s.slice(0,-1)),i.startsWith(`
4
- `)&&(i=i.slice(1))):i.startsWith(`
1
+ import{z as t}from"zod";import{z as re}from"zod";import{z as j}from"zod";import{z as ld}from"zod";var Q=ld.uuidv7(),BT=Q,KT=Q,zT=Q,HT=Q,$T=Q,VT=Q,YT=Q,k=Q,Yt=Q,Fo=Q,ke=Q,xs=Q,I=Q,Go=Q,$=Q,qo=Q,it=Q,ri=Q,mt=Q,XT=Q,QT=Q,ci=Q,st=Q,Wo=Q,ZT=Q,JT=Q,ek=Q,En=Q,tk=Q,nk=Q,ik=Q;var Bo=Q,Es=j.enum(["external_site_edit","page_template_create"]),pd=200,Lt=j.string().min(1).max(pd),dd=4e3,Ko=j.enum(["succeeded","degraded","no_changes","failed"]),Rn=j.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"]),In=j.object({code:j.enum(["preexisting_placeholder_media"]),block_ids:j.array(j.string().min(1))}).strict(),ud=["sandbox_unavailable"];function rk(e){return e!=null&&ud.includes(e)}var gd=j.enum(["pending","delivered","failed"]),_d=j.enum(["running","succeeded","degraded","no_changes","failed"]),ck=j.object({site_id:k,external_run_id:Lt,external_thread_id:Lt,prompt:j.string().min(1).max(dd),thread_title:j.string().trim().min(1).max(200).optional()}).strict(),Rs=j.enum(["added","modified","deleted"]),hd=j.enum(["landing_page","general_page","detail_page"]),Sd=j.enum(["header","footer","styles","layout"]),zo={block_id:j.string().min(1),type:j.string().min(1),change:Rs},Ho={slug:j.string().min(1),title:j.string().min(1),page_type:hd,change:Rs},fd=j.object({kind:Sd,change:Rs}).strict(),$o={site_wide:j.array(fd),unclassified_count:j.number().int().nonnegative()},bd=j.object(zo).strict(),yd=j.object({...Ho,sections:j.array(bd)}).strict(),xd=j.object({pages:j.array(yd),...$o}).strict(),Ed=j.object({...zo,label:j.string().min(1)}).strict(),Rd=j.object({page_id:j.number().int().positive().nullable(),...Ho,sections:j.array(Ed)}).strict(),Vo=j.object({pages:j.array(Rd),...$o}).strict(),mk={pages:[],site_wide:[],unclassified_count:0},lk=j.object({base_snapshot_id:I,target_snapshot_id:I}).strict(),pk=j.object({data:xd}).strict(),mi=j.object({id:Bo,execution_scene:Es.default("external_site_edit"),site_id:k,external_run_id:j.string().min(1).nullable(),external_thread_id:j.string().min(1).nullable(),status:_d,outcome:Ko.nullable(),degraded_reason:Rn.nullable(),vcp_run_id:$.nullable(),vcp_thread_id:it.nullable(),base_snapshot_id:I,snapshot_id:I.nullable(),preview_url:j.string().url().nullable(),summary:j.string().nullable(),error_code:j.string().nullable(),build_verified:j.boolean().nullable(),callback_status:gd.nullable(),created_at:j.string().min(1),started_at:j.string().min(1).nullable(),finished_at:j.string().min(1).nullable(),changes:Vo.nullable().default(null),advisories:j.array(In).nullable().default(null)}).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.changes!==null&&n.addIssue({code:"custom",message:"Page Template tasks never carry changes"}),e.advisories!==null&&e.status!=="succeeded"&&n.addIssue({code:"custom",message:"Page Template advisories belong to succeeded tasks only"})):e.advisories!==null?n.addIssue({code:"custom",message:"External edit tasks never carry advisories"}):(!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"})}),dk=j.object({task:mi}).strict(),uk=j.object({task:mi}).strict(),gk=j.object({task_id:Bo,external_run_id:j.string().min(1),external_thread_id:j.string().min(1),site_id:k,vcp_run_id:$.nullable(),outcome:Ko,degraded_reason:Rn.nullable(),snapshot_id:I.nullable(),preview_url:j.string().url().nullable(),summary:j.string().nullable(),error_code:j.string().nullable(),build_verified:j.boolean().nullable(),retryable:j.boolean(),finished_at:j.string().min(1),changes:Vo.nullable().default(null)}).strict(),_k=j.object({received:j.literal(!0)}).strict();var Xe=re.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"}),Tn=re.string().min(1).refine(e=>e.startsWith("/")&&!e.startsWith("//")&&!/[?#\\\x00-\x20\x7f]/.test(e)&&!e.startsWith("/.vcp")&&!e.split("/").some(n=>{try{let i=decodeURIComponent(n);return i==="."||i===".."||/[/\\\x00-\x1f\x7f]/.test(i)||i.startsWith(".vcp")}catch{return!0}}),{message:"page_path must start with / and must not contain ? or #"});function Yo(e){return/^\[\[\.\.\.[^\[\]]+\]\]$|^\[[^\[\]]+\]$/.test(e)}function li(e){let n=/^(?:src\/)?app\/\.vcp\/page-templates\/(.+)\/page\.tsx$/.exec(e);if(!n)return!1;let i=n[1].split("/"),s=i.some(Yo),a=s?i[0]:i.pop(),o=s?i.slice(1):i;if(s&&o.length===0||!/^[A-Za-z0-9_-]{1,255}$/.test(a)||!Tn.safeParse(`/${o.join("/")}`).success||o.some(c=>c?c.includes("[")||c.includes("]")?!Yo(c):/[\[\]()%]/.test(c)||c.startsWith("_")||c.startsWith("@"):!0))return!1;try{let c=atob(a.replace(/-/g,"+").replace(/_/g,"/")),r=Uint8Array.from(c,x=>x.charCodeAt(0)),l=new TextDecoder("utf-8",{fatal:!0}).decode(r);return Xe.safeParse(l).success&&btoa(String.fromCharCode(...new TextEncoder().encode(l))).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")===a}catch{return!1}}var Xo=re.object({page_path:Tn,template_id:Xe,instruction:re.string().min(1).refine(e=>e.trim().length>0)}).strict(),Qo=3;function Zo(e){return e.replace(/\/+$/,"")||"/"}var yk=re.object({external_run_id:Lt,external_thread_id:Lt,items:re.array(Xo).min(1).max(Qo)}).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:Zo(n.page_path)}))})).superRefine((e,n)=>{let i=new Set;e.items.forEach((s,a)=>{let o=JSON.stringify([s.page_path,s.template_id]);i.has(o)&&n.addIssue({code:"custom",path:["items",a],message:"Duplicate normalized page_path/template_id identity"}),i.add(o)})}),Jo=re.object({items:re.array(Xo).min(1).max(Qo)}).strict().refine(e=>e.items.every(n=>n.page_path===Zo(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"}),er=e=>[...new Set(e)],xk=re.object({page_path:Tn,template_id:Xe,exit_template_ids:re.array(Xe).default([]).transform(er)}).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"}),Ek=re.object({page_path:Tn,template_ids:re.array(Xe).min(1).transform(er)}).strict(),tr={ok:re.literal(!0),site_id:k,page_path:Tn,route_id:re.string().min(1),snapshot_id:I,advisories:re.array(In).default([])},Id=mi.safeExtend({execution_scene:re.literal("page_template_create"),external_run_id:Lt,external_thread_id:Lt,callback_status:re.null(),status:re.enum(["running","succeeded","failed"]),outcome:re.enum(["succeeded","failed"]).nullable(),degraded_reason:re.null(),changes:re.null().default(null)}),Rk=re.object({task:Id}).strict(),Ik=re.object({...tr,promoted_template_id:Xe,deleted_template_ids:re.array(Xe),status:re.literal("promoted")}).strict(),Tk=re.object({...tr,deleted_template_ids:re.array(Xe),status:re.literal("cleaned")}).strict(),kk=re.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_SOURCE_UNSUPPORTED","PAGE_TEMPLATE_GENERATION_FAILED","PAGE_TEMPLATE_PATCH_FAILED"]);import{z as pi}from"zod";var nr=pi.object({primary_products:pi.string().trim().min(1).max(1e3).optional(),current_markets:pi.string().trim().min(1).max(1e3).optional(),qualifications:pi.string().trim().min(1).max(1e3).optional()}).strict();function Pk(e){return Object.values(e).some(n=>typeof n=="string"&&n.trim().length>0)}import{z as lt}from"zod";var ir={autoplay:lt.boolean().optional(),intervalMs:lt.number().int().min(5e3).max(15e3).optional(),loop:lt.boolean().optional()},di=lt.discriminatedUnion("kind",[lt.object({kind:lt.literal("media-carousel"),presentation:lt.enum(["flat","angled"]).optional(),...ir}).strict(),lt.object({kind:lt.literal("category-carousel"),...ir}).strict()]);import{z as kn}from"zod";var Td=40,Mt=kn.object({protocol:kn.enum(["phone","form","download","route","external"]),ctaLabel:kn.string().min(1).max(Td),ctaTarget:kn.string().min(1).max(200).optional(),requiresOwnerDetail:kn.boolean().optional()});var Xt=["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 jk(e){let n=e.VCP_REDIS_URL??e.REDIS_URL;if(n){let i=new URL(n);return{url:n,host:i.hostname,port:i.port?Number(i.port):6379,password:i.password?decodeURIComponent(i.password):void 0}}return{host:e.VCP_REDIS_HOST??"127.0.0.1",port:kd(e.VCP_REDIS_PORT,56379)}}function kd(e,n){if(!e)return n;let i=Number(e);return Number.isInteger(i)&&i>0?i:n}import{z as ae}from"zod";var Ad=ae.enum(["component","page","shared"]),wd=ae.enum(["generation_failed","repair_exhausted","page_unusable","check_incomplete","design_missing","chrome_fallback","style_fallback","resume_exhausted","user_stopped","conflict"]),sr=ae.object({kind:Ad,target_id:ae.string().min(1),page_id:ae.string().min(1).nullable(),reason:wd,repair_attempts:ae.number().int().nonnegative(),message:ae.string().min(1),filled:ae.boolean().optional()}).strict(),Pd=ae.enum(["complete","partial","omitted","check_incomplete","pending"]),Cd=ae.object({page_id:ae.string().min(1),slug:ae.string().min(1),title:ae.string().min(1),parent_page_id:ae.string().min(1).nullable(),result:Pd,attempts:ae.number().int().nonnegative(),omissions:ae.array(sr)}).strict(),An=ae.object({schema_version:ae.literal(1),sitemap_id:ae.string().min(1),confirmed_page_ids:ae.array(ae.string().min(1)).min(1),pages:ae.array(Cd),shared:ae.array(sr),stopped_by_user:ae.boolean(),resume_count:ae.number().int().nonnegative(),home_replaced_by:ae.string().min(1).nullable(),updated_at:ae.string().min(1)}).strict(),ar=ae.object({type:ae.literal("workspace.generation_ledger"),ledger:An,at:ae.string().min(1)}).strict();function Uk(e){return e.pages.filter(n=>n.result==="complete"||n.result==="partial").length}function Fk(e){return e.pages.filter(n=>n.result==="complete"||n.result==="partial"||n.omissions.some(i=>i.kind==="page")).length}import{z as F}from"zod";var Is=F.enum(["text","url","document","image"]),Ts=F.enum(["pending","ready","failed"]),vd=F.enum(["pending","ready","failed"]),Dd=F.enum(["product","price","contact","copy","audience","other"]),ui=F.object({fact:F.string().min(1).max(300),kind:Dd,source_id:En,quote:F.string().min(1).max(500),trust:F.enum(["verbatim","ocr"]).default("verbatim")}),Od=F.object({page_type:F.string().min(1).max(40),sections:F.array(F.string().min(1).max(40)).max(12)}),gi=F.object({source_id:En,nav_structure:F.array(F.string().min(1).max(30)).max(12),page_patterns:F.array(Od).max(10),tone:F.array(F.string().min(1).max(20)).max(8),screenshot_ref:F.string().optional()}),Nd=F.object({source_id:En,type:Is,status:Ts,title:F.string().max(120).optional(),original_ref:F.string().min(1),source_metadata:F.record(F.string(),F.unknown()),error_code:F.string().optional(),submitted:F.boolean().optional()}),_i=F.object({topic:F.string().min(1).max(80),variants:F.array(F.object({value:F.string().min(1).max(300),source_id:En})).min(2)}),jd=F.object({type:F.literal("text"),content:F.string().min(20).max(1e4),title:F.string().min(1).max(120).optional()}).strict(),Ld=F.object({type:F.literal("url"),url:F.string().url().max(2048),rights_ack:F.boolean().optional(),title:F.string().min(1).max(120).optional()}).strict(),Bk=F.discriminatedUnion("type",[jd,Ld]),Kk=[".docx",".html",".md",".txt"],zk=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],Hk=10*1024*1024,$k=2,Vk=F.object({consent_cross_border:F.union([F.literal(!0),F.literal("true")]),consent_text_version:F.string().min(1).max(120),title:F.string().min(1).max(120).optional()}).strict();function Yk(e){return e===!0||e==="true"}var Xk=[".png",".jpg",".jpeg",".webp"],Qk=["image/png","image/jpeg","image/webp","application/octet-stream"],Zk=8*1024*1024,Jk=10,Md=F.enum(["asset","reference"]),e0=F.object({image_role:Md,title:F.string().min(1).max(120).optional()}).strict(),t0=F.object({version:F.literal(1),site_id:k,tenant_id:F.string().min(1),user_prompt:F.string(),status:vd,sources:F.array(Nd).max(16),facts:F.array(ui).max(120),reference:gi.optional(),conflicts:F.array(_i).max(20)}).superRefine((e,n)=>{let i=new Map(e.sources.map(s=>[s.source_id,s]));for(let[s,a]of e.facts.entries()){let o=i.get(a.source_id);(!o||o.type==="url")&&n.addIssue({code:"custom",path:["facts",s,"source_id"],message:"facts must reference a text/document/image source (never url)"})}if(e.reference){let s=i.get(e.reference.source_id),a=s?.type==="image"&&s.source_metadata.image_role==="reference";(!s||s.type!=="url"&&!a)&&n.addIssue({code:"custom",path:["reference","source_id"],message:"reference must point at a url source or reference image source"})}});function n0(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 L}from"zod";import{z as hi}from"zod";var _e=hi.object({routeId:hi.string().min(1),templateId:Xe.optional()}).strict(),B=hi.object({routeId:hi.string().min(1),effectiveTemplateId:Xe.optional()}).strict();function ks(e){return JSON.stringify([e.routeId,e.effectiveTemplateId??null])}function o0(e){let n;try{n=JSON.parse(e)}catch{return null}if(!Array.isArray(n)||n.length!==2)return null;let[i,s]=n,a=B.safeParse(s===null?{routeId:i}:{routeId:i,effectiveTemplateId:s});return a.success?a.data:null}var Ud=["design.md","DESIGN.md"],or=["components/site","src/components/site","lib/generated","src/lib/generated","public"],Fd=["components/system/not-found-content.tsx","src/components/system/not-found-content.tsx"],Gd=["app/globals.css","src/app/globals.css"],qd=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],Wd=new Set(qd),As="source-delete",rr=L.literal(As),Ee=L.string().min(1).refine(mr,"Invalid site edit source path"),Bd=L.string().min(1).refine(Qd,"Invalid site edit source directory path"),p0=L.enum(["text","binary"]),Si=L.object({composition:B,path:Ee,language:L.string().min(1).nullable(),sizeBytes:L.number().int().nonnegative(),contentHash:L.string().min(1).optional()}).strict(),Kd=L.discriminatedUnion("kind",[Si.extend({kind:L.literal("text"),language:L.string().min(1),readonly:L.boolean().default(!1)}),Si.extend({kind:L.literal("binary"),language:L.null(),mimeType:L.string().min(1).optional(),readonly:L.literal(!0)})]),cr=L.lazy(()=>L.discriminatedUnion("kind",[L.object({kind:L.literal("directory"),name:L.string().min(1),path:Bd,children:L.array(cr)}),L.object({kind:L.literal("file"),name:L.string().min(1),path:Ee,file:Kd}).superRefine((e,n)=>{e.path!==e.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),zd=L.enum(["max-files","max-depth","max-total-bytes"]),Hd=L.object({reasons:L.array(zd).min(1),maxFiles:L.number().int().positive(),maxDepth:L.number().int().positive(),maxTotalBytes:L.number().int().positive()}),d0=L.object({composition:B,nodes:L.array(cr),defaultPath:Ee.optional(),totalFiles:L.number().int().nonnegative(),truncated:Hd.optional()}).strict(),u0=L.object({composition:_e}).strict(),g0=L.object({path:Ee,composition:_e}).strict(),$d=Si.extend({kind:L.literal("text"),language:L.string().min(1),readonly:L.boolean().default(!1),content:L.string()}),Vd=L.enum(["too-large","unsupported-mime","bytes-unavailable"]),Yd=Si.extend({kind:L.literal("binary"),language:L.null(),readonly:L.literal(!0),mimeType:L.string().min(1),contentBase64:L.string().min(1).optional(),previewUnavailableReason:Vd.optional()}),_0=L.discriminatedUnion("kind",[$d,Yd]),h0=L.object({key:L.string().min(1),composition:_e}).strict(),Xd=L.object({startLine:L.number().int().positive(),startColumn:L.number().int().nonnegative(),endLine:L.number().int().positive(),endColumn:L.number().int().nonnegative()}),S0=L.object({key:L.string().min(1),composition:B,sourceFile:Ee,componentName:L.string().min(1),openingElementRange:Xd,structuralPath:L.string().min(1),textPreview:L.string().min(1).optional()}).strict();function mr(e){return!fi(e)&&!Jd(e)||ur(e)?!1:Cs(e)||dr(e)||pr(e)||lr(e)||or.some(n=>e===n||e.startsWith(`${n}/`))}function ws(e){return Cs(e)||Wd.has(tu(e))}function Qd(e){return!fi(e)&&!eu(e)||ur(e)?!1:e==="app"||e.startsWith("app/")||e==="src"||e==="src/app"||e.startsWith("src/app/")||or.some(n=>e===n||e.startsWith(`${n}/`)||n.startsWith(`${e}/`))}function Zd(e){return Cs(e)}function Ps(e){return mr(e)?Zd(e)?"design-document":pr(e)?"route-entry":dr(e)?"app-global-style":e.toLowerCase()==="lib/generated/media-assets.ts"||e.toLowerCase()==="src/lib/generated/media-assets.ts"?"generated-media-manifest":lr(e)?"system-page":null:null}function lr(e){return Fd.includes(e)}function f0(e){return Ps(e)!==null}function pr(e){return/^(?:src\/)?app\/(?:.*\/)?page\.[cm]?[jt]sx?$/.test(e.toLowerCase())}function Jd(e){return li(e)&&fi(e.replace("/.vcp/","/_vcp/"))}function eu(e){return/^(?:src\/)?app\/\.vcp(?:\/page-templates(?:\/.+)?)?$/i.test(e)?fi(e.replace("/.vcp","/_vcp")):!1}function dr(e){return Gd.some(n=>n.toLowerCase()===e.toLowerCase())}function tu(e){let n=e.split("/").at(-1)??e,i=n.lastIndexOf(".");return i>0?n.slice(i).toLowerCase():""}function Cs(e){return!e.includes("/")&&Ud.some(n=>n.toLowerCase()===e.toLowerCase())}function ur(e){let n=e.toLowerCase(),i=n.split("/"),a=(i.at(-1)??n).replace(/\.[^.]+$/,"");return/^(?:src\/)?app\/api(?:\/|$)/.test(n)||/^(?:src\/)?app\/(?:.*\/)?route\.[cm]?[jt]sx?$/.test(n)||/^(?:src\/)?app\/(?:.*\/)?(?:action|actions)\.[cm]?[jt]sx?$/.test(n)||/(^|\/)[^/]+\.server\.[cm]?[jt]sx?$/.test(n)||n==="lib/server"||n.startsWith("lib/server")||n==="src/lib/server"||n.startsWith("src/lib/server")||n==="lib/db"||n.startsWith("lib/db")||n==="src/lib/db"||n.startsWith("src/lib/db")||n==="lib/cms"||n.startsWith("lib/cms/")||n==="src/lib/cms"||n.startsWith("src/lib/cms/")?!0:a==="server"||a==="db"||a==="database"||a==="auth"||a==="secret"||a==="secrets"||a==="token"||a==="tokens"||a==="credential"||a==="credentials"||i.includes("server")||i.includes("secrets")}function fi(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 Ae}from"zod";var gr=Ae.string().min(1).max(320).refine(e=>!e.includes("..")&&/^(?:(?:src\/)?(?:app|pages|components|lib|hooks|utils|types)\/|next\.config\.)[\w./()[\]@-]+$/.test(e)),nu=Ae.union([gr,Ae.string().max(320).regex(/^\.next\/[\w./()[\]@-]+\.js$/).refine(e=>!e.includes(".."))]),vs=Ae.object({code:Ae.enum(["NEXT_PAGE_CODE_ERROR","NEXT_CLIENT_COMPONENT_FUNCTION_PROP"]),message:Ae.string().min(1).max(2e3),messages:Ae.array(Ae.string().min(1).max(2e3)).max(3),source_paths:Ae.array(gr).max(8),components:Ae.array(Ae.string().max(80).regex(/^[\w.$-]+$/)).max(8),stack:Ae.array(Ae.object({file:nu,line:Ae.number().int().positive(),column:Ae.number().int().nonnegative(),function:Ae.string().max(80),generated:Ae.boolean()}).strict()).max(8)}).strict();function iu(e){return e==="NEXT_PAGE_CODE_ERROR"||e==="NEXT_CLIENT_COMPONENT_FUNCTION_PROP"}import{z as su}from"zod";var wn=["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"],au=["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"],ou=[...wn,...au],ru=new Set(["ar","fa","he"]),R0=[{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"}],cu={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"},mu=new Set(wn);function _r(e){return mu.has(e)?e:cu[e]}var lu="en";function I0(e){let n=e.toLowerCase().split("-",1)[0]??"";return ru.has(n)?"rtl":"ltr"}var pu={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 T0(e){return pu[e]??lu}var du=["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"],uu=new Set(du);function k0(e){return uu.has(e)}var Re=su.enum(ou);import{z as gu}from"zod";var bi=gu.string().uuid();import{z as S}from"zod";import{z as ee}from"zod";var Et=ee.string().trim().min(1).max(128),Qt=ee.string().trim().min(1).max(500),_u=["\u4EA7\u54C1","\u90E8\u4EF6/\u8017\u6750","\u5E94\u7528\u65B9\u6848","\u5B9A\u5236/OEM","\u670D\u52A1","\u8D44\u8D28/\u80FD\u529B"],hu=ee.enum(_u),Pn=ee.object({id:Et,keyword:ee.string().trim().min(1).max(255),business_id:Et,business_name:ee.string().trim().min(1).max(255),category:hu,selling_points:ee.string().trim().max(2e3),section_id:Et,content_usage:ee.enum(["product","category","solution","service","capability","article","faq"]),intent:Qt,semantic_group:Et,primary_business:ee.boolean(),monthly_volume:ee.number().int().min(1),keyword_difficulty:ee.number().min(0).max(100).nullable(),variants:ee.array(ee.string().trim().min(1).max(255)),source:ee.literal("semrush"),source_evidence:ee.array(Qt).min(1)}).strict(),Ds=ee.object({schema_version:ee.literal(1),snapshot_id:Et,dependency_hash:ee.string().regex(/^[a-f0-9]{64}$/),language:ee.string().trim().min(2).max(35),database:ee.string().regex(/^[a-z]{2}$/),generated_at:ee.string().datetime({offset:!0}),entries:ee.array(Pn),candidates:ee.array(Pn),search_result_ids:ee.array(Et).optional()}).strict().superRefine((e,n)=>{for(let i of["entries","candidates"]){let s=e[i];(new Set(s.map(a=>a.id)).size!==s.length||new Set(s.map(a=>a.keyword.normalize("NFKC").trim().toLowerCase())).size!==s.length)&&n.addIssue({code:"custom",path:[i],message:"\u5173\u952E\u8BCD\u4E0D\u80FD\u91CD\u590D"})}}),yi=ee.object({snapshot_id:Et,entry_ids:ee.array(Et).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"})}),v0=ee.object({expected_revision:ee.number().int().nonnegative(),business_subject:ee.string().trim().min(1).max(255)}).strict(),hr=ee.object({points:ee.array(Qt).length(3),comparison:ee.array(ee.object({dimension:Qt,recommended:Qt,alternative:Qt}).strict()).min(1).max(4)}).strict();var pt=S.string().trim().min(1).max(128),Ut=S.string().trim().min(1).max(200),Qe=S.string().trim().min(1).max(2e3),Os=S.string().trim().max(200),xi=S.string().regex(/^[a-f0-9]{64}$/),Ns=S.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),Zt=["market","persona","product","brand","competition","structure","language","keywords","risk"],Ne=Zt.length,Su=["keywords"],Cn=Zt.filter(e=>!Su.includes(e)),Ei=Cn.length,Ri=S.enum(Zt);function L0(e){return Cn.some(n=>n===e)}var Ii=Ri,Sr=["recommended","conservative","focused"],fr=S.enum(Sr),vn=S.union([fr,S.literal("confirmed")]),Ti=S.enum(["single_country","regional_combination","multi_market"]),ki=S.object({code:S.string().trim().regex(/^[A-Z]{2}$/),name_zh:Ut,name_en:Ut,region:Ut}).strict(),fu=S.object({id:fr,presentation:hr.nullish(),sections:S.array(S.object({id:S.string().trim().min(1).max(128),label:S.string().trim().min(1).max(200)}).strict()).max(30).optional(),label:Ut,note:Qe,impact:S.string().trim().max(500).nullish(),set_value:S.string().trim().max(500).nullish(),site_locale:Re.nullish(),market_type:Ti.nullish(),markets:S.array(ki).max(32).optional()}).loose(),bu=S.object({lead:S.string().trim().min(1).max(500),title:Ut,columns:S.array(S.string().trim().min(1).max(80)).min(1).max(8),rows:S.array(S.array(S.string().trim().max(500)).min(1).max(8)).max(100)}).strict().superRefine((e,n)=>{e.rows.forEach((i,s)=>{i.length!==e.columns.length&&n.addIssue({code:"custom",path:["rows",s],message:"Each Step5 plan row must match the column count."})})}),yu=S.object({goal:Qe,issue:Qe,criteria:S.array(Qe).min(1).max(12),resources:S.array(Qe).min(1).max(12),risks:S.array(Qe).min(1).max(12),execution:S.object({standard:S.array(Qe).min(1).max(12),acceptance:S.array(Qe).min(1).max(12),downstream:S.array(Qe).min(1).max(12)}).strict()}).strict(),xu=S.object({source_type:S.enum(["step2","step3"]),source_id:pt,field_path:S.string().trim().max(300).nullish()}).strict(),Eu=S.enum(["ok","degraded"]),js=S.object({key:Ii,position:S.number().int().min(1).max(Ne),category:Ut,title:Ut,summary:Qe,rationale:Qe,parameter:S.string().trim().max(500).nullish(),options:S.array(fu).max(3),keyword_library:Ds.nullish(),plan:bu.nullish(),structure_detail:yu.nullish(),note_tips:S.array(S.string().trim().min(1).max(200)).max(6),note_placeholder:S.string().trim().min(1).max(300),evidence_refs:S.array(xu).min(1).max(8),generation_status:Eu.optional()}).loose().superRefine((e,n)=>{let i=Zt.indexOf(e.key)+1;i>0&&e.position!==i&&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.options.forEach((s,a)=>{s.id!==Sr[a]&&n.addIssue({code:"custom",path:["options",a,"id"],message:"Step5 strategy options must use the canonical order."})}),e.structure_detail&&e.key!=="structure"&&n.addIssue({code:"custom",path:["structure_detail"],message:"Structure detail is only valid for the structure item."})}),Ru=S.object({item_key:Ri,selected_option_id:vn,note:Os,keyword_selection:yi.optional()}).strict().superRefine((e,n)=>{(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"})}),Ls=S.object({item_key:Ri,selected_option_id:vn,note:Os,keyword_selection:yi.optional(),keyword_library:Ds.optional(),market_type:Ti.nullish(),markets:S.array(ki).max(32).optional(),selected_value:S.unknown().nullable(),accepted_at:S.string().datetime({offset:!0})}).loose(),Iu=S.enum(["running","succeeded","failed"]),Tu=S.object({schema_version:S.literal(1),source_job_id:pt,site_id:pt,output_locale:Ns.optional(),items:S.array(js).length(Ne),decisions:S.array(Ls).min(Ei).max(Ne)}).loose(),ku=S.object({strategy_version_id:pt,site_id:pt,source_job_id:pt,output_locale:Ns.optional(),version:S.number().int().positive(),checksum:xi,snapshot:Tu,committed_at:S.string().datetime({offset:!0})}).loose(),br=S.object({job_id:pt,site_id:pt,output_locale:Ns.optional(),status:Iu,keyword_library_needs_update:S.boolean().optional(),revision:S.number().int().nonnegative(),items:S.array(js).max(Ne),decisions:S.array(Ls).max(Ne),output_checksum:xi.nullish(),error_code:S.string().trim().max(64).nullish(),error_message:S.string().trim().max(500).nullish(),committed_version:ku.nullish()}).loose().superRefine((e,n)=>{let i=e.items.map(a=>a.key);new Set(i).size!==i.length&&n.addIssue({code:"custom",path:["items"],message:"Step5 job items must have unique keys."});let s=e.decisions.map(a=>a.item_key);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["decisions"],message:"Step5 job decisions must have unique item keys."})}),M0=S.object({force_refresh:S.boolean().optional().default(!1)}).strict(),U0=br.extend({cached:S.boolean()}).strict(),F0=S.object({expected_revision:S.number().int().nonnegative()}).strict(),G0=S.object({expected_revision:S.number().int().nonnegative(),selected_option_id:vn,note:Os,keyword_selection:yi.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"})}),q0=S.object({revision:S.number().int().positive(),decision:Ls}).strict(),W0=S.object({idempotency_key:S.string().trim().min(8).max(128),expected_revision:S.number().int().nonnegative(),decisions:S.array(Ru).min(Ei).max(Ne)}).strict().superRefine((e,n)=>{let i=e.decisions.map(s=>s.item_key);new Set(i).size!==i.length&&n.addIssue({code:"custom",path:["decisions"],message:"Step5 commit decisions must use unique strategy keys."}),Cn.forEach(s=>{i.includes(s)||n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit is missing ${s}.`})})}),B0=S.object({strategy_version_id:pt,version:S.number().int().positive(),checksum:xi,next_path:S.string().trim().min(1).max(500)}).strict(),Au=br.extend({completed:S.number().int().min(0).max(Ne),total:S.literal(Ne)}).loose(),wu=["snapshot","strategy_item_start","strategy_item_done","strategy_items_invalidated","strategy_generation_done","failed"];function K0(e){return typeof e=="string"&&wu.includes(e)}var z0=S.discriminatedUnion("event",[S.object({id:S.number().int().nonnegative(),event:S.literal("snapshot"),data:Au}).strict(),S.object({id:S.number().int().positive(),event:S.literal("strategy_item_start"),data:S.object({key:Ri,position:S.number().int().min(1).max(Ne)}).strict()}).strict(),S.object({id:S.number().int().positive(),event:S.literal("strategy_item_done"),data:S.object({item:js}).strict()}).strict(),S.object({id:S.number().int().positive(),event:S.literal("strategy_items_invalidated"),data:S.object({after_position:S.number().int().min(0).max(Ne)}).strict()}).strict(),S.object({id:S.number().int().positive(),event:S.literal("strategy_generation_done"),data:S.object({item_count:S.literal(Ne),schema_version:S.literal(1),checksum:xi}).strict()}).strict(),S.object({id:S.number().int().positive(),event:S.literal("failed"),data:S.object({code:S.string().trim().min(1).max(64),message:S.string().trim().min(1).max(500),retryable:S.boolean(),item_key:Ii.optional()}).loose()}).loose()]);import{z as Pu}from"zod";var Ze=Pu.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 V0(e,n){let i=Ze.safeParse(e),s=Ze.safeParse(n);if(!i.success||!s.success)return null;let a=yr(i.data),o=yr(s.data);for(let r=0;r<3;r+=1){let l=xr(a.release[r],o.release[r]);if(l!==0)return l}if(!a.prerelease&&!o.prerelease)return 0;if(!a.prerelease)return 1;if(!o.prerelease)return-1;let c=Math.max(a.prerelease.length,o.prerelease.length);for(let r=0;r<c;r+=1){let l=a.prerelease[r],x=o.prerelease[r];if(l===void 0)return-1;if(x===void 0)return 1;if(l===x)continue;let h=/^\d+$/u.test(l),C=/^\d+$/u.test(x);return h&&C?xr(BigInt(l),BigInt(x)):h?-1:C?1:Cu(l,x)}return 0}function yr(e){let n=e.indexOf("+"),i=n===-1?e:e.slice(0,n),s=i.indexOf("-"),a=s===-1?i:i.slice(0,s),o=s===-1?void 0:i.slice(s+1),[c,r,l]=a.split(".");return{release:[BigInt(c),BigInt(r),BigInt(l)],...o?{prerelease:o.split(".")}:{}}}function xr(e,n){return e<n?-1:e>n?1:0}function Cu(e,n){return e<n?-1:e>n?1:0}import{z as Z}from"zod";import{z as De}from"zod";var Ms=64,vu=512*1024,Us=4*1024*1024,Du=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function Ou(e){return Du.test(e)}var Er=De.string().min(1).refine(Ou,{message:"Materialization pathTemplate must be a safe relative path."}),Nu=De.object({pathTemplate:Er,content:De.string(),role:De.string().min(1).optional()}).strict(),ju=De.union([De.object({kind:De.literal("default")}).strict(),De.object({kind:De.literal("named"),name:De.string().min(1)}).strict()]),Lu=De.object({pathTemplate:Er,export:ju}).strict(),Mu=De.array(De.never()).optional(),Ft=De.object({instanceBaseName:De.string().min(1),files:De.array(Nu).min(1).max(Ms),entry:Lu,dataRequirements:Mu}).strict().superRefine((e,n)=>{let i=new Set,s=e.entry.pathTemplate,a=0;for(let[o,c]of e.files.entries()){i.has(c.pathTemplate)&&n.addIssue({code:"custom",path:["files",o,"pathTemplate"],message:`Duplicate materialization pathTemplate: ${c.pathTemplate}`}),i.add(c.pathTemplate);let r=new TextEncoder().encode(c.content).length;r>vu&&n.addIssue({code:"custom",path:["files",o,"content"],message:"Materialization file content exceeds the per-file byte limit."}),a+=r}i.has(s)||n.addIssue({code:"custom",path:["entry","pathTemplate"],message:"Materialization entry pathTemplate must match a file."}),a>Us&&n.addIssue({code:"custom",path:["files"],message:"Materialization exceeds the total content byte limit."})});var Rr="insertNewComponent",eA={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"},Fs=Z.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),Ir=Z.lazy(()=>Z.object({id:Z.string().uuid(),key:Z.string().min(1),name:Z.string(),children:Z.array(Ir)}).strict()),Tr=Z.object({category_group_key:Z.literal(Rr),categories:Z.array(Ir)}).strict(),Uu=Z.object({resource_id:Z.string().min(1),name:Z.string(),description:Z.string().nullable(),thumbnail_url:Z.string().nullable(),resolved_version:Fs,category_id:Z.string().uuid().nullable()}).strict(),kr=Z.object({category_group_key:Z.literal(Rr),items:Z.array(Uu),next_cursor:Z.string().min(1).nullable()}).strict(),tA=Z.object({resource_id:Z.string().min(1),resolved_version:Fs,anchor_block_id:Z.string().min(1),placement:Z.enum(["before","after"])}).strict(),nA=Z.object({status:Z.literal("mock_acknowledged")}).strict(),iA=Z.object({category_id:Z.string().uuid().optional(),include_descendants:Z.enum(["true","false"]).optional().transform(e=>e==="true"),limit:Z.coerce.number().int().min(1).max(100).optional().default(20),cursor:Z.string().min(1).optional()}).strict().superRefine((e,n)=>{e.include_descendants&&!e.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),Gt=Fs,sA=Z.object({version:Gt}).strict(),Ar=Z.object({resource_id:Z.string().min(1),resolved_version:Gt,revision_id:Z.string().uuid().optional(),digest_sha256:Z.string().regex(/^[a-f0-9]{64}$/),materialization:Ft}).strict();import{z as E}from"zod";import{z as _}from"zod";var Cr="/",vr=255,Fu=2048,Gu=5e3,qu=64;function Dr(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(i=>![".",".."].includes(i))}catch{return!1}}var qt=_.string().min(1).max(vr).refine(Dr,"url_path must be a safe site-relative path"),Ws=_.string().min(1).max(Fu).refine(Dr,"url must be a safe site-relative path"),Bs=_.string().max(vr),Ai=_.preprocess(e=>e===0?!1:e===1?!0:e,_.boolean()),Dn=_.union([_.url(),Ws]),Ks=_.enum(["landing_page","general_page","detail_page"]),zs=_.enum([...Ks.options,"list_page","category_page","tag_page","author_page","search_page","date_page"]);function cA(e){return e.vcp_managed&&e.url!==null&&Ks.safeParse(e.page_type).success&&qt.safeParse(e.url_path).success}function wr(e){return e.includes("{")||e.includes("}")}function mA(e){if(!wr(e.url_path))return Wu(e.url_path);if(e.url===null)return null;let n=/^[a-z][a-z0-9+.-]*:\/\//iu.test(e.url)?Bu(e.url):e.url;if(n===null||wr(n))return null;let i=Ws.safeParse(n);return i.success?i.data:null}function Wu(e){let n=qt.safeParse(e);return n.success?n.data:null}function Bu(e){try{return new URL(e).pathname}catch{return null}}var Or=_.lazy(()=>_.object({cms_page_id:_.number().int().positive(),title:_.string().trim().min(1).max(255),url_path:Bs,url:Dn.nullable(),page_type:zs,vcp_managed:Ai,children:_.array(Or)}).strict()),Ku=_.object({group_id:_.string().min(1),title:_.string().trim().min(1).max(255),collection_slug:_.string(),pages:_.array(Or)}).strict(),Pr=_.object({groups:_.array(Ku)}).strict(),Nr=_.lazy(()=>_.object({id:_.number().int().positive(),title:_.string().trim().min(1).max(120),url_path:Bs,parent_id:_.number().int().nonnegative(),group_type:_.string().min(1),page_type:zs,plugin_id:_.number().int().nonnegative(),is_default:Ai,is_published:Ai,url:Dn.nullable(),vcp_managed:Ai,children:_.array(Nr)})),zu=_.object({plugin_id:_.number().int().nonnegative(),slug:_.string(),group_name:_.string().trim().min(1).max(255),pages:_.array(Nr)}).passthrough(),Hu=_.array(zu);function jr(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=>jr(n))}}function lA(e){if(!$u(e))return null;let n=Pr.safeParse(e);if(n.success)return n.data;let i=Hu.safeParse(e);if(!i.success)return null;let s=Pr.safeParse({groups:i.data.map(a=>({group_id:String(a.plugin_id),title:a.group_name,collection_slug:a.slug,pages:a.pages.map(jr)}))});return s.success?s.data:null}function $u(e){let n=Array.isArray(e)?e:Gs(e)&&Array.isArray(e.groups)?e.groups:[],i=[];for(let a of n)if(!(!Gs(a)||!Array.isArray(a.pages)))for(let o of a.pages)i.push({node:o,depth:1});let s=0;for(;i.length>0;){let a=i.pop();if(s+=1,s>Gu||a.depth>qu)return!1;if(!(!Gs(a.node)||!Array.isArray(a.node.children)))for(let o of a.node.children)i.push({node:o,depth:a.depth+1})}return!0}function Gs(e){return typeof e=="object"&&e!==null}var Vu=_.enum(["invalid_url_path","missing_url","not_vcp_managed","unsupported_page_type","page_not_generated"]),Yu=_.enum(["home_page","invalid_url_path","not_selectable","not_vcp_managed","page_has_children","last_selectable_page","cms_unbound","unsupported_page_type"]),Lr=_.lazy(()=>_.object({cms_page_id:_.number().int().positive().nullable(),title:_.string().trim().min(1).max(255),url_path:Bs,preview_url_path:Ws.nullable(),url:Dn.nullable(),page_type:zs,vcp_managed:_.boolean(),selectable:_.boolean(),disabled_reason:Vu.nullable(),can_delete:_.boolean(),delete_block_reason:Yu.nullable(),has_cms_children:_.boolean(),children:_.array(Lr)}).strict()),Mr=_.object({group_id:_.string().min(1),title:_.string().trim().min(1).max(255),pages:_.array(Lr)}).strict(),pA=_.object({base_snapshot_id:I,expected_url_path:qt}).strict(),Xu=_.enum(["succeeded","failed"]),Qu=_.object({url_path:qt,phase:_.enum(["ensure","binding","delete"]),code:_.string().min(1),message:_.string().min(1)}).strict(),Hs=_.object({status:Xu,checked_count:_.number().int().nonnegative(),ensured_count:_.number().int().nonnegative(),deleted_count:_.number().int().nonnegative(),already_absent_count:_.number().int().nonnegative(),failed_pages:_.array(Qu),warnings:_.array(_.string().min(1))}).strict(),Zu=_.object({result_snapshot_id:I,deleted_files:_.array(_.string().min(1)),updated_files:_.array(_.string().min(1)),preserved_shared_files:_.array(_.string().min(1)),warnings:_.array(_.string().min(1)),next_url:Dn.nullable(),previous_url:Dn.nullable(),cms_reconcile_result:Hs}).strict(),dA=_.object({code:_.literal(0),message:_.string(),data:Zu}).strict(),uA=_.object({snapshot_id:I}).strict(),Ju=_.object({snapshot_id:I,warnings:_.array(_.string().min(1)),cms_reconcile_result:Hs}).strict(),gA=_.object({code:_.literal(0),message:_.string(),data:Ju}).strict(),_A=_.object({snapshot_id:I}).strict(),eg=_.object({snapshot_id:I,status:_.enum(["converged","required","unknown"]),reason:_.string().min(1).max(255).optional()}).strict(),hA=_.object({code:_.literal(0),message:_.literal("ok"),data:eg}).strict(),SA=_.object({source_committed:_.boolean(),result_snapshot_id:I.optional(),cms_reconcile_result:Hs.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"})}),tg=Ks,ng=_.object({title:_.string().min(1).max(255).optional(),description:_.string().min(1).max(1e3).optional(),keywords:_.string().min(1).max(255).optional(),meta_tags_json:_.record(_.string(),_.unknown()).optional(),schema_json:_.union([_.record(_.string(),_.unknown()),_.array(_.unknown())]).optional(),breadcrumbs_json:_.array(_.unknown()).optional()}).strict(),Ur=_.object({url_path:qt,title:_.string().trim().min(1).max(255),kind:tg,route_file:_.string().min(1),collection_id:_.string().trim().min(1).optional(),seo:ng.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===Cr)&&n.addIssue({code:"custom",path:["kind"],message:"The home target must be the only landing_page target."})}),ig=_.object({complete:_.literal(!0),targets:_.array(Ur)}).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(s=>s.url_path===Cr).length!==1&&n.addIssue({code:"custom",path:["targets"],message:"A complete page target set must contain exactly one home page."})}),fA=_.discriminatedUnion("complete",[ig,_.object({complete:_.literal(!1),targets:_.array(Ur),errors:_.array(_.string().min(1)).min(1)}).strict()]),qs=_.string().regex(/^sha256:[0-9a-f]{64}$/),bA=_.object({projection_hash:qs.nullable()}).strict(),yA=_.object({expected_projection_hash:qs.nullable(),projection_hash:qs}).strict(),xA=_.object({clean_snapshot_id:_.string().uuid().nullable()}).strict(),EA=_.object({clean_snapshot_id:_.string().uuid()}).strict();var Fr="insertNewPage",wA={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"},Wt=E.enum(["page","pages"]),sg=E.object({resource_id:E.string().min(1),resource_type:Wt,resolved_version:Gt,template_page_id:E.string().min(1)}).strict(),Gr=E.lazy(()=>E.object({id:E.string().uuid(),key:E.string().min(1),name:E.string(),children:E.array(Gr)}).strict()),qr=E.object({category_group_key:E.literal(Fr),categories:E.array(Gr)}).strict(),ag=E.object({resource_id:E.string().min(1),resource_type:Wt,name:E.string(),description:E.string().nullable(),thumbnail_url:E.string().nullable(),preview_images:E.array(E.object({url:E.string().min(1),page_id:E.string().min(1).nullable(),is_primary:E.boolean()}).strict()).optional(),resolved_version:Gt,category_id:E.string().uuid().nullable()}).strict(),Wr=E.object({category_group_key:E.literal(Fr),items:E.array(ag),next_cursor:E.string().min(1).nullable()}).strict(),PA=E.object({category_id:E.string().uuid().optional(),include_descendants:E.enum(["true","false"]).optional().transform(e=>e==="true"),limit:E.coerce.number().int().min(1).max(100).optional().default(20),cursor:E.string().min(1).optional()}).strict().superRefine((e,n)=>{e.include_descendants&&!e.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),On=Gt,wi=E.string().regex(/^\/[a-z0-9]+(?:-[a-z0-9]+)*$/),CA=E.string().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),og=E.object({template_page_id:E.string().min(1),title:E.string().trim().min(1).max(120),final_route:wi}).strict(),rg=E.object({template_page_id:E.string().min(1),title:E.string().trim().min(1).max(120),source:sg.optional(),blocks:E.array(E.discriminatedUnion("kind",[E.object({kind:E.literal("package-component"),instance_id:E.string().min(1),component_id:E.string().min(1),label:E.string().trim().min(1).max(120)}).strict(),E.object({kind:E.literal("component-resource"),instance_id:E.string().min(1),resource_id:E.string().min(1),resolved_version:Gt,label:E.string().trim().min(1).max(120)}).strict()])).optional(),route:E.object({input:E.string(),append_random_suffix:E.boolean().optional(),random_suffix_length:E.number().int().min(4).max(16).optional(),final:wi}).strict()}).strict(),cg=E.object({resource_id:E.string().min(1),resource_type:Wt,resolved_version:On,pages:E.array(rg).min(1)}).strict().superRefine((e,n)=>{Rt(e.pages.map(i=>i.template_page_id),"pages",n),Rt(e.pages.map(i=>i.route.final),"routes",n);for(let[i,s]of e.pages.entries()){if(!s.blocks)continue;let a=new Set;for(let[o,c]of s.blocks.entries())a.has(c.instance_id)&&n.addIssue({code:"custom",path:["pages",i,"blocks",o,"instance_id"],message:`Duplicate block instance identifier within page: ${c.instance_id}`}),a.add(c.instance_id)}});function $s(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 Rt(e,n,i){let s=new Set;for(let[a,o]of e.entries())s.has(o)&&i.addIssue({code:"custom",path:[n,a],message:`Duplicate ${n} identifier: ${o}`}),s.add(o)}var vA=E.object({resource_type:Wt,version:On,pages:E.array(og).min(1)}).strict().superRefine((e,n)=>{$s(e,n),Rt(e.pages.map(i=>i.template_page_id),"pages",n),Rt(e.pages.map(i=>i.final_route),"routes",n)}),mg=E.object({instance_id:E.string().min(1),component_id:E.string().min(1)}).strict(),lg=E.object({component_id:E.string().min(1),materialization:Ft}).strict(),pg=E.object({template_page_id:E.string().min(1),title:E.string().trim().min(1).max(120),final_route:wi,materialization:Ft,components:E.array(mg)}).strict(),Vs=E.object({resource_id:E.string().min(1),resource_type:Wt,resolved_version:On,revision_id:E.string().uuid().optional(),digest_sha256:E.string().regex(/^[a-f0-9]{64}$/),components:E.array(lg),pages:E.array(pg).min(1),project_dependencies:E.record(E.string(),E.never()).optional()}).strict().superRefine((e,n)=>{$s(e,n);let i=e.components.map(a=>a.component_id),s=new Set(i);Rt(i,"components",n),Rt(e.pages.map(a=>a.template_page_id),"pages",n),Rt(e.pages.map(a=>a.final_route),"routes",n);for(let[a,o]of e.pages.entries()){let c=new Set;for(let[r,l]of o.components.entries())s.has(l.component_id)||n.addIssue({code:"custom",path:["pages",a,"components",r,"component_id"],message:`Unknown component reference: ${l.component_id}`}),c.has(l.instance_id)&&n.addIssue({code:"custom",path:["pages",a,"components",r,"instance_id"],message:`Duplicate component instance identifier within page: ${l.instance_id}`}),c.add(l.instance_id)}}),Br=Vs,Kr=E.object({template_page_id:E.string().min(1),title:E.string().trim().min(1).max(120),final_route:wi,route_file_path:E.string().regex(/^app\/[a-z0-9]+(?:-[a-z0-9]+)*\/page\.tsx$/)}).strict(),dg=E.object({template_page_id:E.string().min(1),title:E.string().trim().min(1).max(120),composition_supported:E.boolean(),blocks:E.array(E.object({instance_id:E.string().min(1),component_id:E.string().min(1),label:E.string().trim().min(1).max(120)}).strict())}).strict(),zr=E.object({resource_id:E.string().min(1),resource_type:Wt,resolved_version:On,pages:E.array(dg).min(1)}).strict().superRefine((e,n)=>{$s(e,n),Rt(e.pages.map(i=>i.template_page_id),"pages",n)}),DA=E.object({resource_type:Wt,version:On}).strict(),OA=E.object({draft:cg}).strict(),Hr=E.object({groups:E.array(Mr)}).strict(),$r=E.object({candidate:E.record(E.string(),E.unknown())}).strict();var Jt="[a-z0-9]+(?:-[a-z0-9]+)*",Nn=new RegExp(`^/(?:${Jt}(?:/${Jt})*)?$`),Vr=["/privacy","/cookie-policy","/system/not-found"],ug=Vr.map(e=>`app/${e.slice(1)}/page.tsx`);function gg(e){return e.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Yr(e){return typeof e=="string"&&Nn.test(e)}function Xr(e){if(typeof e!="string")return null;let n=e.trim();if(/[^\x00-\x7F]/.test(n))return null;let i=n.replace(/^\/+|\/+$/g,"");if(i==="")return"/";let s=i.split("/");if(s.some(r=>r==="."||r===".."))return null;let a=i.toLowerCase();if(a==="index"||a==="home")return"/";let o=s.map(gg).filter(r=>r.length>0);if(o.length===0)return null;let c=`/${o.join("/")}`;return Yr(c)?c:null}function Qr(e){let n=Xr(e);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function _g(e){let n=Qr(e);return n==="/"?"app/page.tsx":`app/${n.slice(1)}/page.tsx`}import{z as oe}from"zod";import{z as d}from"zod";import{z as je}from"zod";var hg=je.object({code:je.string().min(1),message:je.string().min(1),details:je.record(je.string(),je.unknown()).optional()}),UA=je.object({code:je.string().min(1),message:je.string().min(1)});function Ys(e){return je.object({ok:je.literal(!0),composition:B,data:e}).strict()}function Sg(e){let n={ok:je.literal(!1),composition:B,error:hg.extend({code:e.codeSchema})};return e.currentSchema&&(n.current=e.currentSchema.optional()),e.diagnosticsSchema&&(n.diagnostics=je.array(e.diagnosticsSchema).optional()),e.dataSchema&&(n.data=e.dataSchema.optional()),je.object(n).strict()}function Zr(e){return je.discriminatedUnion("ok",[Ys(e.dataSchema),Sg({codeSchema:e.codeSchema,currentSchema:e.currentSchema,diagnosticsSchema:e.diagnosticsSchema,dataSchema:e.failureDataSchema})])}import{z as te}from"zod";var dt=te.object({start:te.number().int().nonnegative(),end:te.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"})}),fg=te.object({code:te.enum(["missing-class-name","unsupported-attribute-name","source-locator-warning","invalid-new-attr","version-conflict","write-failed"]),message:te.string().min(1)}),Jr=te.object({path:te.string().min(1),content:te.string(),hash:te.string().min(1).optional()}),BA=te.object({composition:B,revision:te.string().min(1),entryCss:Jr,stylesheets:te.array(Jr).default([])}).strict(),KA=te.object({composition:_e}).strict(),zA=te.object({key:te.string().min(1),composition:_e}).strict(),ec=te.object({key:te.string().min(1),composition:B,filePath:te.string().min(1),componentName:te.string().min(1),sourceKind:te.enum(["missing","stringLiteral","expression"]),attrRaw:te.string().min(1).nullable(),valueRaw:te.string().min(1).nullable(),attrRange:dt.nullable(),openingElementRange:dt,version:te.object({documentVersion:te.number().int().nonnegative(),contentHash:te.string().min(1)}),diagnostics:te.array(fg),computedStyle:te.record(te.string(),te.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"})}),HA=ec,$A=Ys(ec),Xs=te.object({source:te.enum(["style-panel","class-source-editor"]),operation:te.enum(["replace-static-classname","replace-expression","create-attribute","remove-attribute"])});import{z as at}from"zod";var bg=new Set(["children","key","ref","dangerouslysetinnerhtml"]),yg=new Set(["data-designer-hover-outline","data-designer-select-outline"]),xg=/^[A-Za-z_$][A-Za-z0-9_$:-]*$/u;function Eg(e){return{code:"protected-attribute",message:`Property is protected from generic site editing: ${e}`}}function Rg(){return{code:"invalid-attribute-name",message:"Property name must be a valid single JSX attribute name"}}function Ig(e){let n=e.toLowerCase();return bg.has(n)||n.startsWith("data-vcp-")||yg.has(n)||/^on[a-z]/iu.test(e)}function Qs(e){if(!xg.test(e))return{owner:"blocked",name:e,diagnostic:Rg()};if(Ig(e))return{owner:"blocked",name:e,diagnostic:Eg(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 ut}from"zod";var Bt=ut.lazy(()=>ut.union([ut.string(),ut.number().finite(),ut.boolean(),ut.null(),ut.array(Bt),ut.record(ut.string(),Bt)]));var tc=at.string().min(1),Tg=at.discriminatedUnion("operation",[at.object({operation:at.literal("set"),name:tc,value:Bt}).strict(),at.object({operation:at.literal("remove"),name:tc}).strict()]).superRefine((e,n)=>{let i=Qs(e.name);i.owner==="blocked"&&n.addIssue({code:"custom",path:["name"],message:i.diagnostic?.message??"Property is not available for site editing"})}),nc=at.object({kind:at.literal("set-props"),scope:at.enum(["selection","template"]),changes:at.array(Tg).min(1)}).strict().superRefine((e,n)=>{let i=new Map;for(let[s,a]of e.changes.entries()){let o=Qs(a.name),c=kg(o),r=i.get(c);r!==void 0?n.addIssue({code:"custom",path:["changes",s,"name"],message:`Duplicate property change; first declared at index ${r}`}):i.set(c,s)}});function kg(e){return e.owner==="class-name-source"||e.owner==="style"?`owner:${e.owner}`:`name:${e.name}`}import{z as Ag}from"zod";var ic=Ag.enum(["src","alt","poster","href","width","height"]);import{z as en}from"zod";var jn=en.object({editingSessionId:en.string().min(1),lockId:en.string().min(1),ownerId:en.string().min(1),leaseAssertion:en.string().min(1)}).strict(),a1="signed-designer-mutations-v1",o1=en.object({mutationContext:jn}).strict();import{z as u}from"zod";import{z as Ln}from"zod";var Pi="::",Zs=Ln.object({file:Ln.string().min(1),component:Ln.string().min(1),structuralPath:Ln.string().min(1),key:Ln.string().min(1)}).superRefine((e,n)=>{let i=wg(e.file,e.component,e.structuralPath);e.key!==i&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function wg(e,n,i){return`${e}${Pi}${n}${Pi}${i}`}function m1(e){let[n,i,...s]=e.split(Pi);return!n||!i||s.length===0?null:{file:n,component:i,structuralPath:s.join(Pi)}}var Ci=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"]),Mn=u.object({code:u.string().min(1),message:u.string().min(1)}).strict(),Pg=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()]),Cg=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(),vg=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(),Dg=u.object({key:u.string().min(1),containerKey:u.string().min(1),businessMemberKeys:u.array(u.string().min(1)),isMultiMember:u.boolean()}).strict(),ac=u.object({kind:u.literal("page-composition"),placementKey:u.string().min(1),documentVersion:u.number().int().nonnegative(),composition:_e}).strict(),Og=u.object({kind:u.literal("page-composition"),placementKey:u.string().min(1),documentVersion:u.number().int().nonnegative(),composition:B,placementUnitKey:u.string().min(1),relation:u.enum(["before","after","prepend","append"])}).strict(),oc=u.object({kind:u.literal("page-composition"),placementKey:u.string().min(1),documentVersion:u.number().int().nonnegative(),composition:_e,placementUnitKey:u.string().min(1),relation:u.enum(["before","after","prepend","append"])}).strict(),rc=u.object({kind:u.literal("page-unit"),composition:_e,placementUnitKey:u.string().min(1)}).strict(),cc=u.object({kind:u.literal("page-unit"),composition:B,placementUnitKey:u.string().min(1)}).strict();function gt(e,n,i,s,a){let o=new Set;for(let[c,r]of e.entries()){let l=s(r);o.has(l)&&n.addIssue({code:"custom",path:[i,c,a],message:`Duplicate ${i} key: ${l}`}),o.add(l)}}var Ng=u.object({status:u.literal("supported"),version:u.number().int().nonnegative(),composition:B,container:Pg,sourceMembers:u.array(Cg),businessMembers:u.array(vg),placementUnits:u.array(Dg),placements:u.array(Og)}).strict().superRefine((e,n)=>{gt(e.sourceMembers,n,"sourceMembers",r=>r.key,"key"),gt(e.businessMembers,n,"businessMembers",r=>r.key,"key"),gt(e.placementUnits,n,"placementUnits",r=>r.key,"key"),gt(e.placements,n,"placements",r=>r.placementKey,"placementKey");let i=new Set(e.sourceMembers.map(r=>r.key)),s=new Set(e.placementUnits.map(r=>r.key)),a=new Map(e.sourceMembers.map(r=>[r.key,r])),o=new Map(e.businessMembers.map(r=>[r.key,r]));for(let[r,l]of e.sourceMembers.entries()){l.containerKey!==e.container.key&&!i.has(l.containerKey)&&n.addIssue({code:"custom",path:["sourceMembers",r,"containerKey"],message:"Source member parent must reference the page container or another source member."}),l.containerKey===l.key&&n.addIssue({code:"custom",path:["sourceMembers",r,"containerKey"],message:"Source member cannot contain itself."});let x=new Set([l.key]),h=l.containerKey;for(;h!==e.container.key;){if(x.has(h)){n.addIssue({code:"custom",path:["sourceMembers",r,"containerKey"],message:"Source member hierarchy must be acyclic."});break}x.add(h);let C=a.get(h);if(!C)break;h=C.containerKey}}e.container.kind==="jsx-container"&&!i.has(e.container.sourceMemberKey)&&n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."});for(let[r,l]of e.businessMembers.entries())i.has(l.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",r,"sourceMemberKey"],message:"Business member must reference a source member."}),s.has(l.containerKey)||n.addIssue({code:"custom",path:["businessMembers",r,"containerKey"],message:"Business member must reference a placement unit container."});for(let[r,l]of e.placementUnits.entries()){let x=a.get(l.containerKey);x?x.containerKey!==e.container.key&&n.addIssue({code:"custom",path:["placementUnits",r,"containerKey"],message:"Placement unit must reference a direct child of the page container."}):n.addIssue({code:"custom",path:["placementUnits",r,"containerKey"],message:"Placement unit containerKey must reference a source member."});let h=new Set;for(let[C,K]of l.businessMemberKeys.entries()){let H=o.get(K);if(!H){n.addIssue({code:"custom",path:["placementUnits",r,"businessMemberKeys",C],message:"Placement unit must reference existing business members."});continue}h.has(K)&&n.addIssue({code:"custom",path:["placementUnits",r,"businessMemberKeys",C],message:"Placement unit cannot reference the same business member twice."}),h.add(K),H.containerKey!==l.key&&n.addIssue({code:"custom",path:["placementUnits",r,"businessMemberKeys",C],message:"Business member containerKey must match its placement unit."});let se=H.sourceMemberKey,fe=new Set;for(;se&&se!==l.containerKey&&!fe.has(se);)fe.add(se),se=a.get(se)?.containerKey;se!==l.containerKey&&n.addIssue({code:"custom",path:["placementUnits",r,"businessMemberKeys",C],message:"Placement unit business members must belong to its source subtree."})}}for(let[r,l]of e.businessMembers.entries())e.placementUnits.find(h=>h.key===l.containerKey)?.businessMemberKeys.includes(l.key)||n.addIssue({code:"custom",path:["businessMembers",r,"containerKey"],message:"Business member must be listed by its placement unit container."});let c=new Map;for(let r of e.placementUnits)c.set(r.containerKey,(c.get(r.containerKey)??0)+1);for(let[r,l]of e.sourceMembers.entries())l.containerKey===e.container.key&&c.get(l.key)!==1&&n.addIssue({code:"custom",path:["sourceMembers",r,"key"],message:"Every direct source member must be owned by exactly one placement unit."});for(let[r,l]of e.placements.entries())pc(l.composition,e.composition)||n.addIssue({code:"custom",path:["placements",r,"composition"],message:"Page placement composition must match page composition."}),l.documentVersion!==e.version&&n.addIssue({code:"custom",path:["placements",r,"documentVersion"],message:"Page placement version must match page composition version."}),s.has(l.placementUnitKey)||n.addIssue({code:"custom",path:["placements",r,"placementUnitKey"],message:"Placement option must reference an existing placement unit."})}),jg=u.object({status:u.literal("unsupported"),version:u.number().int().nonnegative(),composition:B,reason:Ci,diagnostics:u.array(Mn)}).strict(),Lg=u.discriminatedUnion("status",[Ng,jg]),mc=2,g1="page-composition-v2",lc=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 i=[e.startLine,e.startColumn,e.endLine,e.endColumn],s=i.some(o=>o!==void 0),a=i.every(o=>o!==void 0);s&&!a&&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."})}),Mg=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."})}),Ug=u.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),Fg=u.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),Gg=u.discriminatedUnion("kind",[u.object({kind:u.literal("virtual-route-root"),key:u.null(),routeReturn:u.object({sourceIdentity:Zs,sourceRange:lc}).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()]),qg=u.object({key:u.string().min(1),kind:Ug,parentKey:u.string().min(1).nullable(),childKeys:u.array(u.string().min(1)),order:u.number().int().nonnegative(),label:u.string().min(1),sourceIdentity:Zs,sourceRange:lc.nullable(),atomicKind:Fg}).strict().superRefine((e,n)=>{let i=e.kind==="component-call"||e.kind==="native-jsx"?"none":e.kind;e.atomicKind!==i&&n.addIssue({code:"custom",path:["atomicKind"],message:`atomicKind must be ${i} for ${e.kind}.`});let s=new Set;for(let[a,o]of e.childKeys.entries())s.has(o)&&n.addIssue({code:"custom",path:["childKeys",a],message:`Duplicate child source member key: ${o}`}),s.add(o)}),Wg=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(),Bg=u.enum(["independent","atomic","container"]),Kg=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:Bg,isIndependent:u.boolean(),isMultiMember:u.boolean()}).strict().superRefine((e,n)=>{sc(e.sourceMemberKeys,n,"sourceMemberKeys","source member"),sc(e.businessMemberKeys,n,"businessMemberKeys","business member");let i=e.sourceMemberKeys.length>1||e.businessMemberKeys.length>1;e.isMultiMember!==i&&n.addIssue({code:"custom",path:["isMultiMember"],message:"isMultiMember must reflect the source and business member cardinality."});let s=e.boundaryMode==="independent";e.isIndependent!==s&&n.addIssue({code:"custom",path:["isIndependent"],message:"isIndependent must match boundaryMode."})}),zg=u.enum(["before","after","prepend","append","replace"]),Hg=u.enum(["insert-sibling","insert-child","replace-placeholder"]),$g=u.object({kind:u.literal("page-composition"),placementKey:u.string().min(1),documentVersion:u.number().int().nonnegative(),composition:B,placementUnitKey:u.string().min(1),containerKey:u.string().min(1).nullable(),relation:zg,writeMode:Hg}).strict().superRefine((e,n)=>{let i=e.relation==="before"||e.relation==="after"?"insert-sibling":e.relation==="prepend"||e.relation==="append"?"insert-child":"replace-placeholder";e.writeMode!==i&&n.addIssue({code:"custom",path:["writeMode"],message:`writeMode must be ${i} for ${e.relation}.`})}),Vg=u.object({key:u.string().min(1),placementUnitKey:u.string().min(1),runtimeRefs:u.array(Mg).min(1)}).strict(),Yg=u.object({schemaVersion:u.literal(mc),status:u.literal("supported"),version:u.number().int().nonnegative(),composition:B,container:Gg,sourceMembers:u.array(qg),businessMembers:u.array(Wg),placementUnits:u.array(Kg),placements:u.array($g),visualAnchors:u.array(Vg).optional(),diagnostics:u.array(Mn)}).strict().superRefine((e,n)=>{Zg(e,n)}),Xg=u.object({schemaVersion:u.literal(mc),status:u.literal("unsupported"),version:u.number().int().nonnegative(),composition:B,reason:Ci,diagnostics:u.array(Mn)}).strict(),Qg=u.discriminatedUnion("status",[Yg,Xg]),_1=u.union([Qg,Lg]);function sc(e,n,i,s){let a=new Set;for(let[o,c]of e.entries())a.has(c)&&n.addIssue({code:"custom",path:[i,o],message:`Duplicate ${s} key: ${c}`}),a.add(c)}function pc(e,n){return ks(e)===ks(n)}function Zg(e,n){gt(e.sourceMembers,n,"sourceMembers",h=>h.key,"key"),gt(e.businessMembers,n,"businessMembers",h=>h.key,"key"),gt(e.placementUnits,n,"placementUnits",h=>h.key,"key"),gt(e.placements,n,"placements",h=>h.placementKey,"placementKey"),gt(e.visualAnchors??[],n,"visualAnchors",h=>h.key,"key"),Jg(e,n);let i=new Map(e.sourceMembers.map(h=>[h.key,h])),s=new Map(e.businessMembers.map(h=>[h.key,h])),a=new Map(e.placementUnits.map(h=>[h.key,h]));e_(e,i,n),e.container.kind!=="virtual-route-root"&&(i.has(e.container.sourceMemberKey)||n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."}));let o=new Map,c=new Map,r=new Set;for(let[h,C]of e.placementUnits.entries()){C.containerKey!==e.container.key&&n.addIssue({code:"custom",path:["placementUnits",h,"containerKey"],message:"Placement unit containerKey must match the page container."});let K=`${C.containerKey??"<virtual>"}:${C.order}`;r.has(K)&&n.addIssue({code:"custom",path:["placementUnits",h,"order"],message:"Placement unit order must be unique within its container."}),r.add(K);for(let[H,se]of C.sourceMemberKeys.entries()){i.has(se)||n.addIssue({code:"custom",path:["placementUnits",h,"sourceMemberKeys",H],message:"Placement unit must reference existing source members."});let fe=o.get(se);fe&&fe!==C.key&&n.addIssue({code:"custom",path:["placementUnits",h,"sourceMemberKeys",H],message:`Source member is already assigned to ${fe}.`}),o.set(se,C.key)}for(let[H,se]of C.businessMemberKeys.entries()){let fe=s.get(se);if(!fe){n.addIssue({code:"custom",path:["placementUnits",h,"businessMemberKeys",H],message:"Placement unit must reference existing business members."});continue}fe.placementUnitKey!==C.key&&n.addIssue({code:"custom",path:["placementUnits",h,"businessMemberKeys",H],message:"Placement unit and business member must reference each other."}),C.sourceMemberKeys.includes(fe.sourceMemberKey)||n.addIssue({code:"custom",path:["placementUnits",h,"businessMemberKeys",H],message:"Business member sourceMemberKey must belong to the placement unit."});let xn=c.get(se);xn&&xn!==C.key&&n.addIssue({code:"custom",path:["placementUnits",h,"businessMemberKeys",H],message:`Business member is already assigned to ${xn}.`}),c.set(se,C.key)}}for(let[h,C]of e.businessMembers.entries()){i.has(C.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",h,"sourceMemberKey"],message:"Business member must reference a source member."});let K=a.get(C.placementUnitKey);if(!K){n.addIssue({code:"custom",path:["businessMembers",h,"placementUnitKey"],message:"Business member must reference a placement unit."});continue}K.businessMemberKeys.includes(C.key)||n.addIssue({code:"custom",path:["businessMembers",h,"placementUnitKey"],message:"Business member and placement unit must reference each other."}),K.sourceMemberKeys.includes(C.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",h,"sourceMemberKey"],message:"Business member sourceMemberKey must belong to its placement unit."});let H=K.isIndependent&&K.businessMemberKeys.length===1;C.isIndependent!==H&&n.addIssue({code:"custom",path:["businessMembers",h,"isIndependent"],message:"Business member independence must match its placement unit boundary."})}let l=new Set;for(let[h,C]of e.placements.entries()){C.documentVersion!==e.version&&n.addIssue({code:"custom",path:["placements",h,"documentVersion"],message:"Page placement version must match page composition version."}),pc(C.composition,e.composition)||n.addIssue({code:"custom",path:["placements",h,"composition"],message:"Page placement composition must match page composition."});let K=a.get(C.placementUnitKey);K?C.containerKey!==K.containerKey&&n.addIssue({code:"custom",path:["placements",h,"containerKey"],message:"Placement containerKey must match its placement unit."}):n.addIssue({code:"custom",path:["placements",h,"placementUnitKey"],message:"Placement option must reference a placement unit."});let H=`${C.placementUnitKey}:${C.relation}`;l.has(H)&&n.addIssue({code:"custom",path:["placements",h,"relation"],message:"A placement unit cannot expose the same relation more than once."}),l.add(H),C.relation==="replace"&&e.container.kind!=="starter-placeholder"&&n.addIssue({code:"custom",path:["placements",h,"relation"],message:"replace is only valid for a starter placeholder container."}),e.container.kind==="starter-placeholder"&&C.relation!=="replace"&&n.addIssue({code:"custom",path:["placements",h,"relation"],message:"Starter placeholder placements must use replace."})}let x=new Set;for(let[h,C]of(e.visualAnchors??[]).entries())a.has(C.placementUnitKey)||n.addIssue({code:"custom",path:["visualAnchors",h,"placementUnitKey"],message:"Visual anchor must reference a placement unit."}),x.has(C.placementUnitKey)&&n.addIssue({code:"custom",path:["visualAnchors",h,"placementUnitKey"],message:"A placement unit may expose only one visual anchor."}),x.add(C.placementUnitKey)}function Jg(e,n){let i=[];e.container.key!==null&&i.push({key:e.container.key,path:["container","key"],namespace:"container"});for(let[a,o]of e.sourceMembers.entries())i.push({key:o.key,path:["sourceMembers",a,"key"],namespace:"source member"});for(let[a,o]of e.businessMembers.entries())i.push({key:o.key,path:["businessMembers",a,"key"],namespace:"business member"});for(let[a,o]of e.placementUnits.entries())i.push({key:o.key,path:["placementUnits",a,"key"],namespace:"placement unit"});for(let[a,o]of(e.visualAnchors??[]).entries())i.push({key:o.key,path:["visualAnchors",a,"key"],namespace:"visual anchor"});let s=new Map;for(let a of i){let o=s.get(a.key);o?n.addIssue({code:"custom",path:a.path,message:`${a.namespace} key collides with ${o}: ${a.key}`}):s.set(a.key,a.namespace)}}function e_(e,n,i){let s=new Set;for(let[a,o]of e.sourceMembers.entries()){let c=`${o.parentKey??"<root>"}:${o.order}`;if(s.has(c)&&i.addIssue({code:"custom",path:["sourceMembers",a,"order"],message:"Source member order must be unique among siblings."}),s.add(c),o.parentKey===o.key&&i.addIssue({code:"custom",path:["sourceMembers",a,"parentKey"],message:"Source member cannot be its own parent."}),o.parentKey!==null){let x=n.get(o.parentKey);x?x.childKeys.includes(o.key)||i.addIssue({code:"custom",path:["sourceMembers",a,"parentKey"],message:"Source parent and child references must be bidirectional."}):i.addIssue({code:"custom",path:["sourceMembers",a,"parentKey"],message:"Source member parentKey must reference a source member."})}for(let[x,h]of o.childKeys.entries()){if(h===o.key){i.addIssue({code:"custom",path:["sourceMembers",a,"childKeys",x],message:"Source member cannot be its own child."});continue}let C=n.get(h);C?C.parentKey!==o.key&&i.addIssue({code:"custom",path:["sourceMembers",a,"childKeys",x],message:"Source parent and child references must be bidirectional."}):i.addIssue({code:"custom",path:["sourceMembers",a,"childKeys",x],message:"Source child key must reference a source member."})}let r=new Set,l=o;for(;l;){if(r.has(l.key)){i.addIssue({code:"custom",path:["sourceMembers",a,"parentKey"],message:"Source member graph must be acyclic."});break}r.add(l.key),l=l.parentKey===null?void 0:n.get(l.parentKey)}}}var Un=d.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"]),t_=d.discriminatedUnion("kind",[d.object({kind:d.literal("node"),key:d.string().min(1)}).strict(),rc,d.object({kind:d.literal("route"),composition:_e}).strict(),d.object({kind:d.literal("source-file"),path:Ee}).strict(),d.object({kind:d.literal("source-batch"),paths:d.array(Ee).min(1)}).superRefine((e,n)=>{let i=new Set;for(let[s,a]of e.paths.entries())i.has(a)&&n.addIssue({code:"custom",path:["paths",s],message:`Duplicate source target path: ${a}`}),i.add(a)}).strict(),d.object({kind:d.literal("project")}).strict()]),n_=d.discriminatedUnion("kind",[d.object({kind:d.literal("node"),key:d.string().min(1)}).strict(),cc,d.object({kind:d.literal("route"),composition:B}).strict(),d.object({kind:d.literal("source-file"),path:Ee}).strict(),d.object({kind:d.literal("source-batch"),paths:d.array(Ee).min(1)}).strict(),d.object({kind:d.literal("project")}).strict()]),dc=d.enum(["display","position","top","right","bottom","left","zIndex","flexDirection","flexWrap","flexGrow","flexShrink","flexBasis","order","gridTemplateColumns","gridTemplateRows","columns","gridColumn","gridRow","gap","gapX","gapY","spaceX","spaceY","alignItems","justifyContent","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","width","height","minWidth","minHeight","maxWidth","maxHeight","overflow","fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","textAlign","textTransform","textDecoration","textOverflow","textIndent","writingMode","whiteSpace","wordBreak","lineClamp","fontVariantNumeric","screenReaderOnly","color","backgroundColor","backgroundImage","backgroundRepeat","backgroundSize","backgroundPosition","backgroundAttachment","backgroundClip","backgroundOrigin","borderStyle","borderWidth","borderRadius","borderColor","objectFit","objectPosition","aspectRatio","opacity","boxShadow","transform","transformOrigin","transitionProperty","transitionDuration","transitionTimingFunction","animation","pointerEvents","cursor","userSelect","fontStyle","textUnderlineOffset","scrollMarginTop","alignSelf","flex","outlineStyle","resize","ringWidth","ringColor","backdropFilter","overscrollBehavior","divideWidth","divideColor"]),uc=d.enum(["hover","active","focus","disabled"]),gc=d.enum(["sm","md","lg","xl","2xl"]),_c=d.union([d.object({relation:d.enum(["before","after"]),anchorKey:d.string().min(1),parentKey:d.string().min(1)}),d.object({relation:d.enum(["prepend","append"]),parentKey:d.string().min(1)}),oc]),i_=d.object({kind:d.literal("source-sibling"),relation:d.enum(["before","after"]),anchorKey:d.string().min(1)}).strict(),s_=d.union([_c,i_]),hc=d.object({kind:d.literal("component-call"),component:d.never().optional(),materialization:Ft,props:d.record(d.string(),d.never()).optional()}).strict(),a_=d.union([d.object({kind:d.literal("native-tag"),tag:d.string().min(1),text:d.string().optional()}),d.object({kind:d.literal("component-call"),component:d.object({source:d.string().min(1),exportName:d.string().min(1)}),materialization:d.never().optional(),props:d.record(d.string(),d.unknown()).optional()}).strict(),hc]),o_=d.discriminatedUnion("kind",[d.object({kind:d.literal("update-text"),segmentIndex:d.number().int().min(0),value:d.string()}),d.object({kind:d.literal("update-array-item"),segmentIndex:d.number().int().min(0),index:d.number().int().min(0),value:d.string()}),d.object({kind:d.literal("remove-node")}),d.object({kind:d.literal("insert-child"),node:a_,position:d.union([_c,ac])}),d.object({kind:d.literal("replace-node"),node:hc}),d.object({kind:d.literal("move-node"),target:s_,preserveBindings:d.boolean().optional()}),d.object({kind:d.literal("set-class-name-source"),filePath:d.string().min(1),expectedVersion:d.object({documentVersion:d.number().int().nonnegative(),contentHash:d.string().min(1)}),oldAttrRaw:d.string().min(1).nullable(),oldAttrRange:dt.nullable(),openingElementRange:dt,newAttrRaw:d.string().min(1).nullable(),intent:Xs}),nc,d.object({kind:d.literal("apply-style-draft"),className:d.object({filePath:d.string().min(1),expectedVersion:d.object({documentVersion:d.number().int().nonnegative(),contentHash:d.string().min(1)}),oldAttrRaw:d.string().min(1).nullable(),oldAttrRange:dt.nullable(),openingElementRange:dt,newAttrRaw:d.string().min(1).nullable(),intent:Xs}).optional(),props:d.partialRecord(ic,d.string()).optional()}).superRefine((e,n)=>{!e.className&&!e.props&&n.addIssue({code:"custom",message:"apply-style-draft requires className or props"})}),d.object({kind:d.literal("source-edit"),conflictPolicy:d.enum(["compare-and-swap","overwrite"]),edits:d.array(d.discriminatedUnion("operation",[d.object({operation:d.literal("upsert"),path:Ee,content:d.string(),baseContentHash:d.string().min(1).nullable().optional()}).strict().superRefine((e,n)=>{ws(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"})}),d.object({operation:d.literal("delete"),path:Ee,capability:rr,confirmDelete:d.literal(!0),confirmPath:Ee,baseContentHash:d.string().min(1).nullable().optional()}).strict().superRefine((e,n)=>{e.capability!==As&&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"}),ws(e.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit delete only accepts allowlisted text source files"});let i=Ps(e.path);i&&n.addIssue({code:"custom",path:["path"],message:`Protected source file cannot be deleted: ${e.path} (${i})`})})])).min(1),reason:d.string().min(1).optional()}).strict().superRefine((e,n)=>{let i=new Set;for(let[s,a]of e.edits.entries())i.has(a.path)&&n.addIssue({code:"custom",path:["edits",s,"path"],message:`Duplicate source edit path: ${a.path}`}),i.add(a.path),e.conflictPolicy==="compare-and-swap"&&a.baseContentHash===void 0&&n.addIssue({code:"custom",path:["edits",s,"baseContentHash"],message:"source-edit compare-and-swap requires baseContentHash for every edit"})}),d.object({kind:d.literal("insert-page-resource"),artifact:Vs}).strict(),d.object({kind:d.literal("delete-page-source"),expectedUrlPath:d.string().startsWith("/")}).strict()]),Sc=d.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"]),fc=d.object({code:Sc,message:d.string().min(1),details:d.record(d.string(),d.unknown()).optional()}),tn=d.object({key:d.string().min(1),instanceIndex:d.number().int().nonnegative().optional(),instanceCount:d.number().int().positive().optional()}),Js=d.object({id:d.string().min(1),siteId:k,baseSnapshotId:I,composition:_e,kind:Un,target:t_,documentVersion:d.number().int().nonnegative(),selectionRef:tn.optional(),mutationContext:jn.optional(),params:o_}).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 i=e.params.edits.map(a=>a.path),s=e.target.kind==="source-file"?[e.target.path]:e.target.paths;l_(i,s)||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"})}),P1=Js,r_=d.object({kind:d.literal("insert-page-resource"),package_instance_id:d.string().min(1),pages:d.array(Kr).min(1)}).strict().superRefine((e,n)=>{let i=new Set,s=new Set;for(let[a,o]of e.pages.entries())i.has(o.template_page_id)&&n.addIssue({code:"custom",path:["pages",a,"template_page_id"],message:`Duplicate template page route mapping: ${o.template_page_id}`}),s.has(o.final_route)&&n.addIssue({code:"custom",path:["pages",a,"final_route"],message:`Duplicate final route mapping: ${o.final_route}`}),i.add(o.template_page_id),s.add(o.final_route)}),c_=d.object({kind:d.literal("delete-page-source"),deleted_files:d.array(d.string().min(1)),updated_files:d.array(d.string().min(1)),preserved_shared_files:d.array(d.string().min(1)),warnings:d.array(d.string().min(1))}).strict(),m_=d.discriminatedUnion("kind",[r_,c_]),bc=d.object({requestId:d.string().min(1),kind:Un,composition:B,target:n_,resultVersion:d.number().int().nonnegative(),affectedFiles:d.array(d.string().min(1)).optional(),selectionRef:tn.optional(),output:m_.optional()}).strict(),ea=bc.superRefine((e,n)=>{let i=e.kind==="insert-page-resource"||e.kind==="delete-page-source";i&&e.target.kind!=="project"?n.addIssue({code:"custom",path:["target","kind"],message:`${e.kind} result requires a project target`}):!i&&e.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project result target requires a project operation"}),i&&!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"})}),C1=Zr({dataSchema:ea,codeSchema:Sc,failureDataSchema:bc.partial()});function l_(e,n){return e.length===n.length&&e.every((i,s)=>i===n[s])}var p_=oe.enum(["component","page","pages"]),d_=oe.object({resource_kind:p_,resource_name:oe.string().trim().min(1).max(200),file_count:oe.number().int().min(1).max(64),total_bytes:oe.number().int().min(0).max(4*1024*1024),content_digest:oe.string().regex(/^sha256:[a-f0-9]{64}$/),custom_prompt:oe.string().trim().min(1).max(4e3).optional(),final_routes:oe.array(oe.string().min(1)).max(64)}).strict(),u_=oe.discriminatedUnion("kind",[oe.object({kind:oe.literal("none")}).strict(),oe.object({kind:oe.literal("primary"),items:oe.array(oe.object({label:oe.string().trim().min(1).max(120),href:oe.string().startsWith("/").max(200)}).strict()).min(1).max(64)}).strict().superRefine((e,n)=>{let i=new Set;for(let[s,a]of e.items.entries())i.has(a.href)&&n.addIssue({code:"custom",path:["items",s,"href"],message:`Duplicate navigation href: ${a.href}`}),i.add(a.href)})]),g_=oe.object({base_snapshot_id:oe.string().min(1),operation:Js,navigation_selection:u_.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 __(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 yc=oe.object({id:oe.string().min(1),tenant_id:oe.string().min(1),site_id:oe.string().min(1),run_id:oe.string().min(1).optional(),correlation_id:oe.string().min(1).optional(),sent_at:oe.string().min(1),type:oe.literal("client.resource.operation.create"),payload:oe.object({client_message_id:oe.string().min(1),display:d_,transient_resource_input:g_}).strict()}).strict().superRefine((e,n)=>{let{display:i,transient_resource_input:s}=e.payload;e.site_id!==s.operation.siteId&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","siteId"],message:"Resource operation siteId must match envelope site_id."}),(i.resource_kind==="component"?s.operation.kind==="insert-child"||s.operation.kind==="replace-node":s.operation.kind==="insert-page-resource")||n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","kind"],message:i.resource_kind==="component"?"component resources require insert-child or replace-node.":`${i.resource_kind} resources require insert-page-resource.`});let c=__(s.operation).flatMap(l=>l.files),r=c.reduce((l,x)=>l+new TextEncoder().encode(x.content).byteLength,0);if(c.length>Ms&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate file count limit."}),r>Us&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate content byte limit."}),i.file_count!==c.length&&n.addIssue({code:"custom",path:["payload","display","file_count"],message:"Resource summary file_count must match the transient operation."}),i.total_bytes!==r&&n.addIssue({code:"custom",path:["payload","display","total_bytes"],message:"Resource summary total_bytes must match the transient operation."}),s.operation.kind==="insert-page-resource"&&s.operation.params.kind==="insert-page-resource"){let l=s.operation.params.artifact;l.resource_type!==i.resource_kind&&n.addIssue({code:"custom",path:["payload","display","resource_kind"],message:"Resource summary kind must match the page artifact resource_type."});let x=l.pages.map(h=>h.final_route);(x.length!==i.final_routes.length||x.some((h,C)=>h!==i.final_routes[C]))&&n.addIssue({code:"custom",path:["payload","display","final_routes"],message:"Resource summary final_routes must match the page artifact routes."})}if(s.navigation_selection?.kind==="primary"){let l=new Set(i.final_routes);for(let[x,h]of s.navigation_selection.items.entries())l.has(h.href)||n.addIssue({code:"custom",path:["payload","transient_resource_input","navigation_selection","items",x,"href"],message:"Navigation selection href must reference a final resource route."})}});import{z as w}from"zod";import{z as ta}from"zod";var M=e=>ta.object({code:ta.number().int(),data:e,message:ta.string()});var h_=["with_website","without_website"],nn=w.enum(h_),na=w.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."}),S_=["welcome","website_scan","customer_materials","analysis","diagnosis","strategy","structure_planning","preview_personalization","publishing"],It=w.enum(S_),f_=["company_info","website_crawl","website_basic_info_extract","website_metrics_evaluate","intelligent_analysis","strategy_recommendation"],Ec=w.enum(f_),b_=["started","running","succeeded","failed","invalidated"],Rc=w.enum(b_),y_=["draft","structure_saved","generating","workspace_ready"],ia=w.enum(y_),x_=["not_deployed","deploying","deployed"],sa=w.enum(x_),E_=["active","completed"],R_=w.enum(E_),I_=["completed","current","locked"],T_=w.enum(I_),Ic={draft:10,structure_saved:20,generating:30,workspace_ready:40},Tc={not_deployed:10,deploying:20,deployed:30},kc={active:10,completed:20},Ac={started:10,running:20,succeeded:30,failed:40,invalidated:50};function vi(e){return new Map(Object.entries(e).map(([n,i])=>[i,n]))}var k_=vi(Ic),A_=vi(Tc),w_=vi(kc),P_=vi(Ac);function B1(e){let n=k_.get(e);if(!n)throw new Error(`Unknown site build status code: ${e}`);return n}function K1(e){let n=A_.get(e);if(!n)throw new Error(`Unknown site deployment status code: ${e}`);return n}function z1(e){let n=w_.get(e);if(!n)throw new Error(`Unknown site workflow status code: ${e}`);return n}function H1(e){let n=P_.get(e);if(!n)throw new Error(`Unknown task execution status code: ${e}`);return n}function $1(e){return Ic[e]}function V1(e){return Tc[e]}function Y1(e){return kc[e]}function X1(e){return Ac[e]}var aa=[{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}]}}],Q1=aa[0].definitions,wc=w.number().int().min(1),C_=w.object({id:Q,flow_type:nn,definition_version:wc,node_code:It,label:w.string().min(1),sort_order:w.number().int().min(1),is_enabled:w.boolean(),state:T_}),Pc=w.object({id:Wo,tenant_id:w.string().min(1),site_id:k,workflow_id:st,node_code:It,task_type:Ec,external_task_id:w.string().min(1),execution_status:Rc,idempotency_key:w.string().min(1),attempt_no:w.number().int().min(1),source_crawl_task_ref_id:w.string().uuid().nullable(),succeeded_at:w.string().min(1).nullable(),superseded_at:w.string().min(1).nullable(),site_url:w.string().url().nullable(),created_at:w.string().min(1),updated_at:w.string().min(1)}),v_=w.object({id:st,tenant_id:w.string().min(1),site_id:k,flow_type:nn,website:na.nullable(),definition_version:wc,current_node_code:It,status:R_,started_at:w.string().min(1),completed_at:w.string().min(1).nullable(),created_at:w.string().min(1),updated_at:w.string().min(1)}),oa=w.object({workflow:v_,menu:w.array(C_),task_refs:w.array(Pc),site:w.object({default_locale:Re.optional(),status:ia,deployment_status:sa,archived_at:w.string().min(1).nullable(),current_sitemap_id:w.string().nullable().optional(),current_sitemap_version:w.number().int().positive().nullable().optional(),confirmed_sitemap_id:w.string().nullable().optional(),confirmed_sitemap_version:w.number().int().positive().nullable().optional(),structure_confirmed_at:w.string().min(1).nullable().optional(),current_snapshot_id:w.string().nullable(),deployed_url:w.string().url().nullable(),cms_site_id:w.string().min(1).nullish()})}),Z1=M(oa),J1=M(Pc),xc=w.array(w.string().min(1).max(64)).max(16).optional(),ew=w.discriminatedUnion("flow_type",[w.object({flow_type:w.literal("with_website"),website:na,client_capabilities:xc}).strict(),w.object({flow_type:w.literal("without_website"),website:w.null().optional(),client_capabilities:xc}).strict()]),tw=w.object({expected_current_node:w.literal("website_scan"),website:na}).strict(),nw=w.object({expected_current_node:It}).strict(),iw=w.object({expected_current_node:w.literal("publishing")}).strict(),sw=w.object({publish_workflow_id:ci,expected_publish_revision:w.number().int().min(1)}).strict(),D_=w.object({node_code:It,task_type:Ec,external_task_id:w.string().min(1).max(255),idempotency_key:w.string().min(1).max(255),site_url:w.string().url().optional()}),aw=D_.extend({workflow_id:st}).strict(),ow=w.object({external_task_id:w.string().min(1).max(255),execution_status:Rc}),O_=w.object({previous_external_task_id:w.string().min(1).max(255),external_task_id:w.string().min(1).max(255),idempotency_key:w.string().min(1).max(255),site_url:w.string().url().optional()}),rw=O_.extend({workflow_id:st}).strict(),N_=w.object({previous_external_task_id:w.string().min(1).max(255),external_task_id:w.string().min(1).max(255),idempotency_key:w.string().min(1).max(255),site_url:w.string().url()}),cw=N_.extend({workflow_id:st}).strict(),mw=w.object({}).strict();function j_(e,n,i){return e.find(s=>s.definition_version===i)?.definitions[n]}function L_(e,n){return j_(aa,e,n)}function M_(e,n=1){let i=L_(e,n);if(!i)throw new Error(`Unknown workflow definition: ${e} v${n}.`);return i}function U_(e,n,i){let s=new Set(i);return e.filter(a=>a.published&&(a.required_client_capability===null||s.has(a.required_client_capability))).sort((a,o)=>o.definition_version-a.definition_version).map(a=>({definition_version:a.definition_version,items:a.definitions[n]}))[0]}function lw(e,n){return U_(aa,e,n)}function pw(e,n){return M_(e).findIndex(i=>i.node_code===n)}function dw(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 uw(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 gw(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 R}from"zod";var ra=R.string().min(1).max(120).regex(/^[a-z][a-z0-9_-]*$/),Ue=R.string().min(1).max(120).regex(/^[A-Za-z_][A-Za-z0-9_]*$/),F_=R.enum(["text","select","multi_select","tags","category_list","boolean","number"]),Fn=R.string().min(1).max(512).regex(/^\/(?:[^?#]*)$/),G_=R.object({minimum:R.number().finite(),maximum:R.number().finite(),step:R.number().finite().positive()}).strict().refine(e=>e.minimum<e.maximum,{message:"minimum must be less than maximum"}),q_=R.string().trim().min(1).max(100),vc=R.array(q_).max(5).refine(e=>new Set(e.map(n=>n.toLowerCase())).size===e.length,{message:"popular_terms must be unique ignoring case"}),fw=R.array(R.string()).max(20).transform(e=>{let n=new Set;return e.map(i=>i.trim()).filter(i=>{if(i.length===0||i.length>100)return!1;let s=i.toLowerCase();return n.has(s)?!1:(n.add(s),!0)}).slice(0,5)}),Dc=R.object({filter_enabled:R.boolean(),selected_fields:R.array(Ue).max(64),selected_card_fields:R.array(Ue).max(64).default([]),popular_terms_enabled:R.boolean().default(!1),popular_terms:vc.optional()}).strict(),W_=R.object({app_slug:ra}).extend(Dc.shape).strict(),ca=R.object({kind:R.literal("product_search_confirmation"),baseline_snapshot_id:I,target_route_id:Fn,applications:R.array(R.object({app_slug:ra,label:R.string().min(1).max(200),popular_terms:vc.default([]),current_config:Dc.nullable().default(null),affected_routes:R.array(Fn).max(64).default([]),fields:R.array(R.object({field_name:Ue,label:R.string().min(1).max(200),value_shape:F_,option_count:R.number().int().nonnegative().optional(),filter_meta:G_.optional()}).strict()).max(64)}).strict()).min(1).max(12),current_config:W_.nullable().optional(),affected_routes:R.array(Fn).min(1).max(64).optional()}).strict(),B_=R.object({kind:R.literal("product_search_confirmation"),action:R.enum(["confirm","modify"]),app_slug:ra,filter_enabled:R.boolean(),popular_terms_enabled:R.boolean().default(!1),selected_fields:R.array(Ue).max(64),selected_card_fields:R.array(Ue).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"})}),Di=R.union([B_,R.object({kind:R.literal("product_search_confirmation"),action:R.literal("cancel")}).strict()]),Gn=R.union([R.string().max(255),R.number().finite(),R.boolean()]),K_=R.object({values:R.array(Gn).min(1).max(20).refine(e=>new Set(e.map(n=>`${typeof n}:${String(n)}`)).size===e.length,{message:"values must be unique"})}).strict(),z_=R.object({min:R.number().finite().optional(),max:R.number().finite().optional(),include_unlabeled:R.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"}),H_=R.object({q:R.string().max(200),page:R.number().int().min(1).max(500),page_size:R.union([R.literal(9),R.literal(20)]),sort:R.enum(["published_at_desc","published_at_asc","product_name_asc","product_name_desc"]),filters:R.record(Ue,R.union([K_,z_])).superRefine((e,n)=>{Object.keys(e).length>12&&n.addIssue({code:"custom",message:"filters must contain at most 12 fields"})}),display_fields:R.array(Ue).max(64).default([]),missing_count_fields:R.array(Ue).max(12).default([]),relaxation_count_fields:R.array(Ue).max(12).default([]),facets:R.array(R.object({field:Ue,query:R.string().max(100),page:R.number().int().min(1).max(100),page_size:R.literal(10),include_values:R.array(Gn).max(20)}).strict()).max(8)}).strict(),Cc=R.object({value:Gn,label:R.string().max(200),count:R.number().int().nonnegative()}).strict(),$_=R.union([Gn,R.array(Gn).max(50)]),V_=R.object({items:R.array(R.object({id:R.number().int().positive(),thumbnail:R.string().max(2048).nullable(),title:R.string().max(300),summary:R.string().max(2e3),category:R.string().max(300).nullable(),field_values:R.record(Ue,$_).default({}),url:R.string().min(1).max(2048)}).strict()).max(20),page:R.object({total:R.number().int().nonnegative(),page:R.number().int().positive(),page_size:R.union([R.literal(9),R.literal(20)])}).strict(),facets:R.array(R.object({field:Ue,total:R.number().int().nonnegative(),page:R.number().int().positive(),page_size:R.literal(10),values:R.array(Cc).max(10),selected_values:R.array(Cc).max(20)}).strict()).max(8),missing_counts:R.record(Ue,R.number().int().nonnegative()).default({}),relaxation_counts:R.record(Ue,R.number().int().nonnegative()).default({})}).strict(),bw=R.object({contract_version:R.literal(1),request:H_,response:V_}).strict();import{z as qe}from"zod";var ma=4,Ew=20,Rw=1440*60*1e3,Iw=1e6,Y_=["image/png","image/jpeg","image/webp"],la=qe.enum(Y_),Tw="WORKSPACE_ATTACHMENT_UNSUPPORTED_FORMAT",kw="WORKSPACE_ATTACHMENT_TOO_LARGE",Aw="WORKSPACE_ATTACHMENT_LIMIT",ww="WORKSPACE_ATTACHMENT_BOUND",Pw=10,Cw=3600*1e3,vw="WORKSPACE_ATTACHMENT_URL_REJECTED",Dw="WORKSPACE_ATTACHMENT_CAPTURE_FAILED",Ow="WORKSPACE_ATTACHMENT_CAPTURE_BUSY",Nw="WORKSPACE_ATTACHMENT_CAPTURE_TIMEOUT",jw="WORKSPACE_ATTACHMENT_CAPTURE_BUDGET_EXCEEDED",Lw="WORKSPACE_ATTACHMENT_CAPTURE_UNAVAILABLE",Mw=qe.object({attachment_id:qe.string().min(1),media_type:la,width:qe.number().int().positive(),height:qe.number().int().positive(),size_bytes:qe.number().int().nonnegative(),filename:qe.string().min(1).max(120),image_url:qe.string().min(1),source_url:qe.string().min(1).optional(),created_at:qe.string().min(1)}).strict(),Uw=qe.object({url:qe.string().url().max(2048),full_page:qe.boolean().optional()}).strict(),Oc="[A-Za-z0-9_-]+",X_=new RegExp(`^/sites/(${Oc})/workspace/attachments/(${Oc})/image$`);function Fw(e,n){return`/sites/${encodeURIComponent(e)}/workspace/attachments/${encodeURIComponent(n)}/image`}function pa(e){let n=X_.exec(e);return n?{site_id:n[1],attachment_id:n[2]}:null}function Gw(e){let n=[];for(let i of e){if(i.type!=="file"||typeof i.url!="string")continue;let s=pa(i.url);s&&n.push({attachment_id:s.attachment_id,site_id:s.site_id,media_type:typeof i.mediaType=="string"?i.mediaType:"",filename:typeof i.filename=="string"&&i.filename.trim()!==""?i.filename:"image",url:i.url})}return n}import{z as qn}from"zod";var Q_=["deployment_queued","prepare_source","build_artifact","publish_site","site_released","cleanup_release"],Z_=qn.enum(Q_),J_=qn.enum(["running","succeeded","failed"]),eh=qn.object({code:Z_,status:J_,message:qn.string().trim().min(1)}).strict(),Nc=qn.array(eh);import{z as Wn}from"zod";var th={slug:/^page_[0-9]+_slug$/,showInHeader:/^page_[0-9]+_show_in_header$/,showInFooter:/^page_[0-9]+_show_in_footer$/,type:/^block_[0-9]+_type$/};function zw(e){let n={},i=new Set;for(let s of e){if(!th[s.field].test(s.key))throw new Error("Invalid Sitemap Resolver answer-sheet hole key.");if(i.has(s.key))throw new Error("Duplicate Sitemap Resolver answer-sheet hole key.");i.add(s.key),n[s.key]=s.field==="slug"?Wn.string().min(1):s.field==="type"?Wn.string().trim().min(1):Wn.boolean()}return Wn.object({answers:Wn.object(n).strict()}).strict()}import{z as P}from"zod";var nh=P.enum(["pending","running","succeeded","failed"]),ih=P.enum(["TASK_FAILED","WEBSITE_UNREACHABLE"]),sh=P.object({task_id:P.string().uuid(),site_url:P.string().url(),crawler_task_id:P.string().min(1).max(255).nullable(),crawler_error_code:ih.nullable().optional(),crawler_failure_stage:P.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]).nullable().optional(),page_count:P.number().int().min(0).max(20),status:nh,error:P.string().nullable(),created_at:P.string().min(1),updated_at:P.string().min(1)}),Yw=M(sh),da=P.enum(["existing_site","new_site"]),Lc=P.enum(["google_indexing","ai_recommendation","qualification_verifiability","content_freshness","inquiry_form","inquiry_response","privacy_compliance","prohibited_content"]),jc=P.object({observed_result:P.enum(["pass","fail","unknown"])}).strict(),Mc=P.object({kind:P.literal("ai_crawlability"),checks:P.object({ai_access_guidance:jc,structured_data_presence:jc}).strict()}).strict(),ua=P.object({label:P.string().trim(),value:P.union([P.string(),P.number(),P.boolean(),P.null()]),summary:P.string().trim(),tone:P.enum(["good","warn","bad","unknown"]),status:P.enum(["ok","unknown"]),assessment:Mc.optional()}),Oi=P.object({key:P.string().trim().min(1).max(100),label:P.string().trim().min(1).max(100),value:P.union([P.string().max(1e3),P.number(),P.boolean(),P.null()]),tone:P.enum(["good","warn","bad","unknown"]),status:P.enum(["ok","unknown"]),evidence:P.string().trim().max(2e3).optional(),assessment:Mc.optional()}).strict(),ah=P.object({url:P.string().url().max(2048),title:P.string().trim().max(300),words:P.number().int().nonnegative().max(1e7)}).strict(),oh=P.object({site_url:P.string().url().max(2048),scanned_at:P.string().datetime({offset:!0}),reach:P.array(Oi).max(64),trust:P.array(Oi).max(64),convert:P.array(Oi).max(64),safe:P.array(Oi).max(64),pages:P.array(ah).max(100)}).strict(),Ni=P.object({company_task_id:P.string().min(1).max(128),scan_task_id:P.string().min(1).max(128),type:da,result:P.object({company_name:P.string(),website:P.string().url().optional(),primary_product:P.string(),current_market:P.string(),qualifications:P.string(),scan_cards:P.record(P.string(),ua),scan_result:oh.optional()})}),rh=P.object({saved:P.literal(!0),company_task_id:P.string().min(1).max(128),scan_task_id:P.string().min(1).max(128)}),Xw=M(rh),ch=P.enum(["snapshot","task"]),mh=Ni.shape.result.extend({type:da,structured_facts:P.unknown().optional()}).extend({company_name:P.string(),primary_product:P.string(),current_market:P.string(),qualifications:P.string()}),lh=P.object({site_id:P.string().min(1).max(128),company_task_id:P.string().min(1).max(128),scan_task_id:P.string().min(1).max(128),type:da,data_source:ch,result:mh}),Qw=M(lh.nullable());import{z as Ie}from"zod";var Tt=Ie.enum(["company","product_service","case_qualification","market","contact_inquiry","privacy_compliance","news_freshness"]),ph=Ie.object({ordinal:Ie.number().int().min(1).max(1e4),path:Ie.string().min(1).max(2048).refine(e=>!gh(e),{message:"path must be a site-relative path, not an absolute URL"}),last_modified:Ie.string().max(64).nullable()}).strict(),eP=Ie.object({candidates:Ie.array(ph).min(1).max(1e4),selection_limit:Ie.number().int().min(1).max(19)}).strict().superRefine((e,n)=>{let i=e.candidates.map(s=>s.ordinal).sort((s,a)=>s-a);for(let[s,a]of i.entries())if(a!==s+1){n.addIssue({code:"custom",path:["candidates"],message:"candidates ordinals must be unique and consecutive from 1"});return}}),dh=Ie.object({ordinal:Ie.number().int().positive().max(1e4),roles:Ie.array(Tt).min(1).max(7)}).strict(),uh=Ie.object({role:Tt,status:Ie.enum(["selected","not_found"]),selected_ordinals:Ie.array(Ie.number().int().positive().max(1e4)).max(19)}).strict(),tP=Ie.object({selections:Ie.array(dh).max(19),coverage:Ie.array(uh).length(7)}).strict().superRefine((e,n)=>{let i=new Set;for(let[a,o]of e.coverage.entries())i.has(o.role)&&n.addIssue({code:"custom",path:["coverage",a,"role"],message:"coverage roles must be unique"}),i.add(o.role);for(let a of Tt.options)i.has(a)||n.addIssue({code:"custom",path:["coverage"],message:`coverage must include every page role (missing ${a})`});let s=new Map;for(let a of e.selections)for(let o of a.roles){let c=s.get(o)??new Set;c.add(a.ordinal),s.set(o,c)}for(let[a,o]of e.coverage.entries()){let c=s.get(o.role);o.selected_ordinals.some(l=>!c?.has(l))&&n.addIssue({code:"custom",path:["coverage",a,"selected_ordinals"],message:"selected_ordinals must reference selections carrying the same role"})}});function gh(e){let n=e.toLowerCase();return n.startsWith("http://")||n.startsWith("https://")||e.startsWith("//")}import{z as f}from"zod";var aP=f.object({force_refresh:f.boolean().optional()}),Fc=f.enum(["running","succeeded","failed"]),_h=f.object({agent_id:f.string().min(1),name:f.string().min(1),icon:f.string().min(1),capability:f.string().min(1),data_source:f.string().min(1),output_topics:f.string().min(1)}),hh=f.object({site_mode:f.enum(["existing_site","new_site"]),scan_required:f.boolean(),scheduled_agent_ids:f.array(f.string().min(1)),omitted_agent_ids:f.array(f.string().min(1)),next_stage:f.enum(["diagnostic_report","strategy"])}),Sh=f.object({t:f.string(),d:f.string(),evidence:f.object({from:f.string(),url:f.string().nullable().optional(),value:f.string().nullable().optional()})}),fh=f.enum(["complete","partial","insufficient_data","failed"]),bh=f.enum(["ok","failed","insufficient_data"]),ga=f.object({agent_id:f.string().min(1),name:f.string().min(1),icon:f.string().min(1),status:bh,topics:f.array(f.object({topic_id:f.string().min(1),status:fh,evidence_refs:f.array(f.string())})).length(3),findings:f.array(Sh).max(3),elapsed_ms:f.number().nonnegative(),note:f.string().optional(),error:f.string().optional()}),Gc=f.object({total:f.number().int().nonnegative(),ok:f.number().int().nonnegative(),degraded:f.number().int().nonnegative(),total_findings:f.number().int().nonnegative(),elapsed_ms:f.number().nonnegative(),site_mode:f.enum(["existing_site","new_site"]).optional(),scheduled_agent_ids:f.array(f.string()).optional(),omitted_agent_ids:f.array(f.string()).optional(),scheduled:f.number().int().nonnegative().optional(),complete:f.number().int().nonnegative().optional(),partial:f.number().int().nonnegative().optional(),insufficient:f.number().int().nonnegative().optional(),failed:f.number().int().nonnegative().optional(),next_stage:f.enum(["diagnostic_report","strategy"]).optional()}),yh=f.object({agents_done:f.boolean(),analysis:f.record(f.string(),ga),step4_scoring_input:f.unknown().optional(),summary:Gc}),qc=f.object({job_id:f.string().min(1),site_id:f.string().min(1),model_version:f.string().min(1),output_locale:f.string().min(2),cached:f.boolean().optional(),status:Fc,result:yh.nullable().optional(),error:f.string().nullable().optional()}),oP=M(f.array(_h)),rP=M(hh),cP=M(qc),mP=M(qc.nullable()),_t=f.object({id:f.union([f.number().int().nonnegative(),f.string().regex(/^(0|[1-9]\d*)$/u).transform(Number)]).pipe(f.number().int().nonnegative())}),Uc=f.object({percent:f.number().int().min(0).max(100),phase:f.enum(["preparing","analyzing","finalizing","completed","failed"]),stage:f.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:f.number().int().nonnegative(),agents_total:f.number().int().nonnegative(),agent_id:f.string().min(1).optional()}),lP=f.discriminatedUnion("event",[_t.extend({event:f.literal("snapshot"),data:f.object({job_id:f.string().min(1),status:Fc,done:f.number().int().nonnegative(),total:f.number().int().nonnegative(),results:f.array(ga),progress:Uc.optional()})}),_t.extend({event:f.literal("progress"),data:Uc}),_t.extend({event:f.literal("preparing_started"),data:f.object({stage:f.literal("baseline")})}),_t.extend({event:f.literal("preparing_progress"),data:f.object({stage:f.enum(["context","external_evidence"])})}),_t.extend({event:f.literal("preparing_done"),data:f.object({evidence_count:f.number().int().nonnegative(),rule_count:f.number().int().nonnegative(),degraded_capabilities:f.array(f.string())})}),_t.extend({event:f.literal("agent_start"),data:f.object({agent_id:f.string().min(1),name:f.string().min(1),icon:f.string().min(1)})}),_t.extend({event:f.literal("agent_done"),data:ga}),_t.extend({event:f.literal("done"),data:f.object({agents_done:f.literal(!0),summary:Gc})}),_t.extend({event:f.literal("failed"),data:f.object({message:f.string().min(1)})})]);import{z as U}from"zod";var ha=U.enum(["reach","trust","convert","safe"]),Oe=U.number().finite(),xh=U.number().finite().positive(),_a=["reach","trust","convert","safe"],Eh=17,Rh=U.enum(["passed","partial","failed"]),Ih=U.object({landing_page_mode:U.enum(["intent_dynamic","static","none"]),ab_test_enabled:U.boolean()}).strict(),Th=U.union([U.boolean(),U.number().finite(),Rh,Ih]).nullable(),kh=U.union([U.boolean(),U.number().finite()]).nullable(),Ah=U.object({competitor_avg:U.number().finite(),score_items:U.record(U.string(),Th),penalty_items:U.record(U.string(),kh),red_texts:U.array(U.string())}).strict(),wh=U.record(ha,Ah),Ph=U.object({key:ha,score:Oe,pass_score:Oe,gap:Oe}),Ch=U.object({key:U.string(),title:U.string(),is_redline_option:U.boolean().optional(),score:Oe,max_score:xh,pass_score:Oe,passed:U.boolean(),description:U.string()}),vh=U.object({key:ha,title:U.string(),alias:U.string(),slogan:U.string(),score:Oe,max_score:U.literal(100),pass_score:Oe,competitor_average:Oe,status:U.enum(["reached","near","not_reached"]),status_name:U.enum(["\u8FBE\u6807","\u63A5\u8FD1","\u672A\u8FBE\u6807"]),summary:U.string(),sub_dimensions:U.array(Ch),red_texts:U.array(U.string()),redline_hit:U.boolean().optional()}),Dh=U.object({id:U.number().int().positive(),task_code:U.string().min(1).max(128),is_sync:U.literal(0),status:U.literal("succeeded"),rules:wh,scores_list:U.object({overview:U.object({pass_scores:U.object({reach:Oe,trust:Oe,convert:Oe,safe:Oe}),total_score:Oe,total_pass_score:Oe,score_gap:Oe,competitor_average_score:Oe,scoring_criteria_text:U.string().min(1),gap_dimensions:U.array(Ph).max(4),overall_passed:U.boolean(),all_scores_passed:U.boolean(),diagnosis_passed:U.boolean(),commitment_eligible:U.boolean(),safe_redline_hit:U.boolean()}),dimensions:U.array(vh).length(4)}),created_at:U.string().datetime({offset:!0}),updated_at:U.string().datetime({offset:!0})}).superRefine((e,n)=>{Oh(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((s,a)=>s+a.sub_dimensions.length,0)!==Eh&&n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include 17 subdimensions in total."});for(let[s,a]of e.scores_list.dimensions.entries()){if(a.redline_hit===void 0)continue;let o=a.sub_dimensions.findIndex(c=>c.is_redline_option===void 0);o!==-1&&n.addIssue({code:"custom",path:["scores_list","dimensions",s,"sub_dimensions",o,"is_redline_option"],message:"subdimensions must define is_redline_option when redline_hit is defined."})}}),gP=M(Dh);function Oh(e){let n=e.map(i=>i.key);return n.length===_a.length&&new Set(n).size===_a.length&&_a.every(i=>n.includes(i))}var kt={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(kt))Object.freeze(e);Object.freeze(kt);var SP=Object.freeze(Xt.filter(e=>kt[e].length>0)),fP=Object.freeze(Xt.filter(e=>kt[e].length===0)),Nh=Object.freeze(["preparing_source","building","artifact_ready","deploying","released"]),jh="DEPLOYMENT_TRANSITION_INVALID",Sa=class extends Error{constructor(n,i){super(`Invalid deployment transition: ${n} -> ${i}`),this.currentStatus=n,this.nextStatus=i,this.code=jh,this.name="DeploymentTransitionError"}};function bP(e){return kt[e]}function yP(e){return Xt.filter(n=>kt[n].some(i=>i===e))}function Lh(e){return kt[e].length>0}function xP(e){return!Lh(e)}function EP(e,n){if(!kt[e].some(i=>i===n))throw new Sa(e,n);return n}function RP(){return Nh}import{converter as Mh,formatHex as Uh,parse as Fh,wcagContrast as kP}from"culori";var AP=Mh("oklch");var T={paper:"oklch(0.92 0.008 250)",cream:"oklch(0.90 0.035 85)",sand:"oklch(0.75 0.05 78)",stone:"oklch(0.60 0.02 75)",ash:"oklch(0.60 0.012 250)",slate:"oklch(0.45 0.025 250)",charcoal:"oklch(0.30 0.015 255)",ink:"oklch(0.25 0.04 260)",sky:"oklch(0.72 0.12 230)",blue:"oklch(0.58 0.17 250)","medical blue":"oklch(0.58 0.12 235)",indigo:"oklch(0.50 0.18 280)",navy:"oklch(0.40 0.10 258)",ocean:"oklch(0.55 0.13 220)","slate blue":"oklch(0.46 0.06 245)",teal:"oklch(0.60 0.12 195)","soft aqua":"oklch(0.78 0.07 190)",mint:"oklch(0.78 0.10 165)",sage:"oklch(0.65 0.05 145)",green:"oklch(0.58 0.15 145)","clinical green":"oklch(0.62 0.12 155)",emerald:"oklch(0.60 0.16 155)",forest:"oklch(0.45 0.10 145)",olive:"oklch(0.58 0.08 115)",lime:"oklch(0.72 0.17 130)",yellow:"oklch(0.82 0.15 100)",gold:"oklch(0.72 0.14 85)",amber:"oklch(0.70 0.16 70)",orange:"oklch(0.66 0.18 55)",coral:"oklch(0.68 0.16 32)",terracotta:"oklch(0.55 0.12 42)",rust:"oklch(0.50 0.13 38)",brown:"oklch(0.45 0.07 55)",rose:"oklch(0.65 0.16 18)",red:"oklch(0.58 0.20 25)",crimson:"oklch(0.52 0.20 22)",wine:"oklch(0.42 0.13 18)",pink:"oklch(0.72 0.14 0)",magenta:"oklch(0.60 0.22 345)",lavender:"oklch(0.72 0.08 295)",violet:"oklch(0.58 0.19 295)",purple:"oklch(0.52 0.19 305)",plum:"oklch(0.45 0.13 325)",electric:"oklch(0.62 0.23 285)","clean white":"oklch(0.97 0.01 245)","cool gray":"oklch(0.62 0.02 245)",zinc:"oklch(0.60 0.012 250)",gray:"oklch(0.60 0.012 250)",grey:"oklch(0.60 0.012 250)",neutral:"oklch(0.60 0.005 250)",gunmetal:"oklch(0.30 0.015 255)"},Gh={\u84DD:T.blue,\u84DD\u8272:T.blue,\u5929\u84DD:T.sky,\u5929\u84DD\u8272:T.sky,\u6D45\u84DD:T.sky,\u6E56\u84DD:T.ocean,\u6D77\u84DD:T.ocean,\u6DF1\u84DD:T.navy,\u85CF\u84DD:T.navy,\u85CF\u9752:T.navy,\u6D77\u519B\u84DD:T.navy,\u6DF1\u6D77\u519B\u84DD:T.navy,\u5348\u591C\u84DD:T.navy,\u975B\u84DD:T.indigo,\u975B\u9752:T.indigo,\u94A2\u84DD:T["slate blue"],\u9752:T.teal,\u9752\u8272:T.teal,\u84DD\u7EFF:T.teal,\u7EFF:T.green,\u7EFF\u8272:T.green,\u6D45\u7EFF:T.mint,\u8584\u8377\u7EFF:T.mint,\u8349\u7EFF:T.lime,\u6A44\u6984\u7EFF:T.olive,\u58A8\u7EFF:T.forest,\u6DF1\u7EFF:T.forest,\u68EE\u6797\u7EFF:T.forest,\u7FE0\u7EFF:T.emerald,\u7956\u6BCD\u7EFF:T.emerald,\u9EC4:T.yellow,\u9EC4\u8272:T.yellow,\u91D1:T.gold,\u91D1\u8272:T.gold,\u91D1\u9EC4:T.gold,\u7425\u73C0:T.amber,\u7425\u73C0\u8272:T.amber,\u6A59:T.orange,\u6A59\u8272:T.orange,\u6A58\u8272:T.orange,\u6A58\u9EC4:T.orange,\u6D3B\u529B\u6A59:T.orange,\u6696\u6A59:T.orange,\u73CA\u745A:T.coral,\u73CA\u745A\u6A59:T.coral,\u9676\u571F:T.terracotta,\u8D64\u9676:T.terracotta,\u9508\u7EA2:T.rust,\u68D5:T.brown,\u68D5\u8272:T.brown,\u8910\u8272:T.brown,\u5496\u5561\u8272:T.brown,\u7EA2:T.red,\u7EA2\u8272:T.red,\u6731\u7EA2:T.red,\u7EEF\u7EA2:T.crimson,\u6DF1\u7EA2:T.crimson,\u9152\u7EA2:T.wine,\u73AB\u7470:T.rose,\u73AB\u7EA2:T.rose,\u7C89:T.pink,\u7C89\u8272:T.pink,\u7C89\u7EA2:T.pink,\u6D0B\u7EA2:T.magenta,\u54C1\u7EA2:T.magenta,\u7D2B:T.purple,\u7D2B\u8272:T.purple,\u6DE1\u7D2B:T.lavender,\u85B0\u8863\u8349:T.lavender,\u7D2B\u7F57\u5170:T.violet,\u6885\u7EA2:T.plum,\u7070:T.gray,\u7070\u8272:T.gray,\u6D45\u7070:T.gray,\u6DE1\u7070:T.gray,\u51B7\u7070:T["cool gray"],\u51B7\u7070\u767D:T["cool gray"],\u6696\u7070:T.stone,\u6DF1\u7070:T.slate,\u77F3\u58A8\u7070:T.slate,\u77F3\u677F\u7070:T.slate,\u70AD\u7070:T.charcoal,\u70AD\u9ED1:T.charcoal,\u58A8:T.ink,\u58A8\u8272:T.ink,\u9ED1:T.ink,\u9ED1\u8272:T.ink,\u767D:T["clean white"],\u767D\u8272:T["clean white"],\u7C73\u767D:T.cream,\u7C73\u8272:T.cream,\u8C61\u7259\u767D:T.cream,\u5976\u6CB9\u767D:T.cream,\u6C99\u8272:T.sand},wP={...T,...Gh};function fa(e){let n=Fh(e.trim());return n?Uh(n)??null:null}var ht={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",weights:["400","500","600","700"]},"Noto Sans SC":{import:"Noto_Sans_SC",download:!1},"Noto Serif SC":{import:"Noto_Serif_SC",download:!1}},qh={heading:"Inter",body:"Inter"},Wc=ht.Inter;function ji(e){return e.trim().replace(/\s+/g,"_").toLowerCase()}var Hc=(()=>{let e=new Map;for(let[n,i]of Object.entries(ht))e.set(ji(n),i),e.set(ji(i.import),i);return e})();function Wh(e){return typeof e!="string"||e.trim().length===0?Wc:Hc.get(ji(e))??Wc}var Bh=(()=>{let e=new Map;for(let[n,i]of Object.entries(ht))e.set(i.import,n);return e})();function sn(e){if(typeof e!="string"||e.trim().length===0)return"Inter";let n=Hc.get(ji(e));return n?Bh.get(n.import)??"Inter":"Inter"}var Kh=Object.keys(ht),Bc='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',Kc='Georgia, "Times New Roman", serif',zc='"SFMono-Regular", Consolas, monospace',zh=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),Hh=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(e=>e.toLowerCase())),$h=new Set(["JetBrains Mono","IBM Plex Mono"].map(e=>e.toLowerCase()));function Vh(e){let n=e.toLowerCase();return $h.has(n)||n.includes("mono")?"mono":Hh.has(n)||n.includes("serif")?"serif":"sans"}function ba(e,n){let i=l=>(l??"").trim().replace(/^['"]|['"]$/g,"").replace(/[^A-Za-z0-9 _-]+/g,"").trim().slice(0,60),s=i(e),a=i(n),o=l=>zh.has(l.toLowerCase());if(s&&o(s)){let l=s.toLowerCase();return l.includes("mono")?zc:l.includes("serif")?Kc:Bc}let c=s;c||(c=o(a)?"":a),c||(c="Inter");let r=Vh(c);return r==="mono"?`"${c}", ${zc}`:r==="serif"?`"${c}", ${Kc}`:`"${c}", ${Bc}`}function Yh(e){return{"--site-font-sans":ba(e?.body,"Inter"),"--site-font-heading":ba(e?.heading,e?.body??"Inter")}}var ya=["archivo-inter","playfair-source-sans","space-grotesk-manrope","fraunces-libre-franklin","noto-serif-sc-noto-sans-sc","noto-sans-sc"],$c=[{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 Vc(e){let n=$c.find(i=>i.id===e);if(!n)throw new Error(`Unknown font pairing: ${e}`);return n}import{z as an}from"zod";import{z as Xh}from"zod";var Qh=["light","standard","bold"],We=Xh.enum(Qh),Li="standard",Zh=new Set(["display","heading","title"]),Yc={light:{display:300,heading:400,title:400,ui:400,button:400,body:400,strong:600},standard:{display:600,heading:500,title:500,ui:400,button:500,body:400,strong:600},bold:{display:700,heading:700,title:700,ui:400,button:600,body:400,strong:700}},OP=Object.keys(Yc.standard).map(e=>`--site-weight-${e}`),NP="--site-leading-body",jP=["--site-leading-display","--site-leading-heading","--site-leading-title"];function Je(e,n){let i=[];for(let s=e;s<=n;s+=100)i.push(s);return i}var Jh={"Source Sans 3":Je(200,900),"Space Grotesk":Je(300,700),Manrope:Je(200,800),"IBM Plex Sans":Je(100,700),Oswald:Je(200,700),"Bebas Neue":[400],"Playfair Display":Je(400,900),Lora:Je(400,700),"Cormorant Garamond":Je(300,700),"JetBrains Mono":Je(100,800),"IBM Plex Mono":[400,500,600,700],"DM Sans":Je(100,1e3)};function xa(e){return e.trim().replace(/\s+/g,"_").toLowerCase()}var eS=new Set(Object.entries(ht).flatMap(([e,n])=>[xa(e),xa(n.import)]));function Ea(e){if(!(e in ht)&&!eS.has(xa(e)))return null;let n=sn(e);return ht[n].download===!1?null:Jh[n]??Je(100,900)}function Xc(e,n){return!n||n.length===0?e:n.reduce((i,s)=>Math.abs(s-e)<Math.abs(i-e)?s:i,n[0])}function LP(e,n){let i=Yc[e??Li],s=n?.heading?Ea(n.heading):null,a=n?.body?Ea(n.body):null,o={};for(let c of Object.keys(i)){let r=Zh.has(c)?s:a;o[`--site-weight-${c}`]=String(Xc(i[c],r))}return o}var tS=/^(zh|ja|ko)(?:[-_]|$)/i,nS=/^(ar|fa|hi|bn|ta|si|th|lo|km|my|vi)(?:[-_]|$)/i;function Qc(e){return tS.test(e??"")?"dense":nS.test(e??"")?"tall":"default"}function iS(e){return Qc(e)==="dense"?"1.75":"1.5"}var sS={default:["1.1","1.2","1.3"],dense:["1.2","1.3","1.4"]};function MP(e){let n=Qc(e),i=iS(e),[s,a,o]=n==="tall"?[i,i,i]:sS[n];return{"--site-leading-display":s,"--site-leading-heading":a,"--site-leading-title":o}}function UP(e,n){let i=Ea(e);return[...new Set(n.map(a=>Xc(a,i)))].sort((a,o)=>a-o).map(String)}var on="/* <cms-builder:site-design-notes>",Kt="</cms-builder:site-design-notes> */",Ra="palette-inputs: ",Ia="type-inputs: ",At=an.string().min(1).max(40),Ta=an.object({primarySource:an.enum(["user","derived"]),neutral:At.optional(),foreground:At.optional(),supporting:an.array(At).max(4).optional(),imagePalette:an.object({background:At.optional(),foreground:At.optional(),card:At.optional(),muted:At.optional(),border:At.optional()}).optional()}),aS=an.object({weightStyle:We}),oS=e=>e.replaceAll("*/","* /").replace(/\s+/g," ").trim();function rS(e){let n=e.lines.map(oS).filter(Boolean).map(i=>` ${i}`);return e.paletteInputs&&n.push(` ${Ra}${JSON.stringify(e.paletteInputs).replaceAll("*/","* /")}`),e.typeInputs&&n.push(` ${Ia}${JSON.stringify(e.typeInputs).replaceAll("*/","* /")}`),[on,...n,` ${Kt}`].join(`
2
+ `)}function ka(e){let n=e.indexOf(on),i=e.indexOf(Kt,n+1);return n===-1||i===-1?null:{start:n,end:i+Kt.length}}function WP(e){let n=ka(e);if(!n)return e;let i=e.slice(0,n.start),s=e.slice(n.end);return i?(i.endsWith(`
3
+ `)&&(i=i.slice(0,-1)),s.startsWith(`
4
+ `)&&(s=s.slice(1))):s.startsWith(`
5
5
 
6
- `)&&(i=i.slice(2)),s+i}function eS(e){try{let n=JSON.parse(e),s=Ro.safeParse(n);return s.success?s.data:null}catch{return null}}function tS(e){try{let n=JSON.parse(e),s=Qh.safeParse(n);return s.success?s.data:void 0}catch{return}}function Yc(e){let n=Io(e);if(!n)return null;let s=e.slice(n.start+on.length,n.end-Kt.length),i=[],o=null,a;for(let c of s.split(`
7
- `).map(r=>r.trim()).filter(Boolean))c.startsWith(xo)?o=eS(c.slice(xo.length)):c.startsWith(Eo)?a=tS(c.slice(Eo.length)):i.push(c);return{lines:i,paletteInputs:o,...a?{typeInputs:a}:{}}}function TP(e,n){let s=Jh(n),i=Io(e);if(i)return e.slice(0,i.start)+s+e.slice(i.end);let a=[...e.matchAll(/^@import[^\n]*\n/gm)].at(-1);if(!a||a.index===void 0)return`${s}
6
+ `)&&(s=s.slice(2)),i+s}function cS(e){try{let n=JSON.parse(e),i=Ta.safeParse(n);return i.success?i.data:null}catch{return null}}function mS(e){try{let n=JSON.parse(e),i=aS.safeParse(n);return i.success?i.data:void 0}catch{return}}function Zc(e){let n=ka(e);if(!n)return null;let i=e.slice(n.start+on.length,n.end-Kt.length),s=[],a=null,o;for(let c of i.split(`
7
+ `).map(r=>r.trim()).filter(Boolean))c.startsWith(Ra)?a=cS(c.slice(Ra.length)):c.startsWith(Ia)?o=mS(c.slice(Ia.length)):s.push(c);return{lines:s,paletteInputs:a,...o?{typeInputs:o}:{}}}function BP(e,n){let i=rS(n),s=ka(e);if(s)return e.slice(0,s.start)+i+e.slice(s.end);let o=[...e.matchAll(/^@import[^\n]*\n/gm)].at(-1);if(!o||o.index===void 0)return`${i}
8
8
 
9
- ${e}`;let c=a.index+a[0].length;return`${e.slice(0,c)}
10
- ${s}
11
- ${e.slice(c)}`}var an="/* <cms-builder:global-design-tokens> */",Wn="/* </cms-builder:global-design-tokens> */",Me=class extends Error{constructor(n,s){super(`${n}: ${s}`),this.code=n,this.name="DesignTokenBlockError"}};function nS(e){let n=[],s=0;for(;s<e.length;){let i=e.indexOf(an,s),o=e.indexOf(Wn,s);if(i<0){if(o>=0)throw new Me("DESIGN_TOKEN_BLOCK_MISSING","a closing global-design-tokens marker appears without a matching opening marker.");break}if(o<0||o<i)throw new Me("DESIGN_TOKEN_BLOCK_MISSING","a global-design-tokens region is opened but never closed.");let a=i+an.length,c=e.indexOf(an,a);if(c>=0&&c<o)throw new Me("DESIGN_TOKEN_BLOCK_MISSING","global-design-tokens regions are nested; refusing to guess the intended boundaries.");n.push({bodyStart:a,bodyEnd:o}),s=o+Wn.length}if(n.length===0)throw new Me("DESIGN_TOKEN_BLOCK_MISSING","app/globals.css does not contain a cms-builder:global-design-tokens region.");return n}var sS=/^--[A-Za-z0-9_-]+/;function iS(e){return e===void 0||e==="{"||e==="}"||e===";"||/\s/.test(e)}function Qc(e,n,s){let i=[],o=n,a=0;for(;o<s;){let c=e[o];if(c==="/"&&e[o+1]==="*"){let r=e.indexOf("*/",o+2);o=r<0||r>=s?s:r+2;continue}if(c==='"'||c==="'"){o=Zc(e,o,s);continue}if(c==="("){a+=1,o+=1;continue}if(c===")"){a=Math.max(0,a-1),o+=1;continue}if(c==="-"&&a===0&&e[o+1]==="-"&&iS(o===0?void 0:e[o-1])){let r=sS.exec(e.slice(o,s));if(r){let m=r[0],S=o+m.length;for(;S<s&&(e[S]===" "||e[S]===" ");)S+=1;if(e[S]===":"){for(S+=1;S<s&&(e[S]===" "||e[S]===" ");)S+=1;let g=S,w=oS(e,g,s),H=e.slice(g,w).trimEnd();i.push({name:m,value:H.trim(),valueStart:g,valueEnd:g+H.length}),o=w;continue}}}o+=1}return i}function Zc(e,n,s){let i=e[n],o=n+1;for(;o<s;){let a=e[o];if(a==="\\"){o+=2;continue}if(a===i)return o+1;o+=1}return s}function oS(e,n,s){let i=n,o=0;for(;i<s;){let a=e[i];if(a==="\\"){i+=2;continue}if(a==='"'||a==="'"){i=Zc(e,i,s);continue}if(a==="/"&&e[i+1]==="*"){let c=e.indexOf("*/",i+2);i=c<0||c>=s?s:c+2;continue}if(a==="(")o+=1;else if(a===")")o=Math.max(0,o-1);else if(o===0&&(a===";"||a==="}"))return i;i+=1}return s}function Jc(e){return nS(e).flatMap(n=>Qc(e,n.bodyStart,n.bodyEnd))}function aS(e){return new Set(Qc(e,0,e.length).map(n=>n.name))}var rS=/[;{}]|\/\*|\*\/|[\r\n]/;function cS(e,n){if(n.trim().length===0)throw new Me("DESIGN_TOKEN_UNSAFE_VALUE",`refusing to write an empty declaration value for ${e}.`);if(rS.test(n))throw new Me("DESIGN_TOKEN_UNSAFE_VALUE",`refusing to write a declaration value for ${e} that contains a declaration or block terminator, a comment marker, or a newline.`)}function js(e){let n=new Map;for(let s of Jc(e))n.set(s.name,s.value);return n}function vP(e,n,s={}){let i=Jc(e),o=new Set(i.map(g=>g.name)),a=new Set,c=new Set,r=[],m=null;for(let g of n.keys())if(!o.has(g)){if(s.derivedKeys?.has(g)!==!0){r.push(g);continue}m??=aS(e),m.has(g)?c.add(g):a.add(g)}if(r.length>0)throw new Me("DESIGN_TOKEN_UNKNOWN",`refusing to add token names that the shared derivation never produces: ${r.join(", ")}`);for(let[g,w]of n)o.has(g)&&cS(g,w);for(let g of a)s.onOutOfScopeToken?.(g);for(let g of c)s.onUnwritableToken?.(g);let S=e;for(let g=i.length-1;g>=0;g-=1){let w=i[g],K=n.get(w.name);K!==void 0&&(S=S.slice(0,w.valueStart)+K+S.slice(w.valueEnd))}return S}function Kn(e){let n=e.indexOf(an),s=e.indexOf(Wn);return n!==-1&&s!==-1&&s>n}var em=/(color-scheme:\s*)(light|dark)(\s*;)/;function mS(e){let n=e.indexOf(an),s=e.indexOf(Wn);return n!==-1&&s>n?e.slice(n,s):null}function lS(e){let s=mS(e)?.match(em);return s?s[2]:null}function CP(e,n){let s=e.indexOf(an),i=e.indexOf(Wn);if(s===-1||i===-1||i<s)throw new Me("DESIGN_TOKEN_BLOCK_MISSING","globals.css has no design token block");let o=e.slice(s,i);return e.slice(0,s)+o.replace(em,`$1${n}$3`)+e.slice(i)}var pS=/["']([^"']+)["']/;function Xc(e){return e?.match(pS)?.[1]??null}function DP(e){if(!Kn(e))return null;let n;try{n=js(e)}catch(m){if(m instanceof Me)return null;throw m}let s=ho(n.get("--primary")??"")?.toLowerCase()??null,i=ho(n.get("--accent")??"")?.toLowerCase()??null,o=Xc(n.get("--site-font-heading")),a=Xc(n.get("--site-font-sans")),c=Yc(e),r=c?.paletteInputs??null;return{primary:s,accent:i,...r?.foreground!==void 0?{foreground:r.foreground}:{},...r?.neutral!==void 0?{neutral:r.neutral}:{},...r?.supporting!==void 0?{supporting:r.supporting}:{},...r?.imagePalette!==void 0?{imagePalette:r.imagePalette}:{},surfaceMode:lS(e),fonts:o&&a?{heading:nn(o),body:nn(a)}:null,paletteInputs:r,paletteInputsPresent:r!=null,notesLines:c?.lines??null,weightStyle:n.has("--site-weight-display")&&c?.typeInputs?c.typeInputs.weightStyle:null}}var Ls=(e,n)=>e.split(n).length-1;function dS(e){let n=0,s=0,i=0,o=e.length;for(;i<o;){let a=e[i];if(a==="/"&&e[i+1]==="*"){let c=e.indexOf("*/",i+2);i=c===-1?o:c+2;continue}if(a==='"'||a==="'"){let c=a;for(i+=1;i<o;){if(e[i]==="\\"){i+=2;continue}if(e[i]===c){i+=1;break}i+=1}continue}a==="{"?n+=1:a==="}"&&(s+=1),i+=1}return{open:n,close:s}}var tm=e=>{let{open:n,close:s}=dS(e);return n===s};function LP(e,n){if(tm(e)&&!tm(n))return{ok:!1,code:"GLOBALS_CSS_UNBALANCED",message:"app/globals.css has unbalanced braces."};if(Kn(e)&&!Kn(n))return{ok:!1,code:"GLOBALS_CSS_TOKEN_BLOCK_MISSING",message:"Keep the /* <cms-builder:global-design-tokens> */ and /* </cms-builder:global-design-tokens> */ markers in app/globals.css."};if(Ls(e,on)===Ls(e,Kt)&&Ls(n,on)!==Ls(n,Kt))return{ok:!1,code:"GLOBALS_CSS_NOTES_UNPAIRED",message:"The site design notes comment must keep both of its markers."};if(Kn(e)){let i=null;try{i=js(e)}catch(a){if(!(a instanceof Me))throw a}let o;try{o=js(n)}catch(a){if(a instanceof Me)return{ok:!1,code:"GLOBALS_CSS_TOKEN_BLOCK_MALFORMED",message:`app/globals.css design token block is malformed: ${a.message}`};throw a}if(i){let a=[...i.keys()].filter(c=>!o.has(c));if(a.length>0)return{ok:!1,code:"GLOBALS_CSS_TOKEN_REMOVED",message:`Do not delete design tokens from app/globals.css; change their values instead. Removed: ${a.slice(0,8).join(", ")}`}}}return{ok:!0}}import{z as q}from"zod";var KP="x-vcp-run-lease-owner",BP=600*1e3,zP=60*1e3,HP=3,VP=2,$P="WORKSPACE_RUN_RESUME_EXHAUSTED",YP="WORKSPACE_CHECK_INCOMPLETE",XP="WORKSPACE_GENERATION_STOPPED",QP="WORKSPACE_FILL_IN_INTERRUPTED",ZP="WORKSPACE_RUN_LEASE_SUPERSEDED",JP="WORKSPACE_RUN_NOT_ACTIVE",ev="FILL_IN_NOT_AVAILABLE",tv="FILL_IN_TARGET_NOT_OMITTED",nv="FILL_IN_TARGET_MODIFIED",uS=q.object({authMode:q.enum(["disabled-dev","internal-service","oidc"]),user_id:q.string().min(1),external_user_id:q.string().min(1).optional(),email:q.string().min(1).optional(),display_name:q.string().min(1).optional()}).strict(),sv=q.object({run_id:V,lease_owner:q.string().min(1),lease_ms:q.number().int().positive().max(1800*1e3).optional()}).strict(),iv=q.object({status:q.enum(["renewed","not_active","superseded"]),expires_at:q.string().min(1).nullable(),stop_requested:q.boolean()}).strict(),nm=q.object({run_id:V,page_id:q.string().min(1),attempt:q.number().int().positive(),snapshot_id:k,object_key:q.string().min(1),manifest_hash:q.string().min(1),file_paths:q.array(q.string().min(1)).min(1),created_at:q.string().min(1)}).strict(),ov=nm.omit({created_at:!0}).extend({lease_owner:q.string().min(1)}).strict(),av=q.object({checkpoints:q.array(nm)}).strict(),sm=q.object({kind:q.enum(["page","component","shared"]),target_id:q.string().min(1)}).strict(),rv=q.object({run_id:V,site_id:T,tenant_id:q.string().min(1),run_kind:q.enum(["initial_generation","iteration","landing_page","fill_in"]),status:q.enum(["queued","running","succeeded","failed","cancelled"]),base_snapshot_id:k.nullable(),lease_owner:q.string().min(1).nullable(),resume_count:q.number().int().nonnegative(),stop_requested:q.boolean(),reuse_from_run_id:V.nullable(),source_run_id:V.nullable(),fill_in_targets:q.array(sm),execution_scene:yi.nullable().optional(),intent:q.literal("navigation_adaptation").optional(),page_template_manifest:Xa.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"})}),cv=q.object({runs:q.array(q.object({run_id:V,site_id:T,tenant_id:q.string().min(1),run_kind:q.literal("initial_generation"),base_snapshot_id:k,sitemap_id:Te,resume_count:q.number().int().nonnegative(),lease_owner:q.string().min(1),stop_requested:q.boolean(),resume_principal:uS}).strict())}).strict(),mv=q.object({site_id:T}).strict(),lv=q.object({status:q.enum(["requested","already_requested","stopped","no_active_run"]),run_id:V.nullable()}).strict(),pv=q.object({ledger:kn.nullable(),source_run_id:V.nullable(),updated_at:q.string().min(1).nullable()}).strict(),dv=q.object({targets:q.array(sm).min(1).max(50),client_run_key:q.string().min(1).max(400)}).strict();import{z as _S}from"zod";var gv=".i18n.json",Ms="translation",im=new Set(["__proto__","constructor","prototype"]);function am(e){if(!Us(e)||Object.keys(e).length===0)return At("I18N_ROOT_INVALID","Component i18n resources must be a non-empty object.",[]);for(let[n,s]of Object.entries(e)){if(im.has(n))return om([n]);if(!gS(n))return At("I18N_LOCALE_INVALID",`Component i18n locale must be canonical BCP-47: ${n}`,[n]);if(!Us(s))return At("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let i=Object.keys(s);if(i.length!==1||i[0]!==Ms)return At("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let o=s[Ms];if(!Us(o))return At("I18N_RESOURCE_TREE_INVALID",`Component i18n translation namespace for ${n} must be an object.`,[n,Ms]);let a=[{value:o,path:[n,Ms]}];for(;a.length>0;){let c=a.pop();for(let[r,m]of Object.entries(c.value)){let S=[...c.path,r];if(im.has(r))return om(S);if(typeof m!="string"){if(!Us(m))return At("I18N_RESOURCE_TREE_INVALID","Component i18n resource leaves must be strings.",S);a.push({value:m,path:S})}}}}return{success:!0,data:e}}function hv(e){let n;try{n=JSON.parse(e)}catch{return At("I18N_JSON_INVALID","Component i18n resource file must contain valid JSON.",[])}return am(n)}var Sv=_S.custom(e=>am(e).success,"Invalid component i18n resources.");function gS(e){try{let n=Intl.getCanonicalLocales(e);return n.length===1&&n[0]===e}catch{return!1}}function Us(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=Object.getPrototypeOf(e);return n===Object.prototype||n===null}function om(e){return At("I18N_RESOURCE_KEY_FORBIDDEN",`Component i18n resource key is forbidden: ${e.at(-1)??""}`,e)}function At(e,n,s){return{success:!1,error:{code:e,message:n,path:s}}}var ht="products",hS=`/${ht}`,bv=hS,yv=`${ht} detail`,xv="cms_collection_view",Ev="list",Rv="detail",it={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"}},SS=new Set(Object.values(it).map(e=>e.pageTitle)),fS=new Set(Object.values(it).flatMap(e=>[e.blockLabel,e.detailBlockLabel,e.heroBlockLabel]));function Iv(e){let n=e?.trim().toLowerCase()??"";if(n==="zh-tw"||n==="zh-hk"||n==="zh-mo")return it.zhHant;if(n.startsWith("zh"))return it.zhHans;switch(n.split("-")[0]){case"de":return it.de;case"fr":return it.fr;case"es":return it.es;case"ja":return it.ja;case"ko":return it.ko;case"en":default:return it.en}}function Tv(e){return SS.has(e.trim())}function kv(e){return fS.has(e.trim())}import{z as rn}from"zod";var vv="SITE_HAS_ACTIVE_SUBSITES",Cv="SITE_HAS_SUBSITES",bS=rn.object({site_id:T,name:rn.string().min(1),mount_path:rn.string().min(1),archived_at:rn.string().nullable()}),Dv=rn.object({subsites:rn.array(bS)});import{z as ke}from"zod";var Lv=ke.object({key:ke.string().min(1),composition:_e}).strict(),Gs=ke.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),yS=ke.enum(["direct","proxy","upstream","readonly","unsupported"]),xS=ke.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),Fs=ke.object({mode:yS,reasonCode:ke.string().min(1).optional()}),ES=ke.object({kind:xS,message:ke.string().min(1)}),qs=ke.object({composition:B,key:ke.string().min(1),canUpdateText:ke.boolean(),canInsertChild:ke.boolean(),canMove:ke.boolean(),canRemove:ke.boolean(),editModes:ke.object({updateText:Fs.optional(),insertChild:Fs.optional(),move:Fs.optional(),remove:Fs.optional()}).optional(),constraints:ke.array(ES)}).strict();import{z as X}from"zod";var Kv=X.discriminatedUnion("type",[X.object({type:X.literal("site-edit.document.changed"),siteId:T,snapshotId:k,composition:B,version:X.number().int().nonnegative(),at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.operation.planned"),siteId:T,operationId:X.string().min(1),baseSnapshotId:k,composition:B,changedFiles:X.array(X.string().min(1)),at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.operation.completed"),siteId:T,composition:B,result:Qi,at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.operation.failed"),siteId:T,composition:B,requestId:X.string().min(1),error:gc,at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.capability.changed"),siteId:T,composition:B,keys:X.array(X.string().min(1)),at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.graph.invalidated"),siteId:T,composition:B,at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.graph.ready"),siteId:T,composition:B,version:X.number().int().nonnegative(),at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.graph.error"),siteId:T,composition:B,message:X.string().min(1),at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.snapshot.changed"),siteId:T,composition:B,snapshotId:k,previousSnapshotId:X.string().min(1).nullable(),at:X.string().min(1)}).strict()]);import{z as ce}from"zod";var Vv="durable-history-v1",Ws=ce.object({initiatingComposition:B.optional(),affectedCompositions:ce.array(B)}).strict(),$v=ce.enum(["writable","read-only-recovery","unavailable"]),RS=ce.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),IS=ce.object({code:RS,message:ce.string().min(1),occurredAt:ce.iso.datetime().optional()}).strict(),TS=ce.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),rm={revision:ce.number().int().nonnegative(),undoDepth:ce.number().int().nonnegative(),redoDepth:ce.number().int().nonnegative()},kS=ce.object({mode:ce.literal("writable"),composition:B,...rm,canUndo:ce.boolean(),canRedo:ce.boolean(),provenance:Ws.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."})}),AS=ce.object({mode:ce.literal("read-only-recovery"),composition:B,...rm,canUndo:ce.literal(!1),canRedo:ce.literal(!1),recoveryDiagnostic:IS,provenance:Ws.optional()}).strict(),wS=ce.object({mode:ce.literal("unavailable"),composition:B,revision:ce.literal(0),undoDepth:ce.literal(0),redoDepth:ce.literal(0),canUndo:ce.literal(!1),canRedo:ce.literal(!1),reason:TS,provenance:Ws.optional()}).strict(),PS=ce.discriminatedUnion("mode",[kS,AS,wS]),Yv=ce.object({composition:B,status:PS,provenance:Ws}).strict();import{z as $}from"zod";var Ks=$.enum(["api-field","cms-field","i18n-message","config-entry"]),To=$.object({kind:$.enum(["jsx-node","value-path","route-export","external-entry"]),file:$.string().min(1).optional(),isProxy:$.boolean(),displayPath:$.string().min(1).optional(),sourceType:Ks.optional(),sourceId:$.string().min(1).optional()}),vS=$.discriminatedUnion("status",[$.object({status:$.literal("resolved"),value:Wt}).strict(),$.object({status:$.literal("undefined")}).strict(),$.object({status:$.literal("unresolved")}).strict()]),CS=$.object({kind:$.enum(["literal","boolean-shorthand","expression","binding","repeat-template"]),raw:$.string().optional()}).strict(),DS=$.object({name:$.string().min(1),source:CS,resolution:vS,editMode:$.enum(["direct","proxy","upstream","readonly","unsupported"]),sourceScope:$.enum(["node","repeat-item","repeat-template"]),allowedWriteScopes:$.array($.enum(["selection","template"])),effectiveWriteTarget:To.optional(),diagnostics:$.array($.object({code:$.string().min(1),message:$.string().min(1)}).strict())}).strict(),OS=$.object({raw:$.string().min(1),sourceRange:pt,order:$.number().int().nonnegative(),diagnostics:$.array($.object({code:$.string().min(1),message:$.string().min(1)}).strict())}).strict(),NS=$.object({selection:$.enum(["direct","materialize","unsupported"]),template:$.enum(["direct","unsupported"])}).strict(),ko=$.object({documentVersion:$.number().int().nonnegative(),selectionRef:en.optional(),items:$.array(DS),spreads:$.array(OS),creation:NS}).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 Ae}from"zod";var jS=Ae.string().min(1).refine(e=>!e.startsWith("/")&&!e.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),LS=Ae.string().regex(/^sha256:[a-f0-9]{64}$/),MS=Ae.object({path:jS,operation:Ae.enum(["create","update","delete"]),expectedHash:LS.optional(),fullContent:Ae.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"})}),US=Ae.object({siteId:T,baseSnapshotId:k,operationId:Ae.string().min(1),reason:Ae.string().min(1),patches:Ae.array(MS).min(1),changedCompositions:Ae.array(B),changedRouteIds:Ae.array(Ae.string().min(1)).optional(),diagnostics:Ae.array(Ae.object({code:Ae.string().min(1),message:Ae.string().min(1),path:Ae.string().min(1).optional()})).default([])}).strict().superRefine((e,n)=>{let s=new Set;for(let[o,a]of e.patches.entries())s.has(a.path)&&n.addIssue({code:"custom",path:["patches",o,"path"],message:`Duplicate patch path: ${a.path}`}),s.add(a.path);let i=[...new Set(e.changedCompositions.map(o=>o.routeId))];e.changedRouteIds!==void 0&&(e.changedRouteIds.length!==i.length||e.changedRouteIds.some((o,a)=>o!==i[a]))&&n.addIssue({code:"custom",path:["changedRouteIds"],message:"changedRouteIds must be the stable deduplicated route projection of changedCompositions."})}),oC=US.transform(e=>({...e,changedRouteIds:[...new Set(e.changedCompositions.map(n=>n.routeId))]}));var Ao="::repeat-item#";function FS(e,n){return`${e}${Ao}${n}`}function rC(e,n){return n.reduce((s,i)=>FS(s,i),e)}function GS(e){if(typeof e!="string"||e.length===0)return null;let n=[],s=e;for(;;){let i=s.lastIndexOf(Ao);if(i<0)break;let o=Number(s.slice(i+Ao.length));if(!Number.isInteger(o)||o<0)return null;n.unshift({repeatIndex:o}),s=s.slice(0,i)}return!s||n.length===0?null:{baseKey:s,parts:n}}function cC(e){return GS(e)?.baseKey??e??null}import{z as l}from"zod";import{z as Ne}from"zod";var qS=Ne.object({placementKey:Ne.string().min(1),placementUnitKey:Ne.string().min(1),relation:Ne.enum(["before","after","prepend","append"])}).strict(),WS=Ne.object({status:Ne.literal("supported"),containerKey:Ne.string().min(1),hasBusinessMembers:Ne.boolean(),placementUnitKeys:Ne.array(Ne.string().min(1)),placements:Ne.array(qS)}).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 i=new Set;e.placements.forEach((o,a)=>{i.has(o.placementKey)&&n.addIssue({code:"custom",path:["placements",a,"placementKey"],message:"Render page composition placement keys must be unique."}),i.add(o.placementKey),s.has(o.placementUnitKey)||n.addIssue({code:"custom",path:["placements",a,"placementUnitKey"],message:"Render page composition placement must reference a projected unit."})})}),KS=Ne.object({status:Ne.literal("unsupported"),reason:ws,diagnostics:Ne.array(Ln)}).strict(),cm=Ne.discriminatedUnion("status",[WS,KS]);var BS=l.object({canUpdateText:l.boolean(),canInsertChild:l.boolean(),canMove:l.boolean(),canRemove:l.boolean()}),mm=l.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),zS=l.enum(["cms-field","api-field"]),HS=l.enum(["text","attribute","richtext","repeat-region","conditional-region","component-prop"]),VS=l.enum(["exact","safe-derived","partial","unknown"]),$S=l.object({file:l.string().min(1),symbol:l.string().min(1).optional(),reason:l.string().min(1)}),YS=l.object({sourceKind:mm,sourceType:zS,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:HS,targetName:l.string().min(1),confidence:VS,readonly:l.literal(!0),evidence:l.array($S)}),lm=l.object({hasDynamicData:l.boolean(),bindings:l.array(YS)}),pm=l.object({hasDynamicData:l.boolean(),sourceKinds:l.array(mm),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()}),XS=l.object({key:l.string().min(1),parentKey:l.string().min(1).nullable().optional(),pageCompositionUnitKey:l.string().min(1).optional(),operationSummary:BS,dynamicDataSummary:pm.optional()}).strict(),TC=l.object({composition:_e}).strict(),kC=l.object({key:l.string().min(1),composition:_e,selectionRef:en.optional()}).strict(),AC=l.object({siteId:T,snapshotId:k,composition:B,version:l.number().int().nonnegative(),entries:l.array(XS),pageComposition:cm}).strict(),dm=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()}),wo=l.object({index:l.number().int().min(0),value:l.string(),editable:l.boolean(),source:dm.nullable()}),Bn=l.object({key:l.string().min(1),label:l.string().min(1),tag:l.string().min(1)}),wC=l.object({composition:B,key:l.string().min(1),canUpdateText:l.boolean(),canInsertChild:l.boolean(),canMove:l.boolean(),canRemove:l.boolean(),boundaryKind:Gs.nullable(),isOpaque:l.boolean()}).strict(),QS=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()}),um=l.object({kind:l.union([l.enum(["jsx-literal","component-prop","binding","imported-binding","object-field","array-item","repeat-template","conditional-branch"]),Ks]),file:l.string().min(1),displayPath:l.string().min(1),externalSource:l.object({sourceType:Ks,sourceId:l.string().min(1),adapterId:l.string().min(1).optional()}).optional()}),ZS=l.object({kind:um.shape.kind,file:l.string().min(1),displayName:l.string().min(1),canEditHere:l.boolean()}),zn=l.object({finalSource:um.nullable(),chain:l.array(ZS),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)}))}),JS=l.object({kind:l.literal("css-style-model"),properties:l.array(l.object({property:lc,value:l.union([l.string(),l.number(),l.boolean(),l.null()]),resolvedValue:l.union([l.string(),l.number(),l.boolean(),l.null()]).optional(),breakpoint:dc.optional(),state:pc.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(Mn).optional()}))}),PC=l.union([l.record(l.string(),l.unknown()),JS]),_m=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(Mn),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()}),ef=l.object({startLine:l.number().int().positive(),startColumn:l.number().int().nonnegative(),endLine:l.number().int().positive(),endColumn:l.number().int().nonnegative()}),Po=l.object({sourceFile:l.string().min(1),componentName:l.string().min(1),openingElementRange:ef,structuralPath:l.string().min(1),textPreview:l.string().min(1).optional()}),vC=l.object({composition:B,key:l.string().min(1),tag:l.string().min(1),componentName:l.string().min(1),sourceFile:l.string().min(1),sourceLocator:Po.optional(),label:l.string().min(1),capabilities:qs,writeTarget:QS,effectiveWriteTarget:To.optional(),provenanceChain:zn.optional(),componentSemantic:l.record(l.string(),l.unknown()).optional(),styleSource:_m.optional(),conditional:l.record(l.string(),l.unknown()).optional(),dynamicData:lm.optional(),properties:ko.optional(),textSegments:l.array(wo),boundaryKind:Gs.nullable(),isOpaque:l.boolean(),ancestors:l.array(Bn),children:l.array(Bn),siblings:l.array(Bn)}).strict(),CC=l.object({composition:B,key:l.string().min(1),tag:l.string().min(1),label:l.string().min(1),sourceLocator:Po.optional(),capabilities:l.object({constraints:qs.shape.constraints}),isOpaque:l.boolean(),provenanceChain:l.object({editMode:zn.shape.editMode,diagnostics:zn.shape.diagnostics}).optional(),dynamicDataSummary:pm.optional(),ancestors:l.array(Bn)}).strict(),DC=l.object({composition:B,key:l.string().min(1),tag:l.string().min(1),label:l.string().min(1),sourceLocator:Po.optional(),isOpaque:l.boolean(),ancestors:l.array(Bn),componentName:l.string().min(1),sourceFile:l.string().min(1),capabilities:qs,provenanceChain:l.object({editMode:zn.shape.editMode,diagnostics:zn.shape.diagnostics}).optional(),textSegments:l.array(l.object({index:wo.shape.index,editable:wo.shape.editable,sourceKind:dm.shape.kind.nullable()})),dynamicData:lm.optional(),properties:ko.optional(),boundaryKind:Gs.nullable()}).strict(),OC=l.object({composition:B,key:l.string().min(1),styleSource:_m.optional()}).strict();var tf=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],nf=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],sf=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],of=new Set(tf),af=new Set(nf),rf=new Set(sf),cf={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function jC(e){return of.has(vo(e))}function mf(e){return af.has(vo(e))}function lf(e){return rf.has(vo(e))}function LC(e){let{operationSummary:n}=e;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:e.fallbackMode!=="preview"?{...cf}:{canUpdateText:lf(e.tagName),canInsertChild:mf(e.tagName),canMove:!1,canRemove:!1}}function vo(e){return e?.trim().toLowerCase()??""}import{z as pf}from"zod";var qC=pf.object({composition:_e,mutationContext:Nn.optional()}).strict();var KC={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.",SITE_SITEMAP_DRAFT_STALE:"The draft was updated elsewhere. Reload the latest draft before saving.",SITE_SITEMAP_DRAFT_OPERATION_MISMATCH:"This save identity belongs to a different draft operation.",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."},df=["WORKSPACE_RUN_CANCELLED","WORKSPACE_GENERATION_STOPPED"],uf=new Set(df);function BC(e){return typeof e=="string"&&uf.has(e)}var zC={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."},HC={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},VC={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var gm="0.10.23",YC="x-vcp-edit-engine-version",XC="x-vcp-edit-engine-version-source",Co=class extends Error{constructor(n="Invalid edit-engine version."){super(n),this.code="EDIT_ENGINE_VERSION_INVALID",this.name="EditEngineVersionParseError"}},_f=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/;function gf(e){return _f.test(e)}function hf(e){if(typeof e!="string"||!gf(e))throw new Co;return e}function QC(e){return e==null?{version:gm,source:"fallback_current"}:{version:hf(e),source:"explicit"}}function ZC(){return{version:gm,source:"system_current"}}import{z as Ze}from"zod";var Sf=200,ff=200;function bf(e){let n=e.indexOf(":");if(n<=0)return null;let s=e.slice(0,n).trim(),i=e.slice(n+1).trim();return s.length===0||i.length===0?null:{source:s,target:i}}var yf=Ze.string().min(3).max(Sf).refine(e=>bf(e)!==null,{message:'glossary entries must be "source:target" pairs split on a half-width colon, e.g. "\u7C73:Rice"'}),tD=Ze.array(yf).max(ff),nD=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()}),xf=Ze.enum(["regional","fonts_only"]),Bs=Ze.string().regex(/^#[0-9a-fA-F]{6}$/,'color must be a "#rrggbb" value'),Ef=Ze.object({primary:Bs.optional(),accent:Bs.optional(),foreground:Bs.optional(),neutral:Bs.optional()}),Rf=600,sD=Ze.object({mode:xf.default("regional"),seeds:Ef.optional(),note:Ze.string().min(1).max(Rf).optional()}),iD={mode:"regional"};function oD(e){return e===void 0?!1:Object.values(e).some(n=>typeof n=="string"&&n.length>0)}import{z as Bt}from"zod";var If=12,mD=Bt.object({tenant_id:Bt.string().min(1),site_id:T,snapshot_id:k,manifest_hash:Bt.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:Bt.string().min(1).max(2048)}),zs=Bt.number().int().nonnegative().safe(),lD=Bt.object({page_count:zs,translation_character_count:zs,image_estimate:Bt.object({media_key_count:zs,max_replacement_count:zs})}).superRefine((e,n)=>{let{media_key_count:s,max_replacement_count:i}=e.image_estimate;i!==Math.min(s,If)&&n.addIssue({code:"custom",path:["image_estimate","max_replacement_count"],message:"max replacement count does not match the deterministic ceiling"})});import{z as Ue}from"zod";var Tf=Ue.string().trim().min(1),cn=Ue.string().uuid(),kf=Ue.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"),hm=Ue.object({snapshot_id:cn,object_key:kf}),uD=Ue.object({tenant_id:Tf,parent_site_id:cn,subsite_site_id:cn,base:hm,target:hm}),_D=Ue.object({subsite_site_id:cn,pending_pages:Ue.array(Ue.string().min(1)),hash_diverged_count:Ue.number().int().nonnegative(),child_only_count:Ue.number().int().nonnegative(),base_snapshot_id:cn,target_snapshot_id:cn}),Af=Ue.enum(["SUBSITE_DIFF_REQUEST_INVALID","SUBSITE_DIFF_STORE_NOT_CONFIGURED","SUBSITE_DIFF_MANIFEST_MISSING","SUBSITE_DIFF_MANIFEST_INVALID"]),gD=Ue.object({error_code:Af,message:Ue.string().min(1),side:Ue.enum(["base","target"]).optional()});import{z as J}from"zod";var bD=J.object({tenant_id:J.string().min(1),site_id:T,snapshot_id:k,manifest_hash:J.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:J.string().min(1).max(2048),page_slug:J.string().max(512).optional()}),yD=J.object({site_id:T,snapshot_id:k,unit_count:J.number().int().nonnegative(),file_count:J.number().int().nonnegative(),markdown:J.string().min(1),page_slug:J.string().optional(),page_file:J.string().optional(),entries:J.array(J.object({id:J.string().min(1),file_path:J.string().min(1),line:J.number().int().nullable(),kind:J.string().min(1),text:J.string(),media_key:J.string().optional()})).optional(),images:J.array(J.object({id:J.string().min(1),source:J.enum(["media-registry","source-literal"]),src:J.string().min(1),alt:J.string().nullable(),media_key:J.string().optional(),width:J.number().optional(),height:J.number().optional(),provider:J.string().optional(),is_placeholder:J.boolean(),occurrences:J.array(J.object({file_path:J.string().min(1),line:J.number().int()}))})).optional()});import{z as wf}from"zod";var Pf=/^\/[a-z0-9][a-z0-9-]{0,30}$/,vf=Object.freeze(["api","_next","assets","static","robots.txt","sitemap.xml",".well-known"]),Cf=new Set(vf);function Df(e){return Cf.has(e)}var RD=wf.string().regex(Pf).refine(e=>!Df(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 ge}from"zod";var Of=ge.enum(["active","paused","blocked"]),Sm=ge.enum(["typecheck_failed","health_failed","validation_failed"]),Nf={status:Of,attempts:ge.number().int().nonnegative(),attempted_template_version:Xe.nullable(),last_error_code:Sm.nullable()},mn=ge.object(Nf).strict(),Hs=ge.object({template_id:ge.string().trim().min(1),target_template_version:Xe}).strict(),AD=Hs,jf=ge.discriminatedUnion("action",[ge.object({action:ge.literal("proceed"),state:mn.extend({status:ge.literal("active")})}).strict(),ge.object({action:ge.literal("skip_not_newer"),state:mn.extend({status:ge.literal("active")})}).strict(),ge.object({action:ge.literal("skip_paused"),state:mn.extend({status:ge.literal("paused")})}).strict(),ge.object({action:ge.literal("skip_blocked"),state:mn.extend({status:ge.literal("blocked")})}).strict()]),wD=Hs,PD=jf,vD=Hs.extend({error_code:Sm}),CD=ge.object({state:mn}).strict(),DD=Hs,OD=ge.object({state:mn}).strict();import{z as Y}from"zod";var Lf=744*60*60*1e3,Mf=Y.enum(["eligible","fast_path","upgraded","skipped","lock_skipped","cas_aborted","validation_failed","blocked","paused"]),Uf=Y.enum(["typecheck","build","health","validation"]),Ff=Y.enum(["not_attempted","promoted","aborted"]),UD=Y.object({template_id:Y.string().trim().min(1).max(128),from_version:Xe.nullable(),to_version:Xe,outcome:Mf,attempt:Y.number().int().nonnegative().max(2147483647),duration_ms:Y.number().int().nonnegative().max(2147483647),replaced_group_count:Y.number().int().nonnegative().max(2147483647),skipped_group_count:Y.number().int().nonnegative().max(2147483647),validation_stage:Uf.nullable(),cas_outcome:Ff.nullable()}).strict(),FD=Y.object({recorded:Y.literal(!0)}).strict(),fm=Y.object({from:Y.iso.datetime(),to:Y.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)<=Lf,{message:"report window must not exceed 31 days",path:["to"]}),GD=fm,Gf=Y.object({eligible:Y.number().int().nonnegative(),fast_path:Y.number().int().nonnegative(),upgraded:Y.number().int().nonnegative(),skipped:Y.number().int().nonnegative(),lock_skipped:Y.number().int().nonnegative(),cas_aborted:Y.number().int().nonnegative(),validation_failed:Y.number().int().nonnegative(),blocked:Y.number().int().nonnegative(),paused:Y.number().int().nonnegative()}).strict(),qD=Y.object({window:fm,outcome_counts:Gf,current_state_counts:Y.object({blocked:Y.number().int().nonnegative(),paused:Y.number().int().nonnegative()}).strict(),duration_ms:Y.object({p50:Y.number().int().nonnegative().nullable(),p95:Y.number().int().nonnegative().nullable(),sample_count:Y.number().int().nonnegative()}).strict()}).strict(),WD=Y.object({older_than:Y.iso.datetime(),limit:Y.coerce.number().int().min(1).max(200).default(50),include_candidates:Y.enum(["true","false"]).default("false").transform(e=>e==="true")}).strict(),qf=Y.object({site_id:T,snapshot_id:k,status:Y.enum(["candidate","deleting"]),created_at:Y.iso.datetime()}).strict(),KD=Y.object({snapshots:Y.array(qf)}).strict();import{z as St}from"zod";var Wf=St.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"]),Kf=St.object({status:St.literal("ready"),preview_url:St.string().url()}).strict(),Bf=St.object({status:St.literal("failed"),code:Wf,message:St.string().min(1),retryable:St.boolean()}).strict(),HD=St.discriminatedUnion("status",[Kf,Bf]);import{z as wt}from"zod";var zf=["not_started","active","completed"],Hf=wt.enum(zf),Vf=["not_started","in_progress","completed"],$f=wt.enum(Vf),Yf=wt.object({sequence:wt.number().int().positive(),code:Rt,status:$f}).strict(),Xf=wt.object({site_id:T,workflow_status:Hf,flow_type:tn.nullable(),current_step_code:Rt.nullable(),completed_count:wt.number().int().nonnegative(),total_count:wt.number().int().nonnegative(),steps:wt.array(Yf)}).strict().superRefine((e,n)=>{let s=e.steps.filter(i=>i.status==="completed").length;e.total_count!==e.steps.length&&n.addIssue({code:"custom",path:["total_count"],message:"total_count must equal steps.length."}),e.completed_count!==s&&n.addIssue({code:"custom",path:["completed_count"],message:"completed_count must equal completed steps."}),e.steps.forEach((i,o)=>{i.sequence!==o+1&&n.addIssue({code:"custom",path:["steps",o,"sequence"],message:"Step sequence must be continuous and start at 1."})}),e.workflow_status==="not_started"&&(e.flow_type!==null&&n.addIssue({code:"custom",path:["flow_type"],message:"not_started progress cannot have a flow_type."}),e.current_step_code!==null&&n.addIssue({code:"custom",path:["current_step_code"],message:"not_started progress cannot have a current step."}),(e.completed_count!==0||e.total_count!==0)&&n.addIssue({code:"custom",path:["steps"],message:"not_started progress must have zero counts and no steps."})),e.workflow_status==="active"&&(e.flow_type===null&&n.addIssue({code:"custom",path:["flow_type"],message:"active progress requires a flow_type."}),e.current_step_code===null&&n.addIssue({code:"custom",path:["current_step_code"],message:"active progress requires a current step."})),e.workflow_status==="completed"&&(e.flow_type===null&&n.addIssue({code:"custom",path:["flow_type"],message:"completed progress requires a flow_type."}),e.current_step_code!==null&&n.addIssue({code:"custom",path:["current_step_code"],message:"completed progress cannot have a current step."}),e.steps.some(i=>i.status!=="completed")&&n.addIssue({code:"custom",path:["steps"],message:"completed progress must have only completed steps."}),e.completed_count!==e.total_count&&n.addIssue({code:"custom",path:["completed_count"],message:"completed progress counts must be equal."}))}),ZD=M(Xf);import{z as Do}from"zod";var Qf=Do.enum(["none","build","build_publish"]),Zf=Do.object({site_id:T,launcher_scope:Qf}),nO=Do.object({permission:Zf});function sO(e){return e!=="none"}function iO(e){return e==="build_publish"}import{z as fe}from"zod";var lO="build-context.json",pO=2e5,bm=fe.string().regex(/^sha256:[a-f0-9]{64}$/u),ym=1e3;function Jf(e){return Array.from(e).length<=ym}var eb=fe.object({kind:fe.enum(["customer_materials","website_scan_diagnosis","committed_strategy"]),digest:bm}).strict(),tb=fe.object({schema_version:fe.literal(1),flow_type:tn,sources:fe.array(eb).min(2).max(2)}).strict().superRefine((e,n)=>{let s=new Set(e.sources.map(o=>o.kind)),i=e.flow_type==="with_website"?["website_scan_diagnosis","committed_strategy"]:["customer_materials","committed_strategy"];(s.size!==i.length||i.some(o=>!s.has(o)))&&n.addIssue({code:"custom",path:["sources"],message:"Site-build provenance sources must match the persisted workflow flow."})}),nb=fe.object({schema_version:fe.literal(1),seed:bm.optional(),cms_settings:fe.object({main_products:fe.string().trim().min(1).refine(Jf,{message:`main_products must contain at most ${ym} characters`}).optional()}).strict().optional(),provenance:tb.optional()}).strict(),sb=fe.object({schema_version:fe.literal(1),site_id:T,workflow_id:nt,brief:fe.string().min(1),source:fe.enum(["business_provider","mock"]),payload:nb}).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."})}),dO=fe.object({source_snapshot_id:k,source_run_id:V,build_context:sb,page_slugs:fe.array(fe.string().min(1)).optional()}).strict(),uO=fe.object({disposition:fe.enum(["reused","rebased"]),snapshot_id:k}).strict(),ib=fe.object({snapshot:so,workspace_run_id:V.nullable()}).strict(),_O=M(ib);import{z as ot}from"zod";import{z as Be}from"zod";import{z as he}from"zod";import{z as ob}from"zod";var ab=["company_profile","product_manual","product_list","customer_case","product_help","qualification","industry_material"],xm=ob.enum(ab);var Em=he.enum(["pending","running","ready","failed","missing"]),rb=he.object({task_id:he.string().min(1).max(500),status:Em}).strict(),yO=he.object({items:he.array(rb).max(100)}).strict(),Hn=he.string().trim().min(1).max(255),xO=he.object({knowledge_site_id:Hn,source_ids:he.array(Hn).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"]})}),cb=he.object({source_file_id:Hn,category_code:xm.nullable(),category_confirmed:he.boolean(),status:Em}).strict(),EO=he.object({ready:he.boolean(),files:he.array(cb),counts:he.object({total:he.number().int().nonnegative(),pending:he.number().int().nonnegative(),running:he.number().int().nonnegative(),ready:he.number().int().nonnegative(),failed:he.number().int().nonnegative(),missing:he.number().int().nonnegative(),unclassified:he.number().int().nonnegative()}).strict()}).strict();var be=e=>Be.string().trim().max(e),Rm=Be.array(Be.string().trim().min(1).max(120)).max(20),Oo=Be.object({company_name:Be.string().trim().min(1).max(200),brand_name:be(200),primary_products:Be.string().trim().min(1).max(1e3),industry:be(200),applications:be(1e3),business_summary:be(2e3),registered_capital:be(200).default(""),legal_representative:be(200).default(""),target_markets:Rm,customer_industries:be(1e3),customer_roles:be(1e3),buying_scenarios:be(2e3),differentiators:be(2e3),competitors:be(1e3),trust_proof:be(2e3),customer_cases:be(3e3),channels:Rm,expected_domain:be(255),brand_tone:be(500),contact_name:be(200),contact_info:be(500),timezone:be(100),launch_timing:be(200),input_source_ids:Be.array(Hn).max(50)}).strict(),mb=Be.enum(["draft","submitted"]),No=Oo.extend({id:Q,tenant_id:Be.string().min(1),site_id:T,workflow_id:nt,status:mb,submitted_at:Be.string().min(1).nullable(),created_at:Be.string().min(1),updated_at:Be.string().min(1)}).strict(),wO=M(No),PO=M(No),vO=M(No.nullable());var jO=Ds.extend({expected_current_node:ot.literal("website_scan"),type:ot.literal("existing_site"),result:Ds.shape.result.extend({website:ot.string().url(),scan_cards:ot.partialRecord(Oc,lo).refine(e=>Object.keys(e).length>0,{message:"At least one recognized scan card is required."})}).strict()}).strict(),LO=ot.object({expected_current_node:ot.literal("customer_materials"),materials:Oo}).strict(),MO=ot.object({expected_current_node:ot.literal("diagnosis")}).strict(),UO=ot.object({expected_current_node:ot.literal("strategy")}).strict();import{z as N}from"zod";var jo=["compact","comfortable","airy"],Im=["none","sm","md","lg","xl"],Tm="lg",Lo=["subtle","moderate","expressive"],lb=[{id:"subtle",motionLevel:"subtle"},{id:"moderate",motionLevel:"moderate"},{id:"expressive",motionLevel:"expressive"}];function km(e){let n=lb.find(s=>s.id===e);if(!n)throw new Error(`Unknown motion preset: ${e}`);return n}var Am=["ocean","forest","clay","violet","graphite","crimson"],wm=["ai-forest","ai-navy","ai-steel"],Pm=/^gen-[0-9a-f]{8}$/,Mo=[{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"}],Uo=[{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 qO(e){let n=Uo.find(s=>s.id===e);if(!n)throw new Error(`Unknown theme preset: ${e}`);return n}function vm(e){return Uo.find(n=>n.id===e)?.radius??Mo.find(n=>n.id===e)?.radius}var Fo=N.string().regex(/^#[0-9A-F]{6}$/i),Vn=N.string().trim().min(1).max(500),Cm=N.string().datetime({offset:!0}),pb=N.enum(Am),db=N.enum(wm),ub=N.string().regex(Pm),$n=N.union([pb,db,ub]),Yn=N.enum(fo),Xn=N.enum(Lo),Qn=N.enum(jo),Vs=N.enum(Im),Dm=300,_b=N.string().trim().min(1).max(Dm),$s=N.object({primary:Fo,accent:Fo,foreground:Fo}).strict(),gb=N.object({id:$n,rank:N.number().int().min(1).max(3),name:N.string().trim().min(1).max(120),description:N.string().trim().min(1).max(240),color_seeds:$s,surface_mode:N.enum(["light","dark"]),radius:Vs,font_pairing_id:Yn,motion_preset_id:Xn,density:Qn,weight_style:qe.optional(),reason:Vn}).strict(),Om=N.object({name:N.string().trim().min(1).max(120),description:N.string().trim().min(1).max(240),reason:Vn,color_seeds:$s,surface_mode:N.enum(["light","dark"]),radius:Vs,font_pairing_id:Yn,motion_preset_id:Xn,density:Qn,weight_style:qe}).strict(),Nm=N.object({version:N.number().int().min(1),recommendation_id:N.string().uuid(),theme_preset_id:$n,color_seeds:$s,surface_mode:N.enum(["light","dark"]),font_pairing_id:Yn,motion_preset_id:Xn,density:Qn,radius:Vs.optional(),weight_style:qe.optional(),aesthetic_note:_b.optional(),updated_at:Cm}).strict(),hb=N.object({id:N.string().uuid(),version:N.number().int().min(1),catalog_version:N.string().trim().min(1).max(80),source:N.object({mode:N.enum(["ai","fallback"]),fallback_reason:N.string().trim().min(1).max(80).nullable()}).strict(),inputs:N.object({industry:N.string().trim().min(1).max(160).optional(),site_language:N.string().trim().min(2).max(35),owner_locale:Ee.optional(),strategy_version:N.number().int().min(1),input_digest:N.string().regex(/^sha256:[a-f0-9]{64}$/)}).strict(),theme:N.object({recommended_id:$n,candidate_ids:N.array($n).length(3),candidates:N.array(gb).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,i)=>s.id!==e.candidate_ids[i]||s.rank!==i+1)&&n.addIssue({code:"custom",path:["candidates"],message:"Candidates must follow candidate_ids order."})}),font:N.object({recommended_id:Yn,reason:Vn}).strict(),motion:N.object({recommended_id:Xn,reason:Vn}).strict(),density:N.object({recommended_id:Qn,reason:Vn}).strict(),conversion:Lt.optional(),generated_at:Cm}).strict(),ZO=N.object({force_refresh:N.boolean().optional()}).strict(),JO=N.object({request_id:N.string().trim().min(1).max(160),site_id:T,cached:N.boolean(),recommendation:hb,selection:Nm}).strict(),eN=N.object({recommendation_id:N.string().uuid(),expected_version:N.number().int().min(1),theme_preset_id:$n,color_seeds:$s,surface_mode:N.enum(["light","dark"]),font_pairing_id:Yn,motion_preset_id:Xn,density:Qn,radius:Vs.optional(),weight_style:qe.optional(),aesthetic_note:N.string().trim().max(Dm).optional()}).strict(),tN=N.object({selection:Nm}).strict(),Sb=4e3,nN=N.object({tenant_id:N.string().trim().min(1).max(160),site_id:T,site_language:N.string().trim().min(2).max(35),owner_locale:Ee,industry:N.string().trim().min(1).max(160).optional(),strategy_version_id:N.string().uuid(),strategy_version:N.number().int().min(1),strategy_checksum:N.string().regex(/^[a-f0-9]{64}$/),strategy_summary:N.array(N.string().trim().min(1).max(Sb)).min(1).max(De)}).strict(),Go=N.object({theme_candidates:N.array(Om).length(3),conversion:Lt.optional()}).strict().superRefine((e,n)=>{let s=new Set;e.theme_candidates.forEach((i,o)=>{let a=JSON.stringify(i.color_seeds).toUpperCase();s.has(a)&&n.addIssue({code:"custom",path:["theme_candidates",o,"color_seeds"],message:"Theme candidates must have pairwise distinct color_seeds"}),s.add(a)})});function sN(){return Mo.map(e=>Om.parse({name:e.name,description:e.description,reason:e.fallbackReason,color_seeds:e.colorSeeds,surface_mode:e.surfaceMode,radius:e.radius,font_pairing_id:fo[0],motion_preset_id:Lo[0],density:jo[1],weight_style:Ns}))}function fb(e){return e.radius??vm(e.theme_preset_id)??"lg"}function bb(e,n){return e.weight_style??n?.theme?.candidates?.find(s=>s.id===e.theme_preset_id)?.weight_style??n?.theme?.candidates?.[0]?.weight_style??Ns}function iN(e,n){let s=zc(e.font_pairing_id),i=km(e.motion_preset_id);return{colorSeeds:e.color_seeds,surfaceMode:e.surface_mode,fonts:{heading:s.heading,body:s.body},density:e.density,motionLevel:i.motionLevel,motionPreset:i.id,radius:fb(e),weightStyle:bb(e,n)}}function oN(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,weight_style:s.weight_style,updated_at:n.toISOString()}}import{z as qo}from"zod";function yb(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,e.weight_style])}var xb=qo.object(Go.shape).strict().superRefine((e,n)=>{let s=new Set;e.theme_candidates.forEach((i,o)=>{let a=yb(i);s.has(a)&&n.addIssue({code:"custom",path:["theme_candidates",o],message:"Theme candidates must have pairwise distinct visual identities"}),s.add(a)})}),mN=qo.union([Go,xb.safeExtend({model_profile:qo.literal("azure-gpt")})]);import{z as Pt}from"zod";var uN=Pt.object({site_id:T,site_language:Pt.string().trim().min(2).max(35),business_facts:Pt.array(Pt.string().trim().min(1).max(1e3)).min(1).max(8)}).strict(),Eb=Pt.enum(["high","medium","low"]),_N=Pt.object({skill_name:Pt.string().trim().min(1).max(80).nullable(),confidence:Eb,reason:Pt.string().trim().min(1).max(240)}).strict();import{z as Zn}from"zod";var jm=1e4,Rb=Zn.object({note:Zn.string().trim().max(jm),updated_at:Zn.string().min(1)}).strict(),fN=Zn.object({note:Zn.string().trim().max(jm)}).strict(),bN=M(Rb.nullable());import{z as ne}from"zod";var Wo=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],Ys=ne.object({name:ne.string().min(1).max(100),type:ne.enum(Wo),label:ne.string().min(1).max(255),required:ne.boolean().optional(),options:ne.array(ne.string()).optional()}),EN=ne.object({name:ne.string(),cms_type:ne.string(),label:ne.string().optional(),required:ne.boolean().optional(),value_shape:ne.string().optional(),front_display:ne.enum(["visible","internal","forbidden"]).optional(),choices:ne.array(ne.object({value:ne.union([ne.string(),ne.number()]),label:ne.string()})).optional()}),RN=ne.object({route_file_path:ne.string().min(1),target_component_path:ne.string().min(1),content_type_hint:ne.string().min(1),collection_purpose:ne.enum(["generic","product"]).optional(),required_fields:ne.array(Ys).optional(),mode:ne.enum(["bind_existing","provision"]),list_mode:ne.enum(["page","embedded"]).optional(),fields:ne.array(Ys).optional(),seed_records:ne.array(ne.record(ne.string(),ne.unknown())).optional()});import{z as G}from"zod";var Jn=G.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),Xs=G.string().regex(/^[a-f0-9]{64}$/),Qs=G.string().regex(/^[a-z][a-z0-9-]{0,99}$/),Zs=G.string().regex(/^[a-z0-9]{1,30}$/),He=e=>G.string().max(e).refine(n=>n.trim().length>0,"Value must not be blank"),Lm=G.object({id:G.string().uuid(),key:He(100),name:He(255)}).strict(),Um=new Set(["title","summary","description","category","thumbnail","url","admin_id"]),Ib=new Set(["title","summary","description","image_query"]),Tb=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"]),Mm=new Set(["select","multiselect"]),kb=new Set(["title","text","richtext","date","datetime","url","email","color"]),Ab=G.object({name:He(100),label:He(255),type:G.enum(Wo),required:G.boolean().optional(),options:G.array(He(100)).max(100).optional()}).strict().superRefine((e,n)=>{let s=e.options??[];Mm.has(e.type)&&s.length===0&&n.addIssue({code:"custom",path:["options"],message:"Choice fields require at least one option"}),!Mm.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"}),Um.has(e.name)&&n.addIssue({code:"custom",path:["name"],message:"Reserved CMS field names cannot be declared"})}),wb=G.array(Ab).min(1).max(200),Pb=G.array(G.record(G.string(),G.unknown())).max(1e3);function ze(e,n,s){e.addIssue({code:"custom",path:n,message:s})}var vb=G.object({name:He(30),slug:Zs,collection_purpose:G.enum(["generic","product"]).optional(),fields:wb,seed_records:Pb}).strict().superRefine((e,n)=>{let s=e.fields.map(o=>o.name);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["fields"],message:"Field names must be unique"}),s.some(o=>!Um.has(o))||n.addIssue({code:"custom",path:["fields"],message:"At least one custom field is required"});let i=new Map(e.fields.map(o=>[o.name,o]));e.seed_records.forEach((o,a)=>{for(let[c,r]of Object.entries(o)){let m=["seed_records",a,c];if(Tb.has(c)){ze(n,m,"Seed cannot write reserved or runtime-owned fields");continue}if(c==="image_query"){(typeof r!="string"||r.trim()==="")&&ze(n,m,"image_query must be a non-empty string");continue}if(Ib.has(c)){typeof r!="string"&&ze(n,m,"Seed skeleton text fields must be strings");continue}let S=i.get(c);if(!S){ze(n,m,"Seed contains an undeclared field");continue}if(r==null){ze(n,m,"Seed field values must not be null");continue}if(S.type==="select")(typeof r!="string"||!(S.options??[]).includes(r))&&ze(n,m,"Seed select value must be one of the declared options");else if(S.type==="multiselect")(!Array.isArray(r)||r.length===0||r.some(g=>typeof g!="string"||!(S.options??[]).includes(g)))&&ze(n,m,"Seed multiselect value must contain only declared options");else if(S.type==="number")(typeof r!="number"||!Number.isFinite(r))&&ze(n,m,"Seed number values must be finite numbers");else if(S.type==="boolean")typeof r!="boolean"&&ze(n,m,"Seed boolean values must be booleans");else if(S.type==="tag"){let g=Array.isArray(r)?r:[r];(g.length===0||g.some(w=>typeof w!="string"||w.trim()===""))&&ze(n,m,"Seed tag values must be non-empty strings")}else kb.has(S.type)&&typeof r!="string"&&ze(n,m,"Seed text-like values must be strings")}for(let c of e.fields)c.required&&!(c.name in o)&&ze(n,["seed_records",a,c.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"})}),Ko=G.object({schema_version:G.literal(1),application:vb}).strict(),Cb=G.object({templateId:G.string().uuid(),stableKey:Qs,resolvedVersion:Jn,digest:Xs,template:Ko}).strict(),Db=Cb,Ob={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"},Fm=G.enum(Object.values(Ob)),Gm=G.object({category_status:G.enum(["succeeded","failed","not_attempted"]),seed_status:G.enum(["skipped","succeeded","partial","failed"]),requested_count:G.number().int().nonnegative(),written_count:G.number().int().nonnegative().nullable(),published_count:G.number().int().nonnegative().nullable(),errors:G.array(G.object({stage:G.enum(["category","seed","receipt"]),code:He(100)}).strict()).max(20)}).strict(),Nb=G.object({templateId:G.string().uuid(),stableKey:Qs,title:He(200),description:G.string().max(1e3),thumbnailUrl:G.string().url().nullable(),resolvedVersion:Jn,digest:Xs,application:G.object({name:He(30),slug:Zs}).strict(),categories:G.array(Lm),tags:G.array(Lm),status:G.enum(["available","creating","created","conflict","failed"]),errorCode:Fm.nullable().optional(),template:Ko.optional()}).strict(),qm=G.object({items:G.array(Nb)}).strict(),AN=G.object({version:Jn}).strict(),jb=G.object({app_slug:Zs,name:He(30),template:G.object({stable_key:Qs,version:Jn,digest:Xs}).strict()}).strict(),Lb=G.object({status:G.literal("created"),application:jb,initialization:Gm}).strict(),wN=Lb,Mb=G.object({stable_key:Qs,version:Jn,digest:Xs,created_at:G.string().datetime().nullable(),initialization:Gm.nullable()}).strict(),Ub=G.object({app_slug:Zs,name:He(30),collection_slug:G.string().min(1),detail_prefix:G.string().min(1).optional(),source:Mb.nullable()}).strict(),PN=G.object({applications:G.array(Ub)}).strict(),vN=qm,CN=G.object({code:Fm,message:He(500)}).strict(),DN=Ko,ON=Db,NN=qm;import{z as ue}from"zod";var Wm=e=>ue.string().max(e).refine(n=>n.trim().length>0,"Value must not be blank"),Fb=Ys.strict(),Bm=ue.array(Fb).min(1).max(200),Gb=ue.array(ue.record(ue.string(),ue.unknown())).max(1e3),qb=ue.string().regex(/^[a-z0-9]{1,30}$/),Bo=ue.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),UN=ue.object({name:Wm(30),slug:Wm(50),collection_purpose:ue.enum(["generic","product"]).optional(),fields:Bm}).strict(),Km=ue.object({collection_slug:qb,detail_prefix:ue.string().min(1).max(255),plugin_id:Bo.optional()}).strict(),FN=ue.discriminatedUnion("kind",[Km.extend({kind:ue.literal("created")}),Km.extend({kind:ue.literal("exists")})]),GN=ue.object({fields:Bm,seed_records:Gb,category_id:Bo}).strict(),Wb=ue.record(ue.string().min(1),ue.string().min(1).nullable()),qN=ue.object({ids:ue.array(Bo).max(1e3),urls:Wb,failed:ue.array(ue.unknown()).max(1e3)}).strict();function WN(e){return e.replace(/[^a-zA-Z0-9]/g,"").toLowerCase().slice(0,30)}import{z as ye}from"zod";import{z as zo}from"zod";var zm=["lead-generation","trial-and-samples","quote-and-commerce","appointments-and-visits","resources-and-subscriptions","service-and-channel"],Hm="-",Kb="embedded",Ho=zo.enum([...zm,Hm]),Bb=zo.literal(Kb),Vo=zo.object({scene:Ho,shape:Bb}).strict();function zN(e){return zm.find(n=>n===e)??Hm}var Js=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number","file"],zb=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number"],Hb=ye.object({name:ye.string().min(1).max(100),type:ye.enum(zb),label:ye.string().min(1).max(255),required:ye.boolean().optional(),options:ye.array(ye.string()).optional()}),Vb=ye.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),YN=ye.object({mode:ye.enum(["bind_existing","provision"],{error:'mode is required. Use "bind_existing" or "provision". Never call connect_form with {}.'}),form_hint:ye.string().min(1).optional(),name:ye.string().min(1).max(255).optional(),scene:Ho.optional(),component_slug:Vb,description:ye.string().min(1).max(1e3).optional(),fields:ye.array(Hb).optional()}).superRefine((e,n)=>{e.mode==="provision"&&e.scene===void 0&&n.addIssue({code:"custom",path:["scene"],message:"scene is required for provision"}),e.mode==="bind_existing"&&e.scene!==void 0&&n.addIssue({code:"custom",path:["scene"],message:"scene is prohibited for bind_existing"}),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"})}),XN=ye.object({name:ye.string(),label:ye.string(),cms_type:ye.string(),required:ye.boolean()});import{z as p}from"zod";var es=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,pn=/^[A-Za-z][A-Za-z0-9_-]{0,127}$/,ei=/^[A-Za-z][A-Za-z0-9_]{0,99}$/,Xm=/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/,Yo=/^[a-z][a-z0-9-]{0,99}$/,Qm=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,Vm=2,$m=3,ti=p.string().regex(es),$b=p.string().regex(es),Xo=p.string().regex(es),ts=p.string().regex(ei),Qo=p.string().regex(Xm),Yb=p.discriminatedUnion("status",[p.object({status:p.literal("unbound"),form_code:p.null()}).strict(),p.object({status:p.literal("bound"),form_code:p.string().regex(pn)}).strict(),p.object({status:p.literal("missing"),form_code:p.string().regex(pn)}).strict()]),Xb=p.object({value:Qo,label:p.string().trim().min(1).max(255)}).strict(),Qb=p.object({kind:p.literal("field"),field_name:ts,type:p.enum(Js),label:p.string().trim().min(1).max(255),required:p.boolean(),span:p.enum(["full","half"]),options:p.array(Xb).max(100),max_files:p.number().int().min(1).max(5).optional()}).strict(),Zb=p.object({kind:p.literal("step-break"),step_id:p.string().regex(es)}).strict(),Jb=p.discriminatedUnion("kind",[Qb,Zb]),ey=p.object({field_name:ts,type:p.enum(Js),last_label:p.string().max(255)}).strict(),ty=p.object({field_name:ts,value:Qo,last_label:p.string().max(255)}).strict(),ny=p.discriminatedUnion("kind",[p.object({kind:p.literal("custom")}).strict(),p.object({kind:p.literal("template"),slug:p.string().regex(Yo),version:p.string().regex(Qm)}).strict()]),sy={select:2,radio:2,multiselect:1,DropdownSelection:2,RadioButton:2,Checkbox:1};function at(e){return e.toLowerCase()}function Zm(e,n){return e.trim().toLocaleLowerCase(n)}function ln(e,n){return`${at(e)}\0${n}`}function we(e,n,s,i){let o=new Set;for(let a of e){if(o.has(a)){i.addIssue({code:"custom",path:n,message:s});return}o.add(a)}}function Zo(e,n,s,i){let o=sy[e]??0;o>0&&n<o?i.addIssue({code:"custom",path:s,message:`choice field requires at least ${o} option${o===1?"":"s"}`}):o===0&&n>0&&i.addIssue({code:"custom",path:s,message:"non-choice fields must use an empty options array"})}var Jo=p.object({schema_version:p.literal(1),min_runtime_version:p.number().int().positive(),form_definition_id:ti,binding:Yb,content_locale:Ee,features:p.object({multistep:p.boolean()}).strict(),copy:p.object({title:p.string().max(255),description:p.string().max(1e3),submit_button:p.string().trim().min(1).max(100),success_message:p.string().trim().min(1).max(500),error_message:p.string().max(500)}).strict(),layout:p.object({columns:p.enum(["one","two"])}).strict(),nodes:p.array(Jb).min(1).max(200),source:ny,retired:p.object({fields:p.array(ey).max(1e3),options:p.array(ty).max(5e3)}).strict(),compatibility:p.object({standardization_version:p.number().int().positive(),diagnostics:p.array(p.string().trim().min(1).max(500)).max(100)}).strict()}).strict().superRefine((e,n)=>{let s=e.nodes.flatMap((r,m)=>r.kind==="field"?[[m,r]]:[]),i=s.map(([,r])=>r);i.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"at least one field node is required"});let o=e.nodes.filter(r=>r.kind==="step-break");!e.features.multistep&&o.length>0&&n.addIssue({code:"custom",path:["nodes"],message:"step-break requires the multistep feature"}),e.features.multistep&&(e.min_runtime_version<Vm&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`multistep requires runtime version ${Vm}`}),o.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"multistep requires at least one step-break"}));for(let[r,m]of e.nodes.entries())m.kind==="step-break"&&(r===0||r===e.nodes.length-1||e.nodes[r-1]?.kind==="step-break"||e.nodes[r+1]?.kind==="step-break")&&n.addIssue({code:"custom",path:["nodes",r],message:"step-break must separate two non-empty steps"});we(o.map(r=>r.step_id),["nodes"],"step_id must be unique",n),we(i.map(r=>at(r.field_name)),["nodes"],"field_name must be unique",n),we(e.retired.fields.map(r=>at(r.field_name)),["retired","fields"],"retired field_name must be unique",n);let a=new Set(e.retired.fields.map(r=>at(r.field_name)));for(let[r,m]of s)a.has(at(m.field_name))&&n.addIssue({code:"custom",path:["nodes",r,"field_name"],message:"retired field_name cannot be reused"}),Zo(m.type,m.options.length,["nodes",r,"options"],n),m.type==="file"?e.min_runtime_version<$m&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`file fields require runtime version ${$m}`}):m.max_files!==void 0&&n.addIssue({code:"custom",path:["nodes",r,"max_files"],message:"max_files is only valid for file fields"}),we(m.options.map(S=>S.value),["nodes",r,"options"],"option value must be unique within a field",n),we(m.options.map(S=>Zm(S.label,e.content_locale)),["nodes",r,"options"],"option label must be unique within a field",n);we(e.retired.options.map(r=>ln(r.field_name,r.value)),["retired","options"],"retired option identity must be unique",n);let c=new Set(e.retired.options.map(r=>ln(r.field_name,r.value)));for(let[r,m]of s)for(let[S,g]of m.options.entries())c.has(ln(m.field_name,g.value))&&n.addIssue({code:"custom",path:["nodes",r,"options",S,"value"],message:"retired option value cannot be reused"})}),iy=["copy.title","copy.description","copy.submit_button","copy.success_message","copy.error_message","nodes.*.label","nodes.*.options.*.label"],oy=new Set(iy);function ij(e){let n=e.map(s=>typeof s=="number"||/^\d+$/.test(s)?"*":s).join(".");return oy.has(n)}function oj(e,n){let s=[],i=e.nodes.filter(r=>r.kind==="field"),o=new Map(n.nodes.filter(r=>r.kind==="field").map(r=>[at(r.field_name),r])),a=new Map(n.retired.fields.map(r=>[at(r.field_name),r])),c=new Map(n.retired.options.map(r=>[ln(r.field_name,r.value),r]));for(let r of i){let m=at(r.field_name),S=o.get(m),g=a.get(m);S&&S.field_name!==r.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:r.field_name}),S&&S.type!==r.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:r.field_name}),!S&&g&&g.field_name!==r.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:r.field_name}),!S&&g&&g.type!==r.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:r.field_name}),!S&&!a.has(m)&&s.push({code:"FIELD_RETIREMENT_MISSING",field_name:r.field_name});let w=new Set(S?.options.map(K=>K.value)??[]);for(let K of r.options){let H=c.get(ln(r.field_name,K.value));!w.has(K.value)&&H&&H.field_name!==r.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:r.field_name}),!w.has(K.value)&&!H&&s.push({code:"OPTION_RETIREMENT_MISSING",field_name:r.field_name,value:K.value})}}for(let r of e.retired.fields){let m=a.get(at(r.field_name));m&&m.field_name!==r.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:r.field_name}),m&&m.type!==r.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:r.field_name}),m||s.push({code:"FIELD_RETIREMENT_MISSING",field_name:r.field_name})}for(let r of e.retired.options){let m=c.get(ln(r.field_name,r.value));m&&m.field_name!==r.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:r.field_name}),m||s.push({code:"OPTION_RETIREMENT_MISSING",field_name:r.field_name,value:r.value})}return s}var ay=p.enum(An),vt=p.object({english:p.string().max(1e3),translations:p.partialRecord(ay,p.string().max(1e3)).optional()}).strict(),ry=p.object({template_option_key:p.string().regex(Xm),label:vt}).strict(),cy=p.object({template_field_key:p.string().regex(ei),type:p.enum(Js),label:vt,required:p.boolean(),span:p.enum(["full","half"]),options:p.array(ry).max(100)}).strict(),my=p.object({template_step_key:p.string().regex(ei),after_field_key:p.string().regex(ei)}).strict(),aj=["lead-generation","trial-and-samples","quote-and-commerce","appointments-and-visits","resources-and-subscriptions","service-and-channel"],rj=[1,1,1,1,1,1],Jm=p.string().regex(Yo),ly=p.object({schema_version:p.literal(1),slug:Jm,name:vt,template_count:p.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"})}),py=p.object({schema_version:p.literal(1),slug:p.string().regex(Yo),version:p.string().regex(Qm),category:Jm,copy:p.object({title:vt,description:vt,submit_button:vt,success_message:vt,error_message:vt}).strict(),layout:p.object({columns:p.enum(["one","two"])}).strict(),fields:p.array(cy).min(1).max(200),step_breaks:p.array(my).max(20).optional()}).strict().superRefine((e,n)=>{for(let a of["title","description","submit_button","success_message","error_message"])e.copy[a].english.trim()===""&&n.addIssue({code:"custom",path:["copy",a,"english"],message:"English baseline text is required"});we(e.fields.map(a=>a.template_field_key),["fields"],"template_field_key must be unique",n);let s=new Map(e.fields.map((a,c)=>[a.template_field_key,c])),i=e.step_breaks??[];we(i.map(a=>a.template_step_key),["step_breaks"],"template_step_key must be unique",n),we(i.map(a=>a.after_field_key),["step_breaks"],"step breaks must not share an anchor field",n);let o=-1;for(let[a,c]of i.entries()){let r=s.get(c.after_field_key);r===void 0||r>=e.fields.length-1?n.addIssue({code:"custom",path:["step_breaks",a,"after_field_key"],message:"step break must follow an existing non-final field"}):r<=o&&n.addIssue({code:"custom",path:["step_breaks",a,"after_field_key"],message:"step breaks must follow field order"}),o=r??o}e.fields.length+i.length>200&&n.addIssue({code:"custom",path:["step_breaks"],message:"template fields and step breaks must not exceed 200 nodes"});for(let[a,c]of e.fields.entries()){c.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",a,"label","english"],message:"English field label is required"}),Zo(c.type,c.options.length,["fields",a,"options"],n),we(c.options.map(r=>r.template_option_key),["fields",a,"options"],"template_option_key must be unique within a field",n),we(c.options.map(r=>r.label.english.trim().toLowerCase()),["fields",a,"options"],"English option labels must be unique within a field",n);for(let[r,m]of c.options.entries())m.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",a,"options",r,"label","english"],message:"English option label is required"})}}),cj=p.object({schema_version:p.literal(1),visibility:p.enum(["internal","public"]),categories:p.array(ly).max(500),templates:p.array(py).max(500)}).strict().superRefine((e,n)=>{let s=(o,a)=>{let c=An.filter(r=>!o.translations?.[r]?.trim());c.length>0&&n.addIssue({code:"custom",path:[...a,"translations"],message:`public template copy is missing locales: ${c.join(", ")}`})};we(e.categories.map(o=>o.slug),["categories"],"template category slug must be unique",n);let i=new Set(e.categories.map(o=>o.slug));for(let[o,a]of e.categories.entries()){let c=e.templates.filter(r=>r.category===a.slug).length;a.template_count!==c&&n.addIssue({code:"custom",path:["categories",o,"template_count"],message:"template_count must match catalog templates"})}we(e.templates.map(o=>o.slug),["templates"],"template slug must be unique",n);for(let[o,a]of e.templates.entries())i.has(a.category)||n.addIssue({code:"custom",path:["templates",o,"category"],message:"template category must exist in catalog categories"});if(e.visibility==="public"){for(let[o,a]of e.categories.entries())s(a.name,["categories",o,"name"]);for(let[o,a]of e.templates.entries()){for(let[c,r]of Object.entries(a.copy))s(r,["templates",o,"copy",c]);for(let[c,r]of a.fields.entries()){s(r.label,["templates",o,"fields",c,"label"]);for(let[m,S]of r.options.entries())s(S.label,["templates",o,"fields",c,"options",m,"label"])}}}});function mj(e,n){let s=pr(n),i=s?e.translations?.[s]:void 0;return i!==void 0&&i.trim()!==""?i:e.english}var dy=["Text","Summary","Email","Phone","DropdownSelection","RadioButton","Checkbox","Boolean","Date","Num","MultipleFile","SpecificFile"],uy={text:"Text",textarea:"Summary",email:"Email",phone:"Phone",select:"DropdownSelection",radio:"RadioButton",multiselect:"Checkbox",boolean:"Boolean",date:"Date",number:"Num",file:"MultipleFile"},_y=p.object({value:Qo,label:p.string().trim().min(1).max(255)}).strict(),gy=p.object({field_name:ts,field_type:p.enum(dy),field_label:p.string().trim().min(1).max(255),is_required:p.boolean(),sort_order:p.number().int().nonnegative(),options:p.array(_y).max(100)}).strict(),el=p.object({version:p.literal(1),locale:Ee,fields:p.array(gy).min(1).max(200)}).strict().superRefine((e,n)=>{we(e.fields.map(s=>at(s.field_name)),["fields"],"field_name must be unique",n);for(let[s,i]of e.fields.entries())Zo(i.field_type,i.options.length,["fields",s,"options"],n),we(i.options.map(o=>o.value),["fields",s,"options"],"option value must be unique within a field",n),we(i.options.map(o=>Zm(o.label,e.locale)),["fields",s,"options"],"option label must be unique within a field",n)});function lj(e){let n=e.nodes.filter(s=>s.kind==="field").map((s,i)=>({field_name:s.field_name,field_type:s.type==="file"&&s.max_files===1?"SpecificFile":uy[s.type],field_label:s.label,is_required:s.required,sort_order:i,options:s.options.map(o=>({...o}))}));return el.parse({version:1,locale:e.content_locale,fields:n})}var de=p.string().regex(/^sha256:[0-9a-f]{64}$/),hy=p.union([xe,p.enum(["app/api/forms/[code]/route.ts","hooks/use-cms-form-submit.ts","lib/cms/forms.ts","lib/cms/client.ts"])]),Sy=p.object({path:hy,content_hash:de.nullable()}).strict(),fy=p.array(Sy).min(1).max(500).superRefine((e,n)=>{we(e.map(s=>s.path),[],"affected file paths must be unique",n)}),ea=p.object({grade:p.enum(["standard","A","B","C"]),required:p.boolean(),pending_confirmations:p.array(p.object({item_id:p.string().regex(es),field_name:ts.optional(),kind:p.enum(["form_copy","layout","field_label","field_type","field_required","field_options"]),message:p.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"})}),by=p.object({site_id:T,form_definition_id:ti,base_snapshot_id:k,expected_form_spec_hash:de,expected_cms_schema_hash:de.nullable(),form_metadata:Vo.nullable(),draft_form_spec_hash:de,desired_cms_schema_hash:de,affected_files_hash:de,shared_reference_hash:de,shared_reference_count:p.number().int().positive(),confirm_shared_update:p.boolean(),recreate_missing_binding:p.boolean(),standardization:ea,confirm_standardization:p.boolean()}).strict(),tl=p.object({reference_hash:de,page_count:p.number().int().positive(),block_count:p.number().int().positive()}).strict().refine(e=>e.page_count<=e.block_count,{message:"page_count cannot exceed block_count"}),pj=p.object({site_id:T,form_block_id:$b,base_snapshot_id:k,form_spec:Jo,runtime_upgrade_required:p.boolean(),expected_form_spec_hash:de,expected_cms_schema_hash:de.nullable(),affected_files_hash:de,shared_impact:tl,standardization:ea}).strict(),yy=p.object({operation_id:Xo,operation_fingerprint:de,site_id:T,form_definition_id:ti,base_snapshot_id:k,expected_form_spec_hash:de,expected_cms_schema_hash:de.nullable(),form_metadata:Vo.nullable(),draft_form_spec:Jo,draft_form_spec_hash:de,desired_cms_schema_hash:de,affected_files_hash:de,shared_impact:tl,confirm_shared_update:p.boolean(),recreate_missing_binding:p.boolean(),standardization:ea,confirm_standardization:p.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 i=e.draft_form_spec.binding.status==="bound",o=i&&e.standardization.required&&(e.standardization.grade==="B"||e.standardization.grade==="C");(i&&!o&&e.expected_cms_schema_hash===null||!i&&e.expected_cms_schema_hash!==null)&&n.addIssue({code:"custom",path:["expected_cms_schema_hash"],message:i?"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"})}),xy=["created","validated","binding_reserved","candidate_ready","cms_applied","snapshot_promoted","committed","compensating","recovery_required","failed"],ta=p.enum(xy),Ey=["pending","running","succeeded","failed","recovery_required"],nl=p.enum(Ey),Ry=["candidate_abandon","snapshot_reconcile","cms_restore"],sl=p.enum(Ry),Iy=["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"],na=p.enum(Iy),il=p.enum(["wait","resume","retry_new_operation","manual_recovery","none"]),ol=p.enum(["not_started","pending","succeeded","failed"]),al=p.object({operation_id:Xo,operation_fingerprint:de,site_id:T,form_definition_id:ti,stage:ta,status:nl,base_snapshot_id:k,candidate_snapshot_id:k.nullable(),before_form_code:p.string().regex(pn).nullable(),materialized_form_code:p.string().regex(pn).nullable(),expected_form_spec_hash:de,draft_form_spec_hash:de,materialized_form_spec_hash:de.nullable(),expected_cms_schema_hash:de.nullable(),desired_cms_schema_hash:de,retry_count:p.number().int().nonnegative(),failure_stage:sl.nullable(),last_error_code:na.nullable(),retryable:p.boolean(),next_action:il,preview_refresh_status:ol,created_at:p.string().datetime({offset:!0}),updated_at:p.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=p.object({operation:al}).strict(),dj=sa,uj=sa,_j=p.object({operation_fingerprint:de}).strict(),gj=sa,Ty=p.preprocess(e=>{if(!e||typeof e!="object"||Array.isArray(e))return e;let n="form_metadata"in e?e:{...e,form_metadata:null};return"standardization"in e||"confirm_standardization"in e?n:{...n,standardization:{grade:"standard",required:!1,pending_confirmations:[]},confirm_standardization:!1}},yy),hj=p.object({operation:al,request:Ty,cms_replace_result:p.unknown().nullable()}).strict(),ky=p.object({stage:ta.optional(),status:nl.optional(),candidate_snapshot_id:k.nullable().optional(),before_form_code:p.string().regex(pn).nullable().optional(),materialized_form_code:p.string().regex(pn).nullable().optional(),materialized_form_spec_hash:de.nullable().optional(),retry_count:p.number().int().nonnegative().optional(),failure_stage:sl.nullable().optional(),last_error_code:na.nullable().optional(),retryable:p.boolean().optional(),next_action:il.optional(),preview_refresh_status:ol.optional()}).strict(),Sj=p.object({expected_updated_at:p.string().datetime({offset:!0}),operation:ky,cms_replace_result:p.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"}),fj=p.object({code:na,message:p.string().trim().min(1).max(500),retryable:p.boolean(),operation_id:Xo.optional(),stage:ta.optional()}).strict();function Ay(e){return by.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,form_metadata:e.form_metadata,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 Ym(e){for(let n=0;n<e.length;n+=1){let s=e.charCodeAt(n);if(s>=55296&&s<=56319){let i=e.charCodeAt(n+1);if(n+1>=e.length||i<56320||i>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 $o(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 Ym(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 a=[];for(let c=0;c<e.length;c+=1){if(!(c in e))throw new TypeError("canonical JSON cannot contain sparse arrays");a.push($o(e[c],n))}return`[${a.join(",")}]`}let s=Object.getPrototypeOf(e);if(s!==Object.prototype&&s!==null)throw new TypeError("canonical JSON objects must be plain records");let i=e;return`{${Object.keys(i).sort().map(a=>(Ym(a),`${JSON.stringify(a)}:${$o(i[a],n)}`)).join(",")}}`}finally{n.delete(e)}}function ia(e){return $o(e,new Set)}async function ni(e){let n=ia(e),s=new TextEncoder().encode(n),i=globalThis.crypto?.subtle?new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",s)):(await import("@noble/hashes/sha256")).sha256(s);return`sha256:${Array.from(i,a=>a.toString(16).padStart(2,"0")).join("")}`}async function bj(e){return ni(Jo.parse(e))}async function yj(e){return ni(el.parse(e))}async function xj(e){let n=fy.parse(e).map(s=>({...s})).sort((s,i)=>s.path<i.path?-1:s.path>i.path?1:0);return ni({version:1,files:n})}async function Ej(e){return ni(Ay(e))}import{z as C}from"zod";var Tj=["page-seo","root-layout-metadata","nav-items"],kj=C.object({path:C.string(),title:C.string(),description:C.string().optional(),keywords:C.string().optional(),meta_tags_json:C.record(C.string(),C.record(C.string(),C.string())).nullish(),schema_json:C.union([C.record(C.string(),C.unknown()),C.array(C.record(C.string(),C.unknown())),C.string()]).nullish(),breadcrumbs_json:C.array(C.object({name:C.string().optional(),text:C.string().optional(),url:C.string().nullish()})).nullish()}),Aj=C.object({metadataBase:C.string().optional(),title:C.union([C.string(),C.object({default:C.string().optional(),template:C.string().optional(),absolute:C.string().optional()})]).optional(),description:C.string().optional(),keywords:C.string().optional(),openGraph:C.object({title:C.string().optional(),description:C.string().optional(),type:C.string().optional(),siteName:C.string().optional(),url:C.string().optional(),locale:C.string().optional(),images:C.array(C.union([C.string(),C.object({url:C.string(),alt:C.string().optional()})])).optional()}).optional(),twitter:C.object({card:C.string().optional(),title:C.string().optional(),description:C.string().optional(),images:C.array(C.string()).optional()}).optional(),alternates:C.object({canonical:C.string().optional()}).optional(),robots:C.union([C.string(),C.record(C.string(),C.unknown())]).optional()}),rl=()=>C.object({label:C.string(),href:C.string().optional(),targetType:C.enum(["page","anchor","external","email","phone","file","group"]).optional(),role:C.enum(["link","cta"]).optional(),openInNewTab:C.boolean().optional(),nofollow:C.boolean().optional(),description:C.string().optional(),badge:C.string().optional(),iconKey:C.string().optional()}),wj=rl().extend({children:C.array(rl()).optional()}),wy=["title","description","keywords","breadcrumbs_json.*.name","breadcrumbs_json.*.text"],Py=["path","meta_tags_json.**","schema_json.**","breadcrumbs_json.*.url"],vy=["title","title.default","title.template","title.absolute","description","keywords","openGraph.title","openGraph.description","openGraph.siteName","openGraph.images.*.alt","twitter.title","twitter.description"],Cy=["metadataBase","openGraph.type","openGraph.url","openGraph.locale","openGraph.images.*","openGraph.images.*.url","twitter.card","twitter.images.*","alternates.canonical","robots.**"],Dy=["label","description","badge"],Oy=["href","targetType","role","iconKey"],cl={"page-seo":{localizable:wy,machine:Py},"root-layout-metadata":{localizable:vy,machine:Cy},"nav-items":{localizable:Dy,machine:Oy}},ml="*",ll="**",Ny="children";function jy(e){return typeof e=="number"||/^\d+$/.test(e)?ml:e}function pl(e,n){let s=n.map(jy);return e!=="nav-items"?s:s.filter(i=>i!==ml&&i!==Ny)}function dl(e,n){let s=e.split(".");for(let i=0;i<s.length;i+=1){if(s[i]===ll)return!0;if(i>=n.length||s[i]!==n[i])return!1}return s.length===n.length}function Ly(e,n){let s=e.split(".");if(n.length>=s.length)return!1;for(let i=0;i<n.length;i+=1){if(s[i]===ll)return!0;if(s[i]!==n[i])return!1}return!0}function Pj(e,n){let s=pl(e,n);return s.length===0?!1:cl[e].localizable.some(i=>dl(i,s))}function vj(e,n){let s=pl(e,n);if(s.length===0)return!0;let{localizable:i,machine:o}=cl[e];return[...i,...o].some(a=>dl(a,s)||Ly(a,s))}var Oj=["product-search","migration-products","standard-form","form-submission-infrastructure"],My=[{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/${ht}.ts`,materializer:"migration-products"},{path:`components/site/generated/${ht}-list.tsx`,materializer:"migration-products"},{path:`components/site/generated/${ht}-list-view.tsx`,materializer:"migration-products"},{path:`components/site/generated/${ht}-detail-view.tsx`,materializer:"migration-products"},{path:`app/${ht}/[slug]/page.tsx`,materializer:"migration-products"},{path:`components/site/generated/${ht}-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"}],Uy=[{prefix:"components/site/generated/forms/form-",suffix:".tsx",materializer:"standard-form"}],Nj=[{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"},{path:"components/system/not-found-content.tsx",reason:"\u4E00\u6B21\u6027\u5199\u5165\u3001\u4E4B\u540E\u5185\u5BB9\u5F52\u7AD9\u70B9\uFF1A\u5EFA\u7AD9\u65F6\u4EC5\u5728\u6A21\u677F\u539F\u7248\u4E0A\u6309\u7AD9\u70B9\u8BED\u79CD\u5199\u4E00\u6B21 404 \u6587\u6848\uFF0C\u4E4B\u540E\u7531\u7528\u6237\u3001\u8BBE\u8BA1\u5668\u6216 Agent \u7EF4\u62A4\uFF0C\u91CD\u8DD1\u4E5F\u4E0D\u4F1A\u8986\u5199\u6539\u8FC7\u7684\u5185\u5BB9\uFF1B\u5B50\u7AD9\u987B\u968F\u6574\u7AD9\u7FFB\u8BD1\u5B83\u3002"}];function Fy(e){return e.length>0&&!e.includes("/")&&!e.includes(".")}function jj(e){return My.some(n=>n.path===e)?!0:Uy.some(n=>!e.startsWith(n.prefix)||!e.endsWith(n.suffix)?!1:Fy(e.slice(n.prefix.length,e.length-n.suffix.length)))}import{z as ft}from"zod";var Gy=["provisioning","cms_app_created","seeded","ready","failed"],Fj=ft.object({tenant_id:ft.string().min(1),site_id:T,collection_slug:ft.string().min(1),cms_collection_id:ft.string().min(1).nullable(),status:ft.enum(Gy),owned_by_vcp:ft.boolean(),run_id:V.nullable(),last_error:ft.string().nullable(),created_at:ft.string().datetime(),updated_at:ft.string().datetime()});var ul="/vibe/v1";function qy(e){let n=e?.trim().replace(/\/+$/,"");if(!n)return null;try{let s=new URL(n),i=s.pathname.replace(/\/+$/,"");return s.search="",s.hash="",s.pathname=i.endsWith(ul)?i:ul,s.href.replace(/\/+$/,"")}catch{return n}}function qj(e){let n=qy(e.publicProxyUrl),s=e.cmsSiteId?.trim(),i=e.tenantId?.trim();return n&&s&&i?{cmsProxyUrl:n,cmsProjectId:s,cmsTenantId:i}:null}function Kj(e){let n=e.tenant_id?.trim(),s=e.cms_site_id?.trim();if(!n||!s)throw new Error("CMS_REQUEST_CONTEXT_MISSING");return{Accept:"application/json","X-Tenant-Id":n,"X-Site-Id":s}}import{z as _}from"zod";var si=_.string().url().refine(rx,{message:"URL must use http or https"}),_l=_.string().trim().pipe(si),Wy=_.object({task_type:_.literal("home_url"),task_url:_l,planned_num:_.number().int().min(1).max(20).optional()}).strict(),Ky=_.object({task_type:_.literal("url_list"),urls:_.array(si).min(1).max(1e4)}).strict(),Vj=_.discriminatedUnion("task_type",[Wy,Ky]),$j=_.object({page:_.coerce.number().int().positive().default(1),page_size:_.coerce.number().int().min(1).max(20).default(20)}).strict(),Yj=_.object({home_url:_l}).strict(),zt=_.string().uuid(),dn=_.string().uuid(),Xj=_.object({task_uuid:zt}).strict(),gl=_.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]),By=_.object({task_uuid:zt,status:_.literal("NOT_STARTED"),total:_.literal(0)}).strict(),zy=_.object({task_uuid:zt,status:_.literal("PROCESSING"),total:_.literal(0)}).strict(),Qj=_.enum(["no_suitable_page_candidate","page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"]),Hy=_.discriminatedUnion("status",[_.object({role:It,status:_.literal("selected"),reason_code:_.null()}).strict(),_.object({role:It,status:_.literal("not_found"),reason_code:_.literal("no_suitable_page_candidate")}).strict(),_.object({role:It,status:_.literal("unknown"),reason_code:_.enum(["page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"])}).strict()]),hl=_.array(Hy).length(7).superRefine((e,n)=>{let s=new Set(e.map(i=>i.role));s.size!==e.length&&n.addIssue({code:"custom",message:"discovery coverage roles must be unique"});for(let i of It.options)s.has(i)||n.addIssue({code:"custom",message:`discovery coverage is missing role ${i}`})}),Vy=_.object({task_uuid:zt,status:_.literal("SUCCEEDED"),total:_.number().int().positive(),discovery_coverage:hl.optional()}).strict(),$y=_.enum(["TASK_FAILED","PROVIDER_CAPABILITY_LIMIT","WEBSITE_UNREACHABLE"]),Yy=_.object({task_uuid:zt,status:_.literal("FAILED"),total:_.literal(0),error_code:$y,error_message:_.string().min(1),failure_stage:gl}).strict(),Zj=_.discriminatedUnion("status",[By,zy,Vy,Yy]),Xy=_.object({url:si,raw_html:_.string().min(1)}).strict(),Jj=_.object({task_uuid:zt,status:_.literal("SUCCEEDED"),page:_.number().int().positive(),page_size:_.number().int().min(1).max(20),total:_.number().int().positive(),total_pages:_.number().int().positive(),pages:_.array(Xy).max(20),discovery_coverage:hl.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"})}),eL=_.object({task_code:dn}).strict(),Qy=_.object({task_code:dn,status:_.literal("NOT_STARTED")}).strict(),Zy=_.object({task_code:dn,status:_.literal("PROCESSING")}).strict(),Jy=_.object({task_code:dn,status:_.literal("SUCCEEDED"),urls:_.array(si)}).strict(),ex=_.literal("SITEMAP_DISCOVERY_FAILED"),tx=_.object({task_code:dn,status:_.literal("FAILED"),error_code:ex,error_message:_.string().min(1)}).strict(),tL=_.discriminatedUnion("status",[Qy,Zy,Jy,tx]),nL=_.object({company_name:_.string().regex(/\S/u)}).strict(),nx=_.object({company_name:_.string(),brand_name:_.string(),main_products:_.array(_.string()),industry:_.array(_.string()),subfields:_.array(_.string()),business_intro:_.string(),registered_capital:_.string(),legal_representative:_.string(),target_markets:_.array(_.string()),target_customer_industries:_.array(_.string()),target_customer_roles:_.array(_.string()),purchase_scenarios:_.string(),differentiators:_.array(_.string()),competitors:_.array(_.object({name:_.string(),official_url:_.string()}).strict()).max(3),qualifications:_.array(_.string()),representative_cases:_.array(_.string()),acquisition_channels:_.array(_.string()),desired_domain:_.string(),brand_tone:_.string(),timezone:_.string()}).strict(),ii=_.object({company_uuid:_.string().uuid(),company_info:nx,created_at:_.string().datetime(),updated_at:_.string().datetime()}),sx=ii.extend({status:_.literal("NOT_STARTED"),last_error_code:_.null(),last_error_message:_.null(),started_at:_.null(),completed_at:_.null()}).strict(),ix=ii.extend({status:_.literal("PROCESSING"),last_error_code:_.null(),last_error_message:_.null(),started_at:_.string().datetime(),completed_at:_.null()}).strict(),Sl=ii.extend({status:_.literal("SUCCEEDED"),last_error_code:_.null(),last_error_message:_.null(),started_at:_.string().datetime(),completed_at:_.string().datetime()}).strict(),fl=ii.extend({status:_.literal("FAILED"),last_error_code:_.string().min(1),last_error_message:_.string().min(1),started_at:_.string().datetime(),completed_at:_.string().datetime()}).strict(),sL=_.discriminatedUnion("status",[Sl,fl]),iL=_.discriminatedUnion("status",[sx,ix,Sl,fl]),ox=["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"],ax=_.enum(ox),oL=_.object({error_code:ax,error_message:_.string().min(1),failure_stage:gl.optional(),task_uuid:zt.optional(),task_code:dn.optional()}).strict();function rx(e){try{let n=new URL(e).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as W}from"zod";var Ve=W.string().url().refine(lx,{message:"URL must use http or https"}),bl=W.string().min(1).max(512),oi=W.string().datetime({offset:!0}),yl=W.enum(["scraping","completed","failed","expired"]),cL=W.object({url:Ve,ignore_cache:W.boolean(),sitemap:W.enum(["include","skip"]),include_subdomains:W.boolean(),ignore_query_parameters:W.boolean(),limit:W.number().int().min(1).max(1e5)}).strict(),mL=W.object({links:W.array(Ve).max(1e5)}).strict(),lL=W.object({url:Ve,limit:W.number().int().min(1).max(1e5),max_discovery_depth:W.literal(1),crawl_entire_domain:W.literal(!1),allow_subdomains:W.literal(!0),sitemap:W.literal("skip")}).strict(),pL=W.object({crawl_id:bl,expires_at:oi.optional()}).strict(),dL=W.object({status:yl,urls:W.array(Ve).max(1e5),next:Ve.optional(),expires_at:oi}).strict(),uL=W.object({url:Ve,formats:W.tuple([W.literal("rawHtml")]),only_main_content:W.literal(!1),max_age:W.number().int().nonnegative()}).strict(),_L=W.object({url:Ve,raw_html:W.string().min(1),status_code:W.number().int().min(100).max(599).nullable()}).strict(),gL=W.object({urls:W.array(Ve).min(1).max(1e4),formats:W.tuple([W.literal("rawHtml")]),ignore_invalid_urls:W.literal(!1),max_age:W.number().int().nonnegative(),max_concurrency:W.number().int().positive().optional()}).strict(),hL=W.object({batch_id:bl,expires_at:oi.optional()}).strict(),cx=W.object({url:Ve,raw_html:W.string().min(1)}).strict(),SL=W.object({status:yl,total:W.number().int().nonnegative(),completed:W.number().int().nonnegative(),pages:W.array(cx).max(1e4),next:Ve.optional(),expires_at:oi}).strict().superRefine((e,n)=>{e.completed>e.total&&n.addIssue({code:"custom",path:["completed"],message:"completed must not exceed total"})}),mx=W.object({url:Ve,error_message:W.string().min(1)}).strict(),fL=W.object({errors:W.array(mx).max(1e4),robots_blocked:W.array(Ve).max(1e4)}).strict(),bL=W.object({active:W.number().int().nonnegative(),waiting:W.number().int().nonnegative(),max_concurrency:W.number().int().positive()}).strict();function lx(e){try{let n=new URL(e).protocol;return n==="http:"||n==="https:"}catch{return!1}}var xl=["write_file","edit_file","delete_file"],El="apply_patch_batch",px=["set_breadcrumb_placement"],dx=[...xl,El,...px];function ux(e){return xl.includes(e)}function xL(e){return dx.includes(e)}function EL(e){return ux(e)||e===El}import{z as y}from"zod";var Rl=y.lazy(()=>un),_x=y.enum(["page","block"]),ri=y.enum(["component","page","pages"]),gx=y.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),Ht=gx,Il=y.object({requested_locale:Ht,resolved_locale:Ht,fallback_used:y.boolean()}).strict(),ns=y.object({id:y.string().uuid(),key:y.string().min(1),name:y.string().min(1)}).strict(),ai=ns.extend({color:y.string().nullable()}).strict(),AL=y.object({kind:_x,category_id:y.string().uuid().optional(),tag_id:y.string().uuid().optional(),search:y.string().trim().min(1).max(200).optional(),limit:y.coerce.number().int().min(1).max(50).default(20),cursor:y.string().min(1).optional()}).strict(),hx=y.object({stable_key:y.string().min(1),type:ri,title:y.string().min(1).max(200),description:y.string().max(1e3),thumbnail_url:y.string().url().nullable(),resolved_version:y.number().int().positive(),content_schema_version:y.literal(3),category:ns.nullable(),tags:y.array(ai),page_count:y.number().int().nonnegative(),component_count:y.number().int().nonnegative(),locale:Il}).strict(),wL=y.object({items:y.array(hx),facets:y.object({categories:y.array(ns),tags:y.array(ai)}).strict(),next_cursor:y.string().nullable()}).strict(),PL=y.object({operation_id:y.string().uuidv7(),resolved_version:y.number().int().positive(),base_sitemap_id:y.string().uuid(),base_sitemap_version:y.number().int().positive(),sitemap:Rl,target_page_id:y.string().min(1).optional()}).strict(),vL=y.object({next_sitemap:Rl,applied:y.object({stable_key:y.string().min(1),resolved_version:y.number().int().positive(),template_type:ri,page_ids:y.array(y.string().min(1)),block_ids:y.array(y.string().min(1))}).strict(),locale:Il,warnings:y.array(y.string())}).strict(),Tl=y.object({nodeId:y.string().uuid(),type:y.string().trim().min(1).max(100),label:y.string().trim().min(1).max(200),variant:y.string().trim().min(1).max(100).optional(),order:y.number().int().nonnegative(),props:y.record(y.string(),y.unknown()),thumbnail:y.string().url().optional(),source:y.unknown().optional()}).strict(),kl=y.object({nodeId:y.string().uuid().optional(),slug:y.string().regex(/^\/$|^\/[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*$/u),navigation:y.object({showInHeader:y.boolean(),showInFooter:y.boolean(),order:y.number().int().nonnegative()}).strict(),components:y.array(Tl).min(1).max(100),thumbnail:y.string().url().optional(),source:y.unknown().optional()}).strict(),Sx=kl.extend({nodeId:y.uuidv7(),parentNodeId:y.uuidv7().optional()}).strict(),fx=y.object({pages:y.array(Sx).min(1).max(50),thumbnail:y.string().url().optional(),source:y.unknown().optional()}).strict().superRefine(({pages:e},n)=>{let s=new Map(e.map(o=>[o.nodeId,o])),i=e.flatMap(o=>[o.nodeId,...o.components.map(a=>a.nodeId)]);new Set(i).size!==i.length&&n.addIssue({code:"custom",path:["pages"],message:"Node ids must be unique within the shared structure."}),new Set(e.map(o=>o.slug)).size!==e.length&&n.addIssue({code:"custom",path:["pages"],message:"Page slugs must be unique."});for(let[o,a]of e.entries()){if(a.parentNodeId===void 0)continue;let c=g=>n.addIssue({code:"custom",path:["pages",o,"parentNodeId"],message:g}),r=s.get(a.parentNodeId);r||c("Parent must reference a page in this template."),a.parentNodeId===a.nodeId&&c("A page cannot be its own parent."),(a.slug==="/"||r?.slug==="/")&&c("The home page cannot be a parent or child."),r?.parentNodeId!==void 0&&c("Pages allow at most two levels; the parent must be a root page.");let m=new Set([a.nodeId]),S=a.parentNodeId;for(;S!==void 0;){if(m.has(S)){c("Page parent references must not contain a cycle.");break}m.add(S),S=s.get(S)?.parentNodeId}}}),bx=y.union([Tl,kl,fx]),yx=y.object({title:y.string().min(1).max(200),description:y.string().min(1).max(1e3),prompt:y.string().min(1).max(8192)}).strict(),xx=y.object({locale:Ht,title:y.string().min(1).max(200),content:y.object({description:y.string().min(1).max(1e3),prompt:y.string().min(1).max(8192),nodes:y.record(y.string().uuid(),yx)}).strict()}).strict(),CL=y.object({templateId:y.string().uuid(),stableKey:y.string().min(1),type:ri,resolvedVersion:y.number().int().positive(),contentSchemaVersion:y.literal(3),structure:bx,requestedLocale:Ht,resolvedLocale:Ht,fallbackUsed:y.boolean(),contents:y.array(xx).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=Ex(e.structure),i=new Set(Object.keys(e.contents[0]?.content.nodes??{}));(s.size!==i.size||[...s].some(o=>!i.has(o)))&&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."})}),DL=y.object({items:y.array(y.object({stableKey:y.string().min(1),type:ri,title:y.string().min(1).max(200),description:y.string().max(1e3),thumbnailUrl:y.string().url().nullable(),resolvedVersion:y.number().int().positive(),contentSchemaVersion:y.literal(3),category:ns.nullable(),tags:y.array(ai),pageCount:y.number().int().nonnegative(),componentCount:y.number().int().nonnegative(),requestedLocale:Ht,resolvedLocale:Ht,fallbackUsed:y.boolean()}).strict()),facets:y.object({categories:y.array(ns),tags:y.array(ai)}).strict(),nextCursor:y.string().nullable()}).strict().superRefine((e,n)=>{e.items.forEach((s,i)=>{s.fallbackUsed!==(s.requestedLocale!==s.resolvedLocale)&&n.addIssue({code:"custom",path:["items",i,"fallbackUsed"],message:"fallbackUsed must match locale resolution."})})});function Ex(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(i=>i.nodeId)]))}function OL(e){return ia({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}from"zod";var Rx=["pending_dns","active","failed","removing"],Ix=z.enum(Rx),Tx=["serve_site","redirect_301"],kx=z.enum(Tx),Ax=["traffic","ownership","certificate_delegation"],oa=z.enum(Ax),wx=["pending","verified"],Px=z.enum(wx),vx=["not_applicable","unavailable","not_needed","auto_applied","confirmation_required","blocked"],Cx=z.enum(vx),aa=z.enum(["prepare_configuration","apply_configuration","verify_dns","remediate_dns","confirm_dns_remediation"]),Dx=z.enum(["accepted","running","succeeded","failed"]),Ox=z.object({code:z.string().min(1),message:z.string().min(1)}).strict(),Nx=z.object({purpose:oa,verified:z.boolean(),observedValues:z.array(z.string())}).strict(),Al=z.object({ready:z.boolean(),providerReady:z.boolean(),dnsVerified:z.boolean(),records:z.array(Nx)}).strict(),wl=z.object({type:z.string().min(1),name:z.string().min(1),value:z.string().min(1),ttl:z.number().nullable()}).strict(),jx=z.object({purpose:oa,action:z.enum(["none","create","update","blocked"]),before:wl.nullable(),after:wl.nullable()}).strict(),Pl=z.object({domainId:z.string().min(1),status:Cx,changes:z.array(jx)}).strict(),Lx=z.object({purpose:oa,type:z.string().min(1),name:z.string().min(1),value:z.string().min(1),verificationStatus:Px}).strict(),vl=z.object({id:z.string().min(1),hostname:z.string().min(1),isPrimary:z.boolean(),routingMode:kx,observedStatus:Ix,lastVerifiedAt:z.string().datetime().nullable(),dnsRecords:z.array(Lx)}).strict().superRefine((e,n)=>{Mx(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"})}),Cl=z.object({primaryDomain:vl.nullable(),redirectDomains:z.array(vl)}).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[i,o]of e.redirectDomains.entries())(o.isPrimary||o.routingMode!=="redirect_301")&&n.addIssue({code:"custom",path:["redirectDomains",i],message:"redirectDomains must be non-primary 301 redirects"});e.primaryDomain!==null&&e.redirectDomains.some(o=>o.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(i=>i.hostname)];new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["redirectDomains"],message:"domain hostnames must be unique"})}),ci=z.object({id:z.string().min(1),type:aa,status:Dx,error:Ox.nullable(),result:z.union([Al,Pl]).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"){Al.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"){Pl.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 Mx(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 je}from"zod";import{z as x}from"zod";var Ux=x.enum(["active","completed","canceled"]),Fx=x.enum(["quality","domain","gsc","publish"]),mi=x.enum(["pending","running","succeeded","failed"]),Ol=mi,Nl=x.enum(["pending","running","completed"]),Gx=x.object({group_code:x.string().min(1),name:x.string().min(1),score:x.number().nonnegative(),total_score:x.number().nonnegative(),pass_score:x.number().nonnegative(),running_status:Nl,result_text:x.string()}).strict(),qx=x.object({id:x.number().int().positive().optional(),quality_task_id:x.number().int().positive(),item_code:x.string().min(1),status:mi,is_repaired:x.boolean(),total_score:x.number().nonnegative(),score:x.number().nonnegative(),check_result:x.unknown().nullable(),remediation_items:x.unknown().nullable(),result_text:x.string(),created_at:x.string().min(1),updated_at:x.string().min(1),item_name:x.string().min(1),dimension_code:x.enum(["reach","trust","convert","safe"]),group_code:x.string().min(1),auto_fix:x.boolean()}).strict(),Wx=x.object({dimension_code:x.enum(["reach","trust","convert","safe"]),name:x.string().min(1),alias_en:x.string().min(1),description:x.string(),tips:x.string(),score:x.number().nonnegative(),repaired_score:x.number().nonnegative(),total_score:x.number().nonnegative(),pass_score:x.number().nonnegative(),running_status:Nl,problem_group_count:x.number().int().nonnegative(),remediation_items:x.array(qx),groups:x.array(Gx)}).strict(),Kx=x.object({id:x.number().int().positive(),task_code:x.string().uuid(),scene_code:x.enum(["site_publish","vcp_published_pages","content_publish"]),tenant_id:x.string().min(1),vcp_site_id:T,cms_site_id:x.string().min(1),checked_url:x.string().url(),quality_params:x.record(x.string(),x.unknown()).nullable(),status:mi,error_info:x.record(x.string(),x.unknown()).nullable(),created_at:x.string().min(1),updated_at:x.string().min(1)}).strict(),Bx=x.union([x.object({}).strict(),x.object({summary:x.object({final_score:x.number().nonnegative(),pass_score:x.number().nonnegative(),group_count:x.number().int().nonnegative(),problem_group_count:x.number().int().nonnegative()}).strict(),dimensions:x.array(Wx)}).strict()]),Dl=x.object({quality_info:Kx,quality_detail:Bx}).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"]})}),WL=x.object({item_code:x.string().min(1),remediation_items:x.unknown().nullable()}).strict(),zx=x.object({item_code:x.string().min(1),repair_status:x.enum(["succeeded","failed"]),message:x.string().min(1).optional(),error_code:x.string().min(1).optional(),metadata:x.record(x.string(),x.unknown()).optional()}).strict(),jl=x.object({items:x.array(zx)}).strict(),KL=x.object({task_code:x.string().min(1),status:Ol,result:jl.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"})}),Ct=x.object({id:rs,tenant_id:x.string().min(1),site_id:T,status:Ux,current_step:Fx,quality_task_code:x.string().uuid().nullable(),quality_task_status:mi,repair_task_code:x.string().min(1).nullable(),repair_task_status:Ol,publish_deployment_id:ct.nullable(),domain_hostname:x.string().min(1).nullable(),domain_operation_type:aa.nullable(),domain_operation_payload:x.record(x.string(),x.unknown()).nullable(),domain_preparation_operation_id:x.string().min(1).nullable(),domain_operation_id:x.string().min(1).nullable(),revision:x.number().int().positive(),created_at:x.string().min(1),updated_at:x.string().min(1),completed_at:x.string().min(1).nullable(),canceled_at:x.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"})}),BL=x.object({}).strict(),zL=x.object({expected_revision:x.number().int().nonnegative(),current_step:x.enum(["domain","gsc","publish"]),skip_domain_binding:x.boolean().optional()}).strict(),HL=x.object({expected_revision:x.number().int().nonnegative()}).strict(),Hx=x.object({workflow:Ct.nullable(),can_cancel:x.boolean()}).strict(),VL=M(Hx).strict(),Vx=x.object({workflow:Ct,can_cancel:x.boolean()}).strict(),$L=M(Vx).strict(),$x=x.object({workflow:Ct,deployment:x.lazy(()=>Dt)}).strict(),YL=M($x).strict(),Yx=x.object({workflow:Ct,can_cancel:x.boolean(),quality_result:Dl.optional(),repair_result:jl.optional(),final_quality_result:Dl.optional(),message:x.string().min(1).optional()}).strict(),XL=M(Yx).strict();function Xx(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 Qx(e,n){let s=e.map(a=>a.item_code),i=n.items.map(a=>a.item_code);if(new Set(s).size!==s.length||new Set(i).size!==i.length||s.length!==i.length)return!1;let o=new Set(s);return n.items.every(a=>o.has(a.item_code)&&a.repair_status==="succeeded")}function QL(e,n){if(!("summary"in e.quality_detail))return null;let s=Xx(e);if(s.length===0)return e;if(n===void 0||!Qx(s,n))return null;let i=new Set(n.items.map(a=>a.item_code)),o=e.quality_detail.dimensions.map(a=>{let c=a.remediation_items.map(S=>i.has(S.item_code)?{...S,score:S.total_score,is_repaired:!0,result_text:""}:{...S}),r=a.groups.map(S=>{let g=c.filter(w=>w.group_code===S.group_code);return g.length===0?{...S}:{...S,score:g.reduce((w,K)=>w+K.score,0),result_text:g.map(w=>w.result_text).filter(Boolean).join("\u3001")}}),m=r.reduce((S,g)=>S+g.score,0);return{...a,score:m,repaired_score:m,problem_group_count:r.filter(S=>S.score!==S.total_score).length,remediation_items:c,groups:r}});return{quality_info:{...e.quality_info},quality_detail:{...e.quality_detail,summary:{...e.quality_detail.summary,final_score:Math.round(o.reduce((a,c)=>a+c.score,0)/o.length),problem_group_count:o.reduce((a,c)=>a+c.problem_group_count,0)},dimensions:o}}}var Zx=je.object({hostname:je.string().min(1),expected_revision:je.number().int().nonnegative()}).strict(),Ll=je.object({workflow:Ct,operation:ci}).strict(),Jx=M(Ll).strict(),eE=je.object({expected_revision:je.number().int().nonnegative()}).strict(),tE=je.object({workflow:Ct,operation:ci}).strict(),nE=M(tE).strict(),ra=je.object({workflow:Ct,operation:ci.nullable()}).strict(),sE=M(ra).strict(),iE=ra,oE=M(iE).strict(),sM=M(Cl).strict(),aE=je.object({published:je.boolean(),hostname:je.string(),url:je.string(),sandbox_url:je.union([je.string().url(),je.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"}))}),iM=M(aE).strict(),oM=Zx,aM=Ll,rM=Jx,cM=ra,mM=sE,lM=oE,pM=eE,dM=nE;import{z as We}from"zod";var rE=["started","success","failed","canceled"],ca=We.enum(rE),cE=["inactive","pending_binding","active"],ma=We.enum(cE),mE=["domain","url_prefix"],la=We.enum(mE),lE=["not_connected","authorizing","matching_property","ready","failed","canceled","domain_mismatch"],pa=We.enum(lE),rt=We.string().nullable(),Ml=We.object({}).strict(),da=We.object({authorize_url:We.string().url(),custom_domain:rt}).strict(),Ul=M(da),pE=We.object({auth_status:ca,binding_status:ma,credential_connected:We.boolean(),custom_domain:rt,gsc_site_url:rt,property_type:la.nullable(),auth_error_code:rt,auth_error_message:rt}).strict(),Fl=We.object({auth_status:ca,binding_status:ma,credential_connected:We.boolean(),custom_domain:rt,gsc_site_url:rt,property_type:la.nullable(),auth_error_code:rt,auth_error_message:rt,current_domain:rt,state:pa,ready:We.boolean()}).strict().superRefine((e,n)=>{let s=uE(e,e.current_domain),i=s==="ready";e.state!==s&&n.addIssue({code:"custom",path:["state"],message:`state must equal ${s} for the supplied GSC facts`}),e.ready!==i&&n.addIssue({code:"custom",path:["ready"],message:`ready must equal ${String(i)} for the supplied GSC facts`})}),dE=M(Fl);function ss(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 uE(e,n){let s=e.gsc_site_url?.trim()??"",i=ss(e.custom_domain),o=ss(n??("current_domain"in e?e.current_domain:void 0)),a=i.length>0&&o.length>0&&i===o,c=_E(s,e.property_type,o);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":!a||!c?"domain_mismatch":e.binding_status==="pending_binding"?"matching_property":e.auth_status==="success"&&e.binding_status==="active"&&e.credential_connected&&s.length>0&&a&&c?"ready":"failed"}function _E(e,n,s){let i=e?.trim()??"",o=ss(s);if(!i||!o||!n)return!1;if(n==="domain"){let a=/^sc-domain:(.+)$/i.exec(i);if(!a)return!1;let c=a[1].trim();if(!c||/[/:?#]/.test(c))return!1;let r=ss(c);return r?o===r||o.endsWith(`.${r}`):!1}try{let a=new URL(i);return a.protocol!=="https:"||a.username||a.password||a.port||a.pathname!=="/"||a.search||a.hash?!1:ss(a.hostname)===o}catch{return!1}}var hM=Ml,SM=da,fM=Ul,bM=pa,yM=ca,xM=ma,EM=la,RM=pa,IM=Ml,TM=da,kM=Ul,AM=pE,wM=Fl,PM=dE;import{z as O}from"zod";var Ke=O.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),Je=O.string().min(1).max(4096),_n=O.string().regex(/^[A-Za-z0-9_-]{43}$/),gn=O.string().max(300),ua=O.string().datetime({offset:!0}).nullable(),Gl=O.string().regex(/^[A-Z][A-Z0-9_]*$/).max(100).nullable(),gE=["authorized","pending","failed","revoked","expired","not_authorized"],hE=O.enum(gE),SE=["pending","succeeded","failed","canceled","expired","superseded"],fE=O.enum(SE),bE=["unconfigured","configured","needs_reconfiguration","unverified"],yE=O.enum(bE),xE=["not_checked","valid","invalid","unavailable"],EE=O.enum(xE),RE=["authorization_pending","authorization_required","authorization_changed","resource_unavailable","resource_changed","verification_required","verification_unavailable"],IE=O.enum(RE),ql=O.object({revision:Ke,status:fE,started_at:O.string().datetime({offset:!0}),expires_at:O.string().datetime({offset:!0}),finished_at:ua,error_code:Gl}).strict(),OM=O.object({expected_authorization_revision:Ke,expected_attempt_revision:Ke,select_account:O.boolean().default(!1),replace_pending:O.boolean().default(!1)}).strict(),TE=O.object({authorize_url:O.string().url(),authorization_revision:Ke,attempt:ql}).strict(),NM=M(TE),kE=O.object({status:hE,authorization_revision:Ke,account_email:O.string().max(320).nullable(),latest_attempt:ql.nullable()}).strict(),AE=O.object({account_ref:Je,account_key:_n,account_display_name:gn,property_ref:Je,property_key:_n,property_display_name:gn,data_stream_ref:Je,data_stream_key:_n,data_stream_display_name:gn,measurement_id_display:O.string().min(1).max(40),default_uri:O.string().url().nullable(),selected_authorization_revision:Ke,configured_at:O.string().datetime({offset:!0}),updated_at:O.string().datetime({offset:!0})}).strict(),wE=O.object({status:EE,checked_at:ua,expires_at:ua,error_code:Gl}).strict(),PE=O.enum(["oauth","verification"]),vE=O.object({measurement_id_display:O.string().min(1).max(40),stream_display_name:O.string().max(100).nullable()}).strict(),CE=O.object({status:O.enum(["pending","applied"]),applied_revision:Ke}).strict(),Wl=O.object({capability_enabled:O.boolean(),revision:Ke,authorization:kE,binding_status:yE,reason:IE.nullable(),ready:O.boolean(),mode:PE.nullable(),binding:AE.nullable(),verification:wE,tracking:vE.nullable(),deployment:CE}).strict().superRefine((e,n)=>{if(!e.capability_enabled){(e.ready||e.revision!==0||e.authorization.status!=="not_authorized"||e.authorization.authorization_revision!==0||e.authorization.account_email!==null||e.authorization.latest_attempt!==null||e.binding_status!=="unconfigured"||e.reason!==null||e.mode!==null||e.binding!==null||e.tracking!==null||e.deployment.status!=="applied"||e.deployment.applied_revision!==0||e.verification.status!=="not_checked"||e.verification.checked_at!==null||e.verification.expires_at!==null||e.verification.error_code!==null)&&n.addIssue({code:O.ZodIssueCode.custom,message:"disabled GA4 capability must expose an empty state"});return}e.ready&&(e.authorization.status!=="authorized"||e.binding_status!=="configured"||e.mode!=="oauth"||e.binding===null||e.tracking===null||e.verification.status!=="valid"||e.reason!==null)&&n.addIssue({code:O.ZodIssueCode.custom,message:"ready GA4 status must be authorized, configured, and valid"})}),jM=M(Wl),LM=O.object({refresh:O.union([O.boolean(),O.enum(["true","false"]).transform(e=>e==="true")]).default(!1)}).strict(),DE=O.object({property_ref:Je,property_key:_n,display_name:gn}).strict(),OE=O.object({account_ref:Je,account_key:_n,display_name:gn,properties:O.array(DE)}).strict(),NE=O.object({accounts:O.array(OE),returned_count:O.number().int().nonnegative(),completeness:O.literal("unknown"),authorization_revision:Ke}).strict(),MM=M(NE),UM=O.object({authorization_revision:O.coerce.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER)}).strict(),jE=O.object({data_stream_ref:Je,data_stream_key:_n,display_name:gn,measurement_id_display:O.string().min(1).max(40),default_uri:O.string().url().nullable(),selectable:O.boolean(),unavailable_reason:O.string().max(100).nullable()}).strict(),LE=O.object({property_ref:Je,streams:O.array(jE),returned_count:O.number().int().nonnegative(),completeness:O.literal("unknown"),authorization_revision:Ke}).strict(),FM=M(LE),GM=O.object({property_ref:Je,authorization_revision:O.coerce.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER)}).strict(),qM=O.object({expected_revision:Ke,authorization_revision:Ke,account_ref:Je,property_ref:Je,data_stream_ref:Je,confirm_url_mismatch:O.boolean()}).strict(),ME=O.object({applied_revision:Ke,idempotency_replayed:O.boolean()}).strict(),UE=Wl.and(O.object({mutation:ME}).strict()),WM=M(UE);var Kl=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,Bl="VCP_E2B_PREVIEW_PROXY_DOMAIN must be a valid hostname.";function FE(e){let n=e?.trim().toLowerCase()??"";if(!n)return null;if(n.length>253||!n.includes(".")||!n.split(".").every(s=>Kl.test(s)))throw new Error(Bl);return n}function BM(e){let n=FE(e.proxyDomain);if(!n)return null;let s=e.sandboxId.trim();if(!Kl.test(s))throw new Error("sandboxId must be a valid DNS label.");if(`${s}.${n}`.length>253)throw new Error(Bl);return`https://${s}.${n}/`}function HM(e){for(let n of e.targets)if(!(n.kind==="shared"?e.ledger.shared.some(i=>i.kind==="shared"&&i.target_id===n.target_id&&i.filled!==!0):e.ledger.pages.some(i=>i.omissions.some(o=>o.kind===n.kind&&o.target_id===n.target_id&&o.filled!==!0))))return{ok:!1,target_id:n.target_id};return{ok:!0}}function GE(e,n,s=e){let i=new Map(e.map(r=>[r.slug,r])),o=new Map(s.map(r=>[r.id,r])),a=new Map(e.map(r=>{let m=o.get(r.id);return m&&m.slug!==null&&m.slug!==r.slug?[m.slug,r]:null}).filter(r=>r!==null)),c=new Set(s.map(r=>r.slug).filter(r=>r!==null&&!i.has(r)));return{primaryLinks:zl(n.primaryLinks,e,i,a,c,o,"showInHeader"),footerLinks:zl(n.footerLinks,e,i,a,c,o,"showInFooter")}}function zl(e,n,s,i,o,a,c){let r=new Set,m=[];for(let[K,H]of e.entries()){let ie=qE(H.href),Se=ie===null?void 0:s.get(ie)??i.get(ie);if(ie!==null&&o.has(ie)&&!s.has(ie)&&!i.has(ie))continue;if(Se?.slug==="/"){m.push({kind:"independent",link:{...H,label:Hl(H,Se,a)}});continue}if(!Se){m.push({kind:"independent",link:H});continue}if(!Se.navigation[c])continue;r.add(Se.slug);let yn=ie===Se.slug?H.href:WE(H.href,Se.slug);m.push({kind:"page",page:Se,link:{...H,label:Hl(H,Se,a),href:yn},index:K})}let S=m.filter(K=>K.kind==="page").sort((K,H)=>K.page.navigation.order-H.page.navigation.order||K.index-H.index),g=0,w=m.map(K=>K.kind==="page"?S[g++].link:K.link);for(let K of[...n].filter(H=>H.slug!=="/"&&H.navigation[c]).sort((H,ie)=>H.navigation.order-ie.navigation.order))r.has(K.slug)||w.push({label:K.title,href:K.slug});return w}function Hl(e,n,s){let i=s.get(n.id);return e.label===(i?.title??n.title)?n.title:e.label}function qE(e){if(!e.startsWith("/")||e.startsWith("//"))return null;let n=e.search(/[?#]/u);return n===-1?e:e.slice(0,n)}function WE(e,n){let s=e.search(/[?#]/u);return s===-1?n:`${n}${e.slice(s)}`}function li(e){return e.trim().normalize("NFKC").toLowerCase()}function KE(e){let n=e?.toLowerCase();return n?.startsWith("zh")?"\u9996\u9875":n?.startsWith("ja")?"\u30DB\u30FC\u30E0":n?.startsWith("ko")?"\uD648":"Home"}function BE(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 zE(e){return e.map(n=>n.navigation.showInHeader===!0?n:{...n,navigation:{...n.navigation,showInHeader:!0}})}function is(e){return e.parent_page_id??null}function pi(e,n){let s=is(e);return s===null?!0:!n.some(i=>i.id===s)}function Vl(e,n){return e.filter(s=>is(s)===n&&s.id!==n)}function $l(e){let n=e.filter(c=>pi(c,e)),s=n.filter(c=>c.slug==="/"),i=n.filter(c=>c.slug!=="/"),o=[],a=new Set;for(let c of[...s,...i])if(!a.has(c.id)){o.push(c),a.add(c.id);for(let r of Vl(e,c.id))a.has(r.id)||(o.push(r),a.add(r.id))}for(let c of e)a.has(c.id)||(o.push(c),a.add(c.id));return o}function HE(e){if(!e.startsWith("/")||e.startsWith("//"))return null;let n=e.search(/[?#]/);return n===-1?e:e.slice(0,n)}function VE(e,n){let s=$l(n),i=new Map;s.forEach((c,r)=>{c.slug!==null&&!i.has(c.slug)&&i.set(c.slug,r)});let o=[],a=[];for(let c of e){let r=HE(c.href),m=r===null?void 0:i.get(r);m===void 0?a.push(c):o.push({link:c,rank:m})}return o.sort((c,r)=>c.rank-r.rank),[...o.map(c=>c.link),...a]}function $E(e){let n=e.filter(s=>pi(s,e)).length;return{top_level_pages:n,sub_pages:e.length-n,total_pages:e.length,content_items:e.reduce((s,i)=>s+i.blocks.length,0)}}function YE(e,n={}){let s=[],i=new Map(e.map(c=>[c.id,c])),o=e.filter(c=>c.slug==="/");o.length!==1?s.push({code:"missing_home",page_id:null,message:"The structure must contain exactly one home page."}):n.expectedHomeTitle&&li(o[0].title)!==li(n.expectedHomeTitle)&&s.push({code:"home_renamed",page_id:o[0].id,message:`The home page must keep its fixed name '${n.expectedHomeTitle}'.`});for(let c of e){c.title.trim().length===0&&s.push({code:"empty_title",page_id:c.id,message:"Page name is empty."}),c.slug&&n.reservedSlugs?.includes(c.slug)&&s.push({code:"reserved_slug",page_id:c.id,message:`Slug '${c.slug}' is reserved by the site's applications.`});let r=is(c);if(r===null)continue;if(c.slug==="/"){s.push({code:"home_has_parent",page_id:c.id,message:"The home page cannot have a parent."});continue}if(r===c.id){s.push({code:"self_parent",page_id:c.id,message:"A page cannot be its own parent."});continue}let m=i.get(r);if(!m){s.push({code:"parent_not_found",page_id:c.id,message:`Parent page '${r}' does not exist.`});continue}if(m.slug==="/"){s.push({code:"home_has_children",page_id:c.id,message:"The home page cannot have sub pages."});continue}is(m)!==null&&s.push({code:"depth_exceeded",page_id:c.id,message:"At most two levels are allowed."})}let a=new Map;for(let c of e){let r=pi(c,e)?"__top__":is(c),m=li(c.title);if(m.length===0)continue;let S=a.get(r)??new Map,g=S.get(m);g!==void 0&&g!==c.id?s.push({code:"duplicate_sibling_title",page_id:c.id,message:`Page name '${c.title}' is already used at the same level.`}):S.set(m,c.id),a.set(r,S)}return s}var XE=16,QE=/[ᄀ-ᅟ⺀-〾ぁ-㏿㐀-䶿一-鿿ꀀ-꓏가-힣豈-﫿︰-﹯＀-⦆¢-₩]/u;function ZE(e){let n=0;for(let s of e)n+=QE.test(s)?2:1;return n}function JE(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 A}from"zod";var Yl=20*1024*1024,eR=Yl,Xl=["jpg","jpeg","png","gif","webp","bmp"],Ql=["mp4","avi","mov","webm","mkv"],Zl=["mp3","wav","aac","flac","ogg","wma","m4a"],Jl=["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","md","csv"],ep=[...Jl,"zip","rar","json","xmind","psd","ai","fig","sketch"],tR=[...Xl,...Ql,...Zl,...ep],tp=["image/jpeg","image/png","image/gif","image/webp","image/bmp"],np=["video/mp4","video/x-msvideo","video/quicktime","video/webm","video/x-matroska"],sp=["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"],nR=[...tp,...np,...sp],ip=A.enum(["image","video","audio","file"]),op=A.enum(["external","ai_generated","unsplash"]),_a=A.object({resource_id:A.string().min(1),name:A.string().min(1).max(255),url:A.string().url(),thumbnail_url:A.union([A.string().url(),A.literal("")]),mime_type:A.string().trim().min(3).max(127),size:A.number().int().nonnegative(),width:A.number().int().positive().nullable(),height:A.number().int().positive().nullable(),source:op,created_at:A.string().min(1).nullable()}),sR=A.object({page:A.coerce.number().int().min(1).default(1),page_size:A.coerce.number().int().min(1).max(100).default(24),keyword:A.string().trim().max(100).optional(),file_type:ip.default("image")}),iR=A.object({code:A.literal(0),message:A.string(),data:A.object({items:A.array(_a),page:A.number().int().min(1),page_size:A.number().int().min(1),total:A.number().int().nonnegative()})}),oR=A.object({code:A.literal(0),message:A.string(),data:_a}),ga=4,aR=A.object({pageName:A.string().trim().min(1).max(200),pageType:A.enum(["landing_page","general_page","detail_page","list_page","category_page","tag_page","author_page","search_page","date_page"]),sectionTitle:A.string(),nearbyTitle:A.string(),nearbyBody:A.string(),prompt:A.string().trim().min(1).max(2e3),aspectRatio:A.string().regex(/^[1-9]\d*:[1-9]\d*$/)}),ap=A.object({index:A.number().int().min(0).max(ga-1),ok:A.literal(!0),url:A.string().regex(/^data:image\/(?:png|jpeg|gif|webp|bmp);base64,[A-Za-z0-9+/]+={0,2}$/)}),rR=A.object({code:A.literal(0),message:A.string(),data:A.object({items:A.array(ap).min(1).max(ga)})}),rp=A.object({provider_id:A.string().min(1),url:A.string().url(),thumbnail_url:A.string().url(),width:A.number().int().positive(),height:A.number().int().positive(),alt:A.string(),photographer_name:A.string().min(1),photographer_url:A.string().url(),photo_url:A.string().url(),download_location:A.string().url(),dominant_color:A.string().nullable()}),cR=A.object({query:A.string().trim().min(1).max(100),page:A.coerce.number().int().min(1).default(1),page_size:A.coerce.number().int().min(1).max(30).default(18),orientation:A.enum(["landscape","portrait","squarish"]).optional()}),mR=A.object({code:A.literal(0),message:A.string(),data:A.object({items:A.array(rp),page:A.number().int().min(1),page_size:A.number().int().min(1),total:A.number().int().nonnegative(),total_pages:A.number().int().nonnegative()})}),cp=A.string().url().refine(_R,{message:"download_location must be an official Unsplash download URL"}),lR=A.object({download_location:cp}),pR=A.object({code:A.literal(0),message:A.string(),data:A.object({reported:A.boolean()})}),dR=A.object({source_id:A.number().int().positive(),source_title:A.string().min(1).max(255),source_url:Gt,resource_id:A.number().int().positive()}),uR=A.object({code:A.literal(0),message:A.string(),data:A.object({reported:A.boolean()})});function _R(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 me}from"zod";var gR=me.object({colorSeeds:me.object({primary:me.string().min(1).max(40),accent:me.string().min(1).max(40),foreground:me.string().min(1).max(40).optional()}).strict().optional(),surfaceMode:me.enum(["light","dark"]).optional(),fonts:me.object({heading:me.string().min(1).max(60),body:me.string().min(1).max(60)}).strict().optional(),weightStyle:qe.optional()}).strict().refine(e=>e.colorSeeds!==void 0||e.surfaceMode!==void 0||e.fonts!==void 0||e.weightStyle!==void 0,{message:"colorSeeds, surfaceMode, fonts, or weightStyle is required"}),hR=me.object({ok:me.literal(!0),design_plan_version:me.number().int().positive().optional(),snapshot_id:k,site_design_context:me.lazy(()=>di).optional(),changed_files:me.array(me.string().min(1)).optional()}),SR=me.object({snapshot_id:k,color_seeds:me.object({primary:me.string(),accent:me.string(),foreground:me.string().optional()}).nullable(),surface_mode:me.enum(["light","dark"]).nullable(),fonts:me.object({heading:me.string(),body:me.string()}).nullable(),palette_inputs_present:me.boolean(),palette_inputs:Ro.nullable(),notes:me.array(me.string()).nullable(),weight_style:qe.nullable().default(null),source:me.enum(["globals_css","design_plan_archive"])});import{z as D}from"zod";var Ie=D.string().min(1).max(100),mp=D.enum(["page","anchor","external","email","phone","file","group"]);function fR(e){if(!e||e.trim()!==e||/[\u0000-\u001f\u007f\\]/u.test(e))return!1;if(e.startsWith("/")&&!e.startsWith("//")||/^#[^\s]*$/u.test(e)||/^(mailto:|tel:)[^\s]+$/iu.test(e))return!0;try{let n=new URL(e);return(n.protocol==="http:"||n.protocol==="https:")&&!n.username&&!n.password}catch{return!1}}var bR=D.string().max(2048).refine(fR,"Invalid navigation destination"),lp=D.string().trim().min(1).max(255),pp=D.enum(["link","cta"]).nullable(),dp=D.lazy(()=>D.object({id:Ie,group_id:Ie,parent_id:Ie.nullable(),sort_order:D.number().int().nonnegative(),label:D.string(),href:D.string().nullable(),target_type:mp,enabled:D.boolean(),effective_visible:D.boolean(),open_in_new:D.boolean(),nofollow:D.boolean(),role:pp,link_binding:D.object({kind:D.enum(["custom","cms_page","file"]),page_id:Ie.nullable()}),children:D.array(dp)})),yR=D.object({id:Ie,name:D.string(),description:D.string(),is_default:D.boolean(),can_delete:D.boolean(),delete_block_reason:D.string().nullable(),items:D.array(dp)}),xR=D.object({site_id:D.string().min(1),default_group_id:Ie.nullable(),groups:D.array(yR),limits:D.object({max_depth:D.number().int().positive(),max_items:D.number().int().positive()})}),rU=D.object({data:xR}),up=D.object({name:lp,description:D.string().max(2e3).optional()}).strict(),ER=up.partial().refine(e=>Object.keys(e).length>0,"At least one field is required"),cU=D.object({group_id:Ie}).strict(),_p={label:lp,target_type:mp,href:bR.nullable().optional(),enabled:D.boolean().optional(),open_in_new:D.boolean().optional(),nofollow:D.boolean().optional(),role:pp.optional()},RR=D.object({group_id:Ie,parent_id:Ie.nullable().optional(),..._p}).strict().superRefine((e,n)=>{e.target_type!=="group"&&!e.href&&n.addIssue({code:"custom",path:["href"],message:"Link destination is required"}),e.target_type==="group"&&e.href&&n.addIssue({code:"custom",path:["href"],message:"Groups have no destination"})}),IR=D.object({..._p,link_mode:D.literal("custom").optional()}).partial().strict().refine(e=>Object.keys(e).length>0,"At least one field is required"),TR=D.object({group_id:Ie,parent_id:Ie.nullable(),before_id:Ie.nullable().optional()}).strict(),kR=D.object({cms_bound:D.boolean(),cms_driven:D.boolean(),supports_groups:D.boolean(),supports_nested_groups:D.boolean(),supports_link_attributes:D.boolean(),requires_agent:D.boolean(),reasons:D.array(D.string())}),mU=D.object({data:kR}),lU=D.discriminatedUnion("action",[D.object({action:D.literal("create_group"),values:up}).strict(),D.object({action:D.literal("update_group"),id:Ie,values:ER}).strict(),D.object({action:D.literal("delete_group"),id:Ie}).strict(),D.object({action:D.literal("set_default_group"),group_id:Ie}).strict(),D.object({action:D.literal("create_item"),values:RR}).strict(),D.object({action:D.literal("update_item"),id:Ie,values:IR}).strict(),D.object({action:D.literal("delete_item"),id:Ie,cascade:D.boolean().optional()}).strict(),D.object({action:D.literal("move_item"),id:Ie,values:TR}).strict()]);import{z as le}from"zod";var ha=le.enum(["products","cases","guides","documents","company"]),AR=le.enum(["source_unreachable","content_mojibake","min_fields_unmet","document_no_file_reference","document_file_unavailable","media_ingest_failed","app_unavailable","write_failed","kind_input_unavailable","kind_uncertain","kind_service_unavailable","kind_budget_exhausted"]),bt=le.number().int().nonnegative(),wR=le.discriminatedUnion("status",[le.object({collection:ha,status:le.literal("processing")}).strict(),le.object({collection:ha,status:le.enum(["imported","partial","failed"]),imported:bt,exception:bt}).strict()]),gp=le.enum(["legacy_domain_not_routed","site_context_missing","site_rules_limit_exceeded","site_rules_not_served"]),PR=le.enum(["target_page_unpublished","redirect_target_missing","redirect_write_failed",...gp.options]),vR=le.discriminatedUnion("status",[le.object({status:le.literal("processing")}).strict(),le.object({status:le.literal("unavailable")}).strict(),le.object({status:le.literal("ready"),site_reason:gp.nullable(),same_path:bt,active:bt,exception:bt,exceptions:le.array(le.object({path:le.string().regex(/^\/[^?#]*$/),reason_code:PR}))})]),uU=le.object({overall_status:le.enum(["moving","completed","disabled","failed"]),by_collection:le.array(wR),media:le.object({image:bt,video:bt,audio:bt,file:bt}),exceptions:le.array(le.object({collection:ha.nullable(),path:le.string().regex(/^\/[^?#]*$/),reason_code:AR})),redirects:vR.nullable().optional()});var ba=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(),weightStyle:qe.optional()}),Sa=t.enum(["material","reference","brief","industry"]),CR=t.object({market:t.object({value:t.string().min(1).max(200),source:Sa}),customer:t.object({value:t.string().min(1).max(200),source:Sa}),purpose:t.object({options:t.array(t.string().min(1).max(60)).min(2).max(4),selected:t.string().min(1).max(60),source:Sa})}),DR=t.enum(["text-options","motion-slider","positioning"]),ya=t.enum(["none","subtle","moderate","expressive"]),OR=t.enum(["compact","comfortable","airy","editorial"]),NR=ya,xp=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()}),jR=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:ba.optional(),conversionHints:Lt.optional()}),LR=t.object({id:t.string(),type:DR,question:t.string(),tag:t.string(),aiThinking:t.string(),options:t.array(jR),source:t.enum(["ai-detected","always-ask"]),sourceDetail:t.string(),positioning:CR.optional()}),xa=t.object({questions:t.array(LR).min(1).max(6)}),qU=t.object({tenant_id:t.string().min(1),site_id:T,brief_id:$t,brief:t.string().min(20).max(1e3),site_default_locale:Ee.optional(),owner_locale:Ee.optional(),input_context:t.object({facts:t.array(ds).max(120),conflicts:t.array(_s).max(20),reference:us.optional(),sources:t.array(t.object({type:Ei,title:t.string().max(120).optional(),status:Ri})).max(16).optional()}).optional()}),Ep=t.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),WU=t.discriminatedUnion("type",[t.object({type:t.literal("run.started"),runId:V,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(xp).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:Ep.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)})]),KU="SITE_PLANNING_INPUT_FROZEN",BU="SITE_PLANNING_LOCKED",zU="SITE_STRUCTURE_CONFIRMATION_REQUIRED",HU="SITE_STRUCTURE_CONFIRMATION_STALE",VU="SITE_SITEMAP_DRAFT_STALE",$U="SITE_SITEMAP_DRAFT_OPERATION_MISMATCH",hp="SITE_STRUCTURE_INVALID",YU=t.object({tenant_id:t.string().min(1),name:t.string().min(1).max(120),brief:t.string().min(20).max(1e3)}),XU=t.object({name:t.string().min(1).max(120),brief:t.string().min(20).max(1e3)}),QU=t.object({name:t.string().min(1).max(120)}),ZU=t.object({name:t.string().min(1).max(120),default_locale:Ee.optional()}),JU=t.object({body:t.string().min(20).max(1e3)}),eF=t.object({body:t.string().min(20).max(1e3)}),Ea=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"}),tF=t.object({tenant_id:t.string().min(1),site_id:T.optional(),site_url:Ea.optional(),site_name:t.string().trim().min(1).max(255).optional()}),nF=M(Er),sF=M(Rr),iF=M(Ir),oF=M(Ur),aF=M(Fr),rF=M(Gr),cF=M(Wr),mF=M(Kr),lF=M(Br),pF=M(t.object({site_id:T,site_url:Ea.nullable()})),Nt=t.object({id:T,tenant_id:t.string().min(1),name:t.string().min(1),slug:t.string().min(1),status:eo,deployment_status:to,archived_at:t.string().min(1).nullable(),current_sitemap_id:Te.nullable(),confirmed_sitemap_id:Te.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:ct.nullable().optional(),deployed_url:t.string().url().nullable(),default_locale:Ee,owner_locale:Ee.optional(),cms_site_id:dr.nullable().optional(),cms_site_url:Ea.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)}),Ra=t.object({id:$t,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)}),dF=t.object({site:Nt,brief:Ra,next_step:t.literal("clarify")}),uF=t.object({site:Nt,brief:Ra}),_F=t.object({brief:Ra}),MR=t.enum(["queued","running","succeeded","failed","cancelled"]),Rp=t.enum(["clarify","sitemap","workspace"]),Ip=t.enum(["clarify","sitemap","initial_generation","iteration","landing_page","fill_in"]),Tp=t.enum(["clarify","sitemap","workspace","summarize"]),et=t.object({id:V,tenant_id:t.string().min(1),site_id:T,agent_type:Rp,run_kind:Ip,status:MR,model_route:Tp,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:tt.nullable().optional()}),gF=t.object({agent_run:et}).strict(),UR=t.enum(["workspace","landing_page","external"]),FR=t.enum(["user","background"]),kp=t.enum(["active","archived"]),hi=t.object({id:tt,tenant_id:t.string().min(1),site_id:T,kind:UR,origin:FR,subject_key:t.string().min(1).max(200),title:t.string().min(1).max(200),status:kp,external_thread_id:t.string().min(1).max(200).nullable(),last_run_id:V.nullable(),last_activity_at:t.string().min(1),created_at:t.string().min(1),updated_at:t.string().min(1)}),hF=t.object({agent_run:et,thread:hi.nullable()}),SF=t.object({run_id:V.optional(),site_id:T,agent_type:Rp,run_kind:Ip.optional(),model_route:Tp,input:t.record(t.string(),t.unknown()).optional()}).superRefine((e,n)=>{os(e.input)&&n.addIssue({code:"custom",path:["input"],message:"Agent run input must not contain secrets"})}),fF=t.object({agent_run:et,next_step:t.literal("stream_events")}),Ap=t.enum(["draft","candidate","deleting","current","failed"]),yt=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:Xe.nullable().optional(),reason:t.enum(["initial_generation","workspace_edit","pre_deploy","manual_save","rollback","template_upgrade","subsite_clone"]),status:Ap,created_at:t.string().min(1)}),bF=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:Xe.optional(),reason:yt.shape.reason,status:t.enum(["draft","candidate","current","failed"]).default("candidate"),source_run_id:V.optional()}),yF=t.object({site:Nt,snapshot:yt,next_step:t.literal("workspace")}),xF=t.object({expected_manifest_hash:yt.shape.manifest_hash,manifest_hash:yt.shape.manifest_hash,object_key:yt.shape.object_key}).strict(),EF=t.union([t.object({base_snapshot_id:k.nullable(),source_run_id:V.optional(),page_template_advisories:t.array(Rn).optional()}).strict(),t.object({skip_base_check:t.literal(!0)}).strict()]),GR=t.object({site:Nt,snapshot:yt,next_step:t.literal("workspace")}),RF=t.object({snapshot:yt}),IF=t.object({status:t.literal("deleting"),snapshot_id:k,object_key:t.string().min(1)}),TF=t.object({status:t.literal("deleted"),snapshot_id:k}),Si=t.object({id:Ma,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:V.nullable(),created_at:t.string().min(1)}),qR=Si.extend({reason:yt.shape.reason,status:Ap}),kF=t.object({accepted_commit:t.string().min(1),source_run_id:V.optional()}),AF=t.object({site_version:Si,next_step:t.literal("workspace")}),wF=t.object({owner_id:t.string().min(1)}).strict(),PF=t.discriminatedUnion("acquired",[t.object({acquired:t.literal(!0)}).strict(),t.object({acquired:t.literal(!1)}).strict()]),vF=t.object({owner_id:t.string().min(1)}).strict(),CF=t.object({released:t.literal(!0)}).strict(),DF="TEMPLATE_UPGRADE_LOCK_LOST",OF=t.object({base_snapshot_id:k,accepted_commit:Si.shape.accepted_commit,owner_id:t.string().min(1)}).strict(),NF=GR.strict(),jF=t.object({site_versions:t.array(qR)}),LF=t.object({site:Nt,snapshot:yt,site_version:Si,next_step:t.literal("workspace")}),MF=t.object({snapshot_id:k,force_rehydrate:t.boolean().optional(),recovery_required:t.boolean().optional()}),WR=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()})]),UF=t.object({tenant_id:t.string().min(1),site_id:T,snapshot_id:k}).strict(),FF=WR,Ia=t.enum(Yt),wp=t.enum(["quality_check","publish"]),Dt=t.object({id:ct,tenant_id:t.string().min(1),site_id:T,snapshot_id:k,type:wp.default("publish"),version:t.number().int().positive(),status:Ia,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)}),GF=t.object({tenant_id:t.string().min(1),site_id:T,expected_snapshot_id:k}).strict(),qF=t.object({deployment:Dt}),WF=t.object({tenant_id:t.string().min(1),site_id:T,deployment_id:ct}).strict(),KF=t.object({deployment:Dt}),BF=t.object({}).strict(),zF=t.object({snapshot_id:k.optional()}).strict(),KR=t.object({deployment:Dt}),HF=M(KR),VF=t.object({deployment:Dt.nullable()}),$F=t.object({deployment:Dt}),Sp=t.object({id:ct,type:wp.default("publish"),status:Ia,url:t.string().url().nullable(),error_code:t.string().min(1).nullable(),provider_deployment_id:t.string().min(1).nullable()}),BR=t.object({current:Sp.nullable(),latest_released:Sp.nullable()}),YF=M(BR),zR=t.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),hn=t.object({id:t.string().min(1),tenant_id:t.string().min(1),site_id:T,deployment_id:ct,seq:t.number().int().positive(),sent_at:t.string().min(1)}),ui=t.object({deployment:Dt,steps:Cc.default([])}),XF=t.discriminatedUnion("type",[hn.extend({type:t.literal("deployment.snapshot"),payload:ui}),hn.extend({type:t.literal("deployment.status.changed"),payload:ui}),hn.extend({type:t.literal("deployment.finished"),payload:ui}),hn.extend({type:t.literal("deployment.failed"),payload:ui}),hn.extend({type:t.literal("deployment.realtime.recovered"),payload:t.object({action:t.literal("refresh")})}),hn.extend({type:t.literal("server.error"),payload:t.object({code:t.string().min(1),message:t.string().min(1),retryable:t.boolean()})})]),QF=t.object({tenant_id:t.string().min(1),site_id:T,deployment_id:ct,status:Ia,updated_at:t.string().min(1)}),HR="vcp:deployments",ZF={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:HR,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...zR.options]},VR=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)})}),JF=t.object({error:VR.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:et})})}),eG=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({})}),$R=t.object({theme_id:t.string().min(1),paletteIntent:t.string().min(1),tone:t.string().min(1),mediaMood:t.string().min(1),motionLevel:ya.optional(),userVisualHints:ba.optional()}),YR=t.object({key:t.string().min(1).max(64).optional(),question:t.string().min(1),answer:t.string().min(1)}),tG=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)}),nG=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()}),XR=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()}),sG=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:XR.optional()}),QR=t.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),Sn=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:QR.default("system_recommended")}),se=t.string().min(1).max(2e3),fp=t.string().min(1).max(120),di=t.object({visualDirection:se,brandFeeling:se,paletteIntent:se,typographyIntent:se,density:OR,motionLevel:NR,motionPreset:t.enum(["subtle","moderate","expressive"]).optional(),mediaStrategy:se,compositionRules:t.array(se).max(20),avoidPatterns:t.array(se).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(),weightStyle:qe.optional()}),Ta=160,Pp=t.object({routeGoal:se,narrativeArc:se,firstViewportIntent:se,visualContinuity:se,sectionRhythm:se,avoidPatterns:t.array(se).max(20),displayTitle:t.string().min(1).max(40).optional(),displayDescription:t.string().min(1).max(Ta).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()}),vp=t.enum(["model_call","validation","repair","preview","worker_group"]),Ot=t.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),Cp=t.object({sectionRole:se,contentIntent:se,layoutIntent:se,visualIntent:se,mediaIntent:se,motionIntent:se,interaction:ps.optional(),copyTone:se,displayTitle:t.string().min(1).max(40).optional(),displayDescription:t.string().min(1).max(Ta).optional(),ctaIntent:se.optional(),continuityWithPrevious:se.optional(),avoidRepeating:t.array(se).max(20).optional(),industryRecipeRefs:t.array(fp).max(12).optional(),templateRecipeRefs:t.array(fp).max(12).optional()}),Dp=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()}),ZR=t.enum(["solid","floating"]),JR=t.enum(["background","card","primary","frosted"]),eI=t.enum(["sticky","hide-on-scroll","static"]),tI=t.enum(["bar","island"]),nI=t.object({variant:ZR,surface:JR.optional(),behavior:eI.optional(),shape:tI.optional()}),sI=t.object({form:se,layoutIntent:se,scrollBehavior:se,shell:nI.optional(),avoidPatterns:t.array(se).max(10).optional()}),iI=t.enum(["background","card","primary","inverse"]),oI=t.object({surface:iI}),aI=t.object({form:se,composition:se,shell:oI.optional(),avoidPatterns:t.array(se).max(10).optional()}),rI=t.object({pattern:se,intent:se}),Op=t.object({header:sI,footer:aI,mobileNav:rI}),Np=t.enum(["top","below-hero","footer","none"]),jp=t.object({schemaVersion:t.literal(1).default(1),siteDesignContext:di,routeCards:t.record(t.string().min(1),Pp),blockContexts:t.record(t.string().min(1),Cp),selectedSkillPacks:t.array(Sn).max(3).optional(),branding:Dp.optional(),chromeDesign:Op.optional(),breadcrumbPlacement:Np.optional()}),iG=t.object({siteDesignContext:di.omit({imagePalette:!0}).optional(),routeCards:t.record(t.string().min(1),Pp).optional(),blockContexts:t.record(t.string().min(1),Cp.extend({interaction:ps.nullable().optional()})).optional(),branding:Dp.optional(),chromeDesign:Op.optional()}),Fe=t.string().trim().min(1),ka=t.object({id:Fe,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(),Aa=t.string().regex(On,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),cI=new RegExp(`^/(?:${Zt}(?:/${Zt})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),mI=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,lI=t.union([t.string().regex(cI),t.string().regex(mI)]),bp=t.object({label:t.string(),href:lI}).passthrough(),pI=t.object({primaryLinks:t.array(bp),footerLinks:t.array(bp)}),Lp=t.object({showInHeader:t.boolean(),showInFooter:t.boolean(),order:t.number()}).strict(),wa=t.object({id:Fe,slug:Aa,title:t.string().trim().min(1),blocks:t.array(ka).min(1),navigation:Lp,parent_page_id:Fe.nullable().optional()}).strict(),dI=ka.extend({type:t.string().nullable()}).strict(),uI=wa.extend({slug:Aa.nullable(),navigation:Lp.extend({showInHeader:t.boolean().nullable(),showInFooter:t.boolean().nullable()}).strict(),blocks:t.array(dI).min(1)}).strict(),_I=ka.extend({id:t.string()}),gI=wa.omit({parent_page_id:!0}).extend({id:t.string(),slug:t.string().min(1),blocks:t.array(_I).min(1),parent_page_id:t.string().nullable().optional()}),yp=t.object({label:t.string(),href:t.string().min(1)}),hI=t.object({primaryLinks:t.array(yp),footerLinks:t.array(yp)}),SI=t.discriminatedUnion("kind",[t.object({kind:t.literal("brief_clarify"),brief_id:$t,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()]),_i=t.object({site_name:t.string().min(1).max(80).optional(),version:t.number().int().positive(),pages:t.array(wa).min(1),navigation:pI,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:SI.optional()}),skillSelection:Sn,visualTheme:$R.optional(),userChoices:t.array(YR).optional(),confirmedChoices:t.object({conversion:Lt.optional()}).optional(),seoKeywords:t.array(wn).min(1).optional()}).strict(),fn=_i.superRefine((e,n)=>{Mp(e.pages,n)}),un=_i.extend({pages:t.array(uI).min(1)}).strict().superRefine((e,n)=>{Mp(e.pages,n)}),fI=t.enum(["slug","showInHeader","showInFooter"]),bI=t.object({page_id:Fe,fields:t.array(fI).min(1).max(3)}).strict(),yI=t.object({page_id:Fe,block_id:Fe,fields:t.tuple([t.literal("type")])}).strict(),xI=100,EI=500,RI=t.object({pages:t.array(bI).max(xI),blocks:t.array(yI).max(EI)}).strict().superRefine((e,n)=>{let s=new Set;e.pages.forEach((o,a)=>{s.has(o.page_id)&&n.addIssue({code:"custom",path:["pages",a,"page_id"],message:`Duplicate page target '${o.page_id}'.`}),s.add(o.page_id),new Set(o.fields).size!==o.fields.length&&n.addIssue({code:"custom",path:["pages",a,"fields"],message:"Page target fields must be unique."})});let i=new Set;e.blocks.forEach((o,a)=>{let c=`${o.page_id}\0${o.block_id}`;i.has(c)&&n.addIssue({code:"custom",path:["blocks",a],message:`Duplicate block target '${o.page_id}/${o.block_id}'.`}),i.add(c)})}),oG=t.object({sitemap:un,targets:RI,reserved_slugs:t.array(Aa).optional()}).strict(),aG=t.object({sitemap:fn}).strict();function Mp(e,n){let s=new Map,i=new Map,o=new Map,a=0;e.forEach((m,S)=>{let g=s.get(m.id);if(g!==void 0?n.addIssue({code:"custom",path:["pages",S,"id"],message:`Duplicate page id '${m.id}' (first used at pages.${g}.id).`}):s.set(m.id,S),m.blocks.forEach((K,H)=>{let ie=i.get(K.id);ie!==void 0?n.addIssue({code:"custom",path:["pages",S,"blocks",H,"id"],message:`Duplicate block id '${K.id}' (first used at pages.${ie.pageIndex}.blocks.${ie.blockIndex}.id).`}):i.set(K.id,{pageIndex:S,blockIndex:H})}),m.slug===null)return;m.slug==="/"&&(a+=1);let w=o.get(m.slug);w!==void 0?n.addIssue({code:"custom",path:["pages",S,"slug"],message:`Duplicate page slug '${m.slug}' (first used at pages.${w}.slug).`}):o.set(m.slug,S)}),(a!==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:hp}});let c=new Map(e.map((m,S)=>[m.id,{page:m,index:S}])),r=(m,S)=>n.addIssue({code:"custom",path:m,message:S,params:{errorCode:hp}});e.forEach((m,S)=>{let g=m.parent_page_id??null;if(g===null)return;let w=["pages",S,"parent_page_id"];if(m.slug==="/"){r(w,"The home page cannot have a parent.");return}if(g===m.id){r(w,`Page '${m.id}' cannot be its own parent.`);return}let K=c.get(g);if(!K){r(w,`Parent page '${g}' does not exist.`);return}if(K.page.slug==="/"){r(w,"The home page cannot have sub pages.");return}(K.page.parent_page_id??null)!==null&&r(w,`Sitemap allows at most two levels; parent '${g}' must be a top-level page.`)})}var rG=_i.omit({skillSelection:!0,visualTheme:!0,userChoices:!0,confirmedChoices:!0,seoKeywords:!0}).extend({meta:_i.shape.meta.omit({source:!0}),site_name:t.string().min(1).max(80),pages:t.array(gI).min(1),navigation:hI}),II=t.enum(["ai","user"]),bn=t.object({site_id:T,page_id:Fe,edited_by:II.default("ai"),source_agent_run_id:V.optional()}),cG=bn.extend({block_id:Fe,target_index:t.number().int().min(0)}),TI=bn.extend({block_id:Fe}),kI=bn.extend({block_id:Fe,instruction:t.string()}),mG=bn.extend({block_id:Fe,variant:t.string().min(1).nullable()}),lG=bn.extend({block_id:Fe,props:t.record(t.string(),t.unknown()),mode:t.enum(["replace","merge"]).default("replace")}),pG=bn.extend({block:t.object({id:Fe,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()})}),AI=t.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),dG=t.discriminatedUnion("operation",[t.object({operation:t.literal("delete_block"),input:TI}).strict(),t.object({operation:t.literal("update_block_instruction"),input:kI}).strict()]),wI=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"]),PI=t.object({status:t.literal("updated"),operation:AI,site_id:T,sitemap_id:Te,version:t.number().int().positive(),changed_pages:t.array(Fe).min(1),requires_code_patch:t.literal(!0)}),vI=t.object({status:t.literal("failed"),code:wI,message:t.string().min(1),retryable:t.boolean().default(!1),details:t.unknown().optional()}),uG=t.discriminatedUnion("status",[PI,vI]),Pa=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:ya.optional(),visual_tonality:ba.optional(),conversion:Lt.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()}),CI=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(),_G=t.object({source:t.object({kind:t.literal("step5_strategy")}).strict()}).strict(),DI=t.object({item_key:Es,title:t.string().trim().min(1).max(200),selected_option_id:vn,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:Rs.optional(),markets:t.array(Is).max(32).optional(),sections:t.array(t.object({id:t.string().min(1),label:t.string().min(1)}).strict()).optional()}).strict(),OI=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(DI).min(ys).max(De),enterprise_keywords:t.array(wn).min(1).optional()}).strict().superRefine((e,n)=>{let s=e.decisions.map(o=>o.item_key);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["decisions"],message:"Step5 sitemap decisions must use unique strategy keys."}),Pn.forEach(o=>{s.includes(o)||n.addIssue({code:"custom",path:["decisions"],message:`Step5 sitemap decisions are missing ${o}.`})});let i=Qt.filter(o=>s.includes(o));e.decisions.forEach((o,a)=>{o.item_key!==i[a]&&n.addIssue({code:"custom",path:["decisions",a,"item_key"],message:"Step5 sitemap decisions must use the canonical order."})})}),Up=t.object({tenant_id:t.string().min(1),site_id:T,brief_id:$t,brief:t.string().min(20).max(1e3),answers:t.array(Pa).min(1).max(10),skillSelection:Sn,site_default_locale:Ee.optional(),owner_locale:Ee.optional(),cms_site_id:t.string().min(1).nullish(),intent_pages:t.array(CI).max(9).optional(),reference:us.optional(),input_context:t.object({facts:t.array(ds).max(120),conflicts:t.array(_s).max(20)}).optional(),business_facts:Ja.optional(),migration_products_enabled:t.boolean().optional()}),NI=Up.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,migration_products_enabled:!0}).partial({skillSelection:!0}).extend({source:OI}).strict(),gG=t.union([Up,NI]),Fp=t.enum(["planning","generating","validating","ready"]),jI=t.enum(["salvaged","deterministic_fallback"]),LI=t.enum(["model_exception_settled_prefix","model_exception_safe_root"]),Gp={outcome:jI.optional(),reason:LI.optional(),attempts:t.number().int().positive().optional()};function qp(e,n){if(e.type!=="sitemap.generated")return;let s=e.outcome!==void 0,i=e.reason!==void 0;s!==i&&n.addIssue({code:"custom",path:[s?"reason":"outcome"],message:"sitemap.generated outcome and reason must be provided together"})}var MI=t.discriminatedUnion("type",[t.object({type:t.literal("run.started"),runId:V,at:t.string().min(1)}),t.object({type:t.literal("sitemap.generating"),stage:Fp,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:Te,sitemap:fn,...Gp,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)})]),hG=MI.superRefine(qp),Wp=t.object({id:Te,tenant_id:t.string().min(1),site_id:T,version:t.number().int().positive(),source_agent_run_id:V.nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}).strict();function Kp(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 Bp=Wp.extend({sitemap:fn}).superRefine(Kp),zp=Wp.extend({sitemap:un}).superRefine(Kp),SG=t.object({sitemap_id:Te,creation_key:t.string().min(1),sitemap:un,expected_current_sitemap_id:Te,expected_current_sitemap_version:t.number().int().positive()}).strict().superRefine((e,n)=>{e.sitemap.version!==e.expected_current_sitemap_version&&n.addIssue({code:"custom",path:["sitemap","version"],message:"Draft version must match the expected base version."})}),fG=t.object({sitemap:zp}).strict();function bG(e){return`sitemap-user-draft:${e.site_id}:${e.expected_current_sitemap_id}:${e.expected_current_sitemap_version}:${e.sitemap_id}`}var yG=t.object({sitemap_id:Te,creation_key:t.string().min(1),sitemap:fn,source_agent_run_id:V.optional()}),xG=t.object({sitemap_id:Te,creation_key:t.string().min(1),sitemap:un,expected_current_sitemap_id:Te,expected_current_sitemap_version:t.number().int().positive(),migration_content_requested:t.boolean().optional()}),EG=t.object({sitemap_id:Te,creation_key:t.string().min(1),sitemap:fn,source_agent_run_id:V}),RG=t.object({site:Nt,sitemap:Bp,next_step:t.literal("workspace")}).strict(),IG=t.object({site:Nt,sitemap:zp,next_step:t.literal("workspace")}).strict(),TG=t.object({site:Nt,sitemap:Bp,next_step:t.literal("sitemap_review")}).strict(),UI=t.object({id:La,tenant_id:t.string().min(1),site_id:T,brief_id:$t,questions:xa,answers:t.array(Pa),selected_archetype:Sn.optional(),completed_at:t.string().min(1).nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}),kG=t.object({answers:t.array(Pa).min(1),questions:xa,selected_archetype:Sn.optional()}),AG=t.object({clarify_session:UI}),wG=t.object({questions:xa,selected_archetype:Sn}),FI=t.object({id:bi,tenant_id:t.string().min(1),site_id:T,version:t.number().int().positive(),design_plan:jp,source_agent_run_id:V.nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}),PG=t.object({design_plan_id:bi.optional(),design_plan:jp,source_agent_run_id:V.optional()}),vG=t.object({design_plan:FI}),fi=t.enum(["initial_generation","iteration","landing_page","fill_in"]),GI=t.object({label:t.string().min(1).max(48),prompt:t.string().min(1).max(160)}).strict(),qI=t.enum(["model","derived","mixed","advisor"]),Hp=t.object({suggestions:t.array(GI).min(1).max(4),source:qI}).strict(),WI=t.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),KI=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"]),BI=t.enum(["progress","assistant_final"]),Vp=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"]),zI=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"]),va=t.enum(["style_media","chrome","sections","layout","pages","detect_typecheck","repair","finalize","sitemap_resync","preview"]),Ca=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()}),Pe=t.string().min(1).refine(e=>od(e),{message:"Snapshot file paths must be safe relative POSIX paths without traversal."}),Da=t.object({deduped_paths:t.array(Pe),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(Pe)}),Oa=t.object({group_id:t.string().min(1),phase:va,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(Pe)}),HI=t.enum(["style","media","chrome","section","layout","page","breadcrumb"]),Na=t.object({task_id:t.string().min(1),group_id:t.string().min(1),kind:HI,target_path:Pe,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(Ta).optional(),status:Vt,required_reads:t.array(Pe).optional(),search_params_sections:t.array(Pe).optional(),standard_form_view:Pe.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),placement:Np.optional()}).strict().optional()}),ja=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"])}),CG=t.object({plan_id:t.string().min(1),run_kind:fi,model_route:t.object({planner:t.literal("workspace_planner"),worker:t.literal("workspace")}),groups:t.array(Oa),tasks:t.array(Na),dependencies:t.array(ja),expected_outputs:t.array(Pe),diagnostics:Da}),DG=t.object({task_id:t.string().min(1),patch:t.unknown().optional(),snapshot_id:k.optional(),read_files:t.array(Pe),diagnostics:t.array(Ca),status:Vt}),$p=t.object({worker_count:t.number().int().nonnegative(),task_count:t.number().int().nonnegative(),group_count:t.number().int().nonnegative()}),Yp=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()}),VI=t.object({type:t.literal("text"),text:t.string(),state:t.enum(["streaming","done"]).optional()}),$I=t.object({type:t.literal("reasoning"),text:t.string(),state:t.enum(["streaming","done"]).optional(),providerMetadata:t.record(t.string(),t.unknown()).optional()}),YI=t.object({type:t.literal("file"),mediaType:t.string().min(1),filename:t.string().min(1).optional(),url:t.string().min(1)}),XI=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()}),QI=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()}),ZI=t.object({type:t.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:t.string().min(1).optional(),data:t.unknown()}),JI=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()}),eT=t.object({type:t.literal("error"),errorText:t.string().min(1)}),tT=t.object({type:t.literal("step-start")}),gi=t.union([VI,$I,YI,XI,QI,ZI,JI,eT,tT]),nT=t.string().min(1).max(512).refine(e=>od(e)&&!/^[A-Za-z]:\//.test(e),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),sT=t.array(nT).min(1).max(64),iT=t.array(t.string().min(1).max(120)).min(1).max(64),oT=t.discriminatedUnion("type",[t.object({type:t.literal("run.started"),runId:V,at:t.string().min(1)}),t.object({type:t.literal("message.delta"),text:t.string().min(1),history_purpose:BI.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(gi).min(1),display_text:t.string().min(1).max(4e3).optional(),in_reply_to_tool_call_id:t.string().min(1).optional(),interaction_response:vs.optional(),at:t.string().min(1)}),t.object({type:t.literal("plan.updated"),steps:t.array(zI),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(xp).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:Fp,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:Te,sitemap:fn,...Gp,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:Te,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:oo.optional(),at:t.string().min(1)}),t.object({type:t.literal("workspace.plan.created"),plan_id:t.string().min(1),run_kind:fi,groups:t.array(Oa),tasks:t.array(Na),dependencies:t.array(ja),expected_outputs:t.array(Pe),diagnostics:Da,summary:$p,at:t.string().min(1)}).strict(),t.object({type:t.literal("workspace.worker.updated"),group_id:t.string().min(1),phase:va,status:Vt,task_counts:Yp,target_paths:t.array(Pe),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:Pe,read_files_count:t.number().int().nonnegative(),diagnostics:t.array(t.string().min(1)),diagnostic_details:t.array(Ca).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:sT.optional(),degraded_page_ids:iT.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",i=e.reason==="page_omitted",o=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&&!i&&n.addIssue({code:"custom",path:["degraded_page_ids"],message:"degraded_page_ids is only allowed for generated_code_rescue or page_omitted"}),o)for(let a of["degraded_block_ids","dropped_files","snapshot_id","code","diagnostics","retryable"])e[a]!==void 0&&n.addIssue({code:"custom",path:[a],message:`${a} 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 a of["degraded_block_ids","dropped_files","snapshot_id","code","message","diagnostics","retryable"])e[a]!==void 0&&n.addIssue({code:"custom",path:[a],message:`${a} is not allowed for generated_code_rescue`})}),t.object({type:t.literal("workspace.design_plan.outcome"),design_plan_outcome:WI,reason:KI,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(),Hp.extend({type:t.literal("workspace.suggestions"),at:t.string().min(1)}).strict(),nr,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:Ep.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:En.optional(),build_verified:t.boolean().optional(),generation_ledger:kn.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:vp,title:t.string().min(1).max(200),detail:t.string().max(360).optional(),title_code:Ot.optional(),detail_code:Ot.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:Ot.optional(),detail_code:Ot.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)})]),Xp=oT.superRefine(qp).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"})}),fa=t.object({id:Ua,tenant_id:t.string().min(1),site_id:T,agent_run_id:V,sequence:t.number().int().positive(),event_type:Vp,payload:Xp,created_at:t.string().min(1),thread_id:tt.nullable().optional()}),OG=t.object({event_type:Vp,payload:Xp}).superRefine((e,n)=>{e.event_type!==e.payload.type&&n.addIssue({code:"custom",path:["payload","type"],message:"payload.type must match event_type"}),os(e.payload)&&n.addIssue({code:"custom",path:["payload"],message:"AgentEvent payload must not contain secrets"})}),NG=t.discriminatedUnion("status",[t.object({status:t.literal("appended"),agent_run:et,event:fa,next_cursor:t.number().int().nonnegative()}),t.object({status:t.literal("duplicate_ignored"),agent_run:et,event:fa,next_cursor:t.number().int().nonnegative()})]),jG=t.object({events:t.array(fa),next_cursor:t.number().int().nonnegative().optional()}),LG=t.object({after_sequence:t.coerce.number().int().nonnegative().default(0)}),MG=t.object({run_id:V.optional(),thread_id:tt.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"})}),UG=t.enum(["implemented","skeleton","planned"]),FG=t.enum(["GET","POST","PUT","PATCH","DELETE"]),GG=[{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:"GET",path:"/internal/sites/:site_id/workflow/progress",tag:"site-workflows",summary:"Read the minimal internal site workflow progress projection.",status:"implemented",response_schema:"SiteWorkflowProgressResponseSchema"},{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/complete-quality-only",tag:"site-workflows",summary:"Complete the designer workflow after the linked quality-only publish workflow succeeds.",status:"implemented",request_body_schema:"CompleteQualityOnlyWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema",notes:["The server resolves the designer role and atomically completes both workflows without creating a publish deployment or updating the site deployment projection."]},{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:"PUT",path:"/sites/:site_id/sitemap/draft",tag:"sitemaps",summary:"Save an immutable user draft without confirming or advancing the workflow.",status:"implemented",request_body_schema:"SaveSiteSitemapDraftRequestSchema",response_schema:"SaveSiteSitemapDraftResponseSchema"},{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 trusted CMS identity by tenant_id + cms_site_id; legacy site_url is optional and ignored. The response URL is the configured public API base or null.",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"}],qG=[{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"]}],aT=t.object({id:t.string().min(1),role:t.enum(["system","user","assistant"]),metadata:t.unknown().optional(),parts:t.array(gi).min(1)}),Qp=aT.extend({role:t.literal("user")}).superRefine((e,n)=>{let s=0;for(let[i,o]of e.parts.entries()){if(o.type!=="file")continue;s+=1;let a=o;ro.safeParse(a.mediaType).success||n.addIssue({code:"custom",path:["parts",i,"mediaType"],message:"Attachment mediaType must be image/png, image/jpeg or image/webp"}),(typeof a.url!="string"||co(a.url)===null)&&n.addIssue({code:"custom",path:["parts",i,"url"],message:"Attachment url must be a workspace attachment image path"})}s>ao&&n.addIssue({code:"custom",path:["parts"],message:`A message may carry at most ${ao} attachments`})}),WG=t.object({base_snapshot_id:k.optional(),intent:t.literal("navigation_adaptation").optional(),message:Qp.optional(),thread_id:tt.optional(),client_run_key:t.string().min(1).max(200).optional()}).superRefine((e,n)=>{os(e.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),rT=t.object({path:t.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:V,base_snapshot_id:k,run_kind:fi}),KG=t.object({agent_run:et,websocket:rT,next_step:t.literal("workspace_socket")}),BG=t.object({agent_run:et}),zG=t.object({thread_id:tt.optional()}),HG=t.object({agent_run:et.nullable(),thread:hi.nullable()}),VG=t.object({status:kp.default("active")}),$G=t.object({threads:t.array(hi)}),YG=t.object({title:t.string().trim().min(1).max(200)}).strict(),XG=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"}),QG=t.object({thread:hi}),ZG=t.object({agent_type:t.enum(["clarify","sitemap","workspace"]),thread_id:tt.optional()}),JG=t.object({agent_run:et}),eq=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"]),pe=t.object({id:t.string().min(1),tenant_id:t.string().min(1),site_id:T,run_id:V.optional(),correlation_id:t.string().min(1).optional(),seq:t.number().int().positive().optional(),sent_at:t.string().min(1)}),cT=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()}),mT=t.discriminatedUnion("type",[pe.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:Un.optional(),interaction_response:vs.optional(),selected_component:cT.optional(),intent:t.literal("navigation_adaptation").optional(),display_text:t.string().min(1).max(4e3).optional(),message:Qp,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"})})}),pe.extend({type:t.literal("client.run.cancel"),payload:t.object({run_id:V,reason:t.string().min(1).optional()})}),pe.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()})}),Sc]),lT=t.discriminatedUnion("type",[pe.extend({type:t.literal("server.run.started"),payload:t.object({run_id:V,agent_type:t.literal("workspace")})}),pe.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(gi).min(1),display_text:t.string().min(1).max(4e3).optional(),in_reply_to_tool_call_id:t.string().min(1).optional(),interaction_response:vs.optional()})}),pe.extend({type:t.literal("server.assistant.delta"),payload:t.object({message_id:t.string().min(1),parts:t.array(gi).min(1),status:t.enum(["streaming","ready"])})}),pe.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)})}),pe.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:oo.optional()})}),pe.extend({type:t.literal("server.workspace.suggestions"),payload:Hp.extend({run_id:V}).strict()}),pe.extend({type:t.literal("workspace.plan.created"),payload:t.object({plan_id:t.string().min(1),run_kind:fi,groups:t.array(Oa),tasks:t.array(Na),dependencies:t.array(ja),expected_outputs:t.array(Pe),diagnostics:Da,summary:$p})}),pe.extend({type:t.literal("workspace.worker.updated"),payload:t.object({group_id:t.string().min(1),phase:va,status:Vt,task_counts:Yp,target_paths:t.array(Pe),diagnostics:t.array(t.string().min(1))})}),pe.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:Pe,read_files_count:t.number().int().nonnegative(),diagnostics:t.array(t.string().min(1)),diagnostic_details:t.array(Ca).optional()})}),pe.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()})}),pe.extend({type:t.literal("server.sitemap.updated"),payload:t.object({sitemap_id:Te,version:t.number().int().positive(),reason:t.string().min(1)})}),pe.extend({type:t.literal("server.snapshot.created"),payload:t.object({snapshot_id:k,manifest_hash:t.string().regex(/^sha256:[a-f0-9]{64}$/)})}),pe.extend({type:t.literal("server.snapshot.finalized"),payload:t.object({snapshot_id:k})}),pe.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()})}),pe.extend({type:t.literal("preview.build.started"),payload:t.object({snapshot_id:k})}),pe.extend({type:t.literal("preview.build.succeeded"),payload:t.object({snapshot_id:k})}),pe.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()})}),pe.extend({type:t.literal("server.run.finished"),payload:t.object({run_id:V,snapshot_id:k,degraded_reason:En.optional(),build_verified:t.boolean().optional()})}),pe.extend({type:t.literal("server.run.failed"),payload:t.object({run_id:V,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()})}),pe.extend({type:t.literal("server.error"),payload:t.object({code:t.string().min(1),message:t.string().min(1),retryable:t.boolean()})}),pe.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:vp,title:t.string().min(1).max(200),title_code:Ot.optional(),detail:t.string().max(360).optional(),detail_code:Ot.optional(),locks_input:t.boolean()})}),pe.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:Ot.optional(),detail:t.string().max(360).optional(),detail_code:Ot.optional()})}),pe.extend({type:t.literal("server.activity.finished"),payload:t.object({activity_id:t.string().min(1)})}),pe.extend({type:t.literal("server.activity.failed"),payload:t.object({activity_id:t.string().min(1),detail:t.string().max(360).optional()})})]),pT=lT.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"})}),tq=t.union([mT,pT]),nq={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."]},Zp=t.string().regex(/^sha256:[a-f0-9]{64}$/),dT=t.enum(["create","update","delete","str_replace"]),Jp=t.enum(["sitemap_resync","smoke_test","prepare_preview"]),uT=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(),_T=t.object({path:Pe,operation:dT,expected_hash:Zp.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(uT).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(kT(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"})}),gT=t.object({kind:t.enum(["block","page","site","chrome"]),id:t.string().min(1).max(120)}),hT=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:gT,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)}),ed=t.object({site_id:T,base_snapshot_id:k,reason:t.string().min(1),patches:t.array(_T).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(hT).max(24).optional(),post_actions:t.array(Jp).optional()});function td(e,n){let s=new Set;for(let[i,o]of e.patches.entries())s.has(o.path)&&n.addIssue({code:"custom",path:["patches",i,"path"],message:`Duplicate patch path: ${o.path}`}),s.add(o.path)}var sq=ed.superRefine(td),iq=ed.omit({base_snapshot_id:!0}).extend({site_id:T.optional()}).superRefine(td),ST=xe,fT=t.object({path:ST,operation:t.enum(["upsert","delete"]).optional()}),nd=t.enum(["sync_cms_pages","sync_cms_navigation"]),oq=t.object({files:t.array(fT).min(1),post_actions:t.array(nd).optional()}).strict().overwrite(e=>e.post_actions?{...e,post_actions:[...new Set(e.post_actions)]}:e),bT=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","GLOBALS_CSS_EDIT_REJECTED"]),yT=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:Zp,object_key:t.string().min(1),changed_files:t.array(Pe).min(1),post_actions_queued:t.array(Jp),dropped_protected_files:t.array(t.string().min(1)).min(1).optional()}),xT=t.object({status:t.literal("failed"),code:bT,message:t.string().min(1),retryable:t.boolean().default(!1),details:t.unknown().optional()}),aq=t.discriminatedUnion("status",[yT,xT]),rq=t.object({ok:t.literal(!0),post_actions:t.array(t.object({action:nd,status:t.enum(["succeeded","failed"])}).strict()).default([])}),sd=xe,ET=t.enum(["text","binary"]),id=t.object({path:sd,kind:ET,language:t.string().min(1).nullable(),size_bytes:t.number().int().nonnegative()}),cq=t.object({path:sd}),RT=id.extend({kind:t.literal("text"),language:t.string().min(1),content:t.string()}),IT=id.extend({kind:t.literal("binary"),language:t.null(),mime_type:t.string().min(1),content_base64:t.string().min(1)}),mq=t.union([RT,IT]);function os(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=>os(n)):Object.entries(e).some(([n,s])=>TT(n)||os(s))}function TT(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 od(e){let n=e.split("/");return e.length>0&&!e.startsWith("/")&&!e.includes("\\")&&n.every(s=>s!==""&&s!=="."&&s!=="..")}function kT(e){if(/^(?:src\/)?app\/\.vcp\//.test(e))return ms(e);let n=/^app\/(?:(.*)\/)?page\.(?:tsx|jsx)$/.exec(e);if(!n)return!0;let i=(n[1]??"").split("/").filter(a=>a.length>0);return i.some(a=>a.startsWith("_"))?!0:i.filter(a=>!a.startsWith("@")&&!/^\(.+\)$/.test(a)).map(a=>a.replace(/^\((?:\.|\.\.|\.\.\.)\)/,"")).filter(a=>a.length>0).every(a=>/^\[.*\]$/.test(a)||On.test(`/${a}`))}var ad=t.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),AT=t.object({id:as,tenant_id:t.string().min(1),site_id:T,sandbox_id:t.string().min(1).nullable(),status:ad,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)}),lq=t.object({session_id:as.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:as.optional(),expected_ready_session_last_snapshot_id:k.optional(),status:ad,preview_url:t.string().url().optional(),launch_id:t.string().min(1).optional()}),pq=t.object({preview_session:AT,next_step:t.literal("preview")}),dq=t.object({failed_count:t.number().int().nonnegative()}),uq=t.object({site_id:T}),_q=t.object({status:t.enum(["cancelled","stop_requested","no_active_run"]),agent_run:et.nullable()});export{Dm as AESTHETIC_NOTE_MAX_LENGTH,ga as AI_IMAGE_GENERATION_MAX_QUANTITY,Ob as APPLICATION_LIBRARY_ERROR_CODES,RF as AbandonSiteSnapshotResponseSchema,aE as ActiveSiteDomainDataSchema,HG as ActiveWorkspaceRunResponseSchema,vp as ActivityKindSchema,Ot as ActivityTitleCodeSchema,U1 as AdvanceSiteWorkflowRequestSchema,Ep as AgentErrorCategorySchema,Ua as AgentEventIdSchema,fa as AgentEventRecordSchema,Xp as AgentEventSchema,Vp as AgentEventTypeSchema,BI as AgentMessageHistoryPurposeSchema,Tp as AgentModelRouteSchema,zI as AgentPlanStepSchema,hF as AgentRunContextResponseSchema,V as AgentRunIdSchema,Ip as AgentRunKindSchema,et as AgentRunRecordSchema,MR as AgentRunStatusSchema,Rp as AgentRunTypeSchema,tt as AgentThreadIdSchema,UR as AgentThreadKindSchema,FR as AgentThreadOriginSchema,hi as AgentThreadRecordSchema,kp as AgentThreadStatusSchema,ZI as AiSdkUiDataPartSchema,eT as AiSdkUiErrorPartSchema,YI as AiSdkUiFilePartSchema,gi as AiSdkUiMessagePartSchema,aT as AiSdkUiMessageSchema,$I as AiSdkUiReasoningPartSchema,QI as AiSdkUiSourceDocumentPartSchema,XI as AiSdkUiSourceUrlPartSchema,tT as AiSdkUiStepStartPartSchema,VI as AiSdkUiTextPartSchema,JI as AiSdkUiToolPartSchema,UG as ApiContractStatusSchema,VR as ApiErrorEnvelopeSchema,M as ApiResponseSchema,OG as AppendAgentEventRequestSchema,NG as AppendAgentEventResponseSchema,wN as ApplicationCreateResponseSchema,Ub as ApplicationLibraryApplicationSchema,PN as ApplicationLibraryApplicationsDataSchema,Fm as ApplicationLibraryErrorCodeSchema,CN as ApplicationLibraryErrorResponseSchema,vN as ApplicationLibraryTemplatesDataSchema,qm as ApplicationTemplateCatalogDataSchema,Nb as ApplicationTemplateCatalogItemSchema,Db as ApplicationTemplateConsumeDataSchema,AN as ApplicationTemplateCreateRequestSchema,Lb as ApplicationTemplateCreateResponseSchema,jb as ApplicationTemplateCreatedApplicationSchema,Xs as ApplicationTemplateDigestSchema,Ab as ApplicationTemplateFieldSchema,Cb as ApplicationTemplateReferenceSchema,Mb as ApplicationTemplateSourceSchema,Qs as ApplicationTemplateStableKeySchema,Ko as ApplicationTemplateV1Schema,bT as ApplyPatchBatchErrorCodeSchema,xT as ApplyPatchBatchFailureSchema,sq as ApplyPatchBatchInputSchema,_T as ApplyPatchBatchPatchSchema,Jp as ApplyPatchBatchPostActionSchema,aq as ApplyPatchBatchResultSchema,yT as ApplyPatchBatchSuccessSchema,iq as ApplyPatchBatchToolInputSchema,uT as ApplyPatchEditSchema,dT as ApplyPatchOperationSchema,xp as ArchetypeProposalSchema,WT as AuditLogIdSchema,vT as AuthIdentityIdSchema,NT as AuthLoginCodeIdSchema,OT as AuthOidcStateIdSchema,CT as AuthSessionIdSchema,DT as AuthTokenIdSchema,jT as AuthWsTicketIdSchema,Gy as BINDING_STATUSES,Cp as BlockGenerationContextSchema,ps as BlockInteractionSchema,tG as BlockMediaIntentSchema,ka as BlockSchema,bS as BlockingSubsiteSchema,Dp as BrandingSchema,$t as BriefIdSchema,Ra as BriefRecordSchema,Ja as BusinessFactsSchema,VC as CHAT_COPY,HC as CLARIFICATION_COPY,dy as CMS_FORM_FIELD_TYPES,ym as CMS_MAIN_PRODUCTS_MAX_LENGTH,Lu as CMS_PAGE_DIRECTORY_MAX_DEPTH,ju as CMS_PAGE_DIRECTORY_MAX_NODES,Nu as CMS_PAGE_URL_MAX_LENGTH,wr as CMS_PAGE_URL_PATH_MAX_LENGTH,gv as COMPONENT_I18N_FILE_SUFFIX,Ms as COMPONENT_I18N_NAMESPACE,Ed as CONVERSION_CTA_LABEL_MAX_LENGTH,ox as CRAWLER_INTERNAL_ERROR_CODES,gm as CURRENT_EDIT_ENGINE_VERSION,uq as CancelActiveWorkspaceRunRequestSchema,_q as CancelActiveWorkspaceRunResponseSchema,Ll as CheckSitePublishDomainDataSchema,Zx as CheckSitePublishDomainRequestSchema,Jx as CheckSitePublishDomainResponseSchema,Op as ChromeDesignSchema,aI as ChromeFooterDesignSchema,oI as ChromeFooterShellSchema,sI as ChromeHeaderDesignSchema,nI as ChromeHeaderShellSchema,rI as ChromeMobileNavDesignSchema,cv as ClaimStaleWorkspaceRunsResponseSchema,jR as ClarifyQuestionOptionSchema,LR as ClarifyQuestionSchema,DR as ClarifyQuestionTypeSchema,xa as ClarifyQuestionsSchema,qU as ClarifyRunInputSchema,La as ClarifySessionIdSchema,UI as ClarifySessionRecordSchema,WU as ClarifyStreamEventSchema,UN as CmsApplicationCoreInputSchema,FN as CmsApplicationCoreResultSchema,GN as CmsApplicationSeedInputSchema,qN as CmsApplicationSeedResultSchema,KT as CmsCollectionBindingIdSchema,Fj as CmsCollectionBindingSchema,el as CmsFormSchemaProjectionSchema,qi as CmsManagedPageTypeSchema,lU as CmsNavigationActionSchema,mU as CmsNavigationCapabilitiesResponseSchema,kR as CmsNavigationCapabilitiesSchema,up as CmsNavigationCreateGroupBodySchema,RR as CmsNavigationCreateItemBodySchema,cU as CmsNavigationDefaultGroupBodySchema,xR as CmsNavigationEditorContextSchema,rU as CmsNavigationEditorResponseSchema,yR as CmsNavigationGroupSchema,dp as CmsNavigationItemSchema,TR as CmsNavigationMoveItemBodySchema,ER as CmsNavigationPatchGroupBodySchema,IR as CmsNavigationPatchItemBodySchema,mp as CmsNavigationTargetTypeSchema,Fu as CmsPageDirectoryGroupSchema,vr as CmsPageDirectoryNodeSchema,kr as CmsPageDirectorySchema,Wi as CmsPageTypeSchema,Gt as CmsPageUrlPathSchema,sA as CmsSeoSyncStateSchema,dr as CmsSiteIdSchema,nx as CompanyInfoSchema,nL as CompanyInfoTaskCreateRequestSchema,sL as CompanyInfoTaskCreateResponseSchema,iL as CompanyInfoTaskResponseSchema,LO as CompleteCustomerMaterialsRequestSchema,MO as CompleteDiagnosisRequestSchema,G1 as CompleteQualityOnlyWorkflowRequestSchema,TF as CompleteSiteSnapshotDeletionResponseSchema,F1 as CompleteSiteWorkflowRequestSchema,UO as CompleteStrategyRequestSchema,jO as CompleteWebsiteScanRequestSchema,Sv as ComponentI18nResourcesSchema,gA as ComposeDesignerPageResourceBodySchema,XT as ComputeSnapshotEditChangesRequestSchema,QT as ComputeSnapshotEditChangesResponseSchema,tE as ConfirmSitePublishDomainRemediationDataSchema,eE as ConfirmSitePublishDomainRemediationRequestSchema,nE as ConfirmSitePublishDomainRemediationResponseSchema,xG as ConfirmSiteStructureRequestSchema,RN as ConnectDynamicCollectionInputSchema,YN as ConnectFormInputSchema,Lt as ConversionHintsSchema,ax as CrawlerInternalErrorCodeSchema,oL as CrawlerInternalErrorSchema,dn as CrawlerTaskCodeSchema,Vj as CrawlerTaskCreateRequestSchema,Xj as CrawlerTaskCreateResponseSchema,$y as CrawlerTaskFailureErrorCodeSchema,gl as CrawlerTaskFailureStageSchema,Xy as CrawlerTaskPageSchema,$j as CrawlerTaskPagesQuerySchema,Jj as CrawlerTaskPagesResponseSchema,Zj as CrawlerTaskStatusResponseSchema,zt as CrawlerTaskUuidSchema,JF as CreateAgentRunConflictResponseSchema,SF as CreateAgentRunRequestSchema,fF as CreateAgentRunResponseSchema,BF as CreateDeploymentRequestSchema,KR as CreateDeploymentResponseSchema,Nk as CreateDocumentUploadRequestSchema,$T as CreateExternalSiteEditRequestSchema,ZT as CreateExternalSiteEditResponseSchema,Gk as CreateImageUploadRequestSchema,Pk as CreateInputSourceRequestSchema,zF as CreateQualityCheckDeploymentRequestSchema,XU as CreateSiteBriefRequestSchema,dF as CreateSiteBriefResponseSchema,QU as CreateSiteDraftRequestSchema,YU as CreateSiteInputSchema,YG as CreateSiteThreadRequestSchema,L1 as CreateSiteWorkflowRequestSchema,Dd as CreateTextInputSourceRequestSchema,Od as CreateUrlInputSourceRequestSchema,VF as CurrentDeploymentResponseSchema,PO as CustomerMaterialsDraftResponseSchema,Oo as CustomerMaterialsDraftSchema,vO as CustomerMaterialsNullableResponseSchema,No as CustomerMaterialsRecordSchema,wO as CustomerMaterialsResponseSchema,mb as CustomerMaterialsStatusSchema,Oh as DEFAULT_FONTS,Tm as DEFAULT_SITE_DESIGN_RADIUS_ID,ou as DEFAULT_SITE_LOCALE,iD as DEFAULT_SUBSITE_PALETTE,Ns as DEFAULT_WEIGHT_STYLE_ID,Jw as DEPLOYMENT_ACTIVE_STATUSES,Tt as DEPLOYMENT_LIFECYCLE_TRANSITIONS,Kg as DEPLOYMENT_PROGRESS_STEP_CODES,HR as DEPLOYMENT_REALTIME_CHANNEL,Yt as DEPLOYMENT_STATUSES,eP as DEPLOYMENT_TERMINAL_STATUSES,Ah as DEPLOYMENT_TRANSITION_ERROR_CODE,ZF as DEPLOYMENT_WEBSOCKET_CONTRACT,U0 as DESIGNER_COMPONENT_LIBRARY_ERROR_CODES,lA as DESIGNER_PAGE_LIBRARY_ERROR_CODES,vk as DOCUMENT_EXTENSION_WHITELIST,Ck as DOCUMENT_MIME_WHITELIST,Ax as DOMAIN_DNS_PURPOSES,vx as DOMAIN_DNS_REMEDIATION_STATUSES,wx as DOMAIN_DNS_VERIFICATION_STATUSES,Rx as DOMAIN_OBSERVED_STATUSES,Tx as DOMAIN_ROUTING_MODES,J0 as DeleteDesignerPageErrorDetailsSchema,Y0 as DeleteDesignerPageRequestSchema,X0 as DeleteDesignerPageResponseSchema,Vu as DeleteDesignerPageResultSchema,IF as DeleteSiteSnapshotResponseSchema,ct as DeploymentIdSchema,LT as DeploymentJobIdSchema,Bg as DeploymentProgressStepCodeSchema,Hg as DeploymentProgressStepSchema,zg as DeploymentProgressStepStatusSchema,Cc as DeploymentProgressStepsSchema,Dt as DeploymentRecordSchema,QF as DeploymentRedisPubSubEventSchema,Ia as DeploymentStatusSchema,Sp as DeploymentStatusSummarySchema,go as DeploymentTransitionError,wp as DeploymentTypeSchema,ui as DeploymentWsDeploymentPayloadSchema,XF as DeploymentWsServerMessageSchema,zR as DeploymentWsServerMessageTypeSchema,WI as DesignPlanGenerationOutcomeSchema,KI as DesignPlanGenerationReasonSchema,bi as DesignPlanIdSchema,iG as DesignPlanPatchSchema,FI as DesignPlanRecordSchema,jp as DesignPlanSchema,Me as DesignTokenBlockError,eG as DesignTokensSchema,Ou as DesignerComponentCatalogItemSchema,Er as DesignerComponentCategoriesDataSchema,xr as DesignerComponentCategoryNodeSchema,Ft as DesignerComponentExactVersionSchema,Ir as DesignerComponentInstallDataSchema,Rr as DesignerComponentsDataSchema,Ju as DesignerPageCatalogItemSchema,Ur as DesignerPageCategoriesDataSchema,Mr as DesignerPageCategoryNodeSchema,Bu as DesignerPageDeleteBlockReasonSchema,Ku as DesignerPageDisabledReasonSchema,Dn as DesignerPageExactVersionSchema,Nr as DesignerPageGroupSchema,Gr as DesignerPageInstallDataSchema,Or as DesignerPageNodeSchema,Wr as DesignerPageResourcePreparationDataSchema,Zu as DesignerPageResourceSourceSchema,a_ as DesignerPageResourceTemplateSchema,qt as DesignerPageResourceTypeSchema,Fr as DesignerPagesDataSchema,Li as DesignerResourceVersionSchema,Kr as DesignerSitePagesDataSchema,dA as DesignerSiteRouteIdSchema,Cl as DomainConfigurationSchema,oa as DomainDnsPurposeSchema,Lx as DomainDnsRecordSchema,jx as DomainDnsRemediationChangeSchema,wl as DomainDnsRemediationRecordSchema,Pl as DomainDnsRemediationResultSchema,Cx as DomainDnsRemediationStatusSchema,Nx as DomainDnsVerificationObservationSchema,Al as DomainDnsVerificationResultSchema,Px as DomainDnsVerificationStatusSchema,Ix as DomainObservedStatusSchema,Ox as DomainOperationErrorSchema,ci as DomainOperationSchema,Dx as DomainOperationStatusSchema,aa as DomainOperationTypeSchema,vl as DomainRecordSchema,kx as DomainRoutingModeSchema,YC as EDIT_ENGINE_VERSION_HEADER,XC as EDIT_ENGINE_VERSION_SOURCE_HEADER,YT as EMPTY_EXTERNAL_SITE_EDIT_CHANGES,KC as ERROR_COPY,ld as EXTERNAL_SITE_EDIT_INFRASTRUCTURE_REASONS,md as EXTERNAL_SITE_EDIT_PROMPT_MAX_LENGTH,Co as EditEngineVersionParseError,Br as EnhanceDesignerPageResourceBodySchema,lF as EnhanceDesignerPageResourceResponseSchema,tk as ExternalSiteEditCallbackAckSchema,ek as ExternalSiteEditCallbackPayloadSchema,pd as ExternalSiteEditCallbackStatusSchema,xi as ExternalSiteEditChangeKindSchema,za as ExternalSiteEditChangesSchema,En as ExternalSiteEditDegradedReasonSchema,jt as ExternalSiteEditExternalIdSchema,qa as ExternalSiteEditOutcomeSchema,yd as ExternalSiteEditPageChangeSchema,ud as ExternalSiteEditPageTypeSchema,bd as ExternalSiteEditSectionChangeSchema,gd as ExternalSiteEditSiteWideChangeSchema,_d as ExternalSiteEditSiteWideKindSchema,Ga as ExternalSiteEditTaskIdSchema,cs as ExternalSiteEditTaskSchema,dd as ExternalSiteEditTaskStatusSchema,tF as ExternalSyncSiteRequestSchema,pF as ExternalSyncSiteResponseSchema,Pd as ExtractedFactKindSchema,ds as ExtractedFactSchema,Wo as FIELD_TYPES,ev as FILL_IN_NOT_AVAILABLE_ERROR_CODE,nv as FILL_IN_TARGET_MODIFIED_ERROR_CODE,tv as FILL_IN_TARGET_NOT_OMITTED_ERROR_CODE,Bc as FONT_PAIRINGS,fo as FONT_PAIRING_IDS,Iy as FORM_DESIGN_ERROR_CODES,Ry as FORM_DESIGN_FAILURE_STAGES,xy as FORM_DESIGN_OPERATION_STAGES,Ey as FORM_DESIGN_OPERATION_STATUSES,Js as FORM_FIELD_TYPES,zm as FORM_SCENE_CODES,Hm as FORM_SCENE_UNKNOWN,Kb as FORM_SHAPE_EMBEDDED,uy as FORM_SPEC_FIELD_TYPE_TO_CMS,$m as FORM_SPEC_FILE_MIN_RUNTIME_VERSION,iy as FORM_SPEC_LOCALIZABLE_FIELD_PATHS,Vm as FORM_SPEC_MULTISTEP_MIN_RUNTIME_VERSION,rj as FORM_TEMPLATE_CATEGORY_COUNTS,aj as FORM_TEMPLATE_CATEGORY_SLUGS,dq as FailStaleInFlightWorkspaceRunsResponseSchema,Ys as FieldDeclSchema,sm as FillInTargetSchema,gL as FirecrawlBatchCreateRequestSchema,hL as FirecrawlBatchCreatedResponseSchema,mx as FirecrawlBatchErrorSchema,fL as FirecrawlBatchErrorsResponseSchema,cx as FirecrawlBatchPageSchema,SL as FirecrawlBatchStatusResponseSchema,lL as FirecrawlCrawlCreateRequestSchema,pL as FirecrawlCrawlCreatedResponseSchema,dL as FirecrawlCrawlStatusResponseSchema,yl as FirecrawlJobStatusSchema,cL as FirecrawlMapRequestSchema,mL as FirecrawlMapResponseSchema,bL as FirecrawlQueueStatusResponseSchema,uL as FirecrawlScrapeRequestSchema,_L as FirecrawlScrapeResponseSchema,iI as FooterShellSurfaceSchema,$b as FormBlockIdSchema,ti as FormDefinitionIdSchema,fy as FormDesignAffectedFilesSchema,na as FormDesignErrorCodeSchema,fj as FormDesignErrorSchema,sl as FormDesignFailureStageSchema,de as FormDesignHashSchema,pj as FormDesignOpenResponseSchema,by as FormDesignOperationFingerprintInputSchema,Xo as FormDesignOperationIdSchema,il as FormDesignOperationNextActionSchema,UT as FormDesignOperationRecordIdSchema,hj as FormDesignOperationRecordSchema,sa as FormDesignOperationResponseSchema,al as FormDesignOperationSchema,ta as FormDesignOperationStageSchema,nl as FormDesignOperationStatusSchema,Sj as FormDesignOperationTransitionRequestSchema,ol as FormDesignPreviewRefreshStatusSchema,uj as FormDesignQueryResponseSchema,_j as FormDesignResumeRequestSchema,gj as FormDesignResumeResponseSchema,yy as FormDesignSaveRequestSchema,dj as FormDesignSaveResponseSchema,tl as FormDesignSharedImpactSchema,ea as FormDesignStandardizationSchema,Hb as FormFieldDeclSchema,ts as FormFieldNameSchema,Vo as FormMetadataSchema,Qo as FormOptionValueSchema,Ho as FormSceneSchema,Bb as FormShapeSchema,Yb as FormSpecBindingSchema,Qb as FormSpecFieldNodeSchema,Jb as FormSpecNodeSchema,Xb as FormSpecOptionSchema,Zb as FormSpecStepBreakNodeSchema,Jo as FormSpecV1Schema,cj as FormTemplateCatalogResponseSchema,Jm as FormTemplateCategorySlugSchema,ly as FormTemplateCategoryV1Schema,vt as FormTemplateTextSchema,py as FormTemplateV1Schema,gE as GA4_AUTHORIZATION_STATUSES,SE as GA4_AUTH_ATTEMPT_STATUSES,RE as GA4_BINDING_REASONS,bE as GA4_BINDING_STATUSES,xE as GA4_VERIFICATION_STATUSES,Wn as GLOBAL_DESIGN_TOKENS_END,an as GLOBAL_DESIGN_TOKENS_START,rE as GSC_AUTH_STATUSES,cE as GSC_BINDING_STATUSES,mE as GSC_PROPERTY_TYPES,OE as Ga4AccountOptionSchema,ql as Ga4AuthAttemptSchema,fE as Ga4AuthAttemptStatusSchema,kE as Ga4AuthorizationSchema,hE as Ga4AuthorizationStatusSchema,IE as Ga4BindingReasonSchema,AE as Ga4BindingSchema,yE as Ga4BindingStatusSchema,jE as Ga4DataStreamOptionSchema,LE as Ga4DataStreamsDataSchema,GM as Ga4DataStreamsQuerySchema,FM as Ga4DataStreamsResponseSchema,CE as Ga4DeploymentSchema,PE as Ga4ModeSchema,ME as Ga4MutationSchema,DE as Ga4PropertyOptionSchema,NE as Ga4SetupResourcesDataSchema,UM as Ga4SetupResourcesQuerySchema,MM as Ga4SetupResourcesResponseSchema,Wl as Ga4StatusDataSchema,LM as Ga4StatusQuerySchema,jM as Ga4StatusResponseSchema,vE as Ga4TrackingSchema,wE as Ga4VerificationSchema,EE as Ga4VerificationStatusSchema,aR as GenerateAiImagesRequestSchema,rR as GenerateAiImagesResponseSchema,ap as GeneratedAiImageResultSchema,iM as GetActiveSiteDomainResponseSchema,$F as GetDeploymentResponseSchema,BR as GetDeploymentsStatusResponseSchema,JT as GetExternalSiteEditResponseSchema,sM as GetSiteDomainConfigurationResponseSchema,nO as GetSiteLauncherPermissionResponseSchema,ra as GetSitePublishDomainOperationDataSchema,sE as GetSitePublishDomainOperationResponseSchema,GD as GetTemplateUpgradeReportQuerySchema,qD as GetTemplateUpgradeReportResponseSchema,TM as GoogleSearchConsoleAuthStartDataSchema,IM as GoogleSearchConsoleAuthStartRequestSchema,kM as GoogleSearchConsoleAuthStartResponseSchema,yM as GoogleSearchConsoleAuthStatusSchema,xM as GoogleSearchConsoleBindingStatusSchema,EM as GoogleSearchConsolePropertyTypeSchema,RM as GoogleSearchConsoleStateSchema,wM as GoogleSearchConsoleStatusDataSchema,AM as GoogleSearchConsoleStatusInputSchema,PM as GoogleSearchConsoleStatusResponseSchema,SM as GscAuthStartDataSchema,hM as GscAuthStartRequestSchema,fM as GscAuthStartResponseSchema,ca as GscAuthStatusSchema,ma as GscBindingStatusSchema,la as GscPropertyTypeSchema,pE as GscStateInputSchema,bM as GscStateSchema,Fl as GscStatusDataSchema,dE as GscStatusResponseSchema,Ar as HOME_PAGE_URL_PATH,eI as HeaderShellBehaviorSchema,tI as HeaderShellShapeSchema,JR as HeaderShellSurfaceSchema,ZR as HeaderShellVariantSchema,Wy as HomeUrlCrawlerTaskCreateRequestSchema,Ji as HttpUrlSchema,Lk as IMAGE_EXTENSION_WHITELIST,Mk as IMAGE_MIME_WHITELIST,yr as INSERT_NEW_COMPONENT_CATEGORY_GROUP_KEY,Lr as INSERT_NEW_PAGE_CATEGORY_GROUP_KEY,KP as INTERNAL_RUN_LEASE_OWNER_HEADER,au as ISO_639_3_TO_SITE_LOCALE,Nd as ImageRoleSchema,Qp as InboundUserMessageSchema,uN as IndustryClassificationRequestSchema,_N as IndustryClassificationResultSchema,Eb as IndustryConfidenceSchema,Gm as InitializationResultSchema,wd as InputBundleStatusSchema,_s as InputConflictSchema,qk as InputContextBundleSchema,xn as InputContextSourceIdSchema,Cd as InputSourceSchema,Ri as InputSourceStatusSchema,Ei as InputSourceTypeSchema,wD as InspectTemplateUpgradeStateRequestSchema,PD as InspectTemplateUpgradeStateResponseSchema,W0 as InstallDesignerComponentBodySchema,iF as InstallDesignerComponentResponseSchema,uA as InstallDesignerPageBodySchema,rF as InstallDesignerPageResponseSchema,HF as InternalCreateDeploymentResponseSchema,GF as InternalEnsureSubsitePublishRequestSchema,qF as InternalEnsureSubsitePublishResponseSchema,Q as InternalEntityIdSchema,YF as InternalGetDeploymentsStatusResponseSchema,WF as InternalGetSubsitePublishStatusRequestSchema,KF as InternalGetSubsitePublishStatusResponseSchema,UF as InternalPrepareSubsitePreviewRequestSchema,FF as InternalPrepareSubsitePreviewResponseSchema,ab as KNOWLEDGE_CATEGORY_CODES,xm as KnowledgeCategoryCodeSchema,EO as KnowledgeContextReadinessSchema,cb as KnowledgeSourceReadinessSchema,Em as KnowledgeSourceReadinessStatusSchema,yO as KnowledgeTaskStatusBatchSchema,rb as KnowledgeTaskStatusSchema,El as LEGACY_FILE_MUTATION_TOOL_NAME,eu as LEGACY_SITE_LOCALE_CODES,ZG as LatestAgentRunQuerySchema,JG as LatestAgentRunResponseSchema,zG as LatestWorkspaceRunQuerySchema,BG as LatestWorkspaceRunResponseSchema,PL as LauncherPromptTemplateApplyRequestSchema,vL as LauncherPromptTemplateApplyResponseSchema,hx as LauncherPromptTemplateCatalogItemSchema,AL as LauncherPromptTemplateCatalogQuerySchema,wL as LauncherPromptTemplateCatalogSchema,_x as LauncherPromptTemplateKindSchema,gx as LauncherPromptTemplateLocaleSchema,ri as LauncherPromptTemplateTypeSchema,Qf as LauncherScopeSchema,LG as ListAgentEventsQuerySchema,jG as ListAgentEventsResponseSchema,nF as ListDesignerComponentCategoriesResponseSchema,q0 as ListDesignerComponentsQuerySchema,sF as ListDesignerComponentsResponseSchema,oF as ListDesignerPageCategoriesResponseSchema,pA as ListDesignerPagesQuerySchema,aF as ListDesignerPagesResponseSchema,mF as ListDesignerSitePagesResponseSchema,sR as ListMediaLibraryAssetsQuerySchema,iR as ListMediaLibraryAssetsResponseSchema,MG as ListSiteAgentEventsQuerySchema,jF as ListSiteVersionsResponseSchema,WD as ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema,KD as ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema,av as ListWorkspacePageCheckpointsResponseSchema,Ok as MAX_DOCUMENT_SOURCES_PER_SITE,Dk as MAX_DOCUMENT_UPLOAD_BYTES,Fk as MAX_IMAGE_SOURCES_PER_SITE,Uk as MAX_IMAGE_UPLOAD_BYTES,XE as MAX_NAV_LABEL_WIDTH,If as MAX_SUBSITE_MEDIA_REPLACEMENTS,iw as MAX_UNBOUND_WORKSPACE_ATTACHMENTS_PER_SITE,ao as MAX_WORKSPACE_ATTACHMENTS_PER_MESSAGE,pw as MAX_WORKSPACE_URL_CAPTURES_PER_SITE_HOUR,Zl as MEDIA_LIBRARY_AUDIO_EXTENSIONS,sp as MEDIA_LIBRARY_AUDIO_MIME_TYPES,Jl as MEDIA_LIBRARY_DOCUMENT_EXTENSIONS,tR as MEDIA_LIBRARY_EXTENSIONS,ep as MEDIA_LIBRARY_FILE_EXTENSIONS,Xl as MEDIA_LIBRARY_IMAGE_EXTENSIONS,eR as MEDIA_LIBRARY_IMAGE_MAX_BYTES,tp as MEDIA_LIBRARY_IMAGE_MIME_TYPES,Yl as MEDIA_LIBRARY_MAX_BYTES,nR as MEDIA_LIBRARY_MIME_TYPES,Ql as MEDIA_LIBRARY_VIDEO_EXTENSIONS,np as MEDIA_LIBRARY_VIDEO_MIME_TYPES,yv as MIGRATION_PRODUCTS_CMS_DETAIL_PAGE_TITLE,bv as MIGRATION_PRODUCTS_DETAIL_PREFIX,Rv as MIGRATION_PRODUCTS_DETAIL_VIEW_VARIANT,Ev as MIGRATION_PRODUCTS_LIST_VIEW_VARIANT,hS as MIGRATION_PRODUCTS_ROUTE,ht as MIGRATION_PRODUCTS_SLUG,xv as MIGRATION_PRODUCTS_VIEW_BLOCK_TYPE,zb as MODEL_DECLARABLE_FORM_FIELD_TYPES,xl as MODEL_FILE_MUTATION_TOOL_NAMES,lb as MOTION_PRESETS,Lo as MOTION_PRESET_IDS,sG as MediaAssetSchema,XR as MediaAttributionSchema,_a as MediaLibraryAssetSchema,ip as MediaLibraryFileTypeSchema,op as MediaLibrarySourceSchema,gT as MediaRequestOwnerSchema,qT as MediaResolutionCacheIdSchema,wR as MigrationCollectionProgressSchema,ha as MigrationCollectionSchema,uU as MigrationContentProgressSchema,AR as MigrationReasonCodeSchema,vR as MigrationRedirectProgressSchema,PR as MigrationRedirectReasonCodeSchema,gp as MigrationRedirectSiteReasonSchema,G0 as MockDesignerComponentInsertDataSchema,F0 as MockDesignerComponentInsertRequestSchema,ya as MotionLevelSchema,Dy as NAV_ITEMS_LOCALIZABLE_FIELD_PATHS,Oy as NAV_ITEMS_MACHINE_FIELD_PATHS,Lh as NEXT_FONT_DISPLAY_NAMES,gt as NEXT_FONT_REGISTRY,ru as NON_LATIN_SITE_LOCALE_CODES,wj as NavItemSchema,wy as PAGE_SEO_LOCALIZABLE_FIELD_PATHS,Py as PAGE_SEO_MACHINE_FIELD_PATHS,On as PAGE_SLUG_PATTERN,Zt as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,$a as PAGE_TEMPLATE_BATCH_MAX_ITEMS,px as PLATFORM_FILE_MUTATION_TOOL_NAMES,Nj as PLATFORM_MATERIALIZED_EXEMPTIONS,My as PLATFORM_MATERIALIZED_FILES,Uy as PLATFORM_MATERIALIZED_FILE_PATTERNS,Oj as PLATFORM_MATERIALIZERS,zr as PLATFORM_OWNED_PAGE_SLUGS,r_ as PLATFORM_OWNED_ROUTE_FILE_PATHS,Hu as PageDirectoryReconcileFailedPageSchema,Ki as PageDirectoryReconcileResultSchema,tA as PageDirectoryReconcileStateSchema,zu as PageDirectoryReconcileStatusSchema,Hy as PageDiscoveryCoverageEntrySchema,Qj as PageDiscoveryCoverageReasonSchema,hl as PageDiscoveryCoverageSchema,Lp as PageNavigationSchema,zi as PageResourceArtifactSchema,s_ as PageResourceComponentReferenceSchema,i_ as PageResourceComponentSchema,t_ as PageResourceDraftPageSchema,n_ as PageResourceDraftSchema,ks as PageResourceFinalRouteSchema,o_ as PageResourcePageSchema,e_ as PageResourcePageSelectionSchema,qr as PageResourceRouteMappingSchema,wa as PageSchema,kj as PageSeoDeclSchema,Aa as PageSlugSchema,Yu as PageTargetKindSchema,Ui as PageTargetProjectionHashSchema,jr as PageTargetSchema,Xu as PageTargetSeoSchema,eA as PageTargetSetSchema,Xa as PageTemplateBatchManifestSchema,ck as PageTemplateCleanupRequestSchema,pk as PageTemplateCleanupResponseSchema,Va as PageTemplateCreateItemSchema,ak as PageTemplateCreateRequestSchema,mk as PageTemplateCreateResponseSchema,dk as PageTemplateErrorCodeSchema,$e as PageTemplateIdSchema,In as PageTemplatePagePathSchema,rk as PageTemplatePromoteRequestSchema,lk as PageTemplatePromoteResponseSchema,xd as PageTemplateTaskSchema,Ro as PaletteInputsSchema,kG as PersistClarifyAnswersRequestSchema,AG as PersistClarifyAnswersResponseSchema,EG as PersistGeneratedSitemapDraftRequestSchema,TG as PersistGeneratedSitemapDraftResponseSchema,lq as PersistPreviewSessionRequestSchema,pq as PersistPreviewSessionResponseSchema,PG as PersistSiteDesignPlanRequestSchema,vG as PersistSiteDesignPlanResponseSchema,IG as PersistSiteSitemapDraftResponseSchema,yG as PersistSiteSitemapRequestSchema,RG as PersistSiteSitemapResponseSchema,bF as PersistSiteSnapshotRequestSchema,yF as PersistSiteSnapshotResponseSchema,CR as PositioningPrefillSchema,Sa as PositioningSourceSchema,_A as PrepareDesignerPageBodySchema,cF as PrepareDesignerPageResponseSchema,dO as PrepareSiteBuildInitialGenerationBaseRequestSchema,uO as PrepareSiteBuildInitialGenerationBaseResultSchema,AD as PrepareTemplateUpgradeStateRequestSchema,jf as PrepareTemplateUpgradeStateResponseSchema,MF as PrepareVersionPreviewRequestSchema,WR as PrepareVersionPreviewResponseSchema,Pc as ProductSearchAppConfigDraftSchema,io as ProductSearchAppSlugSchema,tw as ProductSearchContractFixtureSchema,Ng as ProductSearchDraftConfigSchema,Le as ProductSearchFieldNameSchema,Dg as ProductSearchFilterMetaSchema,oo as ProductSearchInteractionRequestSchema,vs as ProductSearchInteractionResponseSchema,ew as ProductSearchPopularTermsReadSchema,wc as ProductSearchPopularTermsSchema,Ug as ProductSearchRequestSchema,Gg as ProductSearchResponseSchema,Un as ProductSearchRouteIdSchema,Cg as ProductSearchValueShapeSchema,EF as PromoteSiteSnapshotRequestSchema,GR as PromoteSiteSnapshotResponseSchema,OF as PromoteTemplateUpgradeSnapshotRequestSchema,NF as PromoteTemplateUpgradeSnapshotResponseSchema,Nl as QualityRunningStatusSchema,zC as REFUSAL_COPY,GG as REST_API_ENDPOINTS,vy as ROOT_LAYOUT_METADATA_LOCALIZABLE_FIELD_PATHS,Cy as ROOT_LAYOUT_METADATA_MACHINE_FIELD_PATHS,iE as ReconcileSitePublishDomainOperationDataSchema,oE as ReconcileSitePublishDomainOperationResponseSchema,kF as RecordSnapshotVersionRequestSchema,AF as RecordSnapshotVersionResponseSchema,UD as RecordTemplateUpgradeEventRequestSchema,FD as RecordTemplateUpgradeEventResponseSchema,vD as RecordTemplateUpgradeFailureRequestSchema,CD as RecordTemplateUpgradeFailureResponseSchema,DD as RecordTemplateUpgradeSuccessRequestSchema,OD as RecordTemplateUpgradeSuccessResponseSchema,Q0 as RecoverDesignerPageProjectionRequestSchema,Z0 as RecoverDesignerPageProjectionResponseSchema,$u as RecoverDesignerPageProjectionResultSchema,vd as ReferencePagePatternSchema,us as ReferenceSignalsSchema,dR as RegisterMediaResourceReferenceRequestSchema,uR as RegisterMediaResourceReferenceResponseSchema,q1 as RegisterWorkflowTaskCommandRequestSchema,Ig as RegisterWorkflowTaskRequestSchema,ov as RegisterWorkspacePageCheckpointRequestSchema,vF as ReleaseTemplateUpgradeLockRequestSchema,CF as ReleaseTemplateUpgradeLockResponseSchema,B1 as ReplaceCrawlWorkflowTaskCommandRequestSchema,kg as ReplaceCrawlWorkflowTaskRequestSchema,K1 as ReplaceWorkflowTaskCommandRequestSchema,Tg as ReplaceWorkflowTaskRequestSchema,EN as ResolvedFieldSchema,XN as ResolvedFormFieldSchema,FG as RestApiMethodSchema,LF as RestoreSiteSnapshotResponseSchema,Aj as RootLayoutMetadataSchema,Pp as RouteGenerationCardSchema,yh as RuleEngineInputSchema,Ih as RuleEngineScoreRecordSchema,_o as RuleScoreDimensionKeySchema,Rh as RuleScoreDimensionSchema,An as SELECTABLE_SITE_LOCALE_CODES,EI as SITEMAP_RESOLVER_MAX_BLOCK_TARGETS,xI as SITEMAP_RESOLVER_MAX_PAGE_TARGETS,lO as SITE_BUILD_CONTEXT_FILE_PATH,pO as SITE_BUILD_CONTEXT_MAX_BYTES,dg as SITE_BUILD_STATUSES,xc as SITE_BUILD_STATUS_CODES,ug as SITE_DEPLOYMENT_STATUSES,Ec as SITE_DEPLOYMENT_STATUS_CODES,jo as SITE_DESIGN_DENSITY_IDS,Kt as SITE_DESIGN_NOTES_END,on as SITE_DESIGN_NOTES_START,Im as SITE_DESIGN_RADIUS_IDS,Vv as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,ku as SITE_EDIT_MATERIALIZATION_MAX_FILE_CONTENT_BYTES,Ni as SITE_EDIT_MATERIALIZATION_MAX_FILE_COUNT,ji as SITE_EDIT_MATERIALIZATION_MAX_TOTAL_CONTENT_BYTES,ac as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,XA as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,nf as SITE_EDIT_RUNTIME_CONTAINER_TAGS,sf as SITE_EDIT_RUNTIME_TEXT_TAGS,tf as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,qA as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,Md as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,sr as SITE_EDIT_SOURCE_ALLOWED_DIRS,jd as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,Ld as SITE_EDIT_SOURCE_ALLOWED_SYSTEM_FILES,Ti as SITE_EDIT_SOURCE_DELETE_CAPABILITY,Ud as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,jm as SITE_EXTRA_REQUIREMENT_MAX_LENGTH,vv as SITE_HAS_ACTIVE_SUBSITES_ERROR_CODE,Cv as SITE_HAS_SUBSITES_ERROR_CODE,hP as SITE_LEADING_BODY_TOKEN,SP as SITE_LEADING_HEADING_TOKEN_NAMES,tu as SITE_LOCALE_CODES,Tj as SITE_LOCALIZATION_STRUCTURES,KU as SITE_PLANNING_FROZEN_ERROR_CODE,BU as SITE_PLANNING_LOCKED_ERROR_CODE,$U as SITE_SITEMAP_DRAFT_OPERATION_MISMATCH_ERROR_CODE,VU as SITE_SITEMAP_DRAFT_STALE_ERROR_CODE,zU as SITE_STRUCTURE_CONFIRMATION_REQUIRED_ERROR_CODE,HU as SITE_STRUCTURE_CONFIRMATION_STALE_ERROR_CODE,hp as SITE_STRUCTURE_INVALID_ERROR_CODE,gP as SITE_WEIGHT_TOKEN_NAMES,zf as SITE_WORKFLOW_PROGRESS_STATUSES,Vf as SITE_WORKFLOW_PROGRESS_STEP_STATUSES,_g as SITE_WORKFLOW_STATUSES,Rc as SITE_WORKFLOW_STATUS_CODES,qG as SSE_STREAMS,lu as STEP5_KEYWORD_CATEGORIES,du as STEP5_OPTIONAL_STRATEGY_KEYS,ys as STEP5_REQUIRED_STRATEGY_COUNT,Pn as STEP5_REQUIRED_STRATEGY_KEYS,Ru as STEP5_SSE_EVENT_NAMES,De as STEP5_STRATEGY_COUNT,Qt as STEP5_STRATEGY_KEYS,_r as STEP5_STRATEGY_OPTION_IDS,wm as STEP6_AI_THEME_IDS,Mo as STEP6_AI_THEME_PRESETS,Pm as STEP6_GENERATED_THEME_ID_PATTERN,Sf as SUBSITE_GLOSSARY_ENTRY_MAX_CHARS,ff as SUBSITE_GLOSSARY_MAX_ENTRIES,Pf as SUBSITE_MOUNT_PATH_PATTERN,Rf as SUBSITE_PALETTE_NOTE_MAX_CHARS,vf as SUBSITE_RESERVED_MOUNT_SEGMENTS,r0 as SUPPORTED_SITE_LOCALES,as as SandboxSessionIdSchema,AT as SandboxSessionSchema,ad as SandboxSessionStatusSchema,eF as SaveBriefDraftRequestSchema,_F as SaveBriefDraftResponseSchema,UE as SaveGa4BindingDataSchema,qM as SaveGa4BindingRequestSchema,WM as SaveGa4BindingResponseSchema,fN as SaveSiteExtraRequirementRequestSchema,SG as SaveSiteSitemapDraftRequestSchema,fG as SaveSiteSitemapDraftResponseSchema,cR as SearchUnsplashMediaQuerySchema,mR as SearchUnsplashMediaResponseSchema,Np as SiteBreadcrumbPlacementSchema,sb as SiteBuildContextFileSchema,nb as SiteBuildContextPayloadSchema,tb as SiteBuildContextProvenanceSchema,eb as SiteBuildContextProvenanceSourceSchema,eo as SiteBuildStatusSchema,Dv as SiteDeletionBlockedDetailsSchema,to as SiteDeploymentStatusSchema,di as SiteDesignContextSchema,OR as SiteDesignDensitySchema,NR as SiteDesignMotionLevelSchema,Rn as SiteEditAdvisorySchema,Gs as SiteEditBoundaryKindSchema,ES as SiteEditCapabilityConstraintSchema,yS as SiteEditCapabilityModeSchema,Fs as SiteEditCapabilityModeViewSchema,Lv as SiteEditCapabilityReadRequestSchema,d_ as SiteEditClassNameSourceDiagnosticSchema,pt as SiteEditClassNameSourceRangeSchema,Qr as SiteEditClassNameSourceSchema,TA as SiteEditClassNameSourceStyleContextSchema,Xr as SiteEditClassNameSourceStylesheetSchema,Vi as SiteEditClassNameSourceWriteIntentSchema,yA as SiteEditCommandDiagnosticSchema,l_ as SiteEditCommandErrorSchema,B as SiteEditCompositionContextSchema,_e as SiteEditCompositionSelectorSchema,xS as SiteEditConstraintKindSchema,eg as SiteEditDeletePageSourceOutputSchema,VS as SiteEditDynamicConfidenceSchema,YS as SiteEditDynamicDataBindingSchema,lm as SiteEditDynamicDataDetailSchema,pm as SiteEditDynamicDataSummarySchema,$S as SiteEditDynamicEvidenceSchema,mm as SiteEditDynamicSourceKindSchema,zS as SiteEditDynamicSourceTypeSchema,HS as SiteEditDynamicTargetKindSchema,To as SiteEditEffectiveWriteTargetSchema,Kv as SiteEditEventSchema,yi as SiteEditExecutionSceneSchema,Ks as SiteEditExternalSourceKindSchema,PA as SiteEditGetClassNameSourceCommandResultSchema,AA as SiteEditGetClassNameSourceInputSchema,wA as SiteEditGetClassNameSourceResultSchema,TC as SiteEditGetDocumentInputSchema,kC as SiteEditGetObjectEditContextInputSchema,e0 as SiteEditGetSourceFileInputSchema,Jk as SiteEditGetSourceTreeInputSchema,kA as SiteEditGetStyleContextInputSchema,Ws as SiteEditHistoryProvenanceSchema,AS as SiteEditHistoryReadOnlyRecoveryStatusSchema,RS as SiteEditHistoryRecoveryCodeSchema,IS as SiteEditHistoryRecoveryDiagnosticSchema,Yv as SiteEditHistoryResultSchema,$v as SiteEditHistoryStatusModeSchema,PS as SiteEditHistoryStatusSchema,TS as SiteEditHistoryUnavailableReasonSchema,wS as SiteEditHistoryUnavailableStatusSchema,kS as SiteEditHistoryWritableStatusSchema,qC as SiteEditInitializeSessionInputSchema,Q_ as SiteEditInsertNodeSpecSchema,J_ as SiteEditInsertPageResourceOutputSchema,Du as SiteEditMaterializationDataRequirementsSchema,Cu as SiteEditMaterializationEntrySchema,vu as SiteEditMaterializationExportSchema,Pu as SiteEditMaterializationFileSchema,br as SiteEditMaterializationPathTemplateSchema,Ut as SiteEditMaterializationSchema,uc as SiteEditMaterializedComponentNodeSpecSchema,mc as SiteEditMoveTargetSchema,Nn as SiteEditMutationContextSchema,qs as SiteEditNodeCapabilitySnapshotSchema,wC as SiteEditObjectCapabilitiesSchema,vC as SiteEditObjectDetailSchema,DC as SiteEditObjectEditContextSchema,OC as SiteEditObjectStyleDetailSchema,CC as SiteEditObjectSummarySchema,d1 as SiteEditOperationCommandResultSchema,_c as SiteEditOperationErrorCodeSchema,gc as SiteEditOperationErrorSchema,tg as SiteEditOperationOutputSchema,Z_ as SiteEditOperationParamsSchema,Qi as SiteEditOperationPayloadSchema,Xi as SiteEditOperationRequestSchema,X_ as SiteEditOperationResultTargetSchema,en as SiteEditOperationSelectionRefSchema,BS as SiteEditOperationSummarySchema,Y_ as SiteEditOperationTargetSchema,Mn as SiteEditOperationTypeSchema,Wt as SiteEditOperationValueSchema,QA as SiteEditPageCompositionAnyVersionSchema,O_ as SiteEditPageCompositionAtomicKindSchema,M_ as SiteEditPageCompositionBoundaryModeSchema,T_ as SiteEditPageCompositionBusinessMemberSchema,R_ as SiteEditPageCompositionContainerSchema,Ln as SiteEditPageCompositionDiagnosticSchema,ws as SiteEditPageCompositionErrorCodeSchema,sc as SiteEditPageCompositionPlacementTargetSchema,k_ as SiteEditPageCompositionPlacementUnitSchema,C_ as SiteEditPageCompositionRuntimeRefSchema,v_ as SiteEditPageCompositionSchema,D_ as SiteEditPageCompositionSourceMemberKindSchema,I_ as SiteEditPageCompositionSourceMemberSchema,rc as SiteEditPageCompositionSourceRangeSchema,w_ as SiteEditPageCompositionSupportedSchema,P_ as SiteEditPageCompositionUnsupportedSchema,L_ as SiteEditPageCompositionV2BusinessMemberSchema,N_ as SiteEditPageCompositionV2ContainerSchema,F_ as SiteEditPageCompositionV2PlacementRelationSchema,q_ as SiteEditPageCompositionV2PlacementSchema,U_ as SiteEditPageCompositionV2PlacementUnitSchema,z_ as SiteEditPageCompositionV2Schema,j_ as SiteEditPageCompositionV2SourceMemberSchema,K_ as SiteEditPageCompositionV2SupportedSchema,B_ as SiteEditPageCompositionV2UnsupportedSchema,G_ as SiteEditPageCompositionV2WriteModeSchema,W_ as SiteEditPageCompositionVisualAnchorSchema,A_ as SiteEditPagePlacementOptionSchema,nc as SiteEditPagePlacementSchema,oc as SiteEditPageUnitResultTargetSchema,ic as SiteEditPageUnitTargetSchema,MS as SiteEditPatchPlanPatchSchema,oC as SiteEditPatchPlanSchema,ko as SiteEditPropertiesSchema,b_ as SiteEditPropertyChangeSchema,NS as SiteEditPropertyCreationSchema,DS as SiteEditPropertyItemSchema,vS as SiteEditPropertyResolutionSchema,CS as SiteEditPropertySourceSchema,OS as SiteEditPropertySpreadSchema,zn as SiteEditProvenanceChainSchema,ZS as SiteEditProvenanceHopSchema,AC as SiteEditRenderDocumentSchema,Bn as SiteEditRenderEntryRefSchema,XS as SiteEditRenderEntrySchema,cm as SiteEditRenderPageCompositionSchema,WS as SiteEditRenderPageCompositionSupportedSchema,KS as SiteEditRenderPageCompositionUnsupportedSchema,qS as SiteEditRenderPagePlacementSchema,WA as SiteEditRequiredMutationContextEnvelopeSchema,n0 as SiteEditResolveSourceLocationInputSchema,um as SiteEditSemanticSourceSchema,Jr as SiteEditSetPropsParamsSchema,p1 as SiteEditSignedOperationRequestSchema,ir as SiteEditSourceDeleteCapabilitySchema,Gd as SiteEditSourceDirectoryPathSchema,zd as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,Hd as SiteEditSourceFileBinaryResponseSchema,Qk as SiteEditSourceFileKindSchema,qd as SiteEditSourceFileListItemSchema,t0 as SiteEditSourceFileResponseSchema,Bd as SiteEditSourceFileTextResponseSchema,Yi as SiteEditSourceIdentitySchema,Vd as SiteEditSourceLocationRangeSchema,s0 as SiteEditSourceLocationSchema,ef as SiteEditSourceLocatorRangeSchema,Po as SiteEditSourceLocatorSchema,xe as SiteEditSourcePathSchema,or as SiteEditSourceTreeNodeSchema,Zk as SiteEditSourceTreeResponseSchema,Wd as SiteEditSourceTreeTruncationReasonSchema,Kd as SiteEditSourceTreeTruncationSchema,dc as SiteEditStyleBreakpointSchema,ec as SiteEditStyleDraftPropertySchema,PC as SiteEditStyleModelSchema,lc as SiteEditStylePropertySchema,_m as SiteEditStyleSourceSchema,pc as SiteEditStyleStateModeSchema,wo as SiteEditTextSegmentSchema,dm as SiteEditTextSourceSchema,QS as SiteEditWriteTargetSchema,bN as SiteExtraRequirementResponseSchema,Rb as SiteExtraRequirementSchema,pv as SiteGenerationLedgerResponseSchema,T as SiteIdSchema,Zf as SiteLauncherPermissionSchema,Ee as SiteLocaleSchema,nG as SiteMediaIntentSchema,MT as SiteOperationLockIdSchema,Wf as SitePreviewActivateErrorCodeSchema,Bf as SitePreviewActivateFailedSchema,Kf as SitePreviewActivateReadySchema,HD as SitePreviewActivateResponseSchema,aM as SitePublishDomainCheckDataSchema,oM as SitePublishDomainCheckRequestSchema,rM as SitePublishDomainCheckResponseSchema,cM as SitePublishDomainOperationDataSchema,mM as SitePublishDomainOperationResponseSchema,lM as SitePublishDomainReconcileOperationResponseSchema,pM as SitePublishDomainRemediationConfirmRequestSchema,dM as SitePublishDomainRemediationConfirmResponseSchema,mi as SitePublishQualityTaskStatusSchema,WL as SitePublishRepairInputItemSchema,zx as SitePublishRepairResultItemSchema,jl as SitePublishRepairResultSchema,KL as SitePublishRepairTaskSnapshotSchema,Ol as SitePublishRepairTaskStatusSchema,VL as SitePublishWorkflowActiveResponseSchema,rs as SitePublishWorkflowIdSchema,Vx as SitePublishWorkflowMutationDataSchema,$L as SitePublishWorkflowMutationResponseSchema,$x as SitePublishWorkflowPublishDataSchema,YL as SitePublishWorkflowPublishResponseSchema,Yx as SitePublishWorkflowQualityDataSchema,XL as SitePublishWorkflowQualityResponseSchema,Ct as SitePublishWorkflowRecordSchema,HL as SitePublishWorkflowRevisionRequestSchema,Ux as SitePublishWorkflowStatusSchema,Fx as SitePublishWorkflowStepSchema,Nt as SiteRecordSchema,FT as SiteTemplateUpgradeStateIdSchema,VG as SiteThreadListQuerySchema,$G as SiteThreadListResponseSchema,QG as SiteThreadResponseSchema,Ma as SiteVersionIdSchema,qR as SiteVersionListItemSchema,Si as SiteVersionRecordSchema,nt as SiteWorkflowIdSchema,Xf as SiteWorkflowProgressDataSchema,ZD as SiteWorkflowProgressResponseSchema,Hf as SiteWorkflowProgressStatusSchema,Yf as SiteWorkflowProgressStepSchema,$f as SiteWorkflowProgressStepStatusSchema,Rg as SiteWorkflowRecordSchema,N1 as SiteWorkflowSnapshotResponseSchema,so as SiteWorkflowSnapshotSchema,gg as SiteWorkflowStatusSchema,Fa as SiteWorkflowTaskRefIdSchema,j1 as SiteWorkflowTaskRefResponseSchema,kc as SiteWorkflowTaskRefSchema,pG as SitemapAddBlockInputSchema,Pa as SitemapAnswerSchema,mG as SitemapChangeBlockVariantInputSchema,TI as SitemapDeleteBlockInputSchema,dI as SitemapDraftBlockSchema,uI as SitemapDraftPageSchema,zp as SitemapDraftRecordSchema,un as SitemapDraftSchema,II as SitemapEditActorSchema,wI as SitemapEditErrorCodeSchema,vI as SitemapEditFailureSchema,AI as SitemapEditOperationSchema,uG as SitemapEditResultSchema,PI as SitemapEditSuccessSchema,gG as SitemapGenerationInputSchema,jI as SitemapGenerationOutcomeSchema,LI as SitemapGenerationReasonSchema,Fp as SitemapGenerationStageSchema,Te as SitemapIdSchema,CI as SitemapIntentPageSchema,rG as SitemapModelOutputSchema,gI as SitemapModelPageSchema,cG as SitemapMoveBlockInputSchema,lI as SitemapNavigationHrefSchema,Fe as SitemapNodeIdSchema,Bp as SitemapRecordSchema,oG as SitemapResolverRequestSchema,aG as SitemapResolverResponseSchema,RI as SitemapResolverTargetsSchema,Up as SitemapRunInputSchema,fn as SitemapSchema,SI as SitemapSourceProvenanceSchema,hG as SitemapStreamEventSchema,Yj as SitemapTaskCreateRequestSchema,eL as SitemapTaskCreateResponseSchema,ex as SitemapTaskFailureErrorCodeSchema,tL as SitemapTaskResponseSchema,kI as SitemapUpdateBlockInstructionInputSchema,lG as SitemapUpdateBlockPropsInputSchema,YR as SitemapUserChoiceSchema,Sn as SkillSelectionSchema,QR as SkillSelectionSourceSchema,Zp as SnapshotContentHashSchema,fd as SnapshotEditChangesSchema,Sd as SnapshotEditPageChangeSchema,hd as SnapshotEditSectionChangeSchema,Pe as SnapshotFilePathSchema,k as SnapshotIdSchema,yt as SnapshotRecordSchema,Ap as SnapshotStatusSchema,dv as StartFillInRequestSchema,gF as StartFillInResponseSchema,TE as StartGa4AuthDataSchema,OM as StartGa4AuthRequestSchema,NM as StartGa4AuthResponseSchema,da as StartGscAuthDataSchema,Ml as StartGscAuthRequestSchema,Ul as StartGscAuthResponseSchema,z1 as StartSiteBuildRequestSchema,_O as StartSiteBuildResponseSchema,ib as StartSiteBuildResultSchema,BL as StartSitePublishWorkflowRequestSchema,WG as StartWorkspaceRunRequestSchema,KG as StartWorkspaceRunResponseSchema,Nc as Step2AiCrawlabilityAssessmentSchema,eh as Step2FinalResultDataSourceSchema,Ds as Step2FinalResultRequestSchema,Ow as Step2FinalResultResponseSchema,Dw as Step2FinalResultSaveResponseSchema,Jg as Step2FinalResultSaveResultSchema,mo as Step2FinalResultTypeSchema,nh as Step2FinalResultViewSchema,Oc as Step2FinalScanCardKeySchema,lo as Step2FinalScanCardSchema,Zg as Step2FinalScanResultSchema,Hn as Step2KnowledgeOpaqueIdSchema,xO as Step2KnowledgeScopeSchema,It as Step2PageRoleSchema,Lw as Step2PageSelectionRequestSchema,Mw as Step2PageSelectionResponseSchema,Yg as Step2SiteInitializationCrawlerErrorCodeSchema,$g as Step2SiteInitializationStatusSchema,Cw as Step2SiteInitializationTaskResponseSchema,Xg as Step2SiteInitializationTaskSchema,po as Step3AgentAnalysisSchema,mh as Step3AnalysisFindingSchema,Bw as Step3AnalysisJobResponseSchema,Uc as Step3AnalysisJobSchema,Lc as Step3AnalysisJobStatusSchema,zw as Step3AnalysisLatestResponseSchema,jc as Step3AnalysisProgressSchema,dh as Step3AnalysisResultSchema,Kw as Step3AnalysisScheduleResponseSchema,ch as Step3AnalysisScheduleSchema,Hw as Step3AnalysisSseFrameSchema,qw as Step3AnalysisStartRequestSchema,Mc as Step3AnalysisSummarySchema,rh as Step3AnalystSchema,Ww as Step3AnalystsResponseSchema,Xw as Step4DiagnosisResponseSchema,xs as Step5ActiveStrategyKeySchema,k0 as Step5CommitStrategyRequestSchema,A0 as Step5CommitStrategyResponseSchema,xu as Step5CommittedVersionSchema,vn as Step5DecisionSelectionIdSchema,hu as Step5EvidenceReferenceSchema,Su as Step5GenerationStatusSchema,bu as Step5JobStatusSchema,pu as Step5KeywordCategorySchema,wn as Step5KeywordEntrySchema,Pi as Step5KeywordLibrarySchema,g0 as Step5KeywordSearchBodySchema,fs as Step5KeywordSelectionSchema,Is as Step5MarketCountrySchema,Rs as Step5MarketTypeSchema,ur as Step5OptionPresentationSchema,Ci as Step5OutputLocaleSchema,R0 as Step5RegenerateItemRequestSchema,I0 as Step5SaveDecisionRequestSchema,T0 as Step5SaveDecisionResponseSchema,DI as Step5SitemapDecisionSchema,NI as Step5SitemapRunInputSchema,OI as Step5SitemapSourceSchema,_G as Step5SitemapStartRequestSchema,x0 as Step5StartStrategyRequestSchema,E0 as Step5StartStrategyResponseSchema,fu as Step5StrategyDecisionInputSchema,Oi as Step5StrategyDecisionSchema,Di as Step5StrategyItemSchema,hr as Step5StrategyJobSchema,Es as Step5StrategyKeySchema,gr as Step5StrategyOptionIdSchema,uu as Step5StrategyOptionSchema,_u as Step5StrategyPlanSchema,Eu as Step5StrategySnapshotDataSchema,P0 as Step5StrategySseFrameSchema,yu as Step5StrategyVersionSnapshotSchema,gu as Step5StructureDetailSchema,gb as Step6AiThemeCandidateSchema,$s as Step6ColorSeedsSchema,mN as Step6DesignAgentRecommendationsResponseSchema,nN as Step6DesignRecommendationGenerationInputSchema,Go as Step6DesignRecommendationModelOutputSchema,hb as Step6DesignRecommendationSchema,ZO as Step6DesignRecommendationsRequestSchema,JO as Step6DesignRecommendationsResponseSchema,Nm as Step6DesignSelectionSchema,Om as Step6GeneratedThemeCardSchema,xb as Step6GptDesignRecommendationModelOutputSchema,mv as StopWorkspaceGenerationRequestSchema,lv as StopWorkspaceGenerationResponseSchema,mD as SubsiteCopyEstimateRequestSchema,lD as SubsiteCopyEstimateResponseSchema,tD as SubsiteGlossariesSchema,yf as SubsiteGlossaryEntrySchema,Bs as SubsiteHexColorSchema,RD as SubsiteMountPathSchema,sD as SubsitePaletteLocalizationSchema,xf as SubsitePaletteModeSchema,Ef as SubsitePaletteSeedsSchema,nD as SubsiteSiteInfoSchema,uD as SubsiteSyncDiffComputeRequestSchema,_D as SubsiteSyncDiffComputeResponseSchema,Af as SubsiteSyncDiffErrorCodeSchema,gD as SubsiteSyncDiffErrorResponseSchema,bD as SubsiteVisibleTextExportRequestSchema,yD as SubsiteVisibleTextExportResponseSchema,pg as TASK_EXECUTION_STATUSES,Ic as TASK_EXECUTION_STATUS_CODES,DF as TEMPLATE_UPGRADE_LOCK_LOST_ERROR_CODE,Uo as THEME_PRESETS,Am as THEME_PRESET_IDS,yc as TaskExecutionStatusSchema,Ff as TemplateUpgradeCasOutcomeSchema,Sm as TemplateUpgradeErrorCodeSchema,Gf as TemplateUpgradeOutcomeCountsSchema,Mf as TemplateUpgradeOutcomeSchema,qf as TemplateUpgradeSnapshotDeletionCandidateSchema,mn as TemplateUpgradeStateSchema,Of as TemplateUpgradeStatusSchema,Uf as TemplateUpgradeValidationStageSchema,Xe as TemplateVersionSchema,wF as TryAcquireTemplateUpgradeLockRequestSchema,PF as TryAcquireTemplateUpgradeLockResponseSchema,Qh as TypeInputsSchema,df as USER_STOPPED_RUN_ERROR_CODES,cp as UnsplashDownloadLocationSchema,rp as UnsplashMediaAssetSchema,JU as UpdateBriefRequestSchema,uF as UpdateBriefResponseSchema,wG as UpdateClarifyArchetypeRequestSchema,iA as UpdateCmsSeoSyncStateRequestSchema,xF as UpdateCurrentSnapshotManifestRequestSchema,nA as UpdatePageDirectoryReconcileStateRequestSchema,zL as UpdateSitePublishWorkflowStepRequestSchema,ZU as UpdateSiteRequestSchema,XG as UpdateSiteThreadRequestSchema,M1 as UpdateSiteWorkflowWebsiteRequestSchema,eN as UpdateStep6DesignSelectionRequestSchema,tN as UpdateStep6DesignSelectionResponseSchema,W1 as UpdateWorkflowTaskStatusRequestSchema,oR as UploadMediaLibraryAssetResponseSchema,DL as UpstreamPromptTemplateCatalogDataSchema,CL as UpstreamPromptTemplateConsumeDataSchema,Ky as UrlListCrawlerTaskCreateRequestSchema,GT as UsageRecordIdSchema,lR as UseUnsplashMediaRequestSchema,pR as UseUnsplashMediaResponseSchema,PT as UserIdSchema,lE as VCP_GSC_STATES,pa as VcpGscStateSchema,qx as VcpQualityRemediationItemSchema,Dl as VcpQualityResultSchema,ba as VisualHintsSchema,$R as VisualThemeSchema,Kh as WEIGHT_STYLE_IDS,Hc as WEIGHT_STYLE_PRESETS,O1 as WORKFLOW_DEFINITIONS_V1,no as WORKFLOW_DEFINITION_REGISTRY,cg as WORKFLOW_FLOW_TYPES,hg as WORKFLOW_MENU_STATES,mg as WORKFLOW_NODE_CODES,lg as WORKFLOW_TASK_TYPES,lw as WORKSPACE_ATTACHMENT_BOUND_ERROR_CODE,Sw as WORKSPACE_ATTACHMENT_CAPTURE_BUDGET_ERROR_CODE,gw as WORKSPACE_ATTACHMENT_CAPTURE_BUSY_ERROR_CODE,_w as WORKSPACE_ATTACHMENT_CAPTURE_FAILED_ERROR_CODE,hw as WORKSPACE_ATTACHMENT_CAPTURE_TIMEOUT_ERROR_CODE,fw as WORKSPACE_ATTACHMENT_CAPTURE_UNAVAILABLE_ERROR_CODE,mw as WORKSPACE_ATTACHMENT_LIMIT_ERROR_CODE,qg as WORKSPACE_ATTACHMENT_MEDIA_TYPES,aw as WORKSPACE_ATTACHMENT_TARGET_BASE64_BYTES,cw as WORKSPACE_ATTACHMENT_TOO_LARGE_ERROR_CODE,ow as WORKSPACE_ATTACHMENT_UNBOUND_TTL_MS,rw as WORKSPACE_ATTACHMENT_UNSUPPORTED_FORMAT_ERROR_CODE,uw as WORKSPACE_ATTACHMENT_URL_REJECTED_ERROR_CODE,YP as WORKSPACE_CHECK_INCOMPLETE_ERROR_CODE,dx as WORKSPACE_FILE_MUTATION_TOOL_NAMES,QP as WORKSPACE_FILL_IN_INTERRUPTED_ERROR_CODE,XP as WORKSPACE_GENERATION_STOPPED_ERROR_CODE,VP as WORKSPACE_MAX_PAGE_ATTEMPTS,HP as WORKSPACE_MAX_RESUME_COUNT,zP as WORKSPACE_RUN_HEARTBEAT_INTERVAL_MS,BP as WORKSPACE_RUN_LEASE_MS,ZP as WORKSPACE_RUN_LEASE_SUPERSEDED_ERROR_CODE,JP as WORKSPACE_RUN_NOT_ACTIVE_ERROR_CODE,$P as WORKSPACE_RUN_RESUME_EXHAUSTED_ERROR_CODE,dw as WORKSPACE_URL_CAPTURE_WINDOW_MS,nq as WORKSPACE_WEBSOCKET_CONTRACT,qe as WeightStyleIdSchema,fc as WorkflowClientCapabilitiesSchema,Tc as WorkflowDefinitionVersionSchema,tn as WorkflowFlowTypeSchema,Eg as WorkflowMenuItemSchema,Sg as WorkflowMenuStateSchema,Rt as WorkflowNodeCodeSchema,bc as WorkflowTaskTypeSchema,yw as WorkspaceAttachmentFromUrlRequestSchema,ro as WorkspaceAttachmentMediaTypeSchema,bw as WorkspaceAttachmentSchema,mT as WorkspaceClientMessageSchema,gR as WorkspaceDesignApplyRequestSchema,hR as WorkspaceDesignApplyResponseSchema,SR as WorkspaceDesignCurrentResponseSchema,Ca as WorkspaceDiagnosticSchema,fT as WorkspaceDirectEditFileSchema,ST as WorkspaceDirectEditPathSchema,nd as WorkspaceDirectEditPostActionSchema,oq as WorkspaceDirectEditRequestSchema,rq as WorkspaceDirectEditResponseSchema,Da as WorkspaceExecutionDiagnosticsSchema,CG as WorkspaceExecutionPlanSchema,nr as WorkspaceGenerationLedgerEventSchema,kn as WorkspaceGenerationLedgerSchema,hT as WorkspaceMediaRequestSchema,Id as WorkspaceOmissionKindSchema,Td as WorkspaceOmissionReasonSchema,tr as WorkspaceOmissionSchema,nm as WorkspacePageCheckpointSchema,Ad as WorkspacePageOutcomeSchema,kd as WorkspacePageResultSchema,ja as WorkspacePlanDependencySchema,$p as WorkspacePlanSummarySchema,HI as WorkspacePlanTaskKindSchema,Na as WorkspacePlanTaskSchema,sg as WorkspaceResourceKindSchema,og as WorkspaceResourceNavigationSelectionSchema,Sc as WorkspaceResourceOperationClientMessageSchema,ig as WorkspaceResourceOperationSummarySchema,ag as WorkspaceResourceOperationTransientInputSchema,rv as WorkspaceRunControlInputResponseSchema,sv as WorkspaceRunHeartbeatRequestSchema,iv as WorkspaceRunHeartbeatResponseSchema,fi as WorkspaceRunKindSchema,uS as WorkspaceRunResumePrincipalSchema,cT as WorkspaceSelectedComponentSchema,pT as WorkspaceServerMessageSchema,dG as WorkspaceSitemapEditRequestSchema,rT as WorkspaceSocketDescriptorSchema,IT as WorkspaceSourceFileBinaryResponseSchema,ET as WorkspaceSourceFileKindSchema,id as WorkspaceSourceFileListItemSchema,cq as WorkspaceSourceFilePathQuerySchema,mq as WorkspaceSourceFileResponseSchema,RT as WorkspaceSourceFileTextResponseSchema,sd as WorkspaceSourcePathSchema,GI as WorkspaceSuggestionSchema,Hp as WorkspaceSuggestionsSchema,qI as WorkspaceSuggestionsSourceSchema,Yp as WorkspaceTaskCountsSchema,tq as WorkspaceWebSocketMessageSchema,eq as WorkspaceWebSocketMessageTypeSchema,Oa as WorkspaceWorkerGroupSchema,va as WorkspaceWorkerPhaseSchema,DG as WorkspaceWorkerResultSchema,Vt as WorkspaceWorkerStatusSchema,NN as applicationTemplateCatalogDataSchema,ON as applicationTemplateConsumeDataSchema,DN as applicationTemplateV1Schema,iP as assertDeploymentTransition,HM as assertFillInTargetsOmitted,X1 as assertSiteBuildStatusTransition,Y1 as assertTaskExecutionStatusTransition,yo as availableFontWeights,Kj as buildCmsIdentityHeaders,BM as buildE2bBrowserPreviewUrl,QL as buildFinalSitePublishQualityResult,sN as buildStep6FallbackThemeCards,sO as canEnterLauncher,iO as canPublishSite,ia as canonicalizeFormDesignJson,OL as canonicalizeLauncherPromptTemplateOperation,$r as canonicalizePageSlug,LP as checkGlobalsCssEdit,$i as classifySiteEditPropertyName,V0 as cmsPagePreviewUrlPath,D0 as compareTemplateVersions,rC as composeSiteEditRepeatInstanceKey,Ej as computeFormDesignOperationFingerprint,Ii as computeSiteEditCompositionKey,E_ as computeSiteEditSourceIdentityKey,os as containsSensitiveData,Ik as countLedgerAccessiblePages,Tk as countLedgerProcessedPages,$E as countSitemapStructure,p_ as createSiteEditCommandFailureSchema,Yr as createSiteEditCommandResultSchema,Hi as createSiteEditCommandSuccessSchema,bG as createSiteSitemapDraftCreationKey,Aw as createSitemapResolverAnswerSheetSchema,oN as defaultStep6Selection,uE as deriveVcpGscState,_E as doesGscPropertyMatchDomain,ZE as estimateNavLabelWidth,wg as findWorkflowDefinition,Ag as findWorkflowDefinitionInRegistry,So as fontStack,Ay as formDesignOperationFingerprintInput,Jh as formatSiteDesignNotes,oP as getDeploymentHappyPathTransitions,nP as getDeploymentTransitionPredecessors,tP as getDeploymentTransitionTargets,zc as getFontPairing,km as getMotionPreset,vm as getSiteDesignThemeRadius,Ai as getSiteEditSourceDeleteProtectionReason,Xx as getSitePublishRepairItems,qO as getThemePreset,Pg as getWorkflowDefinition,V1 as getWorkflowNodeIndex,gk as hasAnyBusinessFact,Kn as hasDesignTokenBlock,oD as hasLockedSeeds,xj as hashAffectedFormDesignFiles,yj as hashCmsFormSchemaProjection,ni as hashFormDesignJson,bj as hashFormSpec,KE as homeLabelForLocale,EL as isCanonicalFileMutationToolName,Hr as isCanonicalPageSlug,Jf as isCmsMainProductsWithinLimit,fR as isCmsNavigationHref,H0 as isCmsPageSelectable,Tr as isCmsTemplateUrlPath,jk as isConsentGranted,wh as isDeploymentActiveStatus,sP as isDeploymentTerminalStatus,gf as isExactEditEngineVersion,VT as isExternalSiteEditInfrastructureReason,ij as isFormSpecLocalizableFieldPath,w0 as isKnownStep5SseEventName,kv as isMigrationProductsPresetBlockLabel,Tv as isMigrationProductsPresetPageTitle,ux as isModelFileMutationToolName,l0 as isNonLatinSiteLocale,ms as isPageTemplateCandidateEntryPath,jj as isPlatformMaterializedFile,Df as isReservedSubsiteMountSegment,Yd as isSiteEditDesignDocumentPath,wu as isSiteEditMaterializationPathTemplate,mf as isSiteEditRuntimeContainerTag,lf as isSiteEditRuntimeTextTag,jC as isSiteEditRuntimeVoidElementTag,i0 as isSiteEditSourceDeleteProtectedPath,$d as isSiteEditSourceDirectoryPath,ar as isSiteEditSourcePath,ki as isSiteEditTextSourcePath,Qx as isSitePublishRepairResultSuccessful,vj as isSiteStructureKnownFieldPath,Pj as isSiteStructureLocalizableFieldPath,y0 as isStep5RequiredStrategyKey,pi as isTopLevelPage,BC as isUserStoppedRunErrorCode,$1 as isWorkflowTaskTypeForNode,xL as isWorkspaceFileMutationToolName,Vl as listChildPages,FS as makeSiteEditRepeatInstanceKey,zE as markAllPagesInHeader,Iv as migrationProductsCopyForLocale,BE as moreLabelForLocale,JE as navLabelCollisionKey,WN as normalizeCmsApplicationSlug,qy as normalizeCmsPublicApiBase,Zm as normalizeFormOptionLabelIdentity,ss as normalizeGscDomain,Ya as normalizePageTemplatePagePath,li as normalizeStructureTitle,VE as orderNavigationLinksByStructure,$l as orderSitemapPagesForDisplay,m_ as pageSlugToRouteFilePath,$0 as parseCmsPageDirectory,hv as parseComponentI18nResourcesJson,FE as parseE2bPreviewProxyDomain,hf as parseExactEditEngineVersion,Hk as parseSiteEditCompositionKey,GS as parseSiteEditRepeatInstanceKey,zA as parseSiteEditSourceIdentityKey,co as parseWorkspaceAttachmentImagePath,lj as projectFormSpecToCmsSchema,lS as readColorScheme,js as readDesignTokens,DP as readGlobalsDesignValues,Yc as readSiteDesignNotes,Ew as readWorkspaceAttachmentReferences,GE as reconcileSitemapNavigation,qj as resolveCmsPublicRuntimeBinding,Nh as resolveFont,nn as resolveFontDisplayName,mj as resolveFormTemplateText,H1 as resolvePublishedWorkflowDefinition,xk as resolveRedisConnectionConfig,QC as resolveRequestedEditEngineVersion,pr as resolveSelectableSiteLocale,LC as resolveSiteEditRuntimeOperationSummary,m0 as resolveSiteLocaleFromIso6393,c0 as resolveSiteTextDirection,fb as resolveStep6RadiusId,bb as resolveStep6WeightStyle,ZC as resolveSystemCurrentEditEngineVersion,zN as resolveTemplateFormScene,yP as resolveTryOnFontWeights,vg as selectPublishedWorkflowDefinition,Wk as selectReferenceVisualImage,T1 as siteBuildStatusFromCode,P1 as siteBuildStatusToCode,k1 as siteDeploymentStatusFromCode,v1 as siteDeploymentStatusToCode,qh as siteFontVariables,Yh as siteLeadingBody,bP as siteLeadingHeadingVariables,fP as siteWeightVariables,A1 as siteWorkflowStatusFromCode,C1 as siteWorkflowStatusToCode,bf as splitSubsiteGlossaryEntry,yb as step6GptVisualIdentity,IP as stripSiteDesignNotes,cC as stripSiteEditRepeatInstanceKeys,w1 as taskExecutionStatusFromCode,D1 as taskExecutionStatusToCode,iN as toStep6GenerationVisualHints,Vr as tryCanonicalizeAsciiPageSlug,TP as upsertSiteDesignNotes,am as validateComponentI18nResources,oj as validateFormSpecIdentityTransition,YE as validateSitemapStructure,xw as workspaceAttachmentImagePath,CP as writeColorScheme,vP as writeDesignTokens};
9
+ ${e}`;let c=o.index+o[0].length;return`${e.slice(0,c)}
10
+ ${i}
11
+ ${e.slice(c)}`}var rn="/* <cms-builder:global-design-tokens> */",Bn="/* </cms-builder:global-design-tokens> */",Fe=class extends Error{constructor(n,i){super(`${n}: ${i}`),this.code=n,this.name="DesignTokenBlockError"}};function lS(e){let n=[],i=0;for(;i<e.length;){let s=e.indexOf(rn,i),a=e.indexOf(Bn,i);if(s<0){if(a>=0)throw new Fe("DESIGN_TOKEN_BLOCK_MISSING","a closing global-design-tokens marker appears without a matching opening marker.");break}if(a<0||a<s)throw new Fe("DESIGN_TOKEN_BLOCK_MISSING","a global-design-tokens region is opened but never closed.");let o=s+rn.length,c=e.indexOf(rn,o);if(c>=0&&c<a)throw new Fe("DESIGN_TOKEN_BLOCK_MISSING","global-design-tokens regions are nested; refusing to guess the intended boundaries.");n.push({bodyStart:o,bodyEnd:a}),i=a+Bn.length}if(n.length===0)throw new Fe("DESIGN_TOKEN_BLOCK_MISSING","app/globals.css does not contain a cms-builder:global-design-tokens region.");return n}var pS=/^--[A-Za-z0-9_-]+/;function dS(e){return e===void 0||e==="{"||e==="}"||e===";"||/\s/.test(e)}function em(e,n,i){let s=[],a=n,o=0;for(;a<i;){let c=e[a];if(c==="/"&&e[a+1]==="*"){let r=e.indexOf("*/",a+2);a=r<0||r>=i?i:r+2;continue}if(c==='"'||c==="'"){a=tm(e,a,i);continue}if(c==="("){o+=1,a+=1;continue}if(c===")"){o=Math.max(0,o-1),a+=1;continue}if(c==="-"&&o===0&&e[a+1]==="-"&&dS(a===0?void 0:e[a-1])){let r=pS.exec(e.slice(a,i));if(r){let l=r[0],x=a+l.length;for(;x<i&&(e[x]===" "||e[x]===" ");)x+=1;if(e[x]===":"){for(x+=1;x<i&&(e[x]===" "||e[x]===" ");)x+=1;let h=x,C=uS(e,h,i),H=e.slice(h,C).trimEnd();s.push({name:l,value:H.trim(),valueStart:h,valueEnd:h+H.length}),a=C;continue}}}a+=1}return s}function tm(e,n,i){let s=e[n],a=n+1;for(;a<i;){let o=e[a];if(o==="\\"){a+=2;continue}if(o===s)return a+1;a+=1}return i}function uS(e,n,i){let s=n,a=0;for(;s<i;){let o=e[s];if(o==="\\"){s+=2;continue}if(o==='"'||o==="'"){s=tm(e,s,i);continue}if(o==="/"&&e[s+1]==="*"){let c=e.indexOf("*/",s+2);s=c<0||c>=i?i:c+2;continue}if(o==="(")a+=1;else if(o===")")a=Math.max(0,a-1);else if(a===0&&(o===";"||o==="}"))return s;s+=1}return i}function nm(e){return lS(e).flatMap(n=>em(e,n.bodyStart,n.bodyEnd))}function gS(e){return new Set(em(e,0,e.length).map(n=>n.name))}var _S=/[;{}]|\/\*|\*\/|[\r\n]/;function hS(e,n){if(n.trim().length===0)throw new Fe("DESIGN_TOKEN_UNSAFE_VALUE",`refusing to write an empty declaration value for ${e}.`);if(_S.test(n))throw new Fe("DESIGN_TOKEN_UNSAFE_VALUE",`refusing to write a declaration value for ${e} that contains a declaration or block terminator, a comment marker, or a newline.`)}function Mi(e){let n=new Map;for(let i of nm(e))n.set(i.name,i.value);return n}function VP(e,n,i={}){let s=nm(e),a=new Set(s.map(h=>h.name)),o=new Set,c=new Set,r=[],l=null;for(let h of n.keys())if(!a.has(h)){if(i.derivedKeys?.has(h)!==!0){r.push(h);continue}l??=gS(e),l.has(h)?c.add(h):o.add(h)}if(r.length>0)throw new Fe("DESIGN_TOKEN_UNKNOWN",`refusing to add token names that the shared derivation never produces: ${r.join(", ")}`);for(let[h,C]of n)a.has(h)&&hS(h,C);for(let h of o)i.onOutOfScopeToken?.(h);for(let h of c)i.onUnwritableToken?.(h);let x=e;for(let h=s.length-1;h>=0;h-=1){let C=s[h],K=n.get(C.name);K!==void 0&&(x=x.slice(0,C.valueStart)+K+x.slice(C.valueEnd))}return x}function Kn(e){let n=e.indexOf(rn),i=e.indexOf(Bn);return n!==-1&&i!==-1&&i>n}var im=/(color-scheme:\s*)(light|dark)(\s*;)/;function SS(e){let n=e.indexOf(rn),i=e.indexOf(Bn);return n!==-1&&i>n?e.slice(n,i):null}function fS(e){let i=SS(e)?.match(im);return i?i[2]:null}function YP(e,n){let i=e.indexOf(rn),s=e.indexOf(Bn);if(i===-1||s===-1||s<i)throw new Fe("DESIGN_TOKEN_BLOCK_MISSING","globals.css has no design token block");let a=e.slice(i,s);return e.slice(0,i)+a.replace(im,`$1${n}$3`)+e.slice(s)}var bS=/["']([^"']+)["']/;function Jc(e){return e?.match(bS)?.[1]??null}function XP(e){if(!Kn(e))return null;let n;try{n=Mi(e)}catch(l){if(l instanceof Fe)return null;throw l}let i=fa(n.get("--primary")??"")?.toLowerCase()??null,s=fa(n.get("--accent")??"")?.toLowerCase()??null,a=Jc(n.get("--site-font-heading")),o=Jc(n.get("--site-font-sans")),c=Zc(e),r=c?.paletteInputs??null;return{primary:i,accent:s,...r?.foreground!==void 0?{foreground:r.foreground}:{},...r?.neutral!==void 0?{neutral:r.neutral}:{},...r?.supporting!==void 0?{supporting:r.supporting}:{},...r?.imagePalette!==void 0?{imagePalette:r.imagePalette}:{},surfaceMode:fS(e),fonts:a&&o?{heading:sn(a),body:sn(o)}:null,paletteInputs:r,paletteInputsPresent:r!=null,notesLines:c?.lines??null,weightStyle:n.has("--site-weight-display")&&c?.typeInputs?c.typeInputs.weightStyle:null}}var Ui=(e,n)=>e.split(n).length-1;function yS(e){let n=0,i=0,s=0,a=e.length;for(;s<a;){let o=e[s];if(o==="/"&&e[s+1]==="*"){let c=e.indexOf("*/",s+2);s=c===-1?a:c+2;continue}if(o==='"'||o==="'"){let c=o;for(s+=1;s<a;){if(e[s]==="\\"){s+=2;continue}if(e[s]===c){s+=1;break}s+=1}continue}o==="{"?n+=1:o==="}"&&(i+=1),s+=1}return{open:n,close:i}}var sm=e=>{let{open:n,close:i}=yS(e);return n===i};function eC(e,n){if(sm(e)&&!sm(n))return{ok:!1,code:"GLOBALS_CSS_UNBALANCED",message:"app/globals.css has unbalanced braces."};if(Kn(e)&&!Kn(n))return{ok:!1,code:"GLOBALS_CSS_TOKEN_BLOCK_MISSING",message:"Keep the /* <cms-builder:global-design-tokens> */ and /* </cms-builder:global-design-tokens> */ markers in app/globals.css."};if(Ui(e,on)===Ui(e,Kt)&&Ui(n,on)!==Ui(n,Kt))return{ok:!1,code:"GLOBALS_CSS_NOTES_UNPAIRED",message:"The site design notes comment must keep both of its markers."};if(Kn(e)){let s=null;try{s=Mi(e)}catch(o){if(!(o instanceof Fe))throw o}let a;try{a=Mi(n)}catch(o){if(o instanceof Fe)return{ok:!1,code:"GLOBALS_CSS_TOKEN_BLOCK_MALFORMED",message:`app/globals.css design token block is malformed: ${o.message}`};throw o}if(s){let o=[...s.keys()].filter(c=>!a.has(c));if(o.length>0)return{ok:!1,code:"GLOBALS_CSS_TOKEN_REMOVED",message:`Do not delete design tokens from app/globals.css; change their values instead. Removed: ${o.slice(0,8).join(", ")}`}}}return{ok:!0}}import{z as q}from"zod";var rC="x-vcp-run-lease-owner",cC=600*1e3,mC=60*1e3,lC=3,pC=2,dC="WORKSPACE_RUN_RESUME_EXHAUSTED",uC="WORKSPACE_CHECK_INCOMPLETE",gC="WORKSPACE_GENERATION_STOPPED",_C="WORKSPACE_FILL_IN_INTERRUPTED",hC="WORKSPACE_RUN_LEASE_SUPERSEDED",SC="WORKSPACE_RUN_NOT_ACTIVE",fC="FILL_IN_NOT_AVAILABLE",bC="FILL_IN_TARGET_NOT_OMITTED",yC="FILL_IN_TARGET_MODIFIED",xS=q.object({authMode:q.enum(["disabled-dev","internal-service","oidc"]),user_id:q.string().min(1),external_user_id:q.string().min(1).optional(),email:q.string().min(1).optional(),display_name:q.string().min(1).optional()}).strict(),xC=q.object({run_id:$,lease_owner:q.string().min(1),lease_ms:q.number().int().positive().max(1800*1e3).optional()}).strict(),EC=q.object({status:q.enum(["renewed","not_active","superseded"]),expires_at:q.string().min(1).nullable(),stop_requested:q.boolean()}).strict(),am=q.object({run_id:$,page_id:q.string().min(1),attempt:q.number().int().positive(),snapshot_id:I,object_key:q.string().min(1),manifest_hash:q.string().min(1),file_paths:q.array(q.string().min(1)).min(1),created_at:q.string().min(1)}).strict(),RC=am.omit({created_at:!0}).extend({lease_owner:q.string().min(1)}).strict(),IC=q.object({checkpoints:q.array(am)}).strict(),om=q.object({kind:q.enum(["page","component","shared"]),target_id:q.string().min(1)}).strict(),TC=q.object({run_id:$,site_id:k,tenant_id:q.string().min(1),run_kind:q.enum(["initial_generation","iteration","landing_page","fill_in"]),status:q.enum(["queued","running","succeeded","failed","cancelled"]),base_snapshot_id:I.nullable(),lease_owner:q.string().min(1).nullable(),resume_count:q.number().int().nonnegative(),stop_requested:q.boolean(),reuse_from_run_id:$.nullable(),source_run_id:$.nullable(),fill_in_targets:q.array(om),execution_scene:Es.nullable().optional(),intent:q.literal("navigation_adaptation").optional(),page_template_manifest:Jo.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"})}),kC=q.object({runs:q.array(q.object({run_id:$,site_id:k,tenant_id:q.string().min(1),run_kind:q.literal("initial_generation"),base_snapshot_id:I,sitemap_id:ke,resume_count:q.number().int().nonnegative(),lease_owner:q.string().min(1),stop_requested:q.boolean(),resume_principal:xS}).strict())}).strict(),AC=q.object({site_id:k}).strict(),wC=q.object({status:q.enum(["requested","already_requested","stopped","no_active_run"]),run_id:$.nullable()}).strict(),PC=q.object({ledger:An.nullable(),source_run_id:$.nullable(),updated_at:q.string().min(1).nullable()}).strict(),CC=q.object({targets:q.array(om).min(1).max(50),client_run_key:q.string().min(1).max(400)}).strict();import{z as ES}from"zod";var OC=".i18n.json",Fi="translation",rm=new Set(["__proto__","constructor","prototype"]);function mm(e){if(!Gi(e)||Object.keys(e).length===0)return wt("I18N_ROOT_INVALID","Component i18n resources must be a non-empty object.",[]);for(let[n,i]of Object.entries(e)){if(rm.has(n))return cm([n]);if(!RS(n))return wt("I18N_LOCALE_INVALID",`Component i18n locale must be canonical BCP-47: ${n}`,[n]);if(!Gi(i))return wt("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let s=Object.keys(i);if(s.length!==1||s[0]!==Fi)return wt("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let a=i[Fi];if(!Gi(a))return wt("I18N_RESOURCE_TREE_INVALID",`Component i18n translation namespace for ${n} must be an object.`,[n,Fi]);let o=[{value:a,path:[n,Fi]}];for(;o.length>0;){let c=o.pop();for(let[r,l]of Object.entries(c.value)){let x=[...c.path,r];if(rm.has(r))return cm(x);if(typeof l!="string"){if(!Gi(l))return wt("I18N_RESOURCE_TREE_INVALID","Component i18n resource leaves must be strings.",x);o.push({value:l,path:x})}}}}return{success:!0,data:e}}function NC(e){let n;try{n=JSON.parse(e)}catch{return wt("I18N_JSON_INVALID","Component i18n resource file must contain valid JSON.",[])}return mm(n)}var jC=ES.custom(e=>mm(e).success,"Invalid component i18n resources.");function RS(e){try{let n=Intl.getCanonicalLocales(e);return n.length===1&&n[0]===e}catch{return!1}}function Gi(e){if(typeof e!="object"||e===null||Array.isArray(e))return!1;let n=Object.getPrototypeOf(e);return n===Object.prototype||n===null}function cm(e){return wt("I18N_RESOURCE_KEY_FORBIDDEN",`Component i18n resource key is forbidden: ${e.at(-1)??""}`,e)}function wt(e,n,i){return{success:!1,error:{code:e,message:n,path:i}}}var St="products",IS=`/${St}`,MC=IS,UC=`${St} detail`,FC="cms_collection_view",GC="list",qC="detail",ze={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"},ru:{pageTitle:"\u041F\u0440\u043E\u0434\u0443\u043A\u0446\u0438\u044F",blockLabel:"\u041E\u0431\u0437\u043E\u0440 \u043F\u0440\u043E\u0434\u0443\u043A\u0446\u0438\u0438",detailBlockLabel:"\u041E \u043F\u0440\u043E\u0434\u0443\u043A\u0442\u0435",heroBlockLabel:"\u041D\u0430\u0448\u0430 \u043F\u0440\u043E\u0434\u0443\u043A\u0446\u0438\u044F",homeLabel:"\u0413\u043B\u0430\u0432\u043D\u0430\u044F"}},TS=new Set(Object.values(ze).map(e=>e.pageTitle)),kS=new Set(Object.values(ze).flatMap(e=>[e.blockLabel,e.detailBlockLabel,e.heroBlockLabel]));function WC(e){let n=e?.trim().toLowerCase()??"";if(n==="zh-tw"||n==="zh-hk"||n==="zh-mo")return ze.zhHant;if(n.startsWith("zh"))return ze.zhHans;switch(n.split("-")[0]){case"de":return ze.de;case"fr":return ze.fr;case"es":return ze.es;case"ja":return ze.ja;case"ko":return ze.ko;case"ru":return ze.ru;case"en":default:return ze.en}}function BC(){return Object.values(ze)}function KC(e){return TS.has(e.trim())}function zC(e){return kS.has(e.trim())}var AS="4rem",wS="0.75rem",PS="2rem";function CS(e){if(e?.variant!=="floating")return"container pt-8";let n=[PS,AS];return e.shape==="island"&&n.push(wS),`container pt-[calc(${n.join("+")})]`}function $C(e){return`// Auto-generated by connect_dynamic_collection \u2014 do not edit by hand.
12
+ import { Fragment } from "react";
13
+ import Link from "next/link";
14
+ import type { CmsSeo } from "@/lib/cms";
15
+ import {
16
+ Breadcrumb,
17
+ BreadcrumbItem,
18
+ BreadcrumbLink,
19
+ BreadcrumbList,
20
+ BreadcrumbPage,
21
+ BreadcrumbSeparator,
22
+ } from "@/components/ui/breadcrumb";
23
+
24
+ interface DetailBreadcrumbProps {
25
+ seo: CmsSeo | null;
26
+ title: string;
27
+ }
28
+
29
+ export default function DetailBreadcrumb({ seo, title }: DetailBreadcrumbProps) {
30
+ // \u540E\u53F0\u914D\u4E86\u5C42\u7EA7\u5C31\u7528\u540E\u53F0\u7684\uFF1B\u6CA1\u914D\u624D\u7528\u5E73\u53F0\u4E24\u7EA7\u515C\u5E95\u3002\u672B\u7EA7\u6052\u4E3A\u5F53\u524D\u8BB0\u5F55\u6807\u9898\u4E14\u4E0D\u662F
31
+ // \u94FE\u63A5\u2014\u2014\u5B83\u5C31\u662F\u5F53\u524D\u9875\u3002
32
+ const configured = (seo?.breadcrumbs ?? []).flatMap((item) => {
33
+ const name = (item.name ?? item.text ?? "").trim();
34
+ return name ? [{ name, href: item.url ?? null }] : [];
35
+ });
36
+ const trail =
37
+ configured.length > 0
38
+ ? configured
39
+ : [
40
+ { name: ${JSON.stringify(e.homeLabel)}, href: "/" },
41
+ { name: ${JSON.stringify(e.collectionLabel)}, href: ${JSON.stringify(e.detailPrefix)} },
42
+ ];
43
+
44
+ return (
45
+ <Breadcrumb className="${CS(e.headerShell)}">
46
+ <BreadcrumbList>
47
+ {trail.map((item) => (
48
+ <Fragment key={item.name}>
49
+ <BreadcrumbItem>
50
+ {item.href ? (
51
+ <BreadcrumbLink asChild>
52
+ <Link href={item.href}>{item.name}</Link>
53
+ </BreadcrumbLink>
54
+ ) : (
55
+ <span>{item.name}</span>
56
+ )}
57
+ </BreadcrumbItem>
58
+ <BreadcrumbSeparator />
59
+ </Fragment>
60
+ ))}
61
+ <BreadcrumbItem>
62
+ <BreadcrumbPage>{title}</BreadcrumbPage>
63
+ </BreadcrumbItem>
64
+ </BreadcrumbList>
65
+ </Breadcrumb>
66
+ );
67
+ }
68
+ `}import{z as cn}from"zod";var QC="SITE_HAS_ACTIVE_SUBSITES",ZC="SITE_HAS_SUBSITES",vS=cn.object({site_id:k,name:cn.string().min(1),mount_path:cn.string().min(1),archived_at:cn.string().nullable()}),JC=cn.object({subsites:cn.array(vS)});import{z as we}from"zod";var iv=we.object({key:we.string().min(1),composition:_e}).strict(),Wi=we.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),DS=we.enum(["direct","proxy","upstream","readonly","unsupported"]),OS=we.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),qi=we.object({mode:DS,reasonCode:we.string().min(1).optional()}),NS=we.object({kind:OS,message:we.string().min(1)}),Bi=we.object({composition:B,key:we.string().min(1),canUpdateText:we.boolean(),canInsertChild:we.boolean(),canMove:we.boolean(),canRemove:we.boolean(),editModes:we.object({updateText:qi.optional(),insertChild:qi.optional(),move:qi.optional(),remove:qi.optional()}).optional(),constraints:we.array(NS)}).strict();import{z as X}from"zod";var lv=X.discriminatedUnion("type",[X.object({type:X.literal("site-edit.document.changed"),siteId:k,snapshotId:I,composition:B,version:X.number().int().nonnegative(),at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.operation.planned"),siteId:k,operationId:X.string().min(1),baseSnapshotId:I,composition:B,changedFiles:X.array(X.string().min(1)),at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.operation.completed"),siteId:k,composition:B,result:ea,at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.operation.failed"),siteId:k,composition:B,requestId:X.string().min(1),error:fc,at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.capability.changed"),siteId:k,composition:B,keys:X.array(X.string().min(1)),at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.graph.invalidated"),siteId:k,composition:B,at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.graph.ready"),siteId:k,composition:B,version:X.number().int().nonnegative(),at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.graph.error"),siteId:k,composition:B,message:X.string().min(1),at:X.string().min(1)}).strict(),X.object({type:X.literal("site-edit.snapshot.changed"),siteId:k,composition:B,snapshotId:I,previousSnapshotId:X.string().min(1).nullable(),at:X.string().min(1)}).strict()]);import{z as ce}from"zod";var gv="durable-history-v1",Ki=ce.object({initiatingComposition:B.optional(),affectedCompositions:ce.array(B)}).strict(),_v=ce.enum(["writable","read-only-recovery","unavailable"]),jS=ce.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),LS=ce.object({code:jS,message:ce.string().min(1),occurredAt:ce.iso.datetime().optional()}).strict(),MS=ce.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),lm={revision:ce.number().int().nonnegative(),undoDepth:ce.number().int().nonnegative(),redoDepth:ce.number().int().nonnegative()},US=ce.object({mode:ce.literal("writable"),composition:B,...lm,canUndo:ce.boolean(),canRedo:ce.boolean(),provenance:Ki.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."})}),FS=ce.object({mode:ce.literal("read-only-recovery"),composition:B,...lm,canUndo:ce.literal(!1),canRedo:ce.literal(!1),recoveryDiagnostic:LS,provenance:Ki.optional()}).strict(),GS=ce.object({mode:ce.literal("unavailable"),composition:B,revision:ce.literal(0),undoDepth:ce.literal(0),redoDepth:ce.literal(0),canUndo:ce.literal(!1),canRedo:ce.literal(!1),reason:MS,provenance:Ki.optional()}).strict(),qS=ce.discriminatedUnion("mode",[US,FS,GS]),hv=ce.object({composition:B,status:qS,provenance:Ki}).strict();import{z as V}from"zod";var zi=V.enum(["api-field","cms-field","i18n-message","config-entry"]),Aa=V.object({kind:V.enum(["jsx-node","value-path","route-export","external-entry"]),file:V.string().min(1).optional(),isProxy:V.boolean(),displayPath:V.string().min(1).optional(),sourceType:zi.optional(),sourceId:V.string().min(1).optional()}),WS=V.discriminatedUnion("status",[V.object({status:V.literal("resolved"),value:Bt}).strict(),V.object({status:V.literal("undefined")}).strict(),V.object({status:V.literal("unresolved")}).strict()]),BS=V.object({kind:V.enum(["literal","boolean-shorthand","expression","binding","repeat-template"]),raw:V.string().optional()}).strict(),KS=V.object({name:V.string().min(1),source:BS,resolution:WS,editMode:V.enum(["direct","proxy","upstream","readonly","unsupported"]),sourceScope:V.enum(["node","repeat-item","repeat-template"]),allowedWriteScopes:V.array(V.enum(["selection","template"])),effectiveWriteTarget:Aa.optional(),diagnostics:V.array(V.object({code:V.string().min(1),message:V.string().min(1)}).strict())}).strict(),zS=V.object({raw:V.string().min(1),sourceRange:dt,order:V.number().int().nonnegative(),diagnostics:V.array(V.object({code:V.string().min(1),message:V.string().min(1)}).strict())}).strict(),HS=V.object({selection:V.enum(["direct","materialize","unsupported"]),template:V.enum(["direct","unsupported"])}).strict(),wa=V.object({documentVersion:V.number().int().nonnegative(),selectionRef:tn.optional(),items:V.array(KS),spreads:V.array(zS),creation:HS}).strict().superRefine((e,n)=>{let i=e.selectionRef;i&&i.instanceIndex!==void 0&&i.instanceCount!==void 0&&i.instanceIndex>=i.instanceCount&&n.addIssue({code:"custom",path:["selectionRef","instanceIndex"],message:"instanceIndex must be smaller than instanceCount"})});import{z as Pe}from"zod";var $S=Pe.string().min(1).refine(e=>!e.startsWith("/")&&!e.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),VS=Pe.string().regex(/^sha256:[a-f0-9]{64}$/),YS=Pe.object({path:$S,operation:Pe.enum(["create","update","delete"]),expectedHash:VS.optional(),fullContent:Pe.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"})}),XS=Pe.object({siteId:k,baseSnapshotId:I,operationId:Pe.string().min(1),reason:Pe.string().min(1),patches:Pe.array(YS).min(1),changedCompositions:Pe.array(B),changedRouteIds:Pe.array(Pe.string().min(1)).optional(),diagnostics:Pe.array(Pe.object({code:Pe.string().min(1),message:Pe.string().min(1),path:Pe.string().min(1).optional()})).default([])}).strict().superRefine((e,n)=>{let i=new Set;for(let[a,o]of e.patches.entries())i.has(o.path)&&n.addIssue({code:"custom",path:["patches",a,"path"],message:`Duplicate patch path: ${o.path}`}),i.add(o.path);let s=[...new Set(e.changedCompositions.map(a=>a.routeId))];e.changedRouteIds!==void 0&&(e.changedRouteIds.length!==s.length||e.changedRouteIds.some((a,o)=>a!==s[o]))&&n.addIssue({code:"custom",path:["changedRouteIds"],message:"changedRouteIds must be the stable deduplicated route projection of changedCompositions."})}),kv=XS.transform(e=>({...e,changedRouteIds:[...new Set(e.changedCompositions.map(n=>n.routeId))]}));var Pa="::repeat-item#";function QS(e,n){return`${e}${Pa}${n}`}function wv(e,n){return n.reduce((i,s)=>QS(i,s),e)}function ZS(e){if(typeof e!="string"||e.length===0)return null;let n=[],i=e;for(;;){let s=i.lastIndexOf(Pa);if(s<0)break;let a=Number(i.slice(s+Pa.length));if(!Number.isInteger(a)||a<0)return null;n.unshift({repeatIndex:a}),i=i.slice(0,s)}return!i||n.length===0?null:{baseKey:i,parts:n}}function Pv(e){return ZS(e)?.baseKey??e??null}import{z as m}from"zod";import{z as Le}from"zod";var JS=Le.object({placementKey:Le.string().min(1),placementUnitKey:Le.string().min(1),relation:Le.enum(["before","after","prepend","append"])}).strict(),ef=Le.object({status:Le.literal("supported"),containerKey:Le.string().min(1),hasBusinessMembers:Le.boolean(),placementUnitKeys:Le.array(Le.string().min(1)),placements:Le.array(JS)}).strict().superRefine((e,n)=>{let i=new Set(e.placementUnitKeys);i.size!==e.placementUnitKeys.length&&n.addIssue({code:"custom",path:["placementUnitKeys"],message:"Render page composition placement unit keys must be unique."});let s=new Set;e.placements.forEach((a,o)=>{s.has(a.placementKey)&&n.addIssue({code:"custom",path:["placements",o,"placementKey"],message:"Render page composition placement keys must be unique."}),s.add(a.placementKey),i.has(a.placementUnitKey)||n.addIssue({code:"custom",path:["placements",o,"placementUnitKey"],message:"Render page composition placement must reference a projected unit."})})}),tf=Le.object({status:Le.literal("unsupported"),reason:Ci,diagnostics:Le.array(Mn)}).strict(),pm=Le.discriminatedUnion("status",[ef,tf]);var nf=m.object({canUpdateText:m.boolean(),canInsertChild:m.boolean(),canMove:m.boolean(),canRemove:m.boolean()}),dm=m.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),sf=m.enum(["cms-field","api-field"]),af=m.enum(["text","attribute","richtext","repeat-region","conditional-region","component-prop"]),of=m.enum(["exact","safe-derived","partial","unknown"]),rf=m.object({file:m.string().min(1),symbol:m.string().min(1).optional(),reason:m.string().min(1)}),cf=m.object({sourceKind:dm,sourceType:sf,endpointPattern:m.string().min(1).optional(),operation:m.string().min(1).optional(),collection:m.string().min(1).optional(),fieldPath:m.string().min(1).optional(),valuePath:m.string().min(1).optional(),targetKind:af,targetName:m.string().min(1),confidence:of,readonly:m.literal(!0),evidence:m.array(rf)}),um=m.object({hasDynamicData:m.boolean(),bindings:m.array(cf)}),gm=m.object({hasDynamicData:m.boolean(),sourceKinds:m.array(dm),collections:m.array(m.string().min(1)).min(1).optional(),primaryEndpoint:m.string().min(1).optional(),primaryCollection:m.string().min(1).optional(),primaryFieldPath:m.string().min(1).optional()}),mf=m.discriminatedUnion("kind",[m.object({kind:m.literal("route-unit")}).strict(),m.object({kind:m.literal("source-siblings"),siblingKeys:m.array(m.string().min(1)).min(2)}).strict(),m.object({kind:m.literal("unavailable")}).strict()]),lf=m.object({key:m.string().min(1),parentKey:m.string().min(1).nullable().optional(),pageCompositionUnitKey:m.string().min(1).optional(),pageCompositionActionScope:mf.optional(),operationSummary:nf,dynamicDataSummary:gm.optional()}).strict(),Hv=m.object({composition:_e}).strict(),$v=m.object({key:m.string().min(1),composition:_e,selectionRef:tn.optional()}).strict(),Vv=m.object({siteId:k,snapshotId:I,composition:B,version:m.number().int().nonnegative(),entries:m.array(lf),pageComposition:pm}).strict(),_m=m.object({kind:m.enum(["literal","binding","imported-binding","repeat-template"]),file:m.string().min(1),expression:m.string().min(1),bindingName:m.string().min(1).optional(),path:m.array(m.union([m.string(),m.number()])).optional()}),Ca=m.object({index:m.number().int().min(0),value:m.string(),editable:m.boolean(),source:_m.nullable()}),zn=m.object({key:m.string().min(1),label:m.string().min(1),tag:m.string().min(1)}),Yv=m.object({composition:B,key:m.string().min(1),canUpdateText:m.boolean(),canInsertChild:m.boolean(),canMove:m.boolean(),canRemove:m.boolean(),boundaryKind:Wi.nullable(),isOpaque:m.boolean()}).strict(),pf=m.object({kind:m.enum(["jsx-node","component-proxy","value-binding","route-export"]),file:m.string().min(1),componentName:m.string().min(1),isProxy:m.boolean()}),hm=m.object({kind:m.union([m.enum(["jsx-literal","component-prop","binding","imported-binding","object-field","array-item","repeat-template","conditional-branch"]),zi]),file:m.string().min(1),displayPath:m.string().min(1),externalSource:m.object({sourceType:zi,sourceId:m.string().min(1),adapterId:m.string().min(1).optional()}).optional()}),df=m.object({kind:hm.shape.kind,file:m.string().min(1),displayName:m.string().min(1),canEditHere:m.boolean()}),Hn=m.object({finalSource:hm.nullable(),chain:m.array(df),confidence:m.enum(["exact","safe-derived","partial","unknown"]),editMode:m.enum(["direct","proxy","upstream","readonly","unsupported"]),diagnostics:m.array(m.object({code:m.string().min(1),message:m.string().min(1)}))}),uf=m.object({kind:m.literal("css-style-model"),properties:m.array(m.object({property:dc,value:m.union([m.string(),m.number(),m.boolean(),m.null()]),resolvedValue:m.union([m.string(),m.number(),m.boolean(),m.null()]).optional(),breakpoint:gc.optional(),state:uc.optional(),variants:m.array(m.string().min(1)).optional(),options:m.array(m.union([m.string(),m.number()])).optional(),editable:m.boolean(),diagnostics:m.array(m.object({code:m.string().min(1),message:m.string().min(1)})).optional(),operationBoundary:m.array(Un).optional()}))}),Xv=m.union([m.record(m.string(),m.unknown()),uf]),Sm=m.object({kind:m.literal("class-name-source"),className:m.string(),sourceKind:m.enum(["missing","static-attribute","static-expression","dynamic-expression"]),editable:m.boolean(),operationBoundary:m.array(Un),sourcePath:m.string().min(1).optional(),diagnostics:m.array(m.object({code:m.enum(["missing-class-name","dynamic-binding","non-string-binding"]),message:m.string().min(1)})).optional()}),gf=m.object({startLine:m.number().int().positive(),startColumn:m.number().int().nonnegative(),endLine:m.number().int().positive(),endColumn:m.number().int().nonnegative()}),va=m.object({sourceFile:m.string().min(1),componentName:m.string().min(1),openingElementRange:gf,structuralPath:m.string().min(1),textPreview:m.string().min(1).optional()}),Qv=m.object({composition:B,key:m.string().min(1),tag:m.string().min(1),componentName:m.string().min(1),sourceFile:m.string().min(1),sourceLocator:va.optional(),label:m.string().min(1),capabilities:Bi,writeTarget:pf,effectiveWriteTarget:Aa.optional(),provenanceChain:Hn.optional(),componentSemantic:m.record(m.string(),m.unknown()).optional(),styleSource:Sm.optional(),conditional:m.record(m.string(),m.unknown()).optional(),dynamicData:um.optional(),properties:wa.optional(),textSegments:m.array(Ca),boundaryKind:Wi.nullable(),isOpaque:m.boolean(),ancestors:m.array(zn),children:m.array(zn),siblings:m.array(zn)}).strict(),Zv=m.object({composition:B,key:m.string().min(1),tag:m.string().min(1),label:m.string().min(1),sourceLocator:va.optional(),capabilities:m.object({constraints:Bi.shape.constraints}),isOpaque:m.boolean(),provenanceChain:m.object({editMode:Hn.shape.editMode,diagnostics:Hn.shape.diagnostics}).optional(),dynamicDataSummary:gm.optional(),ancestors:m.array(zn)}).strict(),Jv=m.object({composition:B,key:m.string().min(1),tag:m.string().min(1),label:m.string().min(1),sourceLocator:va.optional(),isOpaque:m.boolean(),ancestors:m.array(zn),componentName:m.string().min(1),sourceFile:m.string().min(1),capabilities:Bi,provenanceChain:m.object({editMode:Hn.shape.editMode,diagnostics:Hn.shape.diagnostics}).optional(),textSegments:m.array(m.object({index:Ca.shape.index,editable:Ca.shape.editable,sourceKind:_m.shape.kind.nullable()})),dynamicData:um.optional(),properties:wa.optional(),boundaryKind:Wi.nullable()}).strict(),eD=m.object({composition:B,key:m.string().min(1),styleSource:Sm.optional()}).strict();var _f=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],hf=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],Sf=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],ff=new Set(_f),bf=new Set(hf),yf=new Set(Sf),xf={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function nD(e){return ff.has(Da(e))}function Ef(e){return bf.has(Da(e))}function Rf(e){return yf.has(Da(e))}function iD(e){let{operationSummary:n}=e;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:e.fallbackMode!=="preview"?{...xf}:{canUpdateText:Rf(e.tagName),canInsertChild:Ef(e.tagName),canMove:!1,canRemove:!1}}function Da(e){return e?.trim().toLowerCase()??""}import{z as If}from"zod";var cD=If.object({composition:_e,mutationContext:jn.optional()}).strict();var lD={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.",SITE_SITEMAP_DRAFT_STALE:"The draft was updated elsewhere. Reload the latest draft before saving.",SITE_SITEMAP_DRAFT_OPERATION_MISMATCH:"This save identity belongs to a different draft operation.",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."},Tf=["WORKSPACE_RUN_CANCELLED","WORKSPACE_GENERATION_STOPPED"],kf=new Set(Tf);function pD(e){return typeof e=="string"&&kf.has(e)}var dD={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."},uD={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},gD={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var fm="0.10.24",hD="x-vcp-edit-engine-version",SD="x-vcp-edit-engine-version-source",Oa=class extends Error{constructor(n="Invalid edit-engine version."){super(n),this.code="EDIT_ENGINE_VERSION_INVALID",this.name="EditEngineVersionParseError"}},Af=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/;function wf(e){return Af.test(e)}function Pf(e){if(typeof e!="string"||!wf(e))throw new Oa;return e}function fD(e){return e==null?{version:fm,source:"fallback_current"}:{version:Pf(e),source:"explicit"}}function bD(){return{version:fm,source:"system_current"}}import{z as et}from"zod";var Cf=200,vf=200;function Df(e){let n=e.indexOf(":");if(n<=0)return null;let i=e.slice(0,n).trim(),s=e.slice(n+1).trim();return i.length===0||s.length===0?null:{source:i,target:s}}var Of=et.string().min(3).max(Cf).refine(e=>Df(e)!==null,{message:'glossary entries must be "source:target" pairs split on a half-width colon, e.g. "\u7C73:Rice"'}),ED=et.array(Of).max(vf),RD=et.object({website_name:et.string().min(1).max(200),website_industry:et.string().min(1).max(200).optional(),website_description:et.string().min(1).max(1e3).optional()}),Nf=et.enum(["regional","fonts_only"]),Hi=et.string().regex(/^#[0-9a-fA-F]{6}$/,'color must be a "#rrggbb" value'),jf=et.object({primary:Hi.optional(),accent:Hi.optional(),foreground:Hi.optional(),neutral:Hi.optional()}),Lf=600,ID=et.object({mode:Nf.default("regional"),seeds:jf.optional(),note:et.string().min(1).max(Lf).optional()}),TD={mode:"regional"};function kD(e){return e===void 0?!1:Object.values(e).some(n=>typeof n=="string"&&n.length>0)}import{z as zt}from"zod";var Mf=12,CD=zt.object({tenant_id:zt.string().min(1),site_id:k,snapshot_id:I,manifest_hash:zt.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:zt.string().min(1).max(2048)}),$i=zt.number().int().nonnegative().safe(),vD=zt.object({page_count:$i,translation_character_count:$i,image_estimate:zt.object({media_key_count:$i,max_replacement_count:$i})}).superRefine((e,n)=>{let{media_key_count:i,max_replacement_count:s}=e.image_estimate;s!==Math.min(i,Mf)&&n.addIssue({code:"custom",path:["image_estimate","max_replacement_count"],message:"max replacement count does not match the deterministic ceiling"})});import{z as ue}from"zod";var Uf=ue.string().trim().min(1),mn=ue.string().uuid(),Ff=ue.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"),bm=ue.object({snapshot_id:mn,object_key:Ff}),ND=ue.object({tenant_id:Uf,parent_site_id:mn,subsite_site_id:mn,base:bm,target:bm}),Gf=ue.object({page_path:ue.string().min(1),page_route:ue.string().min(1).describe("\u4E3B\u7AD9\u76EE\u6807\u5FEB\u7167\u7684\u9875\u9762\u8DEF\u7531\uFF1A\u4F18\u5148 PAGE_SEO.path\uFF0C\u7F3A\u5931\u65F6\u7531\u6587\u4EF6\u8DEF\u7531\u63A8\u5BFC\uFF1B\u52A8\u6001\u9875\u4FDD\u7559\u8DEF\u7531\u6A21\u677F\uFF0C\u4E0D\u542B\u57DF\u540D\u6216\u5B50\u7AD9\u6302\u8F7D\u524D\u7F00\u3002"),page_title:ue.string().nullable().describe("\u4E3B\u7AD9\u76EE\u6807\u5FEB\u7167\u4E2D\u7684\u9759\u6001 PAGE_SEO.title\uFF1B\u7F3A\u5931\u6216\u52A8\u6001\u503C\u8FD4\u56DE null\uFF0C\u4E0D\u67E5\u8BE2 CMS \u6807\u9898\u8986\u76D6\u3002"),ai_image_count:ue.number().int().nonnegative().safe().describe("\u9875\u9762\u5F15\u7528\u7684\u5A92\u4F53\u6CE8\u518C\u8868 key \u6570\u91CF\uFF0C\u9875\u5185\u53BB\u91CD\uFF0C\u4E0D\u9650 12 \u5F20\uFF1B\u8868\u793A\u53EF\u4F9B AI \u91CD\u65B0\u751F\u6210\u7684\u5019\u9009\u56FE\u7247\u6570\u3002"),translation_character_count:ue.number().int().nonnegative().safe().describe("\u6574\u9875\u53EF\u9759\u6001\u63D0\u53D6\u7684\u6587\u6848\u53CA\u76F8\u5173\u56FE\u7247 alt\uFF0C\u539F\u6587\u53BB\u91CD\u540E\u7684 UTF-16 \u5B57\u7B26\u6570\uFF0C\u4E0D\u6263\u9664\u5386\u53F2\u8BD1\u6587\u3002")}),qf={page_count:ue.number().int().nonnegative().safe().describe("\u65B0\u589E\u9875\u9762\u6570\u91CF\uFF0C\u7B49\u4E8E pending_pages \u957F\u5EA6\u3002"),ai_image_count:ue.number().int().nonnegative().safe().describe("\u9010\u9875\u5019\u9009\u56FE\u7247\u6570\u91CF\u4E4B\u548C\uFF0C\u8DE8\u9875\u4E0D\u53BB\u91CD\uFF0C\u4E0D\u8868\u793A\u5DF2\u7531 AI \u751F\u6210\u7684\u56FE\u7247\u6570\u3002"),translation_character_count:ue.number().int().nonnegative().safe().describe("\u9010\u9875\u9884\u4F30\u7FFB\u8BD1\u5B57\u7B26\u6570\u4E4B\u548C\uFF0C\u8DE8\u9875\u4E0D\u53BB\u91CD\uFF0C\u4E0D\u8868\u793A\u5B9E\u9645\u7FFB\u8BD1\u6D88\u8017\u3002"),page_estimates:ue.array(Gf)};function Wf(e,n){let i=new Set(e.pending_pages),s=new Set(e.page_estimates.map(a=>a.page_path));(i.size!==e.pending_pages.length||s.size!==e.page_estimates.length||i.size!==s.size||[...i].some(a=>!s.has(a)))&&n.addIssue({code:"custom",path:["page_estimates"],message:"page_estimates must correspond to pending_pages exactly once"});for(let[a,o]of[["page_count",e.pending_pages.length],["ai_image_count",e.page_estimates.reduce((c,r)=>c+r.ai_image_count,0)],["translation_character_count",e.page_estimates.reduce((c,r)=>c+r.translation_character_count,0)]])e[a]!==o&&n.addIssue({code:"custom",path:[a],message:"total must equal the sum of page estimates"})}var jD=ue.object({...qf,subsite_site_id:mn,pending_pages:ue.array(ue.string().min(1)),hash_diverged_count:ue.number().int().nonnegative(),child_only_count:ue.number().int().nonnegative(),base_snapshot_id:mn,target_snapshot_id:mn}).superRefine(Wf),Bf=ue.enum(["SUBSITE_DIFF_REQUEST_INVALID","SUBSITE_DIFF_STORE_NOT_CONFIGURED","SUBSITE_DIFF_MANIFEST_MISSING","SUBSITE_DIFF_MANIFEST_INVALID","SUBSITE_DIFF_ESTIMATE_INVALID"]),LD=ue.object({error_code:Bf,message:ue.string().min(1),side:ue.enum(["base","target"]).optional()});import{z as J}from"zod";var GD=J.object({tenant_id:J.string().min(1),site_id:k,snapshot_id:I,manifest_hash:J.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:J.string().min(1).max(2048),page_slug:J.string().max(512).optional()}),qD=J.object({site_id:k,snapshot_id:I,unit_count:J.number().int().nonnegative(),file_count:J.number().int().nonnegative(),markdown:J.string().min(1),page_slug:J.string().optional(),page_file:J.string().optional(),entries:J.array(J.object({id:J.string().min(1),file_path:J.string().min(1),line:J.number().int().nullable(),kind:J.string().min(1),text:J.string(),media_key:J.string().optional()})).optional(),images:J.array(J.object({id:J.string().min(1),source:J.enum(["media-registry","source-literal"]),src:J.string().min(1),alt:J.string().nullable(),media_key:J.string().optional(),width:J.number().optional(),height:J.number().optional(),provider:J.string().optional(),is_placeholder:J.boolean(),occurrences:J.array(J.object({file_path:J.string().min(1),line:J.number().int()}))})).optional()});import{z as Kf}from"zod";var zf=/^\/[a-z0-9][a-z0-9-]{0,30}$/,Hf=Object.freeze(["api","_next","assets","static","robots.txt","sitemap.xml",".well-known"]),$f=new Set(Hf);function Vf(e){return $f.has(e)}var KD=Kf.string().regex(zf).refine(e=>!Vf(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 he}from"zod";var Yf=he.enum(["active","paused","blocked"]),ym=he.enum(["typecheck_failed","health_failed","validation_failed"]),Xf={status:Yf,attempts:he.number().int().nonnegative(),attempted_template_version:Ze.nullable(),last_error_code:ym.nullable()},ln=he.object(Xf).strict(),Vi=he.object({template_id:he.string().trim().min(1),target_template_version:Ze}).strict(),VD=Vi,Qf=he.discriminatedUnion("action",[he.object({action:he.literal("proceed"),state:ln.extend({status:he.literal("active")})}).strict(),he.object({action:he.literal("skip_not_newer"),state:ln.extend({status:he.literal("active")})}).strict(),he.object({action:he.literal("skip_paused"),state:ln.extend({status:he.literal("paused")})}).strict(),he.object({action:he.literal("skip_blocked"),state:ln.extend({status:he.literal("blocked")})}).strict()]),YD=Vi,XD=Qf,QD=Vi.extend({error_code:ym}),ZD=he.object({state:ln}).strict(),JD=Vi,eO=he.object({state:ln}).strict();import{z as Y}from"zod";var Zf=744*60*60*1e3,Jf=Y.enum(["eligible","fast_path","upgraded","skipped","lock_skipped","cas_aborted","validation_failed","blocked","paused"]),eb=Y.enum(["typecheck","build","health","validation"]),tb=Y.enum(["not_attempted","promoted","aborted"]),aO=Y.object({template_id:Y.string().trim().min(1).max(128),from_version:Ze.nullable(),to_version:Ze,outcome:Jf,attempt:Y.number().int().nonnegative().max(2147483647),duration_ms:Y.number().int().nonnegative().max(2147483647),replaced_group_count:Y.number().int().nonnegative().max(2147483647),skipped_group_count:Y.number().int().nonnegative().max(2147483647),validation_stage:eb.nullable(),cas_outcome:tb.nullable()}).strict(),oO=Y.object({recorded:Y.literal(!0)}).strict(),xm=Y.object({from:Y.iso.datetime(),to:Y.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)<=Zf,{message:"report window must not exceed 31 days",path:["to"]}),rO=xm,nb=Y.object({eligible:Y.number().int().nonnegative(),fast_path:Y.number().int().nonnegative(),upgraded:Y.number().int().nonnegative(),skipped:Y.number().int().nonnegative(),lock_skipped:Y.number().int().nonnegative(),cas_aborted:Y.number().int().nonnegative(),validation_failed:Y.number().int().nonnegative(),blocked:Y.number().int().nonnegative(),paused:Y.number().int().nonnegative()}).strict(),cO=Y.object({window:xm,outcome_counts:nb,current_state_counts:Y.object({blocked:Y.number().int().nonnegative(),paused:Y.number().int().nonnegative()}).strict(),duration_ms:Y.object({p50:Y.number().int().nonnegative().nullable(),p95:Y.number().int().nonnegative().nullable(),sample_count:Y.number().int().nonnegative()}).strict()}).strict(),mO=Y.object({older_than:Y.iso.datetime(),limit:Y.coerce.number().int().min(1).max(200).default(50),include_candidates:Y.enum(["true","false"]).default("false").transform(e=>e==="true")}).strict(),ib=Y.object({site_id:k,snapshot_id:I,status:Y.enum(["candidate","deleting"]),created_at:Y.iso.datetime()}).strict(),lO=Y.object({snapshots:Y.array(ib)}).strict();import{z as ft}from"zod";var sb=ft.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"]),ab=ft.object({status:ft.literal("ready"),preview_url:ft.string().url()}).strict(),ob=ft.object({status:ft.literal("failed"),code:sb,message:ft.string().min(1),retryable:ft.boolean()}).strict(),uO=ft.discriminatedUnion("status",[ab,ob]);import{z as Pt}from"zod";var rb=["not_started","active","completed"],cb=Pt.enum(rb),mb=["not_started","in_progress","completed"],lb=Pt.enum(mb),pb=Pt.object({sequence:Pt.number().int().positive(),code:It,status:lb}).strict(),db=Pt.object({site_id:k,workflow_status:cb,flow_type:nn.nullable(),current_step_code:It.nullable(),completed_count:Pt.number().int().nonnegative(),total_count:Pt.number().int().nonnegative(),steps:Pt.array(pb)}).strict().superRefine((e,n)=>{let i=e.steps.filter(s=>s.status==="completed").length;e.total_count!==e.steps.length&&n.addIssue({code:"custom",path:["total_count"],message:"total_count must equal steps.length."}),e.completed_count!==i&&n.addIssue({code:"custom",path:["completed_count"],message:"completed_count must equal completed steps."}),e.steps.forEach((s,a)=>{s.sequence!==a+1&&n.addIssue({code:"custom",path:["steps",a,"sequence"],message:"Step sequence must be continuous and start at 1."})}),e.workflow_status==="not_started"&&(e.flow_type!==null&&n.addIssue({code:"custom",path:["flow_type"],message:"not_started progress cannot have a flow_type."}),e.current_step_code!==null&&n.addIssue({code:"custom",path:["current_step_code"],message:"not_started progress cannot have a current step."}),(e.completed_count!==0||e.total_count!==0)&&n.addIssue({code:"custom",path:["steps"],message:"not_started progress must have zero counts and no steps."})),e.workflow_status==="active"&&(e.flow_type===null&&n.addIssue({code:"custom",path:["flow_type"],message:"active progress requires a flow_type."}),e.current_step_code===null&&n.addIssue({code:"custom",path:["current_step_code"],message:"active progress requires a current step."})),e.workflow_status==="completed"&&(e.flow_type===null&&n.addIssue({code:"custom",path:["flow_type"],message:"completed progress requires a flow_type."}),e.current_step_code!==null&&n.addIssue({code:"custom",path:["current_step_code"],message:"completed progress cannot have a current step."}),e.steps.some(s=>s.status!=="completed")&&n.addIssue({code:"custom",path:["steps"],message:"completed progress must have only completed steps."}),e.completed_count!==e.total_count&&n.addIssue({code:"custom",path:["completed_count"],message:"completed progress counts must be equal."}))}),bO=M(db);import{z as Na}from"zod";var ub=Na.enum(["none","build","build_publish"]),gb=Na.object({site_id:k,launcher_scope:ub}),RO=Na.object({permission:gb});function IO(e){return e!=="none"}function TO(e){return e==="build_publish"}import{z as be}from"zod";var vO="build-context.json",DO=2e5,Em=be.string().regex(/^sha256:[a-f0-9]{64}$/u),Rm=1e3;function _b(e){return Array.from(e).length<=Rm}var hb=be.object({kind:be.enum(["customer_materials","website_scan_diagnosis","committed_strategy"]),digest:Em}).strict(),Sb=be.object({schema_version:be.literal(1),flow_type:nn,sources:be.array(hb).min(2).max(2)}).strict().superRefine((e,n)=>{let i=new Set(e.sources.map(a=>a.kind)),s=e.flow_type==="with_website"?["website_scan_diagnosis","committed_strategy"]:["customer_materials","committed_strategy"];(i.size!==s.length||s.some(a=>!i.has(a)))&&n.addIssue({code:"custom",path:["sources"],message:"Site-build provenance sources must match the persisted workflow flow."})}),fb=be.object({schema_version:be.literal(1),seed:Em.optional(),cms_settings:be.object({main_products:be.string().trim().min(1).refine(_b,{message:`main_products must contain at most ${Rm} characters`}).optional()}).strict().optional(),provenance:Sb.optional()}).strict(),bb=be.object({schema_version:be.literal(1),site_id:k,workflow_id:st,brief:be.string().min(1),source:be.enum(["business_provider","mock"]),payload:fb}).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."})}),OO=be.object({source_snapshot_id:I,source_run_id:$,build_context:bb,page_slugs:be.array(be.string().min(1)).optional()}).strict(),NO=be.object({disposition:be.enum(["reused","rebased"]),snapshot_id:I}).strict(),yb=be.object({snapshot:oa,workspace_run_id:$.nullable()}).strict(),jO=M(yb);import{z as ot}from"zod";import{z as He}from"zod";import{z as Se}from"zod";import{z as xb}from"zod";var Eb=["company_profile","product_manual","product_list","customer_case","product_help","qualification","industry_material"],Im=xb.enum(Eb);var Tm=Se.enum(["pending","running","ready","failed","missing"]),Rb=Se.object({task_id:Se.string().min(1).max(500),status:Tm}).strict(),qO=Se.object({items:Se.array(Rb).max(100)}).strict(),$n=Se.string().trim().min(1).max(255),WO=Se.object({knowledge_site_id:$n,source_ids:Se.array($n).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"]})}),Ib=Se.object({source_file_id:$n,category_code:Im.nullable(),category_confirmed:Se.boolean(),status:Tm}).strict(),BO=Se.object({ready:Se.boolean(),files:Se.array(Ib),counts:Se.object({total:Se.number().int().nonnegative(),pending:Se.number().int().nonnegative(),running:Se.number().int().nonnegative(),ready:Se.number().int().nonnegative(),failed:Se.number().int().nonnegative(),missing:Se.number().int().nonnegative(),unclassified:Se.number().int().nonnegative()}).strict()}).strict();var ye=e=>He.string().trim().max(e),km=He.array(He.string().trim().min(1).max(120)).max(20),ja=He.object({company_name:He.string().trim().min(1).max(200),brand_name:ye(200),primary_products:He.string().trim().min(1).max(1e3),industry:ye(200),applications:ye(1e3),business_summary:ye(2e3),registered_capital:ye(200).default(""),legal_representative:ye(200).default(""),target_markets:km,customer_industries:ye(1e3),customer_roles:ye(1e3),buying_scenarios:ye(2e3),differentiators:ye(2e3),competitors:ye(1e3),trust_proof:ye(2e3),customer_cases:ye(3e3),channels:km,expected_domain:ye(255),brand_tone:ye(500),contact_name:ye(200),contact_info:ye(500),timezone:ye(100),launch_timing:ye(200),input_source_ids:He.array($n).max(50)}).strict(),Tb=He.enum(["draft","submitted"]),La=ja.extend({id:Q,tenant_id:He.string().min(1),site_id:k,workflow_id:st,status:Tb,submitted_at:He.string().min(1).nullable(),created_at:He.string().min(1),updated_at:He.string().min(1)}).strict(),YO=M(La),XO=M(La),QO=M(La.nullable());var nN=Ni.extend({expected_current_node:ot.literal("website_scan"),type:ot.literal("existing_site"),result:Ni.shape.result.extend({website:ot.string().url(),scan_cards:ot.partialRecord(Lc,ua).refine(e=>Object.keys(e).length>0,{message:"At least one recognized scan card is required."})}).strict()}).strict(),iN=ot.object({expected_current_node:ot.literal("customer_materials"),materials:ja}).strict(),sN=ot.object({expected_current_node:ot.literal("diagnosis")}).strict(),aN=ot.object({expected_current_node:ot.literal("strategy")}).strict();import{z as N}from"zod";var Ma=["compact","comfortable","airy"],Am=["none","sm","md","lg","xl"],wm="lg",Ua=["subtle","moderate","expressive"],kb=[{id:"subtle",motionLevel:"subtle"},{id:"moderate",motionLevel:"moderate"},{id:"expressive",motionLevel:"expressive"}];function Pm(e){let n=kb.find(i=>i.id===e);if(!n)throw new Error(`Unknown motion preset: ${e}`);return n}var Cm=["ocean","forest","clay","violet","graphite","crimson"],vm=["ai-forest","ai-navy","ai-steel"],Dm=/^gen-[0-9a-f]{8}$/,Fa=[{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"}],Ga=[{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 cN(e){let n=Ga.find(i=>i.id===e);if(!n)throw new Error(`Unknown theme preset: ${e}`);return n}function Om(e){return Ga.find(n=>n.id===e)?.radius??Fa.find(n=>n.id===e)?.radius}var qa=N.string().regex(/^#[0-9A-F]{6}$/i),Vn=N.string().trim().min(1).max(500),Nm=N.string().datetime({offset:!0}),Ab=N.enum(Cm),wb=N.enum(vm),Pb=N.string().regex(Dm),Yn=N.union([Ab,wb,Pb]),Xn=N.enum(ya),Qn=N.enum(Ua),Zn=N.enum(Ma),Yi=N.enum(Am),jm=300,Cb=N.string().trim().min(1).max(jm),Xi=N.object({primary:qa,accent:qa,foreground:qa}).strict(),vb=N.object({id:Yn,rank:N.number().int().min(1).max(3),name:N.string().trim().min(1).max(120),description:N.string().trim().min(1).max(240),color_seeds:Xi,surface_mode:N.enum(["light","dark"]),radius:Yi,font_pairing_id:Xn,motion_preset_id:Qn,density:Zn,weight_style:We.optional(),reason:Vn}).strict(),Lm=N.object({name:N.string().trim().min(1).max(120),description:N.string().trim().min(1).max(240),reason:Vn,color_seeds:Xi,surface_mode:N.enum(["light","dark"]),radius:Yi,font_pairing_id:Xn,motion_preset_id:Qn,density:Zn,weight_style:We}).strict(),Mm=N.object({version:N.number().int().min(1),recommendation_id:N.string().uuid(),theme_preset_id:Yn,color_seeds:Xi,surface_mode:N.enum(["light","dark"]),font_pairing_id:Xn,motion_preset_id:Qn,density:Zn,radius:Yi.optional(),weight_style:We.optional(),aesthetic_note:Cb.optional(),updated_at:Nm}).strict(),Db=N.object({id:N.string().uuid(),version:N.number().int().min(1),catalog_version:N.string().trim().min(1).max(80),source:N.object({mode:N.enum(["ai","fallback"]),fallback_reason:N.string().trim().min(1).max(80).nullable()}).strict(),inputs:N.object({industry:N.string().trim().min(1).max(160).optional(),site_language:N.string().trim().min(2).max(35),owner_locale:Re.optional(),strategy_version:N.number().int().min(1),input_digest:N.string().regex(/^sha256:[a-f0-9]{64}$/)}).strict(),theme:N.object({recommended_id:Yn,candidate_ids:N.array(Yn).length(3),candidates:N.array(vb).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((i,s)=>i.id!==e.candidate_ids[s]||i.rank!==s+1)&&n.addIssue({code:"custom",path:["candidates"],message:"Candidates must follow candidate_ids order."})}),font:N.object({recommended_id:Xn,reason:Vn}).strict(),motion:N.object({recommended_id:Qn,reason:Vn}).strict(),density:N.object({recommended_id:Zn,reason:Vn}).strict(),conversion:Mt.optional(),generated_at:Nm}).strict(),bN=N.object({force_refresh:N.boolean().optional()}).strict(),yN=N.object({request_id:N.string().trim().min(1).max(160),site_id:k,cached:N.boolean(),recommendation:Db,selection:Mm}).strict(),xN=N.object({recommendation_id:N.string().uuid(),expected_version:N.number().int().min(1),theme_preset_id:Yn,color_seeds:Xi,surface_mode:N.enum(["light","dark"]),font_pairing_id:Xn,motion_preset_id:Qn,density:Zn,radius:Yi.optional(),weight_style:We.optional(),aesthetic_note:N.string().trim().max(jm).optional()}).strict(),EN=N.object({selection:Mm}).strict(),Ob=4e3,RN=N.object({tenant_id:N.string().trim().min(1).max(160),site_id:k,site_language:N.string().trim().min(2).max(35),owner_locale:Re,industry:N.string().trim().min(1).max(160).optional(),strategy_version_id:N.string().uuid(),strategy_version:N.number().int().min(1),strategy_checksum:N.string().regex(/^[a-f0-9]{64}$/),strategy_summary:N.array(N.string().trim().min(1).max(Ob)).min(1).max(Ne)}).strict(),Wa=N.object({theme_candidates:N.array(Lm).length(3),conversion:Mt.optional()}).strict().superRefine((e,n)=>{let i=new Set;e.theme_candidates.forEach((s,a)=>{let o=JSON.stringify(s.color_seeds).toUpperCase();i.has(o)&&n.addIssue({code:"custom",path:["theme_candidates",a,"color_seeds"],message:"Theme candidates must have pairwise distinct color_seeds"}),i.add(o)})});function IN(){return Fa.map(e=>Lm.parse({name:e.name,description:e.description,reason:e.fallbackReason,color_seeds:e.colorSeeds,surface_mode:e.surfaceMode,radius:e.radius,font_pairing_id:ya[0],motion_preset_id:Ua[0],density:Ma[1],weight_style:Li}))}function Nb(e){return e.radius??Om(e.theme_preset_id)??"lg"}function jb(e,n){return e.weight_style??n?.theme?.candidates?.find(i=>i.id===e.theme_preset_id)?.weight_style??n?.theme?.candidates?.[0]?.weight_style??Li}function TN(e,n){let i=Vc(e.font_pairing_id),s=Pm(e.motion_preset_id);return{colorSeeds:e.color_seeds,surfaceMode:e.surface_mode,fonts:{heading:i.heading,body:i.body},density:e.density,motionLevel:s.motionLevel,motionPreset:s.id,radius:Nb(e),weightStyle:jb(e,n)}}function kN(e,n){let i=e.theme.candidates[0];return{version:1,recommendation_id:e.id,theme_preset_id:i.id,color_seeds:i.color_seeds,surface_mode:i.surface_mode,font_pairing_id:e.font.recommended_id,motion_preset_id:e.motion.recommended_id,density:e.density.recommended_id,radius:i.radius,weight_style:i.weight_style,updated_at:n.toISOString()}}import{z as Ba}from"zod";function Lb(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,e.weight_style])}var Mb=Ba.object(Wa.shape).strict().superRefine((e,n)=>{let i=new Set;e.theme_candidates.forEach((s,a)=>{let o=Lb(s);i.has(o)&&n.addIssue({code:"custom",path:["theme_candidates",a],message:"Theme candidates must have pairwise distinct visual identities"}),i.add(o)})}),CN=Ba.union([Wa,Mb.safeExtend({model_profile:Ba.literal("azure-gpt")})]);import{z as Ct}from"zod";var NN=Ct.object({site_id:k,site_language:Ct.string().trim().min(2).max(35),business_facts:Ct.array(Ct.string().trim().min(1).max(1e3)).min(1).max(8)}).strict(),Ub=Ct.enum(["high","medium","low"]),jN=Ct.object({skill_name:Ct.string().trim().min(1).max(80).nullable(),confidence:Ub,reason:Ct.string().trim().min(1).max(240)}).strict();import{z as Jn}from"zod";var Um=1e4,Fb=Jn.object({note:Jn.string().trim().max(Um),updated_at:Jn.string().min(1)}).strict(),FN=Jn.object({note:Jn.string().trim().max(Um)}).strict(),GN=M(Fb.nullable());import{z as ne}from"zod";var Ka=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],Qi=ne.object({name:ne.string().min(1).max(100),type:ne.enum(Ka),label:ne.string().min(1).max(255),required:ne.boolean().optional(),options:ne.array(ne.string()).optional()}),BN=ne.object({name:ne.string(),cms_type:ne.string(),label:ne.string().optional(),required:ne.boolean().optional(),value_shape:ne.string().optional(),front_display:ne.enum(["visible","internal","forbidden"]).optional(),choices:ne.array(ne.object({value:ne.union([ne.string(),ne.number()]),label:ne.string()})).optional()}),KN=ne.object({route_file_path:ne.string().min(1),target_component_path:ne.string().min(1),content_type_hint:ne.string().min(1),collection_purpose:ne.enum(["generic","product"]).optional(),required_fields:ne.array(Qi).optional(),mode:ne.enum(["bind_existing","provision"]),list_mode:ne.enum(["page","embedded"]).optional(),fields:ne.array(Qi).optional(),seed_records:ne.array(ne.record(ne.string(),ne.unknown())).optional()});import{z as G}from"zod";var ei=G.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),Zi=G.string().regex(/^[a-f0-9]{64}$/),Ji=G.string().regex(/^[a-z][a-z0-9-]{0,99}$/),es=G.string().regex(/^[a-z0-9]{1,30}$/),Ve=e=>G.string().max(e).refine(n=>n.trim().length>0,"Value must not be blank"),Fm=G.object({id:G.string().uuid(),key:Ve(100),name:Ve(255)}).strict(),qm=new Set(["title","summary","description","category","thumbnail","url","admin_id"]),Gb=new Set(["title","summary","description","image_query"]),qb=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"]),Gm=new Set(["select","multiselect"]),Wb=new Set(["title","text","richtext","date","datetime","url","email","color"]),Bb=G.object({name:Ve(100),label:Ve(255),type:G.enum(Ka),required:G.boolean().optional(),options:G.array(Ve(100)).max(100).optional()}).strict().superRefine((e,n)=>{let i=e.options??[];Gm.has(e.type)&&i.length===0&&n.addIssue({code:"custom",path:["options"],message:"Choice fields require at least one option"}),!Gm.has(e.type)&&i.length>0&&n.addIssue({code:"custom",path:["options"],message:"Only choice fields may declare options"}),new Set(i).size!==i.length&&n.addIssue({code:"custom",path:["options"],message:"Field options must be unique"}),qm.has(e.name)&&n.addIssue({code:"custom",path:["name"],message:"Reserved CMS field names cannot be declared"})}),Kb=G.array(Bb).min(1).max(200),zb=G.array(G.record(G.string(),G.unknown())).max(1e3);function $e(e,n,i){e.addIssue({code:"custom",path:n,message:i})}var Hb=G.object({name:Ve(30),slug:es,collection_purpose:G.enum(["generic","product"]).optional(),fields:Kb,seed_records:zb}).strict().superRefine((e,n)=>{let i=e.fields.map(a=>a.name);new Set(i).size!==i.length&&n.addIssue({code:"custom",path:["fields"],message:"Field names must be unique"}),i.some(a=>!qm.has(a))||n.addIssue({code:"custom",path:["fields"],message:"At least one custom field is required"});let s=new Map(e.fields.map(a=>[a.name,a]));e.seed_records.forEach((a,o)=>{for(let[c,r]of Object.entries(a)){let l=["seed_records",o,c];if(qb.has(c)){$e(n,l,"Seed cannot write reserved or runtime-owned fields");continue}if(c==="image_query"){(typeof r!="string"||r.trim()==="")&&$e(n,l,"image_query must be a non-empty string");continue}if(Gb.has(c)){typeof r!="string"&&$e(n,l,"Seed skeleton text fields must be strings");continue}let x=s.get(c);if(!x){$e(n,l,"Seed contains an undeclared field");continue}if(r==null){$e(n,l,"Seed field values must not be null");continue}if(x.type==="select")(typeof r!="string"||!(x.options??[]).includes(r))&&$e(n,l,"Seed select value must be one of the declared options");else if(x.type==="multiselect")(!Array.isArray(r)||r.length===0||r.some(h=>typeof h!="string"||!(x.options??[]).includes(h)))&&$e(n,l,"Seed multiselect value must contain only declared options");else if(x.type==="number")(typeof r!="number"||!Number.isFinite(r))&&$e(n,l,"Seed number values must be finite numbers");else if(x.type==="boolean")typeof r!="boolean"&&$e(n,l,"Seed boolean values must be booleans");else if(x.type==="tag"){let h=Array.isArray(r)?r:[r];(h.length===0||h.some(C=>typeof C!="string"||C.trim()===""))&&$e(n,l,"Seed tag values must be non-empty strings")}else Wb.has(x.type)&&typeof r!="string"&&$e(n,l,"Seed text-like values must be strings")}for(let c of e.fields)c.required&&!(c.name in a)&&$e(n,["seed_records",o,c.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"})}),za=G.object({schema_version:G.literal(1),application:Hb}).strict(),$b=G.object({templateId:G.string().uuid(),stableKey:Ji,resolvedVersion:ei,digest:Zi,template:za}).strict(),Vb=$b,Yb={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"},Wm=G.enum(Object.values(Yb)),Bm=G.object({category_status:G.enum(["succeeded","failed","not_attempted"]),seed_status:G.enum(["skipped","succeeded","partial","failed"]),requested_count:G.number().int().nonnegative(),written_count:G.number().int().nonnegative().nullable(),published_count:G.number().int().nonnegative().nullable(),errors:G.array(G.object({stage:G.enum(["category","seed","receipt"]),code:Ve(100)}).strict()).max(20)}).strict(),Xb=G.object({templateId:G.string().uuid(),stableKey:Ji,title:Ve(200),description:G.string().max(1e3),thumbnailUrl:G.string().url().nullable(),resolvedVersion:ei,digest:Zi,application:G.object({name:Ve(30),slug:es}).strict(),categories:G.array(Fm),tags:G.array(Fm),status:G.enum(["available","creating","created","conflict","failed"]),errorCode:Wm.nullable().optional(),template:za.optional()}).strict(),Km=G.object({items:G.array(Xb)}).strict(),VN=G.object({version:ei}).strict(),Qb=G.object({app_slug:es,name:Ve(30),template:G.object({stable_key:Ji,version:ei,digest:Zi}).strict()}).strict(),Zb=G.object({status:G.literal("created"),application:Qb,initialization:Bm}).strict(),YN=Zb,Jb=G.object({stable_key:Ji,version:ei,digest:Zi,created_at:G.string().datetime().nullable(),initialization:Bm.nullable()}).strict(),ey=G.object({app_slug:es,name:Ve(30),collection_slug:G.string().min(1),detail_prefix:G.string().min(1).optional(),source:Jb.nullable()}).strict(),XN=G.object({applications:G.array(ey)}).strict(),QN=Km,ZN=G.object({code:Wm,message:Ve(500)}).strict(),JN=za,ej=Vb,tj=Km;import{z as ge}from"zod";var zm=e=>ge.string().max(e).refine(n=>n.trim().length>0,"Value must not be blank"),ty=Qi.strict(),$m=ge.array(ty).min(1).max(200),ny=ge.array(ge.record(ge.string(),ge.unknown())).max(1e3),iy=ge.string().regex(/^[a-z0-9]{1,30}$/),Ha=ge.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),aj=ge.object({name:zm(30),slug:zm(50),collection_purpose:ge.enum(["generic","product"]).optional(),fields:$m}).strict(),Hm=ge.object({collection_slug:iy,detail_prefix:ge.string().min(1).max(255),plugin_id:Ha.optional()}).strict(),oj=ge.discriminatedUnion("kind",[Hm.extend({kind:ge.literal("created")}),Hm.extend({kind:ge.literal("exists")})]),rj=ge.object({fields:$m,seed_records:ny,category_id:Ha}).strict(),sy=ge.record(ge.string().min(1),ge.string().min(1).nullable()),cj=ge.object({ids:ge.array(Ha).max(1e3),urls:sy,failed:ge.array(ge.unknown()).max(1e3)}).strict();function mj(e){return e.replace(/[^a-zA-Z0-9]/g,"").toLowerCase().slice(0,30)}import{z as xe}from"zod";import{z as $a}from"zod";var Vm=["lead-generation","trial-and-samples","quote-and-commerce","appointments-and-visits","resources-and-subscriptions","service-and-channel"],Ym="-",ay="embedded",Va=$a.enum([...Vm,Ym]),oy=$a.literal(ay),Ya=$a.object({scene:Va,shape:oy}).strict();function dj(e){return Vm.find(n=>n===e)??Ym}var ts=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number","file"],ry=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number"],cy=xe.object({name:xe.string().min(1).max(100),type:xe.enum(ry),label:xe.string().min(1).max(255),required:xe.boolean().optional(),options:xe.array(xe.string()).optional()}),my=xe.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),hj=xe.object({mode:xe.enum(["bind_existing","provision"],{error:'mode is required. Use "bind_existing" or "provision". Never call connect_form with {}.'}),form_hint:xe.string().min(1).optional(),name:xe.string().min(1).max(255).optional(),scene:Va.optional(),component_slug:my,description:xe.string().min(1).max(1e3).optional(),fields:xe.array(cy).optional()}).superRefine((e,n)=>{e.mode==="provision"&&e.scene===void 0&&n.addIssue({code:"custom",path:["scene"],message:"scene is required for provision"}),e.mode==="bind_existing"&&e.scene!==void 0&&n.addIssue({code:"custom",path:["scene"],message:"scene is prohibited for bind_existing"}),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"})}),Sj=xe.object({name:xe.string(),label:xe.string(),cms_type:xe.string(),required:xe.boolean()});import{z as p}from"zod";var ti=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,dn=/^[A-Za-z][A-Za-z0-9_-]{0,127}$/,ns=/^[A-Za-z][A-Za-z0-9_]{0,99}$/,Jm=/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/,Qa=/^[a-z][a-z0-9-]{0,99}$/,el=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,Xm=2,Qm=3,is=p.string().regex(ti),ly=p.string().regex(ti),Za=p.string().regex(ti),ni=p.string().regex(ns),Ja=p.string().regex(Jm),py=p.discriminatedUnion("status",[p.object({status:p.literal("unbound"),form_code:p.null()}).strict(),p.object({status:p.literal("bound"),form_code:p.string().regex(dn)}).strict(),p.object({status:p.literal("missing"),form_code:p.string().regex(dn)}).strict()]),dy=p.object({value:Ja,label:p.string().trim().min(1).max(255)}).strict(),uy=p.object({kind:p.literal("field"),field_name:ni,type:p.enum(ts),label:p.string().trim().min(1).max(255),required:p.boolean(),span:p.enum(["full","half"]),options:p.array(dy).max(100),max_files:p.number().int().min(1).max(5).optional()}).strict(),gy=p.object({kind:p.literal("step-break"),step_id:p.string().regex(ti)}).strict(),_y=p.discriminatedUnion("kind",[uy,gy]),hy=p.object({field_name:ni,type:p.enum(ts),last_label:p.string().max(255)}).strict(),Sy=p.object({field_name:ni,value:Ja,last_label:p.string().max(255)}).strict(),fy=p.discriminatedUnion("kind",[p.object({kind:p.literal("custom")}).strict(),p.object({kind:p.literal("template"),slug:p.string().regex(Qa),version:p.string().regex(el)}).strict()]),by={select:2,radio:2,multiselect:1,DropdownSelection:2,RadioButton:2,Checkbox:1};function rt(e){return e.toLowerCase()}function tl(e,n){return e.trim().toLocaleLowerCase(n)}function pn(e,n){return`${rt(e)}\0${n}`}function Ce(e,n,i,s){let a=new Set;for(let o of e){if(a.has(o)){s.addIssue({code:"custom",path:n,message:i});return}a.add(o)}}function eo(e,n,i,s){let a=by[e]??0;a>0&&n<a?s.addIssue({code:"custom",path:i,message:`choice field requires at least ${a} option${a===1?"":"s"}`}):a===0&&n>0&&s.addIssue({code:"custom",path:i,message:"non-choice fields must use an empty options array"})}var to=p.object({schema_version:p.literal(1),min_runtime_version:p.number().int().positive(),form_definition_id:is,binding:py,content_locale:Re,features:p.object({multistep:p.boolean()}).strict(),copy:p.object({title:p.string().max(255),description:p.string().max(1e3),submit_button:p.string().trim().min(1).max(100),success_message:p.string().trim().min(1).max(500),error_message:p.string().max(500)}).strict(),layout:p.object({columns:p.enum(["one","two"])}).strict(),nodes:p.array(_y).min(1).max(200),source:fy,retired:p.object({fields:p.array(hy).max(1e3),options:p.array(Sy).max(5e3)}).strict(),compatibility:p.object({standardization_version:p.number().int().positive(),diagnostics:p.array(p.string().trim().min(1).max(500)).max(100)}).strict()}).strict().superRefine((e,n)=>{let i=e.nodes.flatMap((r,l)=>r.kind==="field"?[[l,r]]:[]),s=i.map(([,r])=>r);s.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"at least one field node is required"});let a=e.nodes.filter(r=>r.kind==="step-break");!e.features.multistep&&a.length>0&&n.addIssue({code:"custom",path:["nodes"],message:"step-break requires the multistep feature"}),e.features.multistep&&(e.min_runtime_version<Xm&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`multistep requires runtime version ${Xm}`}),a.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"multistep requires at least one step-break"}));for(let[r,l]of e.nodes.entries())l.kind==="step-break"&&(r===0||r===e.nodes.length-1||e.nodes[r-1]?.kind==="step-break"||e.nodes[r+1]?.kind==="step-break")&&n.addIssue({code:"custom",path:["nodes",r],message:"step-break must separate two non-empty steps"});Ce(a.map(r=>r.step_id),["nodes"],"step_id must be unique",n),Ce(s.map(r=>rt(r.field_name)),["nodes"],"field_name must be unique",n),Ce(e.retired.fields.map(r=>rt(r.field_name)),["retired","fields"],"retired field_name must be unique",n);let o=new Set(e.retired.fields.map(r=>rt(r.field_name)));for(let[r,l]of i)o.has(rt(l.field_name))&&n.addIssue({code:"custom",path:["nodes",r,"field_name"],message:"retired field_name cannot be reused"}),eo(l.type,l.options.length,["nodes",r,"options"],n),l.type==="file"?e.min_runtime_version<Qm&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`file fields require runtime version ${Qm}`}):l.max_files!==void 0&&n.addIssue({code:"custom",path:["nodes",r,"max_files"],message:"max_files is only valid for file fields"}),Ce(l.options.map(x=>x.value),["nodes",r,"options"],"option value must be unique within a field",n),Ce(l.options.map(x=>tl(x.label,e.content_locale)),["nodes",r,"options"],"option label must be unique within a field",n);Ce(e.retired.options.map(r=>pn(r.field_name,r.value)),["retired","options"],"retired option identity must be unique",n);let c=new Set(e.retired.options.map(r=>pn(r.field_name,r.value)));for(let[r,l]of i)for(let[x,h]of l.options.entries())c.has(pn(l.field_name,h.value))&&n.addIssue({code:"custom",path:["nodes",r,"options",x,"value"],message:"retired option value cannot be reused"})}),yy=["copy.title","copy.description","copy.submit_button","copy.success_message","copy.error_message","nodes.*.label","nodes.*.options.*.label"],xy=new Set(yy);function Tj(e){let n=e.map(i=>typeof i=="number"||/^\d+$/.test(i)?"*":i).join(".");return xy.has(n)}function kj(e,n){let i=[],s=e.nodes.filter(r=>r.kind==="field"),a=new Map(n.nodes.filter(r=>r.kind==="field").map(r=>[rt(r.field_name),r])),o=new Map(n.retired.fields.map(r=>[rt(r.field_name),r])),c=new Map(n.retired.options.map(r=>[pn(r.field_name,r.value),r]));for(let r of s){let l=rt(r.field_name),x=a.get(l),h=o.get(l);x&&x.field_name!==r.field_name&&i.push({code:"FIELD_IDENTITY_CHANGED",field_name:r.field_name}),x&&x.type!==r.type&&i.push({code:"FIELD_TYPE_CHANGED",field_name:r.field_name}),!x&&h&&h.field_name!==r.field_name&&i.push({code:"FIELD_IDENTITY_CHANGED",field_name:r.field_name}),!x&&h&&h.type!==r.type&&i.push({code:"FIELD_TYPE_CHANGED",field_name:r.field_name}),!x&&!o.has(l)&&i.push({code:"FIELD_RETIREMENT_MISSING",field_name:r.field_name});let C=new Set(x?.options.map(K=>K.value)??[]);for(let K of r.options){let H=c.get(pn(r.field_name,K.value));!C.has(K.value)&&H&&H.field_name!==r.field_name&&i.push({code:"FIELD_IDENTITY_CHANGED",field_name:r.field_name}),!C.has(K.value)&&!H&&i.push({code:"OPTION_RETIREMENT_MISSING",field_name:r.field_name,value:K.value})}}for(let r of e.retired.fields){let l=o.get(rt(r.field_name));l&&l.field_name!==r.field_name&&i.push({code:"FIELD_IDENTITY_CHANGED",field_name:r.field_name}),l&&l.type!==r.type&&i.push({code:"FIELD_TYPE_CHANGED",field_name:r.field_name}),l||i.push({code:"FIELD_RETIREMENT_MISSING",field_name:r.field_name})}for(let r of e.retired.options){let l=c.get(pn(r.field_name,r.value));l&&l.field_name!==r.field_name&&i.push({code:"FIELD_IDENTITY_CHANGED",field_name:r.field_name}),l||i.push({code:"OPTION_RETIREMENT_MISSING",field_name:r.field_name,value:r.value})}return i}var Ey=p.enum(wn),vt=p.object({english:p.string().max(1e3),translations:p.partialRecord(Ey,p.string().max(1e3)).optional()}).strict(),Ry=p.object({template_option_key:p.string().regex(Jm),label:vt}).strict(),Iy=p.object({template_field_key:p.string().regex(ns),type:p.enum(ts),label:vt,required:p.boolean(),span:p.enum(["full","half"]),options:p.array(Ry).max(100)}).strict(),Ty=p.object({template_step_key:p.string().regex(ns),after_field_key:p.string().regex(ns)}).strict(),Aj=["lead-generation","trial-and-samples","quote-and-commerce","appointments-and-visits","resources-and-subscriptions","service-and-channel"],wj=[1,1,1,1,1,1],nl=p.string().regex(Qa),ky=p.object({schema_version:p.literal(1),slug:nl,name:vt,template_count:p.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"})}),Ay=p.object({schema_version:p.literal(1),slug:p.string().regex(Qa),version:p.string().regex(el),category:nl,copy:p.object({title:vt,description:vt,submit_button:vt,success_message:vt,error_message:vt}).strict(),layout:p.object({columns:p.enum(["one","two"])}).strict(),fields:p.array(Iy).min(1).max(200),step_breaks:p.array(Ty).max(20).optional()}).strict().superRefine((e,n)=>{for(let o of["title","description","submit_button","success_message","error_message"])e.copy[o].english.trim()===""&&n.addIssue({code:"custom",path:["copy",o,"english"],message:"English baseline text is required"});Ce(e.fields.map(o=>o.template_field_key),["fields"],"template_field_key must be unique",n);let i=new Map(e.fields.map((o,c)=>[o.template_field_key,c])),s=e.step_breaks??[];Ce(s.map(o=>o.template_step_key),["step_breaks"],"template_step_key must be unique",n),Ce(s.map(o=>o.after_field_key),["step_breaks"],"step breaks must not share an anchor field",n);let a=-1;for(let[o,c]of s.entries()){let r=i.get(c.after_field_key);r===void 0||r>=e.fields.length-1?n.addIssue({code:"custom",path:["step_breaks",o,"after_field_key"],message:"step break must follow an existing non-final field"}):r<=a&&n.addIssue({code:"custom",path:["step_breaks",o,"after_field_key"],message:"step breaks must follow field order"}),a=r??a}e.fields.length+s.length>200&&n.addIssue({code:"custom",path:["step_breaks"],message:"template fields and step breaks must not exceed 200 nodes"});for(let[o,c]of e.fields.entries()){c.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",o,"label","english"],message:"English field label is required"}),eo(c.type,c.options.length,["fields",o,"options"],n),Ce(c.options.map(r=>r.template_option_key),["fields",o,"options"],"template_option_key must be unique within a field",n),Ce(c.options.map(r=>r.label.english.trim().toLowerCase()),["fields",o,"options"],"English option labels must be unique within a field",n);for(let[r,l]of c.options.entries())l.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",o,"options",r,"label","english"],message:"English option label is required"})}}),Pj=p.object({schema_version:p.literal(1),visibility:p.enum(["internal","public"]),categories:p.array(ky).max(500),templates:p.array(Ay).max(500)}).strict().superRefine((e,n)=>{let i=(a,o)=>{let c=wn.filter(r=>!a.translations?.[r]?.trim());c.length>0&&n.addIssue({code:"custom",path:[...o,"translations"],message:`public template copy is missing locales: ${c.join(", ")}`})};Ce(e.categories.map(a=>a.slug),["categories"],"template category slug must be unique",n);let s=new Set(e.categories.map(a=>a.slug));for(let[a,o]of e.categories.entries()){let c=e.templates.filter(r=>r.category===o.slug).length;o.template_count!==c&&n.addIssue({code:"custom",path:["categories",a,"template_count"],message:"template_count must match catalog templates"})}Ce(e.templates.map(a=>a.slug),["templates"],"template slug must be unique",n);for(let[a,o]of e.templates.entries())s.has(o.category)||n.addIssue({code:"custom",path:["templates",a,"category"],message:"template category must exist in catalog categories"});if(e.visibility==="public"){for(let[a,o]of e.categories.entries())i(o.name,["categories",a,"name"]);for(let[a,o]of e.templates.entries()){for(let[c,r]of Object.entries(o.copy))i(r,["templates",a,"copy",c]);for(let[c,r]of o.fields.entries()){i(r.label,["templates",a,"fields",c,"label"]);for(let[l,x]of r.options.entries())i(x.label,["templates",a,"fields",c,"options",l,"label"])}}}});function Cj(e,n){let i=_r(n),s=i?e.translations?.[i]:void 0;return s!==void 0&&s.trim()!==""?s:e.english}var wy=["Text","Summary","Email","Phone","DropdownSelection","RadioButton","Checkbox","Boolean","Date","Num","MultipleFile","SpecificFile"],Py={text:"Text",textarea:"Summary",email:"Email",phone:"Phone",select:"DropdownSelection",radio:"RadioButton",multiselect:"Checkbox",boolean:"Boolean",date:"Date",number:"Num",file:"MultipleFile"},Cy=p.object({value:Ja,label:p.string().trim().min(1).max(255)}).strict(),vy=p.object({field_name:ni,field_type:p.enum(wy),field_label:p.string().trim().min(1).max(255),is_required:p.boolean(),sort_order:p.number().int().nonnegative(),options:p.array(Cy).max(100)}).strict(),il=p.object({version:p.literal(1),locale:Re,fields:p.array(vy).min(1).max(200)}).strict().superRefine((e,n)=>{Ce(e.fields.map(i=>rt(i.field_name)),["fields"],"field_name must be unique",n);for(let[i,s]of e.fields.entries())eo(s.field_type,s.options.length,["fields",i,"options"],n),Ce(s.options.map(a=>a.value),["fields",i,"options"],"option value must be unique within a field",n),Ce(s.options.map(a=>tl(a.label,e.locale)),["fields",i,"options"],"option label must be unique within a field",n)});function vj(e){let n=e.nodes.filter(i=>i.kind==="field").map((i,s)=>({field_name:i.field_name,field_type:i.type==="file"&&i.max_files===1?"SpecificFile":Py[i.type],field_label:i.label,is_required:i.required,sort_order:s,options:i.options.map(a=>({...a}))}));return il.parse({version:1,locale:e.content_locale,fields:n})}var de=p.string().regex(/^sha256:[0-9a-f]{64}$/),Dy=p.union([Ee,p.enum(["app/api/forms/[code]/route.ts","hooks/use-cms-form-submit.ts","lib/cms/forms.ts","lib/cms/client.ts"])]),Oy=p.object({path:Dy,content_hash:de.nullable()}).strict(),Ny=p.array(Oy).min(1).max(500).superRefine((e,n)=>{Ce(e.map(i=>i.path),[],"affected file paths must be unique",n)}),no=p.object({grade:p.enum(["standard","A","B","C"]),required:p.boolean(),pending_confirmations:p.array(p.object({item_id:p.string().regex(ti),field_name:ni.optional(),kind:p.enum(["form_copy","layout","field_label","field_type","field_required","field_options"]),message:p.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 i=e.grade==="standard";i===e.required&&n.addIssue({code:"custom",path:["required"],message:i?"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"})}),jy=p.object({site_id:k,form_definition_id:is,base_snapshot_id:I,expected_form_spec_hash:de,expected_cms_schema_hash:de.nullable(),form_metadata:Ya.nullable(),draft_form_spec_hash:de,desired_cms_schema_hash:de,affected_files_hash:de,shared_reference_hash:de,shared_reference_count:p.number().int().positive(),confirm_shared_update:p.boolean(),recreate_missing_binding:p.boolean(),standardization:no,confirm_standardization:p.boolean()}).strict(),sl=p.object({reference_hash:de,page_count:p.number().int().positive(),block_count:p.number().int().positive()}).strict().refine(e=>e.page_count<=e.block_count,{message:"page_count cannot exceed block_count"}),Dj=p.object({site_id:k,form_block_id:ly,base_snapshot_id:I,form_spec:to,runtime_upgrade_required:p.boolean(),expected_form_spec_hash:de,expected_cms_schema_hash:de.nullable(),affected_files_hash:de,shared_impact:sl,standardization:no}).strict(),Ly=p.object({operation_id:Za,operation_fingerprint:de,site_id:k,form_definition_id:is,base_snapshot_id:I,expected_form_spec_hash:de,expected_cms_schema_hash:de.nullable(),form_metadata:Ya.nullable(),draft_form_spec:to,draft_form_spec_hash:de,desired_cms_schema_hash:de,affected_files_hash:de,shared_impact:sl,confirm_shared_update:p.boolean(),recreate_missing_binding:p.boolean(),standardization:no,confirm_standardization:p.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 i=e.draft_form_spec.binding.status==="missing";i!==e.recreate_missing_binding&&n.addIssue({code:"custom",path:["recreate_missing_binding"],message:i?"missing bindings require explicit recreation confirmation":"only missing bindings can be recreated"});let s=e.draft_form_spec.binding.status==="bound",a=s&&e.standardization.required&&(e.standardization.grade==="B"||e.standardization.grade==="C");(s&&!a&&e.expected_cms_schema_hash===null||!s&&e.expected_cms_schema_hash!==null)&&n.addIssue({code:"custom",path:["expected_cms_schema_hash"],message:s?"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"})}),My=["created","validated","binding_reserved","candidate_ready","cms_applied","snapshot_promoted","committed","compensating","recovery_required","failed"],io=p.enum(My),Uy=["pending","running","succeeded","failed","recovery_required"],al=p.enum(Uy),Fy=["candidate_abandon","snapshot_reconcile","cms_restore"],ol=p.enum(Fy),Gy=["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"],so=p.enum(Gy),rl=p.enum(["wait","resume","retry_new_operation","manual_recovery","none"]),cl=p.enum(["not_started","pending","succeeded","failed"]),ml=p.object({operation_id:Za,operation_fingerprint:de,site_id:k,form_definition_id:is,stage:io,status:al,base_snapshot_id:I,candidate_snapshot_id:I.nullable(),before_form_code:p.string().regex(dn).nullable(),materialized_form_code:p.string().regex(dn).nullable(),expected_form_spec_hash:de,draft_form_spec_hash:de,materialized_form_spec_hash:de.nullable(),expected_cms_schema_hash:de.nullable(),desired_cms_schema_hash:de,retry_count:p.number().int().nonnegative(),failure_stage:ol.nullable(),last_error_code:so.nullable(),retryable:p.boolean(),next_action:rl,preview_refresh_status:cl,created_at:p.string().datetime({offset:!0}),updated_at:p.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 i of["candidate_snapshot_id","materialized_form_code","materialized_form_spec_hash"])e[i]===null&&n.addIssue({code:"custom",path:[i],message:`${i} 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"})}}),ao=p.object({operation:ml}).strict(),Oj=ao,Nj=ao,jj=p.object({operation_fingerprint:de}).strict(),Lj=ao,qy=p.preprocess(e=>{if(!e||typeof e!="object"||Array.isArray(e))return e;let n="form_metadata"in e?e:{...e,form_metadata:null};return"standardization"in e||"confirm_standardization"in e?n:{...n,standardization:{grade:"standard",required:!1,pending_confirmations:[]},confirm_standardization:!1}},Ly),Mj=p.object({operation:ml,request:qy,cms_replace_result:p.unknown().nullable()}).strict(),Wy=p.object({stage:io.optional(),status:al.optional(),candidate_snapshot_id:I.nullable().optional(),before_form_code:p.string().regex(dn).nullable().optional(),materialized_form_code:p.string().regex(dn).nullable().optional(),materialized_form_spec_hash:de.nullable().optional(),retry_count:p.number().int().nonnegative().optional(),failure_stage:ol.nullable().optional(),last_error_code:so.nullable().optional(),retryable:p.boolean().optional(),next_action:rl.optional(),preview_refresh_status:cl.optional()}).strict(),Uj=p.object({expected_updated_at:p.string().datetime({offset:!0}),operation:Wy,cms_replace_result:p.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"}),Fj=p.object({code:so,message:p.string().trim().min(1).max(500),retryable:p.boolean(),operation_id:Za.optional(),stage:io.optional()}).strict();function By(e){return jy.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,form_metadata:e.form_metadata,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 Zm(e){for(let n=0;n<e.length;n+=1){let i=e.charCodeAt(n);if(i>=55296&&i<=56319){let s=e.charCodeAt(n+1);if(n+1>=e.length||s<56320||s>57343)throw new TypeError("canonical JSON cannot contain a lone surrogate");n+=1}else if(i>=56320&&i<=57343)throw new TypeError("canonical JSON cannot contain a lone surrogate")}}function Xa(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 Zm(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 o=[];for(let c=0;c<e.length;c+=1){if(!(c in e))throw new TypeError("canonical JSON cannot contain sparse arrays");o.push(Xa(e[c],n))}return`[${o.join(",")}]`}let i=Object.getPrototypeOf(e);if(i!==Object.prototype&&i!==null)throw new TypeError("canonical JSON objects must be plain records");let s=e;return`{${Object.keys(s).sort().map(o=>(Zm(o),`${JSON.stringify(o)}:${Xa(s[o],n)}`)).join(",")}}`}finally{n.delete(e)}}function oo(e){return Xa(e,new Set)}async function ss(e){let n=oo(e),i=new TextEncoder().encode(n),s=globalThis.crypto?.subtle?new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",i)):(await import("@noble/hashes/sha256")).sha256(i);return`sha256:${Array.from(s,o=>o.toString(16).padStart(2,"0")).join("")}`}async function Gj(e){return ss(to.parse(e))}async function qj(e){return ss(il.parse(e))}async function Wj(e){let n=Ny.parse(e).map(i=>({...i})).sort((i,s)=>i.path<s.path?-1:i.path>s.path?1:0);return ss({version:1,files:n})}async function Bj(e){return ss(By(e))}import{z as v}from"zod";var Hj=["page-seo","root-layout-metadata","nav-items"],$j=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()}),Vj=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(),robots:v.union([v.string(),v.record(v.string(),v.unknown())]).optional()}),ll=()=>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()}),Yj=ll().extend({children:v.array(ll()).optional()}),Ky=["title","description","keywords","breadcrumbs_json.*.name","breadcrumbs_json.*.text"],zy=["path","meta_tags_json.**","schema_json.**","breadcrumbs_json.*.url"],Hy=["title","title.default","title.template","title.absolute","description","keywords","openGraph.title","openGraph.description","openGraph.siteName","openGraph.images.*.alt","twitter.title","twitter.description"],$y=["metadataBase","openGraph.type","openGraph.url","openGraph.locale","openGraph.images.*","openGraph.images.*.url","twitter.card","twitter.images.*","alternates.canonical","robots.**"],Vy=["label","description","badge"],Yy=["href","targetType","role","iconKey"],pl={"page-seo":{localizable:Ky,machine:zy},"root-layout-metadata":{localizable:Hy,machine:$y},"nav-items":{localizable:Vy,machine:Yy}},dl="*",ul="**",Xy="children";function Qy(e){return typeof e=="number"||/^\d+$/.test(e)?dl:e}function gl(e,n){let i=n.map(Qy);return e!=="nav-items"?i:i.filter(s=>s!==dl&&s!==Xy)}function _l(e,n){let i=e.split(".");for(let s=0;s<i.length;s+=1){if(i[s]===ul)return!0;if(s>=n.length||i[s]!==n[s])return!1}return i.length===n.length}function Zy(e,n){let i=e.split(".");if(n.length>=i.length)return!1;for(let s=0;s<n.length;s+=1){if(i[s]===ul)return!0;if(i[s]!==n[s])return!1}return!0}function Xj(e,n){let i=gl(e,n);return i.length===0?!1:pl[e].localizable.some(s=>_l(s,i))}function Qj(e,n){let i=gl(e,n);if(i.length===0)return!0;let{localizable:s,machine:a}=pl[e];return[...s,...a].some(o=>_l(o,i)||Zy(o,i))}var eL=["product-search","migration-products","standard-form","form-submission-infrastructure"],Jy=[{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/${St}.ts`,materializer:"migration-products"},{path:`components/site/generated/${St}-list.tsx`,materializer:"migration-products"},{path:`app/${St}/[slug]/page.tsx`,materializer:"migration-products"},{path:`components/site/generated/${St}-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"}],ex=[{prefix:"components/site/generated/forms/form-",suffix:".tsx",materializer:"standard-form"}],tL=[{path:`components/site/generated/${St}-list-view.tsx`,reason:"\u8DEF\u5F84\u5F52\u5E73\u53F0\u3001\u5185\u5BB9\u5F52\u7AD9\u70B9\uFF1A\u4E13\u7528\u4EA7\u54C1 Worker \u6309\u7AD9\u70B9\u8BBE\u8BA1\u751F\u6210\u5217\u8868\u89C6\u56FE\uFF1B\u9996\u6B21 fallback \u4E0D\u6539\u53D8\u5F52\u5C5E\uFF0C\u9759\u6001\u6587\u6848\u987B\u968F\u5B50\u7AD9\u7FFB\u8BD1\u3002"},{path:`components/site/generated/${St}-detail-view.tsx`,reason:"\u8DEF\u5F84\u5F52\u5E73\u53F0\u3001\u5185\u5BB9\u5F52\u7AD9\u70B9\uFF1A\u4E13\u7528\u4EA7\u54C1 Worker \u6309\u7AD9\u70B9\u8BBE\u8BA1\u751F\u6210\u8BE6\u60C5\u89C6\u56FE\uFF1B\u9996\u6B21 fallback \u4E0D\u6539\u53D8\u5F52\u5C5E\uFF0C\u9759\u6001\u6587\u6848\u987B\u968F\u5B50\u7AD9\u7FFB\u8BD1\u3002"},{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"},{path:"components/system/not-found-content.tsx",reason:"\u4E00\u6B21\u6027\u5199\u5165\u3001\u4E4B\u540E\u5185\u5BB9\u5F52\u7AD9\u70B9\uFF1A\u5EFA\u7AD9\u65F6\u4EC5\u5728\u6A21\u677F\u539F\u7248\u4E0A\u6309\u7AD9\u70B9\u8BED\u79CD\u5199\u4E00\u6B21 404 \u6587\u6848\uFF0C\u4E4B\u540E\u7531\u7528\u6237\u3001\u8BBE\u8BA1\u5668\u6216 Agent \u7EF4\u62A4\uFF0C\u91CD\u8DD1\u4E5F\u4E0D\u4F1A\u8986\u5199\u6539\u8FC7\u7684\u5185\u5BB9\uFF1B\u5B50\u7AD9\u987B\u968F\u6574\u7AD9\u7FFB\u8BD1\u5B83\u3002"}];function tx(e){return e.length>0&&!e.includes("/")&&!e.includes(".")}function nL(e){return Jy.some(n=>n.path===e)?!0:ex.some(n=>!e.startsWith(n.prefix)||!e.endsWith(n.suffix)?!1:tx(e.slice(n.prefix.length,e.length-n.suffix.length)))}import{z as bt}from"zod";var nx=["provisioning","cms_app_created","seeded","ready","failed"],oL=bt.object({tenant_id:bt.string().min(1),site_id:k,collection_slug:bt.string().min(1),cms_collection_id:bt.string().min(1).nullable(),status:bt.enum(nx),owned_by_vcp:bt.boolean(),run_id:$.nullable(),last_error:bt.string().nullable(),created_at:bt.string().datetime(),updated_at:bt.string().datetime()});var hl="/vibe/v1";function ix(e){let n=e?.trim().replace(/\/+$/,"");if(!n)return null;try{let i=new URL(n),s=i.pathname.replace(/\/+$/,"");return i.search="",i.hash="",i.pathname=s.endsWith(hl)?s:hl,i.href.replace(/\/+$/,"")}catch{return n}}function cL(e){let n=ix(e.publicProxyUrl),i=e.cmsSiteId?.trim(),s=e.tenantId?.trim();return n&&i&&s?{cmsProxyUrl:n,cmsProjectId:i,cmsTenantId:s}:null}function lL(e){let n=e.tenant_id?.trim(),i=e.cms_site_id?.trim();if(!n||!i)throw new Error("CMS_REQUEST_CONTEXT_MISSING");return{Accept:"application/json","X-Tenant-Id":n,"X-Site-Id":i}}import{z as g}from"zod";var as=g.string().url().refine(Rx,{message:"URL must use http or https"}),Sl=g.string().trim().pipe(as),sx=g.object({task_type:g.literal("home_url"),task_url:Sl,planned_num:g.number().int().min(1).max(20).optional()}).strict(),ax=g.object({task_type:g.literal("url_list"),urls:g.array(as).min(1).max(1e4)}).strict(),gL=g.discriminatedUnion("task_type",[sx,ax]),_L=g.object({page:g.coerce.number().int().positive().default(1),page_size:g.coerce.number().int().min(1).max(20).default(20)}).strict(),hL=g.object({home_url:Sl}).strict(),Ht=g.string().uuid(),un=g.string().uuid(),SL=g.object({task_uuid:Ht}).strict(),fl=g.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]),ox=g.object({task_uuid:Ht,status:g.literal("NOT_STARTED"),total:g.literal(0)}).strict(),rx=g.object({task_uuid:Ht,status:g.literal("PROCESSING"),total:g.literal(0)}).strict(),fL=g.enum(["no_suitable_page_candidate","page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"]),cx=g.discriminatedUnion("status",[g.object({role:Tt,status:g.literal("selected"),reason_code:g.null()}).strict(),g.object({role:Tt,status:g.literal("not_found"),reason_code:g.literal("no_suitable_page_candidate")}).strict(),g.object({role:Tt,status:g.literal("unknown"),reason_code:g.enum(["page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"])}).strict()]),bl=g.array(cx).length(7).superRefine((e,n)=>{let i=new Set(e.map(s=>s.role));i.size!==e.length&&n.addIssue({code:"custom",message:"discovery coverage roles must be unique"});for(let s of Tt.options)i.has(s)||n.addIssue({code:"custom",message:`discovery coverage is missing role ${s}`})}),mx=g.object({task_uuid:Ht,status:g.literal("SUCCEEDED"),total:g.number().int().positive(),discovery_coverage:bl.optional()}).strict(),lx=g.enum(["TASK_FAILED","PROVIDER_CAPABILITY_LIMIT","WEBSITE_UNREACHABLE"]),px=g.object({task_uuid:Ht,status:g.literal("FAILED"),total:g.literal(0),error_code:lx,error_message:g.string().min(1),failure_stage:fl}).strict(),bL=g.discriminatedUnion("status",[ox,rx,mx,px]),dx=g.object({url:as,raw_html:g.string().min(1)}).strict(),yL=g.object({task_uuid:Ht,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(dx).max(20),discovery_coverage:bl.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"})}),xL=g.object({task_code:un}).strict(),ux=g.object({task_code:un,status:g.literal("NOT_STARTED")}).strict(),gx=g.object({task_code:un,status:g.literal("PROCESSING")}).strict(),_x=g.object({task_code:un,status:g.literal("SUCCEEDED"),urls:g.array(as)}).strict(),hx=g.literal("SITEMAP_DISCOVERY_FAILED"),Sx=g.object({task_code:un,status:g.literal("FAILED"),error_code:hx,error_message:g.string().min(1)}).strict(),EL=g.discriminatedUnion("status",[ux,gx,_x,Sx]),RL=g.object({company_name:g.string().regex(/\S/u)}).strict(),fx=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(),os=g.object({company_uuid:g.string().uuid(),company_info:fx,created_at:g.string().datetime(),updated_at:g.string().datetime()}),bx=os.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(),yx=os.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(),yl=os.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(),xl=os.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(),IL=g.discriminatedUnion("status",[yl,xl]),TL=g.discriminatedUnion("status",[bx,yx,yl,xl]),xx=["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"],Ex=g.enum(xx),kL=g.object({error_code:Ex,error_message:g.string().min(1),failure_stage:fl.optional(),task_uuid:Ht.optional(),task_code:un.optional()}).strict();function Rx(e){try{let n=new URL(e).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as W}from"zod";var Ye=W.string().url().refine(kx,{message:"URL must use http or https"}),El=W.string().min(1).max(512),rs=W.string().datetime({offset:!0}),Rl=W.enum(["scraping","completed","failed","expired"]),PL=W.object({url:Ye,ignore_cache:W.boolean(),sitemap:W.enum(["include","skip"]),include_subdomains:W.boolean(),ignore_query_parameters:W.boolean(),limit:W.number().int().min(1).max(1e5)}).strict(),CL=W.object({links:W.array(Ye).max(1e5)}).strict(),vL=W.object({url:Ye,limit:W.number().int().min(1).max(1e5),max_discovery_depth:W.literal(1),crawl_entire_domain:W.literal(!1),allow_subdomains:W.literal(!0),sitemap:W.literal("skip")}).strict(),DL=W.object({crawl_id:El,expires_at:rs.optional()}).strict(),OL=W.object({status:Rl,urls:W.array(Ye).max(1e5),next:Ye.optional(),expires_at:rs}).strict(),NL=W.object({url:Ye,formats:W.tuple([W.literal("rawHtml")]),only_main_content:W.literal(!1),max_age:W.number().int().nonnegative()}).strict(),jL=W.object({url:Ye,raw_html:W.string().min(1),status_code:W.number().int().min(100).max(599).nullable()}).strict(),LL=W.object({urls:W.array(Ye).min(1).max(1e4),formats:W.tuple([W.literal("rawHtml")]),ignore_invalid_urls:W.literal(!1),max_age:W.number().int().nonnegative(),max_concurrency:W.number().int().positive().optional()}).strict(),ML=W.object({batch_id:El,expires_at:rs.optional()}).strict(),Ix=W.object({url:Ye,raw_html:W.string().min(1)}).strict(),UL=W.object({status:Rl,total:W.number().int().nonnegative(),completed:W.number().int().nonnegative(),pages:W.array(Ix).max(1e4),next:Ye.optional(),expires_at:rs}).strict().superRefine((e,n)=>{e.completed>e.total&&n.addIssue({code:"custom",path:["completed"],message:"completed must not exceed total"})}),Tx=W.object({url:Ye,error_message:W.string().min(1)}).strict(),FL=W.object({errors:W.array(Tx).max(1e4),robots_blocked:W.array(Ye).max(1e4)}).strict(),GL=W.object({active:W.number().int().nonnegative(),waiting:W.number().int().nonnegative(),max_concurrency:W.number().int().positive()}).strict();function kx(e){try{let n=new URL(e).protocol;return n==="http:"||n==="https:"}catch{return!1}}var Il=["write_file","edit_file","delete_file"],Tl="apply_patch_batch",Ax=["set_breadcrumb_placement"],wx=[...Il,Tl,...Ax];function Px(e){return Il.includes(e)}function WL(e){return wx.includes(e)}function BL(e){return Px(e)||e===Tl}import{z as b}from"zod";var kl=b.lazy(()=>gn),Cx=b.enum(["page","block"]),ms=b.enum(["component","page","pages"]),vx=b.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),$t=vx,Al=b.object({requested_locale:$t,resolved_locale:$t,fallback_used:b.boolean()}).strict(),ii=b.object({id:b.string().uuid(),key:b.string().min(1),name:b.string().min(1)}).strict(),cs=ii.extend({color:b.string().nullable()}).strict(),VL=b.object({kind:Cx,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(),Dx=b.object({stable_key:b.string().min(1),type:ms,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:ii.nullable(),tags:b.array(cs),page_count:b.number().int().nonnegative(),component_count:b.number().int().nonnegative(),locale:Al}).strict(),YL=b.object({items:b.array(Dx),facets:b.object({categories:b.array(ii),tags:b.array(cs)}).strict(),next_cursor:b.string().nullable()}).strict(),XL=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:kl,target_page_id:b.string().min(1).optional()}).strict(),QL=b.object({next_sitemap:kl,applied:b.object({stable_key:b.string().min(1),resolved_version:b.number().int().positive(),template_type:ms,page_ids:b.array(b.string().min(1)),block_ids:b.array(b.string().min(1))}).strict(),locale:Al,warnings:b.array(b.string())}).strict(),wl=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(),Pl=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(wl).min(1).max(100),thumbnail:b.string().url().optional(),source:b.unknown().optional()}).strict(),Ox=Pl.extend({nodeId:b.uuidv7(),parentNodeId:b.uuidv7().optional()}).strict(),Nx=b.object({pages:b.array(Ox).min(1).max(50),thumbnail:b.string().url().optional(),source:b.unknown().optional()}).strict().superRefine(({pages:e},n)=>{let i=new Map(e.map(a=>[a.nodeId,a])),s=e.flatMap(a=>[a.nodeId,...a.components.map(o=>o.nodeId)]);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["pages"],message:"Node ids must be unique within the shared structure."}),new Set(e.map(a=>a.slug)).size!==e.length&&n.addIssue({code:"custom",path:["pages"],message:"Page slugs must be unique."});for(let[a,o]of e.entries()){if(o.parentNodeId===void 0)continue;let c=h=>n.addIssue({code:"custom",path:["pages",a,"parentNodeId"],message:h}),r=i.get(o.parentNodeId);r||c("Parent must reference a page in this template."),o.parentNodeId===o.nodeId&&c("A page cannot be its own parent."),(o.slug==="/"||r?.slug==="/")&&c("The home page cannot be a parent or child."),r?.parentNodeId!==void 0&&c("Pages allow at most two levels; the parent must be a root page.");let l=new Set([o.nodeId]),x=o.parentNodeId;for(;x!==void 0;){if(l.has(x)){c("Page parent references must not contain a cycle.");break}l.add(x),x=i.get(x)?.parentNodeId}}}),jx=b.union([wl,Pl,Nx]),Lx=b.object({title:b.string().min(1).max(200),description:b.string().min(1).max(1e3),prompt:b.string().min(1).max(8192)}).strict(),Mx=b.object({locale:$t,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(),Lx)}).strict()}).strict(),ZL=b.object({templateId:b.string().uuid(),stableKey:b.string().min(1),type:ms,resolvedVersion:b.number().int().positive(),contentSchemaVersion:b.literal(3),structure:jx,requestedLocale:$t,resolvedLocale:$t,fallbackUsed:b.boolean(),contents:b.array(Mx).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 i=Ux(e.structure),s=new Set(Object.keys(e.contents[0]?.content.nodes??{}));(i.size!==s.size||[...i].some(a=>!s.has(a)))&&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."})}),JL=b.object({items:b.array(b.object({stableKey:b.string().min(1),type:ms,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:ii.nullable(),tags:b.array(cs),pageCount:b.number().int().nonnegative(),componentCount:b.number().int().nonnegative(),requestedLocale:$t,resolvedLocale:$t,fallbackUsed:b.boolean()}).strict()),facets:b.object({categories:b.array(ii),tags:b.array(cs)}).strict(),nextCursor:b.string().nullable()}).strict().superRefine((e,n)=>{e.items.forEach((i,s)=>{i.fallbackUsed!==(i.requestedLocale!==i.resolvedLocale)&&n.addIssue({code:"custom",path:["items",s,"fallbackUsed"],message:"fallbackUsed must match locale resolution."})})});function Ux(e){if("type"in e)return new Set([e.nodeId]);let n="pages"in e?e.pages:[e];return new Set(n.flatMap(i=>[...i.nodeId?[i.nodeId]:[],...i.components.map(s=>s.nodeId)]))}function eM(e){return oo({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}from"zod";var Fx=["pending_dns","active","failed","removing"],Gx=z.enum(Fx),qx=["serve_site","redirect_301"],Wx=z.enum(qx),Bx=["traffic","ownership","certificate_delegation"],ro=z.enum(Bx),Kx=["pending","verified"],zx=z.enum(Kx),Hx=["not_applicable","unavailable","not_needed","auto_applied","confirmation_required","blocked"],$x=z.enum(Hx),co=z.enum(["prepare_configuration","apply_configuration","verify_dns","remediate_dns","confirm_dns_remediation"]),Vx=z.enum(["accepted","running","succeeded","failed"]),Yx=z.object({code:z.string().min(1),message:z.string().min(1)}).strict(),Xx=z.object({purpose:ro,verified:z.boolean(),observedValues:z.array(z.string())}).strict(),Cl=z.object({ready:z.boolean(),providerReady:z.boolean(),dnsVerified:z.boolean(),records:z.array(Xx)}).strict(),vl=z.object({type:z.string().min(1),name:z.string().min(1),value:z.string().min(1),ttl:z.number().nullable()}).strict(),Qx=z.object({purpose:ro,action:z.enum(["none","create","update","blocked"]),before:vl.nullable(),after:vl.nullable()}).strict(),Dl=z.object({domainId:z.string().min(1),status:$x,changes:z.array(Qx)}).strict(),Zx=z.object({purpose:ro,type:z.string().min(1),name:z.string().min(1),value:z.string().min(1),verificationStatus:zx}).strict(),Ol=z.object({id:z.string().min(1),hostname:z.string().min(1),isPrimary:z.boolean(),routingMode:Wx,observedStatus:Gx,lastVerifiedAt:z.string().datetime().nullable(),dnsRecords:z.array(Zx)}).strict().superRefine((e,n)=>{Jx(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"})}),Nl=z.object({primaryDomain:Ol.nullable(),redirectDomains:z.array(Ol)}).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[s,a]of e.redirectDomains.entries())(a.isPrimary||a.routingMode!=="redirect_301")&&n.addIssue({code:"custom",path:["redirectDomains",s],message:"redirectDomains must be non-primary 301 redirects"});e.primaryDomain!==null&&e.redirectDomains.some(a=>a.hostname===e.primaryDomain?.hostname)&&n.addIssue({code:"custom",path:["redirectDomains"],message:"primaryDomain must not also be a redirect"});let i=[...e.primaryDomain===null?[]:[e.primaryDomain.hostname],...e.redirectDomains.map(s=>s.hostname)];new Set(i).size!==i.length&&n.addIssue({code:"custom",path:["redirectDomains"],message:"domain hostnames must be unique"})}),ls=z.object({id:z.string().min(1),type:co,status:Vx,error:Yx.nullable(),result:z.union([Cl,Dl]).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"){Cl.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"){Dl.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 Jx(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(i=>i.length>=1&&i.length<=63&&/^[a-z0-9-]+$/.test(i)&&!i.startsWith("-")&&!i.endsWith("-"))}import{z as Me}from"zod";import{z as y}from"zod";var eE=y.enum(["active","completed","canceled"]),tE=y.enum(["quality","domain","gsc","publish"]),ps=y.enum(["pending","running","succeeded","failed"]),Ll=ps,Ml=y.enum(["pending","running","completed"]),nE=y.object({group_code:y.string().min(1),name:y.string().min(1),score:y.number().nonnegative(),total_score:y.number().nonnegative(),pass_score:y.number().nonnegative(),running_status:Ml,result_text:y.string()}).strict(),iE=y.object({id:y.number().int().positive().optional(),quality_task_id:y.number().int().positive(),item_code:y.string().min(1),status:ps,is_repaired:y.boolean(),total_score:y.number().nonnegative(),score:y.number().nonnegative(),check_result:y.unknown().nullable(),remediation_items:y.unknown().nullable(),result_text:y.string(),created_at:y.string().min(1),updated_at:y.string().min(1),item_name:y.string().min(1),dimension_code:y.enum(["reach","trust","convert","safe"]),group_code:y.string().min(1),auto_fix:y.boolean()}).strict(),sE=y.object({dimension_code:y.enum(["reach","trust","convert","safe"]),name:y.string().min(1),alias_en:y.string().min(1),description:y.string(),tips:y.string(),score:y.number().nonnegative(),repaired_score:y.number().nonnegative(),total_score:y.number().nonnegative(),pass_score:y.number().nonnegative(),running_status:Ml,problem_group_count:y.number().int().nonnegative(),remediation_items:y.array(iE),groups:y.array(nE)}).strict(),aE=y.object({id:y.number().int().positive(),task_code:y.string().uuid(),scene_code:y.enum(["site_publish","vcp_published_pages","content_publish"]),tenant_id:y.string().min(1),vcp_site_id:k,cms_site_id:y.string().min(1),checked_url:y.string().url(),quality_params:y.record(y.string(),y.unknown()).nullable(),status:ps,error_info:y.record(y.string(),y.unknown()).nullable(),created_at:y.string().min(1),updated_at:y.string().min(1)}).strict(),oE=y.union([y.object({}).strict(),y.object({summary:y.object({final_score:y.number().nonnegative(),pass_score:y.number().nonnegative(),group_count:y.number().int().nonnegative(),problem_group_count:y.number().int().nonnegative()}).strict(),dimensions:y.array(sE)}).strict()]),jl=y.object({quality_info:aE,quality_detail:oE}).strict().superRefine((e,n)=>{let i="summary"in e.quality_detail;e.quality_info.status!=="failed"&&!i&&n.addIssue({code:"custom",message:"nonfailed quality tasks require complete detail",path:["quality_detail"]}),e.quality_info.status==="failed"&&i&&n.addIssue({code:"custom",message:"failed quality tasks require empty detail",path:["quality_detail"]})}),mM=y.object({item_code:y.string().min(1),remediation_items:y.unknown().nullable()}).strict(),rE=y.object({item_code:y.string().min(1),repair_status:y.enum(["succeeded","failed"]),message:y.string().min(1).optional(),error_code:y.string().min(1).optional(),metadata:y.record(y.string(),y.unknown()).optional()}).strict(),Ul=y.object({items:y.array(rE)}).strict(),lM=y.object({task_code:y.string().min(1),status:Ll,result:Ul.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"})}),Dt=y.object({id:ci,tenant_id:y.string().min(1),site_id:k,status:eE,current_step:tE,quality_task_code:y.string().uuid().nullable(),quality_task_status:ps,repair_task_code:y.string().min(1).nullable(),repair_task_status:Ll,publish_deployment_id:mt.nullable(),domain_hostname:y.string().min(1).nullable(),domain_operation_type:co.nullable(),domain_operation_payload:y.record(y.string(),y.unknown()).nullable(),domain_preparation_operation_id:y.string().min(1).nullable(),domain_operation_id:y.string().min(1).nullable(),revision:y.number().int().positive(),created_at:y.string().min(1),updated_at:y.string().min(1),completed_at:y.string().min(1).nullable(),canceled_at:y.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"})}),pM=y.object({}).strict(),dM=y.object({expected_revision:y.number().int().nonnegative(),current_step:y.enum(["domain","gsc","publish"]),skip_domain_binding:y.boolean().optional()}).strict(),uM=y.object({expected_revision:y.number().int().nonnegative()}).strict(),cE=y.object({workflow:Dt.nullable(),can_cancel:y.boolean()}).strict(),gM=M(cE).strict(),mE=y.object({workflow:Dt,can_cancel:y.boolean()}).strict(),_M=M(mE).strict(),lE=y.object({workflow:Dt,deployment:y.lazy(()=>Ot)}).strict(),hM=M(lE).strict(),pE=y.object({workflow:Dt,can_cancel:y.boolean(),quality_result:jl.optional(),repair_result:Ul.optional(),final_quality_result:jl.optional(),message:y.string().min(1).optional()}).strict(),SM=M(pE).strict();function fM(e){if(e.quality_info.status!=="succeeded"||!("summary"in e.quality_detail))return[];let n=new Set(["heading_structure","click_obstruction","page_runtime_error"]);return e.quality_detail.dimensions.flatMap(i=>i.remediation_items.filter(s=>s.status==="succeeded"&&s.score<s.total_score&&s.auto_fix&&n.has(s.item_code)).map(s=>({item_code:s.item_code,remediation_items:s.remediation_items})))}function bM(e,n){let i=e.map(o=>o.item_code),s=n.items.map(o=>o.item_code);if(new Set(i).size!==i.length||new Set(s).size!==s.length||i.length!==s.length)return!1;let a=new Set(i);return n.items.every(o=>a.has(o.item_code)&&o.repair_status==="succeeded")}function yM(e,n){return e.quality_info.status!=="succeeded"||!("summary"in e.quality_detail)?null:e}var dE=Me.object({hostname:Me.string().min(1),expected_revision:Me.number().int().nonnegative()}).strict(),Fl=Me.object({workflow:Dt,operation:ls}).strict(),uE=M(Fl).strict(),gE=Me.object({expected_revision:Me.number().int().nonnegative()}).strict(),_E=Me.object({workflow:Dt,operation:ls}).strict(),hE=M(_E).strict(),mo=Me.object({workflow:Dt,operation:ls.nullable()}).strict(),SE=M(mo).strict(),fE=mo,bE=M(fE).strict(),kM=M(Nl).strict(),yE=Me.object({published:Me.boolean(),hostname:Me.string(),url:Me.string(),sandbox_url:Me.union([Me.string().url(),Me.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"}))}),AM=M(yE).strict(),wM=dE,PM=Fl,CM=uE,vM=mo,DM=SE,OM=bE,NM=gE,jM=hE;import{z as Be}from"zod";var xE=["started","success","failed","canceled"],lo=Be.enum(xE),EE=["inactive","pending_binding","active"],po=Be.enum(EE),RE=["domain","url_prefix"],uo=Be.enum(RE),IE=["not_connected","authorizing","matching_property","ready","failed","canceled","domain_mismatch"],go=Be.enum(IE),ct=Be.string().nullable(),Gl=Be.object({}).strict(),_o=Be.object({authorize_url:Be.string().url(),custom_domain:ct}).strict(),ql=M(_o),TE=Be.object({auth_status:lo,binding_status:po,credential_connected:Be.boolean(),custom_domain:ct,gsc_site_url:ct,property_type:uo.nullable(),auth_error_code:ct,auth_error_message:ct}).strict(),Wl=Be.object({auth_status:lo,binding_status:po,credential_connected:Be.boolean(),custom_domain:ct,gsc_site_url:ct,property_type:uo.nullable(),auth_error_code:ct,auth_error_message:ct,current_domain:ct,state:go,ready:Be.boolean()}).strict().superRefine((e,n)=>{let i=AE(e,e.current_domain),s=i==="ready";e.state!==i&&n.addIssue({code:"custom",path:["state"],message:`state must equal ${i} for the supplied GSC facts`}),e.ready!==s&&n.addIssue({code:"custom",path:["ready"],message:`ready must equal ${String(s)} for the supplied GSC facts`})}),kE=M(Wl);function si(e){let n=e?.trim()??"";if(!n)return"";let i=/^[a-z][a-z0-9+.-]*:\/\//i.test(n)?n:`https://${n}`;try{return new URL(i).hostname.replace(/\.+$/,"").toLowerCase()}catch{return n.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").split(/[/?#]/,1)[0].replace(/\.+$/,"").toLowerCase()}}function AE(e,n){let i=e.gsc_site_url?.trim()??"",s=si(e.custom_domain),a=si(n??("current_domain"in e?e.current_domain:void 0)),o=s.length>0&&a.length>0&&s===a,c=wE(i,e.property_type,a);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":i.length===0||e.property_type===null?"matching_property":!o||!c?"domain_mismatch":e.binding_status==="pending_binding"?"matching_property":e.auth_status==="success"&&e.binding_status==="active"&&e.credential_connected&&i.length>0&&o&&c?"ready":"failed"}function wE(e,n,i){let s=e?.trim()??"",a=si(i);if(!s||!a||!n)return!1;if(n==="domain"){let o=/^sc-domain:(.+)$/i.exec(s);if(!o)return!1;let c=o[1].trim();if(!c||/[/:?#]/.test(c))return!1;let r=si(c);return r?a===r||a.endsWith(`.${r}`):!1}try{let o=new URL(s);return o.protocol!=="https:"||o.username||o.password||o.port||o.pathname!=="/"||o.search||o.hash?!1:si(o.hostname)===a}catch{return!1}}var FM=Gl,GM=_o,qM=ql,WM=go,BM=lo,KM=po,zM=uo,HM=go,$M=Gl,VM=_o,YM=ql,XM=TE,QM=Wl,ZM=kE;import{z as O}from"zod";var Ke=O.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),tt=O.string().min(1).max(4096),_n=O.string().regex(/^[A-Za-z0-9_-]{43}$/),hn=O.string().max(300),ho=O.string().datetime({offset:!0}).nullable(),Bl=O.string().regex(/^[A-Z][A-Z0-9_]*$/).max(100).nullable(),PE=["authorized","pending","failed","revoked","expired","not_authorized"],CE=O.enum(PE),vE=["pending","succeeded","failed","canceled","expired","superseded"],DE=O.enum(vE),OE=["unconfigured","configured","needs_reconfiguration","unverified"],NE=O.enum(OE),jE=["not_checked","valid","invalid","unavailable"],LE=O.enum(jE),ME=["authorization_pending","authorization_required","authorization_changed","resource_unavailable","resource_changed","verification_required","verification_unavailable"],UE=O.enum(ME),Kl=O.object({revision:Ke,status:DE,started_at:O.string().datetime({offset:!0}),expires_at:O.string().datetime({offset:!0}),finished_at:ho,error_code:Bl}).strict(),nU=O.object({expected_authorization_revision:Ke,expected_attempt_revision:Ke,select_account:O.boolean().default(!1),replace_pending:O.boolean().default(!1)}).strict(),FE=O.object({authorize_url:O.string().url(),authorization_revision:Ke,attempt:Kl}).strict(),iU=M(FE),GE=O.object({status:CE,authorization_revision:Ke,account_email:O.string().max(320).nullable(),latest_attempt:Kl.nullable()}).strict(),qE=O.object({account_ref:tt,account_key:_n,account_display_name:hn,property_ref:tt,property_key:_n,property_display_name:hn,data_stream_ref:tt,data_stream_key:_n,data_stream_display_name:hn,measurement_id_display:O.string().min(1).max(40),default_uri:O.string().url().nullable(),selected_authorization_revision:Ke,configured_at:O.string().datetime({offset:!0}),updated_at:O.string().datetime({offset:!0})}).strict(),WE=O.object({status:LE,checked_at:ho,expires_at:ho,error_code:Bl}).strict(),BE=O.enum(["oauth","verification"]),KE=O.object({measurement_id_display:O.string().min(1).max(40),stream_display_name:O.string().max(100).nullable()}).strict(),zE=O.object({status:O.enum(["pending","applied"]),applied_revision:Ke}).strict(),zl=O.object({capability_enabled:O.boolean(),revision:Ke,authorization:GE,binding_status:NE,reason:UE.nullable(),ready:O.boolean(),mode:BE.nullable(),binding:qE.nullable(),verification:WE,tracking:KE.nullable(),deployment:zE}).strict().superRefine((e,n)=>{if(!e.capability_enabled){(e.ready||e.revision!==0||e.authorization.status!=="not_authorized"||e.authorization.authorization_revision!==0||e.authorization.account_email!==null||e.authorization.latest_attempt!==null||e.binding_status!=="unconfigured"||e.reason!==null||e.mode!==null||e.binding!==null||e.tracking!==null||e.deployment.status!=="applied"||e.deployment.applied_revision!==0||e.verification.status!=="not_checked"||e.verification.checked_at!==null||e.verification.expires_at!==null||e.verification.error_code!==null)&&n.addIssue({code:O.ZodIssueCode.custom,message:"disabled GA4 capability must expose an empty state"});return}e.ready&&(e.authorization.status!=="authorized"||e.binding_status!=="configured"||e.mode!=="oauth"||e.binding===null||e.tracking===null||e.verification.status!=="valid"||e.reason!==null)&&n.addIssue({code:O.ZodIssueCode.custom,message:"ready GA4 status must be authorized, configured, and valid"})}),sU=M(zl),aU=O.object({refresh:O.union([O.boolean(),O.enum(["true","false"]).transform(e=>e==="true")]).default(!1)}).strict(),HE=O.object({property_ref:tt,property_key:_n,display_name:hn}).strict(),$E=O.object({account_ref:tt,account_key:_n,display_name:hn,properties:O.array(HE)}).strict(),VE=O.object({accounts:O.array($E),returned_count:O.number().int().nonnegative(),completeness:O.literal("unknown"),authorization_revision:Ke}).strict(),oU=M(VE),rU=O.object({authorization_revision:O.coerce.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER)}).strict(),YE=O.object({data_stream_ref:tt,data_stream_key:_n,display_name:hn,measurement_id_display:O.string().min(1).max(40),default_uri:O.string().url().nullable(),selectable:O.boolean(),unavailable_reason:O.string().max(100).nullable()}).strict(),XE=O.object({property_ref:tt,streams:O.array(YE),returned_count:O.number().int().nonnegative(),completeness:O.literal("unknown"),authorization_revision:Ke}).strict(),cU=M(XE),mU=O.object({property_ref:tt,authorization_revision:O.coerce.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER)}).strict(),lU=O.object({expected_revision:Ke,authorization_revision:Ke,account_ref:tt,property_ref:tt,data_stream_ref:tt,confirm_url_mismatch:O.boolean()}).strict(),QE=O.object({applied_revision:Ke,idempotency_replayed:O.boolean()}).strict(),ZE=zl.and(O.object({mutation:QE}).strict()),pU=M(ZE);var Hl=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,$l="VCP_E2B_PREVIEW_PROXY_DOMAIN must be a valid hostname.";function JE(e){let n=e?.trim().toLowerCase()??"";if(!n)return null;if(n.length>253||!n.includes(".")||!n.split(".").every(i=>Hl.test(i)))throw new Error($l);return n}function uU(e){let n=JE(e.proxyDomain);if(!n)return null;let i=e.sandboxId.trim();if(!Hl.test(i))throw new Error("sandboxId must be a valid DNS label.");if(`${i}.${n}`.length>253)throw new Error($l);return`https://${i}.${n}/`}function _U(e){for(let n of e.targets)if(!(n.kind==="shared"?e.ledger.shared.some(s=>s.kind==="shared"&&s.target_id===n.target_id&&s.filled!==!0):e.ledger.pages.some(s=>s.omissions.some(a=>a.kind===n.kind&&a.target_id===n.target_id&&a.filled!==!0))))return{ok:!1,target_id:n.target_id};return{ok:!0}}function eR(e,n,i=e){let s=new Map(e.map(r=>[r.slug,r])),a=new Map(i.map(r=>[r.id,r])),o=new Map(e.map(r=>{let l=a.get(r.id);return l&&l.slug!==null&&l.slug!==r.slug?[l.slug,r]:null}).filter(r=>r!==null)),c=new Set(i.map(r=>r.slug).filter(r=>r!==null&&!s.has(r)));return{primaryLinks:Vl(n.primaryLinks,e,s,o,c,a,"showInHeader"),footerLinks:Vl(n.footerLinks,e,s,o,c,a,"showInFooter")}}function Vl(e,n,i,s,a,o,c){let r=new Set,l=[];for(let[K,H]of e.entries()){let se=tR(H.href),fe=se===null?void 0:i.get(se)??s.get(se);if(se!==null&&a.has(se)&&!i.has(se)&&!s.has(se))continue;if(fe?.slug==="/"){l.push({kind:"independent",link:{...H,label:Yl(H,fe,o)}});continue}if(!fe){l.push({kind:"independent",link:H});continue}if(!fe.navigation[c])continue;r.add(fe.slug);let xn=se===fe.slug?H.href:nR(H.href,fe.slug);l.push({kind:"page",page:fe,link:{...H,label:Yl(H,fe,o),href:xn},index:K})}let x=l.filter(K=>K.kind==="page").sort((K,H)=>K.page.navigation.order-H.page.navigation.order||K.index-H.index),h=0,C=l.map(K=>K.kind==="page"?x[h++].link:K.link);for(let K of[...n].filter(H=>H.slug!=="/"&&H.navigation[c]).sort((H,se)=>H.navigation.order-se.navigation.order))r.has(K.slug)||C.push({label:K.title,href:K.slug});return C}function Yl(e,n,i){let s=i.get(n.id);return e.label===(s?.title??n.title)?n.title:e.label}function tR(e){if(!e.startsWith("/")||e.startsWith("//"))return null;let n=e.search(/[?#]/u);return n===-1?e:e.slice(0,n)}function nR(e,n){let i=e.search(/[?#]/u);return i===-1?n:`${n}${e.slice(i)}`}function ds(e){return e.trim().normalize("NFKC").toLowerCase()}function iR(e){let n=e?.toLowerCase();return n?.startsWith("zh")?"\u9996\u9875":n?.startsWith("ja")?"\u30DB\u30FC\u30E0":n?.startsWith("ko")?"\uD648":"Home"}function sR(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 aR(e){return e.map(n=>n.navigation.showInHeader===!0?n:{...n,navigation:{...n.navigation,showInHeader:!0}})}function ai(e){return e.parent_page_id??null}function us(e,n){let i=ai(e);return i===null?!0:!n.some(s=>s.id===i)}function Xl(e,n){return e.filter(i=>ai(i)===n&&i.id!==n)}function Ql(e){let n=e.filter(c=>us(c,e)),i=n.filter(c=>c.slug==="/"),s=n.filter(c=>c.slug!=="/"),a=[],o=new Set;for(let c of[...i,...s])if(!o.has(c.id)){a.push(c),o.add(c.id);for(let r of Xl(e,c.id))o.has(r.id)||(a.push(r),o.add(r.id))}for(let c of e)o.has(c.id)||(a.push(c),o.add(c.id));return a}function oR(e){if(!e.startsWith("/")||e.startsWith("//"))return null;let n=e.search(/[?#]/);return n===-1?e:e.slice(0,n)}function rR(e,n){let i=Ql(n),s=new Map;i.forEach((c,r)=>{c.slug!==null&&!s.has(c.slug)&&s.set(c.slug,r)});let a=[],o=[];for(let c of e){let r=oR(c.href),l=r===null?void 0:s.get(r);l===void 0?o.push(c):a.push({link:c,rank:l})}return a.sort((c,r)=>c.rank-r.rank),[...a.map(c=>c.link),...o]}function cR(e){let n=e.filter(i=>us(i,e)).length;return{top_level_pages:n,sub_pages:e.length-n,total_pages:e.length,content_items:e.reduce((i,s)=>i+s.blocks.length,0)}}function mR(e,n={}){let i=[],s=new Map(e.map(c=>[c.id,c])),a=e.filter(c=>c.slug==="/");a.length!==1?i.push({code:"missing_home",page_id:null,message:"The structure must contain exactly one home page."}):n.expectedHomeTitle&&ds(a[0].title)!==ds(n.expectedHomeTitle)&&i.push({code:"home_renamed",page_id:a[0].id,message:`The home page must keep its fixed name '${n.expectedHomeTitle}'.`});for(let c of e){c.title.trim().length===0&&i.push({code:"empty_title",page_id:c.id,message:"Page name is empty."}),c.slug&&n.reservedSlugs?.includes(c.slug)&&i.push({code:"reserved_slug",page_id:c.id,message:`Slug '${c.slug}' is reserved by the site's applications.`});let r=ai(c);if(r===null)continue;if(c.slug==="/"){i.push({code:"home_has_parent",page_id:c.id,message:"The home page cannot have a parent."});continue}if(r===c.id){i.push({code:"self_parent",page_id:c.id,message:"A page cannot be its own parent."});continue}let l=s.get(r);if(!l){i.push({code:"parent_not_found",page_id:c.id,message:`Parent page '${r}' does not exist.`});continue}if(l.slug==="/"){i.push({code:"home_has_children",page_id:c.id,message:"The home page cannot have sub pages."});continue}ai(l)!==null&&i.push({code:"depth_exceeded",page_id:c.id,message:"At most two levels are allowed."})}let o=new Map;for(let c of e){let r=us(c,e)?"__top__":ai(c),l=ds(c.title);if(l.length===0)continue;let x=o.get(r)??new Map,h=x.get(l);h!==void 0&&h!==c.id?i.push({code:"duplicate_sibling_title",page_id:c.id,message:`Page name '${c.title}' is already used at the same level.`}):x.set(l,c.id),o.set(r,x)}return i}var lR=16,pR=/[ᄀ-ᅟ⺀-〾ぁ-㏿㐀-䶿一-鿿ꀀ-꓏가-힣豈-﫿︰-﹯＀-⦆¢-₩]/u;function dR(e){let n=0;for(let i of e)n+=pR.test(i)?2:1;return n}function uR(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 A}from"zod";var Zl=20*1024*1024,gR=Zl,Jl=["jpg","jpeg","png","gif","webp","bmp"],ep=["mp4","avi","mov","webm","mkv"],tp=["mp3","wav","aac","flac","ogg","wma","m4a"],np=["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","md","csv"],ip=[...np,"zip","rar","json","xmind","psd","ai","fig","sketch"],_R=[...Jl,...ep,...tp,...ip],sp=["image/jpeg","image/png","image/gif","image/webp","image/bmp"],ap=["video/mp4","video/x-msvideo","video/quicktime","video/webm","video/x-matroska"],op=["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"],hR=[...sp,...ap,...op],rp=A.enum(["image","video","audio","file"]),cp=A.enum(["external","ai_generated","unsplash"]),So=A.object({resource_id:A.string().min(1),name:A.string().min(1).max(255),url:A.string().url(),thumbnail_url:A.union([A.string().url(),A.literal("")]),mime_type:A.string().trim().min(3).max(127),size:A.number().int().nonnegative(),width:A.number().int().positive().nullable(),height:A.number().int().positive().nullable(),source:cp,created_at:A.string().min(1).nullable()}),SR=A.object({page:A.coerce.number().int().min(1).default(1),page_size:A.coerce.number().int().min(1).max(100).default(24),keyword:A.string().trim().max(100).optional(),file_type:rp.default("image")}),fR=A.object({code:A.literal(0),message:A.string(),data:A.object({items:A.array(So),page:A.number().int().min(1),page_size:A.number().int().min(1),total:A.number().int().nonnegative()})}),bR=A.object({code:A.literal(0),message:A.string(),data:So}),fo=4,yR=A.object({pageName:A.string().trim().min(1).max(200),pageType:A.enum(["landing_page","general_page","detail_page","list_page","category_page","tag_page","author_page","search_page","date_page"]),sectionTitle:A.string(),nearbyTitle:A.string(),nearbyBody:A.string(),prompt:A.string().trim().min(1).max(2e3),aspectRatio:A.string().regex(/^[1-9]\d*:[1-9]\d*$/)}),mp=A.object({index:A.number().int().min(0).max(fo-1),ok:A.literal(!0),url:A.string().regex(/^data:image\/(?:png|jpeg|gif|webp|bmp);base64,[A-Za-z0-9+/]+={0,2}$/)}),xR=A.object({code:A.literal(0),message:A.string(),data:A.object({items:A.array(mp).min(1).max(fo)})}),lp=A.object({provider_id:A.string().min(1),url:A.string().url(),thumbnail_url:A.string().url(),width:A.number().int().positive(),height:A.number().int().positive(),alt:A.string(),photographer_name:A.string().min(1),photographer_url:A.string().url(),photo_url:A.string().url(),download_location:A.string().url(),dominant_color:A.string().nullable()}),ER=A.object({query:A.string().trim().min(1).max(100),page:A.coerce.number().int().min(1).default(1),page_size:A.coerce.number().int().min(1).max(30).default(18),orientation:A.enum(["landscape","portrait","squarish"]).optional()}),RR=A.object({code:A.literal(0),message:A.string(),data:A.object({items:A.array(lp),page:A.number().int().min(1),page_size:A.number().int().min(1),total:A.number().int().nonnegative(),total_pages:A.number().int().nonnegative()})}),pp=A.string().url().refine(wR,{message:"download_location must be an official Unsplash download URL"}),IR=A.object({download_location:pp}),TR=A.object({code:A.literal(0),message:A.string(),data:A.object({reported:A.boolean()})}),kR=A.object({source_id:A.number().int().positive(),source_title:A.string().min(1).max(255),source_url:qt,resource_id:A.number().int().positive()}),AR=A.object({code:A.literal(0),message:A.string(),data:A.object({reported:A.boolean()})});function wR(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 me}from"zod";var PR=me.object({colorSeeds:me.object({primary:me.string().min(1).max(40),accent:me.string().min(1).max(40),foreground:me.string().min(1).max(40).optional()}).strict().optional(),surfaceMode:me.enum(["light","dark"]).optional(),fonts:me.object({heading:me.string().min(1).max(60),body:me.string().min(1).max(60)}).strict().optional(),weightStyle:We.optional()}).strict().refine(e=>e.colorSeeds!==void 0||e.surfaceMode!==void 0||e.fonts!==void 0||e.weightStyle!==void 0,{message:"colorSeeds, surfaceMode, fonts, or weightStyle is required"}),CR=me.object({ok:me.literal(!0),design_plan_version:me.number().int().positive().optional(),snapshot_id:I,site_design_context:me.lazy(()=>gs).optional(),changed_files:me.array(me.string().min(1)).optional()}),vR=me.object({snapshot_id:I,color_seeds:me.object({primary:me.string(),accent:me.string(),foreground:me.string().optional()}).nullable(),surface_mode:me.enum(["light","dark"]).nullable(),fonts:me.object({heading:me.string(),body:me.string()}).nullable(),palette_inputs_present:me.boolean(),palette_inputs:Ta.nullable(),notes:me.array(me.string()).nullable(),weight_style:We.nullable().default(null),source:me.enum(["globals_css","design_plan_archive"])});import{z as D}from"zod";var Te=D.string().min(1).max(100),dp=D.enum(["page","anchor","external","email","phone","file","group"]);function DR(e){if(!e||e.trim()!==e||/[\u0000-\u001f\u007f\\]/u.test(e))return!1;if(e.startsWith("/")&&!e.startsWith("//")||/^#[^\s]*$/u.test(e)||/^(mailto:|tel:)[^\s]+$/iu.test(e))return!0;try{let n=new URL(e);return(n.protocol==="http:"||n.protocol==="https:")&&!n.username&&!n.password}catch{return!1}}var OR=D.string().max(2048).refine(DR,"Invalid navigation destination"),up=D.string().trim().min(1).max(255),gp=D.enum(["link","cta"]).nullable(),_p=D.lazy(()=>D.object({id:Te,group_id:Te,parent_id:Te.nullable(),sort_order:D.number().int().nonnegative(),label:D.string(),href:D.string().nullable(),target_type:dp,enabled:D.boolean(),effective_visible:D.boolean(),open_in_new:D.boolean(),nofollow:D.boolean(),role:gp,link_binding:D.object({kind:D.enum(["custom","cms_page","file"]),page_id:Te.nullable()}),children:D.array(_p)})),NR=D.object({id:Te,name:D.string(),description:D.string(),is_default:D.boolean(),can_delete:D.boolean(),delete_block_reason:D.string().nullable(),items:D.array(_p)}),jR=D.object({site_id:D.string().min(1),default_group_id:Te.nullable(),groups:D.array(NR),limits:D.object({max_depth:D.number().int().positive(),max_items:D.number().int().positive()})}),CU=D.object({data:jR}),hp=D.object({name:up,description:D.string().max(2e3).optional()}).strict(),LR=hp.partial().refine(e=>Object.keys(e).length>0,"At least one field is required"),vU=D.object({group_id:Te}).strict(),Sp={label:up,target_type:dp,href:OR.nullable().optional(),enabled:D.boolean().optional(),open_in_new:D.boolean().optional(),nofollow:D.boolean().optional(),role:gp.optional()},MR=D.object({group_id:Te,parent_id:Te.nullable().optional(),...Sp}).strict().superRefine((e,n)=>{e.target_type!=="group"&&!e.href&&n.addIssue({code:"custom",path:["href"],message:"Link destination is required"}),e.target_type==="group"&&e.href&&n.addIssue({code:"custom",path:["href"],message:"Groups have no destination"})}),UR=D.object({...Sp,link_mode:D.literal("custom").optional()}).partial().strict().refine(e=>Object.keys(e).length>0,"At least one field is required"),FR=D.object({group_id:Te,parent_id:Te.nullable(),before_id:Te.nullable().optional()}).strict(),GR=D.object({cms_bound:D.boolean(),cms_driven:D.boolean(),supports_groups:D.boolean(),supports_nested_groups:D.boolean(),supports_link_attributes:D.boolean(),requires_agent:D.boolean(),reasons:D.array(D.string())}),DU=D.object({data:GR}),OU=D.discriminatedUnion("action",[D.object({action:D.literal("create_group"),values:hp}).strict(),D.object({action:D.literal("update_group"),id:Te,values:LR}).strict(),D.object({action:D.literal("delete_group"),id:Te}).strict(),D.object({action:D.literal("set_default_group"),group_id:Te}).strict(),D.object({action:D.literal("create_item"),values:MR}).strict(),D.object({action:D.literal("update_item"),id:Te,values:UR}).strict(),D.object({action:D.literal("delete_item"),id:Te,cascade:D.boolean().optional()}).strict(),D.object({action:D.literal("move_item"),id:Te,values:FR}).strict()]);import{z as le}from"zod";var bo=le.enum(["products","cases","guides","documents","company"]),qR=le.enum(["source_unreachable","content_mojibake","min_fields_unmet","document_no_file_reference","document_file_unavailable","media_ingest_failed","app_unavailable","write_failed","kind_input_unavailable","kind_uncertain","kind_service_unavailable","kind_budget_exhausted"]),yt=le.number().int().nonnegative(),WR=le.discriminatedUnion("status",[le.object({collection:bo,status:le.literal("processing")}).strict(),le.object({collection:bo,status:le.enum(["imported","partial","failed"]),imported:yt,exception:yt}).strict()]),fp=le.enum(["legacy_domain_not_routed","site_context_missing","site_rules_limit_exceeded","site_rules_not_served"]),BR=le.enum(["target_page_unpublished","redirect_target_missing","redirect_write_failed",...fp.options]),KR=le.discriminatedUnion("status",[le.object({status:le.literal("processing")}).strict(),le.object({status:le.literal("unavailable")}).strict(),le.object({status:le.literal("ready"),site_reason:fp.nullable(),same_path:yt,active:yt,exception:yt,exceptions:le.array(le.object({path:le.string().regex(/^\/[^?#]*$/),reason_code:BR}))})]),LU=le.object({overall_status:le.enum(["moving","completed","disabled","failed"]),by_collection:le.array(WR),media:le.object({image:yt,video:yt,audio:yt,file:yt}),exceptions:le.array(le.object({collection:bo.nullable(),path:le.string().regex(/^\/[^?#]*$/),reason_code:qR})),redirects:KR.nullable().optional()});var Eo=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(),weightStyle:We.optional()}),yo=t.enum(["material","reference","brief","industry"]),zR=t.object({market:t.object({value:t.string().min(1).max(200),source:yo}),customer:t.object({value:t.string().min(1).max(200),source:yo}),purpose:t.object({options:t.array(t.string().min(1).max(60)).min(2).max(4),selected:t.string().min(1).max(60),source:yo})}),HR=t.enum(["text-options","motion-slider","positioning"]),Ro=t.enum(["none","subtle","moderate","expressive"]),$R=t.enum(["compact","comfortable","airy","editorial"]),VR=Ro,Ip=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()}),YR=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:Eo.optional(),conversionHints:Mt.optional()}),XR=t.object({id:t.string(),type:HR,question:t.string(),tag:t.string(),aiThinking:t.string(),options:t.array(YR),source:t.enum(["ai-detected","always-ask"]),sourceDetail:t.string(),positioning:zR.optional()}),Io=t.object({questions:t.array(XR).min(1).max(6)}),pF=t.object({tenant_id:t.string().min(1),site_id:k,brief_id:Yt,brief:t.string().min(20).max(1e3),site_default_locale:Re.optional(),owner_locale:Re.optional(),input_context:t.object({facts:t.array(ui).max(120),conflicts:t.array(_i).max(20),reference:gi.optional(),sources:t.array(t.object({type:Is,title:t.string().max(120).optional(),status:Ts})).max(16).optional()}).optional()}),Tp=t.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),dF=t.discriminatedUnion("type",[t.object({type:t.literal("run.started"),runId:$,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(Ip).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:Tp.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)})]),uF="SITE_PLANNING_INPUT_FROZEN",gF="SITE_PLANNING_LOCKED",_F="SITE_STRUCTURE_CONFIRMATION_REQUIRED",hF="SITE_STRUCTURE_CONFIRMATION_STALE",SF="SITE_SITEMAP_DRAFT_STALE",fF="SITE_SITEMAP_DRAFT_OPERATION_MISMATCH",bp="SITE_STRUCTURE_INVALID",bF=t.object({tenant_id:t.string().min(1),name:t.string().min(1).max(120),brief:t.string().min(20).max(1e3)}),yF=t.object({name:t.string().min(1).max(120),brief:t.string().min(20).max(1e3)}),xF=t.object({name:t.string().min(1).max(120)}),EF=t.object({name:t.string().min(1).max(120),default_locale:Re.optional()}),RF=t.object({body:t.string().min(20).max(1e3)}),IF=t.object({body:t.string().min(20).max(1e3)}),To=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"}),TF=t.object({tenant_id:t.string().min(1),site_id:k.optional(),site_url:To.optional(),site_name:t.string().trim().min(1).max(255).optional()}),kF=M(Tr),AF=M(kr),wF=M(Ar),PF=M(qr),CF=M(Wr),vF=M(Br),DF=M(zr),OF=M(Hr),NF=M($r),jF=M(t.object({site_id:k,site_url:To.nullable()})),jt=t.object({id:k,tenant_id:t.string().min(1),name:t.string().min(1),slug:t.string().min(1),status:ia,deployment_status:sa,archived_at:t.string().min(1).nullable(),current_sitemap_id:ke.nullable(),confirmed_sitemap_id:ke.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:I.nullable(),published_deployment_id:mt.nullable().optional(),deployed_url:t.string().url().nullable(),default_locale:Re,owner_locale:Re.optional(),cms_site_id:bi.nullable().optional(),cms_site_url:To.nullable().optional(),parent_site_id:k.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)}),ko=t.object({id:Yt,tenant_id:t.string().min(1),site_id:k,body:t.string().min(1),source:t.enum(["user","import","system"]),created_at:t.string().min(1),updated_at:t.string().min(1)}),LF=t.object({site:jt,brief:ko,next_step:t.literal("clarify")}),MF=t.object({site:jt,brief:ko}),UF=t.object({brief:ko}),QR=t.enum(["queued","running","succeeded","failed","cancelled"]),kp=t.enum(["clarify","sitemap","workspace"]),Ap=t.enum(["clarify","sitemap","initial_generation","iteration","landing_page","fill_in"]),wp=t.enum(["clarify","sitemap","workspace","summarize"]),nt=t.object({id:$,tenant_id:t.string().min(1),site_id:k,agent_type:kp,run_kind:Ap,status:QR,model_route:wp,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:it.nullable().optional()}),FF=t.object({agent_run:nt}).strict(),ZR=t.enum(["workspace","landing_page","external"]),JR=t.enum(["user","background"]),Pp=t.enum(["active","archived"]),fs=t.object({id:it,tenant_id:t.string().min(1),site_id:k,kind:ZR,origin:JR,subject_key:t.string().min(1).max(200),title:t.string().min(1).max(200),status:Pp,external_thread_id:t.string().min(1).max(200).nullable(),last_run_id:$.nullable(),last_activity_at:t.string().min(1),created_at:t.string().min(1),updated_at:t.string().min(1)}),GF=t.object({agent_run:nt,thread:fs.nullable()}),qF=t.object({run_id:$.optional(),site_id:k,agent_type:kp,run_kind:Ap.optional(),model_route:wp,input:t.record(t.string(),t.unknown()).optional()}).superRefine((e,n)=>{oi(e.input)&&n.addIssue({code:"custom",path:["input"],message:"Agent run input must not contain secrets"})}),WF=t.object({agent_run:nt,next_step:t.literal("stream_events")}),Cp=t.enum(["draft","candidate","deleting","current","failed"]),xt=t.object({id:I,tenant_id:t.string().min(1),site_id:k,version:t.number().int().positive(),manifest_hash:t.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:t.string().min(1),template_version:Ze.nullable().optional(),reason:t.enum(["initial_generation","workspace_edit","pre_deploy","manual_save","rollback","template_upgrade","subsite_clone"]),status:Cp,created_at:t.string().min(1)}),BF=t.object({snapshot_id:I,creation_key:t.string().min(1),manifest_hash:t.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:t.string().min(1),template_version:Ze.optional(),reason:xt.shape.reason,status:t.enum(["draft","candidate","current","failed"]).default("candidate"),source_run_id:$.optional()}),KF=t.object({site:jt,snapshot:xt,next_step:t.literal("workspace")}),zF=t.object({expected_manifest_hash:xt.shape.manifest_hash,manifest_hash:xt.shape.manifest_hash,object_key:xt.shape.object_key}).strict(),HF=t.union([t.object({base_snapshot_id:I.nullable(),source_run_id:$.optional(),page_template_advisories:t.array(In).optional()}).strict(),t.object({skip_base_check:t.literal(!0)}).strict()]),eI=t.object({site:jt,snapshot:xt,next_step:t.literal("workspace")}),$F=t.object({snapshot:xt}),VF=t.object({status:t.literal("deleting"),snapshot_id:I,object_key:t.string().min(1)}),YF=t.object({status:t.literal("deleted"),snapshot_id:I}),bs=t.object({id:Go,tenant_id:t.string().min(1),site_id:k,snapshot_id:I,version:t.number().int().positive(),accepted_commit:t.string().min(1),source_run_id:$.nullable(),created_at:t.string().min(1)}),tI=bs.extend({reason:xt.shape.reason,status:Cp}),XF=t.object({accepted_commit:t.string().min(1),source_run_id:$.optional()}),QF=t.object({site_version:bs,next_step:t.literal("workspace")}),ZF=t.object({owner_id:t.string().min(1)}).strict(),JF=t.discriminatedUnion("acquired",[t.object({acquired:t.literal(!0)}).strict(),t.object({acquired:t.literal(!1)}).strict()]),eG=t.object({owner_id:t.string().min(1)}).strict(),tG=t.object({released:t.literal(!0)}).strict(),nG="TEMPLATE_UPGRADE_LOCK_LOST",iG=t.object({base_snapshot_id:I,accepted_commit:bs.shape.accepted_commit,owner_id:t.string().min(1)}).strict(),sG=eI.strict(),aG=t.object({site_versions:t.array(tI)}),oG=t.object({site:jt,snapshot:xt,site_version:bs,next_step:t.literal("workspace")}),rG=t.object({snapshot_id:I,force_rehydrate:t.boolean().optional(),recovery_required:t.boolean().optional(),required_cms_site_id:bi.optional()}),nI=t.discriminatedUnion("status",[t.object({status:t.literal("ready"),snapshot_id:I,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(),snapshot_id:I.optional(),code_error:vs.optional()})]),cG=t.object({tenant_id:t.string().min(1),site_id:k,snapshot_id:I,cms_site_id:bi.optional()}).strict(),mG=nI,Ao=t.enum(Xt),vp=t.enum(["quality_check","publish"]),Ot=t.object({id:mt,tenant_id:t.string().min(1),site_id:k,snapshot_id:I,type:vp.default("publish"),version:t.number().int().positive(),status:Ao,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)}),lG=t.object({tenant_id:t.string().min(1),site_id:k,expected_snapshot_id:I}).strict(),pG=t.object({deployment:Ot}),dG=t.object({tenant_id:t.string().min(1),site_id:k,deployment_id:mt}).strict(),uG=t.object({deployment:Ot}),gG=t.object({}).strict(),_G=t.object({snapshot_id:I.optional()}).strict(),iI=t.object({deployment:Ot}),hG=M(iI),SG=t.object({deployment:Ot.nullable()}),fG=t.object({deployment:Ot}),yp=t.object({id:mt,type:vp.default("publish"),status:Ao,url:t.string().url().nullable(),error_code:t.string().min(1).nullable(),provider_deployment_id:t.string().min(1).nullable()}),sI=t.object({current:yp.nullable(),latest_released:yp.nullable()}),bG=M(sI),aI=t.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),Sn=t.object({id:t.string().min(1),tenant_id:t.string().min(1),site_id:k,deployment_id:mt,seq:t.number().int().positive(),sent_at:t.string().min(1)}),_s=t.object({deployment:Ot,steps:Nc.default([])}),yG=t.discriminatedUnion("type",[Sn.extend({type:t.literal("deployment.snapshot"),payload:_s}),Sn.extend({type:t.literal("deployment.status.changed"),payload:_s}),Sn.extend({type:t.literal("deployment.finished"),payload:_s}),Sn.extend({type:t.literal("deployment.failed"),payload:_s}),Sn.extend({type:t.literal("deployment.realtime.recovered"),payload:t.object({action:t.literal("refresh")})}),Sn.extend({type:t.literal("server.error"),payload:t.object({code:t.string().min(1),message:t.string().min(1),retryable:t.boolean()})})]),xG=t.object({tenant_id:t.string().min(1),site_id:k,deployment_id:mt,status:Ao,updated_at:t.string().min(1)}),oI="vcp:deployments",EG={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:oI,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...aI.options]},rI=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)})}),RG=t.object({error:rI.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:nt})})}),IG=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({})}),cI=t.object({theme_id:t.string().min(1),paletteIntent:t.string().min(1),tone:t.string().min(1),mediaMood:t.string().min(1),motionLevel:Ro.optional(),userVisualHints:Eo.optional()}),mI=t.object({key:t.string().min(1).max(64).optional(),question:t.string().min(1),answer:t.string().min(1)}),TG=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)}),kG=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()}),lI=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()}),AG=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:lI.optional()}),pI=t.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),fn=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:pI.default("system_recommended")}),ie=t.string().min(1).max(2e3),xp=t.string().min(1).max(120),gs=t.object({visualDirection:ie,brandFeeling:ie,paletteIntent:ie,typographyIntent:ie,density:$R,motionLevel:VR,motionPreset:t.enum(["subtle","moderate","expressive"]).optional(),mediaStrategy:ie,compositionRules:t.array(ie).max(20),avoidPatterns:t.array(ie).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(),weightStyle:We.optional()}),wo=160,Dp=t.object({routeGoal:ie,narrativeArc:ie,firstViewportIntent:ie,visualContinuity:ie,sectionRhythm:ie,avoidPatterns:t.array(ie).max(20),displayTitle:t.string().min(1).max(40).optional(),displayDescription:t.string().min(1).max(wo).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()}),Op=t.enum(["model_call","validation","repair","preview","worker_group"]),Nt=t.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),Np=t.object({sectionRole:ie,contentIntent:ie,layoutIntent:ie,visualIntent:ie,mediaIntent:ie,motionIntent:ie,interaction:di.optional(),copyTone:ie,displayTitle:t.string().min(1).max(40).optional(),displayDescription:t.string().min(1).max(wo).optional(),ctaIntent:ie.optional(),continuityWithPrevious:ie.optional(),avoidRepeating:t.array(ie).max(20).optional(),industryRecipeRefs:t.array(xp).max(12).optional(),templateRecipeRefs:t.array(xp).max(12).optional()}),jp=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()}),dI=t.enum(["solid","floating"]),uI=t.enum(["background","card","primary","frosted"]),gI=t.enum(["sticky","hide-on-scroll","static"]),_I=t.enum(["bar","island"]),hI=t.object({variant:dI,surface:uI.optional(),behavior:gI.optional(),shape:_I.optional()}),SI=t.object({form:ie,layoutIntent:ie,scrollBehavior:ie,shell:hI.optional(),avoidPatterns:t.array(ie).max(10).optional()}),fI=t.enum(["background","card","primary","inverse"]),bI=t.object({surface:fI}),yI=t.object({form:ie,composition:ie,shell:bI.optional(),avoidPatterns:t.array(ie).max(10).optional()}),xI=t.object({pattern:ie,intent:ie}),Lp=t.object({header:SI,footer:yI,mobileNav:xI}),Mp=t.enum(["top","below-hero","footer","none"]),Up=t.object({schemaVersion:t.literal(1).default(1),siteDesignContext:gs,routeCards:t.record(t.string().min(1),Dp),blockContexts:t.record(t.string().min(1),Np),selectedSkillPacks:t.array(fn).max(3).optional(),branding:jp.optional(),chromeDesign:Lp.optional(),breadcrumbPlacement:Mp.optional()}),wG=t.object({siteDesignContext:gs.omit({imagePalette:!0}).optional(),routeCards:t.record(t.string().min(1),Dp).optional(),blockContexts:t.record(t.string().min(1),Np.extend({interaction:di.nullable().optional()})).optional(),branding:jp.optional(),chromeDesign:Lp.optional()}),Ge=t.string().trim().min(1),Po=t.object({id:Ge,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(),Co=t.string().regex(Nn,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),EI=new RegExp(`^/(?:${Jt}(?:/${Jt})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),RI=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,II=t.union([t.string().regex(EI),t.string().regex(RI)]),Ep=t.object({label:t.string(),href:II}).passthrough(),TI=t.object({primaryLinks:t.array(Ep),footerLinks:t.array(Ep)}),Fp=t.object({showInHeader:t.boolean(),showInFooter:t.boolean(),order:t.number()}).strict(),vo=t.object({id:Ge,slug:Co,title:t.string().trim().min(1),blocks:t.array(Po).min(1),navigation:Fp,parent_page_id:Ge.nullable().optional()}).strict(),kI=Po.extend({type:t.string().nullable()}).strict(),AI=vo.extend({slug:Co.nullable(),navigation:Fp.extend({showInHeader:t.boolean().nullable(),showInFooter:t.boolean().nullable()}).strict(),blocks:t.array(kI).min(1)}).strict(),wI=Po.extend({id:t.string()}),PI=vo.omit({parent_page_id:!0}).extend({id:t.string(),slug:t.string().min(1),blocks:t.array(wI).min(1),parent_page_id:t.string().nullable().optional()}),Rp=t.object({label:t.string(),href:t.string().min(1)}),CI=t.object({primaryLinks:t.array(Rp),footerLinks:t.array(Rp)}),vI=t.discriminatedUnion("kind",[t.object({kind:t.literal("brief_clarify"),brief_id:Yt,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()]),hs=t.object({site_name:t.string().min(1).max(80).optional(),version:t.number().int().positive(),pages:t.array(vo).min(1),navigation:TI,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:vI.optional()}),skillSelection:fn,visualTheme:cI.optional(),userChoices:t.array(mI).optional(),confirmedChoices:t.object({conversion:Mt.optional()}).optional(),seoKeywords:t.array(Pn).min(1).optional()}).strict(),bn=hs.superRefine((e,n)=>{Gp(e.pages,n)}),gn=hs.extend({pages:t.array(AI).min(1)}).strict().superRefine((e,n)=>{Gp(e.pages,n)}),DI=t.enum(["slug","showInHeader","showInFooter"]),OI=t.object({page_id:Ge,fields:t.array(DI).min(1).max(3)}).strict(),NI=t.object({page_id:Ge,block_id:Ge,fields:t.tuple([t.literal("type")])}).strict(),jI=100,LI=500,MI=t.object({pages:t.array(OI).max(jI),blocks:t.array(NI).max(LI)}).strict().superRefine((e,n)=>{let i=new Set;e.pages.forEach((a,o)=>{i.has(a.page_id)&&n.addIssue({code:"custom",path:["pages",o,"page_id"],message:`Duplicate page target '${a.page_id}'.`}),i.add(a.page_id),new Set(a.fields).size!==a.fields.length&&n.addIssue({code:"custom",path:["pages",o,"fields"],message:"Page target fields must be unique."})});let s=new Set;e.blocks.forEach((a,o)=>{let c=`${a.page_id}\0${a.block_id}`;s.has(c)&&n.addIssue({code:"custom",path:["blocks",o],message:`Duplicate block target '${a.page_id}/${a.block_id}'.`}),s.add(c)})}),PG=t.object({sitemap:gn,targets:MI,reserved_slugs:t.array(Co).optional()}).strict(),CG=t.object({sitemap:bn}).strict();function Gp(e,n){let i=new Map,s=new Map,a=new Map,o=0;e.forEach((l,x)=>{let h=i.get(l.id);if(h!==void 0?n.addIssue({code:"custom",path:["pages",x,"id"],message:`Duplicate page id '${l.id}' (first used at pages.${h}.id).`}):i.set(l.id,x),l.blocks.forEach((K,H)=>{let se=s.get(K.id);se!==void 0?n.addIssue({code:"custom",path:["pages",x,"blocks",H,"id"],message:`Duplicate block id '${K.id}' (first used at pages.${se.pageIndex}.blocks.${se.blockIndex}.id).`}):s.set(K.id,{pageIndex:x,blockIndex:H})}),l.slug===null)return;l.slug==="/"&&(o+=1);let C=a.get(l.slug);C!==void 0?n.addIssue({code:"custom",path:["pages",x,"slug"],message:`Duplicate page slug '${l.slug}' (first used at pages.${C}.slug).`}):a.set(l.slug,x)}),(o!==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:bp}});let c=new Map(e.map((l,x)=>[l.id,{page:l,index:x}])),r=(l,x)=>n.addIssue({code:"custom",path:l,message:x,params:{errorCode:bp}});e.forEach((l,x)=>{let h=l.parent_page_id??null;if(h===null)return;let C=["pages",x,"parent_page_id"];if(l.slug==="/"){r(C,"The home page cannot have a parent.");return}if(h===l.id){r(C,`Page '${l.id}' cannot be its own parent.`);return}let K=c.get(h);if(!K){r(C,`Parent page '${h}' does not exist.`);return}if(K.page.slug==="/"){r(C,"The home page cannot have sub pages.");return}(K.page.parent_page_id??null)!==null&&r(C,`Sitemap allows at most two levels; parent '${h}' must be a top-level page.`)})}var vG=hs.omit({skillSelection:!0,visualTheme:!0,userChoices:!0,confirmedChoices:!0,seoKeywords:!0}).extend({meta:hs.shape.meta.omit({source:!0}),site_name:t.string().min(1).max(80),pages:t.array(PI).min(1),navigation:CI}),UI=t.enum(["ai","user"]),yn=t.object({site_id:k,page_id:Ge,edited_by:UI.default("ai"),source_agent_run_id:$.optional()}),DG=yn.extend({block_id:Ge,target_index:t.number().int().min(0)}),FI=yn.extend({block_id:Ge}),GI=yn.extend({block_id:Ge,instruction:t.string()}),OG=yn.extend({block_id:Ge,variant:t.string().min(1).nullable()}),NG=yn.extend({block_id:Ge,props:t.record(t.string(),t.unknown()),mode:t.enum(["replace","merge"]).default("replace")}),jG=yn.extend({block:t.object({id:Ge,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()})}),qI=t.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),LG=t.discriminatedUnion("operation",[t.object({operation:t.literal("delete_block"),input:FI}).strict(),t.object({operation:t.literal("update_block_instruction"),input:GI}).strict()]),WI=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"]),BI=t.object({status:t.literal("updated"),operation:qI,site_id:k,sitemap_id:ke,version:t.number().int().positive(),changed_pages:t.array(Ge).min(1),requires_code_patch:t.literal(!0)}),KI=t.object({status:t.literal("failed"),code:WI,message:t.string().min(1),retryable:t.boolean().default(!1),details:t.unknown().optional()}),MG=t.discriminatedUnion("status",[BI,KI]),Do=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:Ro.optional(),visual_tonality:Eo.optional(),conversion:Mt.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()}),zI=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(),UG=t.object({source:t.object({kind:t.literal("step5_strategy")}).strict()}).strict(),HI=t.object({item_key:Ii,title:t.string().trim().min(1).max(200),selected_option_id:vn,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:Ti.optional(),markets:t.array(ki).max(32).optional(),sections:t.array(t.object({id:t.string().min(1),label:t.string().min(1)}).strict()).optional()}).strict(),$I=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(HI).min(Ei).max(Ne),enterprise_keywords:t.array(Pn).min(1).optional()}).strict().superRefine((e,n)=>{let i=e.decisions.map(a=>a.item_key);new Set(i).size!==i.length&&n.addIssue({code:"custom",path:["decisions"],message:"Step5 sitemap decisions must use unique strategy keys."}),Cn.forEach(a=>{i.includes(a)||n.addIssue({code:"custom",path:["decisions"],message:`Step5 sitemap decisions are missing ${a}.`})});let s=Zt.filter(a=>i.includes(a));e.decisions.forEach((a,o)=>{a.item_key!==s[o]&&n.addIssue({code:"custom",path:["decisions",o,"item_key"],message:"Step5 sitemap decisions must use the canonical order."})})}),qp=t.object({tenant_id:t.string().min(1),site_id:k,brief_id:Yt,brief:t.string().min(20).max(1e3),answers:t.array(Do).min(1).max(10),skillSelection:fn,site_default_locale:Re.optional(),owner_locale:Re.optional(),cms_site_id:t.string().min(1).nullish(),intent_pages:t.array(zI).max(9).optional(),reference:gi.optional(),input_context:t.object({facts:t.array(ui).max(120),conflicts:t.array(_i).max(20)}).optional(),business_facts:nr.optional(),migration_products_enabled:t.boolean().optional()}),VI=qp.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,migration_products_enabled:!0}).partial({skillSelection:!0}).extend({source:$I}).strict(),FG=t.union([qp,VI]),Wp=t.enum(["planning","generating","validating","ready"]),YI=t.enum(["salvaged","deterministic_fallback"]),XI=t.enum(["model_exception_settled_prefix","model_exception_safe_root"]),Bp={outcome:YI.optional(),reason:XI.optional(),attempts:t.number().int().positive().optional()};function Kp(e,n){if(e.type!=="sitemap.generated")return;let i=e.outcome!==void 0,s=e.reason!==void 0;i!==s&&n.addIssue({code:"custom",path:[i?"reason":"outcome"],message:"sitemap.generated outcome and reason must be provided together"})}var QI=t.discriminatedUnion("type",[t.object({type:t.literal("run.started"),runId:$,at:t.string().min(1)}),t.object({type:t.literal("sitemap.generating"),stage:Wp,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:ke,sitemap:bn,...Bp,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:I,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:I.optional(),at:t.string().min(1)})]),GG=QI.superRefine(Kp),zp=t.object({id:ke,tenant_id:t.string().min(1),site_id:k,version:t.number().int().positive(),source_agent_run_id:$.nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}).strict();function Hp(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 $p=zp.extend({sitemap:bn}).superRefine(Hp),Vp=zp.extend({sitemap:gn}).superRefine(Hp),qG=t.object({sitemap_id:ke,creation_key:t.string().min(1),sitemap:gn,expected_current_sitemap_id:ke,expected_current_sitemap_version:t.number().int().positive()}).strict().superRefine((e,n)=>{e.sitemap.version!==e.expected_current_sitemap_version&&n.addIssue({code:"custom",path:["sitemap","version"],message:"Draft version must match the expected base version."})}),WG=t.object({sitemap:Vp}).strict();function BG(e){return`sitemap-user-draft:${e.site_id}:${e.expected_current_sitemap_id}:${e.expected_current_sitemap_version}:${e.sitemap_id}`}var KG=t.object({sitemap_id:ke,creation_key:t.string().min(1),sitemap:bn,source_agent_run_id:$.optional()}),zG=t.object({sitemap_id:ke,creation_key:t.string().min(1),sitemap:gn,expected_current_sitemap_id:ke,expected_current_sitemap_version:t.number().int().positive(),migration_content_requested:t.boolean().optional()}),HG=t.object({sitemap_id:ke,creation_key:t.string().min(1),sitemap:bn,source_agent_run_id:$}),$G=t.object({site:jt,sitemap:$p,next_step:t.literal("workspace")}).strict(),VG=t.object({site:jt,sitemap:Vp,next_step:t.literal("workspace")}).strict(),YG=t.object({site:jt,sitemap:$p,next_step:t.literal("sitemap_review")}).strict(),ZI=t.object({id:Fo,tenant_id:t.string().min(1),site_id:k,brief_id:Yt,questions:Io,answers:t.array(Do),selected_archetype:fn.optional(),completed_at:t.string().min(1).nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}),XG=t.object({answers:t.array(Do).min(1),questions:Io,selected_archetype:fn.optional()}),QG=t.object({clarify_session:ZI}),ZG=t.object({questions:Io,selected_archetype:fn}),JI=t.object({id:xs,tenant_id:t.string().min(1),site_id:k,version:t.number().int().positive(),design_plan:Up,source_agent_run_id:$.nullable(),created_at:t.string().min(1),updated_at:t.string().min(1)}),JG=t.object({design_plan_id:xs.optional(),design_plan:Up,source_agent_run_id:$.optional()}),eq=t.object({design_plan:JI}),ys=t.enum(["initial_generation","iteration","landing_page","fill_in"]),eT=t.object({label:t.string().min(1).max(48),prompt:t.string().min(1).max(160)}).strict(),tT=t.enum(["model","derived","mixed","advisor"]),Yp=t.object({suggestions:t.array(eT).min(1).max(4),source:tT}).strict(),nT=t.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),iT=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"]),sT=t.enum(["progress","assistant_final"]),Xp=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"]),aT=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"]),Oo=t.enum(["style_media","chrome","sections","layout","pages","detect_typecheck","repair","finalize","sitemap_resync","preview"]),No=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()}),ve=t.string().min(1).refine(e=>cd(e),{message:"Snapshot file paths must be safe relative POSIX paths without traversal."}),jo=t.object({deduped_paths:t.array(ve),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(ve)}),Lo=t.object({group_id:t.string().min(1),phase:Oo,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(ve)}),oT=t.enum(["style","media","chrome","section","layout","page","breadcrumb"]),Mo=t.object({task_id:t.string().min(1),group_id:t.string().min(1),kind:oT,target_path:ve,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(wo).optional(),status:Vt,required_reads:t.array(ve).optional(),search_params_sections:t.array(ve).optional(),standard_form_view:ve.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),placement:Mp.optional()}).strict().optional()}),Uo=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"])}),tq=t.object({plan_id:t.string().min(1),run_kind:ys,model_route:t.object({planner:t.literal("workspace_planner"),worker:t.literal("workspace")}),groups:t.array(Lo),tasks:t.array(Mo),dependencies:t.array(Uo),expected_outputs:t.array(ve),diagnostics:jo}),nq=t.object({task_id:t.string().min(1),patch:t.unknown().optional(),snapshot_id:I.optional(),read_files:t.array(ve),diagnostics:t.array(No),status:Vt}),Qp=t.object({worker_count:t.number().int().nonnegative(),task_count:t.number().int().nonnegative(),group_count:t.number().int().nonnegative()}),Zp=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()}),rT=t.object({type:t.literal("text"),text:t.string(),state:t.enum(["streaming","done"]).optional()}),cT=t.object({type:t.literal("reasoning"),text:t.string(),state:t.enum(["streaming","done"]).optional(),providerMetadata:t.record(t.string(),t.unknown()).optional()}),mT=t.object({type:t.literal("file"),mediaType:t.string().min(1),filename:t.string().min(1).optional(),url:t.string().min(1)}),lT=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()}),pT=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()}),dT=t.object({type:t.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:t.string().min(1).optional(),data:t.unknown()}),uT=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()}),gT=t.object({type:t.literal("error"),errorText:t.string().min(1)}),_T=t.object({type:t.literal("step-start")}),Ss=t.union([rT,cT,mT,lT,pT,dT,uT,gT,_T]),hT=t.string().min(1).max(512).refine(e=>cd(e)&&!/^[A-Za-z]:\//.test(e),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),ST=t.array(hT).min(1).max(64),fT=t.array(t.string().min(1).max(120)).min(1).max(64),bT=t.discriminatedUnion("type",[t.object({type:t.literal("run.started"),runId:$,at:t.string().min(1)}),t.object({type:t.literal("message.delta"),text:t.string().min(1),history_purpose:sT.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(Ss).min(1),display_text:t.string().min(1).max(4e3).optional(),in_reply_to_tool_call_id:t.string().min(1).optional(),interaction_response:Di.optional(),at:t.string().min(1)}),t.object({type:t.literal("plan.updated"),steps:t.array(aT),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(Ip).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:Wp,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:ke,sitemap:bn,...Bp,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:ke,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:ca.optional(),at:t.string().min(1)}),t.object({type:t.literal("workspace.plan.created"),plan_id:t.string().min(1),run_kind:ys,groups:t.array(Lo),tasks:t.array(Mo),dependencies:t.array(Uo),expected_outputs:t.array(ve),diagnostics:jo,summary:Qp,at:t.string().min(1)}).strict(),t.object({type:t.literal("workspace.worker.updated"),group_id:t.string().min(1),phase:Oo,status:Vt,task_counts:Zp,target_paths:t.array(ve),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:ve,read_files_count:t.number().int().nonnegative(),diagnostics:t.array(t.string().min(1)),diagnostic_details:t.array(No).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:ST.optional(),degraded_page_ids:fT.optional(),snapshot_id:I.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 i=e.reason==="generated_code_rescue",s=e.reason==="page_omitted",a=e.reason==="shared_fallback";if(!i){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&&!s&&n.addIssue({code:"custom",path:["degraded_page_ids"],message:"degraded_page_ids is only allowed for generated_code_rescue or page_omitted"}),a)for(let o of["degraded_block_ids","dropped_files","snapshot_id","code","diagnostics","retryable"])e[o]!==void 0&&n.addIssue({code:"custom",path:[o],message:`${o} 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 o of["degraded_block_ids","dropped_files","snapshot_id","code","message","diagnostics","retryable"])e[o]!==void 0&&n.addIssue({code:"custom",path:[o],message:`${o} is not allowed for generated_code_rescue`})}),t.object({type:t.literal("workspace.design_plan.outcome"),design_plan_outcome:nT,reason:iT,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(),Yp.extend({type:t.literal("workspace.suggestions"),at:t.string().min(1)}).strict(),ar,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:I,manifest_hash:t.string().regex(/^sha256:[a-f0-9]{64}$/),at:t.string().min(1)}),t.object({type:t.literal("snapshot.finalized"),snapshot_id:I,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:I,at:t.string().min(1)}),t.object({type:t.literal("preview.build.succeeded"),snapshot_id:I,at:t.string().min(1)}),t.object({type:t.literal("preview.build.failed"),snapshot_id:I,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:Tp.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:I.optional(),degraded_reason:Rn.optional(),build_verified:t.boolean().optional(),generation_ledger:An.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:Op,title:t.string().min(1).max(200),detail:t.string().max(360).optional(),title_code:Nt.optional(),detail_code:Nt.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:Nt.optional(),detail_code:Nt.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)})]),Jp=bT.superRefine(Kp).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 i=e.name==="prepare_product_search_entry";i!==!!e.interaction_request&&n.addIssue({code:"custom",path:["interaction_request"],message:i?"prepare_product_search_entry requires interaction_request":"interaction_request is only valid for prepare_product_search_entry"})}),xo=t.object({id:qo,tenant_id:t.string().min(1),site_id:k,agent_run_id:$,sequence:t.number().int().positive(),event_type:Xp,payload:Jp,created_at:t.string().min(1),thread_id:it.nullable().optional()}),iq=t.object({event_type:Xp,payload:Jp}).superRefine((e,n)=>{e.event_type!==e.payload.type&&n.addIssue({code:"custom",path:["payload","type"],message:"payload.type must match event_type"}),oi(e.payload)&&n.addIssue({code:"custom",path:["payload"],message:"AgentEvent payload must not contain secrets"})}),sq=t.discriminatedUnion("status",[t.object({status:t.literal("appended"),agent_run:nt,event:xo,next_cursor:t.number().int().nonnegative()}),t.object({status:t.literal("duplicate_ignored"),agent_run:nt,event:xo,next_cursor:t.number().int().nonnegative()})]),aq=t.object({events:t.array(xo),next_cursor:t.number().int().nonnegative().optional()}),oq=t.object({after_sequence:t.coerce.number().int().nonnegative().default(0)}),rq=t.object({run_id:$.optional(),thread_id:it.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"})}),cq=t.enum(["implemented","skeleton","planned"]),mq=t.enum(["GET","POST","PUT","PATCH","DELETE"]),lq=[{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:"GET",path:"/internal/sites/:site_id/workflow/progress",tag:"site-workflows",summary:"Read the minimal internal site workflow progress projection.",status:"implemented",response_schema:"SiteWorkflowProgressResponseSchema"},{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/complete-quality-only",tag:"site-workflows",summary:"Complete the designer workflow after the linked quality-only publish workflow succeeds.",status:"implemented",request_body_schema:"CompleteQualityOnlyWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema",notes:["The server resolves the designer role and atomically completes both workflows without creating a publish deployment or updating the site deployment projection."]},{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:"PUT",path:"/sites/:site_id/sitemap/draft",tag:"sitemaps",summary:"Save an immutable user draft without confirming or advancing the workflow.",status:"implemented",request_body_schema:"SaveSiteSitemapDraftRequestSchema",response_schema:"SaveSiteSitemapDraftResponseSchema"},{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 trusted CMS identity by tenant_id + cms_site_id; legacy site_url is optional and ignored. The response URL is the configured public API base or null.",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:"Retired repair task entry: returns 409 WORKSPACE_REPAIR_REQUIRED; use the Workspace repair action.",status:"implemented",request_body_schema:"SitePublishWorkflowRevisionRequestSchema",response_schema:"ApiErrorEnvelopeSchema"},{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"}],pq=[{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"]}],yT=t.object({id:t.string().min(1),role:t.enum(["system","user","assistant"]),metadata:t.unknown().optional(),parts:t.array(Ss).min(1)}),ed=yT.extend({role:t.literal("user")}).superRefine((e,n)=>{let i=0;for(let[s,a]of e.parts.entries()){if(a.type!=="file")continue;i+=1;let o=a;la.safeParse(o.mediaType).success||n.addIssue({code:"custom",path:["parts",s,"mediaType"],message:"Attachment mediaType must be image/png, image/jpeg or image/webp"}),(typeof o.url!="string"||pa(o.url)===null)&&n.addIssue({code:"custom",path:["parts",s,"url"],message:"Attachment url must be a workspace attachment image path"})}i>ma&&n.addIssue({code:"custom",path:["parts"],message:`A message may carry at most ${ma} attachments`})}),dq=t.object({base_snapshot_id:I.optional(),intent:t.literal("navigation_adaptation").optional(),message:ed.optional(),thread_id:it.optional(),client_run_key:t.string().min(1).max(200).optional()}).superRefine((e,n)=>{oi(e.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),xT=t.object({path:t.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:$,base_snapshot_id:I,run_kind:ys}),uq=t.object({agent_run:nt,websocket:xT,next_step:t.literal("workspace_socket")}),gq=t.object({agent_run:nt}),_q=t.object({thread_id:it.optional()}),hq=t.object({agent_run:nt.nullable(),thread:fs.nullable()}),Sq=t.object({status:Pp.default("active")}),fq=t.object({threads:t.array(fs)}),bq=t.object({title:t.string().trim().min(1).max(200)}).strict(),yq=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"}),xq=t.object({thread:fs}),Eq=t.object({agent_type:t.enum(["clarify","sitemap","workspace"]),thread_id:it.optional()}),Rq=t.object({agent_run:nt}),Iq=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"]),pe=t.object({id:t.string().min(1),tenant_id:t.string().min(1),site_id:k,run_id:$.optional(),correlation_id:t.string().min(1).optional(),seq:t.number().int().positive().optional(),sent_at:t.string().min(1)}),ET=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()}),RT=t.discriminatedUnion("type",[pe.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:Fn.optional(),interaction_response:Di.optional(),selected_component:ET.optional(),intent:t.literal("navigation_adaptation").optional(),display_text:t.string().min(1).max(4e3).optional(),message:ed,base_snapshot_id:I.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"})})}),pe.extend({type:t.literal("client.run.cancel"),payload:t.object({run_id:$,reason:t.string().min(1).optional()})}),pe.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()})}),yc]),IT=t.discriminatedUnion("type",[pe.extend({type:t.literal("server.run.started"),payload:t.object({run_id:$,agent_type:t.literal("workspace")})}),pe.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(Ss).min(1),display_text:t.string().min(1).max(4e3).optional(),in_reply_to_tool_call_id:t.string().min(1).optional(),interaction_response:Di.optional()})}),pe.extend({type:t.literal("server.assistant.delta"),payload:t.object({message_id:t.string().min(1),parts:t.array(Ss).min(1),status:t.enum(["streaming","ready"])})}),pe.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)})}),pe.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:ca.optional()})}),pe.extend({type:t.literal("server.workspace.suggestions"),payload:Yp.extend({run_id:$}).strict()}),pe.extend({type:t.literal("workspace.plan.created"),payload:t.object({plan_id:t.string().min(1),run_kind:ys,groups:t.array(Lo),tasks:t.array(Mo),dependencies:t.array(Uo),expected_outputs:t.array(ve),diagnostics:jo,summary:Qp})}),pe.extend({type:t.literal("workspace.worker.updated"),payload:t.object({group_id:t.string().min(1),phase:Oo,status:Vt,task_counts:Zp,target_paths:t.array(ve),diagnostics:t.array(t.string().min(1))})}),pe.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:ve,read_files_count:t.number().int().nonnegative(),diagnostics:t.array(t.string().min(1)),diagnostic_details:t.array(No).optional()})}),pe.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()})}),pe.extend({type:t.literal("server.sitemap.updated"),payload:t.object({sitemap_id:ke,version:t.number().int().positive(),reason:t.string().min(1)})}),pe.extend({type:t.literal("server.snapshot.created"),payload:t.object({snapshot_id:I,manifest_hash:t.string().regex(/^sha256:[a-f0-9]{64}$/)})}),pe.extend({type:t.literal("server.snapshot.finalized"),payload:t.object({snapshot_id:I})}),pe.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()})}),pe.extend({type:t.literal("preview.build.started"),payload:t.object({snapshot_id:I})}),pe.extend({type:t.literal("preview.build.succeeded"),payload:t.object({snapshot_id:I})}),pe.extend({type:t.literal("preview.build.failed"),payload:t.object({snapshot_id:I,message:t.string().min(1),diagnostics:t.string().min(1),retryable:t.boolean()})}),pe.extend({type:t.literal("server.run.finished"),payload:t.object({run_id:$,snapshot_id:I,degraded_reason:Rn.optional(),build_verified:t.boolean().optional()})}),pe.extend({type:t.literal("server.run.failed"),payload:t.object({run_id:$,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()})}),pe.extend({type:t.literal("server.error"),payload:t.object({code:t.string().min(1),message:t.string().min(1),retryable:t.boolean()})}),pe.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:Op,title:t.string().min(1).max(200),title_code:Nt.optional(),detail:t.string().max(360).optional(),detail_code:Nt.optional(),locks_input:t.boolean()})}),pe.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:Nt.optional(),detail:t.string().max(360).optional(),detail_code:Nt.optional()})}),pe.extend({type:t.literal("server.activity.finished"),payload:t.object({activity_id:t.string().min(1)})}),pe.extend({type:t.literal("server.activity.failed"),payload:t.object({activity_id:t.string().min(1),detail:t.string().max(360).optional()})})]),TT=IT.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 i=e.payload.name==="prepare_product_search_entry";i!==!!e.payload.interaction_request&&n.addIssue({code:"custom",path:["payload","interaction_request"],message:i?"prepare_product_search_entry requires interaction_request":"interaction_request is only valid for prepare_product_search_entry"})}),Tq=t.union([RT,TT]),kq={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."]},td=t.string().regex(/^sha256:[a-f0-9]{64}$/),kT=t.enum(["create","update","delete","str_replace"]),nd=t.enum(["sitemap_resync","smoke_test","prepare_preview"]),AT=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(),wT=t.object({path:ve,operation:kT,expected_hash:td.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(AT).min(1).max(20).optional()}).strict().superRefine((e,n)=>{let i=e.full_content!==void 0;if(e.operation==="delete"){i&&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(GT(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}i||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"})}),PT=t.object({kind:t.enum(["block","page","site","chrome"]),id:t.string().min(1).max(120)}),CT=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:PT,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)}),id=t.object({site_id:k,base_snapshot_id:I,reason:t.string().min(1),patches:t.array(wT).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(CT).max(24).optional(),post_actions:t.array(nd).optional()});function sd(e,n){let i=new Set;for(let[s,a]of e.patches.entries())i.has(a.path)&&n.addIssue({code:"custom",path:["patches",s,"path"],message:`Duplicate patch path: ${a.path}`}),i.add(a.path)}var Aq=id.superRefine(sd),wq=id.omit({base_snapshot_id:!0}).extend({site_id:k.optional()}).superRefine(sd),vT=Ee,DT=t.object({path:vT,operation:t.enum(["upsert","delete"]).optional()}),ad=t.enum(["sync_cms_pages","sync_cms_navigation"]),Pq=t.object({files:t.array(DT).min(1),post_actions:t.array(ad).optional()}).strict().overwrite(e=>e.post_actions?{...e,post_actions:[...new Set(e.post_actions)]}:e),OT=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","GLOBALS_CSS_EDIT_REJECTED"]),NT=t.object({status:t.literal("applied"),patch_batch_id:t.string().min(1),site_id:k,base_snapshot_id:I,snapshot_id:I,manifest_hash:td,object_key:t.string().min(1),changed_files:t.array(ve).min(1),post_actions_queued:t.array(nd),dropped_protected_files:t.array(t.string().min(1)).min(1).optional()}),jT=t.object({status:t.literal("failed"),code:OT,message:t.string().min(1),retryable:t.boolean().default(!1),details:t.unknown().optional()}),Cq=t.discriminatedUnion("status",[NT,jT]),vq=t.object({ok:t.literal(!0),post_actions:t.array(t.object({action:ad,status:t.enum(["succeeded","failed"])}).strict()).default([])}),od=Ee,LT=t.enum(["text","binary"]),rd=t.object({path:od,kind:LT,language:t.string().min(1).nullable(),size_bytes:t.number().int().nonnegative()}),Dq=t.object({path:od}),MT=rd.extend({kind:t.literal("text"),language:t.string().min(1),content:t.string()}),UT=rd.extend({kind:t.literal("binary"),language:t.null(),mime_type:t.string().min(1),content_base64:t.string().min(1)}),Oq=t.union([MT,UT]);function oi(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=>oi(n)):Object.entries(e).some(([n,i])=>FT(n)||oi(i))}function FT(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 cd(e){let n=e.split("/");return e.length>0&&!e.startsWith("/")&&!e.includes("\\")&&n.every(i=>i!==""&&i!=="."&&i!=="..")}function GT(e){if(/^(?:src\/)?app\/\.vcp\//.test(e))return li(e);let n=/^app\/(?:(.*)\/)?page\.(?:tsx|jsx)$/.exec(e);if(!n)return!0;let s=(n[1]??"").split("/").filter(o=>o.length>0);return s.some(o=>o.startsWith("_"))?!0:s.filter(o=>!o.startsWith("@")&&!/^\(.+\)$/.test(o)).map(o=>o.replace(/^\((?:\.|\.\.|\.\.\.)\)/,"")).filter(o=>o.length>0).every(o=>/^\[.*\]$/.test(o)||Nn.test(`/${o}`))}var md=t.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),qT=t.object({id:ri,tenant_id:t.string().min(1),site_id:k,sandbox_id:t.string().min(1).nullable(),status:md,source_snapshot_id:I.nullable(),last_snapshot_id:I.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)}),Nq=t.object({session_id:ri.optional(),sandbox_id:t.string().min(1).optional(),source_snapshot_id:I.optional(),last_snapshot_id:I,expected_current_snapshot_id:I.optional(),expected_ready_session_id:ri.optional(),expected_ready_session_last_snapshot_id:I.optional(),status:md,preview_url:t.string().url().optional(),launch_id:t.string().min(1).optional()}),jq=t.object({preview_session:qT,next_step:t.literal("preview")}),Lq=t.object({failed_count:t.number().int().nonnegative()}),Mq=t.object({site_id:k}),Uq=t.object({status:t.enum(["cancelled","stop_requested","no_active_run"]),agent_run:nt.nullable()});export{jm as AESTHETIC_NOTE_MAX_LENGTH,fo as AI_IMAGE_GENERATION_MAX_QUANTITY,Yb as APPLICATION_LIBRARY_ERROR_CODES,$F as AbandonSiteSnapshotResponseSchema,yE as ActiveSiteDomainDataSchema,hq as ActiveWorkspaceRunResponseSchema,Op as ActivityKindSchema,Nt as ActivityTitleCodeSchema,nw as AdvanceSiteWorkflowRequestSchema,Tp as AgentErrorCategorySchema,qo as AgentEventIdSchema,xo as AgentEventRecordSchema,Jp as AgentEventSchema,Xp as AgentEventTypeSchema,sT as AgentMessageHistoryPurposeSchema,wp as AgentModelRouteSchema,aT as AgentPlanStepSchema,GF as AgentRunContextResponseSchema,$ as AgentRunIdSchema,Ap as AgentRunKindSchema,nt as AgentRunRecordSchema,QR as AgentRunStatusSchema,kp as AgentRunTypeSchema,it as AgentThreadIdSchema,ZR as AgentThreadKindSchema,JR as AgentThreadOriginSchema,fs as AgentThreadRecordSchema,Pp as AgentThreadStatusSchema,dT as AiSdkUiDataPartSchema,gT as AiSdkUiErrorPartSchema,mT as AiSdkUiFilePartSchema,Ss as AiSdkUiMessagePartSchema,yT as AiSdkUiMessageSchema,cT as AiSdkUiReasoningPartSchema,pT as AiSdkUiSourceDocumentPartSchema,lT as AiSdkUiSourceUrlPartSchema,_T as AiSdkUiStepStartPartSchema,rT as AiSdkUiTextPartSchema,uT as AiSdkUiToolPartSchema,cq as ApiContractStatusSchema,rI as ApiErrorEnvelopeSchema,M as ApiResponseSchema,iq as AppendAgentEventRequestSchema,sq as AppendAgentEventResponseSchema,YN as ApplicationCreateResponseSchema,ey as ApplicationLibraryApplicationSchema,XN as ApplicationLibraryApplicationsDataSchema,Wm as ApplicationLibraryErrorCodeSchema,ZN as ApplicationLibraryErrorResponseSchema,QN as ApplicationLibraryTemplatesDataSchema,Km as ApplicationTemplateCatalogDataSchema,Xb as ApplicationTemplateCatalogItemSchema,Vb as ApplicationTemplateConsumeDataSchema,VN as ApplicationTemplateCreateRequestSchema,Zb as ApplicationTemplateCreateResponseSchema,Qb as ApplicationTemplateCreatedApplicationSchema,Zi as ApplicationTemplateDigestSchema,Bb as ApplicationTemplateFieldSchema,$b as ApplicationTemplateReferenceSchema,Jb as ApplicationTemplateSourceSchema,Ji as ApplicationTemplateStableKeySchema,za as ApplicationTemplateV1Schema,OT as ApplyPatchBatchErrorCodeSchema,jT as ApplyPatchBatchFailureSchema,Aq as ApplyPatchBatchInputSchema,wT as ApplyPatchBatchPatchSchema,nd as ApplyPatchBatchPostActionSchema,Cq as ApplyPatchBatchResultSchema,NT as ApplyPatchBatchSuccessSchema,wq as ApplyPatchBatchToolInputSchema,AT as ApplyPatchEditSchema,kT as ApplyPatchOperationSchema,Ip as ArchetypeProposalSchema,nk as AuditLogIdSchema,KT as AuthIdentityIdSchema,VT as AuthLoginCodeIdSchema,$T as AuthOidcStateIdSchema,zT as AuthSessionIdSchema,HT as AuthTokenIdSchema,YT as AuthWsTicketIdSchema,nx as BINDING_STATUSES,Np as BlockGenerationContextSchema,di as BlockInteractionSchema,TG as BlockMediaIntentSchema,Po as BlockSchema,vS as BlockingSubsiteSchema,jp as BrandingSchema,Yt as BriefIdSchema,ko as BriefRecordSchema,nr as BusinessFactsSchema,gD as CHAT_COPY,uD as CLARIFICATION_COPY,wy as CMS_FORM_FIELD_TYPES,Rm as CMS_MAIN_PRODUCTS_MAX_LENGTH,qu as CMS_PAGE_DIRECTORY_MAX_DEPTH,Gu as CMS_PAGE_DIRECTORY_MAX_NODES,Fu as CMS_PAGE_URL_MAX_LENGTH,vr as CMS_PAGE_URL_PATH_MAX_LENGTH,OC as COMPONENT_I18N_FILE_SUFFIX,Fi as COMPONENT_I18N_NAMESPACE,Td as CONVERSION_CTA_LABEL_MAX_LENGTH,xx as CRAWLER_INTERNAL_ERROR_CODES,fm as CURRENT_EDIT_ENGINE_VERSION,Mq as CancelActiveWorkspaceRunRequestSchema,Uq as CancelActiveWorkspaceRunResponseSchema,_A as CheckDesignerPageProjectionRequestSchema,hA as CheckDesignerPageProjectionResponseSchema,eg as CheckDesignerPageProjectionResultSchema,Fl as CheckSitePublishDomainDataSchema,dE as CheckSitePublishDomainRequestSchema,uE as CheckSitePublishDomainResponseSchema,Lp as ChromeDesignSchema,yI as ChromeFooterDesignSchema,bI as ChromeFooterShellSchema,SI as ChromeHeaderDesignSchema,hI as ChromeHeaderShellSchema,xI as ChromeMobileNavDesignSchema,kC as ClaimStaleWorkspaceRunsResponseSchema,YR as ClarifyQuestionOptionSchema,XR as ClarifyQuestionSchema,HR as ClarifyQuestionTypeSchema,Io as ClarifyQuestionsSchema,pF as ClarifyRunInputSchema,Fo as ClarifySessionIdSchema,ZI as ClarifySessionRecordSchema,dF as ClarifyStreamEventSchema,aj as CmsApplicationCoreInputSchema,oj as CmsApplicationCoreResultSchema,rj as CmsApplicationSeedInputSchema,cj as CmsApplicationSeedResultSchema,ik as CmsCollectionBindingIdSchema,oL as CmsCollectionBindingSchema,il as CmsFormSchemaProjectionSchema,Ks as CmsManagedPageTypeSchema,OU as CmsNavigationActionSchema,DU as CmsNavigationCapabilitiesResponseSchema,GR as CmsNavigationCapabilitiesSchema,hp as CmsNavigationCreateGroupBodySchema,MR as CmsNavigationCreateItemBodySchema,vU as CmsNavigationDefaultGroupBodySchema,jR as CmsNavigationEditorContextSchema,CU as CmsNavigationEditorResponseSchema,NR as CmsNavigationGroupSchema,_p as CmsNavigationItemSchema,FR as CmsNavigationMoveItemBodySchema,LR as CmsNavigationPatchGroupBodySchema,UR as CmsNavigationPatchItemBodySchema,dp as CmsNavigationTargetTypeSchema,Ku as CmsPageDirectoryGroupSchema,Or as CmsPageDirectoryNodeSchema,Pr as CmsPageDirectorySchema,zs as CmsPageTypeSchema,qt as CmsPageUrlPathSchema,xA as CmsSeoSyncStateSchema,bi as CmsSiteIdSchema,fx as CompanyInfoSchema,RL as CompanyInfoTaskCreateRequestSchema,IL as CompanyInfoTaskCreateResponseSchema,TL as CompanyInfoTaskResponseSchema,iN as CompleteCustomerMaterialsRequestSchema,sN as CompleteDiagnosisRequestSchema,sw as CompleteQualityOnlyWorkflowRequestSchema,YF as CompleteSiteSnapshotDeletionResponseSchema,iw as CompleteSiteWorkflowRequestSchema,aN as CompleteStrategyRequestSchema,nN as CompleteWebsiteScanRequestSchema,jC as ComponentI18nResourcesSchema,OA as ComposeDesignerPageResourceBodySchema,lk as ComputeSnapshotEditChangesRequestSchema,pk as ComputeSnapshotEditChangesResponseSchema,_E as ConfirmSitePublishDomainRemediationDataSchema,gE as ConfirmSitePublishDomainRemediationRequestSchema,hE as ConfirmSitePublishDomainRemediationResponseSchema,zG as ConfirmSiteStructureRequestSchema,KN as ConnectDynamicCollectionInputSchema,hj as ConnectFormInputSchema,Mt as ConversionHintsSchema,Ex as CrawlerInternalErrorCodeSchema,kL as CrawlerInternalErrorSchema,un as CrawlerTaskCodeSchema,gL as CrawlerTaskCreateRequestSchema,SL as CrawlerTaskCreateResponseSchema,lx as CrawlerTaskFailureErrorCodeSchema,fl as CrawlerTaskFailureStageSchema,dx as CrawlerTaskPageSchema,_L as CrawlerTaskPagesQuerySchema,yL as CrawlerTaskPagesResponseSchema,bL as CrawlerTaskStatusResponseSchema,Ht as CrawlerTaskUuidSchema,RG as CreateAgentRunConflictResponseSchema,qF as CreateAgentRunRequestSchema,WF as CreateAgentRunResponseSchema,gG as CreateDeploymentRequestSchema,iI as CreateDeploymentResponseSchema,Vk as CreateDocumentUploadRequestSchema,ck as CreateExternalSiteEditRequestSchema,dk as CreateExternalSiteEditResponseSchema,e0 as CreateImageUploadRequestSchema,Bk as CreateInputSourceRequestSchema,_G as CreateQualityCheckDeploymentRequestSchema,yF as CreateSiteBriefRequestSchema,LF as CreateSiteBriefResponseSchema,xF as CreateSiteDraftRequestSchema,bF as CreateSiteInputSchema,bq as CreateSiteThreadRequestSchema,ew as CreateSiteWorkflowRequestSchema,jd as CreateTextInputSourceRequestSchema,Ld as CreateUrlInputSourceRequestSchema,SG as CurrentDeploymentResponseSchema,XO as CustomerMaterialsDraftResponseSchema,ja as CustomerMaterialsDraftSchema,QO as CustomerMaterialsNullableResponseSchema,La as CustomerMaterialsRecordSchema,YO as CustomerMaterialsResponseSchema,Tb as CustomerMaterialsStatusSchema,qh as DEFAULT_FONTS,wm as DEFAULT_SITE_DESIGN_RADIUS_ID,lu as DEFAULT_SITE_LOCALE,TD as DEFAULT_SUBSITE_PALETTE,Li as DEFAULT_WEIGHT_STYLE_ID,SP as DEPLOYMENT_ACTIVE_STATUSES,kt as DEPLOYMENT_LIFECYCLE_TRANSITIONS,Q_ as DEPLOYMENT_PROGRESS_STEP_CODES,oI as DEPLOYMENT_REALTIME_CHANNEL,Xt as DEPLOYMENT_STATUSES,fP as DEPLOYMENT_TERMINAL_STATUSES,jh as DEPLOYMENT_TRANSITION_ERROR_CODE,EG as DEPLOYMENT_WEBSOCKET_CONTRACT,eA as DESIGNER_COMPONENT_LIBRARY_ERROR_CODES,wA as DESIGNER_PAGE_LIBRARY_ERROR_CODES,Kk as DOCUMENT_EXTENSION_WHITELIST,zk as DOCUMENT_MIME_WHITELIST,Bx as DOMAIN_DNS_PURPOSES,Hx as DOMAIN_DNS_REMEDIATION_STATUSES,Kx as DOMAIN_DNS_VERIFICATION_STATUSES,Fx as DOMAIN_OBSERVED_STATUSES,qx as DOMAIN_ROUTING_MODES,SA as DeleteDesignerPageErrorDetailsSchema,pA as DeleteDesignerPageRequestSchema,dA as DeleteDesignerPageResponseSchema,Zu as DeleteDesignerPageResultSchema,VF as DeleteSiteSnapshotResponseSchema,mt as DeploymentIdSchema,XT as DeploymentJobIdSchema,Z_ as DeploymentProgressStepCodeSchema,eh as DeploymentProgressStepSchema,J_ as DeploymentProgressStepStatusSchema,Nc as DeploymentProgressStepsSchema,Ot as DeploymentRecordSchema,xG as DeploymentRedisPubSubEventSchema,Ao as DeploymentStatusSchema,yp as DeploymentStatusSummarySchema,Sa as DeploymentTransitionError,vp as DeploymentTypeSchema,_s as DeploymentWsDeploymentPayloadSchema,yG as DeploymentWsServerMessageSchema,aI as DeploymentWsServerMessageTypeSchema,nT as DesignPlanGenerationOutcomeSchema,iT as DesignPlanGenerationReasonSchema,xs as DesignPlanIdSchema,wG as DesignPlanPatchSchema,JI as DesignPlanRecordSchema,Up as DesignPlanSchema,Fe as DesignTokenBlockError,IG as DesignTokensSchema,Uu as DesignerComponentCatalogItemSchema,Tr as DesignerComponentCategoriesDataSchema,Ir as DesignerComponentCategoryNodeSchema,Gt as DesignerComponentExactVersionSchema,Ar as DesignerComponentInstallDataSchema,kr as DesignerComponentsDataSchema,ag as DesignerPageCatalogItemSchema,qr as DesignerPageCategoriesDataSchema,Gr as DesignerPageCategoryNodeSchema,Yu as DesignerPageDeleteBlockReasonSchema,Vu as DesignerPageDisabledReasonSchema,On as DesignerPageExactVersionSchema,Mr as DesignerPageGroupSchema,Br as DesignerPageInstallDataSchema,Lr as DesignerPageNodeSchema,zr as DesignerPageResourcePreparationDataSchema,sg as DesignerPageResourceSourceSchema,dg as DesignerPageResourceTemplateSchema,Wt as DesignerPageResourceTypeSchema,Wr as DesignerPagesDataSchema,Fs as DesignerResourceVersionSchema,Hr as DesignerSitePagesDataSchema,CA as DesignerSiteRouteIdSchema,Nl as DomainConfigurationSchema,ro as DomainDnsPurposeSchema,Zx as DomainDnsRecordSchema,Qx as DomainDnsRemediationChangeSchema,vl as DomainDnsRemediationRecordSchema,Dl as DomainDnsRemediationResultSchema,$x as DomainDnsRemediationStatusSchema,Xx as DomainDnsVerificationObservationSchema,Cl as DomainDnsVerificationResultSchema,zx as DomainDnsVerificationStatusSchema,Gx as DomainObservedStatusSchema,Yx as DomainOperationErrorSchema,ls as DomainOperationSchema,Vx as DomainOperationStatusSchema,co as DomainOperationTypeSchema,Ol as DomainRecordSchema,Wx as DomainRoutingModeSchema,hD as EDIT_ENGINE_VERSION_HEADER,SD as EDIT_ENGINE_VERSION_SOURCE_HEADER,mk as EMPTY_EXTERNAL_SITE_EDIT_CHANGES,lD as ERROR_COPY,ud as EXTERNAL_SITE_EDIT_INFRASTRUCTURE_REASONS,dd as EXTERNAL_SITE_EDIT_PROMPT_MAX_LENGTH,Oa as EditEngineVersionParseError,$r as EnhanceDesignerPageResourceBodySchema,NF as EnhanceDesignerPageResourceResponseSchema,_k as ExternalSiteEditCallbackAckSchema,gk as ExternalSiteEditCallbackPayloadSchema,gd as ExternalSiteEditCallbackStatusSchema,Rs as ExternalSiteEditChangeKindSchema,Vo as ExternalSiteEditChangesSchema,Rn as ExternalSiteEditDegradedReasonSchema,Lt as ExternalSiteEditExternalIdSchema,Ko as ExternalSiteEditOutcomeSchema,Rd as ExternalSiteEditPageChangeSchema,hd as ExternalSiteEditPageTypeSchema,Ed as ExternalSiteEditSectionChangeSchema,fd as ExternalSiteEditSiteWideChangeSchema,Sd as ExternalSiteEditSiteWideKindSchema,Bo as ExternalSiteEditTaskIdSchema,mi as ExternalSiteEditTaskSchema,_d as ExternalSiteEditTaskStatusSchema,TF as ExternalSyncSiteRequestSchema,jF as ExternalSyncSiteResponseSchema,Dd as ExtractedFactKindSchema,ui as ExtractedFactSchema,Ka as FIELD_TYPES,fC as FILL_IN_NOT_AVAILABLE_ERROR_CODE,yC as FILL_IN_TARGET_MODIFIED_ERROR_CODE,bC as FILL_IN_TARGET_NOT_OMITTED_ERROR_CODE,$c as FONT_PAIRINGS,ya as FONT_PAIRING_IDS,Gy as FORM_DESIGN_ERROR_CODES,Fy as FORM_DESIGN_FAILURE_STAGES,My as FORM_DESIGN_OPERATION_STAGES,Uy as FORM_DESIGN_OPERATION_STATUSES,ts as FORM_FIELD_TYPES,Vm as FORM_SCENE_CODES,Ym as FORM_SCENE_UNKNOWN,ay as FORM_SHAPE_EMBEDDED,Py as FORM_SPEC_FIELD_TYPE_TO_CMS,Qm as FORM_SPEC_FILE_MIN_RUNTIME_VERSION,yy as FORM_SPEC_LOCALIZABLE_FIELD_PATHS,Xm as FORM_SPEC_MULTISTEP_MIN_RUNTIME_VERSION,wj as FORM_TEMPLATE_CATEGORY_COUNTS,Aj as FORM_TEMPLATE_CATEGORY_SLUGS,Lq as FailStaleInFlightWorkspaceRunsResponseSchema,Qi as FieldDeclSchema,om as FillInTargetSchema,LL as FirecrawlBatchCreateRequestSchema,ML as FirecrawlBatchCreatedResponseSchema,Tx as FirecrawlBatchErrorSchema,FL as FirecrawlBatchErrorsResponseSchema,Ix as FirecrawlBatchPageSchema,UL as FirecrawlBatchStatusResponseSchema,vL as FirecrawlCrawlCreateRequestSchema,DL as FirecrawlCrawlCreatedResponseSchema,OL as FirecrawlCrawlStatusResponseSchema,Rl as FirecrawlJobStatusSchema,PL as FirecrawlMapRequestSchema,CL as FirecrawlMapResponseSchema,GL as FirecrawlQueueStatusResponseSchema,NL as FirecrawlScrapeRequestSchema,jL as FirecrawlScrapeResponseSchema,fI as FooterShellSurfaceSchema,ly as FormBlockIdSchema,is as FormDefinitionIdSchema,Ny as FormDesignAffectedFilesSchema,so as FormDesignErrorCodeSchema,Fj as FormDesignErrorSchema,ol as FormDesignFailureStageSchema,de as FormDesignHashSchema,Dj as FormDesignOpenResponseSchema,jy as FormDesignOperationFingerprintInputSchema,Za as FormDesignOperationIdSchema,rl as FormDesignOperationNextActionSchema,ZT as FormDesignOperationRecordIdSchema,Mj as FormDesignOperationRecordSchema,ao as FormDesignOperationResponseSchema,ml as FormDesignOperationSchema,io as FormDesignOperationStageSchema,al as FormDesignOperationStatusSchema,Uj as FormDesignOperationTransitionRequestSchema,cl as FormDesignPreviewRefreshStatusSchema,Nj as FormDesignQueryResponseSchema,jj as FormDesignResumeRequestSchema,Lj as FormDesignResumeResponseSchema,Ly as FormDesignSaveRequestSchema,Oj as FormDesignSaveResponseSchema,sl as FormDesignSharedImpactSchema,no as FormDesignStandardizationSchema,cy as FormFieldDeclSchema,ni as FormFieldNameSchema,Ya as FormMetadataSchema,Ja as FormOptionValueSchema,Va as FormSceneSchema,oy as FormShapeSchema,py as FormSpecBindingSchema,uy as FormSpecFieldNodeSchema,_y as FormSpecNodeSchema,dy as FormSpecOptionSchema,gy as FormSpecStepBreakNodeSchema,to as FormSpecV1Schema,Pj as FormTemplateCatalogResponseSchema,nl as FormTemplateCategorySlugSchema,ky as FormTemplateCategoryV1Schema,vt as FormTemplateTextSchema,Ay as FormTemplateV1Schema,PE as GA4_AUTHORIZATION_STATUSES,vE as GA4_AUTH_ATTEMPT_STATUSES,ME as GA4_BINDING_REASONS,OE as GA4_BINDING_STATUSES,jE as GA4_VERIFICATION_STATUSES,Bn as GLOBAL_DESIGN_TOKENS_END,rn as GLOBAL_DESIGN_TOKENS_START,xE as GSC_AUTH_STATUSES,EE as GSC_BINDING_STATUSES,RE as GSC_PROPERTY_TYPES,$E as Ga4AccountOptionSchema,Kl as Ga4AuthAttemptSchema,DE as Ga4AuthAttemptStatusSchema,GE as Ga4AuthorizationSchema,CE as Ga4AuthorizationStatusSchema,UE as Ga4BindingReasonSchema,qE as Ga4BindingSchema,NE as Ga4BindingStatusSchema,YE as Ga4DataStreamOptionSchema,XE as Ga4DataStreamsDataSchema,mU as Ga4DataStreamsQuerySchema,cU as Ga4DataStreamsResponseSchema,zE as Ga4DeploymentSchema,BE as Ga4ModeSchema,QE as Ga4MutationSchema,HE as Ga4PropertyOptionSchema,VE as Ga4SetupResourcesDataSchema,rU as Ga4SetupResourcesQuerySchema,oU as Ga4SetupResourcesResponseSchema,zl as Ga4StatusDataSchema,aU as Ga4StatusQuerySchema,sU as Ga4StatusResponseSchema,KE as Ga4TrackingSchema,WE as Ga4VerificationSchema,LE as Ga4VerificationStatusSchema,yR as GenerateAiImagesRequestSchema,xR as GenerateAiImagesResponseSchema,mp as GeneratedAiImageResultSchema,AM as GetActiveSiteDomainResponseSchema,fG as GetDeploymentResponseSchema,sI as GetDeploymentsStatusResponseSchema,uk as GetExternalSiteEditResponseSchema,kM as GetSiteDomainConfigurationResponseSchema,RO as GetSiteLauncherPermissionResponseSchema,mo as GetSitePublishDomainOperationDataSchema,SE as GetSitePublishDomainOperationResponseSchema,rO as GetTemplateUpgradeReportQuerySchema,cO as GetTemplateUpgradeReportResponseSchema,VM as GoogleSearchConsoleAuthStartDataSchema,$M as GoogleSearchConsoleAuthStartRequestSchema,YM as GoogleSearchConsoleAuthStartResponseSchema,BM as GoogleSearchConsoleAuthStatusSchema,KM as GoogleSearchConsoleBindingStatusSchema,zM as GoogleSearchConsolePropertyTypeSchema,HM as GoogleSearchConsoleStateSchema,QM as GoogleSearchConsoleStatusDataSchema,XM as GoogleSearchConsoleStatusInputSchema,ZM as GoogleSearchConsoleStatusResponseSchema,GM as GscAuthStartDataSchema,FM as GscAuthStartRequestSchema,qM as GscAuthStartResponseSchema,lo as GscAuthStatusSchema,po as GscBindingStatusSchema,uo as GscPropertyTypeSchema,TE as GscStateInputSchema,WM as GscStateSchema,Wl as GscStatusDataSchema,kE as GscStatusResponseSchema,Cr as HOME_PAGE_URL_PATH,gI as HeaderShellBehaviorSchema,_I as HeaderShellShapeSchema,uI as HeaderShellSurfaceSchema,dI as HeaderShellVariantSchema,sx as HomeUrlCrawlerTaskCreateRequestSchema,na as HttpUrlSchema,Xk as IMAGE_EXTENSION_WHITELIST,Qk as IMAGE_MIME_WHITELIST,Rr as INSERT_NEW_COMPONENT_CATEGORY_GROUP_KEY,Fr as INSERT_NEW_PAGE_CATEGORY_GROUP_KEY,rC as INTERNAL_RUN_LEASE_OWNER_HEADER,pu as ISO_639_3_TO_SITE_LOCALE,Md as ImageRoleSchema,ed as InboundUserMessageSchema,NN as IndustryClassificationRequestSchema,jN as IndustryClassificationResultSchema,Ub as IndustryConfidenceSchema,Bm as InitializationResultSchema,vd as InputBundleStatusSchema,_i as InputConflictSchema,t0 as InputContextBundleSchema,En as InputContextSourceIdSchema,Nd as InputSourceSchema,Ts as InputSourceStatusSchema,Is as InputSourceTypeSchema,YD as InspectTemplateUpgradeStateRequestSchema,XD as InspectTemplateUpgradeStateResponseSchema,sA as InstallDesignerComponentBodySchema,wF as InstallDesignerComponentResponseSchema,vA as InstallDesignerPageBodySchema,vF as InstallDesignerPageResponseSchema,hG as InternalCreateDeploymentResponseSchema,lG as InternalEnsureSubsitePublishRequestSchema,pG as InternalEnsureSubsitePublishResponseSchema,Q as InternalEntityIdSchema,bG as InternalGetDeploymentsStatusResponseSchema,dG as InternalGetSubsitePublishStatusRequestSchema,uG as InternalGetSubsitePublishStatusResponseSchema,cG as InternalPrepareSubsitePreviewRequestSchema,mG as InternalPrepareSubsitePreviewResponseSchema,Eb as KNOWLEDGE_CATEGORY_CODES,Im as KnowledgeCategoryCodeSchema,BO as KnowledgeContextReadinessSchema,Ib as KnowledgeSourceReadinessSchema,Tm as KnowledgeSourceReadinessStatusSchema,qO as KnowledgeTaskStatusBatchSchema,Rb as KnowledgeTaskStatusSchema,Tl as LEGACY_FILE_MUTATION_TOOL_NAME,au as LEGACY_SITE_LOCALE_CODES,Eq as LatestAgentRunQuerySchema,Rq as LatestAgentRunResponseSchema,_q as LatestWorkspaceRunQuerySchema,gq as LatestWorkspaceRunResponseSchema,XL as LauncherPromptTemplateApplyRequestSchema,QL as LauncherPromptTemplateApplyResponseSchema,Dx as LauncherPromptTemplateCatalogItemSchema,VL as LauncherPromptTemplateCatalogQuerySchema,YL as LauncherPromptTemplateCatalogSchema,Cx as LauncherPromptTemplateKindSchema,vx as LauncherPromptTemplateLocaleSchema,ms as LauncherPromptTemplateTypeSchema,ub as LauncherScopeSchema,oq as ListAgentEventsQuerySchema,aq as ListAgentEventsResponseSchema,kF as ListDesignerComponentCategoriesResponseSchema,iA as ListDesignerComponentsQuerySchema,AF as ListDesignerComponentsResponseSchema,PF as ListDesignerPageCategoriesResponseSchema,PA as ListDesignerPagesQuerySchema,CF as ListDesignerPagesResponseSchema,OF as ListDesignerSitePagesResponseSchema,SR as ListMediaLibraryAssetsQuerySchema,fR as ListMediaLibraryAssetsResponseSchema,rq as ListSiteAgentEventsQuerySchema,aG as ListSiteVersionsResponseSchema,mO as ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema,lO as ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema,IC as ListWorkspacePageCheckpointsResponseSchema,$k as MAX_DOCUMENT_SOURCES_PER_SITE,Hk as MAX_DOCUMENT_UPLOAD_BYTES,Jk as MAX_IMAGE_SOURCES_PER_SITE,Zk as MAX_IMAGE_UPLOAD_BYTES,lR as MAX_NAV_LABEL_WIDTH,Mf as MAX_SUBSITE_MEDIA_REPLACEMENTS,Ew as MAX_UNBOUND_WORKSPACE_ATTACHMENTS_PER_SITE,ma as MAX_WORKSPACE_ATTACHMENTS_PER_MESSAGE,Pw as MAX_WORKSPACE_URL_CAPTURES_PER_SITE_HOUR,tp as MEDIA_LIBRARY_AUDIO_EXTENSIONS,op as MEDIA_LIBRARY_AUDIO_MIME_TYPES,np as MEDIA_LIBRARY_DOCUMENT_EXTENSIONS,_R as MEDIA_LIBRARY_EXTENSIONS,ip as MEDIA_LIBRARY_FILE_EXTENSIONS,Jl as MEDIA_LIBRARY_IMAGE_EXTENSIONS,gR as MEDIA_LIBRARY_IMAGE_MAX_BYTES,sp as MEDIA_LIBRARY_IMAGE_MIME_TYPES,Zl as MEDIA_LIBRARY_MAX_BYTES,hR as MEDIA_LIBRARY_MIME_TYPES,ep as MEDIA_LIBRARY_VIDEO_EXTENSIONS,ap as MEDIA_LIBRARY_VIDEO_MIME_TYPES,UC as MIGRATION_PRODUCTS_CMS_DETAIL_PAGE_TITLE,MC as MIGRATION_PRODUCTS_DETAIL_PREFIX,qC as MIGRATION_PRODUCTS_DETAIL_VIEW_VARIANT,GC as MIGRATION_PRODUCTS_LIST_VIEW_VARIANT,IS as MIGRATION_PRODUCTS_ROUTE,St as MIGRATION_PRODUCTS_SLUG,FC as MIGRATION_PRODUCTS_VIEW_BLOCK_TYPE,ry as MODEL_DECLARABLE_FORM_FIELD_TYPES,Il as MODEL_FILE_MUTATION_TOOL_NAMES,kb as MOTION_PRESETS,Ua as MOTION_PRESET_IDS,AG as MediaAssetSchema,lI as MediaAttributionSchema,So as MediaLibraryAssetSchema,rp as MediaLibraryFileTypeSchema,cp as MediaLibrarySourceSchema,PT as MediaRequestOwnerSchema,tk as MediaResolutionCacheIdSchema,WR as MigrationCollectionProgressSchema,bo as MigrationCollectionSchema,LU as MigrationContentProgressSchema,qR as MigrationReasonCodeSchema,KR as MigrationRedirectProgressSchema,BR as MigrationRedirectReasonCodeSchema,fp as MigrationRedirectSiteReasonSchema,nA as MockDesignerComponentInsertDataSchema,tA as MockDesignerComponentInsertRequestSchema,Ro as MotionLevelSchema,Vy as NAV_ITEMS_LOCALIZABLE_FIELD_PATHS,Yy as NAV_ITEMS_MACHINE_FIELD_PATHS,Kh as NEXT_FONT_DISPLAY_NAMES,ht as NEXT_FONT_REGISTRY,du as NON_LATIN_SITE_LOCALE_CODES,Yj as NavItemSchema,vs as NextPageCodeErrorSchema,Ky as PAGE_SEO_LOCALIZABLE_FIELD_PATHS,zy as PAGE_SEO_MACHINE_FIELD_PATHS,Nn as PAGE_SLUG_PATTERN,Jt as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,Qo as PAGE_TEMPLATE_BATCH_MAX_ITEMS,Ax as PLATFORM_FILE_MUTATION_TOOL_NAMES,tL as PLATFORM_MATERIALIZED_EXEMPTIONS,Jy as PLATFORM_MATERIALIZED_FILES,ex as PLATFORM_MATERIALIZED_FILE_PATTERNS,eL as PLATFORM_MATERIALIZERS,Vr as PLATFORM_OWNED_PAGE_SLUGS,ug as PLATFORM_OWNED_ROUTE_FILE_PATHS,Qu as PageDirectoryReconcileFailedPageSchema,Hs as PageDirectoryReconcileResultSchema,bA as PageDirectoryReconcileStateSchema,Xu as PageDirectoryReconcileStatusSchema,cx as PageDiscoveryCoverageEntrySchema,fL as PageDiscoveryCoverageReasonSchema,bl as PageDiscoveryCoverageSchema,Fp as PageNavigationSchema,Vs as PageResourceArtifactSchema,mg as PageResourceComponentReferenceSchema,lg as PageResourceComponentSchema,rg as PageResourceDraftPageSchema,cg as PageResourceDraftSchema,wi as PageResourceFinalRouteSchema,pg as PageResourcePageSchema,og as PageResourcePageSelectionSchema,Kr as PageResourceRouteMappingSchema,vo as PageSchema,$j as PageSeoDeclSchema,Co as PageSlugSchema,tg as PageTargetKindSchema,qs as PageTargetProjectionHashSchema,Ur as PageTargetSchema,ng as PageTargetSeoSchema,fA as PageTargetSetSchema,Jo as PageTemplateBatchManifestSchema,Ek as PageTemplateCleanupRequestSchema,Tk as PageTemplateCleanupResponseSchema,Xo as PageTemplateCreateItemSchema,yk as PageTemplateCreateRequestSchema,Rk as PageTemplateCreateResponseSchema,kk as PageTemplateErrorCodeSchema,Xe as PageTemplateIdSchema,Tn as PageTemplatePagePathSchema,xk as PageTemplatePromoteRequestSchema,Ik as PageTemplatePromoteResponseSchema,Id as PageTemplateTaskSchema,Ta as PaletteInputsSchema,XG as PersistClarifyAnswersRequestSchema,QG as PersistClarifyAnswersResponseSchema,HG as PersistGeneratedSitemapDraftRequestSchema,YG as PersistGeneratedSitemapDraftResponseSchema,Nq as PersistPreviewSessionRequestSchema,jq as PersistPreviewSessionResponseSchema,JG as PersistSiteDesignPlanRequestSchema,eq as PersistSiteDesignPlanResponseSchema,VG as PersistSiteSitemapDraftResponseSchema,KG as PersistSiteSitemapRequestSchema,$G as PersistSiteSitemapResponseSchema,BF as PersistSiteSnapshotRequestSchema,KF as PersistSiteSnapshotResponseSchema,zR as PositioningPrefillSchema,yo as PositioningSourceSchema,DA as PrepareDesignerPageBodySchema,DF as PrepareDesignerPageResponseSchema,OO as PrepareSiteBuildInitialGenerationBaseRequestSchema,NO as PrepareSiteBuildInitialGenerationBaseResultSchema,VD as PrepareTemplateUpgradeStateRequestSchema,Qf as PrepareTemplateUpgradeStateResponseSchema,rG as PrepareVersionPreviewRequestSchema,nI as PrepareVersionPreviewResponseSchema,Dc as ProductSearchAppConfigDraftSchema,ra as ProductSearchAppSlugSchema,bw as ProductSearchContractFixtureSchema,W_ as ProductSearchDraftConfigSchema,Ue as ProductSearchFieldNameSchema,G_ as ProductSearchFilterMetaSchema,ca as ProductSearchInteractionRequestSchema,Di as ProductSearchInteractionResponseSchema,fw as ProductSearchPopularTermsReadSchema,vc as ProductSearchPopularTermsSchema,H_ as ProductSearchRequestSchema,V_ as ProductSearchResponseSchema,Fn as ProductSearchRouteIdSchema,F_ as ProductSearchValueShapeSchema,HF as PromoteSiteSnapshotRequestSchema,eI as PromoteSiteSnapshotResponseSchema,iG as PromoteTemplateUpgradeSnapshotRequestSchema,sG as PromoteTemplateUpgradeSnapshotResponseSchema,Ml as QualityRunningStatusSchema,dD as REFUSAL_COPY,lq as REST_API_ENDPOINTS,Hy as ROOT_LAYOUT_METADATA_LOCALIZABLE_FIELD_PATHS,$y as ROOT_LAYOUT_METADATA_MACHINE_FIELD_PATHS,fE as ReconcileSitePublishDomainOperationDataSchema,bE as ReconcileSitePublishDomainOperationResponseSchema,XF as RecordSnapshotVersionRequestSchema,QF as RecordSnapshotVersionResponseSchema,aO as RecordTemplateUpgradeEventRequestSchema,oO as RecordTemplateUpgradeEventResponseSchema,QD as RecordTemplateUpgradeFailureRequestSchema,ZD as RecordTemplateUpgradeFailureResponseSchema,JD as RecordTemplateUpgradeSuccessRequestSchema,eO as RecordTemplateUpgradeSuccessResponseSchema,uA as RecoverDesignerPageProjectionRequestSchema,gA as RecoverDesignerPageProjectionResponseSchema,Ju as RecoverDesignerPageProjectionResultSchema,Od as ReferencePagePatternSchema,gi as ReferenceSignalsSchema,kR as RegisterMediaResourceReferenceRequestSchema,AR as RegisterMediaResourceReferenceResponseSchema,aw as RegisterWorkflowTaskCommandRequestSchema,D_ as RegisterWorkflowTaskRequestSchema,RC as RegisterWorkspacePageCheckpointRequestSchema,eG as ReleaseTemplateUpgradeLockRequestSchema,tG as ReleaseTemplateUpgradeLockResponseSchema,cw as ReplaceCrawlWorkflowTaskCommandRequestSchema,N_ as ReplaceCrawlWorkflowTaskRequestSchema,rw as ReplaceWorkflowTaskCommandRequestSchema,O_ as ReplaceWorkflowTaskRequestSchema,BN as ResolvedFieldSchema,Sj as ResolvedFormFieldSchema,mq as RestApiMethodSchema,oG as RestoreSiteSnapshotResponseSchema,Vj as RootLayoutMetadataSchema,Dp as RouteGenerationCardSchema,wh as RuleEngineInputSchema,Dh as RuleEngineScoreRecordSchema,ha as RuleScoreDimensionKeySchema,vh as RuleScoreDimensionSchema,wn as SELECTABLE_SITE_LOCALE_CODES,LI as SITEMAP_RESOLVER_MAX_BLOCK_TARGETS,jI as SITEMAP_RESOLVER_MAX_PAGE_TARGETS,vO as SITE_BUILD_CONTEXT_FILE_PATH,DO as SITE_BUILD_CONTEXT_MAX_BYTES,y_ as SITE_BUILD_STATUSES,Ic as SITE_BUILD_STATUS_CODES,x_ as SITE_DEPLOYMENT_STATUSES,Tc as SITE_DEPLOYMENT_STATUS_CODES,Ma as SITE_DESIGN_DENSITY_IDS,Kt as SITE_DESIGN_NOTES_END,on as SITE_DESIGN_NOTES_START,Am as SITE_DESIGN_RADIUS_IDS,gv as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,vu as SITE_EDIT_MATERIALIZATION_MAX_FILE_CONTENT_BYTES,Ms as SITE_EDIT_MATERIALIZATION_MAX_FILE_COUNT,Us as SITE_EDIT_MATERIALIZATION_MAX_TOTAL_CONTENT_BYTES,mc as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,g1 as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,hf as SITE_EDIT_RUNTIME_CONTAINER_TAGS,Sf as SITE_EDIT_RUNTIME_TEXT_TAGS,_f as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,a1 as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,Gd as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,or as SITE_EDIT_SOURCE_ALLOWED_DIRS,Ud as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,Fd as SITE_EDIT_SOURCE_ALLOWED_SYSTEM_FILES,As as SITE_EDIT_SOURCE_DELETE_CAPABILITY,qd as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,Um as SITE_EXTRA_REQUIREMENT_MAX_LENGTH,QC as SITE_HAS_ACTIVE_SUBSITES_ERROR_CODE,ZC as SITE_HAS_SUBSITES_ERROR_CODE,NP as SITE_LEADING_BODY_TOKEN,jP as SITE_LEADING_HEADING_TOKEN_NAMES,ou as SITE_LOCALE_CODES,Hj as SITE_LOCALIZATION_STRUCTURES,uF as SITE_PLANNING_FROZEN_ERROR_CODE,gF as SITE_PLANNING_LOCKED_ERROR_CODE,fF as SITE_SITEMAP_DRAFT_OPERATION_MISMATCH_ERROR_CODE,SF as SITE_SITEMAP_DRAFT_STALE_ERROR_CODE,_F as SITE_STRUCTURE_CONFIRMATION_REQUIRED_ERROR_CODE,hF as SITE_STRUCTURE_CONFIRMATION_STALE_ERROR_CODE,bp as SITE_STRUCTURE_INVALID_ERROR_CODE,OP as SITE_WEIGHT_TOKEN_NAMES,rb as SITE_WORKFLOW_PROGRESS_STATUSES,mb as SITE_WORKFLOW_PROGRESS_STEP_STATUSES,E_ as SITE_WORKFLOW_STATUSES,kc as SITE_WORKFLOW_STATUS_CODES,pq as SSE_STREAMS,_u as STEP5_KEYWORD_CATEGORIES,Su as STEP5_OPTIONAL_STRATEGY_KEYS,Ei as STEP5_REQUIRED_STRATEGY_COUNT,Cn as STEP5_REQUIRED_STRATEGY_KEYS,wu as STEP5_SSE_EVENT_NAMES,Ne as STEP5_STRATEGY_COUNT,Zt as STEP5_STRATEGY_KEYS,Sr as STEP5_STRATEGY_OPTION_IDS,vm as STEP6_AI_THEME_IDS,Fa as STEP6_AI_THEME_PRESETS,Dm as STEP6_GENERATED_THEME_ID_PATTERN,Cf as SUBSITE_GLOSSARY_ENTRY_MAX_CHARS,vf as SUBSITE_GLOSSARY_MAX_ENTRIES,zf as SUBSITE_MOUNT_PATH_PATTERN,Lf as SUBSITE_PALETTE_NOTE_MAX_CHARS,Hf as SUBSITE_RESERVED_MOUNT_SEGMENTS,R0 as SUPPORTED_SITE_LOCALES,ri as SandboxSessionIdSchema,qT as SandboxSessionSchema,md as SandboxSessionStatusSchema,IF as SaveBriefDraftRequestSchema,UF as SaveBriefDraftResponseSchema,ZE as SaveGa4BindingDataSchema,lU as SaveGa4BindingRequestSchema,pU as SaveGa4BindingResponseSchema,FN as SaveSiteExtraRequirementRequestSchema,qG as SaveSiteSitemapDraftRequestSchema,WG as SaveSiteSitemapDraftResponseSchema,ER as SearchUnsplashMediaQuerySchema,RR as SearchUnsplashMediaResponseSchema,Mp as SiteBreadcrumbPlacementSchema,bb as SiteBuildContextFileSchema,fb as SiteBuildContextPayloadSchema,Sb as SiteBuildContextProvenanceSchema,hb as SiteBuildContextProvenanceSourceSchema,ia as SiteBuildStatusSchema,JC as SiteDeletionBlockedDetailsSchema,sa as SiteDeploymentStatusSchema,gs as SiteDesignContextSchema,$R as SiteDesignDensitySchema,VR as SiteDesignMotionLevelSchema,In as SiteEditAdvisorySchema,Wi as SiteEditBoundaryKindSchema,NS as SiteEditCapabilityConstraintSchema,DS as SiteEditCapabilityModeSchema,qi as SiteEditCapabilityModeViewSchema,iv as SiteEditCapabilityReadRequestSchema,fg as SiteEditClassNameSourceDiagnosticSchema,dt as SiteEditClassNameSourceRangeSchema,ec as SiteEditClassNameSourceSchema,BA as SiteEditClassNameSourceStyleContextSchema,Jr as SiteEditClassNameSourceStylesheetSchema,Xs as SiteEditClassNameSourceWriteIntentSchema,UA as SiteEditCommandDiagnosticSchema,hg as SiteEditCommandErrorSchema,B as SiteEditCompositionContextSchema,_e as SiteEditCompositionSelectorSchema,OS as SiteEditConstraintKindSchema,c_ as SiteEditDeletePageSourceOutputSchema,of as SiteEditDynamicConfidenceSchema,cf as SiteEditDynamicDataBindingSchema,um as SiteEditDynamicDataDetailSchema,gm as SiteEditDynamicDataSummarySchema,rf as SiteEditDynamicEvidenceSchema,dm as SiteEditDynamicSourceKindSchema,sf as SiteEditDynamicSourceTypeSchema,af as SiteEditDynamicTargetKindSchema,Aa as SiteEditEffectiveWriteTargetSchema,lv as SiteEditEventSchema,Es as SiteEditExecutionSceneSchema,zi as SiteEditExternalSourceKindSchema,$A as SiteEditGetClassNameSourceCommandResultSchema,zA as SiteEditGetClassNameSourceInputSchema,HA as SiteEditGetClassNameSourceResultSchema,Hv as SiteEditGetDocumentInputSchema,$v as SiteEditGetObjectEditContextInputSchema,g0 as SiteEditGetSourceFileInputSchema,u0 as SiteEditGetSourceTreeInputSchema,KA as SiteEditGetStyleContextInputSchema,Ki as SiteEditHistoryProvenanceSchema,FS as SiteEditHistoryReadOnlyRecoveryStatusSchema,jS as SiteEditHistoryRecoveryCodeSchema,LS as SiteEditHistoryRecoveryDiagnosticSchema,hv as SiteEditHistoryResultSchema,_v as SiteEditHistoryStatusModeSchema,qS as SiteEditHistoryStatusSchema,MS as SiteEditHistoryUnavailableReasonSchema,GS as SiteEditHistoryUnavailableStatusSchema,US as SiteEditHistoryWritableStatusSchema,cD as SiteEditInitializeSessionInputSchema,a_ as SiteEditInsertNodeSpecSchema,r_ as SiteEditInsertPageResourceOutputSchema,Mu as SiteEditMaterializationDataRequirementsSchema,Lu as SiteEditMaterializationEntrySchema,ju as SiteEditMaterializationExportSchema,Nu as SiteEditMaterializationFileSchema,Er as SiteEditMaterializationPathTemplateSchema,Ft as SiteEditMaterializationSchema,hc as SiteEditMaterializedComponentNodeSpecSchema,s_ as SiteEditMoveNodeTargetSchema,_c as SiteEditMoveTargetSchema,jn as SiteEditMutationContextSchema,Bi as SiteEditNodeCapabilitySnapshotSchema,Yv as SiteEditObjectCapabilitiesSchema,Qv as SiteEditObjectDetailSchema,Jv as SiteEditObjectEditContextSchema,eD as SiteEditObjectStyleDetailSchema,Zv as SiteEditObjectSummarySchema,C1 as SiteEditOperationCommandResultSchema,Sc as SiteEditOperationErrorCodeSchema,fc as SiteEditOperationErrorSchema,m_ as SiteEditOperationOutputSchema,o_ as SiteEditOperationParamsSchema,ea as SiteEditOperationPayloadSchema,Js as SiteEditOperationRequestSchema,n_ as SiteEditOperationResultTargetSchema,tn as SiteEditOperationSelectionRefSchema,nf as SiteEditOperationSummarySchema,t_ as SiteEditOperationTargetSchema,Un as SiteEditOperationTypeSchema,Bt as SiteEditOperationValueSchema,mf as SiteEditPageCompositionActionScopeSchema,_1 as SiteEditPageCompositionAnyVersionSchema,Fg as SiteEditPageCompositionAtomicKindSchema,Bg as SiteEditPageCompositionBoundaryModeSchema,vg as SiteEditPageCompositionBusinessMemberSchema,Pg as SiteEditPageCompositionContainerSchema,Mn as SiteEditPageCompositionDiagnosticSchema,Ci as SiteEditPageCompositionErrorCodeSchema,oc as SiteEditPageCompositionPlacementTargetSchema,Dg as SiteEditPageCompositionPlacementUnitSchema,Mg as SiteEditPageCompositionRuntimeRefSchema,Lg as SiteEditPageCompositionSchema,Ug as SiteEditPageCompositionSourceMemberKindSchema,Cg as SiteEditPageCompositionSourceMemberSchema,lc as SiteEditPageCompositionSourceRangeSchema,Ng as SiteEditPageCompositionSupportedSchema,jg as SiteEditPageCompositionUnsupportedSchema,Wg as SiteEditPageCompositionV2BusinessMemberSchema,Gg as SiteEditPageCompositionV2ContainerSchema,zg as SiteEditPageCompositionV2PlacementRelationSchema,$g as SiteEditPageCompositionV2PlacementSchema,Kg as SiteEditPageCompositionV2PlacementUnitSchema,Qg as SiteEditPageCompositionV2Schema,qg as SiteEditPageCompositionV2SourceMemberSchema,Yg as SiteEditPageCompositionV2SupportedSchema,Xg as SiteEditPageCompositionV2UnsupportedSchema,Hg as SiteEditPageCompositionV2WriteModeSchema,Vg as SiteEditPageCompositionVisualAnchorSchema,Og as SiteEditPagePlacementOptionSchema,ac as SiteEditPagePlacementSchema,cc as SiteEditPageUnitResultTargetSchema,rc as SiteEditPageUnitTargetSchema,YS as SiteEditPatchPlanPatchSchema,kv as SiteEditPatchPlanSchema,wa as SiteEditPropertiesSchema,Tg as SiteEditPropertyChangeSchema,HS as SiteEditPropertyCreationSchema,KS as SiteEditPropertyItemSchema,WS as SiteEditPropertyResolutionSchema,BS as SiteEditPropertySourceSchema,zS as SiteEditPropertySpreadSchema,Hn as SiteEditProvenanceChainSchema,df as SiteEditProvenanceHopSchema,Vv as SiteEditRenderDocumentSchema,zn as SiteEditRenderEntryRefSchema,lf as SiteEditRenderEntrySchema,pm as SiteEditRenderPageCompositionSchema,ef as SiteEditRenderPageCompositionSupportedSchema,tf as SiteEditRenderPageCompositionUnsupportedSchema,JS as SiteEditRenderPagePlacementSchema,o1 as SiteEditRequiredMutationContextEnvelopeSchema,h0 as SiteEditResolveSourceLocationInputSchema,hm as SiteEditSemanticSourceSchema,nc as SiteEditSetPropsParamsSchema,P1 as SiteEditSignedOperationRequestSchema,rr as SiteEditSourceDeleteCapabilitySchema,Bd as SiteEditSourceDirectoryPathSchema,Vd as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,Yd as SiteEditSourceFileBinaryResponseSchema,p0 as SiteEditSourceFileKindSchema,Kd as SiteEditSourceFileListItemSchema,_0 as SiteEditSourceFileResponseSchema,$d as SiteEditSourceFileTextResponseSchema,Zs as SiteEditSourceIdentitySchema,Xd as SiteEditSourceLocationRangeSchema,S0 as SiteEditSourceLocationSchema,gf as SiteEditSourceLocatorRangeSchema,va as SiteEditSourceLocatorSchema,Ee as SiteEditSourcePathSchema,i_ as SiteEditSourceSiblingMoveTargetSchema,cr as SiteEditSourceTreeNodeSchema,d0 as SiteEditSourceTreeResponseSchema,zd as SiteEditSourceTreeTruncationReasonSchema,Hd as SiteEditSourceTreeTruncationSchema,gc as SiteEditStyleBreakpointSchema,ic as SiteEditStyleDraftPropertySchema,Xv as SiteEditStyleModelSchema,dc as SiteEditStylePropertySchema,Sm as SiteEditStyleSourceSchema,uc as SiteEditStyleStateModeSchema,Ca as SiteEditTextSegmentSchema,_m as SiteEditTextSourceSchema,pf as SiteEditWriteTargetSchema,GN as SiteExtraRequirementResponseSchema,Fb as SiteExtraRequirementSchema,PC as SiteGenerationLedgerResponseSchema,k as SiteIdSchema,gb as SiteLauncherPermissionSchema,Re as SiteLocaleSchema,kG as SiteMediaIntentSchema,QT as SiteOperationLockIdSchema,sb as SitePreviewActivateErrorCodeSchema,ob as SitePreviewActivateFailedSchema,ab as SitePreviewActivateReadySchema,uO as SitePreviewActivateResponseSchema,PM as SitePublishDomainCheckDataSchema,wM as SitePublishDomainCheckRequestSchema,CM as SitePublishDomainCheckResponseSchema,vM as SitePublishDomainOperationDataSchema,DM as SitePublishDomainOperationResponseSchema,OM as SitePublishDomainReconcileOperationResponseSchema,NM as SitePublishDomainRemediationConfirmRequestSchema,jM as SitePublishDomainRemediationConfirmResponseSchema,ps as SitePublishQualityTaskStatusSchema,mM as SitePublishRepairInputItemSchema,rE as SitePublishRepairResultItemSchema,Ul as SitePublishRepairResultSchema,lM as SitePublishRepairTaskSnapshotSchema,Ll as SitePublishRepairTaskStatusSchema,gM as SitePublishWorkflowActiveResponseSchema,ci as SitePublishWorkflowIdSchema,mE as SitePublishWorkflowMutationDataSchema,_M as SitePublishWorkflowMutationResponseSchema,lE as SitePublishWorkflowPublishDataSchema,hM as SitePublishWorkflowPublishResponseSchema,pE as SitePublishWorkflowQualityDataSchema,SM as SitePublishWorkflowQualityResponseSchema,Dt as SitePublishWorkflowRecordSchema,uM as SitePublishWorkflowRevisionRequestSchema,eE as SitePublishWorkflowStatusSchema,tE as SitePublishWorkflowStepSchema,jt as SiteRecordSchema,JT as SiteTemplateUpgradeStateIdSchema,Sq as SiteThreadListQuerySchema,fq as SiteThreadListResponseSchema,xq as SiteThreadResponseSchema,Go as SiteVersionIdSchema,tI as SiteVersionListItemSchema,bs as SiteVersionRecordSchema,st as SiteWorkflowIdSchema,db as SiteWorkflowProgressDataSchema,bO as SiteWorkflowProgressResponseSchema,cb as SiteWorkflowProgressStatusSchema,pb as SiteWorkflowProgressStepSchema,lb as SiteWorkflowProgressStepStatusSchema,v_ as SiteWorkflowRecordSchema,Z1 as SiteWorkflowSnapshotResponseSchema,oa as SiteWorkflowSnapshotSchema,R_ as SiteWorkflowStatusSchema,Wo as SiteWorkflowTaskRefIdSchema,J1 as SiteWorkflowTaskRefResponseSchema,Pc as SiteWorkflowTaskRefSchema,jG as SitemapAddBlockInputSchema,Do as SitemapAnswerSchema,OG as SitemapChangeBlockVariantInputSchema,FI as SitemapDeleteBlockInputSchema,kI as SitemapDraftBlockSchema,AI as SitemapDraftPageSchema,Vp as SitemapDraftRecordSchema,gn as SitemapDraftSchema,UI as SitemapEditActorSchema,WI as SitemapEditErrorCodeSchema,KI as SitemapEditFailureSchema,qI as SitemapEditOperationSchema,MG as SitemapEditResultSchema,BI as SitemapEditSuccessSchema,FG as SitemapGenerationInputSchema,YI as SitemapGenerationOutcomeSchema,XI as SitemapGenerationReasonSchema,Wp as SitemapGenerationStageSchema,ke as SitemapIdSchema,zI as SitemapIntentPageSchema,vG as SitemapModelOutputSchema,PI as SitemapModelPageSchema,DG as SitemapMoveBlockInputSchema,II as SitemapNavigationHrefSchema,Ge as SitemapNodeIdSchema,$p as SitemapRecordSchema,PG as SitemapResolverRequestSchema,CG as SitemapResolverResponseSchema,MI as SitemapResolverTargetsSchema,qp as SitemapRunInputSchema,bn as SitemapSchema,vI as SitemapSourceProvenanceSchema,GG as SitemapStreamEventSchema,hL as SitemapTaskCreateRequestSchema,xL as SitemapTaskCreateResponseSchema,hx as SitemapTaskFailureErrorCodeSchema,EL as SitemapTaskResponseSchema,GI as SitemapUpdateBlockInstructionInputSchema,NG as SitemapUpdateBlockPropsInputSchema,mI as SitemapUserChoiceSchema,fn as SkillSelectionSchema,pI as SkillSelectionSourceSchema,td as SnapshotContentHashSchema,xd as SnapshotEditChangesSchema,yd as SnapshotEditPageChangeSchema,bd as SnapshotEditSectionChangeSchema,ve as SnapshotFilePathSchema,I as SnapshotIdSchema,xt as SnapshotRecordSchema,Cp as SnapshotStatusSchema,CC as StartFillInRequestSchema,FF as StartFillInResponseSchema,FE as StartGa4AuthDataSchema,nU as StartGa4AuthRequestSchema,iU as StartGa4AuthResponseSchema,_o as StartGscAuthDataSchema,Gl as StartGscAuthRequestSchema,ql as StartGscAuthResponseSchema,mw as StartSiteBuildRequestSchema,jO as StartSiteBuildResponseSchema,yb as StartSiteBuildResultSchema,pM as StartSitePublishWorkflowRequestSchema,dq as StartWorkspaceRunRequestSchema,uq as StartWorkspaceRunResponseSchema,Mc as Step2AiCrawlabilityAssessmentSchema,ch as Step2FinalResultDataSourceSchema,Ni as Step2FinalResultRequestSchema,Qw as Step2FinalResultResponseSchema,Xw as Step2FinalResultSaveResponseSchema,rh as Step2FinalResultSaveResultSchema,da as Step2FinalResultTypeSchema,lh as Step2FinalResultViewSchema,Lc as Step2FinalScanCardKeySchema,ua as Step2FinalScanCardSchema,oh as Step2FinalScanResultSchema,$n as Step2KnowledgeOpaqueIdSchema,WO as Step2KnowledgeScopeSchema,Tt as Step2PageRoleSchema,eP as Step2PageSelectionRequestSchema,tP as Step2PageSelectionResponseSchema,ih as Step2SiteInitializationCrawlerErrorCodeSchema,nh as Step2SiteInitializationStatusSchema,Yw as Step2SiteInitializationTaskResponseSchema,sh as Step2SiteInitializationTaskSchema,ga as Step3AgentAnalysisSchema,Sh as Step3AnalysisFindingSchema,cP as Step3AnalysisJobResponseSchema,qc as Step3AnalysisJobSchema,Fc as Step3AnalysisJobStatusSchema,mP as Step3AnalysisLatestResponseSchema,Uc as Step3AnalysisProgressSchema,yh as Step3AnalysisResultSchema,rP as Step3AnalysisScheduleResponseSchema,hh as Step3AnalysisScheduleSchema,lP as Step3AnalysisSseFrameSchema,aP as Step3AnalysisStartRequestSchema,Gc as Step3AnalysisSummarySchema,_h as Step3AnalystSchema,oP as Step3AnalystsResponseSchema,gP as Step4DiagnosisResponseSchema,Ri as Step5ActiveStrategyKeySchema,W0 as Step5CommitStrategyRequestSchema,B0 as Step5CommitStrategyResponseSchema,ku as Step5CommittedVersionSchema,vn as Step5DecisionSelectionIdSchema,xu as Step5EvidenceReferenceSchema,Eu as Step5GenerationStatusSchema,Iu as Step5JobStatusSchema,hu as Step5KeywordCategorySchema,Pn as Step5KeywordEntrySchema,Ds as Step5KeywordLibrarySchema,v0 as Step5KeywordSearchBodySchema,yi as Step5KeywordSelectionSchema,ki as Step5MarketCountrySchema,Ti as Step5MarketTypeSchema,hr as Step5OptionPresentationSchema,Ns as Step5OutputLocaleSchema,F0 as Step5RegenerateItemRequestSchema,G0 as Step5SaveDecisionRequestSchema,q0 as Step5SaveDecisionResponseSchema,HI as Step5SitemapDecisionSchema,VI as Step5SitemapRunInputSchema,$I as Step5SitemapSourceSchema,UG as Step5SitemapStartRequestSchema,M0 as Step5StartStrategyRequestSchema,U0 as Step5StartStrategyResponseSchema,Ru as Step5StrategyDecisionInputSchema,Ls as Step5StrategyDecisionSchema,js as Step5StrategyItemSchema,br as Step5StrategyJobSchema,Ii as Step5StrategyKeySchema,fr as Step5StrategyOptionIdSchema,fu as Step5StrategyOptionSchema,bu as Step5StrategyPlanSchema,Au as Step5StrategySnapshotDataSchema,z0 as Step5StrategySseFrameSchema,Tu as Step5StrategyVersionSnapshotSchema,yu as Step5StructureDetailSchema,vb as Step6AiThemeCandidateSchema,Xi as Step6ColorSeedsSchema,CN as Step6DesignAgentRecommendationsResponseSchema,RN as Step6DesignRecommendationGenerationInputSchema,Wa as Step6DesignRecommendationModelOutputSchema,Db as Step6DesignRecommendationSchema,bN as Step6DesignRecommendationsRequestSchema,yN as Step6DesignRecommendationsResponseSchema,Mm as Step6DesignSelectionSchema,Lm as Step6GeneratedThemeCardSchema,Mb as Step6GptDesignRecommendationModelOutputSchema,AC as StopWorkspaceGenerationRequestSchema,wC as StopWorkspaceGenerationResponseSchema,CD as SubsiteCopyEstimateRequestSchema,vD as SubsiteCopyEstimateResponseSchema,qf as SubsiteDiffEstimateShape,ED as SubsiteGlossariesSchema,Of as SubsiteGlossaryEntrySchema,Hi as SubsiteHexColorSchema,KD as SubsiteMountPathSchema,Gf as SubsitePageEstimateSchema,ID as SubsitePaletteLocalizationSchema,Nf as SubsitePaletteModeSchema,jf as SubsitePaletteSeedsSchema,RD as SubsiteSiteInfoSchema,ND as SubsiteSyncDiffComputeRequestSchema,jD as SubsiteSyncDiffComputeResponseSchema,Bf as SubsiteSyncDiffErrorCodeSchema,LD as SubsiteSyncDiffErrorResponseSchema,GD as SubsiteVisibleTextExportRequestSchema,qD as SubsiteVisibleTextExportResponseSchema,b_ as TASK_EXECUTION_STATUSES,Ac as TASK_EXECUTION_STATUS_CODES,nG as TEMPLATE_UPGRADE_LOCK_LOST_ERROR_CODE,Ga as THEME_PRESETS,Cm as THEME_PRESET_IDS,Rc as TaskExecutionStatusSchema,tb as TemplateUpgradeCasOutcomeSchema,ym as TemplateUpgradeErrorCodeSchema,nb as TemplateUpgradeOutcomeCountsSchema,Jf as TemplateUpgradeOutcomeSchema,ib as TemplateUpgradeSnapshotDeletionCandidateSchema,ln as TemplateUpgradeStateSchema,Yf as TemplateUpgradeStatusSchema,eb as TemplateUpgradeValidationStageSchema,Ze as TemplateVersionSchema,ZF as TryAcquireTemplateUpgradeLockRequestSchema,JF as TryAcquireTemplateUpgradeLockResponseSchema,aS as TypeInputsSchema,Tf as USER_STOPPED_RUN_ERROR_CODES,pp as UnsplashDownloadLocationSchema,lp as UnsplashMediaAssetSchema,RF as UpdateBriefRequestSchema,MF as UpdateBriefResponseSchema,ZG as UpdateClarifyArchetypeRequestSchema,EA as UpdateCmsSeoSyncStateRequestSchema,zF as UpdateCurrentSnapshotManifestRequestSchema,yA as UpdatePageDirectoryReconcileStateRequestSchema,dM as UpdateSitePublishWorkflowStepRequestSchema,EF as UpdateSiteRequestSchema,yq as UpdateSiteThreadRequestSchema,tw as UpdateSiteWorkflowWebsiteRequestSchema,xN as UpdateStep6DesignSelectionRequestSchema,EN as UpdateStep6DesignSelectionResponseSchema,ow as UpdateWorkflowTaskStatusRequestSchema,bR as UploadMediaLibraryAssetResponseSchema,JL as UpstreamPromptTemplateCatalogDataSchema,ZL as UpstreamPromptTemplateConsumeDataSchema,ax as UrlListCrawlerTaskCreateRequestSchema,ek as UsageRecordIdSchema,IR as UseUnsplashMediaRequestSchema,TR as UseUnsplashMediaResponseSchema,BT as UserIdSchema,IE as VCP_GSC_STATES,go as VcpGscStateSchema,iE as VcpQualityRemediationItemSchema,jl as VcpQualityResultSchema,Eo as VisualHintsSchema,cI as VisualThemeSchema,Qh as WEIGHT_STYLE_IDS,Yc as WEIGHT_STYLE_PRESETS,Q1 as WORKFLOW_DEFINITIONS_V1,aa as WORKFLOW_DEFINITION_REGISTRY,h_ as WORKFLOW_FLOW_TYPES,I_ as WORKFLOW_MENU_STATES,S_ as WORKFLOW_NODE_CODES,f_ as WORKFLOW_TASK_TYPES,ww as WORKSPACE_ATTACHMENT_BOUND_ERROR_CODE,jw as WORKSPACE_ATTACHMENT_CAPTURE_BUDGET_ERROR_CODE,Ow as WORKSPACE_ATTACHMENT_CAPTURE_BUSY_ERROR_CODE,Dw as WORKSPACE_ATTACHMENT_CAPTURE_FAILED_ERROR_CODE,Nw as WORKSPACE_ATTACHMENT_CAPTURE_TIMEOUT_ERROR_CODE,Lw as WORKSPACE_ATTACHMENT_CAPTURE_UNAVAILABLE_ERROR_CODE,Aw as WORKSPACE_ATTACHMENT_LIMIT_ERROR_CODE,Y_ as WORKSPACE_ATTACHMENT_MEDIA_TYPES,Iw as WORKSPACE_ATTACHMENT_TARGET_BASE64_BYTES,kw as WORKSPACE_ATTACHMENT_TOO_LARGE_ERROR_CODE,Rw as WORKSPACE_ATTACHMENT_UNBOUND_TTL_MS,Tw as WORKSPACE_ATTACHMENT_UNSUPPORTED_FORMAT_ERROR_CODE,vw as WORKSPACE_ATTACHMENT_URL_REJECTED_ERROR_CODE,uC as WORKSPACE_CHECK_INCOMPLETE_ERROR_CODE,wx as WORKSPACE_FILE_MUTATION_TOOL_NAMES,_C as WORKSPACE_FILL_IN_INTERRUPTED_ERROR_CODE,gC as WORKSPACE_GENERATION_STOPPED_ERROR_CODE,pC as WORKSPACE_MAX_PAGE_ATTEMPTS,lC as WORKSPACE_MAX_RESUME_COUNT,mC as WORKSPACE_RUN_HEARTBEAT_INTERVAL_MS,cC as WORKSPACE_RUN_LEASE_MS,hC as WORKSPACE_RUN_LEASE_SUPERSEDED_ERROR_CODE,SC as WORKSPACE_RUN_NOT_ACTIVE_ERROR_CODE,dC as WORKSPACE_RUN_RESUME_EXHAUSTED_ERROR_CODE,Cw as WORKSPACE_URL_CAPTURE_WINDOW_MS,kq as WORKSPACE_WEBSOCKET_CONTRACT,We as WeightStyleIdSchema,xc as WorkflowClientCapabilitiesSchema,wc as WorkflowDefinitionVersionSchema,nn as WorkflowFlowTypeSchema,C_ as WorkflowMenuItemSchema,T_ as WorkflowMenuStateSchema,It as WorkflowNodeCodeSchema,Ec as WorkflowTaskTypeSchema,Uw as WorkspaceAttachmentFromUrlRequestSchema,la as WorkspaceAttachmentMediaTypeSchema,Mw as WorkspaceAttachmentSchema,RT as WorkspaceClientMessageSchema,PR as WorkspaceDesignApplyRequestSchema,CR as WorkspaceDesignApplyResponseSchema,vR as WorkspaceDesignCurrentResponseSchema,No as WorkspaceDiagnosticSchema,DT as WorkspaceDirectEditFileSchema,vT as WorkspaceDirectEditPathSchema,ad as WorkspaceDirectEditPostActionSchema,Pq as WorkspaceDirectEditRequestSchema,vq as WorkspaceDirectEditResponseSchema,jo as WorkspaceExecutionDiagnosticsSchema,tq as WorkspaceExecutionPlanSchema,ar as WorkspaceGenerationLedgerEventSchema,An as WorkspaceGenerationLedgerSchema,CT as WorkspaceMediaRequestSchema,Ad as WorkspaceOmissionKindSchema,wd as WorkspaceOmissionReasonSchema,sr as WorkspaceOmissionSchema,am as WorkspacePageCheckpointSchema,Cd as WorkspacePageOutcomeSchema,Pd as WorkspacePageResultSchema,Uo as WorkspacePlanDependencySchema,Qp as WorkspacePlanSummarySchema,oT as WorkspacePlanTaskKindSchema,Mo as WorkspacePlanTaskSchema,p_ as WorkspaceResourceKindSchema,u_ as WorkspaceResourceNavigationSelectionSchema,yc as WorkspaceResourceOperationClientMessageSchema,d_ as WorkspaceResourceOperationSummarySchema,g_ as WorkspaceResourceOperationTransientInputSchema,TC as WorkspaceRunControlInputResponseSchema,xC as WorkspaceRunHeartbeatRequestSchema,EC as WorkspaceRunHeartbeatResponseSchema,ys as WorkspaceRunKindSchema,xS as WorkspaceRunResumePrincipalSchema,ET as WorkspaceSelectedComponentSchema,TT as WorkspaceServerMessageSchema,LG as WorkspaceSitemapEditRequestSchema,xT as WorkspaceSocketDescriptorSchema,UT as WorkspaceSourceFileBinaryResponseSchema,LT as WorkspaceSourceFileKindSchema,rd as WorkspaceSourceFileListItemSchema,Dq as WorkspaceSourceFilePathQuerySchema,Oq as WorkspaceSourceFileResponseSchema,MT as WorkspaceSourceFileTextResponseSchema,od as WorkspaceSourcePathSchema,eT as WorkspaceSuggestionSchema,Yp as WorkspaceSuggestionsSchema,tT as WorkspaceSuggestionsSourceSchema,Zp as WorkspaceTaskCountsSchema,Tq as WorkspaceWebSocketMessageSchema,Iq as WorkspaceWebSocketMessageTypeSchema,Lo as WorkspaceWorkerGroupSchema,Oo as WorkspaceWorkerPhaseSchema,nq as WorkspaceWorkerResultSchema,Vt as WorkspaceWorkerStatusSchema,tj as applicationTemplateCatalogDataSchema,ej as applicationTemplateConsumeDataSchema,JN as applicationTemplateV1Schema,EP as assertDeploymentTransition,_U as assertFillInTargetsOmitted,gw as assertSiteBuildStatusTransition,uw as assertTaskExecutionStatusTransition,Ea as availableFontWeights,CS as breadcrumbClassName,lL as buildCmsIdentityHeaders,uU as buildE2bBrowserPreviewUrl,yM as buildFinalSitePublishQualityResult,IN as buildStep6FallbackThemeCards,IO as canEnterLauncher,TO as canPublishSite,oo as canonicalizeFormDesignJson,eM as canonicalizeLauncherPromptTemplateOperation,Qr as canonicalizePageSlug,eC as checkGlobalsCssEdit,Qs as classifySiteEditPropertyName,mA as cmsPagePreviewUrlPath,V0 as compareTemplateVersions,wv as composeSiteEditRepeatInstanceKey,Bj as computeFormDesignOperationFingerprint,ks as computeSiteEditCompositionKey,wg as computeSiteEditSourceIdentityKey,oi as containsSensitiveData,Uk as countLedgerAccessiblePages,Fk as countLedgerProcessedPages,cR as countSitemapStructure,Sg as createSiteEditCommandFailureSchema,Zr as createSiteEditCommandResultSchema,Ys as createSiteEditCommandSuccessSchema,BG as createSiteSitemapDraftCreationKey,zw as createSitemapResolverAnswerSheetSchema,kN as defaultStep6Selection,AE as deriveVcpGscState,wE as doesGscPropertyMatchDomain,dR as estimateNavLabelWidth,L_ as findWorkflowDefinition,j_ as findWorkflowDefinitionInRegistry,ba as fontStack,By as formDesignOperationFingerprintInput,rS as formatSiteDesignNotes,$C as generateDetailBreadcrumb,RP as getDeploymentHappyPathTransitions,yP as getDeploymentTransitionPredecessors,bP as getDeploymentTransitionTargets,Vc as getFontPairing,Pm as getMotionPreset,Om as getSiteDesignThemeRadius,Ps as getSiteEditSourceDeleteProtectionReason,fM as getSitePublishRepairItems,cN as getThemePreset,M_ as getWorkflowDefinition,pw as getWorkflowNodeIndex,Pk as hasAnyBusinessFact,Kn as hasDesignTokenBlock,kD as hasLockedSeeds,Wj as hashAffectedFormDesignFiles,qj as hashCmsFormSchemaProjection,ss as hashFormDesignJson,Gj as hashFormSpec,iR as homeLabelForLocale,BL as isCanonicalFileMutationToolName,Yr as isCanonicalPageSlug,_b as isCmsMainProductsWithinLimit,DR as isCmsNavigationHref,cA as isCmsPageSelectable,wr as isCmsTemplateUrlPath,Yk as isConsentGranted,Lh as isDeploymentActiveStatus,xP as isDeploymentTerminalStatus,wf as isExactEditEngineVersion,rk as isExternalSiteEditInfrastructureReason,Tj as isFormSpecLocalizableFieldPath,K0 as isKnownStep5SseEventName,zC as isMigrationProductsPresetBlockLabel,KC as isMigrationProductsPresetPageTitle,Px as isModelFileMutationToolName,iu as isNextPageCodeErrorCode,k0 as isNonLatinSiteLocale,li as isPageTemplateCandidateEntryPath,nL as isPlatformMaterializedFile,Vf as isReservedSubsiteMountSegment,Zd as isSiteEditDesignDocumentPath,Ou as isSiteEditMaterializationPathTemplate,Ef as isSiteEditRuntimeContainerTag,Rf as isSiteEditRuntimeTextTag,nD as isSiteEditRuntimeVoidElementTag,f0 as isSiteEditSourceDeleteProtectedPath,Qd as isSiteEditSourceDirectoryPath,mr as isSiteEditSourcePath,ws as isSiteEditTextSourcePath,bM as isSitePublishRepairResultSuccessful,Qj as isSiteStructureKnownFieldPath,Xj as isSiteStructureLocalizableFieldPath,L0 as isStep5RequiredStrategyKey,us as isTopLevelPage,pD as isUserStoppedRunErrorCode,dw as isWorkflowTaskTypeForNode,WL as isWorkspaceFileMutationToolName,Xl as listChildPages,QS as makeSiteEditRepeatInstanceKey,aR as markAllPagesInHeader,WC as migrationProductsCopyForLocale,BC as migrationProductsKnownCopies,sR as moreLabelForLocale,uR as navLabelCollisionKey,mj as normalizeCmsApplicationSlug,ix as normalizeCmsPublicApiBase,tl as normalizeFormOptionLabelIdentity,si as normalizeGscDomain,Zo as normalizePageTemplatePagePath,ds as normalizeStructureTitle,rR as orderNavigationLinksByStructure,Ql as orderSitemapPagesForDisplay,_g as pageSlugToRouteFilePath,lA as parseCmsPageDirectory,NC as parseComponentI18nResourcesJson,JE as parseE2bPreviewProxyDomain,Pf as parseExactEditEngineVersion,o0 as parseSiteEditCompositionKey,ZS as parseSiteEditRepeatInstanceKey,m1 as parseSiteEditSourceIdentityKey,pa as parseWorkspaceAttachmentImagePath,vj as projectFormSpecToCmsSchema,fS as readColorScheme,Mi as readDesignTokens,XP as readGlobalsDesignValues,Zc as readSiteDesignNotes,Gw as readWorkspaceAttachmentReferences,eR as reconcileSitemapNavigation,cL as resolveCmsPublicRuntimeBinding,Wh as resolveFont,sn as resolveFontDisplayName,Cj as resolveFormTemplateText,lw as resolvePublishedWorkflowDefinition,jk as resolveRedisConnectionConfig,fD as resolveRequestedEditEngineVersion,_r as resolveSelectableSiteLocale,iD as resolveSiteEditRuntimeOperationSummary,T0 as resolveSiteLocaleFromIso6393,I0 as resolveSiteTextDirection,Nb as resolveStep6RadiusId,jb as resolveStep6WeightStyle,bD as resolveSystemCurrentEditEngineVersion,dj as resolveTemplateFormScene,UP as resolveTryOnFontWeights,U_ as selectPublishedWorkflowDefinition,n0 as selectReferenceVisualImage,B1 as siteBuildStatusFromCode,$1 as siteBuildStatusToCode,K1 as siteDeploymentStatusFromCode,V1 as siteDeploymentStatusToCode,Yh as siteFontVariables,iS as siteLeadingBody,MP as siteLeadingHeadingVariables,LP as siteWeightVariables,z1 as siteWorkflowStatusFromCode,Y1 as siteWorkflowStatusToCode,Df as splitSubsiteGlossaryEntry,Lb as step6GptVisualIdentity,WP as stripSiteDesignNotes,Pv as stripSiteEditRepeatInstanceKeys,H1 as taskExecutionStatusFromCode,X1 as taskExecutionStatusToCode,TN as toStep6GenerationVisualHints,Xr as tryCanonicalizeAsciiPageSlug,BP as upsertSiteDesignNotes,mm as validateComponentI18nResources,kj as validateFormSpecIdentityTransition,mR as validateSitemapStructure,Wf as validateSubsiteDiffEstimates,Fw as workspaceAttachmentImagePath,YP as writeColorScheme,VP as writeDesignTokens};