@vcp-dev/contracts 0.8.2 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{z as e}from"zod";import{z as ym}from"zod";var G=ym.uuidv7(),ss=G,Hb=G,$b=G,Yb=G,Xb=G,Zb=G,Qb=G,I=G,ut=G,Yi=G,ke=G,is=G,x=G,Xi=G,V=G,Zi=G,pn=G,Fe=G,Jb=G,ey=G,Qi=G,Oe=G,Ji=G,ty=G,ny=G,sy=G,nt=G,iy=G,ay=G,oy=G;import{z as dn}from"zod";var ea=dn.object({primary_products:dn.string().trim().min(1).max(1e3).optional(),current_markets:dn.string().trim().min(1).max(1e3).optional(),qualifications:dn.string().trim().min(1).max(1e3).optional()}).strict();function my(t){return Object.values(t).some(n=>typeof n=="string"&&n.trim().length>0)}import{z as vt}from"zod";import{z as as}from"zod";var M=t=>as.object({code:as.number().int(),data:t,message:as.string()});var gt=2e3,xm=vt.object({note:vt.string().trim().max(gt),updated_at:vt.string().min(1)}).strict(),_y=vt.object({note:vt.string().trim().max(gt)}).strict(),hy=M(xm.nullable());import{z as Ct}from"zod";var Em=40,st=Ct.object({protocol:Ct.enum(["phone","form","download","route","external"]),ctaLabel:Ct.string().min(1).max(Em),ctaTarget:Ct.string().min(1).max(200).optional(),requiresOwnerDetail:Ct.boolean().optional()});var _t=["queued","preparing_source","building","artifact_ready","deploying","released","lock_failed","source_prepare_failed","build_failed","artifact_fetch_failed","artifact_validation_failed","deploy_failed","cleanup_failed"];function yy(t){let n=t.VCP_REDIS_URL??t.REDIS_URL;if(n){let s=new URL(n);return{url:n,host:s.hostname,port:s.port?Number(s.port):6379,password:s.password?decodeURIComponent(s.password):void 0}}return{host:t.VCP_REDIS_HOST??"127.0.0.1",port:Im(t.VCP_REDIS_PORT,56379)}}function Im(t,n){if(!t)return n;let s=Number(t);return Number.isInteger(s)&&s>0?s:n}import{z as Y}from"zod";var na=G,ta=200,Rm=4e3,sa=Y.enum(["succeeded","degraded","no_changes","failed"]),Dt=Y.enum(["typecheck_unresolved","step_cap_reached","partial_apply_gave_up","patch_protected_dropped","preview_build_failed","preview_runtime_degraded","build_not_verified","external_blocked","cms_reconcile_failed","run_expired","sandbox_unavailable"]),Tm=["sandbox_unavailable"];function Ry(t){return t!=null&&Tm.includes(t)}var km=Y.enum(["pending","delivered","failed"]),Pm=Y.enum(["running","succeeded","degraded","no_changes","failed"]),Ty=Y.object({site_id:I,external_run_id:Y.string().min(1).max(ta),external_thread_id:Y.string().min(1).max(ta),prompt:Y.string().min(1).max(Rm)}).strict(),ia=Y.object({id:na,site_id:I,external_run_id:Y.string().min(1),external_thread_id:Y.string().min(1),status:Pm,outcome:sa.nullable(),degraded_reason:Dt.nullable(),vcp_run_id:V.nullable(),base_snapshot_id:x,snapshot_id:x.nullable(),preview_url:Y.string().url().nullable(),summary:Y.string().nullable(),error_code:Y.string().nullable(),build_verified:Y.boolean().nullable(),callback_status:km,created_at:Y.string().min(1),started_at:Y.string().min(1).nullable(),finished_at:Y.string().min(1).nullable()}).strict(),ky=Y.object({task:ia}).strict(),Py=Y.object({task:ia}).strict(),wy=Y.object({task_id:na,external_run_id:Y.string().min(1),external_thread_id:Y.string().min(1),site_id:I,vcp_run_id:V.nullable(),outcome:sa,degraded_reason:Dt.nullable(),snapshot_id:x.nullable(),preview_url:Y.string().url().nullable(),summary:Y.string().nullable(),error_code:Y.string().nullable(),build_verified:Y.boolean().nullable(),retryable:Y.boolean(),finished_at:Y.string().min(1)}).strict(),Ay=Y.object({received:Y.literal(!0)}).strict();import{z as D}from"zod";var os=D.enum(["text","url","document","image"]),rs=D.enum(["pending","ready","failed"]),wm=D.enum(["pending","ready","failed"]),Am=D.enum(["product","price","contact","copy","audience","other"]),un=D.object({fact:D.string().min(1).max(300),kind:Am,source_id:nt,quote:D.string().min(1).max(500),trust:D.enum(["verbatim","ocr"]).default("verbatim")}),vm=D.object({page_type:D.string().min(1).max(40),sections:D.array(D.string().min(1).max(40)).max(12)}),gn=D.object({source_id:nt,nav_structure:D.array(D.string().min(1).max(30)).max(12),page_patterns:D.array(vm).max(10),tone:D.array(D.string().min(1).max(20)).max(8),screenshot_ref:D.string().optional()}),Cm=D.object({source_id:nt,type:os,status:rs,title:D.string().max(120).optional(),original_ref:D.string().min(1),source_metadata:D.record(D.string(),D.unknown()),error_code:D.string().optional(),submitted:D.boolean().optional()}),_n=D.object({topic:D.string().min(1).max(80),variants:D.array(D.object({value:D.string().min(1).max(300),source_id:nt})).min(2)}),Dm=D.object({type:D.literal("text"),content:D.string().min(20).max(1e4),title:D.string().min(1).max(120).optional()}).strict(),jm=D.object({type:D.literal("url"),url:D.string().url().max(2048),rights_ack:D.boolean().optional(),title:D.string().min(1).max(120).optional()}).strict(),jy=D.discriminatedUnion("type",[Dm,jm]),Oy=[".docx",".html",".md",".txt"],Ny=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],Ly=10*1024*1024,My=2,Uy=D.object({consent_cross_border:D.union([D.literal(!0),D.literal("true")]),consent_text_version:D.string().min(1).max(120),title:D.string().min(1).max(120).optional()}).strict();function Fy(t){return t===!0||t==="true"}var qy=[".png",".jpg",".jpeg",".webp"],Gy=["image/png","image/jpeg","image/webp","application/octet-stream"],Ky=8*1024*1024,zy=10,Om=D.enum(["asset","reference"]),By=D.object({image_role:Om,title:D.string().min(1).max(120).optional()}).strict(),Wy=D.object({version:D.literal(1),site_id:I,tenant_id:D.string().min(1),user_prompt:D.string(),status:wm,sources:D.array(Cm).max(16),facts:D.array(un).max(120),reference:gn.optional(),conflicts:D.array(_n).max(20)}).superRefine((t,n)=>{let s=new Map(t.sources.map(a=>[a.source_id,a]));for(let[a,i]of t.facts.entries()){let r=s.get(i.source_id);(!r||r.type==="url")&&n.addIssue({code:"custom",path:["facts",a,"source_id"],message:"facts must reference a text/document/image source (never url)"})}if(t.reference){let a=s.get(t.reference.source_id),i=a?.type==="image"&&a.source_metadata.image_role==="reference";(!a||a.type!=="url"&&!i)&&n.addIssue({code:"custom",path:["reference","source_id"],message:"reference must point at a url source or reference image source"})}});function Vy(t){for(let n of t.sources)if(n.type==="image"&&n.status==="ready"&&n.source_metadata?.image_role==="reference")return{source_id:n.source_id};return t.reference?.screenshot_ref?{source_id:t.reference.source_id}:null}import{z as A}from"zod";import{z as Sn}from"zod";import{z as X}from"zod";var Ie=X.string().min(1),hn=X.string().min(1).refine(t=>t.startsWith("/")&&!t.includes("?")&&!t.includes("#"),{message:"page_path must start with / and must not contain ? or #"}),Nm=X.object({template_id:Ie,safe_name:X.string().min(1),entry_file:X.string().min(1),kind:X.enum(["default","additional"])}).strict(),Xy=X.object({schema_version:X.literal(1),route_id:X.string().min(1),canonical_entry_file:X.string().min(1),route_key:X.string().min(1),default_template_id:Ie,templates:X.array(Nm).min(1)}).strict().superRefine((t,n)=>{let s=new Set,a,i=0;for(let[r,_]of t.templates.entries())s.has(_.template_id)&&n.addIssue({code:"custom",path:["templates",r,"template_id"],message:`Duplicate template_id: ${_.template_id}`}),s.add(_.template_id),_.kind==="default"&&(i+=1,a=_.template_id);i!==1?n.addIssue({code:"custom",path:["templates"],message:"templates must contain exactly one default item"}):a!==t.default_template_id&&n.addIssue({code:"custom",path:["default_template_id"],message:"default_template_id must match the default template"})}),Zy=X.object({page_path:hn,template_id:Ie,instruction:X.string().min(1)}).strict(),aa=t=>[...new Set(t)],Qy=X.object({page_path:hn,template_id:Ie,exit_template_ids:X.array(Ie).default([]).transform(aa)}).strict(),Jy=X.object({page_path:hn,template_ids:X.array(Ie).min(1).transform(aa)}).strict(),cs={ok:X.literal(!0),site_id:I,page_path:hn,route_id:X.string().min(1),default_template_id:Ie,snapshot_id:x,route_mode:X.literal("delegated")},ex=X.object({...cs,template_id:Ie,status:X.literal("created")}).strict(),tx=X.object({...cs,promoted_template_id:Ie,deleted_template_ids:X.array(Ie),status:X.literal("promoted")}).strict(),nx=X.object({...cs,deleted_template_ids:X.array(Ie),status:X.literal("cleaned")}).strict(),sx=X.enum(["PAGE_TEMPLATE_REQUEST_INVALID","PAGE_TEMPLATE_PAGE_NOT_FOUND","PAGE_TEMPLATE_NOT_FOUND","PAGE_TEMPLATE_ALREADY_EXISTS","PAGE_TEMPLATE_ID_COLLISION","PAGE_TEMPLATE_MANAGED_SOURCE_INVALID","PAGE_TEMPLATE_DEFAULT_PROTECTED","PAGE_TEMPLATE_DEFAULT_ALREADY_ACTIVE","PAGE_TEMPLATE_ASSET_IN_USE","PAGE_TEMPLATE_SNAPSHOT_CONFLICT","PAGE_TEMPLATE_DYNAMIC_ROUTE_UNSUPPORTED","PAGE_TEMPLATE_SOURCE_UNSUPPORTED","PAGE_TEMPLATE_GENERATION_FAILED","PAGE_TEMPLATE_PATCH_FAILED"]);var ne=Sn.object({routeId:Sn.string().min(1),templateId:Ie.optional()}).strict(),L=Sn.object({routeId:Sn.string().min(1),effectiveTemplateId:Ie.optional()}).strict();function ms(t){return JSON.stringify([t.routeId,t.effectiveTemplateId??null])}function rx(t){let n;try{n=JSON.parse(t)}catch{return null}if(!Array.isArray(n)||n.length!==2)return null;let[s,a]=n,i=L.safeParse(a===null?{routeId:s}:{routeId:s,effectiveTemplateId:a});return i.success?i.data:null}var Lm=["design.md","DESIGN.md"],oa=["components/site","src/components/site","lib/generated","src/lib/generated","public"],Mm=["app/globals.css","src/app/globals.css"],Um=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],Fm=new Set(Um),ls="source-delete",ra=A.literal(ls),le=A.string().min(1).refine(ma,"Invalid site edit source path"),qm=A.string().min(1).refine($m,"Invalid site edit source directory path"),px=A.enum(["text","binary"]),fn=A.object({composition:L,path:le,language:A.string().min(1).nullable(),sizeBytes:A.number().int().nonnegative(),contentHash:A.string().min(1).optional()}).strict(),Gm=A.discriminatedUnion("kind",[fn.extend({kind:A.literal("text"),language:A.string().min(1),readonly:A.boolean().default(!1)}),fn.extend({kind:A.literal("binary"),language:A.null(),mimeType:A.string().min(1).optional(),readonly:A.literal(!0)})]),ca=A.lazy(()=>A.discriminatedUnion("kind",[A.object({kind:A.literal("directory"),name:A.string().min(1),path:qm,children:A.array(ca)}),A.object({kind:A.literal("file"),name:A.string().min(1),path:le,file:Gm}).superRefine((t,n)=>{t.path!==t.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),Km=A.enum(["max-files","max-depth","max-total-bytes"]),zm=A.object({reasons:A.array(Km).min(1),maxFiles:A.number().int().positive(),maxDepth:A.number().int().positive(),maxTotalBytes:A.number().int().positive()}),dx=A.object({composition:L,nodes:A.array(ca),defaultPath:le.optional(),totalFiles:A.number().int().nonnegative(),truncated:zm.optional()}).strict(),ux=A.object({composition:ne}).strict(),gx=A.object({path:le,composition:ne}).strict(),Bm=fn.extend({kind:A.literal("text"),language:A.string().min(1),readonly:A.boolean().default(!1),content:A.string()}),Wm=A.enum(["too-large","unsupported-mime","bytes-unavailable"]),Vm=fn.extend({kind:A.literal("binary"),language:A.null(),readonly:A.literal(!0),mimeType:A.string().min(1),contentBase64:A.string().min(1).optional(),previewUnavailableReason:Wm.optional()}),_x=A.discriminatedUnion("kind",[Bm,Vm]),hx=A.object({key:A.string().min(1),composition:ne}).strict(),Hm=A.object({startLine:A.number().int().positive(),startColumn:A.number().int().nonnegative(),endLine:A.number().int().positive(),endColumn:A.number().int().nonnegative()}),Sx=A.object({key:A.string().min(1),composition:L,sourceFile:le,componentName:A.string().min(1),openingElementRange:Hm,structuralPath:A.string().min(1),textPreview:A.string().min(1).optional()}).strict();function ma(t){return!ua(t)||da(t)?!1:us(t)||pa(t)||la(t)||oa.some(n=>t===n||t.startsWith(`${n}/`))}function ps(t){return us(t)||Fm.has(Ym(t))}function $m(t){return!ua(t)||da(t)?!1:t==="app"||t.startsWith("app/")||t==="src"||t==="src/app"||t.startsWith("src/app/")||oa.some(n=>t===n||t.startsWith(`${n}/`)||n.startsWith(`${t}/`))}function ds(t){return ma(t)?us(t)?"design-document":la(t)?"route-entry":pa(t)?"app-global-style":t.toLowerCase()==="lib/generated/media-assets.ts"||t.toLowerCase()==="src/lib/generated/media-assets.ts"?"generated-media-manifest":null:null}function fx(t){return ds(t)!==null}function la(t){return/^(?:src\/)?app\/(?:.*\/)?page\.[cm]?[jt]sx?$/.test(t.toLowerCase())}function pa(t){return Mm.some(n=>n.toLowerCase()===t.toLowerCase())}function Ym(t){let n=t.split("/").at(-1)??t,s=n.lastIndexOf(".");return s>0?n.slice(s).toLowerCase():""}function us(t){return!t.includes("/")&&Lm.some(n=>n.toLowerCase()===t.toLowerCase())}function da(t){let n=t.toLowerCase(),s=n.split("/"),i=(s.at(-1)??n).replace(/\.[^.]+$/,"");return/^(?:src\/)?app\/api(?:\/|$)/.test(n)||/^(?:src\/)?app\/(?:.*\/)?route\.[cm]?[jt]sx?$/.test(n)||/^(?:src\/)?app\/(?:.*\/)?(?:action|actions)\.[cm]?[jt]sx?$/.test(n)||/(^|\/)[^/]+\.server\.[cm]?[jt]sx?$/.test(n)||n==="lib/server"||n.startsWith("lib/server")||n==="src/lib/server"||n.startsWith("src/lib/server")||n==="lib/db"||n.startsWith("lib/db")||n==="src/lib/db"||n.startsWith("src/lib/db")||n==="lib/cms"||n.startsWith("lib/cms/")||n==="src/lib/cms"||n.startsWith("src/lib/cms/")?!0:i==="server"||i==="db"||i==="database"||i==="auth"||i==="secret"||i==="secrets"||i==="token"||i==="tokens"||i==="credential"||i==="credentials"||s.includes("server")||s.includes("secrets")}function ua(t){return!t||t.startsWith("/")||t.includes("\\")?!1:t.split("/").every(n=>!(n.length===0||n==="."||n===".."||n.startsWith(".")||n==="package.json"||n==="node_modules"||n==="recipes"||n.startsWith(".env")))}import{z as Xm}from"zod";var jt=["zh-CN","zh-HK","zh-TW","en-US","en-GB","ja-JP","ko-KR","es-ES","fr-FR","de-DE","pt-PT","ru-RU","ar-SA","id-ID","vi-VN","th-TH","it-IT","nl-NL","tr-TR","pl-PL","uk-UA","cs-CZ","sk-SK","hu-HU","ro-RO","el-GR","sv-SE","da-DK","fi-FI","hr-HR","lt-LT","lv-LV","et-EE","ga-IE","mt-MT","ka-GE","fa-IR","bn-BD","ta-IN","si-LK","ms-MY","fil-PH","my-MM","km-KH","lo-LA","mn-MN","kk-KZ"],Zm=["en","ja","es","fr","de","ko","pt","pt-BR","it","ru","ar","hi","id","vi","th","tr","nl","pl","uk","sv","da","fi","no","cs","el","hu","ro","he","ms","fil","bn","ta","ca","sk","hr","bg","lt","lv","et","fa","sw","sr","is"],Qm=[...jt,...Zm],Jm=new Set(["ar","fa","he"]),xx=[{code:"zh-CN",label:"\u7B80\u4F53\u4E2D\u6587",englishName:"Chinese (Simplified)"},{code:"zh-HK",label:"\u7E41\u9AD4\u4E2D\u6587\uFF08\u9999\u6E2F\uFF09",englishName:"Chinese (Traditional, Hong Kong)"},{code:"zh-TW",label:"\u7E41\u9AD4\u4E2D\u6587\uFF08\u53F0\u7063\uFF09",englishName:"Chinese (Traditional, Taiwan)"},{code:"en-US",label:"English (US)",englishName:"English (United States)",common:!0},{code:"en-GB",label:"English (UK)",englishName:"English (United Kingdom)",common:!0},{code:"ja-JP",label:"\u65E5\u672C\u8A9E",englishName:"Japanese"},{code:"ko-KR",label:"\uD55C\uAD6D\uC5B4",englishName:"Korean"},{code:"es-ES",label:"Espa\xF1ol",englishName:"Spanish"},{code:"fr-FR",label:"Fran\xE7ais",englishName:"French"},{code:"de-DE",label:"Deutsch",englishName:"German"},{code:"pt-PT",label:"Portugu\xEAs",englishName:"Portuguese"},{code:"ru-RU",label:"\u0420\u0443\u0441\u0441\u043A\u0438\u0439",englishName:"Russian"},{code:"ar-SA",label:"\u0627\u0644\u0639\u0631\u0628\u064A\u0629",englishName:"Arabic"},{code:"id-ID",label:"Bahasa Indonesia",englishName:"Indonesian"},{code:"vi-VN",label:"Ti\u1EBFng Vi\u1EC7t",englishName:"Vietnamese"},{code:"th-TH",label:"\u0E44\u0E17\u0E22",englishName:"Thai"},{code:"it-IT",label:"Italiano",englishName:"Italian"},{code:"nl-NL",label:"Nederlands",englishName:"Dutch"},{code:"tr-TR",label:"T\xFCrk\xE7e",englishName:"Turkish"},{code:"pl-PL",label:"Polski",englishName:"Polish"},{code:"uk-UA",label:"\u0423\u043A\u0440\u0430\u0457\u043D\u0441\u044C\u043A\u0430",englishName:"Ukrainian"},{code:"cs-CZ",label:"\u010Ce\u0161tina",englishName:"Czech"},{code:"sk-SK",label:"Sloven\u010Dina",englishName:"Slovak"},{code:"hu-HU",label:"Magyar",englishName:"Hungarian"},{code:"ro-RO",label:"Rom\xE2n\u0103",englishName:"Romanian"},{code:"el-GR",label:"\u0395\u03BB\u03BB\u03B7\u03BD\u03B9\u03BA\u03AC",englishName:"Greek"},{code:"sv-SE",label:"Svenska",englishName:"Swedish"},{code:"da-DK",label:"Dansk",englishName:"Danish"},{code:"fi-FI",label:"Suomi",englishName:"Finnish"},{code:"hr-HR",label:"Hrvatski",englishName:"Croatian"},{code:"lt-LT",label:"Lietuvi\u0173",englishName:"Lithuanian"},{code:"lv-LV",label:"Latvie\u0161u",englishName:"Latvian"},{code:"et-EE",label:"Eesti",englishName:"Estonian"},{code:"ga-IE",label:"Gaeilge",englishName:"Irish"},{code:"mt-MT",label:"Malti",englishName:"Maltese"},{code:"ka-GE",label:"\u10E5\u10D0\u10E0\u10D7\u10E3\u10DA\u10D8",englishName:"Georgian"},{code:"fa-IR",label:"\u0641\u0627\u0631\u0633\u06CC",englishName:"Persian"},{code:"bn-BD",label:"\u09AC\u09BE\u0982\u09B2\u09BE",englishName:"Bengali"},{code:"ta-IN",label:"\u0BA4\u0BAE\u0BBF\u0BB4\u0BCD",englishName:"Tamil"},{code:"si-LK",label:"\u0DC3\u0DD2\u0D82\u0DC4\u0DBD",englishName:"Sinhala"},{code:"ms-MY",label:"Bahasa Melayu",englishName:"Malay"},{code:"fil-PH",label:"Filipino",englishName:"Filipino"},{code:"my-MM",label:"\u1019\u103C\u1014\u103A\u1019\u102C",englishName:"Burmese"},{code:"km-KH",label:"\u1797\u17B6\u179F\u17B6\u1781\u17D2\u1798\u17C2\u179A",englishName:"Khmer"},{code:"lo-LA",label:"\u0EA5\u0EB2\u0EA7",englishName:"Lao"},{code:"mn-MN",label:"\u041C\u043E\u043D\u0433\u043E\u043B",englishName:"Mongolian"},{code:"kk-KZ",label:"\u049A\u0430\u0437\u0430\u049B",englishName:"Kazakh"}],el={en:"en-US",ja:"ja-JP",es:"es-ES",fr:"fr-FR",de:"de-DE",ko:"ko-KR",pt:"pt-PT",it:"it-IT",ru:"ru-RU",ar:"ar-SA",id:"id-ID",vi:"vi-VN",th:"th-TH",tr:"tr-TR",nl:"nl-NL",pl:"pl-PL",uk:"uk-UA",sv:"sv-SE",da:"da-DK",fi:"fi-FI",cs:"cs-CZ",el:"el-GR",hu:"hu-HU",ro:"ro-RO",ms:"ms-MY",fil:"fil-PH",bn:"bn-BD",ta:"ta-IN",sk:"sk-SK",hr:"hr-HR",lt:"lt-LT",lv:"lv-LV",et:"et-EE",fa:"fa-IR"},tl=new Set(jt);function ga(t){return tl.has(t)?t:el[t]}var nl="en";function Ex(t){let n=t.toLowerCase().split("-",1)[0]??"";return Jm.has(n)?"rtl":"ltr"}var sl={cmn:"zh-CN",eng:"en",jpn:"ja",spa:"es",fra:"fr",deu:"de",kor:"ko",por:"pt",ita:"it",rus:"ru",arb:"ar",ara:"ar",hin:"hi",ind:"id",vie:"vi",tha:"th",tur:"tr",nld:"nl",pol:"pl",ukr:"uk",swe:"sv",dan:"da",fin:"fi",nob:"no",nor:"no",ces:"cs",ell:"el",hun:"hu",ron:"ro",heb:"he",msa:"ms",zsm:"ms",tgl:"fil",ben:"bn",tam:"ta",cat:"ca",slk:"sk",hrv:"hr",bul:"bg",lit:"lt",lav:"lv",est:"et",pes:"fa",fas:"fa",swh:"sw",swa:"sw",srp:"sr",isl:"is"};function Ix(t){return sl[t]??nl}var il=["zh-CN","zh-HK","zh-TW","ja-JP","ja","ko-KR","ko","ru-RU","ru","uk-UA","uk","bg","sr","mn-MN","kk-KZ","ar-SA","ar","fa-IR","fa","he","hi","th-TH","th","el-GR","el","ka-GE","bn-BD","bn","ta-IN","ta","si-LK","my-MM","km-KH","lo-LA"],al=new Set(il);function Rx(t){return al.has(t)}var pe=Xm.enum(Qm);import{z as ol}from"zod";var _a=ol.string().uuid();import{z as o}from"zod";var de=o.string().trim().min(1).max(128),Ot=o.string().trim().min(1).max(200),_s=o.string().trim().min(1).max(2e3),hs=o.string().trim().max(200),Nt=o.string().regex(/^[a-f0-9]{64}$/),Ss=o.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),it=["market","persona","product","brand","competition","structure","language","seogeo","content","conversion","risk"],fe=it.length,yn=o.enum(it),xn=yn,fa=["recommended","conservative","focused"],ht=o.enum(fa),gs=o.object({id:ht,label:Ot,note:_s,impact:o.string().trim().max(500).nullish(),set_value:o.string().trim().max(500).nullish(),site_locale:pe.nullish()}).loose(),rl=o.object({lead:o.string().trim().min(1).max(500),title:Ot,columns:o.array(o.string().trim().min(1).max(80)).min(1).max(8),rows:o.array(o.array(o.string().trim().max(500)).min(1).max(8)).max(100)}).strict().superRefine((t,n)=>{t.rows.forEach((s,a)=>{s.length!==t.columns.length&&n.addIssue({code:"custom",path:["rows",a],message:"Each Step5 plan row must match the column count."})})}),cl=o.object({source_type:o.enum(["step2","step3"]),source_id:de,field_path:o.string().trim().max(300).nullish()}).strict(),ml=o.enum(["ready","disabled","empty","timeout","rate_limited","quota_exhausted","failed"]),ba=o.enum(["INFORMATIONAL","NAVIGATIONAL","COMMERCIAL","TRANSACTIONAL"]),ll=o.object({id:de,term:o.string().trim().min(1).max(255),source_type:o.enum(["step2","step3","step5"]),source_id:de,field_path:o.string().trim().min(1).max(300),source_field:o.string().trim().min(1).max(300).optional(),source_evidence:o.string().trim().min(1).max(2e3).optional(),business_subject:o.string().trim().min(1).max(255).optional(),reason:o.string().trim().min(1).max(1e3).optional()}).strict(),pl=o.object({keyword:o.string().trim().min(1).max(255),normalized_keyword:o.string().trim().min(1).max(255),intents:o.array(ba).min(1).max(4),search_volume:o.number().int().min(50),keyword_difficulty:o.number().min(0).max(45),cpc:o.number().nonnegative().nullish(),trend:o.array(o.number().int().min(0).max(100)).length(12),serp_features:o.array(o.string().trim().min(1).max(80)).max(64),fit:o.object({seo:o.number().int().min(0).max(100),geo:o.number().int().min(0).max(100),buyer:o.number().int().min(0).max(100)}).strict(),recommended_channel:o.enum(["SEO","GEO","DUAL"]),priority:o.enum(["P0","P1","P2","P3"]),already_in_plan:o.boolean(),page_level:o.union([o.literal(1),o.literal(2)]).default(1)}).strict(),dl=o.object({id:de,intent:ba,title:Ot,landing_page_type:o.enum(["blog","product","category","landing"]),keywords:o.array(pl).min(1).max(100)}).strict(),ul=o.enum(["NO_SEEDS","NO_PROVIDER_CANDIDATES","NO_METRIC_ELIGIBLE_CANDIDATES","NO_COMMERCIAL_INTENT_CANDIDATES","NO_FIT_ELIGIBLE_CANDIDATES"]),gl=o.object({fetched_count:o.number().int().nonnegative(),unique_count:o.number().int().nonnegative(),metric_gate_pass_count:o.number().int().nonnegative(),commercial_intent_pass_count:o.number().int().nonnegative(),fit_pass_count:o.number().int().nonnegative(),selected_count:o.number().int().nonnegative()}).strict().superRefine((t,n)=>{let s=[t.fetched_count,t.unique_count,t.metric_gate_pass_count,t.commercial_intent_pass_count,t.fit_pass_count,t.selected_count];s.some((a,i)=>i>0&&a>s[i-1])&&n.addIssue({code:"custom",message:"Semrush selection counts must be monotonically non-increasing."})}),_l=o.object({schema_version:o.literal(1),provider:o.literal("semrush"),api_version:o.literal("v4"),database:o.string().trim().regex(/^[A-Z]{2}$/),country:o.string().trim().regex(/^[A-Z]{2}$/),fetched_at:o.string().datetime({offset:!0}),context_hash:Nt,status:ml,seeds:o.array(ll).max(20),intent_groups:o.array(dl).max(16),selection_summary:gl.optional(),empty_reason_code:ul.nullish(),error_code:o.string().trim().regex(/^[A-Z0-9_]+$/).max(64).nullish()}).strict().superRefine((t,n)=>{if(t.database!==t.country&&n.addIssue({code:"custom",path:["database"],message:"Semrush database must match the ISO country code."}),t.status==="ready"&&t.intent_groups.length===0&&n.addIssue({code:"custom",path:["intent_groups"],message:"Ready Semrush recommendations require an intent group."}),t.status==="ready"&&t.error_code&&n.addIssue({code:"custom",path:["error_code"],message:"Ready Semrush recommendations cannot contain an error code."}),t.empty_reason_code&&t.status!=="empty"&&n.addIssue({code:"custom",path:["empty_reason_code"],message:"Semrush empty reason is only valid for an empty snapshot."}),t.selection_summary){let s=t.intent_groups.reduce((a,i)=>a+i.keywords.length,0);t.selection_summary.selected_count!==s&&n.addIssue({code:"custom",path:["selection_summary","selected_count"],message:"Semrush selected count must match the persisted keywords."})}}),ha=1,vx=o.object({seed_keyword:o.string().trim().min(1).max(255),database:o.string().trim().toLowerCase().regex(/^[a-z]{2}$/).default("us"),limit:o.number().int().min(1).max(100).default(20),offset:o.number().int().nonnegative().default(0),min_search_volume:o.number().int().nonnegative().default(50),max_keyword_difficulty:o.number().finite().min(0).max(100).default(45),min_relevance_score:o.literal(ha).default(ha)}).strict(),hl=o.object({keyword:o.string().trim().min(1).max(255),search_volume:o.number().int().nonnegative().nullable(),keyword_difficulty:o.number().nonnegative().nullable(),cpc:o.number().nonnegative().nullable(),competition:o.number().nonnegative().nullable(),result_count:o.number().int().nonnegative().nullable(),intent:o.string().trim().max(64).nullable(),trend:o.array(o.string()).nullable(),serp_features:o.array(o.string()).nullable(),fit:o.number().finite().min(0).max(10),currency:o.string().trim().regex(/^[A-Z]{3}$/).nullable()}).strict(),Sl=o.object({request_id:o.string().trim().min(1).max(128),snapshot_id:o.string().uuid(),seed_keyword:o.string().trim().min(1).max(255),database:o.string().trim().min(1).max(16),limit:o.number().int().min(1).max(100),offset:o.number().int().nonnegative(),freshness:o.enum(["live","cached","historical"]),collected_at:o.string().datetime({offset:!0}),items:o.array(hl).max(100),result_count:o.number().int().nonnegative()}).strict(),Cx=o.object({code:o.literal(0),message:o.string(),data:Sl}).strict(),Dx=o.object({snapshot_id:o.string().uuid(),selected_keywords:o.array(o.string().trim().min(2).max(160)).min(1).max(50)}).strict(),fl=o.object({candidate_id:de,keyword:o.string().trim().min(2).max(160),classification_status:o.string().trim().min(1).max(64),selection_status:o.string().trim().min(1).max(64),selected_at:o.string().datetime({offset:!0})}).strict(),bl=o.object({selection_batch_id:de,snapshot_id:o.string().uuid(),selected_count:o.number().int().nonnegative(),created_count:o.number().int().nonnegative(),updated_count:o.number().int().nonnegative(),deselected_count:o.number().int().nonnegative(),items:o.array(fl).max(50)}).strict().superRefine((t,n)=>{t.selected_count!==t.items.length&&n.addIssue({code:"custom",path:["selected_count"],message:"selected_count must equal items.length."})}),jx=o.object({code:o.literal(0),message:o.string(),data:bl}).strict(),yl=o.enum(["ok","degraded"]),fs=o.object({key:xn,position:o.number().int().min(1).max(fe),category:Ot,title:Ot,summary:_s,rationale:_s,parameter:o.string().trim().max(500).nullish(),options:o.tuple([gs,gs,gs]),plan:rl.nullish(),note_tips:o.array(o.string().trim().min(1).max(200)).max(6),note_placeholder:o.string().trim().min(1).max(300),evidence_refs:o.array(cl).min(1).max(8),semrush_recommendations:_l.nullish(),seo_payload:o.lazy(()=>bs).nullish(),generation_status:yl.optional()}).loose().superRefine((t,n)=>{let s=it.indexOf(t.key)+1;t.position!==s&&n.addIssue({code:"custom",path:["position"],message:`Step5 strategy ${t.key} uses an invalid position.`}),t.options.forEach((a,i)=>{a.id!==fa[i]&&n.addIssue({code:"custom",path:["options",i,"id"],message:"Step5 strategy options must use the canonical order."})}),t.semrush_recommendations&&t.key!=="seogeo"&&n.addIssue({code:"custom",path:["semrush_recommendations"],message:"Semrush recommendations are only valid for the seogeo item."}),t.seo_payload&&t.key!=="seogeo"&&n.addIssue({code:"custom",path:["seo_payload"],message:"SEO payloads are only valid for the seogeo item."})}),bn=9,ya=o.object({id:de,type:o.union([o.literal(1),o.literal(2)]).default(1),cells:o.tuple([o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500)])}).strict(),xl=2,El=1,Ox=20,Il=50,xa=o.object({id:de,keyword:o.string().trim().min(1).max(500),intent_code:o.string().trim().min(1).max(16),intent_type:o.string().trim().min(1).max(200),strength:o.enum(["high","medium"]),search_volume:o.number().int().nonnegative().nullable(),cpc:o.number().finite().nonnegative().nullable()}).strict(),Rl=xa.superRefine((t,n)=>{t.intent_code!=="C"&&t.intent_code!=="T"&&n.addIssue({code:"custom",path:["intent_code"],message:"New legacy SEO keyword selections must use commercial or transactional intent."})}),En=o.object({id:de,keyword:o.string().trim().min(2).max(160),normalized_keyword:o.string().trim().min(2).max(160),intc:o.enum(["I","N","C","T"]),keyword_type:o.string().trim().min(1).max(80),intent_strength:o.enum(["high","medium","low"]),monthly_volume:o.number().int().nonnegative().nullable(),keyword_difficulty:o.number().finite().min(0).max(100).nullable(),fit:o.number().finite().min(0).max(10).nullable(),sem_cpc:o.number().finite().nonnegative().nullable(),currency:o.string().trim().regex(/^[A-Z]{3}$/).nullable(),landing_page:o.string().trim().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*)?$/),content_format:o.string().trim().min(1).max(80),priority:o.enum(["P0","P1","P2","P3"]),source:o.enum(["step5_generation","semrush"]),source_market:o.string().trim().toLowerCase().regex(/^[a-z]{2,8}$/),metric_timestamp:o.string().datetime({offset:!0}).nullable()}).strict().superRefine((t,n)=>{let s=Ra(t.keyword);t.normalized_keyword!==s&&n.addIssue({code:"custom",path:["normalized_keyword"],message:"normalized_keyword must match the canonical keyword form."}),/^[\x20-\x7E]+$/.test(t.keyword)||n.addIssue({code:"custom",path:["keyword"],message:"Step5 SEO keywords must be English ASCII text."})}),Tl=o.object({request_id:o.string().trim().min(1).max(128),snapshot_id:de,selected_keywords:o.array(o.string().trim().min(2).max(160)).min(1).max(50)}).strict(),bs=o.object({schema_version:o.literal(xl),seo_keywords:o.array(En).min(El).max(Il),semrush_snapshot_refs:o.array(Tl).max(20).optional()}).strict().superRefine(Ml),kl=bs.superRefine((t,n)=>{t.seo_keywords.forEach((s,a)=>{s.intc!=="C"&&s.intc!=="T"&&n.addIssue({code:"custom",path:["seo_keywords",a,"intc"],message:"New SEO keyword selections must use commercial or transactional intent."})})}),Pl=o.object({rows:o.array(ya).max(100).optional(),seo_keywords:o.array(xa).max(100).optional()}).strict(),wl=o.object({rows:o.array(ya).max(100).optional(),seo_keywords:o.array(Rl).max(100).optional()}).strict(),Al=o.union([bs,Pl]),Ea=o.union([kl,wl]),vl=o.object({item_key:yn,selected_option_id:ht,note:hs,custom_payload:Ea.optional()}).strict().superRefine((t,n)=>{t.item_key==="seogeo"&&t.custom_payload&&!("schema_version"in t.custom_payload)&&Ll(t.custom_payload,n)}),ys=o.object({item_key:yn,selected_option_id:ht,note:hs,custom_payload:Al.optional(),selected_value:o.unknown().nullable(),accepted_at:o.string().datetime({offset:!0})}).loose(),Cl=o.enum(["running","succeeded","failed"]),Dl=o.object({schema_version:o.literal(1),source_job_id:de,site_id:de,output_locale:Ss.optional(),items:o.array(fs).length(fe),decisions:o.array(ys).length(fe)}).loose(),jl=o.object({strategy_version_id:de,site_id:de,source_job_id:de,output_locale:Ss.optional(),version:o.number().int().positive(),checksum:Nt,snapshot:Dl,committed_at:o.string().datetime({offset:!0})}).loose(),Ia=o.object({job_id:de,site_id:de,output_locale:Ss.optional(),status:Cl,revision:o.number().int().nonnegative(),items:o.array(fs).max(fe),decisions:o.array(ys).max(fe),output_checksum:Nt.nullish(),error_code:o.string().trim().max(64).nullish(),error_message:o.string().trim().max(500).nullish(),committed_version:jl.nullish()}).loose().superRefine((t,n)=>{let s=t.items.map(i=>i.key);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["items"],message:"Step5 job items must have unique keys."});let a=t.decisions.map(i=>i.item_key);new Set(a).size!==a.length&&n.addIssue({code:"custom",path:["decisions"],message:"Step5 job decisions must have unique item keys."})}),Nx=o.object({force_refresh:o.boolean().optional().default(!1)}).strict(),Lx=Ia.extend({cached:o.boolean()}).strict(),Mx=o.object({expected_revision:o.number().int().nonnegative()}).strict(),Ux=o.object({expected_revision:o.number().int().nonnegative(),selected_option_id:ht,note:hs,custom_payload:Ea.optional()}).strict(),Fx=o.object({revision:o.number().int().positive(),decision:ys}).strict(),qx=o.object({idempotency_key:o.string().trim().min(8).max(128),expected_revision:o.number().int().nonnegative(),decisions:o.array(vl).length(fe)}).strict().superRefine((t,n)=>{let s=t.decisions.map(a=>a.item_key);new Set(s).size!==it.length&&n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit must contain ${fe} unique decisions.`}),it.forEach(a=>{s.includes(a)||n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit is missing ${a}.`})})}),Gx=o.object({strategy_version_id:de,version:o.number().int().positive(),checksum:Nt,next_path:o.string().trim().min(1).max(500)}).strict(),Ol=Ia.extend({completed:o.number().int().min(0).max(fe),total:o.literal(fe)}).loose(),Nl=["snapshot","strategy_item_start","strategy_item_done","strategy_items_invalidated","strategy_generation_done","failed"];function Kx(t){return typeof t=="string"&&Nl.includes(t)}var zx=o.discriminatedUnion("event",[o.object({id:o.number().int().nonnegative(),event:o.literal("snapshot"),data:Ol}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_item_start"),data:o.object({key:yn,position:o.number().int().min(1).max(fe)}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_item_done"),data:o.object({item:fs}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_items_invalidated"),data:o.object({after_position:o.number().int().min(0).max(fe)}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_generation_done"),data:o.object({item_count:o.literal(fe),schema_version:o.literal(1),checksum:Nt}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("failed"),data:o.object({code:o.string().trim().min(1).max(64),message:o.string().trim().min(1).max(500),retryable:o.boolean(),item_key:xn.optional()}).loose()}).loose()]);function Sa(t){let n=t.trim().toLocaleLowerCase();return n===""||n==="/"?"/":`/${n.replace(/^\/+|\/+$/g,"")}`}function Ll(t,n){let s=(t.rows??[]).filter(i=>i.type===1);t.rows&&s.length===0&&n.addIssue({code:"custom",path:["custom_payload","rows"],message:"SEO/GEO plans must keep at least one primary page."});let a=s.some(i=>Sa(i.cells[3])==="/");s.length+(a?0:1)>bn&&n.addIssue({code:"custom",path:["custom_payload","rows"],message:`Initial generation supports at most ${bn} primary pages including home.`}),s.forEach((i,r)=>{/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/.test(Sa(i.cells[3]))||n.addIssue({code:"custom",path:["custom_payload","rows",r,"cells",3],message:"Primary intent pages must use root or one-segment kebab-case paths."})})}function Ra(t){return t.normalize("NFKC").trim().replace(/\s+/g," ").toLowerCase()}function Ml(t,n){let s=new Set;t.seo_keywords.forEach((i,r)=>{s.has(i.normalized_keyword)&&n.addIssue({code:"custom",path:["seo_keywords",r,"normalized_keyword"],message:"SEO keywords must be unique after Unicode normalization."}),s.add(i.normalized_keyword),(i.monthly_volume===null||i.monthly_volume<50)&&n.addIssue({code:"custom",path:["seo_keywords",r,"monthly_volume"],message:"Selected SEO keywords require monthly_volume >= 50."}),(i.keyword_difficulty===null||i.keyword_difficulty>45)&&n.addIssue({code:"custom",path:["seo_keywords",r,"keyword_difficulty"],message:"Selected SEO keywords require keyword_difficulty <= 45."}),(i.fit===null||i.fit<7)&&n.addIssue({code:"custom",path:["seo_keywords",r,"fit"],message:"Selected SEO keywords require fit >= 7.0."})});let a=new Set((t.semrush_snapshot_refs??[]).flatMap(i=>i.selected_keywords.map(Ra)));t.seo_keywords.forEach((i,r)=>{i.source==="semrush"&&!a.has(i.normalized_keyword)&&n.addIssue({code:"custom",path:["seo_keywords",r,"source"],message:"Semrush keywords must reference a persisted Semrush snapshot selection."})})}import{z as Ul}from"zod";var De=Ul.string().regex(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/);function Vx(t,n){let s=De.safeParse(t),a=De.safeParse(n);if(!s.success||!a.success)return null;let i=Ta(s.data),r=Ta(a.data);for(let c=0;c<3;c+=1){let g=ka(i.release[c],r.release[c]);if(g!==0)return g}if(!i.prerelease&&!r.prerelease)return 0;if(!i.prerelease)return 1;if(!r.prerelease)return-1;let _=Math.max(i.prerelease.length,r.prerelease.length);for(let c=0;c<_;c+=1){let g=i.prerelease[c],j=r.prerelease[c];if(g===void 0)return-1;if(j===void 0)return 1;if(g===j)continue;let E=/^\d+$/u.test(g),O=/^\d+$/u.test(j);return E&&O?ka(BigInt(g),BigInt(j)):E?-1:O?1:Fl(g,j)}return 0}function Ta(t){let n=t.indexOf("+"),s=n===-1?t:t.slice(0,n),a=s.indexOf("-"),i=a===-1?s:s.slice(0,a),r=a===-1?void 0:s.slice(a+1),[_,c,g]=i.split(".");return{release:[BigInt(_),BigInt(c),BigInt(g)],...r?{prerelease:r.split(".")}:{}}}function ka(t,n){return t<n?-1:t>n?1:0}function Fl(t,n){return t<n?-1:t>n?1:0}import{z as K}from"zod";import{z as be}from"zod";var xs=64,ql=512*1024,Es=4*1024*1024,Gl=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function Kl(t){return Gl.test(t)}var Pa=be.string().min(1).refine(Kl,{message:"Materialization pathTemplate must be a safe relative path."}),zl=be.object({pathTemplate:Pa,content:be.string(),role:be.string().min(1).optional()}).strict(),Bl=be.union([be.object({kind:be.literal("default")}).strict(),be.object({kind:be.literal("named"),name:be.string().min(1)}).strict()]),Wl=be.object({pathTemplate:Pa,export:Bl}).strict(),Vl=be.array(be.never()).optional(),at=be.object({instanceBaseName:be.string().min(1),files:be.array(zl).min(1).max(xs),entry:Wl,dataRequirements:Vl}).strict().superRefine((t,n)=>{let s=new Set,a=t.entry.pathTemplate,i=0;for(let[r,_]of t.files.entries()){s.has(_.pathTemplate)&&n.addIssue({code:"custom",path:["files",r,"pathTemplate"],message:`Duplicate materialization pathTemplate: ${_.pathTemplate}`}),s.add(_.pathTemplate);let c=new TextEncoder().encode(_.content).length;c>ql&&n.addIssue({code:"custom",path:["files",r,"content"],message:"Materialization file content exceeds the per-file byte limit."}),i+=c}s.has(a)||n.addIssue({code:"custom",path:["entry","pathTemplate"],message:"Materialization entry pathTemplate must match a file."}),i>Es&&n.addIssue({code:"custom",path:["files"],message:"Materialization exceeds the total content byte limit."})});var wa="insertNewComponent",Qx={categoryGroupMissing:"DESIGNER_COMPONENT_CATEGORY_GROUP_MISSING",unavailable:"DESIGNER_COMPONENT_LIBRARY_UNAVAILABLE",timeout:"DESIGNER_COMPONENT_LIBRARY_TIMEOUT",invalidResponse:"DESIGNER_COMPONENT_LIBRARY_INVALID_RESPONSE",incompatibleResource:"DESIGNER_COMPONENT_RESOURCE_INCOMPATIBLE"},Is=K.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),Aa=K.lazy(()=>K.object({id:K.string().uuid(),key:K.string().min(1),name:K.string(),children:K.array(Aa)}).strict()),va=K.object({category_group_key:K.literal(wa),categories:K.array(Aa)}).strict(),Hl=K.object({resource_id:K.string().min(1),name:K.string(),description:K.string().nullable(),thumbnail_url:K.string().nullable(),resolved_version:Is,category_id:K.string().uuid().nullable()}).strict(),Ca=K.object({category_group_key:K.literal(wa),items:K.array(Hl),next_cursor:K.string().min(1).nullable()}).strict(),Jx=K.object({resource_id:K.string().min(1),resolved_version:Is,anchor_block_id:K.string().min(1),placement:K.enum(["before","after"])}).strict(),eE=K.object({status:K.literal("mock_acknowledged")}).strict(),tE=K.object({category_id:K.string().uuid().optional(),include_descendants:K.enum(["true","false"]).optional().transform(t=>t==="true"),limit:K.coerce.number().int().min(1).max(100).optional().default(20),cursor:K.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),ot=Is,nE=K.object({version:ot}).strict(),Da=K.object({resource_id:K.string().min(1),resolved_version:ot,revision_id:K.string().uuid().optional(),digest_sha256:K.string().regex(/^[a-f0-9]{64}$/),materialization:at}).strict();import{z as b}from"zod";import{z as y}from"zod";var Oa="/",Na=255,$l=5e3,Yl=64;function Xl(t){if(!t.startsWith("/")||t.includes("//")||/[?#\\\s\u0000-\u001f\u007f]/u.test(t))return!1;try{let n=decodeURIComponent(t);return n.includes("//")||/[?#\\\s\u0000-\u001f\u007f]/u.test(n)||n.split("/").length!==t.split("/").length||/%25/iu.test(t)?!1:n.split("/").every(s=>![".",".."].includes(s))}catch{return!1}}var Mt=y.string().min(1).max(Na).refine(Xl,"url_path must be a safe site-relative path"),ks=y.string().max(Na),In=y.preprocess(t=>t===0?!1:t===1?!0:t,y.boolean()),Lt=y.union([y.url(),Mt]),Ps=y.enum(["landing_page","general_page","detail_page"]),ws=y.enum([...Ps.options,"list_page","category_page","tag_page","author_page","search_page","date_page"]);function oE(t){return t.vcp_managed&&t.url!==null&&Ps.safeParse(t.page_type).success&&Mt.safeParse(t.url_path).success}var La=y.lazy(()=>y.object({cms_page_id:y.number().int().positive(),title:y.string().trim().min(1).max(255),url_path:ks,url:Lt.nullable(),page_type:ws,vcp_managed:In,children:y.array(La)}).strict()),Zl=y.object({group_id:y.string().min(1),title:y.string().trim().min(1).max(255),pages:y.array(La)}).strict(),ja=y.object({groups:y.array(Zl)}).strict(),Ma=y.lazy(()=>y.object({id:y.number().int().positive(),title:y.string().trim().min(1).max(120),url_path:ks,parent_id:y.number().int().nonnegative(),group_type:y.string().min(1),page_type:ws,plugin_id:y.number().int().nonnegative(),is_default:In,is_published:In,url:Lt.nullable(),vcp_managed:In,children:y.array(Ma)})),Ql=y.object({plugin_id:y.number().int().nonnegative(),slug:y.string(),group_name:y.string().trim().min(1).max(255),pages:y.array(Ma)}).passthrough(),Jl=y.array(Ql);function Ua(t){return{cms_page_id:t.id,title:t.title,url_path:t.url_path,url:t.url,page_type:t.page_type,vcp_managed:t.vcp_managed,children:t.children.map(n=>Ua(n))}}function rE(t){if(!ep(t))return null;let n=ja.safeParse(t);if(n.success)return n.data;let s=Jl.safeParse(t);if(!s.success)return null;let a=ja.safeParse({groups:s.data.map(i=>({group_id:String(i.plugin_id),title:i.group_name,pages:i.pages.map(Ua)}))});return a.success?a.data:null}function ep(t){let n=Array.isArray(t)?t:Rs(t)&&Array.isArray(t.groups)?t.groups:[],s=[];for(let i of n)if(!(!Rs(i)||!Array.isArray(i.pages)))for(let r of i.pages)s.push({node:r,depth:1});let a=0;for(;s.length>0;){let i=s.pop();if(a+=1,a>$l||i.depth>Yl)return!1;if(!(!Rs(i.node)||!Array.isArray(i.node.children)))for(let r of i.node.children)s.push({node:r,depth:i.depth+1})}return!0}function Rs(t){return typeof t=="object"&&t!==null}var tp=y.enum(["invalid_url_path","missing_url","not_vcp_managed","unsupported_page_type"]),np=y.enum(["home_page","invalid_url_path","not_selectable","not_vcp_managed","page_has_children","last_selectable_page","cms_unbound","unsupported_page_type"]),Fa=y.lazy(()=>y.object({cms_page_id:y.number().int().positive().nullable(),title:y.string().trim().min(1).max(255),url_path:ks,url:Lt.nullable(),page_type:ws,vcp_managed:y.boolean(),selectable:y.boolean(),disabled_reason:tp.nullable(),can_delete:y.boolean(),delete_block_reason:np.nullable(),has_cms_children:y.boolean(),children:y.array(Fa)}).strict()),qa=y.object({group_id:y.string().min(1),title:y.string().trim().min(1).max(255),pages:y.array(Fa)}).strict(),cE=y.object({base_snapshot_id:x,expected_url_path:Mt}).strict(),sp=y.enum(["succeeded","failed"]),ip=y.object({url_path:Mt,phase:y.enum(["ensure","binding","delete"]),code:y.string().min(1),message:y.string().min(1)}).strict(),Ga=y.object({status:sp,checked_count:y.number().int().nonnegative(),ensured_count:y.number().int().nonnegative(),deleted_count:y.number().int().nonnegative(),already_absent_count:y.number().int().nonnegative(),failed_pages:y.array(ip),warnings:y.array(y.string().min(1))}).strict(),ap=y.object({result_snapshot_id:x,deleted_files:y.array(y.string().min(1)),updated_files:y.array(y.string().min(1)),preserved_shared_files:y.array(y.string().min(1)),warnings:y.array(y.string().min(1)),next_url:Lt.nullable(),previous_url:Lt.nullable(),cms_reconcile_result:Ga}).strict(),mE=y.object({code:y.literal(0),message:y.string(),data:ap}).strict(),lE=y.object({source_committed:y.boolean(),result_snapshot_id:x.optional(),cms_reconcile_result:Ga.optional()}).strict().superRefine((t,n)=>{t.source_committed&&!t.result_snapshot_id&&n.addIssue({code:"custom",path:["result_snapshot_id"],message:"committed source requires result_snapshot_id"})}),op=Ps,Ka=y.object({url_path:Mt,title:y.string().trim().min(1).max(255),kind:op,route_file:y.string().min(1),collection_id:y.string().trim().min(1).optional()}).strict().superRefine((t,n)=>{t.kind==="detail_page"&&!t.collection_id&&n.addIssue({code:"custom",path:["collection_id"],message:"detail_page target requires collection_id"}),t.kind!=="detail_page"&&t.collection_id&&n.addIssue({code:"custom",path:["collection_id"],message:`${t.kind} target cannot have collection_id`}),t.kind==="landing_page"!=(t.url_path===Oa)&&n.addIssue({code:"custom",path:["kind"],message:"The home target must be the only landing_page target."})}),rp=y.object({complete:y.literal(!0),targets:y.array(Ka)}).strict().superRefine((t,n)=>{t.targets.length<1&&n.addIssue({code:"too_small",minimum:1,inclusive:!0,origin:"array",path:["targets"],message:"A complete page target set must contain at least one page."}),t.targets.filter(a=>a.url_path===Oa).length!==1&&n.addIssue({code:"custom",path:["targets"],message:"A complete page target set must contain exactly one home page."})}),pE=y.discriminatedUnion("complete",[rp,y.object({complete:y.literal(!1),targets:y.array(Ka),errors:y.array(y.string().min(1)).min(1)}).strict()]),Ts=y.string().regex(/^sha256:[0-9a-f]{64}$/),dE=y.object({projection_hash:Ts.nullable()}).strict(),uE=y.object({expected_projection_hash:Ts.nullable(),projection_hash:Ts}).strict();var za="insertNewPage",bE={categoryGroupMissing:"DESIGNER_PAGE_CATEGORY_GROUP_MISSING",unavailable:"DESIGNER_PAGE_LIBRARY_UNAVAILABLE",timeout:"DESIGNER_PAGE_LIBRARY_TIMEOUT",invalidResponse:"DESIGNER_PAGE_LIBRARY_INVALID_RESPONSE",incompatibleResource:"DESIGNER_PAGE_RESOURCE_INCOMPATIBLE"},rt=b.enum(["page","pages"]),cp=b.object({resource_id:b.string().min(1),resource_type:rt,resolved_version:ot,template_page_id:b.string().min(1)}).strict(),Ba=b.lazy(()=>b.object({id:b.string().uuid(),key:b.string().min(1),name:b.string(),children:b.array(Ba)}).strict()),Wa=b.object({category_group_key:b.literal(za),categories:b.array(Ba)}).strict(),mp=b.object({resource_id:b.string().min(1),resource_type:rt,name:b.string(),description:b.string().nullable(),thumbnail_url:b.string().nullable(),resolved_version:ot,category_id:b.string().uuid().nullable()}).strict(),Va=b.object({category_group_key:b.literal(za),items:b.array(mp),next_cursor:b.string().min(1).nullable()}).strict(),yE=b.object({category_id:b.string().uuid().optional(),include_descendants:b.enum(["true","false"]).optional().transform(t=>t==="true"),limit:b.coerce.number().int().min(1).max(100).optional().default(20),cursor:b.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),Ut=ot,Rn=b.string().regex(/^\/[a-z0-9]+(?:-[a-z0-9]+)*$/),xE=b.string().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),lp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:Rn}).strict(),pp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),source:cp.optional(),blocks:b.array(b.discriminatedUnion("kind",[b.object({kind:b.literal("package-component"),instance_id:b.string().min(1),component_id:b.string().min(1),label:b.string().trim().min(1).max(120)}).strict(),b.object({kind:b.literal("component-resource"),instance_id:b.string().min(1),resource_id:b.string().min(1),resolved_version:ot,label:b.string().trim().min(1).max(120)}).strict()])).optional(),route:b.object({input:b.string(),append_random_suffix:b.boolean().optional(),random_suffix_length:b.number().int().min(4).max(16).optional(),final:Rn}).strict()}).strict(),dp=b.object({resource_id:b.string().min(1),resource_type:rt,resolved_version:Ut,pages:b.array(pp).min(1)}).strict().superRefine((t,n)=>{Ve(t.pages.map(s=>s.template_page_id),"pages",n),Ve(t.pages.map(s=>s.route.final),"routes",n);for(let[s,a]of t.pages.entries()){if(!a.blocks)continue;let i=new Set;for(let[r,_]of a.blocks.entries())i.has(_.instance_id)&&n.addIssue({code:"custom",path:["pages",s,"blocks",r,"instance_id"],message:`Duplicate block instance identifier within page: ${_.instance_id}`}),i.add(_.instance_id)}});function As(t,n){t.resource_type==="page"&&t.pages.length!==1&&n.addIssue({code:"custom",path:["pages"],message:"page resources must contain exactly one page"}),t.resource_type==="pages"&&t.pages.length<2&&n.addIssue({code:"custom",path:["pages"],message:"pages resources must contain at least two pages"})}function Ve(t,n,s){let a=new Set;for(let[i,r]of t.entries())a.has(r)&&s.addIssue({code:"custom",path:[n,i],message:`Duplicate ${n} identifier: ${r}`}),a.add(r)}var EE=b.object({resource_type:rt,version:Ut,pages:b.array(lp).min(1)}).strict().superRefine((t,n)=>{As(t,n),Ve(t.pages.map(s=>s.template_page_id),"pages",n),Ve(t.pages.map(s=>s.final_route),"routes",n)}),up=b.object({instance_id:b.string().min(1),component_id:b.string().min(1)}).strict(),gp=b.object({component_id:b.string().min(1),materialization:at}).strict(),_p=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:Rn,materialization:at,components:b.array(up)}).strict(),vs=b.object({resource_id:b.string().min(1),resource_type:rt,resolved_version:Ut,revision_id:b.string().uuid().optional(),digest_sha256:b.string().regex(/^[a-f0-9]{64}$/),components:b.array(gp),pages:b.array(_p).min(1),project_dependencies:b.record(b.string(),b.never()).optional()}).strict().superRefine((t,n)=>{As(t,n);let s=t.components.map(i=>i.component_id),a=new Set(s);Ve(s,"components",n),Ve(t.pages.map(i=>i.template_page_id),"pages",n),Ve(t.pages.map(i=>i.final_route),"routes",n);for(let[i,r]of t.pages.entries()){let _=new Set;for(let[c,g]of r.components.entries())a.has(g.component_id)||n.addIssue({code:"custom",path:["pages",i,"components",c,"component_id"],message:`Unknown component reference: ${g.component_id}`}),_.has(g.instance_id)&&n.addIssue({code:"custom",path:["pages",i,"components",c,"instance_id"],message:`Duplicate component instance identifier within page: ${g.instance_id}`}),_.add(g.instance_id)}}),Ha=vs,$a=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:Rn,route_file_path:b.string().regex(/^app\/[a-z0-9]+(?:-[a-z0-9]+)*\/page\.tsx$/)}).strict(),hp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),composition_supported:b.boolean(),blocks:b.array(b.object({instance_id:b.string().min(1),component_id:b.string().min(1),label:b.string().trim().min(1).max(120)}).strict())}).strict(),Ya=b.object({resource_id:b.string().min(1),resource_type:rt,resolved_version:Ut,pages:b.array(hp).min(1)}).strict().superRefine((t,n)=>{As(t,n),Ve(t.pages.map(s=>s.template_page_id),"pages",n)}),IE=b.object({resource_type:rt,version:Ut}).strict(),RE=b.object({draft:dp}).strict(),Xa=b.object({groups:b.array(qa)}).strict(),Za=b.object({candidate:b.record(b.string(),b.unknown())}).strict();var St="[a-z0-9]+(?:-[a-z0-9]+)*",Ft=new RegExp(`^/(?:${St}(?:/${St})*)?$`),Qa=["/privacy","/cookie-policy"],Sp=Qa.map(t=>`app/${t.slice(1)}/page.tsx`);function fp(t){return t.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function Ja(t){return typeof t=="string"&&Ft.test(t)}function eo(t){if(typeof t!="string")return null;let n=t.trim();if(/[^\x00-\x7F]/.test(n))return null;let s=n.replace(/^\/+|\/+$/g,"");if(s==="")return"/";let a=s.split("/");if(a.some(c=>c==="."||c===".."))return null;let i=s.toLowerCase();if(i==="index"||i==="home")return"/";let r=a.map(fp).filter(c=>c.length>0);if(r.length===0)return null;let _=`/${r.join("/")}`;return Ja(_)?_:null}function to(t){let n=eo(t);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function bp(t){let n=to(t);return n==="/"?"app/page.tsx":`app/${n.slice(1)}/page.tsx`}import{z as Z}from"zod";import{z as p}from"zod";import{z as we}from"zod";var yp=we.object({code:we.string().min(1),message:we.string().min(1)}),AE=we.object({code:we.string().min(1),message:we.string().min(1)});function Cs(t){return we.object({ok:we.literal(!0),composition:L,data:t}).strict()}function xp(t){let n={ok:we.literal(!1),composition:L,error:yp.extend({code:t.codeSchema})};return t.currentSchema&&(n.current=t.currentSchema.optional()),t.diagnosticsSchema&&(n.diagnostics=we.array(t.diagnosticsSchema).optional()),t.dataSchema&&(n.data=t.dataSchema.optional()),we.object(n).strict()}function no(t){return we.discriminatedUnion("ok",[Cs(t.dataSchema),xp({codeSchema:t.codeSchema,currentSchema:t.currentSchema,diagnosticsSchema:t.diagnosticsSchema,dataSchema:t.failureDataSchema})])}import{z as B}from"zod";var ct=B.object({start:B.number().int().nonnegative(),end:B.number().int().nonnegative()}).superRefine((t,n)=>{t.end<t.start&&n.addIssue({code:"custom",path:["end"],message:"end must be greater than or equal to start"})}),Ep=B.object({code:B.enum(["missing-class-name","unsupported-attribute-name","source-locator-warning","invalid-new-attr","version-conflict","write-failed"]),message:B.string().min(1)}),so=B.object({path:B.string().min(1),content:B.string(),hash:B.string().min(1).optional()}),OE=B.object({composition:L,revision:B.string().min(1),entryCss:so,stylesheets:B.array(so).default([])}).strict(),NE=B.object({composition:ne}).strict(),LE=B.object({key:B.string().min(1),composition:ne}).strict(),io=B.object({key:B.string().min(1),composition:L,filePath:B.string().min(1),componentName:B.string().min(1),sourceKind:B.enum(["missing","stringLiteral","expression"]),attrRaw:B.string().min(1).nullable(),valueRaw:B.string().min(1).nullable(),attrRange:ct.nullable(),openingElementRange:ct,version:B.object({documentVersion:B.number().int().nonnegative(),contentHash:B.string().min(1)}),diagnostics:B.array(Ep),computedStyle:B.record(B.string(),B.string()).optional()}).strict().superRefine((t,n)=>{if(t.sourceKind==="missing"){(t.attrRaw!==null||t.valueRaw!==null||t.attrRange!==null)&&n.addIssue({code:"custom",message:"missing className source must not include attr raw or range"});return}(t.attrRaw===null||t.valueRaw===null||t.attrRange===null)&&n.addIssue({code:"custom",message:"present className source must include attr raw and ranges"})}),ME=io,UE=Cs(io),Ds=B.object({source:B.enum(["style-panel","class-source-editor"]),operation:B.enum(["replace-static-classname","replace-expression","create-attribute","remove-attribute"])});import{z as Ip}from"zod";var js=Ip.enum(["src","alt","poster","href","width","height"]);import{z as ft}from"zod";var qt=ft.object({editingSessionId:ft.string().min(1),lockId:ft.string().min(1),ownerId:ft.string().min(1),leaseAssertion:ft.string().min(1)}).strict(),zE="signed-designer-mutations-v1",BE=ft.object({mutationContext:qt}).strict();import{z as d}from"zod";import{z as Gt}from"zod";var Tn="::",Os=Gt.object({file:Gt.string().min(1),component:Gt.string().min(1),structuralPath:Gt.string().min(1),key:Gt.string().min(1)}).superRefine((t,n)=>{let s=Rp(t.file,t.component,t.structuralPath);t.key!==s&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function Rp(t,n,s){return`${t}${Tn}${n}${Tn}${s}`}function HE(t){let[n,s,...a]=t.split(Tn);return!n||!s||a.length===0?null:{file:n,component:s,structuralPath:a.join(Tn)}}var kn=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"]),Kt=d.object({code:d.string().min(1),message:d.string().min(1)}).strict(),Tp=d.union([d.object({kind:d.literal("virtual-route-root"),key:d.string().min(1)}).strict(),d.object({kind:d.literal("jsx-container"),key:d.string().min(1),sourceMemberKey:d.string().min(1),sourceFile:d.string().min(1),componentName:d.string().min(1).optional()}).strict(),d.object({kind:d.literal("starter-placeholder"),key:d.string().min(1),sourceFile:d.string().min(1).optional()}).strict()]),kp=d.object({key:d.string().min(1),kind:d.enum(["jsx-element","jsx-fragment","jsx-expression","null-return","starter-placeholder"]),containerKey:d.string().min(1),label:d.string().min(1),sourceFile:d.string().min(1).optional(),isAtomic:d.boolean()}).strict(),Pp=d.object({key:d.string().min(1),sourceMemberKey:d.string().min(1),containerKey:d.string().min(1),label:d.string().min(1),isIndependent:d.boolean()}).strict(),wp=d.object({key:d.string().min(1),containerKey:d.string().min(1),businessMemberKeys:d.array(d.string().min(1)),isMultiMember:d.boolean()}).strict(),oo=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:ne}).strict(),Ap=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:L,placementUnitKey:d.string().min(1),relation:d.enum(["before","after","prepend","append"])}).strict(),ro=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:ne,placementUnitKey:d.string().min(1),relation:d.enum(["before","after","prepend","append"])}).strict(),co=d.object({kind:d.literal("page-unit"),composition:ne,placementUnitKey:d.string().min(1)}).strict(),mo=d.object({kind:d.literal("page-unit"),composition:L,placementUnitKey:d.string().min(1)}).strict();function qe(t,n,s,a,i){let r=new Set;for(let[_,c]of t.entries()){let g=a(c);r.has(g)&&n.addIssue({code:"custom",path:[s,_,i],message:`Duplicate ${s} key: ${g}`}),r.add(g)}}var vp=d.object({status:d.literal("supported"),version:d.number().int().nonnegative(),composition:L,container:Tp,sourceMembers:d.array(kp),businessMembers:d.array(Pp),placementUnits:d.array(wp),placements:d.array(Ap)}).strict().superRefine((t,n)=>{qe(t.sourceMembers,n,"sourceMembers",c=>c.key,"key"),qe(t.businessMembers,n,"businessMembers",c=>c.key,"key"),qe(t.placementUnits,n,"placementUnits",c=>c.key,"key"),qe(t.placements,n,"placements",c=>c.placementKey,"placementKey");let s=new Set(t.sourceMembers.map(c=>c.key)),a=new Set(t.placementUnits.map(c=>c.key)),i=new Map(t.sourceMembers.map(c=>[c.key,c])),r=new Map(t.businessMembers.map(c=>[c.key,c]));for(let[c,g]of t.sourceMembers.entries()){g.containerKey!==t.container.key&&!s.has(g.containerKey)&&n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member parent must reference the page container or another source member."}),g.containerKey===g.key&&n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member cannot contain itself."});let j=new Set([g.key]),E=g.containerKey;for(;E!==t.container.key;){if(j.has(E)){n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member hierarchy must be acyclic."});break}j.add(E);let O=i.get(E);if(!O)break;E=O.containerKey}}t.container.kind==="jsx-container"&&!s.has(t.container.sourceMemberKey)&&n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."});for(let[c,g]of t.businessMembers.entries())s.has(g.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",c,"sourceMemberKey"],message:"Business member must reference a source member."}),a.has(g.containerKey)||n.addIssue({code:"custom",path:["businessMembers",c,"containerKey"],message:"Business member must reference a placement unit container."});for(let[c,g]of t.placementUnits.entries()){let j=i.get(g.containerKey);j?j.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",c,"containerKey"],message:"Placement unit must reference a direct child of the page container."}):n.addIssue({code:"custom",path:["placementUnits",c,"containerKey"],message:"Placement unit containerKey must reference a source member."});let E=new Set;for(let[O,F]of g.businessMemberKeys.entries()){let q=r.get(F);if(!q){n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Placement unit must reference existing business members."});continue}E.has(F)&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Placement unit cannot reference the same business member twice."}),E.add(F),q.containerKey!==g.key&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Business member containerKey must match its placement unit."});let ee=q.sourceMemberKey,ae=new Set;for(;ee&&ee!==g.containerKey&&!ae.has(ee);)ae.add(ee),ee=i.get(ee)?.containerKey;ee!==g.containerKey&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Placement unit business members must belong to its source subtree."})}}for(let[c,g]of t.businessMembers.entries())t.placementUnits.find(E=>E.key===g.containerKey)?.businessMemberKeys.includes(g.key)||n.addIssue({code:"custom",path:["businessMembers",c,"containerKey"],message:"Business member must be listed by its placement unit container."});let _=new Map;for(let c of t.placementUnits)_.set(c.containerKey,(_.get(c.containerKey)??0)+1);for(let[c,g]of t.sourceMembers.entries())g.containerKey===t.container.key&&_.get(g.key)!==1&&n.addIssue({code:"custom",path:["sourceMembers",c,"key"],message:"Every direct source member must be owned by exactly one placement unit."});for(let[c,g]of t.placements.entries())uo(g.composition,t.composition)||n.addIssue({code:"custom",path:["placements",c,"composition"],message:"Page placement composition must match page composition."}),g.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",c,"documentVersion"],message:"Page placement version must match page composition version."}),a.has(g.placementUnitKey)||n.addIssue({code:"custom",path:["placements",c,"placementUnitKey"],message:"Placement option must reference an existing placement unit."})}),Cp=d.object({status:d.literal("unsupported"),version:d.number().int().nonnegative(),composition:L,reason:kn,diagnostics:d.array(Kt)}).strict(),Dp=d.discriminatedUnion("status",[vp,Cp]),lo=2,QE="page-composition-v2",po=d.object({start:d.number().int().nonnegative(),end:d.number().int().nonnegative(),startLine:d.number().int().positive().optional(),startColumn:d.number().int().nonnegative().optional(),endLine:d.number().int().positive().optional(),endColumn:d.number().int().nonnegative().optional()}).strict().superRefine((t,n)=>{t.end<t.start&&n.addIssue({code:"custom",path:["end"],message:"Source range end must be greater than or equal to start."});let s=[t.startLine,t.startColumn,t.endLine,t.endColumn],a=s.some(r=>r!==void 0),i=s.every(r=>r!==void 0);a&&!i&&n.addIssue({code:"custom",path:["startLine"],message:"Source line and column locations must be provided together."}),t.startLine!==void 0&&t.endLine!==void 0&&t.endLine<t.startLine&&n.addIssue({code:"custom",path:["endLine"],message:"Source range endLine must not precede startLine."}),t.startLine!==void 0&&t.endLine===t.startLine&&t.startColumn!==void 0&&t.endColumn!==void 0&&t.endColumn<t.startColumn&&n.addIssue({code:"custom",path:["endColumn"],message:"Source range endColumn must not precede startColumn."})}),jp=d.object({key:d.string().min(1),instanceIndex:d.number().int().nonnegative().optional(),instanceCount:d.number().int().positive().optional(),textSegmentIndex:d.number().int().nonnegative().optional()}).strict().superRefine((t,n)=>{t.instanceIndex!==void 0&&t.instanceCount!==void 0&&t.instanceIndex>=t.instanceCount&&n.addIssue({code:"custom",path:["instanceIndex"],message:"instanceIndex must be lower than instanceCount."})}),Op=d.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),Np=d.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),Lp=d.discriminatedUnion("kind",[d.object({kind:d.literal("virtual-route-root"),key:d.null(),routeReturn:d.object({sourceIdentity:Os,sourceRange:po}).strict()}).strict(),d.object({kind:d.literal("jsx-container"),key:d.string().min(1),sourceMemberKey:d.string().min(1)}).strict(),d.object({kind:d.literal("starter-placeholder"),key:d.string().min(1),sourceMemberKey:d.string().min(1),replacementMode:d.literal("replace")}).strict()]),Mp=d.object({key:d.string().min(1),kind:Op,parentKey:d.string().min(1).nullable(),childKeys:d.array(d.string().min(1)),order:d.number().int().nonnegative(),label:d.string().min(1),sourceIdentity:Os,sourceRange:po.nullable(),atomicKind:Np}).strict().superRefine((t,n)=>{let s=t.kind==="component-call"||t.kind==="native-jsx"?"none":t.kind;t.atomicKind!==s&&n.addIssue({code:"custom",path:["atomicKind"],message:`atomicKind must be ${s} for ${t.kind}.`});let a=new Set;for(let[i,r]of t.childKeys.entries())a.has(r)&&n.addIssue({code:"custom",path:["childKeys",i],message:`Duplicate child source member key: ${r}`}),a.add(r)}),Up=d.object({key:d.string().min(1),sourceMemberKey:d.string().min(1),placementUnitKey:d.string().min(1),label:d.string().min(1),isIndependent:d.boolean()}).strict(),Fp=d.enum(["independent","atomic","container"]),qp=d.object({key:d.string().min(1),containerKey:d.string().min(1).nullable(),sourceMemberKeys:d.array(d.string().min(1)).min(1),businessMemberKeys:d.array(d.string().min(1)),order:d.number().int().nonnegative(),boundaryMode:Fp,isIndependent:d.boolean(),isMultiMember:d.boolean()}).strict().superRefine((t,n)=>{ao(t.sourceMemberKeys,n,"sourceMemberKeys","source member"),ao(t.businessMemberKeys,n,"businessMemberKeys","business member");let s=t.sourceMemberKeys.length>1||t.businessMemberKeys.length>1;t.isMultiMember!==s&&n.addIssue({code:"custom",path:["isMultiMember"],message:"isMultiMember must reflect the source and business member cardinality."});let a=t.boundaryMode==="independent";t.isIndependent!==a&&n.addIssue({code:"custom",path:["isIndependent"],message:"isIndependent must match boundaryMode."})}),Gp=d.enum(["before","after","prepend","append","replace"]),Kp=d.enum(["insert-sibling","insert-child","replace-placeholder"]),zp=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:L,placementUnitKey:d.string().min(1),containerKey:d.string().min(1).nullable(),relation:Gp,writeMode:Kp}).strict().superRefine((t,n)=>{let s=t.relation==="before"||t.relation==="after"?"insert-sibling":t.relation==="prepend"||t.relation==="append"?"insert-child":"replace-placeholder";t.writeMode!==s&&n.addIssue({code:"custom",path:["writeMode"],message:`writeMode must be ${s} for ${t.relation}.`})}),Bp=d.object({key:d.string().min(1),placementUnitKey:d.string().min(1),runtimeRefs:d.array(jp).min(1)}).strict(),Wp=d.object({schemaVersion:d.literal(lo),status:d.literal("supported"),version:d.number().int().nonnegative(),composition:L,container:Lp,sourceMembers:d.array(Mp),businessMembers:d.array(Up),placementUnits:d.array(qp),placements:d.array(zp),visualAnchors:d.array(Bp).optional(),diagnostics:d.array(Kt)}).strict().superRefine((t,n)=>{$p(t,n)}),Vp=d.object({schemaVersion:d.literal(lo),status:d.literal("unsupported"),version:d.number().int().nonnegative(),composition:L,reason:kn,diagnostics:d.array(Kt)}).strict(),Hp=d.discriminatedUnion("status",[Wp,Vp]),JE=d.union([Hp,Dp]);function ao(t,n,s,a){let i=new Set;for(let[r,_]of t.entries())i.has(_)&&n.addIssue({code:"custom",path:[s,r],message:`Duplicate ${a} key: ${_}`}),i.add(_)}function uo(t,n){return ms(t)===ms(n)}function $p(t,n){qe(t.sourceMembers,n,"sourceMembers",E=>E.key,"key"),qe(t.businessMembers,n,"businessMembers",E=>E.key,"key"),qe(t.placementUnits,n,"placementUnits",E=>E.key,"key"),qe(t.placements,n,"placements",E=>E.placementKey,"placementKey"),qe(t.visualAnchors??[],n,"visualAnchors",E=>E.key,"key"),Yp(t,n);let s=new Map(t.sourceMembers.map(E=>[E.key,E])),a=new Map(t.businessMembers.map(E=>[E.key,E])),i=new Map(t.placementUnits.map(E=>[E.key,E]));Xp(t,s,n),t.container.kind!=="virtual-route-root"&&(s.has(t.container.sourceMemberKey)||n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."}));let r=new Map,_=new Map,c=new Set;for(let[E,O]of t.placementUnits.entries()){O.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",E,"containerKey"],message:"Placement unit containerKey must match the page container."});let F=`${O.containerKey??"<virtual>"}:${O.order}`;c.has(F)&&n.addIssue({code:"custom",path:["placementUnits",E,"order"],message:"Placement unit order must be unique within its container."}),c.add(F);for(let[q,ee]of O.sourceMemberKeys.entries()){s.has(ee)||n.addIssue({code:"custom",path:["placementUnits",E,"sourceMemberKeys",q],message:"Placement unit must reference existing source members."});let ae=r.get(ee);ae&&ae!==O.key&&n.addIssue({code:"custom",path:["placementUnits",E,"sourceMemberKeys",q],message:`Source member is already assigned to ${ae}.`}),r.set(ee,O.key)}for(let[q,ee]of O.businessMemberKeys.entries()){let ae=a.get(ee);if(!ae){n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",q],message:"Placement unit must reference existing business members."});continue}ae.placementUnitKey!==O.key&&n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",q],message:"Placement unit and business member must reference each other."}),O.sourceMemberKeys.includes(ae.sourceMemberKey)||n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",q],message:"Business member sourceMemberKey must belong to the placement unit."});let At=_.get(ee);At&&At!==O.key&&n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",q],message:`Business member is already assigned to ${At}.`}),_.set(ee,O.key)}}for(let[E,O]of t.businessMembers.entries()){s.has(O.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",E,"sourceMemberKey"],message:"Business member must reference a source member."});let F=i.get(O.placementUnitKey);if(!F){n.addIssue({code:"custom",path:["businessMembers",E,"placementUnitKey"],message:"Business member must reference a placement unit."});continue}F.businessMemberKeys.includes(O.key)||n.addIssue({code:"custom",path:["businessMembers",E,"placementUnitKey"],message:"Business member and placement unit must reference each other."}),F.sourceMemberKeys.includes(O.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",E,"sourceMemberKey"],message:"Business member sourceMemberKey must belong to its placement unit."});let q=F.isIndependent&&F.businessMemberKeys.length===1;O.isIndependent!==q&&n.addIssue({code:"custom",path:["businessMembers",E,"isIndependent"],message:"Business member independence must match its placement unit boundary."})}let g=new Set;for(let[E,O]of t.placements.entries()){O.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",E,"documentVersion"],message:"Page placement version must match page composition version."}),uo(O.composition,t.composition)||n.addIssue({code:"custom",path:["placements",E,"composition"],message:"Page placement composition must match page composition."});let F=i.get(O.placementUnitKey);F?O.containerKey!==F.containerKey&&n.addIssue({code:"custom",path:["placements",E,"containerKey"],message:"Placement containerKey must match its placement unit."}):n.addIssue({code:"custom",path:["placements",E,"placementUnitKey"],message:"Placement option must reference a placement unit."});let q=`${O.placementUnitKey}:${O.relation}`;g.has(q)&&n.addIssue({code:"custom",path:["placements",E,"relation"],message:"A placement unit cannot expose the same relation more than once."}),g.add(q),O.relation==="replace"&&t.container.kind!=="starter-placeholder"&&n.addIssue({code:"custom",path:["placements",E,"relation"],message:"replace is only valid for a starter placeholder container."}),t.container.kind==="starter-placeholder"&&O.relation!=="replace"&&n.addIssue({code:"custom",path:["placements",E,"relation"],message:"Starter placeholder placements must use replace."})}let j=new Set;for(let[E,O]of(t.visualAnchors??[]).entries())i.has(O.placementUnitKey)||n.addIssue({code:"custom",path:["visualAnchors",E,"placementUnitKey"],message:"Visual anchor must reference a placement unit."}),j.has(O.placementUnitKey)&&n.addIssue({code:"custom",path:["visualAnchors",E,"placementUnitKey"],message:"A placement unit may expose only one visual anchor."}),j.add(O.placementUnitKey)}function Yp(t,n){let s=[];t.container.key!==null&&s.push({key:t.container.key,path:["container","key"],namespace:"container"});for(let[i,r]of t.sourceMembers.entries())s.push({key:r.key,path:["sourceMembers",i,"key"],namespace:"source member"});for(let[i,r]of t.businessMembers.entries())s.push({key:r.key,path:["businessMembers",i,"key"],namespace:"business member"});for(let[i,r]of t.placementUnits.entries())s.push({key:r.key,path:["placementUnits",i,"key"],namespace:"placement unit"});for(let[i,r]of(t.visualAnchors??[]).entries())s.push({key:r.key,path:["visualAnchors",i,"key"],namespace:"visual anchor"});let a=new Map;for(let i of s){let r=a.get(i.key);r?n.addIssue({code:"custom",path:i.path,message:`${i.namespace} key collides with ${r}: ${i.key}`}):a.set(i.key,i.namespace)}}function Xp(t,n,s){let a=new Set;for(let[i,r]of t.sourceMembers.entries()){let _=`${r.parentKey??"<root>"}:${r.order}`;if(a.has(_)&&s.addIssue({code:"custom",path:["sourceMembers",i,"order"],message:"Source member order must be unique among siblings."}),a.add(_),r.parentKey===r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member cannot be its own parent."}),r.parentKey!==null){let j=n.get(r.parentKey);j?j.childKeys.includes(r.key)||s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member parentKey must reference a source member."})}for(let[j,E]of r.childKeys.entries()){if(E===r.key){s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source member cannot be its own child."});continue}let O=n.get(E);O?O.parentKey!==r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source child key must reference a source member."})}let c=new Set,g=r;for(;g;){if(c.has(g.key)){s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member graph must be acyclic."});break}c.add(g.key),g=g.parentKey===null?void 0:n.get(g.parentKey)}}}var zt=p.enum(["update-text","update-array-item","remove-node","insert-child","move-node","set-class-name-source","set-props","apply-style-draft","source-edit","insert-page-resource","delete-page-source"]),go=p.lazy(()=>p.union([p.string(),p.number(),p.boolean(),p.null(),p.array(go),p.record(p.string(),go)])),Zp=p.discriminatedUnion("kind",[p.object({kind:p.literal("node"),key:p.string().min(1)}).strict(),co,p.object({kind:p.literal("route"),composition:ne}).strict(),p.object({kind:p.literal("source-file"),path:le}).strict(),p.object({kind:p.literal("source-batch"),paths:p.array(le).min(1)}).superRefine((t,n)=>{let s=new Set;for(let[a,i]of t.paths.entries())s.has(i)&&n.addIssue({code:"custom",path:["paths",a],message:`Duplicate source target path: ${i}`}),s.add(i)}).strict(),p.object({kind:p.literal("project")}).strict()]),Qp=p.discriminatedUnion("kind",[p.object({kind:p.literal("node"),key:p.string().min(1)}).strict(),mo,p.object({kind:p.literal("route"),composition:L}).strict(),p.object({kind:p.literal("source-file"),path:le}).strict(),p.object({kind:p.literal("source-batch"),paths:p.array(le).min(1)}).strict(),p.object({kind:p.literal("project")}).strict()]),ho=p.enum(["display","position","top","right","bottom","left","zIndex","flexDirection","flexWrap","flexGrow","flexShrink","flexBasis","order","gridTemplateColumns","gridTemplateRows","columns","gridColumn","gridRow","gap","gapX","gapY","spaceX","spaceY","alignItems","justifyContent","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","width","height","minWidth","minHeight","maxWidth","maxHeight","overflow","fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","textAlign","textTransform","textDecoration","textOverflow","textIndent","writingMode","whiteSpace","wordBreak","lineClamp","fontVariantNumeric","screenReaderOnly","color","backgroundColor","backgroundImage","backgroundRepeat","backgroundSize","backgroundPosition","backgroundAttachment","backgroundClip","backgroundOrigin","borderStyle","borderWidth","borderRadius","borderColor","objectFit","objectPosition","aspectRatio","opacity","boxShadow","transform","transformOrigin","transitionProperty","transitionDuration","transitionTimingFunction","animation","pointerEvents","cursor","userSelect","fontStyle","textUnderlineOffset","scrollMarginTop","alignSelf","flex","outlineStyle","resize","ringWidth","ringColor","backdropFilter","overscrollBehavior","divideWidth","divideColor"]),So=p.enum(["hover","active","focus","disabled"]),fo=p.enum(["sm","md","lg","xl","2xl"]),_o=p.union([p.object({relation:p.enum(["before","after"]),anchorKey:p.string().min(1)}),p.object({relation:p.enum(["prepend","append"]),parentKey:p.string().min(1)}),ro]),Jp=p.union([p.object({kind:p.literal("native-tag"),tag:p.string().min(1),text:p.string().optional()}),p.object({kind:p.literal("component-call"),component:p.object({source:p.string().min(1),exportName:p.string().min(1)}),materialization:p.never().optional(),props:p.record(p.string(),p.unknown()).optional()}).strict(),p.object({kind:p.literal("component-call"),component:p.never().optional(),materialization:at,props:p.record(p.string(),p.never()).optional()}).strict()]),ed=p.discriminatedUnion("kind",[p.object({kind:p.literal("update-text"),segmentIndex:p.number().int().min(0),value:p.string()}),p.object({kind:p.literal("update-array-item"),segmentIndex:p.number().int().min(0),index:p.number().int().min(0),value:p.string()}),p.object({kind:p.literal("remove-node")}),p.object({kind:p.literal("insert-child"),node:Jp,position:p.union([_o,oo])}),p.object({kind:p.literal("move-node"),target:_o,preserveBindings:p.boolean().optional()}),p.object({kind:p.literal("set-class-name-source"),filePath:p.string().min(1),expectedVersion:p.object({documentVersion:p.number().int().nonnegative(),contentHash:p.string().min(1)}),oldAttrRaw:p.string().min(1).nullable(),oldAttrRange:ct.nullable(),openingElementRange:ct,newAttrRaw:p.string().min(1).nullable(),intent:Ds}),p.object({kind:p.literal("set-props"),props:p.partialRecord(js,p.string())}),p.object({kind:p.literal("apply-style-draft"),className:p.object({filePath:p.string().min(1),expectedVersion:p.object({documentVersion:p.number().int().nonnegative(),contentHash:p.string().min(1)}),oldAttrRaw:p.string().min(1).nullable(),oldAttrRange:ct.nullable(),openingElementRange:ct,newAttrRaw:p.string().min(1).nullable(),intent:Ds}).optional(),props:p.partialRecord(js,p.string()).optional()}).superRefine((t,n)=>{!t.className&&!t.props&&n.addIssue({code:"custom",message:"apply-style-draft requires className or props"})}),p.object({kind:p.literal("source-edit"),conflictPolicy:p.enum(["compare-and-swap","overwrite"]),edits:p.array(p.discriminatedUnion("operation",[p.object({operation:p.literal("upsert"),path:le,content:p.string(),baseContentHash:p.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{ps(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit upsert only accepts allowlisted text source files"}),t.content.includes("\0")&&n.addIssue({code:"custom",path:["content"],message:"source-edit content must be valid text"})}),p.object({operation:p.literal("delete"),path:le,capability:ra,confirmDelete:p.literal(!0),confirmPath:le,baseContentHash:p.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{t.capability!==ls&&n.addIssue({code:"custom",path:["capability"],message:"delete requires source-delete capability"}),t.confirmPath!==t.path&&n.addIssue({code:"custom",path:["confirmPath"],message:"delete confirmation path must match edit path"}),ps(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit delete only accepts allowlisted text source files"});let s=ds(t.path);s&&n.addIssue({code:"custom",path:["path"],message:`Protected source file cannot be deleted: ${t.path} (${s})`})})])).min(1),reason:p.string().min(1).optional()}).strict().superRefine((t,n)=>{let s=new Set;for(let[a,i]of t.edits.entries())s.has(i.path)&&n.addIssue({code:"custom",path:["edits",a,"path"],message:`Duplicate source edit path: ${i.path}`}),s.add(i.path),t.conflictPolicy==="compare-and-swap"&&i.baseContentHash===void 0&&n.addIssue({code:"custom",path:["edits",a,"baseContentHash"],message:"source-edit compare-and-swap requires baseContentHash for every edit"})}),p.object({kind:p.literal("insert-page-resource"),artifact:vs}).strict(),p.object({kind:p.literal("delete-page-source"),expectedUrlPath:p.string().startsWith("/")}).strict()]),bo=p.enum(["NODE_NOT_FOUND","HOME_PAGE_LOCKED","ROUTE_NOT_FOUND","CAPABILITY_REJECTED","CONSTRAINT_VIOLATED","INVALID_PARAMS","PLAN_FAILED","TRANSACTION_PREFLIGHT_FAILED","ROUTE_REBUILD_FAILED","HISTORY_COMMIT_FAILED","MATERIALIZATION_CONFLICT","MATERIALIZATION_REJECTED","MUTATION_ASSERTION_REQUIRED","MUTATION_ASSERTION_INVALID","VERSION_STALE","AST_PARSE_ERROR","UNSUPPORTED_OPERATION","LOCATOR_FAILED","INVALID_TARGET","WRITE_IO_ERROR","CONCURRENT_MODIFIED","ROLLBACK_FAILED","RECOVERY_REQUIRED","RECOVERY_PERSIST_FAILED","MUTATION_SESSION_REQUIRED","LEASE_ASSERTION_INVALID","LEASE_ASSERTION_EXPIRED","LEASE_ASSERTION_SCOPE_MISMATCH","CROSS_PAGE_MOVE_UNSUPPORTED","INTERNAL_ERROR"]),yo=p.object({code:bo,message:p.string().min(1),details:p.record(p.string(),p.unknown()).optional()}),xo=p.object({key:p.string().min(1),instanceIndex:p.number().int().nonnegative().optional(),instanceCount:p.number().int().positive().optional()}),Ns=p.object({id:p.string().min(1),siteId:I,baseSnapshotId:x,composition:ne,kind:zt,target:Zp,documentVersion:p.number().int().nonnegative(),selectionRef:xo.optional(),mutationContext:qt.optional(),params:ed}).strict().superRefine((t,n)=>{if(t.kind!==t.params.kind&&n.addIssue({code:"custom",path:["params","kind"],message:"params.kind must match operation kind"}),t.kind==="source-edit"){if(t.target.kind!=="source-file"&&t.target.kind!=="source-batch")n.addIssue({code:"custom",path:["target","kind"],message:"source-edit requires a source-file or source-batch target"});else if(t.params.kind==="source-edit"){let s=t.params.edits.map(i=>i.path),a=t.target.kind==="source-file"?[t.target.path]:t.target.paths;id(s,a)||n.addIssue({code:"custom",path:["target"],message:"source-edit target paths must match edit paths"})}}else(t.target.kind==="source-file"||t.target.kind==="source-batch")&&n.addIssue({code:"custom",path:["target","kind"],message:"source targets are only valid for source-edit"});t.target.kind==="page-unit"&&(t.kind!=="insert-child"&&t.kind!=="move-node"&&t.kind!=="remove-node"&&n.addIssue({code:"custom",path:["target","kind"],message:"page-unit target is only valid for page-level operations"}),t.kind==="move-node"&&t.params.kind==="move-node"&&(!("kind"in t.params.target)||t.params.target.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","target","kind"],message:"page-unit move-node target requires page-composition placement"})),t.params.kind==="insert-child"&&"kind"in t.params.position&&t.params.position.kind==="page-composition"&&t.target.kind!=="page-unit"&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-composition position requires page-unit target"}),t.kind==="insert-page-resource"||t.kind==="delete-page-source"?t.target.kind!=="project"&&n.addIssue({code:"custom",path:["target","kind"],message:`${t.kind} requires a project target`}):t.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project target is only valid for insert-page-resource or delete-page-source"}),t.kind==="insert-child"&&t.target.kind==="page-unit"&&t.params.kind==="insert-child"&&(!("kind"in t.params.position)||t.params.position.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-unit target requires page-composition position"})}),dI=Ns,td=p.object({kind:p.literal("insert-page-resource"),package_instance_id:p.string().min(1),pages:p.array($a).min(1)}).strict().superRefine((t,n)=>{let s=new Set,a=new Set;for(let[i,r]of t.pages.entries())s.has(r.template_page_id)&&n.addIssue({code:"custom",path:["pages",i,"template_page_id"],message:`Duplicate template page route mapping: ${r.template_page_id}`}),a.has(r.final_route)&&n.addIssue({code:"custom",path:["pages",i,"final_route"],message:`Duplicate final route mapping: ${r.final_route}`}),s.add(r.template_page_id),a.add(r.final_route)}),nd=p.object({kind:p.literal("delete-page-source"),deleted_files:p.array(p.string().min(1)),updated_files:p.array(p.string().min(1)),preserved_shared_files:p.array(p.string().min(1)),warnings:p.array(p.string().min(1))}).strict(),sd=p.discriminatedUnion("kind",[td,nd]),Eo=p.object({requestId:p.string().min(1),kind:zt,composition:L,target:Qp,resultVersion:p.number().int().nonnegative(),affectedFiles:p.array(p.string().min(1)).optional(),selectionRef:xo.optional(),output:sd.optional()}).strict(),Ls=Eo.superRefine((t,n)=>{let s=t.kind==="insert-page-resource"||t.kind==="delete-page-source";s&&t.target.kind!=="project"?n.addIssue({code:"custom",path:["target","kind"],message:`${t.kind} result requires a project target`}):!s&&t.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project result target requires a project operation"}),s&&!t.output&&n.addIssue({code:"custom",path:["output"],message:`${t.kind} result requires typed output`}),t.output&&t.output.kind!==t.kind&&n.addIssue({code:"custom",path:["output","kind"],message:"output.kind must match operation kind"})}),uI=no({dataSchema:Ls,codeSchema:bo,failureDataSchema:Eo.partial()});function id(t,n){return t.length===n.length&&t.every((s,a)=>s===n[a])}var ad=Z.enum(["component","page","pages"]),od=Z.object({resource_kind:ad,resource_name:Z.string().trim().min(1).max(200),file_count:Z.number().int().min(1).max(64),total_bytes:Z.number().int().min(0).max(4*1024*1024),content_digest:Z.string().regex(/^sha256:[a-f0-9]{64}$/),custom_prompt:Z.string().trim().min(1).max(4e3).optional(),final_routes:Z.array(Z.string().min(1)).max(64)}).strict(),rd=Z.discriminatedUnion("kind",[Z.object({kind:Z.literal("none")}).strict(),Z.object({kind:Z.literal("primary"),items:Z.array(Z.object({label:Z.string().trim().min(1).max(120),href:Z.string().startsWith("/").max(200)}).strict()).min(1).max(64)}).strict().superRefine((t,n)=>{let s=new Set;for(let[a,i]of t.items.entries())s.has(i.href)&&n.addIssue({code:"custom",path:["items",a,"href"],message:`Duplicate navigation href: ${i.href}`}),s.add(i.href)})]),cd=Z.object({base_snapshot_id:Z.string().min(1),operation:Ns,navigation_selection:rd.optional()}).strict().superRefine((t,n)=>{t.base_snapshot_id!==t.operation.baseSnapshotId&&n.addIssue({code:"custom",path:["operation","baseSnapshotId"],message:"Resource operation baseSnapshotId must match base_snapshot_id."})});function md(t){return t.kind==="insert-child"&&t.params.kind==="insert-child"&&t.params.node.kind==="component-call"&&"materialization"in t.params.node&&t.params.node.materialization?[t.params.node.materialization]:t.kind==="insert-page-resource"&&t.params.kind==="insert-page-resource"?[...t.params.artifact.components.map(n=>n.materialization),...t.params.artifact.pages.map(n=>n.materialization)]:[]}var Io=Z.object({id:Z.string().min(1),tenant_id:Z.string().min(1),site_id:Z.string().min(1),run_id:Z.string().min(1).optional(),correlation_id:Z.string().min(1).optional(),sent_at:Z.string().min(1),type:Z.literal("client.resource.operation.create"),payload:Z.object({client_message_id:Z.string().min(1),display:od,transient_resource_input:cd}).strict()}).strict().superRefine((t,n)=>{let{display:s,transient_resource_input:a}=t.payload;t.site_id!==a.operation.siteId&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","siteId"],message:"Resource operation siteId must match envelope site_id."});let i=s.resource_kind==="component"?"insert-child":"insert-page-resource";a.operation.kind!==i&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","kind"],message:`${s.resource_kind} resources require ${i}.`});let _=md(a.operation).flatMap(g=>g.files),c=_.reduce((g,j)=>g+new TextEncoder().encode(j.content).byteLength,0);if(_.length>xs&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate file count limit."}),c>Es&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate content byte limit."}),s.file_count!==_.length&&n.addIssue({code:"custom",path:["payload","display","file_count"],message:"Resource summary file_count must match the transient operation."}),s.total_bytes!==c&&n.addIssue({code:"custom",path:["payload","display","total_bytes"],message:"Resource summary total_bytes must match the transient operation."}),a.operation.kind==="insert-page-resource"&&a.operation.params.kind==="insert-page-resource"){let g=a.operation.params.artifact;g.resource_type!==s.resource_kind&&n.addIssue({code:"custom",path:["payload","display","resource_kind"],message:"Resource summary kind must match the page artifact resource_type."});let j=g.pages.map(E=>E.final_route);(j.length!==s.final_routes.length||j.some((E,O)=>E!==s.final_routes[O]))&&n.addIssue({code:"custom",path:["payload","display","final_routes"],message:"Resource summary final_routes must match the page artifact routes."})}if(a.navigation_selection?.kind==="primary"){let g=new Set(s.final_routes);for(let[j,E]of a.navigation_selection.items.entries())g.has(E.href)||n.addIssue({code:"custom",path:["payload","transient_resource_input","navigation_selection","items",j,"href"],message:"Navigation selection href must reference a final resource route."})}});import{z as T}from"zod";var ld=["with_website","without_website"],Pn=T.enum(ld),Ms=T.string().trim().url().refine(t=>{let n=new URL(t).protocol;return n==="http:"||n==="https:"},{message:"Website must use the http or https protocol."}),pd=["welcome","website_scan","customer_materials","analysis","diagnosis","strategy","structure_planning","preview_personalization","publishing"],Bt=T.enum(pd),dd=["company_info","website_crawl","website_basic_info_extract","website_metrics_evaluate","intelligent_analysis","strategy_recommendation"],To=T.enum(dd),ud=["started","running","succeeded","failed","invalidated"],ko=T.enum(ud),gd=["draft","structure_saved","generating","workspace_ready"],Us=T.enum(gd),_d=["not_deployed","deploying","deployed"],Fs=T.enum(_d),hd=["active","completed"],Sd=T.enum(hd),fd=["completed","current","locked"],bd=T.enum(fd),Po={draft:10,structure_saved:20,generating:30,workspace_ready:40},wo={not_deployed:10,deploying:20,deployed:30},Ao={active:10,completed:20},vo={started:10,running:20,succeeded:30,failed:40,invalidated:50};function wn(t){return new Map(Object.entries(t).map(([n,s])=>[s,n]))}var yd=wn(Po),xd=wn(wo),Ed=wn(Ao),Id=wn(vo);function II(t){let n=yd.get(t);if(!n)throw new Error(`Unknown site build status code: ${t}`);return n}function RI(t){let n=xd.get(t);if(!n)throw new Error(`Unknown site deployment status code: ${t}`);return n}function TI(t){let n=Ed.get(t);if(!n)throw new Error(`Unknown site workflow status code: ${t}`);return n}function kI(t){let n=Id.get(t);if(!n)throw new Error(`Unknown task execution status code: ${t}`);return n}function PI(t){return Po[t]}function wI(t){return wo[t]}function AI(t){return Ao[t]}function vI(t){return vo[t]}var qs=[{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}]}}],CI=qs[0].definitions,Co=T.number().int().min(1),Rd=T.object({id:G,flow_type:Pn,definition_version:Co,node_code:Bt,label:T.string().min(1),sort_order:T.number().int().min(1),is_enabled:T.boolean(),state:bd}),Do=T.object({id:Ji,tenant_id:T.string().min(1),site_id:I,workflow_id:Oe,node_code:Bt,task_type:To,external_task_id:T.string().min(1),execution_status:ko,idempotency_key:T.string().min(1),attempt_no:T.number().int().min(1),superseded_at:T.string().min(1).nullable(),created_at:T.string().min(1),updated_at:T.string().min(1)}),Td=T.object({id:Oe,tenant_id:T.string().min(1),site_id:I,flow_type:Pn,website:Ms.nullable(),definition_version:Co,current_node_code:Bt,status:Sd,started_at:T.string().min(1),completed_at:T.string().min(1).nullable(),created_at:T.string().min(1),updated_at:T.string().min(1)}),Gs=T.object({workflow:Td,menu:T.array(Rd),task_refs:T.array(Do),site:T.object({default_locale:pe.optional(),status:Us,deployment_status:Fs,archived_at:T.string().min(1).nullable(),current_sitemap_id:T.string().nullable().optional(),current_sitemap_version:T.number().int().positive().nullable().optional(),confirmed_sitemap_id:T.string().nullable().optional(),confirmed_sitemap_version:T.number().int().positive().nullable().optional(),structure_confirmed_at:T.string().min(1).nullable().optional(),current_snapshot_id:T.string().nullable(),deployed_url:T.string().url().nullable(),cms_site_id:T.string().min(1).nullish()})}),DI=M(Gs),jI=M(Do),Ro=T.array(T.string().min(1).max(64)).max(16).optional(),OI=T.discriminatedUnion("flow_type",[T.object({flow_type:T.literal("with_website"),website:Ms,client_capabilities:Ro}).strict(),T.object({flow_type:T.literal("without_website"),website:T.null().optional(),client_capabilities:Ro}).strict()]),NI=T.object({expected_current_node:T.literal("website_scan"),website:Ms}).strict(),LI=T.object({expected_current_node:Bt}).strict(),MI=T.object({expected_current_node:T.literal("publishing")}).strict(),kd=T.object({node_code:Bt,task_type:To,external_task_id:T.string().min(1).max(255),idempotency_key:T.string().min(1).max(255)}),UI=kd.extend({workflow_id:Oe}).strict(),FI=T.object({external_task_id:T.string().min(1).max(255),execution_status:ko}),Pd=T.object({previous_external_task_id:T.string().min(1).max(255),external_task_id:T.string().min(1).max(255),idempotency_key:T.string().min(1).max(255)}),qI=Pd.extend({workflow_id:Oe}).strict(),wd=T.object({previous_external_task_id:T.string().min(1).max(255),external_task_id:T.string().min(1).max(255),idempotency_key:T.string().min(1).max(255)}),GI=wd.extend({workflow_id:Oe}).strict(),KI=T.object({}).strict();function Ad(t,n,s){return t.find(a=>a.definition_version===s)?.definitions[n]}function vd(t,n){return Ad(qs,t,n)}function Cd(t,n=1){let s=vd(t,n);if(!s)throw new Error(`Unknown workflow definition: ${t} v${n}.`);return s}function Dd(t,n,s){let a=new Set(s);return t.filter(i=>i.published&&(i.required_client_capability===null||a.has(i.required_client_capability))).sort((i,r)=>r.definition_version-i.definition_version).map(i=>({definition_version:i.definition_version,items:i.definitions[n]}))[0]}function zI(t,n){return Dd(qs,t,n)}function BI(t,n){return Cd(t).findIndex(s=>s.node_code===n)}function WI(t,n){return t==="website_scan"?n==="website_crawl"||n==="website_basic_info_extract"||n==="website_metrics_evaluate":t==="customer_materials"?n==="company_info":t==="analysis"?n==="intelligent_analysis":t==="strategy"?n==="strategy_recommendation":!1}function VI(t,n){if(t===n)return n;if(!{started:["running","succeeded","failed","invalidated"],running:["succeeded","failed","invalidated"],succeeded:["invalidated"],failed:["invalidated"],invalidated:[]}[t].includes(n))throw new Error(`Invalid task execution status transition: ${t} -> ${n}`);return n}function HI(t,n){if(t===n)return n;if(!{draft:["structure_saved"],structure_saved:["generating","draft"],generating:["workspace_ready","structure_saved"],workspace_ready:[]}[t].includes(n))throw new Error(`Invalid site build status transition: ${t} -> ${n}`);return n}import{z as f}from"zod";var Ks=f.string().min(1).max(120).regex(/^[a-z][a-z0-9_-]*$/),Re=f.string().min(1).max(120).regex(/^[A-Za-z_][A-Za-z0-9_]*$/),jd=f.enum(["text","select","multi_select","tags","category_list","boolean","number"]),Wt=f.string().min(1).max(512).regex(/^\/(?:[^?#]*)$/),Od=f.object({minimum:f.number().finite(),maximum:f.number().finite(),step:f.number().finite().positive()}).strict().refine(t=>t.minimum<t.maximum,{message:"minimum must be less than maximum"}),Nd=f.string().trim().min(1).max(100),Oo=f.array(Nd).max(5).refine(t=>new Set(t.map(n=>n.toLowerCase())).size===t.length,{message:"popular_terms must be unique ignoring case"}),ZI=f.array(f.string()).max(20).transform(t=>{let n=new Set;return t.map(s=>s.trim()).filter(s=>{if(s.length===0||s.length>100)return!1;let a=s.toLowerCase();return n.has(a)?!1:(n.add(a),!0)}).slice(0,5)}),No=f.object({filter_enabled:f.boolean(),selected_fields:f.array(Re).max(64),selected_card_fields:f.array(Re).max(64).default([]),popular_terms_enabled:f.boolean().default(!1),popular_terms:Oo.optional()}).strict(),Ld=f.object({app_slug:Ks}).extend(No.shape).strict(),zs=f.object({kind:f.literal("product_search_confirmation"),baseline_snapshot_id:x,target_route_id:Wt,applications:f.array(f.object({app_slug:Ks,label:f.string().min(1).max(200),popular_terms:Oo.default([]),current_config:No.nullable().default(null),affected_routes:f.array(Wt).max(64).default([]),fields:f.array(f.object({field_name:Re,label:f.string().min(1).max(200),value_shape:jd,option_count:f.number().int().nonnegative().optional(),filter_meta:Od.optional()}).strict()).max(64)}).strict()).min(1).max(12),current_config:Ld.nullable().optional(),affected_routes:f.array(Wt).min(1).max(64).optional()}).strict(),Md=f.object({kind:f.literal("product_search_confirmation"),action:f.enum(["confirm","modify"]),app_slug:Ks,filter_enabled:f.boolean(),popular_terms_enabled:f.boolean().default(!1),selected_fields:f.array(Re).max(64),selected_card_fields:f.array(Re).max(64).default([])}).strict().superRefine((t,n)=>{t.filter_enabled&&t.selected_fields.length===0&&n.addIssue({code:"custom",path:["selected_fields"],message:"selected_fields must not be empty while filters are enabled"}),new Set(t.selected_fields).size!==t.selected_fields.length&&n.addIssue({code:"custom",path:["selected_fields"],message:"selected_fields must be unique"}),new Set(t.selected_card_fields).size!==t.selected_card_fields.length&&n.addIssue({code:"custom",path:["selected_card_fields"],message:"selected_card_fields must be unique"})}),An=f.union([Md,f.object({kind:f.literal("product_search_confirmation"),action:f.literal("cancel")}).strict()]),Vt=f.union([f.string().max(255),f.number().finite(),f.boolean()]),Ud=f.object({values:f.array(Vt).min(1).max(20).refine(t=>new Set(t.map(n=>`${typeof n}:${String(n)}`)).size===t.length,{message:"values must be unique"})}).strict(),Fd=f.object({min:f.number().finite().optional(),max:f.number().finite().optional(),include_unlabeled:f.boolean().optional()}).strict().refine(t=>t.min!==void 0||t.max!==void 0||t.include_unlabeled===!0,{message:"a numeric boundary or include_unlabeled is required"}).refine(t=>t.min===void 0||t.max===void 0||t.min<=t.max,{message:"min must not be greater than max"}),qd=f.object({q:f.string().max(200),page:f.number().int().min(1).max(500),page_size:f.union([f.literal(9),f.literal(20)]),sort:f.enum(["published_at_desc","published_at_asc","product_name_asc","product_name_desc"]),filters:f.record(Re,f.union([Ud,Fd])).superRefine((t,n)=>{Object.keys(t).length>12&&n.addIssue({code:"custom",message:"filters must contain at most 12 fields"})}),display_fields:f.array(Re).max(64).default([]),missing_count_fields:f.array(Re).max(12).default([]),relaxation_count_fields:f.array(Re).max(12).default([]),facets:f.array(f.object({field:Re,query:f.string().max(100),page:f.number().int().min(1).max(100),page_size:f.literal(10),include_values:f.array(Vt).max(20)}).strict()).max(8)}).strict(),jo=f.object({value:Vt,label:f.string().max(200),count:f.number().int().nonnegative()}).strict(),Gd=f.union([Vt,f.array(Vt).max(50)]),Kd=f.object({items:f.array(f.object({id:f.number().int().positive(),thumbnail:f.string().max(2048).nullable(),title:f.string().max(300),summary:f.string().max(2e3),category:f.string().max(300).nullable(),field_values:f.record(Re,Gd).default({}),url:f.string().min(1).max(2048)}).strict()).max(20),page:f.object({total:f.number().int().nonnegative(),page:f.number().int().positive(),page_size:f.union([f.literal(9),f.literal(20)])}).strict(),facets:f.array(f.object({field:Re,total:f.number().int().nonnegative(),page:f.number().int().positive(),page_size:f.literal(10),values:f.array(jo).max(10),selected_values:f.array(jo).max(20)}).strict()).max(8),missing_counts:f.record(Re,f.number().int().nonnegative()).default({}),relaxation_counts:f.record(Re,f.number().int().nonnegative()).default({})}).strict(),QI=f.object({contract_version:f.literal(1),request:qd,response:Kd}).strict();import{z as Ht}from"zod";var zd=["deployment_queued","prepare_source","build_artifact","publish_site","site_released","cleanup_release"],Bd=Ht.enum(zd),Wd=Ht.enum(["running","succeeded","failed"]),Vd=Ht.object({code:Bd,status:Wd,message:Ht.string().trim().min(1)}).strict(),Lo=Ht.array(Vd);import{z as R}from"zod";var Hd=R.enum(["pending","running","succeeded","failed"]),$d=R.enum(["TASK_FAILED","WEBSITE_UNREACHABLE"]),Yd=R.object({task_id:R.string().uuid(),site_url:R.string().url(),crawler_task_id:R.string().min(1).max(255).nullable(),crawler_error_code:$d.nullable().optional(),crawler_failure_stage:R.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]).nullable().optional(),page_count:R.number().int().min(0).max(20),status:Hd,error:R.string().nullable(),created_at:R.string().min(1),updated_at:R.string().min(1)}),iR=M(Yd),Bs=R.enum(["existing_site","new_site"]),Mo=R.enum(["google_indexing","ai_recommendation","qualification_verifiability","content_freshness","inquiry_form","inquiry_response","privacy_compliance","prohibited_content"]),Ws=R.object({label:R.string().trim(),value:R.union([R.string(),R.number(),R.boolean(),R.null()]),summary:R.string().trim(),tone:R.enum(["good","warn","bad","unknown"]),status:R.enum(["ok","unknown"])}),vn=R.object({key:R.string().trim().min(1).max(100),label:R.string().trim().min(1).max(100),value:R.union([R.string().max(1e3),R.number(),R.boolean(),R.null()]),tone:R.enum(["good","warn","bad","unknown"]),status:R.enum(["ok","unknown"]),evidence:R.string().trim().max(2e3).optional()}).strict(),Xd=R.object({url:R.string().url().max(2048),title:R.string().trim().max(300),words:R.number().int().nonnegative().max(1e7)}).strict(),Zd=R.object({site_url:R.string().url().max(2048),scanned_at:R.string().datetime({offset:!0}),reach:R.array(vn).max(64),trust:R.array(vn).max(64),convert:R.array(vn).max(64),safe:R.array(vn).max(64),pages:R.array(Xd).max(100)}).strict(),Cn=R.object({company_task_id:R.string().min(1).max(128),scan_task_id:R.string().min(1).max(128),type:Bs,result:R.object({company_name:R.string(),website:R.string().url().optional(),primary_product:R.string(),current_market:R.string(),qualifications:R.string(),scan_cards:R.record(R.string(),Ws),scan_result:Zd.optional()})}),Qd=R.object({saved:R.literal(!0),company_task_id:R.string().min(1).max(128),scan_task_id:R.string().min(1).max(128)}),aR=M(Qd),Jd=R.enum(["snapshot","task"]),eu=Cn.shape.result.extend({type:Bs,structured_facts:R.unknown().optional()}).extend({company_name:R.string(),primary_product:R.string(),current_market:R.string(),qualifications:R.string()}),tu=R.object({site_id:R.string().min(1).max(128),company_task_id:R.string().min(1).max(128),scan_task_id:R.string().min(1).max(128),type:Bs,data_source:Jd,result:eu}),oR=M(tu.nullable());import{z as ue}from"zod";var He=ue.enum(["company","product_service","case_qualification","market","contact_inquiry","privacy_compliance","news_freshness"]),nu=ue.object({ordinal:ue.number().int().min(1).max(1e4),path:ue.string().min(1).max(2048).refine(t=>!au(t),{message:"path must be a site-relative path, not an absolute URL"}),last_modified:ue.string().max(64).nullable()}).strict(),mR=ue.object({candidates:ue.array(nu).min(1).max(1e4),selection_limit:ue.number().int().min(1).max(19)}).strict().superRefine((t,n)=>{let s=t.candidates.map(a=>a.ordinal).sort((a,i)=>a-i);for(let[a,i]of s.entries())if(i!==a+1){n.addIssue({code:"custom",path:["candidates"],message:"candidates ordinals must be unique and consecutive from 1"});return}}),su=ue.object({ordinal:ue.number().int().positive().max(1e4),roles:ue.array(He).min(1).max(7)}).strict(),iu=ue.object({role:He,status:ue.enum(["selected","not_found"]),selected_ordinals:ue.array(ue.number().int().positive().max(1e4)).max(19)}).strict(),lR=ue.object({selections:ue.array(su).max(19),coverage:ue.array(iu).length(7)}).strict().superRefine((t,n)=>{let s=new Set;for(let[i,r]of t.coverage.entries())s.has(r.role)&&n.addIssue({code:"custom",path:["coverage",i,"role"],message:"coverage roles must be unique"}),s.add(r.role);for(let i of He.options)s.has(i)||n.addIssue({code:"custom",path:["coverage"],message:`coverage must include every page role (missing ${i})`});let a=new Map;for(let i of t.selections)for(let r of i.roles){let _=a.get(r)??new Set;_.add(i.ordinal),a.set(r,_)}for(let[i,r]of t.coverage.entries()){let _=a.get(r.role);r.selected_ordinals.some(g=>!_?.has(g))&&n.addIssue({code:"custom",path:["coverage",i,"selected_ordinals"],message:"selected_ordinals must reference selections carrying the same role"})}});function au(t){let n=t.toLowerCase();return n.startsWith("http://")||n.startsWith("https://")||t.startsWith("//")}import{z as h}from"zod";var gR=h.object({force_refresh:h.boolean().optional()}),Fo=h.enum(["running","succeeded","failed"]),ou=h.object({agent_id:h.string().min(1),name:h.string().min(1),icon:h.string().min(1),capability:h.string().min(1),data_source:h.string().min(1),output_topics:h.string().min(1)}),ru=h.object({site_mode:h.enum(["existing_site","new_site"]),scan_required:h.boolean(),scheduled_agent_ids:h.array(h.string().min(1)),omitted_agent_ids:h.array(h.string().min(1)),next_stage:h.enum(["diagnostic_report","strategy"])}),cu=h.object({t:h.string(),d:h.string(),evidence:h.object({from:h.string(),url:h.string().nullable().optional(),value:h.string().nullable().optional()})}),mu=h.enum(["complete","partial","insufficient_data","failed"]),lu=h.enum(["ok","failed","insufficient_data"]),Vs=h.object({agent_id:h.string().min(1),name:h.string().min(1),icon:h.string().min(1),status:lu,topics:h.array(h.object({topic_id:h.string().min(1),status:mu,evidence_refs:h.array(h.string())})).length(3),findings:h.array(cu).max(3),elapsed_ms:h.number().nonnegative(),note:h.string().optional(),error:h.string().optional()}),qo=h.object({total:h.number().int().nonnegative(),ok:h.number().int().nonnegative(),degraded:h.number().int().nonnegative(),total_findings:h.number().int().nonnegative(),elapsed_ms:h.number().nonnegative(),site_mode:h.enum(["existing_site","new_site"]).optional(),scheduled_agent_ids:h.array(h.string()).optional(),omitted_agent_ids:h.array(h.string()).optional(),scheduled:h.number().int().nonnegative().optional(),complete:h.number().int().nonnegative().optional(),partial:h.number().int().nonnegative().optional(),insufficient:h.number().int().nonnegative().optional(),failed:h.number().int().nonnegative().optional(),next_stage:h.enum(["diagnostic_report","strategy"]).optional()}),pu=h.object({agents_done:h.boolean(),analysis:h.record(h.string(),Vs),step4_scoring_input:h.unknown().optional(),summary:qo}),Go=h.object({job_id:h.string().min(1),site_id:h.string().min(1),model_version:h.string().min(1),output_locale:h.string().min(2),cached:h.boolean().optional(),status:Fo,result:pu.nullable().optional(),error:h.string().nullable().optional()}),_R=M(h.array(ou)),hR=M(ru),SR=M(Go),fR=M(Go.nullable()),Ge=h.object({id:h.union([h.number().int().nonnegative(),h.string().regex(/^(0|[1-9]\d*)$/u).transform(Number)]).pipe(h.number().int().nonnegative())}),Uo=h.object({percent:h.number().int().min(0).max(100),phase:h.enum(["preparing","analyzing","finalizing","completed","failed"]),stage:h.enum(["queued","baseline_ready","source_pages_ready","external_evidence_ready","knowledge_evidence_ready","page_evidence_ready","analysis_context_ready","preparation_saved","workflow_ready","agent_started","agent_completed","workflow_completed","scoring_input_ready","red_texts_ready","result_ready","result_persisted","completed","failed"]),agents_done:h.number().int().nonnegative(),agents_total:h.number().int().nonnegative(),agent_id:h.string().min(1).optional()}),bR=h.discriminatedUnion("event",[Ge.extend({event:h.literal("snapshot"),data:h.object({job_id:h.string().min(1),status:Fo,done:h.number().int().nonnegative(),total:h.number().int().nonnegative(),results:h.array(Vs),progress:Uo.optional()})}),Ge.extend({event:h.literal("progress"),data:Uo}),Ge.extend({event:h.literal("preparing_started"),data:h.object({stage:h.literal("baseline")})}),Ge.extend({event:h.literal("preparing_progress"),data:h.object({stage:h.enum(["context","external_evidence"])})}),Ge.extend({event:h.literal("preparing_done"),data:h.object({evidence_count:h.number().int().nonnegative(),rule_count:h.number().int().nonnegative(),degraded_capabilities:h.array(h.string())})}),Ge.extend({event:h.literal("agent_start"),data:h.object({agent_id:h.string().min(1),name:h.string().min(1),icon:h.string().min(1)})}),Ge.extend({event:h.literal("agent_done"),data:Vs}),Ge.extend({event:h.literal("done"),data:h.object({agents_done:h.literal(!0),summary:qo})}),Ge.extend({event:h.literal("failed"),data:h.object({message:h.string().min(1)})})]);import{z as v}from"zod";var $s=v.enum(["reach","trust","convert","safe"]),ye=v.number().finite(),du=v.number().finite().positive(),Hs=["reach","trust","convert","safe"],uu=17,gu=v.enum(["passed","partial","failed"]),_u=v.object({landing_page_mode:v.enum(["intent_dynamic","static","none"]),ab_test_enabled:v.boolean()}).strict(),hu=v.union([v.boolean(),v.number().finite(),gu,_u]).nullable(),Su=v.union([v.boolean(),v.number().finite()]).nullable(),fu=v.object({competitor_avg:v.number().finite(),score_items:v.record(v.string(),hu),penalty_items:v.record(v.string(),Su),red_texts:v.array(v.string())}).strict(),bu=v.record($s,fu),yu=v.object({key:$s,score:ye,pass_score:ye,gap:ye}),xu=v.object({key:v.string(),title:v.string(),is_redline_option:v.boolean().optional(),score:ye,max_score:du,pass_score:ye,passed:v.boolean(),description:v.string()}),Eu=v.object({key:$s,title:v.string(),alias:v.string(),slogan:v.string(),score:ye,max_score:v.literal(100),pass_score:ye,competitor_average:ye,status:v.enum(["reached","near","not_reached"]),status_name:v.enum(["\u8FBE\u6807","\u63A5\u8FD1","\u672A\u8FBE\u6807"]),summary:v.string(),sub_dimensions:v.array(xu),red_texts:v.array(v.string()),redline_hit:v.boolean().optional()}),Iu=v.object({id:v.number().int().positive(),task_code:v.string().min(1).max(128),is_sync:v.literal(0),status:v.literal("succeeded"),rules:bu,scores_list:v.object({overview:v.object({pass_scores:v.object({reach:ye,trust:ye,convert:ye,safe:ye}),total_score:ye,total_pass_score:ye,score_gap:ye,competitor_average_score:ye,scoring_criteria_text:v.string().min(1),gap_dimensions:v.array(yu).max(4),overall_passed:v.boolean(),all_scores_passed:v.boolean(),diagnosis_passed:v.boolean(),commitment_eligible:v.boolean(),safe_redline_hit:v.boolean()}),dimensions:v.array(Eu).length(4)}),created_at:v.string().datetime({offset:!0}),updated_at:v.string().datetime({offset:!0})}).superRefine((t,n)=>{Ru(t.scores_list.dimensions)||n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include each canonical score dimension."}),t.scores_list.dimensions.reduce((a,i)=>a+i.sub_dimensions.length,0)!==uu&&n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include 17 subdimensions in total."});for(let[a,i]of t.scores_list.dimensions.entries()){if(i.redline_hit===void 0)continue;let r=i.sub_dimensions.findIndex(_=>_.is_redline_option===void 0);r!==-1&&n.addIssue({code:"custom",path:["scores_list","dimensions",a,"sub_dimensions",r,"is_redline_option"],message:"subdimensions must define is_redline_option when redline_hit is defined."})}}),IR=M(Iu);function Ru(t){let n=t.map(s=>s.key);return n.length===Hs.length&&new Set(n).size===Hs.length&&Hs.every(s=>n.includes(s))}var $e={queued:["preparing_source","lock_failed","deploy_failed"],preparing_source:["building","source_prepare_failed","deploy_failed"],building:["artifact_ready","build_failed","artifact_fetch_failed","artifact_validation_failed","deploy_failed"],artifact_ready:["deploying","deploy_failed"],deploying:["released","deploy_failed"],released:[],lock_failed:[],source_prepare_failed:[],build_failed:[],artifact_fetch_failed:[],artifact_validation_failed:[],deploy_failed:[],cleanup_failed:[]};for(let t of Object.values($e))Object.freeze(t);Object.freeze($e);var kR=Object.freeze(_t.filter(t=>$e[t].length>0)),PR=Object.freeze(_t.filter(t=>$e[t].length===0)),Tu=Object.freeze(["preparing_source","building","artifact_ready","deploying","released"]),ku="DEPLOYMENT_TRANSITION_INVALID",Ys=class extends Error{constructor(n,s){super(`Invalid deployment transition: ${n} -> ${s}`),this.currentStatus=n,this.nextStatus=s,this.code=ku,this.name="DeploymentTransitionError"}};function wR(t){return $e[t]}function AR(t){return _t.filter(n=>$e[n].some(s=>s===t))}function Pu(t){return $e[t].length>0}function vR(t){return!Pu(t)}function CR(t,n){if(!$e[t].some(s=>s===n))throw new Ys(t,n);return n}function DR(){return Tu}import{z as wu}from"zod";var NR=".i18n.json",Dn="translation",Ko=new Set(["__proto__","constructor","prototype"]);function Bo(t){if(!jn(t)||Object.keys(t).length===0)return Ye("I18N_ROOT_INVALID","Component i18n resources must be a non-empty object.",[]);for(let[n,s]of Object.entries(t)){if(Ko.has(n))return zo([n]);if(!Au(n))return Ye("I18N_LOCALE_INVALID",`Component i18n locale must be canonical BCP-47: ${n}`,[n]);if(!jn(s))return Ye("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let a=Object.keys(s);if(a.length!==1||a[0]!==Dn)return Ye("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let i=s[Dn];if(!jn(i))return Ye("I18N_RESOURCE_TREE_INVALID",`Component i18n translation namespace for ${n} must be an object.`,[n,Dn]);let r=[{value:i,path:[n,Dn]}];for(;r.length>0;){let _=r.pop();for(let[c,g]of Object.entries(_.value)){let j=[..._.path,c];if(Ko.has(c))return zo(j);if(typeof g!="string"){if(!jn(g))return Ye("I18N_RESOURCE_TREE_INVALID","Component i18n resource leaves must be strings.",j);r.push({value:g,path:j})}}}}return{success:!0,data:t}}function LR(t){let n;try{n=JSON.parse(t)}catch{return Ye("I18N_JSON_INVALID","Component i18n resource file must contain valid JSON.",[])}return Bo(n)}var MR=wu.custom(t=>Bo(t).success,"Invalid component i18n resources.");function Au(t){try{let n=Intl.getCanonicalLocales(t);return n.length===1&&n[0]===t}catch{return!1}}function jn(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null}function zo(t){return Ye("I18N_RESOURCE_KEY_FORBIDDEN",`Component i18n resource key is forbidden: ${t.at(-1)??""}`,t)}function Ye(t,n,s){return{success:!1,error:{code:t,message:n,path:s}}}var Ke="products",vu=`/${Ke}`,FR=vu,qR=`${Ke} detail`,GR="cms_collection_view",KR="list",zR="detail",Ne={zhHans:{pageTitle:"\u4EA7\u54C1\u4E2D\u5FC3",blockLabel:"\u4EA7\u54C1\u6982\u89C8",detailBlockLabel:"\u4EA7\u54C1\u8BE6\u60C5",heroBlockLabel:"\u4EA7\u54C1\u7B80\u4ECB",homeLabel:"\u9996\u9875"},zhHant:{pageTitle:"\u7522\u54C1\u4E2D\u5FC3",blockLabel:"\u7522\u54C1\u6982\u89BD",detailBlockLabel:"\u7522\u54C1\u8A73\u60C5",heroBlockLabel:"\u7522\u54C1\u7C21\u4ECB",homeLabel:"\u9996\u9801"},en:{pageTitle:"Products",blockLabel:"Products overview",detailBlockLabel:"Product details",heroBlockLabel:"Products Introduction",homeLabel:"Home"},de:{pageTitle:"Produkte",blockLabel:"Produkt\xFCbersicht",detailBlockLabel:"Produktdetails",heroBlockLabel:"Produkteinf\xFChrung",homeLabel:"Startseite"},fr:{pageTitle:"Produits",blockLabel:"Aper\xE7u des produits",detailBlockLabel:"D\xE9tails du produit",heroBlockLabel:"Pr\xE9sentation des produits",homeLabel:"Accueil"},es:{pageTitle:"Productos",blockLabel:"Resumen de productos",detailBlockLabel:"Detalles del producto",heroBlockLabel:"Introducci\xF3n de productos",homeLabel:"Inicio"},ja:{pageTitle:"\u88FD\u54C1",blockLabel:"\u88FD\u54C1\u6982\u8981",detailBlockLabel:"\u88FD\u54C1\u8A73\u7D30",heroBlockLabel:"\u88FD\u54C1\u7D39\u4ECB",homeLabel:"\u30DB\u30FC\u30E0"},ko:{pageTitle:"\uC81C\uD488",blockLabel:"\uC81C\uD488 \uAC1C\uC694",detailBlockLabel:"\uC81C\uD488 \uC0C1\uC138",heroBlockLabel:"\uC81C\uD488 \uC18C\uAC1C",homeLabel:"\uD648"}},Cu=new Set(Object.values(Ne).map(t=>t.pageTitle)),Du=new Set(Object.values(Ne).flatMap(t=>[t.blockLabel,t.detailBlockLabel,t.heroBlockLabel]));function BR(t){let n=t?.trim().toLowerCase()??"";if(n==="zh-tw"||n==="zh-hk"||n==="zh-mo")return Ne.zhHant;if(n.startsWith("zh"))return Ne.zhHans;switch(n.split("-")[0]){case"de":return Ne.de;case"fr":return Ne.fr;case"es":return Ne.es;case"ja":return Ne.ja;case"ko":return Ne.ko;case"en":default:return Ne.en}}function WR(t){return Cu.has(t.trim())}function VR(t){return Du.has(t.trim())}import{z as ge}from"zod";var XR=ge.object({key:ge.string().min(1),composition:ne}).strict(),Nn=ge.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),ju=ge.enum(["direct","proxy","upstream","readonly","unsupported"]),Ou=ge.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),On=ge.object({mode:ju,reasonCode:ge.string().min(1).optional()}),Nu=ge.object({kind:Ou,message:ge.string().min(1)}),Ln=ge.object({composition:L,key:ge.string().min(1),canUpdateText:ge.boolean(),canInsertChild:ge.boolean(),canMove:ge.boolean(),canRemove:ge.boolean(),editModes:ge.object({updateText:On.optional(),insertChild:On.optional(),move:On.optional(),remove:On.optional()}).optional(),constraints:ge.array(Nu)}).strict();import{z}from"zod";var sT=z.discriminatedUnion("type",[z.object({type:z.literal("site-edit.document.changed"),siteId:I,snapshotId:x,composition:L,version:z.number().int().nonnegative(),at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.operation.planned"),siteId:I,operationId:z.string().min(1),baseSnapshotId:x,composition:L,changedFiles:z.array(z.string().min(1)),at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.operation.completed"),siteId:I,composition:L,result:Ls,at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.operation.failed"),siteId:I,composition:L,requestId:z.string().min(1),error:yo,at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.capability.changed"),siteId:I,composition:L,keys:z.array(z.string().min(1)),at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.graph.invalidated"),siteId:I,composition:L,at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.graph.ready"),siteId:I,composition:L,version:z.number().int().nonnegative(),at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.graph.error"),siteId:I,composition:L,message:z.string().min(1),at:z.string().min(1)}).strict()]);import{z as Q}from"zod";var rT="durable-history-v1",Mn=Q.object({initiatingComposition:L.optional(),affectedCompositions:Q.array(L)}).strict(),cT=Q.enum(["writable","read-only-recovery","unavailable"]),Lu=Q.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),Mu=Q.object({code:Lu,message:Q.string().min(1),occurredAt:Q.iso.datetime().optional()}).strict(),Uu=Q.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),Wo={revision:Q.number().int().nonnegative(),undoDepth:Q.number().int().nonnegative(),redoDepth:Q.number().int().nonnegative()},Fu=Q.object({mode:Q.literal("writable"),composition:L,...Wo,canUndo:Q.boolean(),canRedo:Q.boolean(),provenance:Mn.optional()}).strict().superRefine((t,n)=>{t.canUndo!==t.undoDepth>0&&n.addIssue({code:"custom",path:["canUndo"],message:"canUndo must reflect undoDepth."}),t.canRedo!==t.redoDepth>0&&n.addIssue({code:"custom",path:["canRedo"],message:"canRedo must reflect redoDepth."})}),qu=Q.object({mode:Q.literal("read-only-recovery"),composition:L,...Wo,canUndo:Q.literal(!1),canRedo:Q.literal(!1),recoveryDiagnostic:Mu,provenance:Mn.optional()}).strict(),Gu=Q.object({mode:Q.literal("unavailable"),composition:L,revision:Q.literal(0),undoDepth:Q.literal(0),redoDepth:Q.literal(0),canUndo:Q.literal(!1),canRedo:Q.literal(!1),reason:Uu,provenance:Mn.optional()}).strict(),Ku=Q.discriminatedUnion("mode",[Fu,qu,Gu]),mT=Q.object({composition:L,status:Ku,provenance:Mn}).strict();import{z as _e}from"zod";var zu=_e.string().min(1).refine(t=>!t.startsWith("/")&&!t.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),Bu=_e.string().regex(/^sha256:[a-f0-9]{64}$/),Wu=_e.object({path:zu,operation:_e.enum(["create","update","delete"]),expectedHash:Bu.optional(),fullContent:_e.string().optional()}).superRefine((t,n)=>{t.operation==="delete"&&t.fullContent!==void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"delete patches must not include fullContent"}),t.operation!=="delete"&&t.fullContent===void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"create/update patches must include fullContent"})}),Vu=_e.object({siteId:I,baseSnapshotId:x,operationId:_e.string().min(1),reason:_e.string().min(1),patches:_e.array(Wu).min(1),changedCompositions:_e.array(L),changedRouteIds:_e.array(_e.string().min(1)).optional(),diagnostics:_e.array(_e.object({code:_e.string().min(1),message:_e.string().min(1),path:_e.string().min(1).optional()})).default([])}).strict().superRefine((t,n)=>{let s=new Set;for(let[i,r]of t.patches.entries())s.has(r.path)&&n.addIssue({code:"custom",path:["patches",i,"path"],message:`Duplicate patch path: ${r.path}`}),s.add(r.path);let a=[...new Set(t.changedCompositions.map(i=>i.routeId))];t.changedRouteIds!==void 0&&(t.changedRouteIds.length!==a.length||t.changedRouteIds.some((i,r)=>i!==a[r]))&&n.addIssue({code:"custom",path:["changedRouteIds"],message:"changedRouteIds must be the stable deduplicated route projection of changedCompositions."})}),gT=Vu.transform(t=>({...t,changedRouteIds:[...new Set(t.changedCompositions.map(n=>n.routeId))]}));var Xs="::repeat-item#";function Hu(t,n){return`${t}${Xs}${n}`}function hT(t,n){return n.reduce((s,a)=>Hu(s,a),t)}function $u(t){if(typeof t!="string"||t.length===0)return null;let n=[],s=t;for(;;){let a=s.lastIndexOf(Xs);if(a<0)break;let i=Number(s.slice(a+Xs.length));if(!Number.isInteger(i)||i<0)return null;n.unshift({repeatIndex:i}),s=s.slice(0,a)}return!s||n.length===0?null:{baseKey:s,parts:n}}function ST(t){return $u(t)?.baseKey??t??null}import{z as m}from"zod";import{z as Ee}from"zod";var Yu=Ee.object({placementKey:Ee.string().min(1),placementUnitKey:Ee.string().min(1),relation:Ee.enum(["before","after","prepend","append"])}).strict(),Xu=Ee.object({status:Ee.literal("supported"),containerKey:Ee.string().min(1),hasBusinessMembers:Ee.boolean(),placementUnitKeys:Ee.array(Ee.string().min(1)),placements:Ee.array(Yu)}).strict().superRefine((t,n)=>{let s=new Set(t.placementUnitKeys);s.size!==t.placementUnitKeys.length&&n.addIssue({code:"custom",path:["placementUnitKeys"],message:"Render page composition placement unit keys must be unique."});let a=new Set;t.placements.forEach((i,r)=>{a.has(i.placementKey)&&n.addIssue({code:"custom",path:["placements",r,"placementKey"],message:"Render page composition placement keys must be unique."}),a.add(i.placementKey),s.has(i.placementUnitKey)||n.addIssue({code:"custom",path:["placements",r,"placementUnitKey"],message:"Render page composition placement must reference a projected unit."})})}),Zu=Ee.object({status:Ee.literal("unsupported"),reason:kn,diagnostics:Ee.array(Kt)}).strict(),Vo=Ee.discriminatedUnion("status",[Xu,Zu]);var Qu=m.object({canUpdateText:m.boolean(),canInsertChild:m.boolean(),canMove:m.boolean(),canRemove:m.boolean()}),Ho=m.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),Ju=m.enum(["cms-field","api-field"]),eg=m.enum(["text","attribute","richtext","repeat-region","component-prop"]),tg=m.enum(["exact","safe-derived","partial","unknown"]),ng=m.object({file:m.string().min(1),symbol:m.string().min(1).optional(),reason:m.string().min(1)}),sg=m.object({sourceKind:Ho,sourceType:Ju,endpointPattern:m.string().min(1).optional(),operation:m.string().min(1).optional(),collection:m.string().min(1).optional(),fieldPath:m.string().min(1).optional(),valuePath:m.string().min(1).optional(),targetKind:eg,targetName:m.string().min(1),confidence:tg,readonly:m.literal(!0),evidence:m.array(ng)}),$o=m.object({hasDynamicData:m.boolean(),bindings:m.array(sg)}),Yo=m.object({hasDynamicData:m.boolean(),sourceKinds:m.array(Ho),primaryEndpoint:m.string().min(1).optional(),primaryCollection:m.string().min(1).optional(),primaryFieldPath:m.string().min(1).optional()}),ig=m.object({key:m.string().min(1),pageCompositionUnitKey:m.string().min(1).optional(),operationSummary:Qu,dynamicDataSummary:Yo.optional()}).strict(),DT=m.object({composition:ne}).strict(),jT=m.object({key:m.string().min(1),composition:ne}).strict(),OT=m.object({siteId:I,snapshotId:x,composition:L,version:m.number().int().nonnegative(),entries:m.array(ig),pageComposition:Vo}).strict(),Zs=m.enum(["api-field","cms-field","i18n-message","config-entry"]),Xo=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()}),Qs=m.object({index:m.number().int().min(0),value:m.string(),editable:m.boolean(),source:Xo.nullable()}),$t=m.object({key:m.string().min(1),label:m.string().min(1),tag:m.string().min(1)}),NT=m.object({composition:L,key:m.string().min(1),canUpdateText:m.boolean(),canInsertChild:m.boolean(),canMove:m.boolean(),canRemove:m.boolean(),boundaryKind:Nn.nullable(),isOpaque:m.boolean()}).strict(),ag=m.object({kind:m.enum(["jsx-node","component-proxy","value-binding","route-export"]),file:m.string().min(1),componentName:m.string().min(1),isProxy:m.boolean()}),og=m.object({kind:m.enum(["jsx-node","value-path","route-export","external-entry"]),file:m.string().min(1).optional(),isProxy:m.boolean(),displayPath:m.string().min(1).optional(),sourceType:Zs.optional(),sourceId:m.string().min(1).optional()}),Zo=m.object({kind:m.union([m.enum(["jsx-literal","component-prop","binding","imported-binding","object-field","array-item","repeat-template","conditional-branch"]),Zs]),file:m.string().min(1),displayPath:m.string().min(1),externalSource:m.object({sourceType:Zs,sourceId:m.string().min(1),adapterId:m.string().min(1).optional()}).optional()}),rg=m.object({kind:Zo.shape.kind,file:m.string().min(1),displayName:m.string().min(1),canEditHere:m.boolean()}),Yt=m.object({finalSource:Zo.nullable(),chain:m.array(rg),confidence:m.enum(["exact","safe-derived","partial","unknown"]),editMode:m.enum(["direct","proxy","upstream","readonly","unsupported"]),diagnostics:m.array(m.object({code:m.string().min(1),message:m.string().min(1)}))}),cg=m.object({kind:m.literal("css-style-model"),properties:m.array(m.object({property:ho,value:m.union([m.string(),m.number(),m.boolean(),m.null()]),resolvedValue:m.union([m.string(),m.number(),m.boolean(),m.null()]).optional(),breakpoint:fo.optional(),state:So.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(zt).optional()}))}),LT=m.union([m.record(m.string(),m.unknown()),cg]),Qo=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(zt),sourcePath:m.string().min(1).optional(),diagnostics:m.array(m.object({code:m.enum(["missing-class-name","dynamic-binding","non-string-binding"]),message:m.string().min(1)})).optional()}),mg=m.object({startLine:m.number().int().positive(),startColumn:m.number().int().nonnegative(),endLine:m.number().int().positive(),endColumn:m.number().int().nonnegative()}),Js=m.object({sourceFile:m.string().min(1),componentName:m.string().min(1),openingElementRange:mg,structuralPath:m.string().min(1),textPreview:m.string().min(1).optional()}),MT=m.object({composition:L,key:m.string().min(1),tag:m.string().min(1),componentName:m.string().min(1),sourceFile:m.string().min(1),sourceLocator:Js.optional(),label:m.string().min(1),capabilities:Ln,writeTarget:ag,effectiveWriteTarget:og.optional(),provenanceChain:Yt.optional(),componentSemantic:m.record(m.string(),m.unknown()).optional(),contentModel:m.record(m.string(),m.unknown()).optional(),mediaModel:m.record(m.string(),m.unknown()).optional(),styleSource:Qo.optional(),conditional:m.record(m.string(),m.unknown()).optional(),dynamicData:$o.optional(),textSegments:m.array(Qs),boundaryKind:Nn.nullable(),isOpaque:m.boolean(),ancestors:m.array($t),children:m.array($t),siblings:m.array($t)}).strict(),UT=m.object({composition:L,key:m.string().min(1),tag:m.string().min(1),label:m.string().min(1),sourceLocator:Js.optional(),capabilities:m.object({constraints:Ln.shape.constraints}),isOpaque:m.boolean(),provenanceChain:m.object({editMode:Yt.shape.editMode,diagnostics:Yt.shape.diagnostics}).optional(),dynamicDataSummary:Yo.optional(),ancestors:m.array($t)}).strict(),FT=m.object({composition:L,key:m.string().min(1),tag:m.string().min(1),label:m.string().min(1),sourceLocator:Js.optional(),isOpaque:m.boolean(),ancestors:m.array($t),componentName:m.string().min(1),sourceFile:m.string().min(1),capabilities:Ln,provenanceChain:m.object({editMode:Yt.shape.editMode,diagnostics:Yt.shape.diagnostics}).optional(),textSegments:m.array(m.object({index:Qs.shape.index,editable:Qs.shape.editable,sourceKind:Xo.shape.kind.nullable()})),dynamicData:$o.optional(),boundaryKind:Nn.nullable()}).strict(),qT=m.object({composition:L,key:m.string().min(1),mediaModel:m.record(m.string(),m.unknown()).optional(),styleSource:Qo.optional()}).strict();var lg=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],pg=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],dg=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],ug=new Set(lg),gg=new Set(pg),_g=new Set(dg),hg={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function KT(t){return ug.has(ei(t))}function Sg(t){return gg.has(ei(t))}function fg(t){return _g.has(ei(t))}function zT(t){let{operationSummary:n}=t;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:t.fallbackMode!=="preview"?{...hg}:{canUpdateText:fg(t.tagName),canInsertChild:Sg(t.tagName),canMove:!1,canRemove:!1}}function ei(t){return t?.trim().toLowerCase()??""}import{z as bg}from"zod";var $T=bg.object({composition:ne,mutationContext:qt.optional()}).strict();var XT={PATCH_VALIDATION_FAILED:"The code didn't pass validation. Try describing the change more specifically.",PATCH_BATCH_FAILED:"The site code couldn't be generated. Please regenerate the site.",PATCH_BATCH_INVALID:"The change couldn't be applied. Try simpler instructions.",VALIDATION_FAILED:"Your message couldn't be sent as written. Please edit it and try again.",WORKSPACE_MESSAGE_CONTAINS_SECRET:"Your message looks like it contains a secret or token, so it wasn't sent. Remove it and try again.",WORKSPACE_TOOL_RESULT_INVALID:"This change couldn't be completed and was rolled back. Please try again.",WORKSPACE_TOOL_FAILED:"A tool step failed. Please try again.",WORKSPACE_TOOL_RESULT_MISSING:"The tool didn't return a usable result. Please try again.",WORKSPACE_MODEL_STREAM_FAILED:"The model stream ended unexpectedly. Please try again.",WORKSPACE_MODEL_STREAM_ABORTED:"Generation was interrupted before finishing. Please try again.",MODEL_OUTPUT_TRUNCATED:"The response was too long and was cut off before any change was applied. Try again, or split the request into smaller changes.",WORKSPACE_EDIT_NOT_APPLIED:"No change was applied. Try describing the change differently.",PRODUCT_SEARCH_APPLY_NOT_AVAILABLE:"Product search changes aren't available yet. Please try again later.",WORKSPACE_INITIAL_EXECUTION_FAILED:"Initial generation failed. Please retry from the brief.",WORKSPACE_INITIAL_GENERATION_CHECK_FAILED:"Initial generation could not be verified. Please retry.",WORKSPACE_INITIAL_GENERATION_FINALIZE_FAILED:"Initial generation could not finalize. Please retry.",WORKSPACE_INITIAL_GENERATION_QUALITY_GATE_FAILED:"Initial generation failed quality checks. Please regenerate the site.",WORKSPACE_ITERATION_QUALITY_GATE_FAILED:"Quality check failed. The change was rolled back; try a smaller or more specific request.",WORKSPACE_SOCKET_DEAD:"The workspace connection was lost. Please retry.",WORKSPACE_RUN_CANCELLED:"The run was cancelled.",WORKSPACE_RUN_ABANDONED:"This run was interrupted and did not finish. Please try again.",WORKSPACE_RUN_REQUEST_FAILED:"Couldn't start the workspace. Please try again.",WORKSPACE_RUN_BAD_RESPONSE:"The server response was malformed. Please try again.",WORKSPACE_SOCKET_UNAVAILABLE:"Workspace connection unavailable. Please try again.",WORKSPACE_SOCKET_ERROR:"The workspace connection had an error. Please try again.",WORKSPACE_SOCKET_CLOSED:"The workspace connection closed. Please try again.",WORKSPACE_SOCKET_OPEN_TIMEOUT:"Couldn't reach the workspace in time. Please try again.",WORKSPACE_CLIENT_MESSAGE_ID_MISSING:"Something went wrong sending your message. Please try again.",SITE_SNAPSHOT_REQUIRED:"This site has no usable snapshot yet. Complete Step 3 first.",AGENT_TIMEOUT:"That took longer than expected. Try breaking the change into smaller pieces.",SANDBOX_NOT_AVAILABLE:"The preview environment isn't ready. Your edits have still been saved.",PREVIEW_BUILD_FAILED:"Preview is available, but the production build failed. Fix the reported build error before deploying.",PREVIEW_BUILD_NOT_CONFIGURED:"Preview is available, but the production build check is not configured.",PREVIEW_BUILD_SANDBOX_NOT_FOUND:"Preview is available, but the build check could not find the active preview sandbox.",WS_CONNECTION_ERROR:"Connection lost. Reconnecting\u2026",USER_MESSAGE_PERSIST_FAILED:"Your message wasn't saved. Please send it again.",CLARIFICATION_REPLY_STALE:"That question has expired. Please tell me what you'd like to do now.",CLARIFY_MODEL_FAILED:"Clarify couldn't finish generating questions. Please try again.",WORKSPACE_RUN_IN_FLIGHT:"Another session is already running. Please try again in a moment.",SITE_OPERATION_LOCKED:"Another change is already running for this site. Wait for it to finish, then try again.",EDIT_ENGINE_VERSION_INVALID:"Invalid editor version. Refresh the page and try again.",SANDBOX_DEPENDENCY_SYNC_FAILED:"The preview runtime could not be prepared. Please try again.",SANDBOX_PREVIEW_FAILED:"The site preview failed to start. Please try again.",SANDBOX_DEPENDENCY_VERSION_MISMATCH:"The preview runtime could not be verified. Please try again.",SANDBOX_RUNTIME_NOT_READY:"The preview needs to be refreshed before this change can be applied. Refresh the preview and try again.",GENERIC:"Something went wrong. Please try again."},ZT={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."},QT={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},JT={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var Jo="0.8.2",tk="x-vcp-edit-engine-version",nk="x-vcp-edit-engine-version-source",ti=class extends Error{constructor(n="Invalid edit-engine version."){super(n),this.code="EDIT_ENGINE_VERSION_INVALID",this.name="EditEngineVersionParseError"}},yg=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/;function xg(t){return yg.test(t)}function Eg(t){if(typeof t!="string"||!xg(t))throw new ti;return t}function sk(t){return t==null?{version:Jo,source:"fallback_current"}:{version:Eg(t),source:"explicit"}}function ik(){return{version:Jo,source:"system_current"}}import{z as je}from"zod";var Ig=200,Rg=200;function Tg(t){let n=t.indexOf(":");if(n<=0)return null;let s=t.slice(0,n).trim(),a=t.slice(n+1).trim();return s.length===0||a.length===0?null:{source:s,target:a}}var kg=je.string().min(3).max(Ig).refine(t=>Tg(t)!==null,{message:'glossary entries must be "source:target" pairs split on a half-width colon, e.g. "\u7C73:Rice"'}),rk=je.array(kg).max(Rg),ck=je.object({website_name:je.string().min(1).max(200),website_industry:je.string().min(1).max(200).optional(),website_description:je.string().min(1).max(1e3).optional()}),Pg=je.enum(["regional","fonts_only"]),Un=je.string().regex(/^#[0-9a-fA-F]{6}$/,'color must be a "#rrggbb" value'),wg=je.object({primary:Un.optional(),accent:Un.optional(),foreground:Un.optional(),neutral:Un.optional()}),Ag=600,mk=je.object({mode:Pg.default("regional"),seeds:wg.optional(),note:je.string().min(1).max(Ag).optional()}),lk={mode:"regional"};function pk(t){return t===void 0?!1:Object.values(t).some(n=>typeof n=="string"&&n.length>0)}import{z as Te}from"zod";var vg=Te.string().trim().min(1),bt=Te.string().uuid(),Cg=Te.string().min(1).max(2048).refine(t=>t.startsWith("/")||t.includes("\\")?!1:t.split("/").every(n=>n.length>0&&n!=="."&&n!==".."),"object_key must be a relative snapshot store path without empty, '.' or '..' segments"),er=Te.object({snapshot_id:bt,object_key:Cg}),gk=Te.object({tenant_id:vg,parent_site_id:bt,subsite_site_id:bt,base:er,target:er}),_k=Te.object({subsite_site_id:bt,pending_pages:Te.array(Te.string().min(1)),hash_diverged_count:Te.number().int().nonnegative(),child_only_count:Te.number().int().nonnegative(),base_snapshot_id:bt,target_snapshot_id:bt}),Dg=Te.enum(["SUBSITE_DIFF_REQUEST_INVALID","SUBSITE_DIFF_STORE_NOT_CONFIGURED","SUBSITE_DIFF_MANIFEST_MISSING","SUBSITE_DIFF_MANIFEST_INVALID"]),hk=Te.object({error_code:Dg,message:Te.string().min(1),side:Te.enum(["base","target"]).optional()});import{z as re}from"zod";var yk=re.object({tenant_id:re.string().min(1),site_id:I,snapshot_id:x,manifest_hash:re.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:re.string().min(1).max(2048),page_slug:re.string().max(512).optional()}),xk=re.object({site_id:I,snapshot_id:x,unit_count:re.number().int().nonnegative(),file_count:re.number().int().nonnegative(),markdown:re.string().min(1),page_slug:re.string().optional(),page_file:re.string().optional(),entries:re.array(re.object({id:re.string().min(1),file_path:re.string().min(1),line:re.number().int().nullable(),kind:re.string().min(1),text:re.string(),media_key:re.string().optional()})).optional()});import{z as jg}from"zod";var Og=/^\/[a-z0-9][a-z0-9-]{0,30}$/,Ng=Object.freeze(["api","_next","assets","static","robots.txt","sitemap.xml",".well-known"]),Lg=new Set(Ng);function Mg(t){return Lg.has(t)}var Rk=jg.string().regex(Og).refine(t=>!Mg(t.slice(1)),{message:"mount_path must not use a reserved segment (api, _next, assets, static, robots.txt, sitemap.xml, .well-known)"});import{z as se}from"zod";var Ug=se.enum(["active","paused","blocked"]),tr=se.enum(["typecheck_failed","health_failed","validation_failed"]),Fg={status:Ug,attempts:se.number().int().nonnegative(),attempted_template_version:De.nullable(),last_error_code:tr.nullable()},yt=se.object(Fg).strict(),Fn=se.object({template_id:se.string().trim().min(1),target_template_version:De}).strict(),wk=Fn,qg=se.discriminatedUnion("action",[se.object({action:se.literal("proceed"),state:yt.extend({status:se.literal("active")})}).strict(),se.object({action:se.literal("skip_not_newer"),state:yt.extend({status:se.literal("active")})}).strict(),se.object({action:se.literal("skip_paused"),state:yt.extend({status:se.literal("paused")})}).strict(),se.object({action:se.literal("skip_blocked"),state:yt.extend({status:se.literal("blocked")})}).strict()]),Ak=Fn,vk=qg,Ck=Fn.extend({error_code:tr}),Dk=se.object({state:yt}).strict(),jk=Fn,Ok=se.object({state:yt}).strict();import{z as U}from"zod";var Gg=744*60*60*1e3,Kg=U.enum(["eligible","fast_path","upgraded","skipped","lock_skipped","cas_aborted","validation_failed","blocked","paused"]),zg=U.enum(["typecheck","build","health","validation"]),Bg=U.enum(["not_attempted","promoted","aborted"]),Fk=U.object({template_id:U.string().trim().min(1).max(128),from_version:De.nullable(),to_version:De,outcome:Kg,attempt:U.number().int().nonnegative().max(2147483647),duration_ms:U.number().int().nonnegative().max(2147483647),replaced_group_count:U.number().int().nonnegative().max(2147483647),skipped_group_count:U.number().int().nonnegative().max(2147483647),validation_stage:zg.nullable(),cas_outcome:Bg.nullable()}).strict(),qk=U.object({recorded:U.literal(!0)}).strict(),nr=U.object({from:U.iso.datetime(),to:U.iso.datetime()}).strict().refine(({from:t,to:n})=>Date.parse(t)<Date.parse(n),{message:"from must be earlier than to",path:["to"]}).refine(({from:t,to:n})=>Date.parse(n)-Date.parse(t)<=Gg,{message:"report window must not exceed 31 days",path:["to"]}),Gk=nr,Wg=U.object({eligible:U.number().int().nonnegative(),fast_path:U.number().int().nonnegative(),upgraded:U.number().int().nonnegative(),skipped:U.number().int().nonnegative(),lock_skipped:U.number().int().nonnegative(),cas_aborted:U.number().int().nonnegative(),validation_failed:U.number().int().nonnegative(),blocked:U.number().int().nonnegative(),paused:U.number().int().nonnegative()}).strict(),Kk=U.object({window:nr,outcome_counts:Wg,current_state_counts:U.object({blocked:U.number().int().nonnegative(),paused:U.number().int().nonnegative()}).strict(),duration_ms:U.object({p50:U.number().int().nonnegative().nullable(),p95:U.number().int().nonnegative().nullable(),sample_count:U.number().int().nonnegative()}).strict()}).strict(),zk=U.object({older_than:U.iso.datetime(),limit:U.coerce.number().int().min(1).max(200).default(50),include_candidates:U.enum(["true","false"]).default("false").transform(t=>t==="true")}).strict(),Vg=U.object({site_id:I,snapshot_id:x,status:U.enum(["candidate","deleting"]),created_at:U.iso.datetime()}).strict(),Bk=U.object({snapshots:U.array(Vg)}).strict();import{z as ze}from"zod";var Hg=ze.enum(["PREVIEW_SESSION_NOT_FOUND","PREVIEW_SESSION_INVALID","PREVIEW_SESSION_STALE","PREVIEW_SESSION_LOOKUP_FAILED","PREVIEW_SANDBOX_NOT_FOUND","PREVIEW_SANDBOX_CONNECT_FAILED","PREVIEW_SANDBOX_OWNERSHIP_MISMATCH","PREVIEW_ACTIVATION_TIMEOUT","PREVIEW_PREFLIGHT_FAILED","PREVIEW_ENV_LOOKUP_FAILED","PREVIEW_SERVER_START_FAILED","PREVIEW_HEALTH_CHECK_FAILED","SANDBOX_NOT_CONFIGURED"]),$g=ze.object({status:ze.literal("ready"),preview_url:ze.string().url()}).strict(),Yg=ze.object({status:ze.literal("failed"),code:Hg,message:ze.string().min(1),retryable:ze.boolean()}).strict(),Hk=ze.discriminatedUnion("status",[$g,Yg]);import{z as oe}from"zod";var Jk="build-context.json",e1=2e5,sr=oe.string().regex(/^sha256:[a-f0-9]{64}$/u),ir=1e3;function Xg(t){return Array.from(t).length<=ir}var Zg=oe.object({kind:oe.enum(["customer_materials","website_scan_diagnosis","committed_strategy"]),digest:sr}).strict(),Qg=oe.object({schema_version:oe.literal(1),flow_type:Pn,sources:oe.array(Zg).min(2).max(2)}).strict().superRefine((t,n)=>{let s=new Set(t.sources.map(i=>i.kind)),a=t.flow_type==="with_website"?["website_scan_diagnosis","committed_strategy"]:["customer_materials","committed_strategy"];(s.size!==a.length||a.some(i=>!s.has(i)))&&n.addIssue({code:"custom",path:["sources"],message:"Site-build provenance sources must match the persisted workflow flow."})}),Jg=oe.object({schema_version:oe.literal(1),seed:sr.optional(),cms_settings:oe.object({main_products:oe.string().trim().min(1).refine(Xg,{message:`main_products must contain at most ${ir} characters`}).optional()}).strict().optional(),provenance:Qg.optional()}).strict(),e_=oe.object({schema_version:oe.literal(1),site_id:I,workflow_id:Oe,brief:oe.string().min(1),source:oe.enum(["business_provider","mock"]),payload:Jg}).strict().superRefine((t,n)=>{t.source==="business_provider"&&!t.payload.provenance&&n.addIssue({code:"custom",path:["payload","provenance"],message:"Business site-build context requires persisted provenance."})}),t1=oe.object({source_snapshot_id:x,source_run_id:V,build_context:e_,page_slugs:oe.array(oe.string().min(1)).optional()}).strict(),n1=oe.object({disposition:oe.enum(["reused","rebased"]),snapshot_id:x}).strict(),t_=oe.object({snapshot:Gs,workspace_run_id:V.nullable()}).strict(),s1=M(t_);import{z as Le}from"zod";import{z as Ae}from"zod";import{z as ie}from"zod";import{z as n_}from"zod";var s_=["company_profile","product_manual","product_list","customer_case","product_help","qualification","industry_material"],ar=n_.enum(s_);var or=ie.enum(["pending","running","ready","failed","missing"]),i_=ie.object({task_id:ie.string().min(1).max(500),status:or}).strict(),m1=ie.object({items:ie.array(i_).max(100)}).strict(),Xt=ie.string().trim().min(1).max(255),l1=ie.object({knowledge_site_id:Xt,source_ids:ie.array(Xt).min(1).max(200)}).strict().superRefine((t,n)=>{new Set(t.source_ids).size!==t.source_ids.length&&n.addIssue({code:"custom",message:"Knowledge source IDs must be unique.",path:["source_ids"]})}),a_=ie.object({source_file_id:Xt,category_code:ar.nullable(),category_confirmed:ie.boolean(),status:or}).strict(),p1=ie.object({ready:ie.boolean(),files:ie.array(a_),counts:ie.object({total:ie.number().int().nonnegative(),pending:ie.number().int().nonnegative(),running:ie.number().int().nonnegative(),ready:ie.number().int().nonnegative(),failed:ie.number().int().nonnegative(),missing:ie.number().int().nonnegative(),unclassified:ie.number().int().nonnegative()}).strict()}).strict();var ce=t=>Ae.string().trim().max(t),rr=Ae.array(Ae.string().trim().min(1).max(120)).max(20),ni=Ae.object({company_name:Ae.string().trim().min(1).max(200),brand_name:ce(200),primary_products:Ae.string().trim().min(1).max(1e3),industry:ce(200),applications:ce(1e3),business_summary:ce(2e3),registered_capital:ce(200).default(""),legal_representative:ce(200).default(""),target_markets:rr,customer_industries:ce(1e3),customer_roles:ce(1e3),buying_scenarios:ce(2e3),differentiators:ce(2e3),competitors:ce(1e3),trust_proof:ce(2e3),customer_cases:ce(3e3),channels:rr,expected_domain:ce(255),brand_tone:ce(500),contact_name:ce(200),contact_info:ce(500),timezone:ce(100),launch_timing:ce(200),input_source_ids:Ae.array(Xt).max(50)}).strict(),o_=Ae.enum(["draft","submitted"]),si=ni.extend({id:G,tenant_id:Ae.string().min(1),site_id:I,workflow_id:Oe,status:o_,submitted_at:Ae.string().min(1).nullable(),created_at:Ae.string().min(1),updated_at:Ae.string().min(1)}).strict(),S1=M(si),f1=M(si),b1=M(si.nullable());var R1=Cn.extend({expected_current_node:Le.literal("website_scan"),type:Le.literal("existing_site"),result:Cn.shape.result.extend({website:Le.string().url(),scan_cards:Le.partialRecord(Mo,Ws).refine(t=>Object.keys(t).length>0,{message:"At least one recognized scan card is required."})}).strict()}).strict(),T1=Le.object({expected_current_node:Le.literal("customer_materials"),materials:ni}).strict(),k1=Le.object({expected_current_node:Le.literal("diagnosis")}).strict(),P1=Le.object({expected_current_node:Le.literal("strategy")}).strict();import{z as k}from"zod";var Zt={Inter:{import:"Inter"},"Inter Tight":{import:"Inter_Tight"},"DM Sans":{import:"DM_Sans"},"Source Sans 3":{import:"Source_Sans_3"},"Libre Franklin":{import:"Libre_Franklin"},Montserrat:{import:"Montserrat"},Archivo:{import:"Archivo"},"Space Grotesk":{import:"Space_Grotesk"},Manrope:{import:"Manrope"},"IBM Plex Sans":{import:"IBM_Plex_Sans"},Oswald:{import:"Oswald"},"Roboto Condensed":{import:"Roboto_Condensed"},"Bebas Neue":{import:"Bebas_Neue",weights:["400"]},"Playfair Display":{import:"Playfair_Display"},Lora:{import:"Lora"},Fraunces:{import:"Fraunces"},"Cormorant Garamond":{import:"Cormorant_Garamond"},"JetBrains Mono":{import:"JetBrains_Mono"},"IBM Plex Mono":{import:"IBM_Plex_Mono"},"Noto Sans SC":{import:"Noto_Sans_SC",download:!1},"Noto Serif SC":{import:"Noto_Serif_SC",download:!1}},r_={heading:"Inter",body:"Inter"},cr=Zt.Inter;function qn(t){return t.trim().replace(/\s+/g,"_").toLowerCase()}var dr=(()=>{let t=new Map;for(let[n,s]of Object.entries(Zt))t.set(qn(n),s),t.set(qn(s.import),s);return t})();function c_(t){return typeof t!="string"||t.trim().length===0?cr:dr.get(qn(t))??cr}var m_=(()=>{let t=new Map;for(let[n,s]of Object.entries(Zt))t.set(s.import,n);return t})();function l_(t){if(typeof t!="string"||t.trim().length===0)return"Inter";let n=dr.get(qn(t));return n?m_.get(n.import)??"Inter":"Inter"}var p_=Object.keys(Zt),mr='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',lr='Georgia, "Times New Roman", serif',pr='"SFMono-Regular", Consolas, monospace',d_=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),u_=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(t=>t.toLowerCase())),g_=new Set(["JetBrains Mono","IBM Plex Mono"].map(t=>t.toLowerCase()));function __(t){let n=t.toLowerCase();return g_.has(n)||n.includes("mono")?"mono":u_.has(n)||n.includes("serif")?"serif":"sans"}function ii(t,n){let s=g=>(g??"").trim().replace(/^['"]|['"]$/g,"").replace(/[^A-Za-z0-9 _-]+/g,"").trim().slice(0,60),a=s(t),i=s(n),r=g=>d_.has(g.toLowerCase());if(a&&r(a)){let g=a.toLowerCase();return g.includes("mono")?pr:g.includes("serif")?lr:mr}let _=a;_||(_=r(i)?"":i),_||(_="Inter");let c=__(_);return c==="mono"?`"${_}", ${pr}`:c==="serif"?`"${_}", ${lr}`:`"${_}", ${mr}`}function h_(t){return{"--site-font-sans":ii(t?.body,"Inter"),"--site-font-heading":ii(t?.heading,t?.body??"Inter")}}var ai=["archivo-inter","playfair-source-sans","space-grotesk-manrope","fraunces-libre-franklin","noto-serif-sc-noto-sans-sc","noto-sans-sc"],ur=[{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 gr(t){let n=ur.find(s=>s.id===t);if(!n)throw new Error(`Unknown font pairing: ${t}`);return n}var oi=["compact","comfortable","airy"],_r=["none","sm","md","lg","xl"],hr="lg",ri=["subtle","moderate","expressive"],S_=[{id:"subtle",motionLevel:"subtle"},{id:"moderate",motionLevel:"moderate"},{id:"expressive",motionLevel:"expressive"}];function Sr(t){let n=S_.find(s=>s.id===t);if(!n)throw new Error(`Unknown motion preset: ${t}`);return n}var fr=["ocean","forest","clay","violet","graphite","crimson"],br=["ai-forest","ai-navy","ai-steel"],yr=/^gen-[0-9a-f]{8}$/,ci=[{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"}],mi=[{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 C1(t){let n=mi.find(s=>s.id===t);if(!n)throw new Error(`Unknown theme preset: ${t}`);return n}function xr(t){return mi.find(n=>n.id===t)?.radius??ci.find(n=>n.id===t)?.radius}var li=k.string().regex(/^#[0-9A-F]{6}$/i),Qt=k.string().trim().min(1).max(500),Er=k.string().datetime({offset:!0}),f_=k.enum(fr),b_=k.enum(br),y_=k.string().regex(yr),Jt=k.union([f_,b_,y_]),en=k.enum(ai),tn=k.enum(ri),nn=k.enum(oi),Gn=k.enum(_r),Ir=300,x_=k.string().trim().min(1).max(Ir),Kn=k.object({primary:li,accent:li,foreground:li}).strict(),E_=k.object({id:Jt,rank:k.number().int().min(1).max(3),name:k.string().trim().min(1).max(120),description:k.string().trim().min(1).max(240),color_seeds:Kn,surface_mode:k.enum(["light","dark"]),radius:Gn,font_pairing_id:en,motion_preset_id:tn,density:nn,reason:Qt}).strict(),Rr=k.object({name:k.string().trim().min(1).max(120),description:k.string().trim().min(1).max(240),reason:Qt,color_seeds:Kn,surface_mode:k.enum(["light","dark"]),radius:Gn,font_pairing_id:en,motion_preset_id:tn,density:nn}).strict(),Tr=k.object({version:k.number().int().min(1),recommendation_id:k.string().uuid(),theme_preset_id:Jt,color_seeds:Kn,surface_mode:k.enum(["light","dark"]),font_pairing_id:en,motion_preset_id:tn,density:nn,radius:Gn.optional(),aesthetic_note:x_.optional(),updated_at:Er}).strict(),I_=k.object({id:k.string().uuid(),version:k.number().int().min(1),catalog_version:k.string().trim().min(1).max(80),source:k.object({mode:k.enum(["ai","fallback"]),fallback_reason:k.string().trim().min(1).max(80).nullable()}).strict(),inputs:k.object({industry:k.string().trim().min(1).max(160).optional(),site_language:k.string().trim().min(2).max(35),owner_locale:pe.optional(),strategy_version:k.number().int().min(1),input_digest:k.string().regex(/^sha256:[a-f0-9]{64}$/)}).strict(),theme:k.object({recommended_id:Jt,candidate_ids:k.array(Jt).length(3),candidates:k.array(E_).length(3)}).strict().superRefine((t,n)=>{t.recommended_id!==t.candidate_ids[0]&&n.addIssue({code:"custom",path:["recommended_id"],message:"recommended_id must be the first candidate"}),t.candidates.some((s,a)=>s.id!==t.candidate_ids[a]||s.rank!==a+1)&&n.addIssue({code:"custom",path:["candidates"],message:"Candidates must follow candidate_ids order."})}),font:k.object({recommended_id:en,reason:Qt}).strict(),motion:k.object({recommended_id:tn,reason:Qt}).strict(),density:k.object({recommended_id:nn,reason:Qt}).strict(),conversion:st.optional(),generated_at:Er}).strict(),K1=k.object({force_refresh:k.boolean().optional()}).strict(),z1=k.object({request_id:k.string().trim().min(1).max(160),site_id:I,cached:k.boolean(),recommendation:I_,selection:Tr}).strict(),B1=k.object({recommendation_id:k.string().uuid(),expected_version:k.number().int().min(1),theme_preset_id:Jt,color_seeds:Kn,surface_mode:k.enum(["light","dark"]),font_pairing_id:en,motion_preset_id:tn,density:nn,radius:Gn.optional(),aesthetic_note:k.string().trim().max(Ir).optional()}).strict(),W1=k.object({selection:Tr}).strict(),V1=k.object({tenant_id:k.string().trim().min(1).max(160),site_id:I,site_language:k.string().trim().min(2).max(35),owner_locale:pe,industry:k.string().trim().min(1).max(160).optional(),strategy_version_id:k.string().uuid(),strategy_version:k.number().int().min(1),strategy_checksum:k.string().regex(/^[a-f0-9]{64}$/),strategy_summary:k.array(k.string().trim().min(1).max(500)).min(1).max(fe),reference_image_source_id:nt.optional(),owner_whole_site_request:k.string().trim().min(1).max(gt).optional()}).strict(),H1=k.object({theme_candidates:k.array(Rr).length(3),conversion:st.optional()}).strict().superRefine((t,n)=>{let s=new Set;t.theme_candidates.forEach((a,i)=>{let r=JSON.stringify(a.color_seeds).toUpperCase();s.has(r)&&n.addIssue({code:"custom",path:["theme_candidates",i,"color_seeds"],message:"Theme candidates must have pairwise distinct color_seeds"}),s.add(r)})});function $1(){return ci.map(t=>Rr.parse({name:t.name,description:t.description,reason:t.fallbackReason,color_seeds:t.colorSeeds,surface_mode:t.surfaceMode,radius:t.radius,font_pairing_id:ai[0],motion_preset_id:ri[0],density:oi[1]}))}function R_(t){return t.radius??xr(t.theme_preset_id)??"lg"}function Y1(t){let n=gr(t.font_pairing_id),s=Sr(t.motion_preset_id);return{colorSeeds:t.color_seeds,surfaceMode:t.surface_mode,fonts:{heading:n.heading,body:n.body},density:t.density,motionLevel:s.motionLevel,motionPreset:s.id,radius:R_(t)}}function X1(t,n){let s=t.theme.candidates[0];return{version:1,recommendation_id:t.id,theme_preset_id:s.id,color_seeds:s.color_seeds,surface_mode:s.surface_mode,font_pairing_id:t.font.recommended_id,motion_preset_id:t.motion.recommended_id,density:t.density.recommended_id,radius:s.radius,updated_at:n.toISOString()}}import{z as Xe}from"zod";var e0=Xe.object({site_id:I,site_language:Xe.string().trim().min(2).max(35),business_facts:Xe.array(Xe.string().trim().min(1).max(1e3)).min(1).max(8)}).strict(),T_=Xe.enum(["high","medium","low"]),t0=Xe.object({skill_name:Xe.string().trim().min(1).max(80).nullable(),confidence:T_,reason:Xe.string().trim().min(1).max(240)}).strict();import{z as W}from"zod";var k_=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],kr=W.object({name:W.string().min(1).max(100),type:W.enum(k_),label:W.string().min(1).max(255),required:W.boolean().optional(),options:W.array(W.string()).optional()}),i0=W.object({name:W.string(),cms_type:W.string(),label:W.string().optional(),required:W.boolean().optional(),value_shape:W.string().optional(),front_display:W.enum(["visible","internal","forbidden"]).optional(),choices:W.array(W.object({value:W.union([W.string(),W.number()]),label:W.string()})).optional()}),a0=W.object({route_file_path:W.string().min(1),target_component_path:W.string().min(1),content_type_hint:W.string().min(1),collection_purpose:W.enum(["generic","product"]).optional(),required_fields:W.array(kr).optional(),mode:W.enum(["bind_existing","provision"]),list_mode:W.enum(["page","embedded"]).optional(),fields:W.array(kr).optional(),seed_records:W.array(W.record(W.string(),W.unknown())).optional()});import{z as me}from"zod";var zn=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number","file"],P_=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number"],w_=me.object({name:me.string().min(1).max(100),type:me.enum(P_),label:me.string().min(1).max(255),required:me.boolean().optional(),options:me.array(me.string()).optional()}),A_=me.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),c0=me.object({mode:me.enum(["bind_existing","provision"],{error:'mode is required. Use "bind_existing" or "provision". Never call connect_form with {}.'}),form_hint:me.string().min(1).optional(),name:me.string().min(1).max(255).optional(),component_slug:A_,description:me.string().min(1).max(1e3).optional(),fields:me.array(w_).optional()}).superRefine((t,n)=>{t.mode==="bind_existing"&&!t.form_hint?.trim()&&n.addIssue({code:"custom",path:["form_hint"],message:"form_hint is required for bind_existing"}),t.mode==="provision"&&!t.name?.trim()&&n.addIssue({code:"custom",path:["name"],message:"name is required for provision"})}),m0=me.object({name:me.string(),label:me.string(),cms_type:me.string(),required:me.boolean()});import{z as l}from"zod";var sn=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,Et=/^[A-Za-z][A-Za-z0-9_-]{0,127}$/,Bn=/^[A-Za-z][A-Za-z0-9_]{0,99}$/,vr=/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/,di=/^[a-z][a-z0-9-]{0,99}$/,Cr=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,Pr=2,wr=3,Wn=l.string().regex(sn),v_=l.string().regex(sn),ui=l.string().regex(sn),an=l.string().regex(Bn),gi=l.string().regex(vr),C_=l.discriminatedUnion("status",[l.object({status:l.literal("unbound"),form_code:l.null()}).strict(),l.object({status:l.literal("bound"),form_code:l.string().regex(Et)}).strict(),l.object({status:l.literal("missing"),form_code:l.string().regex(Et)}).strict()]),D_=l.object({value:gi,label:l.string().trim().min(1).max(255)}).strict(),j_=l.object({kind:l.literal("field"),field_name:an,type:l.enum(zn),label:l.string().trim().min(1).max(255),required:l.boolean(),span:l.enum(["full","half"]),options:l.array(D_).max(100),max_files:l.number().int().min(1).max(5).optional()}).strict(),O_=l.object({kind:l.literal("step-break"),step_id:l.string().regex(sn)}).strict(),N_=l.discriminatedUnion("kind",[j_,O_]),L_=l.object({field_name:an,type:l.enum(zn),last_label:l.string().max(255)}).strict(),M_=l.object({field_name:an,value:gi,last_label:l.string().max(255)}).strict(),U_=l.discriminatedUnion("kind",[l.object({kind:l.literal("custom")}).strict(),l.object({kind:l.literal("template"),slug:l.string().regex(di),version:l.string().regex(Cr)}).strict()]),F_={select:2,radio:2,multiselect:1,DropdownSelection:2,RadioButton:2,Checkbox:1};function Me(t){return t.toLowerCase()}function Dr(t,n){return t.trim().toLocaleLowerCase(n)}function xt(t,n){return`${Me(t)}\0${n}`}function he(t,n,s,a){let i=new Set;for(let r of t){if(i.has(r)){a.addIssue({code:"custom",path:n,message:s});return}i.add(r)}}function _i(t,n,s,a){let i=F_[t]??0;i>0&&n<i?a.addIssue({code:"custom",path:s,message:`choice field requires at least ${i} option${i===1?"":"s"}`}):i===0&&n>0&&a.addIssue({code:"custom",path:s,message:"non-choice fields must use an empty options array"})}var hi=l.object({schema_version:l.literal(1),min_runtime_version:l.number().int().positive(),form_definition_id:Wn,binding:C_,content_locale:pe,features:l.object({multistep:l.boolean()}).strict(),copy:l.object({title:l.string().max(255),description:l.string().max(1e3),submit_button:l.string().trim().min(1).max(100),success_message:l.string().trim().min(1).max(500),error_message:l.string().max(500)}).strict(),layout:l.object({columns:l.enum(["one","two"])}).strict(),nodes:l.array(N_).min(1).max(200),source:U_,retired:l.object({fields:l.array(L_).max(1e3),options:l.array(M_).max(5e3)}).strict(),compatibility:l.object({standardization_version:l.number().int().positive(),diagnostics:l.array(l.string().trim().min(1).max(500)).max(100)}).strict()}).strict().superRefine((t,n)=>{let s=t.nodes.flatMap((c,g)=>c.kind==="field"?[[g,c]]:[]),a=s.map(([,c])=>c);a.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"at least one field node is required"});let i=t.nodes.filter(c=>c.kind==="step-break");!t.features.multistep&&i.length>0&&n.addIssue({code:"custom",path:["nodes"],message:"step-break requires the multistep feature"}),t.features.multistep&&(t.min_runtime_version<Pr&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`multistep requires runtime version ${Pr}`}),i.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"multistep requires at least one step-break"}));for(let[c,g]of t.nodes.entries())g.kind==="step-break"&&(c===0||c===t.nodes.length-1||t.nodes[c-1]?.kind==="step-break"||t.nodes[c+1]?.kind==="step-break")&&n.addIssue({code:"custom",path:["nodes",c],message:"step-break must separate two non-empty steps"});he(i.map(c=>c.step_id),["nodes"],"step_id must be unique",n),he(a.map(c=>Me(c.field_name)),["nodes"],"field_name must be unique",n),he(t.retired.fields.map(c=>Me(c.field_name)),["retired","fields"],"retired field_name must be unique",n);let r=new Set(t.retired.fields.map(c=>Me(c.field_name)));for(let[c,g]of s)r.has(Me(g.field_name))&&n.addIssue({code:"custom",path:["nodes",c,"field_name"],message:"retired field_name cannot be reused"}),_i(g.type,g.options.length,["nodes",c,"options"],n),g.type==="file"?t.min_runtime_version<wr&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`file fields require runtime version ${wr}`}):g.max_files!==void 0&&n.addIssue({code:"custom",path:["nodes",c,"max_files"],message:"max_files is only valid for file fields"}),he(g.options.map(j=>j.value),["nodes",c,"options"],"option value must be unique within a field",n),he(g.options.map(j=>Dr(j.label,t.content_locale)),["nodes",c,"options"],"option label must be unique within a field",n);he(t.retired.options.map(c=>xt(c.field_name,c.value)),["retired","options"],"retired option identity must be unique",n);let _=new Set(t.retired.options.map(c=>xt(c.field_name,c.value)));for(let[c,g]of s)for(let[j,E]of g.options.entries())_.has(xt(g.field_name,E.value))&&n.addIssue({code:"custom",path:["nodes",c,"options",j,"value"],message:"retired option value cannot be reused"})}),q_=["copy.title","copy.description","copy.submit_button","copy.success_message","copy.error_message","nodes.*.label","nodes.*.options.*.label"],G_=new Set(q_);function h0(t){let n=t.map(s=>typeof s=="number"||/^\d+$/.test(s)?"*":s).join(".");return G_.has(n)}function S0(t,n){let s=[],a=t.nodes.filter(c=>c.kind==="field"),i=new Map(n.nodes.filter(c=>c.kind==="field").map(c=>[Me(c.field_name),c])),r=new Map(n.retired.fields.map(c=>[Me(c.field_name),c])),_=new Map(n.retired.options.map(c=>[xt(c.field_name,c.value),c]));for(let c of a){let g=Me(c.field_name),j=i.get(g),E=r.get(g);j&&j.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),j&&j.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),!j&&E&&E.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),!j&&E&&E.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),!j&&!r.has(g)&&s.push({code:"FIELD_RETIREMENT_MISSING",field_name:c.field_name});let O=new Set(j?.options.map(F=>F.value)??[]);for(let F of c.options){let q=_.get(xt(c.field_name,F.value));!O.has(F.value)&&q&&q.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),!O.has(F.value)&&!q&&s.push({code:"OPTION_RETIREMENT_MISSING",field_name:c.field_name,value:F.value})}}for(let c of t.retired.fields){let g=r.get(Me(c.field_name));g&&g.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),g&&g.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),g||s.push({code:"FIELD_RETIREMENT_MISSING",field_name:c.field_name})}for(let c of t.retired.options){let g=_.get(xt(c.field_name,c.value));g&&g.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),g||s.push({code:"OPTION_RETIREMENT_MISSING",field_name:c.field_name,value:c.value})}return s}var K_=l.enum(jt),Ze=l.object({english:l.string().max(1e3),translations:l.partialRecord(K_,l.string().max(1e3)).optional()}).strict(),z_=l.object({template_option_key:l.string().regex(vr),label:Ze}).strict(),B_=l.object({template_field_key:l.string().regex(Bn),type:l.enum(zn),label:Ze,required:l.boolean(),span:l.enum(["full","half"]),options:l.array(z_).max(100)}).strict(),W_=l.object({template_step_key:l.string().regex(Bn),after_field_key:l.string().regex(Bn)}).strict(),f0=["lead-generation","trial-and-samples","quote-and-commerce","appointments-and-visits","resources-and-subscriptions","service-and-channel"],b0=[1,1,1,1,1,1],jr=l.string().regex(di),V_=l.object({schema_version:l.literal(1),slug:jr,name:Ze,template_count:l.number().int().min(0).max(500)}).strict().superRefine((t,n)=>{t.name.english.trim()===""&&n.addIssue({code:"custom",path:["name","english"],message:"English category name is required"})}),H_=l.object({schema_version:l.literal(1),slug:l.string().regex(di),version:l.string().regex(Cr),category:jr,copy:l.object({title:Ze,description:Ze,submit_button:Ze,success_message:Ze,error_message:Ze}).strict(),layout:l.object({columns:l.enum(["one","two"])}).strict(),fields:l.array(B_).min(1).max(200),step_breaks:l.array(W_).max(20).optional()}).strict().superRefine((t,n)=>{for(let r of["title","description","submit_button","success_message","error_message"])t.copy[r].english.trim()===""&&n.addIssue({code:"custom",path:["copy",r,"english"],message:"English baseline text is required"});he(t.fields.map(r=>r.template_field_key),["fields"],"template_field_key must be unique",n);let s=new Map(t.fields.map((r,_)=>[r.template_field_key,_])),a=t.step_breaks??[];he(a.map(r=>r.template_step_key),["step_breaks"],"template_step_key must be unique",n),he(a.map(r=>r.after_field_key),["step_breaks"],"step breaks must not share an anchor field",n);let i=-1;for(let[r,_]of a.entries()){let c=s.get(_.after_field_key);c===void 0||c>=t.fields.length-1?n.addIssue({code:"custom",path:["step_breaks",r,"after_field_key"],message:"step break must follow an existing non-final field"}):c<=i&&n.addIssue({code:"custom",path:["step_breaks",r,"after_field_key"],message:"step breaks must follow field order"}),i=c??i}t.fields.length+a.length>200&&n.addIssue({code:"custom",path:["step_breaks"],message:"template fields and step breaks must not exceed 200 nodes"});for(let[r,_]of t.fields.entries()){_.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",r,"label","english"],message:"English field label is required"}),_i(_.type,_.options.length,["fields",r,"options"],n),he(_.options.map(c=>c.template_option_key),["fields",r,"options"],"template_option_key must be unique within a field",n),he(_.options.map(c=>c.label.english.trim().toLowerCase()),["fields",r,"options"],"English option labels must be unique within a field",n);for(let[c,g]of _.options.entries())g.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",r,"options",c,"label","english"],message:"English option label is required"})}}),y0=l.object({schema_version:l.literal(1),visibility:l.enum(["internal","public"]),categories:l.array(V_).max(500),templates:l.array(H_).max(500)}).strict().superRefine((t,n)=>{let s=(i,r)=>{let _=jt.filter(c=>!i.translations?.[c]?.trim());_.length>0&&n.addIssue({code:"custom",path:[...r,"translations"],message:`public template copy is missing locales: ${_.join(", ")}`})};he(t.categories.map(i=>i.slug),["categories"],"template category slug must be unique",n);let a=new Set(t.categories.map(i=>i.slug));for(let[i,r]of t.categories.entries()){let _=t.templates.filter(c=>c.category===r.slug).length;r.template_count!==_&&n.addIssue({code:"custom",path:["categories",i,"template_count"],message:"template_count must match catalog templates"})}he(t.templates.map(i=>i.slug),["templates"],"template slug must be unique",n);for(let[i,r]of t.templates.entries())a.has(r.category)||n.addIssue({code:"custom",path:["templates",i,"category"],message:"template category must exist in catalog categories"});if(t.visibility==="public"){for(let[i,r]of t.categories.entries())s(r.name,["categories",i,"name"]);for(let[i,r]of t.templates.entries()){for(let[_,c]of Object.entries(r.copy))s(c,["templates",i,"copy",_]);for(let[_,c]of r.fields.entries()){s(c.label,["templates",i,"fields",_,"label"]);for(let[g,j]of c.options.entries())s(j.label,["templates",i,"fields",_,"options",g,"label"])}}}});function x0(t,n){let s=ga(n),a=s?t.translations?.[s]:void 0;return a!==void 0&&a.trim()!==""?a:t.english}var $_=["Text","Summary","Email","Phone","DropdownSelection","RadioButton","Checkbox","Boolean","Date","Num","MultipleFile","SpecificFile"],Y_={text:"Text",textarea:"Summary",email:"Email",phone:"Phone",select:"DropdownSelection",radio:"RadioButton",multiselect:"Checkbox",boolean:"Boolean",date:"Date",number:"Num",file:"MultipleFile"},X_=l.object({value:gi,label:l.string().trim().min(1).max(255)}).strict(),Z_=l.object({field_name:an,field_type:l.enum($_),field_label:l.string().trim().min(1).max(255),is_required:l.boolean(),sort_order:l.number().int().nonnegative(),options:l.array(X_).max(100)}).strict(),Or=l.object({version:l.literal(1),locale:pe,fields:l.array(Z_).min(1).max(200)}).strict().superRefine((t,n)=>{he(t.fields.map(s=>Me(s.field_name)),["fields"],"field_name must be unique",n);for(let[s,a]of t.fields.entries())_i(a.field_type,a.options.length,["fields",s,"options"],n),he(a.options.map(i=>i.value),["fields",s,"options"],"option value must be unique within a field",n),he(a.options.map(i=>Dr(i.label,t.locale)),["fields",s,"options"],"option label must be unique within a field",n)});function E0(t){let n=t.nodes.filter(s=>s.kind==="field").map((s,a)=>({field_name:s.field_name,field_type:s.type==="file"&&s.max_files===1?"SpecificFile":Y_[s.type],field_label:s.label,is_required:s.required,sort_order:a,options:s.options.map(i=>({...i}))}));return Or.parse({version:1,locale:t.content_locale,fields:n})}var te=l.string().regex(/^sha256:[0-9a-f]{64}$/),Q_=l.union([le,l.enum(["app/api/forms/[code]/route.ts","hooks/use-cms-form-submit.ts","lib/cms/forms.ts","lib/cms/client.ts"])]),J_=l.object({path:Q_,content_hash:te.nullable()}).strict(),eh=l.array(J_).min(1).max(500).superRefine((t,n)=>{he(t.map(s=>s.path),[],"affected file paths must be unique",n)}),Si=l.object({grade:l.enum(["standard","A","B","C"]),required:l.boolean(),pending_confirmations:l.array(l.object({item_id:l.string().regex(sn),field_name:an.optional(),kind:l.enum(["form_copy","layout","field_label","field_type","field_required","field_options"]),message:l.string().trim().min(1).max(500)}).strict().superRefine((t,n)=>{t.kind.startsWith("field_")&&!t.field_name&&n.addIssue({code:"custom",path:["field_name"],message:"field confirmation items require field_name"})})).max(200)}).strict().superRefine((t,n)=>{let s=t.grade==="standard";s===t.required&&n.addIssue({code:"custom",path:["required"],message:s?"standard forms do not require standardization confirmation":"legacy forms require standardization confirmation"}),t.grade==="C"&&t.pending_confirmations.length===0&&n.addIssue({code:"custom",path:["pending_confirmations"],message:"grade C requires at least one pending confirmation"}),t.grade!=="C"&&t.pending_confirmations.length>0&&n.addIssue({code:"custom",path:["pending_confirmations"],message:"only grade C can contain pending confirmations"})}),th=l.object({site_id:I,form_definition_id:Wn,base_snapshot_id:x,expected_form_spec_hash:te,expected_cms_schema_hash:te.nullable(),draft_form_spec_hash:te,desired_cms_schema_hash:te,affected_files_hash:te,shared_reference_hash:te,shared_reference_count:l.number().int().positive(),confirm_shared_update:l.boolean(),recreate_missing_binding:l.boolean(),standardization:Si,confirm_standardization:l.boolean()}).strict(),Nr=l.object({reference_hash:te,page_count:l.number().int().positive(),block_count:l.number().int().positive()}).strict().refine(t=>t.page_count<=t.block_count,{message:"page_count cannot exceed block_count"}),I0=l.object({site_id:I,form_block_id:v_,base_snapshot_id:x,form_spec:hi,runtime_upgrade_required:l.boolean(),expected_form_spec_hash:te,expected_cms_schema_hash:te.nullable(),affected_files_hash:te,shared_impact:Nr,standardization:Si}).strict(),nh=l.object({operation_id:ui,operation_fingerprint:te,site_id:I,form_definition_id:Wn,base_snapshot_id:x,expected_form_spec_hash:te,expected_cms_schema_hash:te.nullable(),draft_form_spec:hi,draft_form_spec_hash:te,desired_cms_schema_hash:te,affected_files_hash:te,shared_impact:Nr,confirm_shared_update:l.boolean(),recreate_missing_binding:l.boolean(),standardization:Si,confirm_standardization:l.boolean()}).strict().superRefine((t,n)=>{t.form_definition_id!==t.draft_form_spec.form_definition_id&&n.addIssue({code:"custom",path:["form_definition_id"],message:"form_definition_id must match draft_form_spec"}),t.shared_impact.block_count>1&&!t.confirm_shared_update&&n.addIssue({code:"custom",path:["confirm_shared_update"],message:"shared definition updates require explicit confirmation"});let s=t.draft_form_spec.binding.status==="missing";s!==t.recreate_missing_binding&&n.addIssue({code:"custom",path:["recreate_missing_binding"],message:s?"missing bindings require explicit recreation confirmation":"only missing bindings can be recreated"});let a=t.draft_form_spec.binding.status==="bound",i=a&&t.standardization.required&&(t.standardization.grade==="B"||t.standardization.grade==="C");(a&&!i&&t.expected_cms_schema_hash===null||!a&&t.expected_cms_schema_hash!==null)&&n.addIssue({code:"custom",path:["expected_cms_schema_hash"],message:a?"bound standard forms require the current CMS schema hash":"unbound or missing forms cannot claim a current CMS schema hash"}),t.confirm_standardization!==t.standardization.required&&n.addIssue({code:"custom",path:["confirm_standardization"],message:t.standardization.required?"legacy standardization requires explicit confirmation":"standard forms cannot claim legacy standardization confirmation"})}),sh=["created","validated","binding_reserved","candidate_ready","cms_applied","snapshot_promoted","committed","compensating","recovery_required","failed"],fi=l.enum(sh),ih=["pending","running","succeeded","failed","recovery_required"],Lr=l.enum(ih),ah=["candidate_abandon","snapshot_reconcile","cms_restore"],Mr=l.enum(ah),oh=["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"],bi=l.enum(oh),Ur=l.enum(["wait","resume","retry_new_operation","manual_recovery","none"]),Fr=l.enum(["not_started","pending","succeeded","failed"]),qr=l.object({operation_id:ui,operation_fingerprint:te,site_id:I,form_definition_id:Wn,stage:fi,status:Lr,base_snapshot_id:x,candidate_snapshot_id:x.nullable(),before_form_code:l.string().regex(Et).nullable(),materialized_form_code:l.string().regex(Et).nullable(),expected_form_spec_hash:te,draft_form_spec_hash:te,materialized_form_spec_hash:te.nullable(),expected_cms_schema_hash:te.nullable(),desired_cms_schema_hash:te,retry_count:l.number().int().nonnegative(),failure_stage:Mr.nullable(),last_error_code:bi.nullable(),retryable:l.boolean(),next_action:Ur,preview_refresh_status:Fr,created_at:l.string().datetime({offset:!0}),updated_at:l.string().datetime({offset:!0})}).strict().superRefine((t,n)=>{if(!(t.stage!=="committed"&&t.status!=="succeeded")){(t.stage!=="committed"||t.status!=="succeeded")&&n.addIssue({code:"custom",path:["status"],message:"committed stage and succeeded status must be reported together"});for(let s of["candidate_snapshot_id","materialized_form_code","materialized_form_spec_hash"])t[s]===null&&n.addIssue({code:"custom",path:[s],message:`${s} is required for a committed success`});(t.failure_stage!==null||t.last_error_code!==null||t.retryable||t.next_action!=="none")&&n.addIssue({code:"custom",path:["next_action"],message:"a committed success cannot retain an error or retry action"})}}),yi=l.object({operation:qr}).strict(),R0=yi,T0=yi,k0=l.object({operation_fingerprint:te}).strict(),P0=yi,rh=l.preprocess(t=>!t||typeof t!="object"||Array.isArray(t)||"standardization"in t||"confirm_standardization"in t?t:{...t,standardization:{grade:"standard",required:!1,pending_confirmations:[]},confirm_standardization:!1},nh),w0=l.object({operation:qr,request:rh,cms_replace_result:l.unknown().nullable()}).strict(),ch=l.object({stage:fi.optional(),status:Lr.optional(),candidate_snapshot_id:x.nullable().optional(),before_form_code:l.string().regex(Et).nullable().optional(),materialized_form_code:l.string().regex(Et).nullable().optional(),materialized_form_spec_hash:te.nullable().optional(),retry_count:l.number().int().nonnegative().optional(),failure_stage:Mr.nullable().optional(),last_error_code:bi.nullable().optional(),retryable:l.boolean().optional(),next_action:Ur.optional(),preview_refresh_status:Fr.optional()}).strict(),A0=l.object({expected_updated_at:l.string().datetime({offset:!0}),operation:ch,cms_replace_result:l.unknown().nullable().optional()}).strict().refine(t=>Object.keys(t.operation).length>0||Object.hasOwn(t,"cms_replace_result"),{message:"transition must change operation state or CMS result"}),v0=l.object({code:bi,message:l.string().trim().min(1).max(500),retryable:l.boolean(),operation_id:ui.optional(),stage:fi.optional()}).strict();function mh(t){return th.parse({site_id:t.site_id,form_definition_id:t.form_definition_id,base_snapshot_id:t.base_snapshot_id,expected_form_spec_hash:t.expected_form_spec_hash,expected_cms_schema_hash:t.expected_cms_schema_hash,draft_form_spec_hash:t.draft_form_spec_hash,desired_cms_schema_hash:t.desired_cms_schema_hash,affected_files_hash:t.affected_files_hash,shared_reference_hash:t.shared_impact.reference_hash,shared_reference_count:t.shared_impact.block_count,confirm_shared_update:t.confirm_shared_update,recreate_missing_binding:t.recreate_missing_binding,standardization:t.standardization,confirm_standardization:t.confirm_standardization})}function Ar(t){for(let n=0;n<t.length;n+=1){let s=t.charCodeAt(n);if(s>=55296&&s<=56319){let a=t.charCodeAt(n+1);if(n+1>=t.length||a<56320||a>57343)throw new TypeError("canonical JSON cannot contain a lone surrogate");n+=1}else if(s>=56320&&s<=57343)throw new TypeError("canonical JSON cannot contain a lone surrogate")}}function pi(t,n){if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="number"){if(!Number.isFinite(t))throw new TypeError("canonical JSON numbers must be finite");return JSON.stringify(t)}if(typeof t=="string")return Ar(t),JSON.stringify(t);if(typeof t!="object")throw new TypeError("value is not valid JSON");if(n.has(t))throw new TypeError("canonical JSON cannot contain cycles");n.add(t);try{if(Array.isArray(t)){let r=[];for(let _=0;_<t.length;_+=1){if(!(_ in t))throw new TypeError("canonical JSON cannot contain sparse arrays");r.push(pi(t[_],n))}return`[${r.join(",")}]`}let s=Object.getPrototypeOf(t);if(s!==Object.prototype&&s!==null)throw new TypeError("canonical JSON objects must be plain records");let a=t;return`{${Object.keys(a).sort().map(r=>(Ar(r),`${JSON.stringify(r)}:${pi(a[r],n)}`)).join(",")}}`}finally{n.delete(t)}}function xi(t){return pi(t,new Set)}async function Vn(t){let n=xi(t),s=new TextEncoder().encode(n),a=globalThis.crypto?.subtle?new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",s)):(await import("@noble/hashes/sha256")).sha256(s);return`sha256:${Array.from(a,r=>r.toString(16).padStart(2,"0")).join("")}`}async function C0(t){return Vn(hi.parse(t))}async function D0(t){return Vn(Or.parse(t))}async function j0(t){let n=eh.parse(t).map(s=>({...s})).sort((s,a)=>s.path<a.path?-1:s.path>a.path?1:0);return Vn({version:1,files:n})}async function O0(t){return Vn(mh(t))}import{z as P}from"zod";var M0=["page-seo","root-layout-metadata","nav-items"],U0=P.object({path:P.string(),title:P.string(),description:P.string().optional(),keywords:P.string().optional(),meta_tags_json:P.record(P.string(),P.record(P.string(),P.string())).nullish(),schema_json:P.union([P.record(P.string(),P.unknown()),P.array(P.record(P.string(),P.unknown())),P.string()]).nullish(),breadcrumbs_json:P.array(P.object({name:P.string().optional(),text:P.string().optional(),url:P.string().nullish()})).nullish()}),F0=P.object({metadataBase:P.string().optional(),title:P.union([P.string(),P.object({default:P.string().optional(),template:P.string().optional(),absolute:P.string().optional()})]).optional(),description:P.string().optional(),keywords:P.string().optional(),openGraph:P.object({title:P.string().optional(),description:P.string().optional(),type:P.string().optional(),siteName:P.string().optional(),url:P.string().optional(),locale:P.string().optional(),images:P.array(P.union([P.string(),P.object({url:P.string(),alt:P.string().optional()})])).optional()}).optional(),twitter:P.object({card:P.string().optional(),title:P.string().optional(),description:P.string().optional(),images:P.array(P.string()).optional()}).optional(),alternates:P.object({canonical:P.string().optional()}).optional()}),Gr=()=>P.object({label:P.string(),href:P.string().optional(),targetType:P.enum(["page","anchor","external","email","phone","file","group"]).optional(),role:P.enum(["link","cta"]).optional(),openInNewTab:P.boolean().optional(),nofollow:P.boolean().optional(),description:P.string().optional(),badge:P.string().optional(),iconKey:P.string().optional()}),q0=Gr().extend({children:P.array(Gr()).optional()}),lh=["title","description","keywords","breadcrumbs_json.*.name","breadcrumbs_json.*.text"],ph=["path","meta_tags_json.**","schema_json.**","breadcrumbs_json.*.url"],dh=["title","title.default","title.template","title.absolute","description","keywords","openGraph.title","openGraph.description","openGraph.siteName","openGraph.images.*.alt","twitter.title","twitter.description"],uh=["metadataBase","openGraph.type","openGraph.url","openGraph.locale","openGraph.images.*","openGraph.images.*.url","twitter.card","twitter.images.*","alternates.canonical"],gh=["label","description","badge"],_h=["href","targetType","role","iconKey"],Kr={"page-seo":{localizable:lh,machine:ph},"root-layout-metadata":{localizable:dh,machine:uh},"nav-items":{localizable:gh,machine:_h}},zr="*",Br="**",hh="children";function Sh(t){return typeof t=="number"||/^\d+$/.test(t)?zr:t}function Wr(t,n){let s=n.map(Sh);return t!=="nav-items"?s:s.filter(a=>a!==zr&&a!==hh)}function Vr(t,n){let s=t.split(".");for(let a=0;a<s.length;a+=1){if(s[a]===Br)return!0;if(a>=n.length||s[a]!==n[a])return!1}return s.length===n.length}function fh(t,n){let s=t.split(".");if(n.length>=s.length)return!1;for(let a=0;a<n.length;a+=1){if(s[a]===Br)return!0;if(s[a]!==n[a])return!1}return!0}function G0(t,n){let s=Wr(t,n);return s.length===0?!1:Kr[t].localizable.some(a=>Vr(a,s))}function K0(t,n){let s=Wr(t,n);if(s.length===0)return!0;let{localizable:a,machine:i}=Kr[t];return[...a,...i].some(r=>Vr(r,s)||fh(r,s))}var W0=["product-search","migration-products","standard-form","form-submission-infrastructure"],bh=[{path:"app/search/page.tsx",materializer:"product-search"},{path:"components/site/generated/product-search/entry.tsx",materializer:"product-search"},{path:"components/site/generated/product-search/results.tsx",materializer:"product-search"},{path:"app/api/product-search/facets/route.ts",materializer:"product-search"},{path:"lib/cms/product-search.ts",materializer:"product-search"},{path:"lib/generated/product-search-value-codec.ts",materializer:"product-search"},{path:"lib/generated/product-search-config.json",materializer:"product-search"},{path:`lib/cms/generated/${Ke}.ts`,materializer:"migration-products"},{path:`components/site/generated/${Ke}-list.tsx`,materializer:"migration-products"},{path:`components/site/generated/${Ke}-list-view.tsx`,materializer:"migration-products"},{path:`components/site/generated/${Ke}-detail-view.tsx`,materializer:"migration-products"},{path:`app/${Ke}/[slug]/page.tsx`,materializer:"migration-products"},{path:`components/site/generated/${Ke}-breadcrumb.tsx`,materializer:"migration-products"},{path:"components/site/generated/forms/vcp-form-runtime.tsx",materializer:"standard-form"},{path:"app/api/forms/[code]/route.ts",materializer:"form-submission-infrastructure"},{path:"hooks/use-cms-form-submit.ts",materializer:"form-submission-infrastructure"},{path:"lib/cms/forms.ts",materializer:"form-submission-infrastructure"}],yh=[{prefix:"components/site/generated/forms/form-",suffix:".tsx",materializer:"standard-form"}],V0=[{path:"lib/cms/client.ts",reason:"\u4E0D\u662F\u7269\u5316\u4EA7\u7269\uFF1A\u6A21\u677F\u81EA\u5E26\u7684 CMS \u4F20\u8F93\u5C42\uFF0C\u7269\u5316\u5668\u53EA\u5BF9\u5B83\u505A\u5B9A\u70B9\u5B57\u7B26\u4E32\u5347\u7EA7\uFF08\u591A\u90E8\u5206\u8868\u5355\u63D0\u4EA4\u3001no-store \u8BFB\uFF09\uFF0C\u6574\u4EFD\u8986\u5199\u53CD\u800C\u4F1A\u62B9\u6389\u7AD9\u70B9\u4FA7\u7684\u5176\u4ED6\u5347\u7EA7\u3002"},{path:"components/site/generated/forms/form-<id>.spec.ts",reason:"\u8DEF\u5F84\u5F52\u5E73\u53F0\u3001\u5185\u5BB9\u5F52\u7AD9\u70B9\uFF1A\u8868\u5355\u8BBE\u8BA1\u5668\u5199\u7684\u5B57\u6BB5\u6587\u6848\uFF0C\u5F52 FORM_SPEC_LOCALIZABLE_FIELD_PATHS \u7684\u5B57\u6BB5\u7EA7\u6E05\u5355\u7BA1\u8F96\u3002"}];function xh(t){return t.length>0&&!t.includes("/")&&!t.includes(".")}function H0(t){return bh.some(n=>n.path===t)?!0:yh.some(n=>!t.startsWith(n.prefix)||!t.endsWith(n.suffix)?!1:xh(t.slice(n.prefix.length,t.length-n.suffix.length)))}import{z as Be}from"zod";var Eh=["provisioning","cms_app_created","seeded","ready","failed"],Z0=Be.object({tenant_id:Be.string().min(1),site_id:I,collection_slug:Be.string().min(1),cms_collection_id:Be.string().min(1).nullable(),status:Be.enum(Eh),owned_by_vcp:Be.boolean(),run_id:V.nullable(),last_error:Be.string().nullable(),created_at:Be.string().datetime(),updated_at:Be.string().datetime()});var Hr="/vibe/v1";function J0(t){let n=t?.trim().replace(/\/+$/,"");if(!n)return null;try{let s=new URL(n),a=s.pathname.replace(/\/+$/,"");return s.search="",s.hash="",s.pathname=a.endsWith(Hr)?a:Hr,s.href.replace(/\/+$/,"")}catch{return n}}import{z as u}from"zod";var Hn=u.string().url().refine(Kh,{message:"URL must use http or https"}),$r=u.string().trim().pipe(Hn),Ih=u.object({task_type:u.literal("home_url"),task_url:$r,planned_num:u.number().int().min(1).max(20).optional()}).strict(),Rh=u.object({task_type:u.literal("url_list"),urls:u.array(Hn).min(1).max(1e4)}).strict(),sP=u.discriminatedUnion("task_type",[Ih,Rh]),iP=u.object({page:u.coerce.number().int().positive().default(1),page_size:u.coerce.number().int().min(1).max(20).default(20)}).strict(),aP=u.object({home_url:$r}).strict(),mt=u.string().uuid(),It=u.string().uuid(),oP=u.object({task_uuid:mt}).strict(),Yr=u.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]),Th=u.object({task_uuid:mt,status:u.literal("NOT_STARTED"),total:u.literal(0)}).strict(),kh=u.object({task_uuid:mt,status:u.literal("PROCESSING"),total:u.literal(0)}).strict(),rP=u.enum(["no_suitable_page_candidate","page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"]),Ph=u.discriminatedUnion("status",[u.object({role:He,status:u.literal("selected"),reason_code:u.null()}).strict(),u.object({role:He,status:u.literal("not_found"),reason_code:u.literal("no_suitable_page_candidate")}).strict(),u.object({role:He,status:u.literal("unknown"),reason_code:u.enum(["page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"])}).strict()]),Xr=u.array(Ph).length(7).superRefine((t,n)=>{let s=new Set(t.map(a=>a.role));s.size!==t.length&&n.addIssue({code:"custom",message:"discovery coverage roles must be unique"});for(let a of He.options)s.has(a)||n.addIssue({code:"custom",message:`discovery coverage is missing role ${a}`})}),wh=u.object({task_uuid:mt,status:u.literal("SUCCEEDED"),total:u.number().int().positive(),discovery_coverage:Xr.optional()}).strict(),Ah=u.enum(["TASK_FAILED","PROVIDER_CAPABILITY_LIMIT","WEBSITE_UNREACHABLE"]),vh=u.object({task_uuid:mt,status:u.literal("FAILED"),total:u.literal(0),error_code:Ah,error_message:u.string().min(1),failure_stage:Yr}).strict(),cP=u.discriminatedUnion("status",[Th,kh,wh,vh]),Ch=u.object({url:Hn,raw_html:u.string().min(1)}).strict(),mP=u.object({task_uuid:mt,status:u.literal("SUCCEEDED"),page:u.number().int().positive(),page_size:u.number().int().min(1).max(20),total:u.number().int().positive(),total_pages:u.number().int().positive(),pages:u.array(Ch).max(20),discovery_coverage:Xr.optional()}).strict().superRefine((t,n)=>{t.total_pages!==Math.ceil(t.total/t.page_size)&&n.addIssue({code:"custom",path:["total_pages"],message:"total_pages must equal ceil(total / page_size)"}),t.pages.length>t.page_size&&n.addIssue({code:"custom",path:["pages"],message:"pages must not exceed page_size"})}),lP=u.object({task_code:It}).strict(),Dh=u.object({task_code:It,status:u.literal("NOT_STARTED")}).strict(),jh=u.object({task_code:It,status:u.literal("PROCESSING")}).strict(),Oh=u.object({task_code:It,status:u.literal("SUCCEEDED"),urls:u.array(Hn)}).strict(),Nh=u.literal("SITEMAP_DISCOVERY_FAILED"),Lh=u.object({task_code:It,status:u.literal("FAILED"),error_code:Nh,error_message:u.string().min(1)}).strict(),pP=u.discriminatedUnion("status",[Dh,jh,Oh,Lh]),dP=u.object({company_name:u.string().regex(/\S/u)}).strict(),Mh=u.object({company_name:u.string(),brand_name:u.string(),main_products:u.array(u.string()),industry:u.array(u.string()),subfields:u.array(u.string()),business_intro:u.string(),registered_capital:u.string(),legal_representative:u.string(),target_markets:u.array(u.string()),target_customer_industries:u.array(u.string()),target_customer_roles:u.array(u.string()),purchase_scenarios:u.string(),differentiators:u.array(u.string()),competitors:u.array(u.object({name:u.string(),official_url:u.string()}).strict()).max(3),qualifications:u.array(u.string()),representative_cases:u.array(u.string()),acquisition_channels:u.array(u.string()),desired_domain:u.string(),brand_tone:u.string(),timezone:u.string()}).strict(),$n=u.object({company_uuid:u.string().uuid(),company_info:Mh,created_at:u.string().datetime(),updated_at:u.string().datetime()}),Uh=$n.extend({status:u.literal("NOT_STARTED"),last_error_code:u.null(),last_error_message:u.null(),started_at:u.null(),completed_at:u.null()}).strict(),Fh=$n.extend({status:u.literal("PROCESSING"),last_error_code:u.null(),last_error_message:u.null(),started_at:u.string().datetime(),completed_at:u.null()}).strict(),Zr=$n.extend({status:u.literal("SUCCEEDED"),last_error_code:u.null(),last_error_message:u.null(),started_at:u.string().datetime(),completed_at:u.string().datetime()}).strict(),Qr=$n.extend({status:u.literal("FAILED"),last_error_code:u.string().min(1),last_error_message:u.string().min(1),started_at:u.string().datetime(),completed_at:u.string().datetime()}).strict(),uP=u.discriminatedUnion("status",[Zr,Qr]),gP=u.discriminatedUnion("status",[Uh,Fh,Zr,Qr]),qh=["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"],Gh=u.enum(qh),_P=u.object({error_code:Gh,error_message:u.string().min(1),failure_stage:Yr.optional(),task_uuid:mt.optional(),task_code:It.optional()}).strict();function Kh(t){try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as N}from"zod";var ve=N.string().url().refine(Wh,{message:"URL must use http or https"}),Jr=N.string().min(1).max(512),Yn=N.string().datetime({offset:!0}),ec=N.enum(["scraping","completed","failed","expired"]),fP=N.object({url:ve,ignore_cache:N.boolean(),sitemap:N.enum(["include","skip"]),include_subdomains:N.boolean(),ignore_query_parameters:N.boolean(),limit:N.number().int().min(1).max(1e5)}).strict(),bP=N.object({links:N.array(ve).max(1e5)}).strict(),yP=N.object({url:ve,limit:N.number().int().min(1).max(1e5),max_discovery_depth:N.literal(1),crawl_entire_domain:N.literal(!1),allow_subdomains:N.literal(!0),sitemap:N.literal("skip")}).strict(),xP=N.object({crawl_id:Jr,expires_at:Yn.optional()}).strict(),EP=N.object({status:ec,urls:N.array(ve).max(1e5),next:ve.optional(),expires_at:Yn}).strict(),IP=N.object({url:ve,formats:N.tuple([N.literal("rawHtml")]),only_main_content:N.literal(!1),max_age:N.number().int().nonnegative()}).strict(),RP=N.object({url:ve,raw_html:N.string().min(1),status_code:N.number().int().min(100).max(599).nullable()}).strict(),TP=N.object({urls:N.array(ve).min(1).max(1e4),formats:N.tuple([N.literal("rawHtml")]),ignore_invalid_urls:N.literal(!1),max_age:N.number().int().nonnegative(),max_concurrency:N.number().int().positive().optional()}).strict(),kP=N.object({batch_id:Jr,expires_at:Yn.optional()}).strict(),zh=N.object({url:ve,raw_html:N.string().min(1)}).strict(),PP=N.object({status:ec,total:N.number().int().nonnegative(),completed:N.number().int().nonnegative(),pages:N.array(zh).max(1e4),next:ve.optional(),expires_at:Yn}).strict().superRefine((t,n)=>{t.completed>t.total&&n.addIssue({code:"custom",path:["completed"],message:"completed must not exceed total"})}),Bh=N.object({url:ve,error_message:N.string().min(1)}).strict(),wP=N.object({errors:N.array(Bh).max(1e4),robots_blocked:N.array(ve).max(1e4)}).strict(),AP=N.object({active:N.number().int().nonnegative(),waiting:N.number().int().nonnegative(),max_concurrency:N.number().int().positive()}).strict();function Wh(t){try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as S}from"zod";var nc=S.lazy(()=>rn),Vh=S.enum(["page","block"]),Zn=S.enum(["component","page","pages"]),Hh=S.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),lt=Hh,sc=S.object({requested_locale:lt,resolved_locale:lt,fallback_used:S.boolean()}).strict(),on=S.object({id:S.string().uuid(),key:S.string().min(1),name:S.string().min(1)}).strict(),Xn=on.extend({color:S.string().nullable()}).strict(),OP=S.object({kind:Vh,category_id:S.string().uuid().optional(),tag_id:S.string().uuid().optional(),search:S.string().trim().min(1).max(200).optional(),limit:S.coerce.number().int().min(1).max(50).default(20),cursor:S.string().min(1).optional()}).strict(),$h=S.object({stable_key:S.string().min(1),type:Zn,title:S.string().min(1).max(200),description:S.string().max(1e3),thumbnail_url:S.string().url().nullable(),resolved_version:S.number().int().positive(),content_schema_version:S.literal(3),category:on.nullable(),tags:S.array(Xn),page_count:S.number().int().nonnegative(),component_count:S.number().int().nonnegative(),locale:sc}).strict(),NP=S.object({items:S.array($h),facets:S.object({categories:S.array(on),tags:S.array(Xn)}).strict(),next_cursor:S.string().nullable()}).strict(),LP=S.object({operation_id:S.string().uuidv7(),resolved_version:S.number().int().positive(),base_sitemap_id:S.string().uuid(),base_sitemap_version:S.number().int().positive(),sitemap:nc,target_page_id:S.string().min(1).optional()}).strict(),MP=S.object({next_sitemap:nc,applied:S.object({stable_key:S.string().min(1),resolved_version:S.number().int().positive(),template_type:Zn,page_ids:S.array(S.string().min(1)),block_ids:S.array(S.string().min(1))}).strict(),locale:sc,warnings:S.array(S.string())}).strict(),ic=S.object({nodeId:S.string().uuid(),type:S.string().trim().min(1).max(100),label:S.string().trim().min(1).max(200),variant:S.string().trim().min(1).max(100).optional(),order:S.number().int().nonnegative(),props:S.record(S.string(),S.unknown()),thumbnail:S.string().url().optional(),source:S.unknown().optional()}).strict(),tc=S.object({nodeId:S.string().uuid().optional(),slug:S.string().regex(/^\/$|^\/[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*$/u),navigation:S.object({showInHeader:S.boolean(),showInFooter:S.boolean(),order:S.number().int().nonnegative()}).strict(),components:S.array(ic).min(1).max(100),thumbnail:S.string().url().optional(),source:S.unknown().optional()}).strict(),Yh=S.union([ic,tc,S.object({pages:S.array(tc).min(1).max(50),thumbnail:S.string().url().optional(),source:S.unknown().optional()}).strict()]),Xh=S.object({title:S.string().min(1).max(200),description:S.string().min(1).max(1e3),prompt:S.string().min(1).max(8192)}).strict(),Zh=S.object({locale:lt,title:S.string().min(1).max(200),content:S.object({description:S.string().min(1).max(1e3),prompt:S.string().min(1).max(8192),nodes:S.record(S.string().uuid(),Xh)}).strict()}).strict(),UP=S.object({templateId:S.string().uuid(),stableKey:S.string().min(1),type:Zn,resolvedVersion:S.number().int().positive(),contentSchemaVersion:S.literal(3),structure:Yh,requestedLocale:lt,resolvedLocale:lt,fallbackUsed:S.boolean(),contents:S.array(Zh).length(1)}).strict().superRefine((t,n)=>{(t.type==="component"&&!("type"in t.structure)||t.type==="page"&&!("components"in t.structure)||t.type==="pages"&&!("pages"in t.structure))&&n.addIssue({code:"custom",path:["structure"],message:"Template type and structure must match."});let s=Qh(t.structure),a=new Set(Object.keys(t.contents[0]?.content.nodes??{}));(s.size!==a.size||[...s].some(i=>!a.has(i)))&&n.addIssue({code:"custom",path:["contents",0,"content","nodes"],message:"Localized nodes must exactly match the structure nodes."}),t.contents[0]?.locale!==t.resolvedLocale&&n.addIssue({code:"custom",path:["contents"],message:"Resolved locale must match returned content."}),t.fallbackUsed!==(t.requestedLocale!==t.resolvedLocale)&&n.addIssue({code:"custom",path:["fallbackUsed"],message:"fallbackUsed must match locale resolution."})}),FP=S.object({items:S.array(S.object({stableKey:S.string().min(1),type:Zn,title:S.string().min(1).max(200),description:S.string().max(1e3),thumbnailUrl:S.string().url().nullable(),resolvedVersion:S.number().int().positive(),contentSchemaVersion:S.literal(3),category:on.nullable(),tags:S.array(Xn),pageCount:S.number().int().nonnegative(),componentCount:S.number().int().nonnegative(),requestedLocale:lt,resolvedLocale:lt,fallbackUsed:S.boolean()}).strict()),facets:S.object({categories:S.array(on),tags:S.array(Xn)}).strict(),nextCursor:S.string().nullable()}).strict().superRefine((t,n)=>{t.items.forEach((s,a)=>{s.fallbackUsed!==(s.requestedLocale!==s.resolvedLocale)&&n.addIssue({code:"custom",path:["items",a,"fallbackUsed"],message:"fallbackUsed must match locale resolution."})})});function Qh(t){if("type"in t)return new Set([t.nodeId]);let n="pages"in t?t.pages:[t];return new Set(n.flatMap(s=>[...s.nodeId?[s.nodeId]:[],...s.components.map(a=>a.nodeId)]))}function qP(t){return xi({tenant_id:t.tenant_id,site_id:t.site_id,stable_key:t.stable_key,resolved_version:t.request.resolved_version,base_sitemap_id:t.request.base_sitemap_id,base_sitemap_version:t.request.base_sitemap_version,sitemap:t.request.sitemap,target_page_id:t.request.target_page_id??null})}import{z as H}from"zod";var Jh=["pending_dns","active","failed","removing"],eS=H.enum(Jh),tS=["serve_site","redirect_301"],nS=H.enum(tS),sS=["traffic","ownership","certificate_delegation"],oc=H.enum(sS),iS=["pending","verified"],aS=H.enum(iS),Ei=H.enum(["prepare_configuration","apply_configuration","verify_dns"]),oS=H.enum(["accepted","running","succeeded","failed"]),rS=H.object({code:H.string().min(1),message:H.string().min(1)}).strict(),cS=H.object({purpose:oc,verified:H.boolean(),observedValues:H.array(H.string())}).strict(),mS=H.object({ready:H.boolean(),providerReady:H.boolean(),dnsVerified:H.boolean(),records:H.array(cS)}).strict(),lS=H.object({purpose:oc,type:H.string().min(1),name:H.string().min(1),value:H.string().min(1),verificationStatus:aS}).strict(),ac=H.object({id:H.string().min(1),hostname:H.string().min(1),isPrimary:H.boolean(),routingMode:nS,observedStatus:eS,lastVerifiedAt:H.string().datetime().nullable(),dnsRecords:H.array(lS)}).strict().superRefine((t,n)=>{pS(t.hostname)||n.addIssue({code:"custom",path:["hostname"],message:"hostname must be a canonical ASCII hostname"}),t.isPrimary&&t.routingMode!=="serve_site"&&n.addIssue({code:"custom",path:["routingMode"],message:"a primary domain must serve the site"}),!t.isPrimary&&t.routingMode!=="redirect_301"&&n.addIssue({code:"custom",path:["routingMode"],message:"a non-primary domain must redirect with 301"})}),rc=H.object({primaryDomain:ac.nullable(),redirectDomains:H.array(ac)}).strict().superRefine((t,n)=>{t.primaryDomain!==null&&(!t.primaryDomain.isPrimary||t.primaryDomain.routingMode!=="serve_site")&&n.addIssue({code:"custom",path:["primaryDomain"],message:"primaryDomain must be primary and serve the site"});for(let[a,i]of t.redirectDomains.entries())(i.isPrimary||i.routingMode!=="redirect_301")&&n.addIssue({code:"custom",path:["redirectDomains",a],message:"redirectDomains must be non-primary 301 redirects"});t.primaryDomain!==null&&t.redirectDomains.some(i=>i.hostname===t.primaryDomain?.hostname)&&n.addIssue({code:"custom",path:["redirectDomains"],message:"primaryDomain must not also be a redirect"});let s=[...t.primaryDomain===null?[]:[t.primaryDomain.hostname],...t.redirectDomains.map(a=>a.hostname)];new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["redirectDomains"],message:"domain hostnames must be unique"})}),Ii=H.object({id:H.string().min(1),type:Ei,status:oS,error:rS.nullable(),result:mS.nullable().optional()}).strict().superRefine((t,n)=>{t.status==="failed"&&t.error===null&&n.addIssue({code:"custom",path:["error"],message:"failed operations must include a stable error"}),t.status!=="failed"&&t.error!==null&&n.addIssue({code:"custom",path:["error"],message:"non-failed operations must not include an error"}),t.result!==void 0&&t.result!==null&&(t.type!=="verify_dns"||t.status!=="succeeded")&&n.addIssue({code:"custom",path:["result"],message:"DNS verification results only belong to succeeded verify_dns operations"})});function pS(t){if(t!==t.trim()||t!==t.toLowerCase()||t.length>253||t.endsWith("."))return!1;let n=t.split(".");return n.length>=2&&n[n.length-1].length>=2&&n.every(s=>s.length>=1&&s.length<=63&&/^[a-z0-9-]+$/.test(s)&&!s.startsWith("-")&&!s.endsWith("-"))}import{z as cn}from"zod";import{z as C}from"zod";var dS=C.enum(["active","completed","canceled"]),uS=C.enum(["quality","domain","gsc","publish"]),Rt=C.enum(["pending","running","succeeded","failed"]),gS=C.enum(["calculating","passed","failed"]),_S=C.object({group_code:C.string().min(1),name:C.string().min(1),display_status:Rt,result_text:C.string()}).strict(),hS=C.object({dimension_code:C.enum(["reach","trust","convert","safe"]),name:C.string().min(1),alias_en:C.string().min(1),description:C.string(),tips:C.string(),display_status:Rt,problem_group_count:C.number().int().nonnegative(),groups:C.array(_S)}).strict(),SS=C.object({task_code:C.string().uuid(),status:Rt,remediation_items:C.record(C.string(),C.unknown()),summary:C.object({final_score:C.number().int().min(0).max(100),can_publish:gS,group_count:C.number().int().nonnegative(),problem_group_count:C.number().int().nonnegative()}).strict(),dimensions:C.array(hS)}).strict(),pt=C.object({id:Qi,tenant_id:C.string().min(1),site_id:I,status:dS,current_step:uS,sensitive_word_task_id:C.number().int().nonnegative(),sensitive_word_task_status:Rt,quality_task_code:C.string().uuid(),quality_task_status:Rt,task_id:C.string().min(1).nullable(),task_status:Rt,publish_deployment_id:Fe.nullable(),domain_hostname:C.string().min(1).nullable(),domain_operation_type:Ei.nullable(),domain_operation_payload:C.record(C.string(),C.unknown()).nullable(),domain_preparation_operation_id:C.string().min(1).nullable(),domain_operation_id:C.string().min(1).nullable(),revision:C.number().int().positive(),created_at:C.string().min(1),updated_at:C.string().min(1),completed_at:C.string().min(1).nullable(),canceled_at:C.string().min(1).nullable()}).strict().superRefine((t,n)=>{if(t.task_id!==t.quality_task_code&&n.addIssue({code:"custom",path:["task_id"],message:"task_id must remain the read-only quality_task_code alias"}),t.task_status!==t.quality_task_status&&n.addIssue({code:"custom",path:["task_status"],message:"task_status must remain the read-only quality_task_status alias"}),t.domain_operation_type===null){t.domain_operation_payload!==null&&n.addIssue({code:"custom",path:["domain_operation_payload"],message:"domain_operation_payload must be null without an active domain operation"}),t.domain_operation_id!==null&&n.addIssue({code:"custom",path:["domain_operation_id"],message:"domain_operation_id must be null without an active domain operation"});return}t.domain_hostname===null&&n.addIssue({code:"custom",path:["domain_hostname"],message:"an active domain operation requires a hostname"}),t.domain_operation_payload===null&&n.addIssue({code:"custom",path:["domain_operation_payload"],message:"an active domain operation requires a payload"})}),YP=C.object({}).strict(),XP=C.object({}).strict(),ZP=C.object({expected_revision:C.number().int().nonnegative(),current_step:C.enum(["domain","gsc","publish"]),skip_domain_binding:C.boolean().optional()}).strict(),QP=C.object({expected_revision:C.number().int().nonnegative()}).strict(),fS=C.object({workflow:pt.nullable(),can_cancel:C.boolean()}).strict(),JP=M(fS).strict(),bS=C.object({workflow:pt,can_cancel:C.boolean()}).strict(),ew=M(bS).strict(),yS=C.object({workflow:pt,deployment:C.lazy(()=>Qe)}).strict(),tw=M(yS).strict(),nw=C.object({workflow:pt,can_cancel:C.boolean(),quality_result:SS.optional(),message:C.string().min(1).optional()}).strict();var xS=cn.object({hostname:cn.string().min(1),expected_revision:cn.number().int().nonnegative()}).strict(),cc=cn.object({workflow:pt,operation:Ii}).strict(),ES=M(cc).strict(),Ri=cn.object({workflow:pt,operation:Ii.nullable()}).strict(),IS=M(Ri).strict(),RS=Ri,TS=M(RS).strict(),cw=M(rc).strict(),mw=xS,lw=cc,pw=ES,dw=Ri,uw=IS,gw=TS;import{z as Pe}from"zod";var kS=["started","success","failed","canceled"],Ti=Pe.enum(kS),PS=["inactive","pending_binding","active"],ki=Pe.enum(PS),wS=["domain","url_prefix"],Pi=Pe.enum(wS),AS=["not_connected","authorizing","matching_property","ready","failed","canceled","domain_mismatch"],wi=Pe.enum(AS),Ue=Pe.string().nullable(),mc=Pe.object({}).strict(),Ai=Pe.object({authorize_url:Pe.string().url(),custom_domain:Ue}).strict(),lc=M(Ai),vS=Pe.object({auth_status:Ti,binding_status:ki,credential_connected:Pe.boolean(),custom_domain:Ue,gsc_site_url:Ue,property_type:Pi.nullable(),auth_error_code:Ue,auth_error_message:Ue}).strict(),pc=Pe.object({auth_status:Ti,binding_status:ki,credential_connected:Pe.boolean(),custom_domain:Ue,gsc_site_url:Ue,property_type:Pi.nullable(),auth_error_code:Ue,auth_error_message:Ue,current_domain:Ue,state:wi,ready:Pe.boolean()}).strict().superRefine((t,n)=>{let s=DS(t,t.current_domain),a=s==="ready";t.state!==s&&n.addIssue({code:"custom",path:["state"],message:`state must equal ${s} for the supplied GSC facts`}),t.ready!==a&&n.addIssue({code:"custom",path:["ready"],message:`ready must equal ${String(a)} for the supplied GSC facts`})}),CS=M(pc);function mn(t){let n=t?.trim()??"";if(!n)return"";let s=/^[a-z][a-z0-9+.-]*:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).hostname.replace(/\.+$/,"").toLowerCase()}catch{return n.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").split(/[/?#]/,1)[0].replace(/\.+$/,"").toLowerCase()}}function DS(t,n){let s=t.gsc_site_url?.trim()??"",a=mn(t.custom_domain),i=mn(n??("current_domain"in t?t.current_domain:void 0)),r=a.length>0&&i.length>0&&a===i,_=jS(s,t.property_type,i);return t.auth_status==="canceled"?"canceled":t.auth_status==="failed"?"failed":t.auth_status==="started"?"authorizing":!t.credential_connected||t.binding_status==="inactive"?"not_connected":s.length===0||t.property_type===null?"matching_property":!r||!_?"domain_mismatch":t.binding_status==="pending_binding"?"matching_property":t.auth_status==="success"&&t.binding_status==="active"&&t.credential_connected&&s.length>0&&r&&_?"ready":"failed"}function jS(t,n,s){let a=t?.trim()??"",i=mn(s);if(!a||!i||!n)return!1;if(n==="domain"){let r=/^sc-domain:(.+)$/i.exec(a);if(!r)return!1;let _=r[1].trim();if(!_||/[/:?#]/.test(_))return!1;let c=mn(_);return c?i===c||i.endsWith(`.${c}`):!1}try{let r=new URL(a);return r.protocol!=="https:"||r.username||r.password||r.port||r.pathname!=="/"||r.search||r.hash?!1:mn(r.hostname)===i}catch{return!1}}var fw=mc,bw=Ai,yw=lc,xw=wi,Ew=Ti,Iw=ki,Rw=Pi,Tw=wi,kw=mc,Pw=Ai,ww=lc,Aw=vS,vw=pc,Cw=CS;var dc=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,uc="VCP_E2B_PREVIEW_PROXY_DOMAIN must be a valid hostname.";function OS(t){let n=t?.trim().toLowerCase()??"";if(!n)return null;if(n.length>253||!n.includes(".")||!n.split(".").every(s=>dc.test(s)))throw new Error(uc);return n}function jw(t){let n=OS(t.proxyDomain);if(!n)return null;let s=t.sandboxId.trim();if(!dc.test(s))throw new Error("sandboxId must be a valid DNS label.");if(`${s}.${n}`.length>253)throw new Error(uc);return`https://${s}.${n}/`}function NS(t,n,s=t){let a=new Map(t.map(c=>[c.slug,c])),i=new Map(s.map(c=>[c.id,c])),r=new Map(t.map(c=>{let g=i.get(c.id);return g&&g.slug!==null&&g.slug!==c.slug?[g.slug,c]:null}).filter(c=>c!==null)),_=new Set(s.map(c=>c.slug).filter(c=>c!==null&&!a.has(c)));return{primaryLinks:gc(n.primaryLinks,t,a,r,_,i,"showInHeader"),footerLinks:gc(n.footerLinks,t,a,r,_,i,"showInFooter")}}function gc(t,n,s,a,i,r,_){let c=new Set,g=[];for(let[F,q]of t.entries()){let ee=LS(q.href),ae=ee===null?void 0:s.get(ee)??a.get(ee);if(ee!==null&&i.has(ee)&&!s.has(ee)&&!a.has(ee))continue;if(ae?.slug==="/"){g.push({kind:"independent",link:{...q,label:_c(q,ae,r)}});continue}if(!ae){g.push({kind:"independent",link:q});continue}if(!ae.navigation[_])continue;c.add(ae.slug);let At=ee===ae.slug?q.href:MS(q.href,ae.slug);g.push({kind:"page",page:ae,link:{...q,label:_c(q,ae,r),href:At},index:F})}let j=g.filter(F=>F.kind==="page").sort((F,q)=>F.page.navigation.order-q.page.navigation.order||F.index-q.index),E=0,O=g.map(F=>F.kind==="page"?j[E++].link:F.link);for(let F of[...n].filter(q=>q.slug!=="/"&&q.navigation[_]).sort((q,ee)=>q.navigation.order-ee.navigation.order))c.has(F.slug)||O.push({label:F.title,href:F.slug});return O}function _c(t,n,s){let a=s.get(n.id);return t.label===(a?.title??n.title)?n.title:t.label}function LS(t){if(!t.startsWith("/")||t.startsWith("//"))return null;let n=t.search(/[?#]/u);return n===-1?t:t.slice(0,n)}function MS(t,n){let s=t.search(/[?#]/u);return s===-1?n:`${n}${t.slice(s)}`}import{z as w}from"zod";var hc=20*1024*1024,US=hc,Sc=["jpg","jpeg","png","gif","webp","bmp"],fc=["mp4","avi","mov","webm","mkv"],bc=["mp3","wav","aac","flac","ogg","wma","m4a"],yc=["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","md","csv"],xc=[...yc,"zip","rar","json","xmind","psd","ai","fig","sketch"],FS=[...Sc,...fc,...bc,...xc],Ec=["image/jpeg","image/png","image/gif","image/webp","image/bmp"],Ic=["video/mp4","video/x-msvideo","video/quicktime","video/webm","video/x-matroska"],Rc=["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"],qS=[...Ec,...Ic,...Rc],Tc=w.enum(["image","video","audio","file"]),kc=w.enum(["external","ai_generated","unsplash"]),vi=w.object({resource_id:w.string().min(1),name:w.string().min(1).max(255),url:w.string().url(),thumbnail_url:w.union([w.string().url(),w.literal("")]),mime_type:w.string().trim().min(3).max(127),size:w.number().int().nonnegative(),width:w.number().int().positive().nullable(),height:w.number().int().positive().nullable(),source:kc,created_at:w.string().min(1).nullable()}),GS=w.object({page:w.coerce.number().int().min(1).default(1),page_size:w.coerce.number().int().min(1).max(100).default(24),keyword:w.string().trim().max(100).optional(),file_type:Tc.default("image")}),KS=w.object({code:w.literal(0),message:w.string(),data:w.object({items:w.array(vi),page:w.number().int().min(1),page_size:w.number().int().min(1),total:w.number().int().nonnegative()})}),zS=w.object({code:w.literal(0),message:w.string(),data:vi}),Pc=w.object({provider_id:w.string().min(1),url:w.string().url(),thumbnail_url:w.string().url(),width:w.number().int().positive(),height:w.number().int().positive(),alt:w.string(),photographer_name:w.string().min(1),photographer_url:w.string().url(),photo_url:w.string().url(),download_location:w.string().url(),dominant_color:w.string().nullable()}),BS=w.object({query:w.string().trim().min(1).max(100),page:w.coerce.number().int().min(1).default(1),page_size:w.coerce.number().int().min(1).max(30).default(18),orientation:w.enum(["landscape","portrait","squarish"]).optional()}),WS=w.object({code:w.literal(0),message:w.string(),data:w.object({items:w.array(Pc),page:w.number().int().min(1),page_size:w.number().int().min(1),total:w.number().int().nonnegative(),total_pages:w.number().int().nonnegative()})}),wc=w.string().url().refine($S,{message:"download_location must be an official Unsplash download URL"}),VS=w.object({download_location:wc}),HS=w.object({code:w.literal(0),message:w.string(),data:w.object({reported:w.boolean()})});function $S(t){if(!URL.canParse(t))return!1;let n=new URL(t);return n.protocol==="https:"&&n.hostname==="api.unsplash.com"&&n.username===""&&n.password===""&&n.port===""&&n.hash===""&&/^\/photos\/[^/]+\/download$/.test(n.pathname)}import{z as Ce}from"zod";var YS=Ce.object({colorSeeds:Ce.object({primary:Ce.string().min(1).max(40),accent:Ce.string().min(1).max(40),foreground:Ce.string().min(1).max(40).optional()}).strict().optional(),surfaceMode:Ce.enum(["light","dark"]).optional(),fonts:Ce.object({heading:Ce.string().min(1).max(60),body:Ce.string().min(1).max(60)}).strict().optional()}).strict().refine(t=>t.colorSeeds!==void 0||t.surfaceMode!==void 0||t.fonts!==void 0,{message:"colorSeeds, surfaceMode, or fonts is required"}),XS=Ce.object({ok:Ce.literal(!0),design_plan_version:Ce.number().int().positive(),snapshot_id:x});var ji=e.object({heading:e.string().min(1).max(160).optional(),body:e.string().min(1).max(160).optional(),paletteIntent:e.string().min(1).max(400).optional(),surfaceMode:e.enum(["light","dark"]).optional(),radius:e.enum(["none","sm","md","lg","xl"]).optional(),density:e.enum(["compact","comfortable","airy","editorial"]).optional(),motionPreset:e.enum(["subtle","moderate","expressive"]).optional(),colorSeeds:e.object({primary:e.string().min(1).max(40),accent:e.string().min(1).max(40),foreground:e.string().min(1).max(40).optional(),neutral:e.string().min(1).max(40).optional(),supporting:e.array(e.string().min(1).max(40)).max(4).optional()}).optional(),imagePalette:e.object({background:e.string().min(1).max(40).optional(),foreground:e.string().min(1).max(40).optional(),card:e.string().min(1).max(40).optional(),muted:e.string().min(1).max(40).optional(),border:e.string().min(1).max(40).optional()}).optional(),themeId:e.string().min(1).max(60).optional(),themeDescription:e.string().min(1).max(400).optional(),aestheticNote:e.string().min(1).max(300).optional()}),Ci=e.enum(["material","reference","brief","industry"]),ZS=e.object({market:e.object({value:e.string().min(1).max(200),source:Ci}),customer:e.object({value:e.string().min(1).max(200),source:Ci}),purpose:e.object({options:e.array(e.string().min(1).max(60)).min(2).max(4),selected:e.string().min(1).max(60),source:Ci})}),QS=e.enum(["text-options","motion-slider","positioning"]),Oi=e.enum(["none","subtle","moderate","expressive"]),JS=e.enum(["compact","comfortable","airy","editorial"]),ef=Oi,jc=e.object({skill_name:e.string().min(1),rationale:e.string().min(4).max(200),confidence:e.enum(["high","medium","low"]).optional(),displayName:e.object({zh:e.string().min(1),en:e.string().min(1)}).partial().optional()}),tf=e.object({value:e.string(),label:e.string(),desc:e.string().optional(),impact:e.string().optional(),isRecommended:e.boolean().optional(),preselect:e.boolean().optional(),visualHints:ji.optional(),conversionHints:st.optional()}),nf=e.object({id:e.string(),type:QS,question:e.string(),tag:e.string(),aiThinking:e.string(),options:e.array(tf),source:e.enum(["ai-detected","always-ask"]),sourceDetail:e.string(),positioning:ZS.optional()}),Ni=e.object({questions:e.array(nf).min(1).max(6)}),cA=e.object({tenant_id:e.string().min(1),site_id:I,brief_id:ut,brief:e.string().min(20).max(1e3),site_default_locale:pe.optional(),owner_locale:pe.optional(),input_context:e.object({facts:e.array(un).max(120),conflicts:e.array(_n).max(20),reference:gn.optional(),sources:e.array(e.object({type:os,title:e.string().max(120).optional(),status:rs})).max(16).optional()}).optional()}),Oc=e.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),mA=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:V,at:e.string().min(1)}),e.object({type:e.literal("skill.selecting"),category:e.literal("page-generation"),available:e.array(e.object({id:e.string().min(1),name:e.string().min(1)})).max(20),at:e.string().min(1)}),e.object({type:e.literal("skill.selected"),category:e.literal("page-generation"),selected:e.object({id:e.string().min(1),name:e.string().min(1),reason:e.string().min(1).max(200)}),at:e.string().min(1)}),e.object({type:e.literal("clarify.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("clarify.archetype_proposals"),proposals:e.array(jc).min(1).max(5),at:e.string().min(1)}),e.object({type:e.literal("clarify.finished"),questions_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),error_category:Oc.optional(),retryable:e.boolean().optional(),attempts:e.number().int().positive().optional(),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),at:e.string().min(1)})]),lA="SITE_PLANNING_INPUT_FROZEN",pA="SITE_PLANNING_LOCKED",dA="SITE_STRUCTURE_CONFIRMATION_REQUIRED",uA="SITE_STRUCTURE_CONFIRMATION_STALE",gA=e.object({tenant_id:e.string().min(1),owner_user_id:ss,name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),_A=e.object({name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),hA=e.object({name:e.string().min(1).max(120)}),SA=e.object({name:e.string().min(1).max(120),default_locale:pe.optional()}),fA=e.object({body:e.string().min(20).max(1e3)}),bA=e.object({body:e.string().min(20).max(1e3)}),Li=e.string().url().refine(t=>{try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}},{message:"URL must use http or https protocol"}),yA=e.object({tenant_id:e.string().min(1),site_id:I.optional(),site_url:Li,site_name:e.string().trim().min(1).max(255).optional()}),xA=M(va),EA=M(Ca),IA=M(Da),RA=M(Wa),TA=M(Va),kA=M(Ha),PA=M(Ya),wA=M(Xa),AA=M(Za),vA=M(e.object({site_id:I,site_url:Li})),tt=e.object({id:I,tenant_id:e.string().min(1),owner_user_id:ss.nullable(),name:e.string().min(1),slug:e.string().min(1),status:Us,deployment_status:Fs,archived_at:e.string().min(1).nullable(),current_sitemap_id:ke.nullable(),confirmed_sitemap_id:ke.nullable().optional(),confirmed_sitemap_version:e.number().int().positive().nullable().optional(),structure_confirmed_at:e.string().min(1).nullable().optional(),migration_content_requested:e.boolean().optional(),current_snapshot_id:x.nullable(),published_deployment_id:Fe.nullable().optional(),deployed_url:e.string().url().nullable(),default_locale:pe,owner_locale:pe.optional(),cms_site_id:_a.nullable().optional(),cms_site_url:Li.nullable().optional(),parent_site_id:I.nullable().optional(),mount_path:e.string().min(1).nullable().optional(),schema_version:e.literal(1),created_at:e.string().min(1),updated_at:e.string().min(1)}),Mi=e.object({id:ut,tenant_id:e.string().min(1),site_id:I,body:e.string().min(1),source:e.enum(["user","import","system"]),created_at:e.string().min(1),updated_at:e.string().min(1)}),CA=e.object({site:tt,brief:Mi,next_step:e.literal("clarify")}),DA=e.object({site:tt,brief:Mi}),jA=e.object({brief:Mi}),sf=e.enum(["queued","running","succeeded","failed","cancelled"]),Nc=e.enum(["clarify","sitemap","workspace"]),Lc=e.enum(["clarify","sitemap","initial_generation","iteration"]),Mc=e.enum(["clarify","sitemap","workspace","summarize"]),et=e.object({id:V,tenant_id:e.string().min(1),site_id:I,agent_type:Nc,run_kind:Lc,status:sf,model_route:Mc,started_at:e.string().min(1).nullable(),finished_at:e.string().min(1).nullable(),error_code:e.string().min(1).nullable(),created_at:e.string().min(1)}),OA=e.object({run_id:V.optional(),site_id:I,agent_type:Nc,run_kind:Lc.optional(),model_route:Mc,input:e.record(e.string(),e.unknown()).optional()}).superRefine((t,n)=>{ln(t.input)&&n.addIssue({code:"custom",path:["input"],message:"Agent run input must not contain secrets"})}),NA=e.object({agent_run:et,next_step:e.literal("stream_events")}),Uc=e.enum(["draft","candidate","deleting","current","failed"]),We=e.object({id:x,tenant_id:e.string().min(1),site_id:I,version:e.number().int().positive(),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),template_version:De.nullable().optional(),reason:e.enum(["initial_generation","workspace_edit","pre_deploy","manual_save","rollback","template_upgrade","subsite_clone"]),status:Uc,created_at:e.string().min(1)}),LA=e.object({snapshot_id:x,creation_key:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),template_version:De.optional(),reason:We.shape.reason,status:e.enum(["draft","candidate","current","failed"]).default("candidate"),source_run_id:V.optional()}),MA=e.object({site:tt,snapshot:We,next_step:e.literal("workspace")}),UA=e.object({expected_manifest_hash:We.shape.manifest_hash,manifest_hash:We.shape.manifest_hash,object_key:We.shape.object_key}).strict(),FA=e.union([e.object({base_snapshot_id:x.nullable(),source_run_id:V.optional()}).strict(),e.object({skip_base_check:e.literal(!0)}).strict()]),af=e.object({site:tt,snapshot:We,next_step:e.literal("workspace")}),qA=e.object({snapshot:We}),GA=e.object({status:e.literal("deleting"),snapshot_id:x,object_key:e.string().min(1)}),KA=e.object({status:e.literal("deleted"),snapshot_id:x}),ts=e.object({id:Xi,tenant_id:e.string().min(1),site_id:I,snapshot_id:x,version:e.number().int().positive(),accepted_commit:e.string().min(1),source_run_id:V.nullable(),created_at:e.string().min(1)}),of=ts.extend({reason:We.shape.reason,status:Uc}),zA=e.object({accepted_commit:e.string().min(1),source_run_id:V.optional()}),BA=e.object({site_version:ts,next_step:e.literal("workspace")}),WA=e.object({owner_id:e.string().min(1)}).strict(),VA=e.discriminatedUnion("acquired",[e.object({acquired:e.literal(!0)}).strict(),e.object({acquired:e.literal(!1)}).strict()]),HA=e.object({owner_id:e.string().min(1)}).strict(),$A=e.object({released:e.literal(!0)}).strict(),YA="TEMPLATE_UPGRADE_LOCK_LOST",XA=e.object({base_snapshot_id:x,accepted_commit:ts.shape.accepted_commit,owner_id:e.string().min(1)}).strict(),ZA=af.strict(),QA=e.object({site_versions:e.array(of)}),JA=e.object({site:tt,snapshot:We,site_version:ts,next_step:e.literal("workspace")}),ev=e.object({snapshot_id:x,force_rehydrate:e.boolean().optional()}),rf=e.discriminatedUnion("status",[e.object({status:e.literal("ready"),snapshot_id:x,preview_url:e.string().min(1)}),e.object({status:e.literal("failed"),code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})]),tv=e.object({tenant_id:e.string().min(1),site_id:I,snapshot_id:x}).strict(),nv=rf,Ui=e.enum(_t),Fc=e.enum(["quality_check","publish"]),Qe=e.object({id:Fe,tenant_id:e.string().min(1),site_id:I,snapshot_id:x,type:Fc.default("publish"),version:e.number().int().positive(),status:Ui,provider:e.enum(["cloudflare"]),url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),sv=e.object({tenant_id:e.string().min(1),site_id:I,expected_snapshot_id:x}).strict(),iv=e.object({deployment:Qe}),av=e.object({tenant_id:e.string().min(1),site_id:I,deployment_id:Fe}).strict(),ov=e.object({deployment:Qe}),rv=e.object({}).strict(),cv=e.object({snapshot_id:x.optional()}).strict(),cf=e.object({deployment:Qe}),mv=M(cf),lv=e.object({deployment:Qe.nullable()}),pv=e.object({deployment:Qe}),Ac=e.object({id:Fe,type:Fc.default("publish"),status:Ui,url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable()}),mf=e.object({current:Ac.nullable(),latest_released:Ac.nullable()}),dv=M(mf),lf=e.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),Tt=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:I,deployment_id:Fe,seq:e.number().int().positive(),sent_at:e.string().min(1)}),Qn=e.object({deployment:Qe,steps:Lo.default([])}),uv=e.discriminatedUnion("type",[Tt.extend({type:e.literal("deployment.snapshot"),payload:Qn}),Tt.extend({type:e.literal("deployment.status.changed"),payload:Qn}),Tt.extend({type:e.literal("deployment.finished"),payload:Qn}),Tt.extend({type:e.literal("deployment.failed"),payload:Qn}),Tt.extend({type:e.literal("deployment.realtime.recovered"),payload:e.object({action:e.literal("refresh")})}),Tt.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})})]),gv=e.object({tenant_id:e.string().min(1),site_id:I,deployment_id:Fe,status:Ui,updated_at:e.string().min(1)}),pf="vcp:deployments",_v={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:pf,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...lf.options]},df=e.object({error:e.object({code:e.string().min(1),message:e.string().min(1),details:e.unknown().optional(),request_id:e.string().min(1).optional(),retryable:e.boolean().default(!1)})}),hv=e.object({error:df.shape.error.extend({code:e.literal("AGENT_RUN_IN_FLIGHT"),details:e.object({code:e.literal("AGENT_RUN_IN_FLIGHT"),message:e.string().min(1),agent_run:et})})}),Sv=e.object({colors:e.record(e.string(),e.string()).default({}),typography:e.record(e.string(),e.string()).default({}),spacing:e.record(e.string(),e.string()).default({}),motion:e.record(e.string(),e.string()).default({})}),uf=e.object({theme_id:e.string().min(1),paletteIntent:e.string().min(1),tone:e.string().min(1),mediaMood:e.string().min(1),motionLevel:Oi.optional(),userVisualHints:ji.optional()}),gf=e.object({question:e.string().min(1),answer:e.string().min(1)}),fv=e.object({query:e.string().min(1),keywords:e.array(e.string()).default([]),orientation:e.enum(["landscape","portrait","square"]).optional(),role:e.enum(["hero","section","card","gallery","testimonial","decorative"]),altHint:e.string().min(1)}),bv=e.object({id:e.string().min(1),role:e.enum(["site_background","nav_background","footer_background"]),query:e.string().min(1),keywords:e.array(e.string()).default([]),treatment:e.enum(["cover","fixed-cover","subtle-texture"]),altHint:e.string().optional()}),_f=e.object({provider:e.enum(["unsplash","pexels"]),providerLabel:e.enum(["Unsplash","Pexels"]),providerHref:e.string().url(),photoHref:e.string().url().optional(),photographerName:e.string().optional(),photographerHref:e.string().url().optional(),requiresAttribution:e.boolean()}),yv=e.object({src:e.string().min(1),alt:e.string().min(1),width:e.number().int().positive().optional(),height:e.number().int().positive().optional(),provider:e.enum(["unsplash","pexels","placeholder"]).optional(),providerId:e.string().optional(),photoUrl:e.string().url().optional(),photographer:e.string().optional(),photographerUrl:e.string().url().optional(),credit:e.string().optional(),dominantColor:e.string().optional(),attribution:_f.optional()}),hf=e.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),kt=e.object({id:e.string().min(1),name:e.string().min(1),category:e.literal("page-generation"),version:e.string().min(1).optional(),reason:e.string().min(1).max(200),source:hf.default("system_recommended")}),$=e.string().min(1).max(2e3),vc=e.string().min(1).max(120),qc=e.object({visualDirection:$,brandFeeling:$,paletteIntent:$,typographyIntent:$,density:JS,motionLevel:ef,motionPreset:e.enum(["subtle","moderate","expressive"]).optional(),mediaStrategy:$,compositionRules:e.array($).max(20),avoidPatterns:e.array($).max(20),fonts:e.object({heading:e.string().min(1),body:e.string().min(1)}).optional(),colorSeeds:e.object({primary:e.string().min(1).max(40),accent:e.string().min(1).max(40),foreground:e.string().min(1).max(40).optional(),neutral:e.string().min(1).max(40).optional(),supporting:e.array(e.string().min(1).max(40)).max(4).optional()}).optional(),surfaceMode:e.enum(["light","dark"]).optional(),radius:e.enum(["none","sm","md","lg","xl"]).optional(),imagePalette:e.object({background:e.string().min(1).max(40).optional(),foreground:e.string().min(1).max(40).optional(),card:e.string().min(1).max(40).optional(),muted:e.string().min(1).max(40).optional(),border:e.string().min(1).max(40).optional()}).optional()}),Fi=160,Gc=e.object({routeGoal:$,narrativeArc:$,firstViewportIntent:$,visualContinuity:$,sectionRhythm:$,avoidPatterns:e.array($).max(20),displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(Fi).optional(),metaTitle:e.string().min(1).max(120).optional(),metaDescription:e.string().min(1).max(320).optional(),primaryKeyword:e.string().min(1).max(160).optional(),longTailKeywords:e.array(e.string().min(1).max(160)).max(3).optional()}),Kc=e.enum(["model_call","validation","repair","preview","worker_group"]),Je=e.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),zc=e.object({sectionRole:$,contentIntent:$,layoutIntent:$,visualIntent:$,mediaIntent:$,motionIntent:$,copyTone:$,displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(Fi).optional(),ctaIntent:$.optional(),continuityWithPrevious:$.optional(),avoidRepeating:e.array($).max(20).optional(),industryRecipeRefs:e.array(vc).max(12).optional(),templateRecipeRefs:e.array(vc).max(12).optional()}),Bc=e.object({siteName:e.string().min(1).max(120),tagline:e.string().min(1).max(200).optional(),primaryCta:e.object({label:e.string().min(1).max(60),target:e.string().min(1).max(200)}).optional(),trustSignals:e.array(e.string().min(1).max(60)).max(6).optional(),industry:e.string().min(1).max(40).optional()}),Sf=e.enum(["solid","floating"]),ff=e.enum(["background","card","primary","frosted"]),bf=e.enum(["sticky","hide-on-scroll","static"]),yf=e.enum(["bar","island"]),xf=e.object({variant:Sf,surface:ff.optional(),behavior:bf.optional(),shape:yf.optional()}),Ef=e.object({form:$,layoutIntent:$,scrollBehavior:$,shell:xf.optional(),avoidPatterns:e.array($).max(10).optional()}),If=e.enum(["background","card","primary","inverse"]),Rf=e.object({surface:If}),Tf=e.object({form:$,composition:$,shell:Rf.optional(),avoidPatterns:e.array($).max(10).optional()}),kf=e.object({pattern:$,intent:$}),Wc=e.object({header:Ef,footer:Tf,mobileNav:kf}),Vc=e.object({schemaVersion:e.literal(1).default(1),siteDesignContext:qc,routeCards:e.record(e.string().min(1),Gc),blockContexts:e.record(e.string().min(1),zc),selectedSkillPacks:e.array(kt).max(3).optional(),branding:Bc.optional(),chromeDesign:Wc.optional()}),xv=e.object({siteDesignContext:qc.omit({imagePalette:!0}).optional(),routeCards:e.record(e.string().min(1),Gc).optional(),blockContexts:e.record(e.string().min(1),zc).optional(),branding:Bc.optional(),chromeDesign:Wc.optional()}),xe=e.string().trim().min(1),qi=e.object({id:xe,label:e.string().trim().min(1),type:e.string(),variant:e.string().optional(),order:e.number(),props:e.record(e.string(),e.unknown()),meta:e.object({aiGenerated:e.boolean(),userEdited:e.boolean(),lastEditedAt:e.string(),lastEditedBy:e.enum(["ai","user"]),userInstruction:e.string().optional()}).optional()}).strict(),Hc=e.string().regex(Ft,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),Pf=new RegExp(`^/(?:${St}(?:/${St})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),wf=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,Af=e.union([e.string().regex(Pf),e.string().regex(wf)]),Cc=e.object({label:e.string(),href:Af}).passthrough(),vf=e.object({primaryLinks:e.array(Cc),footerLinks:e.array(Cc)}),$c=e.object({showInHeader:e.boolean(),showInFooter:e.boolean(),order:e.number()}).strict(),Gi=e.object({id:xe,slug:Hc,title:e.string().trim().min(1),blocks:e.array(qi).min(1),navigation:$c}).strict(),Cf=qi.extend({type:e.string().nullable()}).strict(),Df=Gi.extend({slug:Hc.nullable(),navigation:$c.extend({showInHeader:e.boolean().nullable(),showInFooter:e.boolean().nullable()}).strict(),blocks:e.array(Cf).min(1)}).strict(),jf=qi.extend({id:e.string()}),Of=Gi.extend({id:e.string(),slug:e.string().min(1),blocks:e.array(jf).min(1)}),Dc=e.object({label:e.string(),href:e.string().min(1)}),Nf=e.object({primaryLinks:e.array(Dc),footerLinks:e.array(Dc)}),Lf=e.discriminatedUnion("kind",[e.object({kind:e.literal("brief_clarify"),brief_id:ut,answer_ids:e.array(e.string().min(1)).max(10)}).strict(),e.object({kind:e.literal("step5_strategy"),strategy_version_id:e.string().uuid(),strategy_version:e.number().int().positive(),strategy_checksum:e.string().regex(/^[a-f0-9]{64}$/)}).strict()]),Jn=e.object({site_name:e.string().min(1).max(80).optional(),version:e.number().int().positive(),pages:e.array(Gi).min(1),navigation:vf,integrations:e.object({cms:e.unknown().optional(),analytics:e.unknown().optional()}).optional(),meta:e.object({generatedAt:e.string(),generatedBy:e.literal("sitemap-agent"),source_brief_id:e.string().optional(),source_answer_ids:e.array(e.string()).optional(),source:Lf.optional()}),skillSelection:kt,visualTheme:uf.optional(),userChoices:e.array(gf).optional(),confirmedChoices:e.object({conversion:st.optional()}).optional(),seoKeywords:e.array(En).min(1).max(50).optional()}).strict(),Pt=Jn.superRefine((t,n)=>{Zc(t.pages,n)}),rn=Jn.extend({pages:e.array(Df).min(1)}).strict().superRefine((t,n)=>{Zc(t.pages,n)}),Mf=e.enum(["slug","showInHeader","showInFooter"]),Uf=e.object({page_id:xe,fields:e.array(Mf).min(1).max(3)}).strict(),Ff=e.object({page_id:xe,block_id:xe,fields:e.tuple([e.literal("type")])}).strict(),Yc=100,Xc=500,qf=e.object({pages:e.array(Uf).max(Yc),blocks:e.array(Ff).max(Xc)}).strict().superRefine((t,n)=>{let s=new Set;t.pages.forEach((i,r)=>{s.has(i.page_id)&&n.addIssue({code:"custom",path:["pages",r,"page_id"],message:`Duplicate page target '${i.page_id}'.`}),s.add(i.page_id),new Set(i.fields).size!==i.fields.length&&n.addIssue({code:"custom",path:["pages",r,"fields"],message:"Page target fields must be unique."})});let a=new Set;t.blocks.forEach((i,r)=>{let _=`${i.page_id}\0${i.block_id}`;a.has(_)&&n.addIssue({code:"custom",path:["blocks",r],message:`Duplicate block target '${i.page_id}/${i.block_id}'.`}),a.add(_)})}),Ev=e.object({sitemap:rn,targets:qf}).strict(),Iv=e.object({pages:e.array(e.object({page_id:xe,slug:e.string().min(1).optional(),show_in_header:e.boolean().optional(),show_in_footer:e.boolean().optional()}).strict()).max(Yc),blocks:e.array(e.object({page_id:xe,block_id:xe,type:e.string().trim().min(1)}).strict()).max(Xc)}).strict().superRefine((t,n)=>{let s=new Set;t.pages.forEach((i,r)=>{s.has(i.page_id)&&n.addIssue({code:"custom",path:["pages",r,"page_id"],message:`Duplicate page output '${i.page_id}'.`}),s.add(i.page_id)});let a=new Set;t.blocks.forEach((i,r)=>{let _=`${i.page_id}\0${i.block_id}`;a.has(_)&&n.addIssue({code:"custom",path:["blocks",r],message:`Duplicate block output '${i.page_id}/${i.block_id}'.`}),a.add(_)})}),Rv=e.object({sitemap:Pt}).strict();function Zc(t,n){let s=new Map,a=new Map,i=new Map,r=0;t.forEach((_,c)=>{let g=s.get(_.id);if(g!==void 0?n.addIssue({code:"custom",path:["pages",c,"id"],message:`Duplicate page id '${_.id}' (first used at pages.${g}.id).`}):s.set(_.id,c),_.blocks.forEach((E,O)=>{let F=a.get(E.id);F!==void 0?n.addIssue({code:"custom",path:["pages",c,"blocks",O,"id"],message:`Duplicate block id '${E.id}' (first used at pages.${F.pageIndex}.blocks.${F.blockIndex}.id).`}):a.set(E.id,{pageIndex:c,blockIndex:O})}),_.slug===null)return;_.slug==="/"&&(r+=1);let j=i.get(_.slug);j!==void 0?n.addIssue({code:"custom",path:["pages",c,"slug"],message:`Duplicate page slug '${_.slug}' (first used at pages.${j}.slug).`}):i.set(_.slug,c)}),(r!==1||t[0]?.slug!=="/")&&n.addIssue({code:"custom",path:["pages"],message:"Sitemap must contain exactly one home page at pages[0] with slug '/'."})}var Tv=Jn.omit({skillSelection:!0,visualTheme:!0,userChoices:!0,confirmedChoices:!0,seoKeywords:!0}).extend({meta:Jn.shape.meta.omit({source:!0}),site_name:e.string().min(1).max(80),pages:e.array(Of).min(1),navigation:Nf}),Gf=e.enum(["ai","user"]),wt=e.object({site_id:I,page_id:xe,edited_by:Gf.default("ai"),source_agent_run_id:V.optional()}),kv=wt.extend({block_id:xe,target_index:e.number().int().min(0)}),Kf=wt.extend({block_id:xe}),zf=wt.extend({block_id:xe,instruction:e.string()}),Pv=wt.extend({block_id:xe,variant:e.string().min(1).nullable()}),wv=wt.extend({block_id:xe,props:e.record(e.string(),e.unknown()),mode:e.enum(["replace","merge"]).default("replace")}),Av=wt.extend({block:e.object({id:xe,label:e.string().trim().min(1),type:e.string().min(1),variant:e.string().min(1).optional(),props:e.record(e.string(),e.unknown()).default({}),insert_index:e.number().int().min(0).optional()})}),Bf=e.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),vv=e.discriminatedUnion("operation",[e.object({operation:e.literal("delete_block"),input:Kf}).strict(),e.object({operation:e.literal("update_block_instruction"),input:zf}).strict()]),Wf=e.enum(["SITEMAP_EDIT_INVALID","SITEMAP_API_NOT_CONFIGURED","SITEMAP_NOT_FOUND","SITEMAP_PAGE_NOT_FOUND","SITEMAP_BLOCK_NOT_FOUND","SITEMAP_BLOCK_ALREADY_EXISTS","SITEMAP_LAST_BLOCK_DELETE_FORBIDDEN","SITEMAP_EDIT_FAILED"]),Vf=e.object({status:e.literal("updated"),operation:Bf,site_id:I,sitemap_id:ke,version:e.number().int().positive(),changed_pages:e.array(xe).min(1),requires_code_patch:e.literal(!0)}),Hf=e.object({status:e.literal("failed"),code:Wf,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),Cv=e.discriminatedUnion("status",[Vf,Hf]),Ki=e.object({question_id:e.string().min(1),value:e.string().min(1),label:e.string().min(1).optional(),question:e.string().min(1).optional(),option_label:e.string().min(1).optional(),motion_level:Oi.optional(),visual_tonality:ji.optional(),conversion:st.optional(),positioning:e.object({market:e.string().min(1).max(200),customer:e.string().min(1).max(200),purpose:e.string().min(1).max(60)}).optional()}),$f=e.object({id:e.string().trim().min(1).max(128),type:e.literal(1),search_intent:e.string().trim().min(1).max(255),path:e.string().trim().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),channel:e.string().trim().min(1).max(80),content_format:e.string().trim().min(1).max(80),priority:e.enum(["P0","P1","P2","P3"])}).strict(),Dv=e.object({source:e.object({kind:e.literal("step5_strategy")}).strict()}).strict(),Yf=e.object({item_key:xn,title:e.string().trim().min(1).max(200),selected_option_id:ht,selected_label:e.string().trim().min(1).max(200),selected_value:e.string().trim().min(1).max(500),selected_description:e.string().trim().min(1).max(2e3),impact:e.string().trim().min(1).max(500).optional(),customer_note:e.string().trim().min(1).max(200).optional()}).strict(),Xf=e.object({kind:e.literal("step5_strategy"),site_name:e.string().trim().min(1).max(80).optional(),strategy_version_id:e.string().uuid(),strategy_version:e.number().int().positive(),strategy_checksum:e.string().regex(/^[a-f0-9]{64}$/),decisions:e.array(Yf).length(fe),seo_keywords:e.array(En).min(1).max(50).optional()}).strict().superRefine((t,n)=>{t.decisions.forEach((s,a)=>{s.item_key!==it[a]&&n.addIssue({code:"custom",path:["decisions",a,"item_key"],message:"Step5 sitemap decisions must use the canonical order."})})}),Qc=e.object({tenant_id:e.string().min(1),site_id:I,brief_id:ut,brief:e.string().min(20).max(1e3),answers:e.array(Ki).min(1).max(10),skillSelection:kt,site_default_locale:pe.optional(),owner_locale:pe.optional(),cms_site_id:e.string().min(1).nullish(),intent_pages:e.array($f).max(bn).optional(),reference:gn.optional(),input_context:e.object({facts:e.array(un).max(120),conflicts:e.array(_n).max(20)}).optional(),business_facts:ea.optional(),extra_requirement:e.string().trim().min(1).max(gt).optional(),migration_products_enabled:e.boolean().optional()}),Zf=Qc.pick({tenant_id:!0,site_id:!0,skillSelection:!0,site_default_locale:!0,owner_locale:!0,cms_site_id:!0,reference:!0,input_context:!0,business_facts:!0,extra_requirement:!0,migration_products_enabled:!0}).partial({skillSelection:!0}).extend({source:Xf}).strict(),jv=e.union([Qc,Zf]),Jc=e.enum(["planning","generating","validating","ready"]),Qf=e.enum(["salvaged","deterministic_fallback"]),Jf=e.enum(["model_exception_settled_prefix","model_exception_safe_root"]),em={outcome:Qf.optional(),reason:Jf.optional(),attempts:e.number().int().positive().optional()};function tm(t,n){if(t.type!=="sitemap.generated")return;let s=t.outcome!==void 0,a=t.reason!==void 0;s!==a&&n.addIssue({code:"custom",path:[s?"reason":"outcome"],message:"sitemap.generated outcome and reason must be provided together"})}var eb=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:V,at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:Jc,message:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generated"),sitemap_id:ke,sitemap:Pt,...em,at:e.string().min(1)}),e.object({type:e.literal("sitemap.clamped"),reason:e.enum(["page_early_stop","finalize_best_effort"]),original_page_count:e.number().int().nonnegative().optional(),final_page_count:e.number().int().nonnegative().optional(),original_block_count:e.number().int().nonnegative().optional(),final_block_count:e.number().int().nonnegative().optional(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.started"),slot_count:e.number().int().nonnegative(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.finished"),slot_count:e.number().int().nonnegative(),provider_counts:e.object({unsplash:e.number().int().nonnegative(),pexels:e.number().int().nonnegative(),placeholder:e.number().int().nonnegative()}),fallback_count:e.number().int().nonnegative(),error_codes:e.array(e.string()),at:e.string().min(1)}),e.object({type:e.literal("snapshot.created"),snapshot_id:x,manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),snapshot_id:x.optional(),at:e.string().min(1)})]),Ov=eb.superRefine(tm),nm=e.object({id:ke,tenant_id:e.string().min(1),site_id:I,version:e.number().int().positive(),source_agent_run_id:V.nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}).strict();function sm(t,n){t.version!==t.sitemap.version&&n.addIssue({code:"custom",path:["sitemap","version"],message:`Sitemap JSON version ${t.sitemap.version} must equal record version ${t.version}.`})}var im=nm.extend({sitemap:Pt}).superRefine(sm),tb=nm.extend({sitemap:rn}).superRefine(sm),Nv=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:Pt,source_agent_run_id:V.optional()}),Lv=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:rn,expected_current_sitemap_id:ke,expected_current_sitemap_version:e.number().int().positive(),migration_content_requested:e.boolean().optional()}),Mv=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:Pt,source_agent_run_id:V}),Uv=e.object({site:tt,sitemap:im,next_step:e.literal("workspace")}).strict(),Fv=e.object({site:tt,sitemap:tb,next_step:e.literal("workspace")}).strict(),qv=e.object({site:tt,sitemap:im,next_step:e.literal("sitemap_review")}).strict(),nb=e.object({id:Yi,tenant_id:e.string().min(1),site_id:I,brief_id:ut,questions:Ni,answers:e.array(Ki),selected_archetype:kt.optional(),completed_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Gv=e.object({answers:e.array(Ki).min(1),questions:Ni,selected_archetype:kt.optional()}),Kv=e.object({clarify_session:nb}),zv=e.object({questions:Ni,selected_archetype:kt}),sb=e.object({id:is,tenant_id:e.string().min(1),site_id:I,version:e.number().int().positive(),design_plan:Vc,source_agent_run_id:V.nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Bv=e.object({design_plan_id:is.optional(),design_plan:Vc,source_agent_run_id:V.optional()}),Wv=e.object({design_plan:sb}),ns=e.enum(["initial_generation","iteration"]),ib=e.object({label:e.string().min(1).max(48),prompt:e.string().min(1).max(160)}).strict(),ab=e.enum(["model","derived","mixed","advisor"]),am=e.object({suggestions:e.array(ib).min(1).max(4),source:ab}).strict(),ob=e.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),rb=e.enum(["generation_succeeded","entry_slots_omitted","quality_gate_exhausted","schema_gate_exhausted","generation_timeout","stream_schema_mismatch","stream_generation_error","generation_error","fallback_compiler_error","legacy_result_missing_metadata"]),cb=e.enum(["progress","assistant_final"]),om=e.enum(["run.started","message.delta","user.message","plan.updated","clarify.partial","clarify.archetype_proposals","clarify.finished","sitemap.generating","sitemap.partial","sitemap.generated","sitemap.clamped","sitemap.updated","sitemap.resync.failed","sitemap.resync.warning","block.changed","tool.started","tool.finished","workspace.plan.created","workspace.worker.updated","workspace.task.updated","workspace.degraded","workspace.design_plan.outcome","workspace.suggestions","file.changed","snapshot.created","snapshot.finalized","preview.preparing","preview.ready","preview.build.started","preview.build.succeeded","preview.build.failed","run.failed","run.finished","media_resolution.started","media_resolution.finished","skill.selecting","skill.selected","activity.started","activity.updated","activity.finished","activity.failed"]),mb=e.object({id:e.string().min(1),title:e.string().min(1),status:e.enum(["pending","running","completed","failed"])}),dt=e.enum(["pending","running","completed","completed_with_skips","failed","skipped"]),zi=e.enum(["style_media","chrome","sections","layout","pages","detect_typecheck","repair","finalize","sitemap_resync","preview"]),Bi=e.object({code:e.string().min(1),message:e.string().min(1),path:e.string().min(1).optional(),task_id:e.string().min(1).optional(),details:e.record(e.string(),e.unknown()).optional()}),Se=e.string().min(1).refine(t=>fm(t),{message:"Snapshot file paths must be safe relative POSIX paths without traversal."}),Wi=e.object({deduped_paths:e.array(Se),skipped_tasks:e.array(e.string().min(1)),failed_tasks:e.array(e.string().min(1)),fallback_files:e.array(e.string().min(1)),applied_paths:e.array(Se)}),Vi=e.object({group_id:e.string().min(1),phase:zi,title:e.string().min(1),status:dt,task_ids:e.array(e.string().min(1)),depends_on_groups:e.array(e.string().min(1)),target_paths:e.array(Se)}),lb=e.enum(["style","media","chrome","section","layout","page"]),Hi=e.object({task_id:e.string().min(1),group_id:e.string().min(1),kind:lb,target_path:Se,block_id:e.string().min(1).optional(),block_type:e.string().min(1).optional(),block_variant:e.string().min(1).optional(),block_order:e.number().int().nonnegative().optional(),user_instruction:e.string().min(1).optional(),page_id:e.string().min(1).optional(),page_slug:e.string().min(1).optional(),page_title:e.string().min(1).optional(),title:e.string().min(1).max(60).optional(),description:e.string().min(1).max(Fi).optional(),status:dt,required_reads:e.array(Se).optional(),search_params_sections:e.array(Se).optional(),standard_form_view:Se.optional()}),$i=e.object({from_group_id:e.string().min(1),to_group_id:e.string().min(1),reason:e.enum(["style_media","chrome","sections","layout","page_composition","quality_gate"])}),Vv=e.object({plan_id:e.string().min(1),run_kind:ns,model_route:e.object({planner:e.literal("workspace_planner"),worker:e.literal("workspace")}),groups:e.array(Vi),tasks:e.array(Hi),dependencies:e.array($i),expected_outputs:e.array(Se),diagnostics:Wi}),Hv=e.object({task_id:e.string().min(1),patch:e.unknown().optional(),snapshot_id:x.optional(),read_files:e.array(Se),diagnostics:e.array(Bi),status:dt}),rm=e.object({worker_count:e.number().int().nonnegative(),task_count:e.number().int().nonnegative(),group_count:e.number().int().nonnegative()}),cm=e.object({pending:e.number().int().nonnegative(),running:e.number().int().nonnegative(),completed:e.number().int().nonnegative(),completed_with_skips:e.number().int().nonnegative(),failed:e.number().int().nonnegative(),skipped:e.number().int().nonnegative()}),pb=e.object({type:e.literal("text"),text:e.string(),state:e.enum(["streaming","done"]).optional()}),db=e.object({type:e.literal("reasoning"),text:e.string(),state:e.enum(["streaming","done"]).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),ub=e.object({type:e.literal("file"),mediaType:e.string().min(1),filename:e.string().min(1).optional(),url:e.string().min(1)}),gb=e.object({type:e.literal("source-url"),sourceId:e.string().min(1),url:e.string().min(1),title:e.string().min(1).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),_b=e.object({type:e.literal("source-document"),sourceId:e.string().min(1),mediaType:e.string().min(1),title:e.string().min(1),filename:e.string().min(1).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),hb=e.object({type:e.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:e.string().min(1).optional(),data:e.unknown()}),Sb=e.object({type:e.string().regex(/^tool-[a-zA-Z0-9_-]+$/),toolCallId:e.string().min(1),state:e.enum(["input-streaming","input-available","output-available","output-error"]),input:e.unknown().optional(),output:e.unknown().optional(),errorText:e.string().min(1).optional()}),fb=e.object({type:e.literal("error"),errorText:e.string().min(1)}),bb=e.object({type:e.literal("step-start")}),es=e.union([pb,db,ub,gb,_b,hb,Sb,fb,bb]),yb=e.string().min(1).max(512).refine(t=>fm(t)&&!/^[A-Za-z]:\//.test(t),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),xb=e.array(yb).min(1).max(64),Eb=e.array(e.string().min(1).max(120)).min(1).max(64),Ib=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:V,at:e.string().min(1)}),e.object({type:e.literal("message.delta"),text:e.string().min(1),history_purpose:cb.optional(),at:e.string().min(1)}),e.object({type:e.literal("user.message"),client_message_id:e.string().min(1),message_id:e.string().min(1),parts:e.array(es).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),interaction_response:An.optional(),at:e.string().min(1)}),e.object({type:e.literal("plan.updated"),steps:e.array(mb),at:e.string().min(1)}),e.object({type:e.literal("clarify.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("clarify.archetype_proposals"),proposals:e.array(jc).min(1).max(5),at:e.string().min(1)}),e.object({type:e.literal("clarify.finished"),questions_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:Jc,message:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generated"),sitemap_id:ke,sitemap:Pt,...em,at:e.string().min(1)}),e.object({type:e.literal("sitemap.clamped"),reason:e.enum(["page_early_stop","finalize_best_effort"]),original_page_count:e.number().int().nonnegative().optional(),final_page_count:e.number().int().nonnegative().optional(),original_block_count:e.number().int().nonnegative().optional(),final_block_count:e.number().int().nonnegative().optional(),at:e.string().min(1)}).strict(),e.object({type:e.literal("sitemap.updated"),sitemap_id:ke,version:e.number().int().positive(),reason:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.resync.failed"),error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),diagnostics:e.unknown().optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.resync.warning"),code:e.string().min(1),message:e.string().min(1),diagnostics:e.unknown().optional(),at:e.string().min(1)}),e.object({type:e.literal("block.changed"),block_id:e.string().min(1),change_type:e.enum(["add","update","delete","move"]),at:e.string().min(1)}),e.object({type:e.literal("tool.started"),tool_call_id:e.string().min(1),name:e.string().min(1),summary:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("tool.finished"),tool_call_id:e.string().min(1),name:e.string().min(1),result_summary:e.string().min(1),interaction_request:zs.optional(),at:e.string().min(1)}),e.object({type:e.literal("workspace.plan.created"),plan_id:e.string().min(1),run_kind:ns,groups:e.array(Vi),tasks:e.array(Hi),dependencies:e.array($i),expected_outputs:e.array(Se),diagnostics:Wi,summary:rm,at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.worker.updated"),group_id:e.string().min(1),phase:zi,status:dt,task_counts:cm,target_paths:e.array(Se),diagnostics:e.array(e.string().min(1)),at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.task.updated"),task_id:e.string().min(1),group_id:e.string().min(1),status:dt,target_path:Se,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(Bi).optional(),at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.degraded"),reason:e.enum(["block_placeholder","form_placeholder","patch_protected_dropped","preview_health_degraded","design_plan_fallback","generated_code_rescue","cms_page_directory_degraded","form_prebuild_skipped","form_section_fallback","first_settings_sync_failed"]),degraded_block_ids:e.array(e.string().min(1)).min(1).optional(),dropped_files:e.array(e.string().min(1)).min(1).optional(),degraded_file_paths:xb.optional(),degraded_page_ids:Eb.optional(),snapshot_id:x.optional(),code:e.string().min(1).optional(),message:e.string().min(1).optional(),diagnostics:e.string().min(1).optional(),retryable:e.boolean().optional(),at:e.string().min(1)}).strict().superRefine((t,n)=>{if(!(t.reason==="generated_code_rescue")){for(let a of["degraded_file_paths","degraded_page_ids"])t[a]!==void 0&&n.addIssue({code:"custom",path:[a],message:`${a} is only allowed for generated_code_rescue`});return}t.degraded_file_paths===void 0&&n.addIssue({code:"custom",path:["degraded_file_paths"],message:"generated_code_rescue requires degraded_file_paths"});for(let a of["degraded_block_ids","dropped_files","snapshot_id","code","message","diagnostics","retryable"])t[a]!==void 0&&n.addIssue({code:"custom",path:[a],message:`${a} is not allowed for generated_code_rescue`})}),e.object({type:e.literal("workspace.design_plan.outcome"),design_plan_outcome:ob,reason:rb,gate_diagnostics:e.object({gate:e.enum(["quality","schema"]),issue_codes:e.array(e.string().min(1)).max(20),issue_paths:e.array(e.string()).max(20),finish_reason:e.string().min(1).optional()}).strict().optional(),at:e.string().min(1)}).strict(),am.extend({type:e.literal("workspace.suggestions"),at:e.string().min(1)}).strict(),e.object({type:e.literal("file.changed"),path:e.string().min(1),change_type:e.enum(["create","update","delete"]),diff:e.string().optional(),at:e.string().min(1)}),e.object({type:e.literal("snapshot.created"),snapshot_id:x,manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("snapshot.finalized"),snapshot_id:x,at:e.string().min(1)}),e.object({type:e.literal("preview.preparing"),at:e.string().min(1)}),e.object({type:e.literal("preview.ready"),url:e.string().url(),at:e.string().min(1)}),e.object({type:e.literal("preview.build.started"),snapshot_id:x,at:e.string().min(1)}),e.object({type:e.literal("preview.build.succeeded"),snapshot_id:x,at:e.string().min(1)}),e.object({type:e.literal("preview.build.failed"),snapshot_id:x,message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean(),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),error_category:Oc.optional(),retryable:e.boolean().optional(),attempts:e.number().int().positive().optional(),outcome:e.literal("retained_previous").optional(),details:e.record(e.string(),e.unknown()).optional(),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),snapshot_id:x.optional(),degraded_reason:Dt.optional(),build_verified:e.boolean().optional(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.started"),slot_count:e.number().int().nonnegative(),at:e.string().datetime()}),e.object({type:e.literal("media_resolution.finished"),slot_count:e.number().int().nonnegative(),provider_counts:e.object({unsplash:e.number().int().nonnegative(),pexels:e.number().int().nonnegative(),placeholder:e.number().int().nonnegative()}),fallback_count:e.number().int().nonnegative(),error_codes:e.array(e.string()),at:e.string().datetime()}),e.object({type:e.literal("skill.selecting"),category:e.literal("page-generation"),available:e.array(e.object({id:e.string().min(1),name:e.string().min(1)})).max(20),at:e.string().min(1)}),e.object({type:e.literal("skill.selected"),category:e.literal("page-generation"),selected:e.object({id:e.string().min(1),name:e.string().min(1),reason:e.string().min(1).max(200)}),at:e.string().min(1)}),e.object({type:e.literal("activity.started"),activity_id:e.string().min(1),parent_activity_id:e.string().min(1).optional(),kind:Kc,title:e.string().min(1).max(200),detail:e.string().max(360).optional(),title_code:Je.optional(),detail_code:Je.optional(),locks_input:e.boolean(),at:e.string().min(1)}),e.object({type:e.literal("activity.updated"),activity_id:e.string().min(1),title:e.string().min(1).max(200).optional(),detail:e.string().max(360).optional(),title_code:Je.optional(),detail_code:Je.optional(),at:e.string().min(1)}),e.object({type:e.literal("activity.finished"),activity_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("activity.failed"),activity_id:e.string().min(1),detail:e.string().max(360).optional(),at:e.string().min(1)})]),mm=Ib.superRefine(tm).superRefine((t,n)=>{if(t.type==="user.message"&&t.interaction_response&&!t.in_reply_to_tool_call_id&&n.addIssue({code:"custom",path:["in_reply_to_tool_call_id"],message:"in_reply_to_tool_call_id is required for an interaction response"}),t.type!=="tool.finished")return;let s=t.name==="prepare_product_search_entry";s!==!!t.interaction_request&&n.addIssue({code:"custom",path:["interaction_request"],message:s?"prepare_product_search_entry requires interaction_request":"interaction_request is only valid for prepare_product_search_entry"})}),Di=e.object({id:Zi,tenant_id:e.string().min(1),site_id:I,agent_run_id:V,sequence:e.number().int().positive(),event_type:om,payload:mm,created_at:e.string().min(1)}),$v=e.object({event_type:om,payload:mm}).superRefine((t,n)=>{t.event_type!==t.payload.type&&n.addIssue({code:"custom",path:["payload","type"],message:"payload.type must match event_type"}),ln(t.payload)&&n.addIssue({code:"custom",path:["payload"],message:"AgentEvent payload must not contain secrets"})}),Yv=e.discriminatedUnion("status",[e.object({status:e.literal("appended"),agent_run:et,event:Di,next_cursor:e.number().int().nonnegative()}),e.object({status:e.literal("duplicate_ignored"),agent_run:et,event:Di,next_cursor:e.number().int().nonnegative()})]),Xv=e.object({events:e.array(Di),next_cursor:e.number().int().nonnegative().optional()}),Zv=e.object({after_sequence:e.coerce.number().int().nonnegative().default(0)}),Qv=e.enum(["implemented","skeleton","planned"]),Jv=e.enum(["GET","POST","PUT","PATCH","DELETE"]),eC=[{method:"PATCH",path:"/internal/sites/:site_id/snapshots/:snapshot_id/manifest",tag:"snapshots",summary:"Compare-and-set the manifest hash for the active current snapshot after an in-place object replacement.",status:"implemented",request_body_schema:"UpdateCurrentSnapshotManifestRequestSchema",response_schema:"SnapshotRecordSchema",notes:["Internal Agent authentication is required. The update succeeds only when site current_snapshot_id, snapshot status, object key, and expected manifest hash still match."]},{method:"GET",path:"/health",tag:"system",summary:"API health check.",status:"implemented",response_schema:"ApiHealth"},{method:"POST",path:"/sites",tag:"sites",summary:"Create a site and Step 1 brief in the current dev context.",status:"implemented",request_body_schema:"CreateSiteBriefRequestSchema",response_schema:"CreateSiteBriefResponseSchema"},{method:"POST",path:"/sites/drafts",tag:"sites",summary:"Create a draft site without a brief in the current tenant so /s/:site_id can collect Step 1 later.",status:"implemented",request_body_schema:"CreateSiteDraftRequestSchema",response_schema:"SiteRecordSchema"},{method:"GET",path:"/sites",tag:"sites",summary:"List current tenant sites.",status:"implemented",response_schema:"SiteRecordSchema[]"},{method:"GET",path:"/sites/by-cms/:cms_site_id",tag:"sites",summary:"Resolve an external CMS site id to one tenant-scoped VCP site.",status:"implemented",response_schema:"SiteRecordSchema",notes:["Used by the browser /d/:cms_site_id handoff route; lookup is scoped by current request tenant and returns 404 when the CMS site has not been synchronized."]},{method:"GET",path:"/sites/:site_id",tag:"sites",summary:"Get one tenant-scoped site.",status:"implemented",response_schema:"SiteRecordSchema"},{method:"POST",path:"/sites/:site_id/workflow",tag:"site-workflows",summary:"Create one version-bound site workflow from a published flow definition.",status:"implemented",request_body_schema:"CreateSiteWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/workflow",tag:"site-workflows",summary:"Read the current site workflow snapshot and derived menu state.",status:"implemented",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"PUT",path:"/sites/:site_id/workflow/website",tag:"site-workflows",summary:"Update the source website while website_scan is current.",status:"implemented",request_body_schema:"UpdateSiteWorkflowWebsiteRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/advance",tag:"site-workflows",summary:"Advance one non-terminal workflow node with an expected-current-node guard.",status:"implemented",request_body_schema:"AdvanceSiteWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/complete",tag:"site-workflows",summary:"Complete the workflow from its final publishing node after server-side release checks pass.",status:"implemented",request_body_schema:"CompleteSiteWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema",notes:["The browser supplies only the expected current node; the server verifies persisted release facts before completing the workflow."]},{method:"POST",path:"/sites/:site_id/workflow/tasks/register",tag:"site-workflows",summary:"Register a business-owned external task id and its idempotency key.",status:"implemented",request_body_schema:"RegisterWorkflowTaskCommandRequestSchema",response_schema:"SiteWorkflowTaskRefResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/step2-site-initialization/tasks",tag:"site-workflows/step2-site-initialization",summary:"Create or reuse the current workflow's Step2 website crawl task.",status:"implemented",response_schema:"Step2SiteInitializationTaskResponseSchema",notes:["The server derives tenantId, sessionId, and siteUrl from trusted request/workflow state; the browser cannot submit upstream scope fields."]},{method:"GET",path:"/sites/:site_id/workflow/step2-site-initialization/tasks/:task_id",tag:"site-workflows/step2-site-initialization",summary:"Poll the workflow-owned Step2 website crawl task.",status:"implemented",response_schema:"Step2SiteInitializationTaskResponseSchema",notes:["The task id must match the current non-superseded website_crawl task reference for the workflow."]},{method:"POST",path:"/sites/:site_id/workflow/tasks/:task_type/replace",tag:"site-workflows",summary:"Replace one task reference while retaining its superseded history.",status:"implemented",request_body_schema:"ReplaceWorkflowTaskCommandRequestSchema",response_schema:"SiteWorkflowTaskRefResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/tasks/website_crawl/replace-and-invalidate-dependents",tag:"site-workflows",summary:"Replace website crawl and invalidate basic-info and metrics dependents atomically.",status:"implemented",request_body_schema:"ReplaceCrawlWorkflowTaskCommandRequestSchema",response_schema:"SiteWorkflowTaskRefResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/build",tag:"site-workflows",summary:"Start the server-owned site build and workspace snapshot lifecycle.",status:"implemented",request_body_schema:"StartSiteBuildRequestSchema",response_schema:"StartSiteBuildResponseSchema",notes:["The browser may start or query the build, but cannot write site build or deployment summary status directly."]},{method:"GET",path:"/sites/:site_id/workflow/customer-materials",tag:"site-workflows",summary:"Read the persisted no-website customer materials draft.",status:"implemented",response_schema:"CustomerMaterialsNullableResponseSchema"},{method:"PUT",path:"/sites/:site_id/workflow/customer-materials",tag:"site-workflows",summary:"Save the no-website customer materials before submission.",status:"implemented",request_body_schema:"CustomerMaterialsDraftSchema",response_schema:"CustomerMaterialsResponseSchema",notes:["A submitted record is immutable and rejects later writes."]},{method:"POST",path:"/sites/:site_id/workflow/customer-materials/submit",tag:"site-workflows",summary:"Submit and freeze customer materials before analysis.",status:"implemented",request_body_schema:"CustomerMaterialsDraftSchema",response_schema:"CustomerMaterialsResponseSchema",notes:["Repeated submissions return 409; clients may retry only the separate workflow advance."]},{method:"GET",path:"/sites/:site_id/designer/component-library/categories",tag:"designer-component-library",summary:"List the fixed insert-new-component category tree for a site.",status:"implemented",response_schema:"ListDesignerComponentCategoriesResponseSchema",notes:["The server validates site ownership and fixes category_group_key to insertNewComponent."]},{method:"GET",path:"/sites/:site_id/designer/component-library/resources",tag:"designer-component-library",summary:"List component resources from the fixed designer catalog group.",status:"implemented",query_schema:"ListDesignerComponentsQuerySchema",response_schema:"ListDesignerComponentsResponseSchema",notes:["The server fixes resource type to component and does not expose resource-platform secrets, internal hosts, or product-line selection."]},{method:"POST",path:"/sites/:site_id/designer/component-library/resources/:resource_id/install",tag:"designer-component-library",summary:"Install one exact component version and return a strict SiteEditEngine materialization.",status:"implemented",request_body_schema:"InstallDesignerComponentBodySchema",response_schema:"InstallDesignerComponentResponseSchema",notes:["The server downloads the resource ZIP with the configured secret, validates main.json identity and compatibility, and returns only the strict materialization plus immutable revision metadata."]},{method:"GET",path:"/sites/:site_id/designer/page-library/categories",tag:"designer-page-library",summary:"List the fixed insert-new-page category tree for a site.",status:"implemented",response_schema:"ListDesignerPageCategoriesResponseSchema",notes:["The server validates site ownership and fixes category_group_key to insertNewPage."]},{method:"GET",path:"/sites/:site_id/designer/page-library/resources",tag:"designer-page-library",summary:"List page and pages resources from the fixed designer catalog.",status:"implemented",query_schema:"ListDesignerPagesQuerySchema",response_schema:"ListDesignerPagesResponseSchema",notes:["The server fixes resource types to page and pages and does not expose resource-platform credentials or internal routing."]},{method:"POST",path:"/sites/:site_id/designer/page-library/resources/:resource_id/prepare",tag:"designer-page-library",summary:"Resolve one exact page resource version for designer-side draft configuration.",status:"implemented",request_body_schema:"PrepareDesignerPageBodySchema",response_schema:"PrepareDesignerPageResponseSchema"},{method:"POST",path:"/sites/:site_id/designer/page-library/resources/:resource_id/install",tag:"designer-page-library",summary:"Install one exact page resource version and return a strict PageResourceArtifact.",status:"implemented",request_body_schema:"InstallDesignerPageBodySchema",response_schema:"InstallDesignerPageResponseSchema",notes:["The server validates the explicit resource type, immutable package identity, page selections, materializations, and package-local references."]},{method:"GET",path:"/sites/:site_id/designer/pages",tag:"designer-page-library",summary:"List designer pages from the stable first-phase fixture source.",status:"implemented",response_schema:"ListDesignerSitePagesResponseSchema"},{method:"POST",path:"/sites/:site_id/designer/page-resources/enhance",tag:"designer-page-library",summary:"Echo a designer page-resource candidate without model execution or normalization.",status:"implemented",request_body_schema:"EnhanceDesignerPageResourceBodySchema",response_schema:"EnhanceDesignerPageResourceResponseSchema"},{method:"POST",path:"/sites/:site_id/designer/page-resources/compose",tag:"designer-page-library",summary:"Compose exact page and component resources into one strict page artifact.",status:"implemented",request_body_schema:"ComposeDesignerPageResourceBodySchema",response_schema:"InstallDesignerPageResponseSchema",notes:["The server installs every immutable source, validates ordered page blocks, scopes component materializations, and returns one artifact without exposing resource-platform credentials."]},{method:"POST",path:"/sites/:site_id/designer/page-resources/blank",tag:"designer-page-library",summary:"Create the deterministic built-in blank page artifact for one configured route.",status:"implemented",request_body_schema:"InstallDesignerPageBodySchema",response_schema:"InstallDesignerPageResponseSchema"},{method:"PATCH",path:"/sites/:site_id",tag:"sites",summary:"Update site display name and optional generated-site locale for the current tenant.",status:"implemented",request_body_schema:"UpdateSiteRequestSchema",response_schema:"SiteRecordSchema"},{method:"DELETE",path:"/sites/:site_id",tag:"sites",summary:"Archive a site so it no longer appears in the tenant site list.",status:"implemented",response_schema:"SiteRecordSchema"},{method:"GET",path:"/sites/:site_id/workspace/source-files",tag:"sites",summary:"List source files available in the ready preview sandbox.",status:"implemented",response_schema:"WorkspaceSourceFileListItemSchema[]"},{method:"GET",path:"/sites/:site_id/workspace/source-file",tag:"sites",summary:"Read a source file from the ready preview sandbox.",status:"implemented",query_schema:"WorkspaceSourceFilePathQuerySchema",response_schema:"WorkspaceSourceFileResponseSchema"},{method:"GET",path:"/sites/:site_id/media-assets",tag:"media-assets",summary:"List or search enterprise image assets through the CMS adapter.",status:"implemented",query_schema:"ListMediaLibraryAssetsQuerySchema",response_schema:"ListMediaLibraryAssetsResponseSchema"},{method:"POST",path:"/sites/:site_id/media-assets",tag:"media-assets",summary:"Upload one validated image and create its enterprise asset.",status:"implemented",response_schema:"UploadMediaLibraryAssetResponseSchema",notes:["Accepts one multipart field named file; only the image MIME allowlist is accepted and the maximum size is 20 MiB."]},{method:"GET",path:"/sites/:site_id/media-assets/unsplash/search",tag:"media-assets",summary:"Search Unsplash through the VCP server-side client.",status:"implemented",query_schema:"SearchUnsplashMediaQuerySchema",response_schema:"SearchUnsplashMediaResponseSchema",notes:["The browser never receives the Unsplash access key; CMS is not involved in search."]},{method:"POST",path:"/sites/:site_id/media-assets/unsplash/:provider_id/use",tag:"media-assets",summary:"Best-effort report that an Unsplash image was selected.",status:"implemented",request_body_schema:"UseUnsplashMediaRequestSchema",response_schema:"UseUnsplashMediaResponseSchema",notes:["CMS report failure returns reported=false and does not roll back the image replacement."]},{method:"POST",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Confirm the currently reviewed Sitemap Draft and advance the site to structure_saved.",status:"implemented",request_body_schema:"ConfirmSiteStructureRequestSchema",response_schema:"PersistSiteSitemapDraftResponseSchema"},{method:"POST",path:"/internal/sites/:site_id/sitemap-draft",tag:"sitemaps",summary:"Persist an agent-generated sitemap draft without confirming the structure.",status:"implemented",request_body_schema:"PersistGeneratedSitemapDraftRequestSchema",response_schema:"PersistGeneratedSitemapDraftResponseSchema"},{method:"GET",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Read the current Sitemap Draft for a site.",status:"implemented",response_schema:"SitemapDraftRecordSchema"},{method:"POST",path:"/sites/:site_id/clarify/answers",tag:"clarify",summary:"Persist the Step 2 clarify answers (and the answered questions) into the site's clarify session.",status:"implemented",request_body_schema:"PersistClarifyAnswersRequestSchema",response_schema:"PersistClarifyAnswersResponseSchema"},{method:"PATCH",path:"/sites/:site_id/clarify/archetype",tag:"clarify",summary:"Switch the Step 2 industry archetype (user_picked) into the site's clarify session via an idempotent upsert.",status:"implemented",request_body_schema:"UpdateClarifyArchetypeRequestSchema",response_schema:"PersistClarifyAnswersResponseSchema",notes:["Independent of generate: materializes a clarify_sessions row when none exists (using the supplied questions) or updates only selected_archetype; never writes answers/completed_at. Forces source=user_picked."]},{method:"POST",path:"/internal/sites/:site_id/design-plan",tag:"design-plans",summary:"Persist a generated design plan version for a site (internal agent-only write).",status:"implemented",request_body_schema:"PersistSiteDesignPlanRequestSchema",response_schema:"PersistSiteDesignPlanResponseSchema",notes:["Guarded by the internal agent token; only the Workspace/Sitemap agent writes design plans."]},{method:"GET",path:"/internal/sites/:site_id/design-plan",tag:"design-plans",summary:"Read the current (latest version) design plan for a site (internal agent-only read).",status:"implemented",response_schema:"DesignPlanRecordSchema",notes:["Guarded by the internal agent token; only the Workspace/Sitemap agent reads design plans."]},{method:"GET",path:"/sites/:site_id/design-plan",tag:"design-plans",summary:"Read the current (latest version) design plan for a site so Workspace UI can inspect the generated design contract.",status:"implemented",response_schema:"DesignPlanRecordSchema"},{method:"GET",path:"/sites/:site_id/brief",tag:"briefs",summary:"Read the persisted Step 1 brief for a site so the Workspace Agent can seed first full-site generation without a new write surface.",status:"implemented",response_schema:"BriefRecordSchema"},{method:"PUT",path:"/sites/:site_id/brief/draft",tag:"briefs",summary:"Save a draft site's Step 1 brief without advancing the workflow.",status:"implemented",request_body_schema:"SaveBriefDraftRequestSchema",response_schema:"SaveBriefDraftResponseSchema",notes:["Only sites in the editable build phase are writable; the brief row is upserted idempotently while site status, locale, and workflow stage remain unchanged."]},{method:"PATCH",path:"/sites/:site_id/brief",tag:"briefs",summary:"Create or update a draft site's Step 1 brief and advance it to Clarify without allowing later workflow states to roll back.",status:"implemented",request_body_schema:"UpdateBriefRequestSchema",response_schema:"UpdateBriefResponseSchema",notes:["Only sites in the editable build phase are writable; missing brief rows are created on first save; identical retries are idempotent."]},{method:"POST",path:"/internal/sites/:cms_site_id/external-sync",tag:"sites",summary:"Synchronize a trusted external CMS site URL into VCP by tenant_id + cms_site_id, creating a draft VCP site on first sync.",status:"implemented",request_body_schema:"ExternalSyncSiteRequestSchema",response_schema:"ExternalSyncSiteResponseSchema",notes:["This trusted external entry does not require browser login or internal bearer auth; tenant_id is written directly to tenants.id and the response uses the internal { code, data, message } success envelope."]},{method:"POST",path:"/internal/sites/:site_id/page-templates",tag:"page-templates",summary:"Create a private page template through the authenticated VCP internal service surface.",status:"implemented",request_body_schema:"PageTemplateCreateRequestSchema",response_schema:"PageTemplateCreateResponseSchema",notes:["Internal service endpoint; callers use the API bearer token plus trusted tenant/user headers. API delegates to Agent with its own AGENT_INTERNAL_TOKEN and never forwards caller Authorization."]},{method:"POST",path:"/internal/sites/:site_id/page-templates/promote",tag:"page-templates",summary:"Promote a private page template through the authenticated VCP internal service surface.",status:"implemented",request_body_schema:"PageTemplatePromoteRequestSchema",response_schema:"PageTemplatePromoteResponseSchema",notes:["Internal service endpoint; uses the same bearer + tenant/user context as create and delegates to Agent with API-owned credentials."]},{method:"POST",path:"/internal/sites/:site_id/page-templates/cleanup",tag:"page-templates",summary:"Clean up private page templates through the authenticated VCP internal service surface.",status:"implemented",request_body_schema:"PageTemplateCleanupRequestSchema",response_schema:"PageTemplateCleanupResponseSchema",notes:["Internal service endpoint; cleanup remains explicit and default-template protection is enforced by the Agent lifecycle service."]},{method:"POST",path:"/sites/:site_id/snapshots",tag:"snapshots",summary:"Persist snapshot metadata without changing the current site snapshot.",status:"implemented",request_body_schema:"PersistSiteSnapshotRequestSchema",response_schema:"PersistSiteSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/promote",tag:"snapshots",summary:"Promote a site snapshot as the current workspace version.",status:"implemented",request_body_schema:"PromoteSiteSnapshotRequestSchema",response_schema:"PromoteSiteSnapshotResponseSchema"},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/lock/try-acquire",tag:"snapshots",summary:"Try to acquire the short-lived template-upgrade site lock.",status:"implemented",request_body_schema:"TryAcquireTemplateUpgradeLockRequestSchema",response_schema:"TryAcquireTemplateUpgradeLockResponseSchema",notes:["Internal agent-only endpoint; lock contention returns acquired=false instead of a user-facing conflict."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/lock/release",tag:"snapshots",summary:"Release the calling template-upgrade attempt's site lock.",status:"implemented",request_body_schema:"ReleaseTemplateUpgradeLockRequestSchema",response_schema:"ReleaseTemplateUpgradeLockResponseSchema",notes:["Internal agent-only endpoint; release is scoped by tenant, site, operation type, and owner."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/snapshots/:snapshot_id/promote",tag:"snapshots",summary:"CAS-promote a validated template-upgrade candidate and bind its accepted commit atomically.",status:"implemented",request_body_schema:"PromoteTemplateUpgradeSnapshotRequestSchema",response_schema:"PromoteTemplateUpgradeSnapshotResponseSchema",notes:["Internal agent-only endpoint; accepted_commit is never part of the public promote request or response."]},{method:"GET",path:"/internal/sites/:site_id/template-upgrade/state",tag:"snapshots",summary:"Inspect the projected tenant-scoped template-upgrade state without mutation.",status:"implemented",query_schema:"InspectTemplateUpgradeStateRequestSchema",response_schema:"InspectTemplateUpgradeStateResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and the repository path is read-only."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/state/prepare",tag:"snapshots",summary:"Prepare the tenant-scoped template-upgrade retry state for a target version.",status:"implemented",request_body_schema:"PrepareTemplateUpgradeStateRequestSchema",response_schema:"PrepareTemplateUpgradeStateResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and is never accepted in the request body."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/state/failure",tag:"snapshots",summary:"Record a finite validation failure for the prepared template-upgrade target.",status:"implemented",request_body_schema:"RecordTemplateUpgradeFailureRequestSchema",response_schema:"RecordTemplateUpgradeFailureResponseSchema",notes:["Internal agent-only endpoint; accepts a finite error code and never raw validation output."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/state/success",tag:"snapshots",summary:"Reset retry state after the prepared template-upgrade target succeeds.",status:"implemented",request_body_schema:"RecordTemplateUpgradeSuccessRequestSchema",response_schema:"RecordTemplateUpgradeSuccessResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and is never accepted in the request body."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/events",tag:"snapshots",summary:"Record one bounded template-upgrade observability event.",status:"implemented",request_body_schema:"RecordTemplateUpgradeEventRequestSchema",response_schema:"RecordTemplateUpgradeEventResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and the strict request excludes raw errors, source content, and file paths."]},{method:"GET",path:"/internal/template-upgrades/report",tag:"snapshots",summary:"Read tenant-scoped template-upgrade outcome, state, and duration aggregates.",status:"implemented",query_schema:"GetTemplateUpgradeReportQuerySchema",response_schema:"GetTemplateUpgradeReportResponseSchema",notes:["Internal endpoint; tenant identity is derived from trusted request context and all aggregates are tenant-scoped."]},{method:"GET",path:"/internal/template-upgrades/snapshot-deletions/pending",tag:"snapshots",summary:"List tenant-scoped stale template-upgrade snapshot deletions for dry-run or reconciliation.",status:"implemented",query_schema:"ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema",response_schema:"ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema",notes:["Defaults to retrying deleting tombstones. Including candidate snapshots is an explicit maintenance action and should use a conservative age threshold."]},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/abandon",tag:"snapshots",summary:"Mark an unpromoted candidate snapshot as failed.",status:"implemented",response_schema:"AbandonSiteSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/snapshots/:snapshot_id",tag:"snapshots",summary:"Read one tenant-scoped snapshot metadata record for a site.",status:"implemented",response_schema:"SnapshotRecordSchema"},{method:"DELETE",path:"/sites/:site_id/snapshots/:snapshot_id",tag:"snapshots",summary:"Prepare two-phase deletion of a candidate snapshot and return its object key; refuses non-candidate/current/referenced snapshots.",status:"implemented",response_schema:"DeleteSiteSnapshotResponseSchema",notes:["Internal Agent authentication is required. This endpoint only creates a deleting tombstone; object removal and completion are separate steps."]},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/deletion/complete",tag:"snapshots",summary:"Complete deletion after the snapshot object has been removed; only accepts deleting snapshots.",status:"implemented",response_schema:"CompleteSiteSnapshotDeletionResponseSchema",notes:["Internal Agent authentication is required; callers must remove the object before completing the DB deletion."]},{method:"POST",path:"/agent-runs",tag:"agent-runs",summary:"Create an agent run for event persistence and replay.",status:"implemented",request_body_schema:"CreateAgentRunRequestSchema",response_schema:"CreateAgentRunResponseSchema"},{method:"POST",path:"/agent-runs/:run_id/events",tag:"agent-runs",summary:"Append one normalized AgentEvent to a run.",status:"implemented",request_body_schema:"AppendAgentEventRequestSchema",response_schema:"AppendAgentEventResponseSchema",notes:["Internal-only write surface: only internal-service callers may append, except browser (oidc) contexts may append run.failed (the WS connect-stage unlock path, equivalent to POST /agent-runs/workspace/cancel). All other oidc appends \u2014 run.finished, run.started, tool/system/progress, file/snapshot \u2014 are rejected with 403 FORBIDDEN. The browser sends user messages over the Workspace WebSocket (recorded server-side as user.message) and otherwise only reads the GET replay."]},{method:"GET",path:"/agent-runs/:run_id/events",tag:"agent-runs",summary:"Replay AgentEvents after a run-local sequence cursor.",status:"implemented",response_schema:"ListAgentEventsResponseSchema"},{method:"POST",path:"/internal/agent-runs/fail-stale-in-flight",tag:"agent-runs",summary:"Fail stale in-flight workspace runs (internal maintenance, cross-tenant sweep).",status:"implemented",response_schema:"FailStaleInFlightWorkspaceRunsResponseSchema",notes:["Internal maintenance endpoint guarded by InternalAgentAuthGuard (Bearer VCP_AGENT_INTERNAL_TOKEN, production fail-closed); the /internal/** prefix is exempt from browser auth middleware so the guard is the sole trust boundary. Not exposed to the browser via agent-proxy; called by an external admin cron / controlled ops script."]},{method:"GET",path:"/deployments",tag:"deployments",summary:"Deployment resource summary endpoint until publish APIs land.",status:"skeleton"},{method:"POST",path:"/sites/:site_id/workspace/runs",tag:"workspace",summary:"Start an asynchronous Workspace Agent run from the current snapshot.",status:"implemented",request_body_schema:"StartWorkspaceRunRequestSchema",response_schema:"StartWorkspaceRunResponseSchema",notes:["Long-running work must be event-driven and must not block API transactions."]},{method:"POST",path:"/v1/agent/workspace/:site_id/form-design-operations",tag:"agent/workspace",summary:"Create or replay a deterministic FORM_SPEC save operation.",status:"implemented",request_body_schema:"FormDesignSaveRequestSchema",response_schema:"FormDesignOperationResponseSchema"},{method:"GET",path:"/v1/agent/workspace/:site_id/form-design-operations/:operation_id",tag:"agent/workspace",summary:"Read a persisted FORM_SPEC save operation.",status:"implemented",response_schema:"FormDesignOperationResponseSchema"},{method:"POST",path:"/v1/agent/workspace/:site_id/form-design-operations/:operation_id/resume",tag:"agent/workspace",summary:"Resume a recoverable FORM_SPEC save with its original fingerprint.",status:"implemented",request_body_schema:"FormDesignResumeRequestSchema",response_schema:"FormDesignOperationResponseSchema"},{method:"GET",path:"/sites/:site_id/workspace/runs/latest",tag:"workspace",summary:"Look up the latest workspace Agent run for a site so Step 4 re-entry can replay persisted events without re-triggering the model.",status:"implemented",response_schema:"LatestWorkspaceRunResponseSchema"},{method:"POST",path:"/internal/sites/:site_id/preview-sessions",tag:"sandbox-sessions",summary:"Persist or update an Agent-owned on-demand preview session; optional current/ready-session guards support current-snapshot CAS and guarded in-place snapshot advance.",status:"implemented",request_body_schema:"PersistPreviewSessionRequestSchema",response_schema:"PersistPreviewSessionResponseSchema"},{method:"GET",path:"/sites/:site_id/preview-sessions/current",tag:"sandbox-sessions",summary:"Read the latest tenant-scoped preview session for a site.",status:"implemented",response_schema:"SandboxSessionSchema"},{method:"POST",path:"/sites/:site_id/preview/activate",tag:"site-preview",summary:"Activate the existing preview sandbox for a site.",status:"implemented",response_schema:"SitePreviewActivateResponseSchema"},{method:"POST",path:"/v1/agent/site-preview/:site_id/activate",tag:"agent/site-preview",summary:"Activate the existing preview sandbox for a site through Agent.",status:"implemented",response_schema:"SitePreviewActivateResponseSchema"},{method:"POST",path:"/sites/:site_id/deployments",tag:"deployments",summary:"Queue an explicit user-confirmed publish from the latest current snapshot.",status:"implemented",request_body_schema:"CreateDeploymentRequestSchema",response_schema:"CreateDeploymentResponseSchema",notes:["The server resolves the latest current snapshot and validates site and snapshot existence, in-flight deployment state, and site operation lock before creating the deployment record and queue job.","The API returns after creating the deployment record and queue job; worker-service claims deployment_jobs for build and Cloudflare publish."]},{method:"POST",path:"/sites/:site_id/deployments/quality-check",tag:"deployments",summary:"Queue a quality-check deployment from a snapshot.",status:"implemented",request_body_schema:"CreateQualityCheckDeploymentRequestSchema",response_schema:"CreateDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/quality-check/status",tag:"deployments",summary:"Read the latest quality-check deployment status.",status:"implemented",response_schema:"GetDeploymentsStatusResponseSchema"},{method:"POST",path:"/internal/site-deployments/quality-check",tag:"deployments",summary:"Queue a quality-check deployment for the current site through the internal Agent API.",status:"implemented",response_schema:"InternalCreateDeploymentResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id.","POST accepts no request body; VCP resolves the current snapshot. Quality-check and publish deployments are independent."]},{method:"GET",path:"/internal/site-deployments/quality-check/status",tag:"deployments",summary:"Read the latest internal quality-check deployment status for the current site.",status:"implemented",response_schema:"InternalGetDeploymentsStatusResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id."]},{method:"POST",path:"/internal/site-deployments/publish",tag:"deployments",summary:"Queue a publish deployment for the current site through the internal Agent API.",status:"implemented",response_schema:"InternalCreateDeploymentResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id.","POST accepts no request body; VCP resolves the latest current snapshot. Quality-check and publish deployments are independent."]},{method:"GET",path:"/internal/site-deployments/publish/status",tag:"deployments",summary:"Read the latest internal publish deployment status for the current site.",status:"implemented",response_schema:"InternalGetDeploymentsStatusResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id."]},{method:"GET",path:"/sites/:site_id/deployments/current",tag:"deployments",summary:"Read the latest deployment for workspace refresh recovery.",status:"implemented",response_schema:"CurrentDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/status",tag:"deployments",summary:"Read current in-flight deployment and latest released deployment.",status:"implemented",response_schema:"GetDeploymentsStatusResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/:deployment_id",tag:"deployments",summary:"Read one tenant-scoped deployment for status polling.",status:"implemented",response_schema:"GetDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/cms/collections",tag:"cms",summary:"List CMS collections for a site.",status:"planned"},{method:"POST",path:"/sites/:site_id/cms/collections",tag:"cms",summary:"Create a CMS collection bound to generated content.",status:"planned"},{method:"GET",path:"/sites/:site_id/cms/collections/:collection_id/entries",tag:"cms",summary:"List CMS entries for a collection.",status:"planned"},{method:"POST",path:"/sites/:site_id/cms/collections/:collection_id/entries",tag:"cms",summary:"Create a CMS entry.",status:"planned"},{method:"PATCH",path:"/sites/:site_id/cms/collections/:collection_id/entries/:entry_id",tag:"cms",summary:"Update a CMS entry.",status:"planned"},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/version-record",tag:"versions",summary:"Record the sandbox accepted git commit for a promoted snapshot version.",status:"implemented",request_body_schema:"RecordSnapshotVersionRequestSchema",response_schema:"RecordSnapshotVersionResponseSchema"},{method:"GET",path:"/sites/:site_id/versions",tag:"versions",summary:"List snapshot-backed site versions.",status:"implemented",response_schema:"ListSiteVersionsResponseSchema"},{method:"POST",path:"/sites/:site_id/versions/:snapshot_id/restore",tag:"versions",summary:"Restore a site to an earlier snapshot version.",status:"implemented",response_schema:"RestoreSiteSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/domains/configuration",tag:"custom-domains",summary:"Read the authoritative site domain configuration.",status:"implemented",response_schema:"GetSiteDomainConfigurationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflows/:workflow_id/domain/check",tag:"publish-workflow",summary:"Check a publish workflow domain and start its operation.",status:"implemented",request_body_schema:"CheckSitePublishDomainRequestSchema",response_schema:"CheckSitePublishDomainResponseSchema"},{method:"GET",path:"/sites/:site_id/publish-workflows/:workflow_id/domain/operation",tag:"publish-workflow",summary:"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/integrations/gsc/auth/start",tag:"gsc",summary:"Start Google Search Console authorization for a site.",status:"implemented",request_body_schema:"StartGscAuthRequestSchema",response_schema:"StartGscAuthResponseSchema"},{method:"GET",path:"/sites/:site_id/integrations/gsc/status",tag:"gsc",summary:"Read Google Search Console authorization and property status.",status:"implemented",response_schema:"GscStatusResponseSchema"},{method:"GET",path:"/admin/tenants",tag:"admin",summary:"Admin tenant listing.",status:"planned"},{method:"GET",path:"/usage/summary",tag:"usage",summary:"Summarize tenant usage and cost controls.",status:"planned"},{method:"GET",path:"/sites/:site_id/publish-workflow/active",tag:"publish-workflow",summary:"Read the active site publish workflow.",status:"implemented",response_schema:"SitePublishWorkflowActiveResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/start",tag:"publish-workflow",summary:"Start or recover the site publish workflow.",status:"implemented",request_body_schema:"StartSitePublishWorkflowRequestSchema",response_schema:"SitePublishWorkflowMutationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/:workflow_id/retry",tag:"publish-workflow",summary:"Retry failed external publish quality tasks.",status:"implemented",request_body_schema:"SitePublishWorkflowRevisionRequestSchema",response_schema:"SitePublishWorkflowMutationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/:workflow_id/stream",tag:"publish-workflow",summary:"Stream updates for an existing site publish workflow.",status:"implemented",request_body_schema:"StreamSitePublishWorkflowRequestSchema",response_schema:"SitePublishWorkflowSseDataSchema"},{method:"PATCH",path:"/sites/:site_id/publish-workflow/:workflow_id/step",tag:"publish-workflow",summary:"Move the site publish workflow to an allowed step.",status:"implemented",request_body_schema:"UpdateSitePublishWorkflowStepRequestSchema",response_schema:"SitePublishWorkflowMutationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/:workflow_id/cancel",tag:"publish-workflow",summary:"Cancel a stable site publish workflow.",status:"implemented",request_body_schema:"SitePublishWorkflowRevisionRequestSchema",response_schema:"SitePublishWorkflowMutationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/:workflow_id/publish",tag:"publish-workflow",summary:"Start formal publishing for a site publish workflow.",status:"implemented",request_body_schema:"SitePublishWorkflowRevisionRequestSchema",response_schema:"SitePublishWorkflowPublishResponseSchema"}],tC=[{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"]}],Rb=e.object({id:e.string().min(1),role:e.enum(["system","user","assistant"]),metadata:e.unknown().optional(),parts:e.array(es).min(1)}),lm=Rb.extend({role:e.literal("user")}),nC=e.object({base_snapshot_id:x.optional(),message:lm.optional(),client_run_key:e.string().min(1).max(200).optional()}).superRefine((t,n)=>{ln(t.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),Tb=e.object({path:e.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:V,base_snapshot_id:x,run_kind:ns}),sC=e.object({agent_run:et,websocket:Tb,next_step:e.literal("workspace_socket")}),iC=e.object({agent_run:et}),aC=e.object({agent_type:e.enum(["clarify","sitemap","workspace"])}),oC=e.object({agent_run:et}),rC=e.enum(["client.message.create","client.resource.operation.create","client.run.cancel","client.tool.approve","server.run.started","server.user.message","server.assistant.delta","server.tool.started","server.tool.completed","server.workspace.suggestions","workspace.plan.created","workspace.worker.updated","workspace.task.updated","server.patch.applied","server.sitemap.updated","server.snapshot.created","server.snapshot.finalized","server.preview.invalidated","preview.build.started","preview.build.succeeded","preview.build.failed","server.run.finished","server.run.failed","server.error","server.activity.started","server.activity.updated","server.activity.finished","server.activity.failed"]),J=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:I,run_id:V.optional(),correlation_id:e.string().min(1).optional(),seq:e.number().int().positive().optional(),sent_at:e.string().min(1)}),kb=e.object({key:e.string().min(1),label:e.string().min(1),source_file:e.string().min(1).optional(),component_name:e.string().min(1).optional(),opening_element_range:e.object({start_line:e.number().int().positive(),start_column:e.number().int().nonnegative(),end_line:e.number().int().positive(),end_column:e.number().int().nonnegative()}).optional(),structural_path:e.string().min(1).optional(),text_preview:e.string().min(1).optional()}),Pb=e.discriminatedUnion("type",[J.extend({type:e.literal("client.message.create"),payload:e.object({client_message_id:e.string().min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),current_route_id:Wt.optional(),interaction_response:An.optional(),selected_component:kb.optional(),message:lm,base_snapshot_id:x.optional()}).superRefine((t,n)=>{t.interaction_response&&!t.in_reply_to_tool_call_id&&n.addIssue({code:"custom",path:["in_reply_to_tool_call_id"],message:"in_reply_to_tool_call_id is required for an interaction response"})})}),J.extend({type:e.literal("client.run.cancel"),payload:e.object({run_id:V,reason:e.string().min(1).optional()})}),J.extend({type:e.literal("client.tool.approve"),payload:e.object({tool_call_id:e.string().min(1),decision:e.enum(["approve","reject"]),reason:e.string().min(1).optional()})}),Io]),wb=e.discriminatedUnion("type",[J.extend({type:e.literal("server.run.started"),payload:e.object({run_id:V,agent_type:e.literal("workspace")})}),J.extend({type:e.literal("server.user.message"),payload:e.object({client_message_id:e.string().min(1),message_id:e.string().min(1),parts:e.array(es).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),interaction_response:An.optional()})}),J.extend({type:e.literal("server.assistant.delta"),payload:e.object({message_id:e.string().min(1),parts:e.array(es).min(1),status:e.enum(["streaming","ready"])})}),J.extend({type:e.literal("server.tool.started"),payload:e.object({tool_call_id:e.string().min(1),name:e.string().min(1),summary:e.string().min(1)})}),J.extend({type:e.literal("server.tool.completed"),payload:e.object({tool_call_id:e.string().min(1),name:e.string().min(1),result_summary:e.string().min(1),interaction_request:zs.optional()})}),J.extend({type:e.literal("server.workspace.suggestions"),payload:am.extend({run_id:V}).strict()}),J.extend({type:e.literal("workspace.plan.created"),payload:e.object({plan_id:e.string().min(1),run_kind:ns,groups:e.array(Vi),tasks:e.array(Hi),dependencies:e.array($i),expected_outputs:e.array(Se),diagnostics:Wi,summary:rm})}),J.extend({type:e.literal("workspace.worker.updated"),payload:e.object({group_id:e.string().min(1),phase:zi,status:dt,task_counts:cm,target_paths:e.array(Se),diagnostics:e.array(e.string().min(1))})}),J.extend({type:e.literal("workspace.task.updated"),payload:e.object({task_id:e.string().min(1),group_id:e.string().min(1),status:dt,target_path:Se,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(Bi).optional()})}),J.extend({type:e.literal("server.patch.applied"),payload:e.object({patch_batch_id:e.string().min(1),changed_files:e.array(e.string().min(1)),sitemap_resync_queued:e.boolean()})}),J.extend({type:e.literal("server.sitemap.updated"),payload:e.object({sitemap_id:ke,version:e.number().int().positive(),reason:e.string().min(1)})}),J.extend({type:e.literal("server.snapshot.created"),payload:e.object({snapshot_id:x,manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/)})}),J.extend({type:e.literal("server.snapshot.finalized"),payload:e.object({snapshot_id:x})}),J.extend({type:e.literal("server.preview.invalidated"),payload:e.object({reason:e.string().min(1),next_preview_url:e.string().url().optional()})}),J.extend({type:e.literal("preview.build.started"),payload:e.object({snapshot_id:x})}),J.extend({type:e.literal("preview.build.succeeded"),payload:e.object({snapshot_id:x})}),J.extend({type:e.literal("preview.build.failed"),payload:e.object({snapshot_id:x,message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean()})}),J.extend({type:e.literal("server.run.finished"),payload:e.object({run_id:V,snapshot_id:x,degraded_reason:Dt.optional(),build_verified:e.boolean().optional()})}),J.extend({type:e.literal("server.run.failed"),payload:e.object({run_id:V,error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),outcome:e.literal("retained_previous").optional(),details:e.record(e.string(),e.unknown()).optional()})}),J.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})}),J.extend({type:e.literal("server.activity.started"),payload:e.object({activity_id:e.string().min(1),parent_activity_id:e.string().min(1).optional(),kind:Kc,title:e.string().min(1).max(200),title_code:Je.optional(),detail:e.string().max(360).optional(),detail_code:Je.optional(),locks_input:e.boolean()})}),J.extend({type:e.literal("server.activity.updated"),payload:e.object({activity_id:e.string().min(1),title:e.string().min(1).max(200).optional(),title_code:Je.optional(),detail:e.string().max(360).optional(),detail_code:Je.optional()})}),J.extend({type:e.literal("server.activity.finished"),payload:e.object({activity_id:e.string().min(1)})}),J.extend({type:e.literal("server.activity.failed"),payload:e.object({activity_id:e.string().min(1),detail:e.string().max(360).optional()})})]),Ab=wb.superRefine((t,n)=>{if(t.type==="server.user.message"&&t.payload.interaction_response&&!t.payload.in_reply_to_tool_call_id&&n.addIssue({code:"custom",path:["payload","in_reply_to_tool_call_id"],message:"in_reply_to_tool_call_id is required for an interaction response"}),t.type!=="server.tool.completed")return;let s=t.payload.name==="prepare_product_search_entry";s!==!!t.payload.interaction_request&&n.addIssue({code:"custom",path:["payload","interaction_request"],message:s?"prepare_product_search_entry requires interaction_request":"interaction_request is only valid for prepare_product_search_entry"})}),cC=e.union([Pb,Ab]),mC={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."]},pm=e.string().regex(/^sha256:[a-f0-9]{64}$/),vb=e.enum(["create","update","delete","str_replace"]),dm=e.enum(["sitemap_resync","smoke_test","prepare_preview"]),Cb=e.object({old_string:e.string().min(1).describe("Exact text to find in the current file. Must match the file uniquely; include enough surrounding context (usually 2-4 adjacent lines)."),new_string:e.string().describe("Replacement text. May be empty to delete the matched text."),replace_all:e.boolean().optional()}).strict(),Db=e.object({path:Se,operation:vb,expected_hash:pm.optional(),full_content:e.string().describe("Complete file content for create/update patches. Only this single field is a string value: every double quote inside the source code must be escaped so the field stays valid JSON. Avoid ASCII double quotes inside JSX attribute values and use corner quotes like \u300C\u751F\u65E5\u5FEB\u4E50\u300D for visitor-facing quoted examples. The surrounding patch object and the patches array are ordinary JSON structures, not strings.").optional(),edits:e.array(Cb).min(1).max(20).optional()}).strict().superRefine((t,n)=>{let s=t.full_content!==void 0;if(t.operation==="delete"){s&&n.addIssue({code:"custom",path:["full_content"],message:"delete patches must not include full_content"}),t.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"});return}if(Bb(t.path)||n.addIssue({code:"custom",path:["path"],message:"Static App Router page paths must use lowercase ASCII kebab-case public segments."}),t.operation==="str_replace"){t.full_content!==void 0&&n.addIssue({code:"custom",path:["full_content"],message:"str_replace patches must not include full_content"}),(!t.edits||t.edits.length===0)&&n.addIssue({code:"custom",path:["edits"],message:"str_replace patches must include a non-empty edits array"});return}s||n.addIssue({code:"custom",path:["full_content"],message:"create/update patches must include full_content"}),t.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"})}),jb=e.object({kind:e.enum(["block","page","site","chrome"]),id:e.string().min(1).max(120)}),Ob=e.object({base_key:e.string().min(1).max(120).regex(/^[A-Za-z0-9._:-]+$/).refine(t=>!t.includes(".."),{message:"base_key must not contain '..'"}),owner:jb,count:e.number().int().min(1).max(12),query:e.string().min(1).max(400),role:e.enum(["hero","section","card","gallery","testimonial","decorative","site_background","nav_background","footer_background"]),orientation:e.enum(["landscape","portrait","square"]).optional(),altHint:e.string().min(1).max(300)}),um=e.object({site_id:I,base_snapshot_id:x,reason:e.string().min(1),patches:e.array(Db).min(1).describe("A real JSON array of patch objects. Never JSON.stringify this array, and never put an encoded JSON array inside a string \u2014 emit the array itself. Only full_content within a patch object is a string field."),media_requests:e.array(Ob).max(24).optional(),post_actions:e.array(dm).optional()});function gm(t,n){let s=new Set;for(let[a,i]of t.patches.entries())s.has(i.path)&&n.addIssue({code:"custom",path:["patches",a,"path"],message:`Duplicate patch path: ${i.path}`}),s.add(i.path)}var lC=um.superRefine(gm),pC=um.omit({base_snapshot_id:!0}).extend({site_id:I.optional()}).superRefine(gm),Nb=le,Lb=e.object({path:Nb,operation:e.enum(["upsert","delete"]).optional()}),_m=e.enum(["sync_cms_pages","sync_cms_navigation"]),dC=e.object({files:e.array(Lb).min(1),post_actions:e.array(_m).optional()}).strict().overwrite(t=>t.post_actions?{...t,post_actions:[...new Set(t.post_actions)]}:t),Mb=e.enum(["BASE_SNAPSHOT_NOT_FOUND","PATCH_TARGET_NOT_FOUND","PATCH_TARGET_ALREADY_EXISTS","PATCH_EXPECTED_HASH_MISMATCH","PATCH_DIFF_UNSUPPORTED","PATCH_PROTECTED_FILE","PATCH_VALIDATION_FAILED","PATCH_MEDIA_REFERENCE_NOT_DECLARED","PATCH_BATCH_INVALID","PATCH_BATCH_FAILED","PATCH_BATCH_TOO_LARGE","STR_REPLACE_NOT_FOUND","STR_REPLACE_NOT_UNIQUE","STR_REPLACE_BINARY_FILE","STR_REPLACE_REQUIRES_READ"]),Ub=e.object({status:e.literal("applied"),patch_batch_id:e.string().min(1),site_id:I,base_snapshot_id:x,snapshot_id:x,manifest_hash:pm,object_key:e.string().min(1),changed_files:e.array(Se).min(1),post_actions_queued:e.array(dm),dropped_protected_files:e.array(e.string().min(1)).min(1).optional()}),Fb=e.object({status:e.literal("failed"),code:Mb,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),uC=e.discriminatedUnion("status",[Ub,Fb]),gC=e.object({ok:e.literal(!0),post_actions:e.array(e.object({action:_m,status:e.enum(["succeeded","failed"])}).strict()).default([])}),hm=le,qb=e.enum(["text","binary"]),Sm=e.object({path:hm,kind:qb,language:e.string().min(1).nullable(),size_bytes:e.number().int().nonnegative()}),_C=e.object({path:hm}),Gb=Sm.extend({kind:e.literal("text"),language:e.string().min(1),content:e.string()}),Kb=Sm.extend({kind:e.literal("binary"),language:e.null(),mime_type:e.string().min(1),content_base64:e.string().min(1)}),hC=e.union([Gb,Kb]);function ln(t){return typeof t=="string"?/authorization\s*:|bearer\s+|token\s*=|secret\s*=|api[_-]?key\s*=|access[_\s-]?key\s*=|\bsk-[a-z0-9_-]{20,}|eyJ[a-z0-9_-]{10,}\.[a-z0-9_-]{10,}\.[a-z0-9_-]{10,}/i.test(t):!t||typeof t!="object"?!1:Array.isArray(t)?t.some(n=>ln(n)):Object.entries(t).some(([n,s])=>zb(n)||ln(s))}function zb(t){let n=t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/\s+/g,"_").toLowerCase();return/(^|[_-])(authorization|token|secret|api[_-]?key|apikey|access[_-]?key|accesskey)([_-]|$)/.test(n)}function fm(t){let n=t.split("/");return t.length>0&&!t.startsWith("/")&&!t.includes("\\")&&n.every(s=>s!==""&&s!=="."&&s!=="..")}function Bb(t){let n=/^app\/(?:(.*)\/)?page\.(?:tsx|jsx)$/.exec(t);if(!n)return!0;let a=(n[1]??"").split("/").filter(r=>r.length>0);return a.some(r=>r.startsWith("_"))?!0:a.filter(r=>!r.startsWith("@")&&!/^\(.+\)$/.test(r)).map(r=>r.replace(/^\((?:\.|\.\.|\.\.\.)\)/,"")).filter(r=>r.length>0).every(r=>/^\[.*\]$/.test(r)||Ft.test(`/${r}`))}var bm=e.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),Wb=e.object({id:pn,tenant_id:e.string().min(1),site_id:I,sandbox_id:e.string().min(1).nullable(),status:bm,source_snapshot_id:x.nullable(),last_snapshot_id:x.nullable(),preview_url:e.string().url().nullable(),browser_preview_url:e.string().url().nullable().optional(),last_activity_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),SC=e.object({session_id:pn.optional(),sandbox_id:e.string().min(1).optional(),source_snapshot_id:x.optional(),last_snapshot_id:x,expected_current_snapshot_id:x.optional(),expected_ready_session_id:pn.optional(),expected_ready_session_last_snapshot_id:x.optional(),status:bm,preview_url:e.string().url().optional()}),fC=e.object({preview_session:Wb,next_step:e.literal("preview")}),bC=e.object({failed_count:e.number().int().nonnegative()}),yC=e.object({site_id:I}),xC=e.object({status:e.enum(["cancelled","no_active_run"]),agent_run:et.nullable()});export{Ir as AESTHETIC_NOTE_MAX_LENGTH,qA as AbandonSiteSnapshotResponseSchema,Kc as ActivityKindSchema,Je as ActivityTitleCodeSchema,LI as AdvanceSiteWorkflowRequestSchema,Oc as AgentErrorCategorySchema,Zi as AgentEventIdSchema,Di as AgentEventRecordSchema,mm as AgentEventSchema,om as AgentEventTypeSchema,cb as AgentMessageHistoryPurposeSchema,Mc as AgentModelRouteSchema,mb as AgentPlanStepSchema,V as AgentRunIdSchema,Lc as AgentRunKindSchema,et as AgentRunRecordSchema,sf as AgentRunStatusSchema,Nc as AgentRunTypeSchema,hb as AiSdkUiDataPartSchema,fb as AiSdkUiErrorPartSchema,ub as AiSdkUiFilePartSchema,es as AiSdkUiMessagePartSchema,Rb as AiSdkUiMessageSchema,db as AiSdkUiReasoningPartSchema,_b as AiSdkUiSourceDocumentPartSchema,gb as AiSdkUiSourceUrlPartSchema,bb as AiSdkUiStepStartPartSchema,pb as AiSdkUiTextPartSchema,Sb as AiSdkUiToolPartSchema,Qv as ApiContractStatusSchema,df as ApiErrorEnvelopeSchema,M as ApiResponseSchema,$v as AppendAgentEventRequestSchema,Yv as AppendAgentEventResponseSchema,Mb as ApplyPatchBatchErrorCodeSchema,Fb as ApplyPatchBatchFailureSchema,lC as ApplyPatchBatchInputSchema,Db as ApplyPatchBatchPatchSchema,dm as ApplyPatchBatchPostActionSchema,uC as ApplyPatchBatchResultSchema,Ub as ApplyPatchBatchSuccessSchema,pC as ApplyPatchBatchToolInputSchema,Cb as ApplyPatchEditSchema,vb as ApplyPatchOperationSchema,jc as ArchetypeProposalSchema,ay as AuditLogIdSchema,Hb as AuthIdentityIdSchema,Zb as AuthLoginCodeIdSchema,Xb as AuthOidcStateIdSchema,$b as AuthSessionIdSchema,Yb as AuthTokenIdSchema,Qb as AuthWsTicketIdSchema,Eh as BINDING_STATUSES,zc as BlockGenerationContextSchema,fv as BlockMediaIntentSchema,qi as BlockSchema,Bc as BrandingSchema,ut as BriefIdSchema,Mi as BriefRecordSchema,ea as BusinessFactsSchema,JT as CHAT_COPY,QT as CLARIFICATION_COPY,$_ as CMS_FORM_FIELD_TYPES,ir as CMS_MAIN_PRODUCTS_MAX_LENGTH,Yl as CMS_PAGE_DIRECTORY_MAX_DEPTH,$l as CMS_PAGE_DIRECTORY_MAX_NODES,Na as CMS_PAGE_URL_PATH_MAX_LENGTH,NR as COMPONENT_I18N_FILE_SUFFIX,Dn as COMPONENT_I18N_NAMESPACE,Em as CONVERSION_CTA_LABEL_MAX_LENGTH,qh as CRAWLER_INTERNAL_ERROR_CODES,Jo as CURRENT_EDIT_ENGINE_VERSION,yC as CancelActiveWorkspaceRunRequestSchema,xC as CancelActiveWorkspaceRunResponseSchema,cc as CheckSitePublishDomainDataSchema,xS as CheckSitePublishDomainRequestSchema,ES as CheckSitePublishDomainResponseSchema,Wc as ChromeDesignSchema,Tf as ChromeFooterDesignSchema,Rf as ChromeFooterShellSchema,Ef as ChromeHeaderDesignSchema,xf as ChromeHeaderShellSchema,kf as ChromeMobileNavDesignSchema,tf as ClarifyQuestionOptionSchema,nf as ClarifyQuestionSchema,QS as ClarifyQuestionTypeSchema,Ni as ClarifyQuestionsSchema,cA as ClarifyRunInputSchema,Yi as ClarifySessionIdSchema,nb as ClarifySessionRecordSchema,mA as ClarifyStreamEventSchema,oy as CmsCollectionBindingIdSchema,Z0 as CmsCollectionBindingSchema,Or as CmsFormSchemaProjectionSchema,Ps as CmsManagedPageTypeSchema,Zl as CmsPageDirectoryGroupSchema,La as CmsPageDirectoryNodeSchema,ja as CmsPageDirectorySchema,ws as CmsPageTypeSchema,Mt as CmsPageUrlPathSchema,_a as CmsSiteIdSchema,Mh as CompanyInfoSchema,dP as CompanyInfoTaskCreateRequestSchema,uP as CompanyInfoTaskCreateResponseSchema,gP as CompanyInfoTaskResponseSchema,T1 as CompleteCustomerMaterialsRequestSchema,k1 as CompleteDiagnosisRequestSchema,KA as CompleteSiteSnapshotDeletionResponseSchema,MI as CompleteSiteWorkflowRequestSchema,P1 as CompleteStrategyRequestSchema,R1 as CompleteWebsiteScanRequestSchema,MR as ComponentI18nResourcesSchema,RE as ComposeDesignerPageResourceBodySchema,Lv as ConfirmSiteStructureRequestSchema,a0 as ConnectDynamicCollectionInputSchema,c0 as ConnectFormInputSchema,st as ConversionHintsSchema,Gh as CrawlerInternalErrorCodeSchema,_P as CrawlerInternalErrorSchema,It as CrawlerTaskCodeSchema,sP as CrawlerTaskCreateRequestSchema,oP as CrawlerTaskCreateResponseSchema,Ah as CrawlerTaskFailureErrorCodeSchema,Yr as CrawlerTaskFailureStageSchema,Ch as CrawlerTaskPageSchema,iP as CrawlerTaskPagesQuerySchema,mP as CrawlerTaskPagesResponseSchema,cP as CrawlerTaskStatusResponseSchema,mt as CrawlerTaskUuidSchema,hv as CreateAgentRunConflictResponseSchema,OA as CreateAgentRunRequestSchema,NA as CreateAgentRunResponseSchema,rv as CreateDeploymentRequestSchema,cf as CreateDeploymentResponseSchema,Uy as CreateDocumentUploadRequestSchema,Ty as CreateExternalSiteEditRequestSchema,ky as CreateExternalSiteEditResponseSchema,By as CreateImageUploadRequestSchema,jy as CreateInputSourceRequestSchema,cv as CreateQualityCheckDeploymentRequestSchema,_A as CreateSiteBriefRequestSchema,CA as CreateSiteBriefResponseSchema,hA as CreateSiteDraftRequestSchema,gA as CreateSiteInputSchema,OI as CreateSiteWorkflowRequestSchema,Dm as CreateTextInputSourceRequestSchema,jm as CreateUrlInputSourceRequestSchema,lv as CurrentDeploymentResponseSchema,f1 as CustomerMaterialsDraftResponseSchema,ni as CustomerMaterialsDraftSchema,b1 as CustomerMaterialsNullableResponseSchema,si as CustomerMaterialsRecordSchema,S1 as CustomerMaterialsResponseSchema,o_ as CustomerMaterialsStatusSchema,r_ as DEFAULT_FONTS,hr as DEFAULT_SITE_DESIGN_RADIUS_ID,nl as DEFAULT_SITE_LOCALE,lk as DEFAULT_SUBSITE_PALETTE,kR as DEPLOYMENT_ACTIVE_STATUSES,$e as DEPLOYMENT_LIFECYCLE_TRANSITIONS,zd as DEPLOYMENT_PROGRESS_STEP_CODES,pf as DEPLOYMENT_REALTIME_CHANNEL,_t as DEPLOYMENT_STATUSES,PR as DEPLOYMENT_TERMINAL_STATUSES,ku as DEPLOYMENT_TRANSITION_ERROR_CODE,_v as DEPLOYMENT_WEBSOCKET_CONTRACT,Qx as DESIGNER_COMPONENT_LIBRARY_ERROR_CODES,bE as DESIGNER_PAGE_LIBRARY_ERROR_CODES,Oy as DOCUMENT_EXTENSION_WHITELIST,Ny as DOCUMENT_MIME_WHITELIST,sS as DOMAIN_DNS_PURPOSES,iS as DOMAIN_DNS_VERIFICATION_STATUSES,Jh as DOMAIN_OBSERVED_STATUSES,tS as DOMAIN_ROUTING_MODES,lE as DeleteDesignerPageErrorDetailsSchema,cE as DeleteDesignerPageRequestSchema,mE as DeleteDesignerPageResponseSchema,ap as DeleteDesignerPageResultSchema,GA as DeleteSiteSnapshotResponseSchema,Fe as DeploymentIdSchema,Jb as DeploymentJobIdSchema,Bd as DeploymentProgressStepCodeSchema,Vd as DeploymentProgressStepSchema,Wd as DeploymentProgressStepStatusSchema,Lo as DeploymentProgressStepsSchema,Qe as DeploymentRecordSchema,gv as DeploymentRedisPubSubEventSchema,Ui as DeploymentStatusSchema,Ac as DeploymentStatusSummarySchema,Ys as DeploymentTransitionError,Fc as DeploymentTypeSchema,Qn as DeploymentWsDeploymentPayloadSchema,uv as DeploymentWsServerMessageSchema,lf as DeploymentWsServerMessageTypeSchema,ob as DesignPlanGenerationOutcomeSchema,rb as DesignPlanGenerationReasonSchema,is as DesignPlanIdSchema,xv as DesignPlanPatchSchema,sb as DesignPlanRecordSchema,Vc as DesignPlanSchema,Sv as DesignTokensSchema,Hl as DesignerComponentCatalogItemSchema,va as DesignerComponentCategoriesDataSchema,Aa as DesignerComponentCategoryNodeSchema,ot as DesignerComponentExactVersionSchema,Da as DesignerComponentInstallDataSchema,Ca as DesignerComponentsDataSchema,mp as DesignerPageCatalogItemSchema,Wa as DesignerPageCategoriesDataSchema,Ba as DesignerPageCategoryNodeSchema,np as DesignerPageDeleteBlockReasonSchema,tp as DesignerPageDisabledReasonSchema,Ut as DesignerPageExactVersionSchema,qa as DesignerPageGroupSchema,Ha as DesignerPageInstallDataSchema,Fa as DesignerPageNodeSchema,Ya as DesignerPageResourcePreparationDataSchema,cp as DesignerPageResourceSourceSchema,hp as DesignerPageResourceTemplateSchema,rt as DesignerPageResourceTypeSchema,Va as DesignerPagesDataSchema,Is as DesignerResourceVersionSchema,Xa as DesignerSitePagesDataSchema,xE as DesignerSiteRouteIdSchema,rc as DomainConfigurationSchema,oc as DomainDnsPurposeSchema,lS as DomainDnsRecordSchema,cS as DomainDnsVerificationObservationSchema,mS as DomainDnsVerificationResultSchema,aS as DomainDnsVerificationStatusSchema,eS as DomainObservedStatusSchema,rS as DomainOperationErrorSchema,Ii as DomainOperationSchema,oS as DomainOperationStatusSchema,Ei as DomainOperationTypeSchema,ac as DomainRecordSchema,nS as DomainRoutingModeSchema,tk as EDIT_ENGINE_VERSION_HEADER,nk as EDIT_ENGINE_VERSION_SOURCE_HEADER,XT as ERROR_COPY,Tm as EXTERNAL_SITE_EDIT_INFRASTRUCTURE_REASONS,Rm as EXTERNAL_SITE_EDIT_PROMPT_MAX_LENGTH,ti as EditEngineVersionParseError,Za as EnhanceDesignerPageResourceBodySchema,AA as EnhanceDesignerPageResourceResponseSchema,Ay as ExternalSiteEditCallbackAckSchema,wy as ExternalSiteEditCallbackPayloadSchema,km as ExternalSiteEditCallbackStatusSchema,Dt as ExternalSiteEditDegradedReasonSchema,sa as ExternalSiteEditOutcomeSchema,na as ExternalSiteEditTaskIdSchema,ia as ExternalSiteEditTaskSchema,Pm as ExternalSiteEditTaskStatusSchema,yA as ExternalSyncSiteRequestSchema,vA as ExternalSyncSiteResponseSchema,Am as ExtractedFactKindSchema,un as ExtractedFactSchema,k_ as FIELD_TYPES,ur as FONT_PAIRINGS,ai as FONT_PAIRING_IDS,oh as FORM_DESIGN_ERROR_CODES,ah as FORM_DESIGN_FAILURE_STAGES,sh as FORM_DESIGN_OPERATION_STAGES,ih as FORM_DESIGN_OPERATION_STATUSES,zn as FORM_FIELD_TYPES,Y_ as FORM_SPEC_FIELD_TYPE_TO_CMS,wr as FORM_SPEC_FILE_MIN_RUNTIME_VERSION,q_ as FORM_SPEC_LOCALIZABLE_FIELD_PATHS,Pr as FORM_SPEC_MULTISTEP_MIN_RUNTIME_VERSION,b0 as FORM_TEMPLATE_CATEGORY_COUNTS,f0 as FORM_TEMPLATE_CATEGORY_SLUGS,bC as FailStaleInFlightWorkspaceRunsResponseSchema,kr as FieldDeclSchema,TP as FirecrawlBatchCreateRequestSchema,kP as FirecrawlBatchCreatedResponseSchema,Bh as FirecrawlBatchErrorSchema,wP as FirecrawlBatchErrorsResponseSchema,zh as FirecrawlBatchPageSchema,PP as FirecrawlBatchStatusResponseSchema,yP as FirecrawlCrawlCreateRequestSchema,xP as FirecrawlCrawlCreatedResponseSchema,EP as FirecrawlCrawlStatusResponseSchema,ec as FirecrawlJobStatusSchema,fP as FirecrawlMapRequestSchema,bP as FirecrawlMapResponseSchema,AP as FirecrawlQueueStatusResponseSchema,IP as FirecrawlScrapeRequestSchema,RP as FirecrawlScrapeResponseSchema,If as FooterShellSurfaceSchema,v_ as FormBlockIdSchema,Wn as FormDefinitionIdSchema,eh as FormDesignAffectedFilesSchema,bi as FormDesignErrorCodeSchema,v0 as FormDesignErrorSchema,Mr as FormDesignFailureStageSchema,te as FormDesignHashSchema,I0 as FormDesignOpenResponseSchema,th as FormDesignOperationFingerprintInputSchema,ui as FormDesignOperationIdSchema,Ur as FormDesignOperationNextActionSchema,ty as FormDesignOperationRecordIdSchema,w0 as FormDesignOperationRecordSchema,yi as FormDesignOperationResponseSchema,qr as FormDesignOperationSchema,fi as FormDesignOperationStageSchema,Lr as FormDesignOperationStatusSchema,A0 as FormDesignOperationTransitionRequestSchema,Fr as FormDesignPreviewRefreshStatusSchema,T0 as FormDesignQueryResponseSchema,k0 as FormDesignResumeRequestSchema,P0 as FormDesignResumeResponseSchema,nh as FormDesignSaveRequestSchema,R0 as FormDesignSaveResponseSchema,Nr as FormDesignSharedImpactSchema,Si as FormDesignStandardizationSchema,w_ as FormFieldDeclSchema,an as FormFieldNameSchema,gi as FormOptionValueSchema,C_ as FormSpecBindingSchema,j_ as FormSpecFieldNodeSchema,N_ as FormSpecNodeSchema,D_ as FormSpecOptionSchema,O_ as FormSpecStepBreakNodeSchema,hi as FormSpecV1Schema,y0 as FormTemplateCatalogResponseSchema,jr as FormTemplateCategorySlugSchema,V_ as FormTemplateCategoryV1Schema,Ze as FormTemplateTextSchema,H_ as FormTemplateV1Schema,kS as GSC_AUTH_STATUSES,PS as GSC_BINDING_STATUSES,wS as GSC_PROPERTY_TYPES,pv as GetDeploymentResponseSchema,mf as GetDeploymentsStatusResponseSchema,Py as GetExternalSiteEditResponseSchema,cw as GetSiteDomainConfigurationResponseSchema,Ri as GetSitePublishDomainOperationDataSchema,IS as GetSitePublishDomainOperationResponseSchema,Gk as GetTemplateUpgradeReportQuerySchema,Kk as GetTemplateUpgradeReportResponseSchema,Pw as GoogleSearchConsoleAuthStartDataSchema,kw as GoogleSearchConsoleAuthStartRequestSchema,ww as GoogleSearchConsoleAuthStartResponseSchema,Ew as GoogleSearchConsoleAuthStatusSchema,Iw as GoogleSearchConsoleBindingStatusSchema,Rw as GoogleSearchConsolePropertyTypeSchema,Tw as GoogleSearchConsoleStateSchema,vw as GoogleSearchConsoleStatusDataSchema,Aw as GoogleSearchConsoleStatusInputSchema,Cw as GoogleSearchConsoleStatusResponseSchema,bw as GscAuthStartDataSchema,fw as GscAuthStartRequestSchema,yw as GscAuthStartResponseSchema,Ti as GscAuthStatusSchema,ki as GscBindingStatusSchema,Pi as GscPropertyTypeSchema,vS as GscStateInputSchema,xw as GscStateSchema,pc as GscStatusDataSchema,CS as GscStatusResponseSchema,Oa as HOME_PAGE_URL_PATH,bf as HeaderShellBehaviorSchema,yf as HeaderShellShapeSchema,ff as HeaderShellSurfaceSchema,Sf as HeaderShellVariantSchema,Ih as HomeUrlCrawlerTaskCreateRequestSchema,Ms as HttpUrlSchema,qy as IMAGE_EXTENSION_WHITELIST,Gy as IMAGE_MIME_WHITELIST,wa as INSERT_NEW_COMPONENT_CATEGORY_GROUP_KEY,za as INSERT_NEW_PAGE_CATEGORY_GROUP_KEY,sl as ISO_639_3_TO_SITE_LOCALE,Om as ImageRoleSchema,lm as InboundUserMessageSchema,e0 as IndustryClassificationRequestSchema,t0 as IndustryClassificationResultSchema,T_ as IndustryConfidenceSchema,wm as InputBundleStatusSchema,_n as InputConflictSchema,Wy as InputContextBundleSchema,nt as InputContextSourceIdSchema,Cm as InputSourceSchema,rs as InputSourceStatusSchema,os as InputSourceTypeSchema,Ak as InspectTemplateUpgradeStateRequestSchema,vk as InspectTemplateUpgradeStateResponseSchema,nE as InstallDesignerComponentBodySchema,IA as InstallDesignerComponentResponseSchema,EE as InstallDesignerPageBodySchema,kA as InstallDesignerPageResponseSchema,mv as InternalCreateDeploymentResponseSchema,sv as InternalEnsureSubsitePublishRequestSchema,iv as InternalEnsureSubsitePublishResponseSchema,G as InternalEntityIdSchema,dv as InternalGetDeploymentsStatusResponseSchema,av as InternalGetSubsitePublishStatusRequestSchema,ov as InternalGetSubsitePublishStatusResponseSchema,tv as InternalPrepareSubsitePreviewRequestSchema,nv as InternalPrepareSubsitePreviewResponseSchema,s_ as KNOWLEDGE_CATEGORY_CODES,ar as KnowledgeCategoryCodeSchema,p1 as KnowledgeContextReadinessSchema,a_ as KnowledgeSourceReadinessSchema,or as KnowledgeSourceReadinessStatusSchema,m1 as KnowledgeTaskStatusBatchSchema,i_ as KnowledgeTaskStatusSchema,Zm as LEGACY_SITE_LOCALE_CODES,aC as LatestAgentRunQuerySchema,oC as LatestAgentRunResponseSchema,iC as LatestWorkspaceRunResponseSchema,LP as LauncherPromptTemplateApplyRequestSchema,MP as LauncherPromptTemplateApplyResponseSchema,$h as LauncherPromptTemplateCatalogItemSchema,OP as LauncherPromptTemplateCatalogQuerySchema,NP as LauncherPromptTemplateCatalogSchema,Vh as LauncherPromptTemplateKindSchema,Hh as LauncherPromptTemplateLocaleSchema,Zn as LauncherPromptTemplateTypeSchema,Zv as ListAgentEventsQuerySchema,Xv as ListAgentEventsResponseSchema,xA as ListDesignerComponentCategoriesResponseSchema,tE as ListDesignerComponentsQuerySchema,EA as ListDesignerComponentsResponseSchema,RA as ListDesignerPageCategoriesResponseSchema,yE as ListDesignerPagesQuerySchema,TA as ListDesignerPagesResponseSchema,wA as ListDesignerSitePagesResponseSchema,GS as ListMediaLibraryAssetsQuerySchema,KS as ListMediaLibraryAssetsResponseSchema,QA as ListSiteVersionsResponseSchema,zk as ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema,Bk as ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema,My as MAX_DOCUMENT_SOURCES_PER_SITE,Ly as MAX_DOCUMENT_UPLOAD_BYTES,zy as MAX_IMAGE_SOURCES_PER_SITE,Ky as MAX_IMAGE_UPLOAD_BYTES,bc as MEDIA_LIBRARY_AUDIO_EXTENSIONS,Rc as MEDIA_LIBRARY_AUDIO_MIME_TYPES,yc as MEDIA_LIBRARY_DOCUMENT_EXTENSIONS,FS as MEDIA_LIBRARY_EXTENSIONS,xc as MEDIA_LIBRARY_FILE_EXTENSIONS,Sc as MEDIA_LIBRARY_IMAGE_EXTENSIONS,US as MEDIA_LIBRARY_IMAGE_MAX_BYTES,Ec as MEDIA_LIBRARY_IMAGE_MIME_TYPES,hc as MEDIA_LIBRARY_MAX_BYTES,qS as MEDIA_LIBRARY_MIME_TYPES,fc as MEDIA_LIBRARY_VIDEO_EXTENSIONS,Ic as MEDIA_LIBRARY_VIDEO_MIME_TYPES,qR as MIGRATION_PRODUCTS_CMS_DETAIL_PAGE_TITLE,FR as MIGRATION_PRODUCTS_DETAIL_PREFIX,zR as MIGRATION_PRODUCTS_DETAIL_VIEW_VARIANT,KR as MIGRATION_PRODUCTS_LIST_VIEW_VARIANT,vu as MIGRATION_PRODUCTS_ROUTE,Ke as MIGRATION_PRODUCTS_SLUG,GR as MIGRATION_PRODUCTS_VIEW_BLOCK_TYPE,P_ as MODEL_DECLARABLE_FORM_FIELD_TYPES,S_ as MOTION_PRESETS,ri as MOTION_PRESET_IDS,Xy as ManagedPageTemplateRouteManifestV1Schema,yv as MediaAssetSchema,_f as MediaAttributionSchema,vi as MediaLibraryAssetSchema,Tc as MediaLibraryFileTypeSchema,kc as MediaLibrarySourceSchema,jb as MediaRequestOwnerSchema,iy as MediaResolutionCacheIdSchema,eE as MockDesignerComponentInsertDataSchema,Jx as MockDesignerComponentInsertRequestSchema,Oi as MotionLevelSchema,gh as NAV_ITEMS_LOCALIZABLE_FIELD_PATHS,_h as NAV_ITEMS_MACHINE_FIELD_PATHS,p_ as NEXT_FONT_DISPLAY_NAMES,Zt as NEXT_FONT_REGISTRY,il as NON_LATIN_SITE_LOCALE_CODES,q0 as NavItemSchema,lh as PAGE_SEO_LOCALIZABLE_FIELD_PATHS,ph as PAGE_SEO_MACHINE_FIELD_PATHS,Ft as PAGE_SLUG_PATTERN,St as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,V0 as PLATFORM_MATERIALIZED_EXEMPTIONS,bh as PLATFORM_MATERIALIZED_FILES,yh as PLATFORM_MATERIALIZED_FILE_PATTERNS,W0 as PLATFORM_MATERIALIZERS,Qa as PLATFORM_OWNED_PAGE_SLUGS,Sp as PLATFORM_OWNED_ROUTE_FILE_PATHS,ip as PageDirectoryReconcileFailedPageSchema,Ga as PageDirectoryReconcileResultSchema,dE as PageDirectoryReconcileStateSchema,sp as PageDirectoryReconcileStatusSchema,Ph as PageDiscoveryCoverageEntrySchema,rP as PageDiscoveryCoverageReasonSchema,Xr as PageDiscoveryCoverageSchema,$c as PageNavigationSchema,vs as PageResourceArtifactSchema,up as PageResourceComponentReferenceSchema,gp as PageResourceComponentSchema,pp as PageResourceDraftPageSchema,dp as PageResourceDraftSchema,Rn as PageResourceFinalRouteSchema,_p as PageResourcePageSchema,lp as PageResourcePageSelectionSchema,$a as PageResourceRouteMappingSchema,Gi as PageSchema,U0 as PageSeoDeclSchema,Hc as PageSlugSchema,op as PageTargetKindSchema,Ts as PageTargetProjectionHashSchema,Ka as PageTargetSchema,pE as PageTargetSetSchema,Jy as PageTemplateCleanupRequestSchema,nx as PageTemplateCleanupResponseSchema,Zy as PageTemplateCreateRequestSchema,ex as PageTemplateCreateResponseSchema,sx as PageTemplateErrorCodeSchema,Ie as PageTemplateIdSchema,hn as PageTemplatePagePathSchema,Qy as PageTemplatePromoteRequestSchema,tx as PageTemplatePromoteResponseSchema,Gv as PersistClarifyAnswersRequestSchema,Kv as PersistClarifyAnswersResponseSchema,Mv as PersistGeneratedSitemapDraftRequestSchema,qv as PersistGeneratedSitemapDraftResponseSchema,SC as PersistPreviewSessionRequestSchema,fC as PersistPreviewSessionResponseSchema,Bv as PersistSiteDesignPlanRequestSchema,Wv as PersistSiteDesignPlanResponseSchema,Fv as PersistSiteSitemapDraftResponseSchema,Nv as PersistSiteSitemapRequestSchema,Uv as PersistSiteSitemapResponseSchema,LA as PersistSiteSnapshotRequestSchema,MA as PersistSiteSnapshotResponseSchema,ZS as PositioningPrefillSchema,Ci as PositioningSourceSchema,IE as PrepareDesignerPageBodySchema,PA as PrepareDesignerPageResponseSchema,t1 as PrepareSiteBuildInitialGenerationBaseRequestSchema,n1 as PrepareSiteBuildInitialGenerationBaseResultSchema,wk as PrepareTemplateUpgradeStateRequestSchema,qg as PrepareTemplateUpgradeStateResponseSchema,ev as PrepareVersionPreviewRequestSchema,rf as PrepareVersionPreviewResponseSchema,No as ProductSearchAppConfigDraftSchema,Ks as ProductSearchAppSlugSchema,QI as ProductSearchContractFixtureSchema,Ld as ProductSearchDraftConfigSchema,Re as ProductSearchFieldNameSchema,Od as ProductSearchFilterMetaSchema,zs as ProductSearchInteractionRequestSchema,An as ProductSearchInteractionResponseSchema,ZI as ProductSearchPopularTermsReadSchema,Oo as ProductSearchPopularTermsSchema,qd as ProductSearchRequestSchema,Kd as ProductSearchResponseSchema,Wt as ProductSearchRouteIdSchema,jd as ProductSearchValueShapeSchema,FA as PromoteSiteSnapshotRequestSchema,af as PromoteSiteSnapshotResponseSchema,XA as PromoteTemplateUpgradeSnapshotRequestSchema,ZA as PromoteTemplateUpgradeSnapshotResponseSchema,gS as PublishDecisionSchema,ZT as REFUSAL_COPY,eC as REST_API_ENDPOINTS,dh as ROOT_LAYOUT_METADATA_LOCALIZABLE_FIELD_PATHS,uh as ROOT_LAYOUT_METADATA_MACHINE_FIELD_PATHS,RS as ReconcileSitePublishDomainOperationDataSchema,TS as ReconcileSitePublishDomainOperationResponseSchema,zA as RecordSnapshotVersionRequestSchema,BA as RecordSnapshotVersionResponseSchema,Fk as RecordTemplateUpgradeEventRequestSchema,qk as RecordTemplateUpgradeEventResponseSchema,Ck as RecordTemplateUpgradeFailureRequestSchema,Dk as RecordTemplateUpgradeFailureResponseSchema,jk as RecordTemplateUpgradeSuccessRequestSchema,Ok as RecordTemplateUpgradeSuccessResponseSchema,vm as ReferencePagePatternSchema,gn as ReferenceSignalsSchema,UI as RegisterWorkflowTaskCommandRequestSchema,kd as RegisterWorkflowTaskRequestSchema,HA as ReleaseTemplateUpgradeLockRequestSchema,$A as ReleaseTemplateUpgradeLockResponseSchema,GI as ReplaceCrawlWorkflowTaskCommandRequestSchema,wd as ReplaceCrawlWorkflowTaskRequestSchema,qI as ReplaceWorkflowTaskCommandRequestSchema,Pd as ReplaceWorkflowTaskRequestSchema,i0 as ResolvedFieldSchema,m0 as ResolvedFormFieldSchema,Jv as RestApiMethodSchema,JA as RestoreSiteSnapshotResponseSchema,F0 as RootLayoutMetadataSchema,Gc as RouteGenerationCardSchema,bu as RuleEngineInputSchema,Iu as RuleEngineScoreRecordSchema,$s as RuleScoreDimensionKeySchema,Eu as RuleScoreDimensionSchema,jt as SELECTABLE_SITE_LOCALE_CODES,Xc as SITEMAP_RESOLVER_MAX_BLOCK_TARGETS,Yc as SITEMAP_RESOLVER_MAX_PAGE_TARGETS,Jk as SITE_BUILD_CONTEXT_FILE_PATH,e1 as SITE_BUILD_CONTEXT_MAX_BYTES,gd as SITE_BUILD_STATUSES,Po as SITE_BUILD_STATUS_CODES,_d as SITE_DEPLOYMENT_STATUSES,wo as SITE_DEPLOYMENT_STATUS_CODES,oi as SITE_DESIGN_DENSITY_IDS,_r as SITE_DESIGN_RADIUS_IDS,rT as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,ql as SITE_EDIT_MATERIALIZATION_MAX_FILE_CONTENT_BYTES,xs as SITE_EDIT_MATERIALIZATION_MAX_FILE_COUNT,Es as SITE_EDIT_MATERIALIZATION_MAX_TOTAL_CONTENT_BYTES,lo as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,QE as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,pg as SITE_EDIT_RUNTIME_CONTAINER_TAGS,dg as SITE_EDIT_RUNTIME_TEXT_TAGS,lg as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,zE as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,Mm as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,oa as SITE_EDIT_SOURCE_ALLOWED_DIRS,Lm as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,ls as SITE_EDIT_SOURCE_DELETE_CAPABILITY,Um as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,gt as SITE_EXTRA_REQUIREMENT_MAX_LENGTH,Qm as SITE_LOCALE_CODES,M0 as SITE_LOCALIZATION_STRUCTURES,lA as SITE_PLANNING_FROZEN_ERROR_CODE,pA as SITE_PLANNING_LOCKED_ERROR_CODE,dA as SITE_STRUCTURE_CONFIRMATION_REQUIRED_ERROR_CODE,uA as SITE_STRUCTURE_CONFIRMATION_STALE_ERROR_CODE,hd as SITE_WORKFLOW_STATUSES,Ao as SITE_WORKFLOW_STATUS_CODES,tC as SSE_STREAMS,bn as STEP5_PRIMARY_INTENT_PAGE_LIMIT,ha as STEP5_SEMRUSH_MIN_RELEVANCE_SCORE,Ox as STEP5_SEO_KEYWORD_DEFAULT,Il as STEP5_SEO_KEYWORD_MAX,El as STEP5_SEO_KEYWORD_MIN,xl as STEP5_SEO_PAYLOAD_SCHEMA_VERSION,Nl as STEP5_SSE_EVENT_NAMES,fe as STEP5_STRATEGY_COUNT,it as STEP5_STRATEGY_KEYS,fa as STEP5_STRATEGY_OPTION_IDS,br as STEP6_AI_THEME_IDS,ci as STEP6_AI_THEME_PRESETS,yr as STEP6_GENERATED_THEME_ID_PATTERN,Ig as SUBSITE_GLOSSARY_ENTRY_MAX_CHARS,Rg as SUBSITE_GLOSSARY_MAX_ENTRIES,Og as SUBSITE_MOUNT_PATH_PATTERN,Ag as SUBSITE_PALETTE_NOTE_MAX_CHARS,Ng as SUBSITE_RESERVED_MOUNT_SEGMENTS,xx as SUPPORTED_SITE_LOCALES,pn as SandboxSessionIdSchema,Wb as SandboxSessionSchema,bm as SandboxSessionStatusSchema,bA as SaveBriefDraftRequestSchema,jA as SaveBriefDraftResponseSchema,_y as SaveSiteExtraRequirementRequestSchema,BS as SearchUnsplashMediaQuerySchema,WS as SearchUnsplashMediaResponseSchema,e_ as SiteBuildContextFileSchema,Jg as SiteBuildContextPayloadSchema,Qg as SiteBuildContextProvenanceSchema,Zg as SiteBuildContextProvenanceSourceSchema,Us as SiteBuildStatusSchema,Fs as SiteDeploymentStatusSchema,qc as SiteDesignContextSchema,JS as SiteDesignDensitySchema,ef as SiteDesignMotionLevelSchema,Nn as SiteEditBoundaryKindSchema,Nu as SiteEditCapabilityConstraintSchema,ju as SiteEditCapabilityModeSchema,On as SiteEditCapabilityModeViewSchema,XR as SiteEditCapabilityReadRequestSchema,Ep as SiteEditClassNameSourceDiagnosticSchema,ct as SiteEditClassNameSourceRangeSchema,io as SiteEditClassNameSourceSchema,OE as SiteEditClassNameSourceStyleContextSchema,so as SiteEditClassNameSourceStylesheetSchema,Ds as SiteEditClassNameSourceWriteIntentSchema,AE as SiteEditCommandDiagnosticSchema,yp as SiteEditCommandErrorSchema,L as SiteEditCompositionContextSchema,ne as SiteEditCompositionSelectorSchema,Ou as SiteEditConstraintKindSchema,nd as SiteEditDeletePageSourceOutputSchema,tg as SiteEditDynamicConfidenceSchema,sg as SiteEditDynamicDataBindingSchema,$o as SiteEditDynamicDataDetailSchema,Yo as SiteEditDynamicDataSummarySchema,ng as SiteEditDynamicEvidenceSchema,Ho as SiteEditDynamicSourceKindSchema,Ju as SiteEditDynamicSourceTypeSchema,eg as SiteEditDynamicTargetKindSchema,og as SiteEditEffectiveWriteTargetSchema,js as SiteEditElementPropertySchema,sT as SiteEditEventSchema,Zs as SiteEditExternalSourceKindSchema,UE as SiteEditGetClassNameSourceCommandResultSchema,LE as SiteEditGetClassNameSourceInputSchema,ME as SiteEditGetClassNameSourceResultSchema,DT as SiteEditGetDocumentInputSchema,jT as SiteEditGetObjectEditContextInputSchema,gx as SiteEditGetSourceFileInputSchema,ux as SiteEditGetSourceTreeInputSchema,NE as SiteEditGetStyleContextInputSchema,Mn as SiteEditHistoryProvenanceSchema,qu as SiteEditHistoryReadOnlyRecoveryStatusSchema,Lu as SiteEditHistoryRecoveryCodeSchema,Mu as SiteEditHistoryRecoveryDiagnosticSchema,mT as SiteEditHistoryResultSchema,cT as SiteEditHistoryStatusModeSchema,Ku as SiteEditHistoryStatusSchema,Uu as SiteEditHistoryUnavailableReasonSchema,Gu as SiteEditHistoryUnavailableStatusSchema,Fu as SiteEditHistoryWritableStatusSchema,$T as SiteEditInitializeSessionInputSchema,Jp as SiteEditInsertNodeSpecSchema,td as SiteEditInsertPageResourceOutputSchema,Vl as SiteEditMaterializationDataRequirementsSchema,Wl as SiteEditMaterializationEntrySchema,Bl as SiteEditMaterializationExportSchema,zl as SiteEditMaterializationFileSchema,Pa as SiteEditMaterializationPathTemplateSchema,at as SiteEditMaterializationSchema,_o as SiteEditMoveTargetSchema,qt as SiteEditMutationContextSchema,Ln as SiteEditNodeCapabilitySnapshotSchema,NT as SiteEditObjectCapabilitiesSchema,MT as SiteEditObjectDetailSchema,FT as SiteEditObjectEditContextSchema,qT as SiteEditObjectStyleDetailSchema,UT as SiteEditObjectSummarySchema,uI as SiteEditOperationCommandResultSchema,bo as SiteEditOperationErrorCodeSchema,yo as SiteEditOperationErrorSchema,sd as SiteEditOperationOutputSchema,ed as SiteEditOperationParamsSchema,Ls as SiteEditOperationPayloadSchema,Ns as SiteEditOperationRequestSchema,Qp as SiteEditOperationResultTargetSchema,xo as SiteEditOperationSelectionRefSchema,Qu as SiteEditOperationSummarySchema,Zp as SiteEditOperationTargetSchema,zt as SiteEditOperationTypeSchema,go as SiteEditOperationValueSchema,JE as SiteEditPageCompositionAnyVersionSchema,Np as SiteEditPageCompositionAtomicKindSchema,Fp as SiteEditPageCompositionBoundaryModeSchema,Pp as SiteEditPageCompositionBusinessMemberSchema,Tp as SiteEditPageCompositionContainerSchema,Kt as SiteEditPageCompositionDiagnosticSchema,kn as SiteEditPageCompositionErrorCodeSchema,ro as SiteEditPageCompositionPlacementTargetSchema,wp as SiteEditPageCompositionPlacementUnitSchema,jp as SiteEditPageCompositionRuntimeRefSchema,Dp as SiteEditPageCompositionSchema,Op as SiteEditPageCompositionSourceMemberKindSchema,kp as SiteEditPageCompositionSourceMemberSchema,po as SiteEditPageCompositionSourceRangeSchema,vp as SiteEditPageCompositionSupportedSchema,Cp as SiteEditPageCompositionUnsupportedSchema,Up as SiteEditPageCompositionV2BusinessMemberSchema,Lp as SiteEditPageCompositionV2ContainerSchema,Gp as SiteEditPageCompositionV2PlacementRelationSchema,zp as SiteEditPageCompositionV2PlacementSchema,qp as SiteEditPageCompositionV2PlacementUnitSchema,Hp as SiteEditPageCompositionV2Schema,Mp as SiteEditPageCompositionV2SourceMemberSchema,Wp as SiteEditPageCompositionV2SupportedSchema,Vp as SiteEditPageCompositionV2UnsupportedSchema,Kp as SiteEditPageCompositionV2WriteModeSchema,Bp as SiteEditPageCompositionVisualAnchorSchema,Ap as SiteEditPagePlacementOptionSchema,oo as SiteEditPagePlacementSchema,mo as SiteEditPageUnitResultTargetSchema,co as SiteEditPageUnitTargetSchema,Wu as SiteEditPatchPlanPatchSchema,gT as SiteEditPatchPlanSchema,Yt as SiteEditProvenanceChainSchema,rg as SiteEditProvenanceHopSchema,OT as SiteEditRenderDocumentSchema,$t as SiteEditRenderEntryRefSchema,ig as SiteEditRenderEntrySchema,Vo as SiteEditRenderPageCompositionSchema,Xu as SiteEditRenderPageCompositionSupportedSchema,Zu as SiteEditRenderPageCompositionUnsupportedSchema,Yu as SiteEditRenderPagePlacementSchema,BE as SiteEditRequiredMutationContextEnvelopeSchema,hx as SiteEditResolveSourceLocationInputSchema,Zo as SiteEditSemanticSourceSchema,dI as SiteEditSignedOperationRequestSchema,ra as SiteEditSourceDeleteCapabilitySchema,qm as SiteEditSourceDirectoryPathSchema,Wm as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,Vm as SiteEditSourceFileBinaryResponseSchema,px as SiteEditSourceFileKindSchema,Gm as SiteEditSourceFileListItemSchema,_x as SiteEditSourceFileResponseSchema,Bm as SiteEditSourceFileTextResponseSchema,Os as SiteEditSourceIdentitySchema,Hm as SiteEditSourceLocationRangeSchema,Sx as SiteEditSourceLocationSchema,mg as SiteEditSourceLocatorRangeSchema,Js as SiteEditSourceLocatorSchema,le as SiteEditSourcePathSchema,ca as SiteEditSourceTreeNodeSchema,dx as SiteEditSourceTreeResponseSchema,Km as SiteEditSourceTreeTruncationReasonSchema,zm as SiteEditSourceTreeTruncationSchema,fo as SiteEditStyleBreakpointSchema,LT as SiteEditStyleModelSchema,ho as SiteEditStylePropertySchema,Qo as SiteEditStyleSourceSchema,So as SiteEditStyleStateModeSchema,Qs as SiteEditTextSegmentSchema,Xo as SiteEditTextSourceSchema,ag as SiteEditWriteTargetSchema,hy as SiteExtraRequirementResponseSchema,xm as SiteExtraRequirementSchema,I as SiteIdSchema,pe as SiteLocaleSchema,bv as SiteMediaIntentSchema,ey as SiteOperationLockIdSchema,Hg as SitePreviewActivateErrorCodeSchema,Yg as SitePreviewActivateFailedSchema,$g as SitePreviewActivateReadySchema,Hk as SitePreviewActivateResponseSchema,lw as SitePublishDomainCheckDataSchema,mw as SitePublishDomainCheckRequestSchema,pw as SitePublishDomainCheckResponseSchema,dw as SitePublishDomainOperationDataSchema,uw as SitePublishDomainOperationResponseSchema,gw as SitePublishDomainReconcileOperationResponseSchema,Rt as SitePublishQualityTaskStatusSchema,JP as SitePublishWorkflowActiveResponseSchema,Qi as SitePublishWorkflowIdSchema,bS as SitePublishWorkflowMutationDataSchema,ew as SitePublishWorkflowMutationResponseSchema,yS as SitePublishWorkflowPublishDataSchema,tw as SitePublishWorkflowPublishResponseSchema,pt as SitePublishWorkflowRecordSchema,QP as SitePublishWorkflowRevisionRequestSchema,nw as SitePublishWorkflowSseDataSchema,dS as SitePublishWorkflowStatusSchema,uS as SitePublishWorkflowStepSchema,tt as SiteRecordSchema,ny as SiteTemplateUpgradeStateIdSchema,Xi as SiteVersionIdSchema,of as SiteVersionListItemSchema,ts as SiteVersionRecordSchema,Oe as SiteWorkflowIdSchema,Td as SiteWorkflowRecordSchema,DI as SiteWorkflowSnapshotResponseSchema,Gs as SiteWorkflowSnapshotSchema,Sd as SiteWorkflowStatusSchema,Ji as SiteWorkflowTaskRefIdSchema,jI as SiteWorkflowTaskRefResponseSchema,Do as SiteWorkflowTaskRefSchema,Av as SitemapAddBlockInputSchema,Ki as SitemapAnswerSchema,Pv as SitemapChangeBlockVariantInputSchema,Kf as SitemapDeleteBlockInputSchema,Cf as SitemapDraftBlockSchema,Df as SitemapDraftPageSchema,tb as SitemapDraftRecordSchema,rn as SitemapDraftSchema,Gf as SitemapEditActorSchema,Wf as SitemapEditErrorCodeSchema,Hf as SitemapEditFailureSchema,Bf as SitemapEditOperationSchema,Cv as SitemapEditResultSchema,Vf as SitemapEditSuccessSchema,jv as SitemapGenerationInputSchema,Qf as SitemapGenerationOutcomeSchema,Jf as SitemapGenerationReasonSchema,Jc as SitemapGenerationStageSchema,ke as SitemapIdSchema,$f as SitemapIntentPageSchema,Tv as SitemapModelOutputSchema,Of as SitemapModelPageSchema,kv as SitemapMoveBlockInputSchema,Af as SitemapNavigationHrefSchema,xe as SitemapNodeIdSchema,im as SitemapRecordSchema,Iv as SitemapResolverModelOutputSchema,Ev as SitemapResolverRequestSchema,Rv as SitemapResolverResponseSchema,qf as SitemapResolverTargetsSchema,Qc as SitemapRunInputSchema,Pt as SitemapSchema,Lf as SitemapSourceProvenanceSchema,Ov as SitemapStreamEventSchema,aP as SitemapTaskCreateRequestSchema,lP as SitemapTaskCreateResponseSchema,Nh as SitemapTaskFailureErrorCodeSchema,pP as SitemapTaskResponseSchema,zf as SitemapUpdateBlockInstructionInputSchema,wv as SitemapUpdateBlockPropsInputSchema,gf as SitemapUserChoiceSchema,kt as SkillSelectionSchema,hf as SkillSelectionSourceSchema,pm as SnapshotContentHashSchema,Se as SnapshotFilePathSchema,x as SnapshotIdSchema,We as SnapshotRecordSchema,Uc as SnapshotStatusSchema,Ai as StartGscAuthDataSchema,mc as StartGscAuthRequestSchema,lc as StartGscAuthResponseSchema,KI as StartSiteBuildRequestSchema,s1 as StartSiteBuildResponseSchema,t_ as StartSiteBuildResultSchema,YP as StartSitePublishWorkflowRequestSchema,nC as StartWorkspaceRunRequestSchema,sC as StartWorkspaceRunResponseSchema,Jd as Step2FinalResultDataSourceSchema,Cn as Step2FinalResultRequestSchema,oR as Step2FinalResultResponseSchema,aR as Step2FinalResultSaveResponseSchema,Qd as Step2FinalResultSaveResultSchema,Bs as Step2FinalResultTypeSchema,tu as Step2FinalResultViewSchema,Mo as Step2FinalScanCardKeySchema,Ws as Step2FinalScanCardSchema,Zd as Step2FinalScanResultSchema,Xt as Step2KnowledgeOpaqueIdSchema,l1 as Step2KnowledgeScopeSchema,He as Step2PageRoleSchema,mR as Step2PageSelectionRequestSchema,lR as Step2PageSelectionResponseSchema,$d as Step2SiteInitializationCrawlerErrorCodeSchema,Hd as Step2SiteInitializationStatusSchema,iR as Step2SiteInitializationTaskResponseSchema,Yd as Step2SiteInitializationTaskSchema,Vs as Step3AgentAnalysisSchema,cu as Step3AnalysisFindingSchema,SR as Step3AnalysisJobResponseSchema,Go as Step3AnalysisJobSchema,Fo as Step3AnalysisJobStatusSchema,fR as Step3AnalysisLatestResponseSchema,Uo as Step3AnalysisProgressSchema,pu as Step3AnalysisResultSchema,hR as Step3AnalysisScheduleResponseSchema,ru as Step3AnalysisScheduleSchema,bR as Step3AnalysisSseFrameSchema,gR as Step3AnalysisStartRequestSchema,qo as Step3AnalysisSummarySchema,ou as Step3AnalystSchema,_R as Step3AnalystsResponseSchema,IR as Step4DiagnosisResponseSchema,yn as Step5ActiveStrategyKeySchema,qx as Step5CommitStrategyRequestSchema,Gx as Step5CommitStrategyResponseSchema,jl as Step5CommittedVersionSchema,Ea as Step5DecisionCustomPayloadInputSchema,Al as Step5DecisionCustomPayloadSchema,cl as Step5EvidenceReferenceSchema,yl as Step5GenerationStatusSchema,Cl as Step5JobStatusSchema,wl as Step5LegacyDecisionCustomPayloadInputSchema,Pl as Step5LegacyDecisionCustomPayloadSchema,Rl as Step5LegacySeoKeywordInputSchema,xa as Step5LegacySeoKeywordSchema,Ss as Step5OutputLocaleSchema,Mx as Step5RegenerateItemRequestSchema,Ux as Step5SaveDecisionRequestSchema,Fx as Step5SaveDecisionResponseSchema,ul as Step5SemrushEmptyReasonCodeSchema,dl as Step5SemrushIntentGroupSchema,hl as Step5SemrushKeywordCandidateSchema,Sl as Step5SemrushKeywordCandidateSearchDataSchema,vx as Step5SemrushKeywordCandidateSearchRequestSchema,Cx as Step5SemrushKeywordCandidateSearchResponseSchema,pl as Step5SemrushKeywordRecommendationSchema,bl as Step5SemrushKeywordSelectionDataSchema,fl as Step5SemrushKeywordSelectionItemSchema,Dx as Step5SemrushKeywordSelectionRequestSchema,jx as Step5SemrushKeywordSelectionResponseSchema,ll as Step5SemrushRecommendationSeedSchema,_l as Step5SemrushRecommendationSnapshotSchema,ml as Step5SemrushRecommendationStatusSchema,ba as Step5SemrushSearchIntentSchema,gl as Step5SemrushSelectionSummarySchema,Tl as Step5SemrushSnapshotRefSchema,ya as Step5SeoGeoPlanRowSchema,En as Step5SeoKeywordSchema,kl as Step5SeoPayloadV2InputSchema,bs as Step5SeoPayloadV2Schema,Yf as Step5SitemapDecisionSchema,Zf as Step5SitemapRunInputSchema,Xf as Step5SitemapSourceSchema,Dv as Step5SitemapStartRequestSchema,Nx as Step5StartStrategyRequestSchema,Lx as Step5StartStrategyResponseSchema,vl as Step5StrategyDecisionInputSchema,ys as Step5StrategyDecisionSchema,fs as Step5StrategyItemSchema,Ia as Step5StrategyJobSchema,xn as Step5StrategyKeySchema,ht as Step5StrategyOptionIdSchema,gs as Step5StrategyOptionSchema,rl as Step5StrategyPlanSchema,Ol as Step5StrategySnapshotDataSchema,zx as Step5StrategySseFrameSchema,Dl as Step5StrategyVersionSnapshotSchema,E_ as Step6AiThemeCandidateSchema,Kn as Step6ColorSeedsSchema,V1 as Step6DesignRecommendationGenerationInputSchema,H1 as Step6DesignRecommendationModelOutputSchema,I_ as Step6DesignRecommendationSchema,K1 as Step6DesignRecommendationsRequestSchema,z1 as Step6DesignRecommendationsResponseSchema,Tr as Step6DesignSelectionSchema,Rr as Step6GeneratedThemeCardSchema,XP as StreamSitePublishWorkflowRequestSchema,rk as SubsiteGlossariesSchema,kg as SubsiteGlossaryEntrySchema,Un as SubsiteHexColorSchema,Rk as SubsiteMountPathSchema,mk as SubsitePaletteLocalizationSchema,Pg as SubsitePaletteModeSchema,wg as SubsitePaletteSeedsSchema,ck as SubsiteSiteInfoSchema,gk as SubsiteSyncDiffComputeRequestSchema,_k as SubsiteSyncDiffComputeResponseSchema,Dg as SubsiteSyncDiffErrorCodeSchema,hk as SubsiteSyncDiffErrorResponseSchema,yk as SubsiteVisibleTextExportRequestSchema,xk as SubsiteVisibleTextExportResponseSchema,ud as TASK_EXECUTION_STATUSES,vo as TASK_EXECUTION_STATUS_CODES,YA as TEMPLATE_UPGRADE_LOCK_LOST_ERROR_CODE,mi as THEME_PRESETS,fr as THEME_PRESET_IDS,ko as TaskExecutionStatusSchema,Bg as TemplateUpgradeCasOutcomeSchema,tr as TemplateUpgradeErrorCodeSchema,Wg as TemplateUpgradeOutcomeCountsSchema,Kg as TemplateUpgradeOutcomeSchema,Vg as TemplateUpgradeSnapshotDeletionCandidateSchema,yt as TemplateUpgradeStateSchema,Ug as TemplateUpgradeStatusSchema,zg as TemplateUpgradeValidationStageSchema,De as TemplateVersionSchema,WA as TryAcquireTemplateUpgradeLockRequestSchema,VA as TryAcquireTemplateUpgradeLockResponseSchema,wc as UnsplashDownloadLocationSchema,Pc as UnsplashMediaAssetSchema,fA as UpdateBriefRequestSchema,DA as UpdateBriefResponseSchema,zv as UpdateClarifyArchetypeRequestSchema,UA as UpdateCurrentSnapshotManifestRequestSchema,uE as UpdatePageDirectoryReconcileStateRequestSchema,ZP as UpdateSitePublishWorkflowStepRequestSchema,SA as UpdateSiteRequestSchema,NI as UpdateSiteWorkflowWebsiteRequestSchema,B1 as UpdateStep6DesignSelectionRequestSchema,W1 as UpdateStep6DesignSelectionResponseSchema,FI as UpdateWorkflowTaskStatusRequestSchema,zS as UploadMediaLibraryAssetResponseSchema,FP as UpstreamPromptTemplateCatalogDataSchema,UP as UpstreamPromptTemplateConsumeDataSchema,Rh as UrlListCrawlerTaskCreateRequestSchema,sy as UsageRecordIdSchema,VS as UseUnsplashMediaRequestSchema,HS as UseUnsplashMediaResponseSchema,ss as UserIdSchema,AS as VCP_GSC_STATES,wi as VcpGscStateSchema,SS as VcpQualityResultSchema,ji as VisualHintsSchema,uf as VisualThemeSchema,CI as WORKFLOW_DEFINITIONS_V1,qs as WORKFLOW_DEFINITION_REGISTRY,ld as WORKFLOW_FLOW_TYPES,fd as WORKFLOW_MENU_STATES,pd as WORKFLOW_NODE_CODES,dd as WORKFLOW_TASK_TYPES,mC as WORKSPACE_WEBSOCKET_CONTRACT,Ro as WorkflowClientCapabilitiesSchema,Co as WorkflowDefinitionVersionSchema,Pn as WorkflowFlowTypeSchema,Rd as WorkflowMenuItemSchema,bd as WorkflowMenuStateSchema,Bt as WorkflowNodeCodeSchema,To as WorkflowTaskTypeSchema,Pb as WorkspaceClientMessageSchema,YS as WorkspaceDesignApplyRequestSchema,XS as WorkspaceDesignApplyResponseSchema,Bi as WorkspaceDiagnosticSchema,Lb as WorkspaceDirectEditFileSchema,Nb as WorkspaceDirectEditPathSchema,_m as WorkspaceDirectEditPostActionSchema,dC as WorkspaceDirectEditRequestSchema,gC as WorkspaceDirectEditResponseSchema,Wi as WorkspaceExecutionDiagnosticsSchema,Vv as WorkspaceExecutionPlanSchema,Ob as WorkspaceMediaRequestSchema,$i as WorkspacePlanDependencySchema,rm as WorkspacePlanSummarySchema,lb as WorkspacePlanTaskKindSchema,Hi as WorkspacePlanTaskSchema,ad as WorkspaceResourceKindSchema,rd as WorkspaceResourceNavigationSelectionSchema,Io as WorkspaceResourceOperationClientMessageSchema,od as WorkspaceResourceOperationSummarySchema,cd as WorkspaceResourceOperationTransientInputSchema,ns as WorkspaceRunKindSchema,kb as WorkspaceSelectedComponentSchema,Ab as WorkspaceServerMessageSchema,vv as WorkspaceSitemapEditRequestSchema,Tb as WorkspaceSocketDescriptorSchema,Kb as WorkspaceSourceFileBinaryResponseSchema,qb as WorkspaceSourceFileKindSchema,Sm as WorkspaceSourceFileListItemSchema,_C as WorkspaceSourceFilePathQuerySchema,hC as WorkspaceSourceFileResponseSchema,Gb as WorkspaceSourceFileTextResponseSchema,hm as WorkspaceSourcePathSchema,ib as WorkspaceSuggestionSchema,am as WorkspaceSuggestionsSchema,ab as WorkspaceSuggestionsSourceSchema,cm as WorkspaceTaskCountsSchema,cC as WorkspaceWebSocketMessageSchema,rC as WorkspaceWebSocketMessageTypeSchema,Vi as WorkspaceWorkerGroupSchema,zi as WorkspaceWorkerPhaseSchema,Hv as WorkspaceWorkerResultSchema,dt as WorkspaceWorkerStatusSchema,CR as assertDeploymentTransition,HI as assertSiteBuildStatusTransition,VI as assertTaskExecutionStatusTransition,jw as buildE2bBrowserPreviewUrl,$1 as buildStep6FallbackThemeCards,xi as canonicalizeFormDesignJson,qP as canonicalizeLauncherPromptTemplateOperation,to as canonicalizePageSlug,Vx as compareTemplateVersions,hT as composeSiteEditRepeatInstanceKey,O0 as computeFormDesignOperationFingerprint,ms as computeSiteEditCompositionKey,Rp as computeSiteEditSourceIdentityKey,ln as containsSensitiveData,xp as createSiteEditCommandFailureSchema,no as createSiteEditCommandResultSchema,Cs as createSiteEditCommandSuccessSchema,X1 as defaultStep6Selection,DS as deriveVcpGscState,jS as doesGscPropertyMatchDomain,vd as findWorkflowDefinition,Ad as findWorkflowDefinitionInRegistry,ii as fontStack,mh as formDesignOperationFingerprintInput,DR as getDeploymentHappyPathTransitions,AR as getDeploymentTransitionPredecessors,wR as getDeploymentTransitionTargets,gr as getFontPairing,Sr as getMotionPreset,xr as getSiteDesignThemeRadius,ds as getSiteEditSourceDeleteProtectionReason,C1 as getThemePreset,Cd as getWorkflowDefinition,BI as getWorkflowNodeIndex,my as hasAnyBusinessFact,pk as hasLockedSeeds,j0 as hashAffectedFormDesignFiles,D0 as hashCmsFormSchemaProjection,Vn as hashFormDesignJson,C0 as hashFormSpec,Ja as isCanonicalPageSlug,Xg as isCmsMainProductsWithinLimit,oE as isCmsPageSelectable,Fy as isConsentGranted,Pu as isDeploymentActiveStatus,vR as isDeploymentTerminalStatus,xg as isExactEditEngineVersion,Ry as isExternalSiteEditInfrastructureReason,h0 as isFormSpecLocalizableFieldPath,Kx as isKnownStep5SseEventName,VR as isMigrationProductsPresetBlockLabel,WR as isMigrationProductsPresetPageTitle,Rx as isNonLatinSiteLocale,H0 as isPlatformMaterializedFile,Mg as isReservedSubsiteMountSegment,Kl as isSiteEditMaterializationPathTemplate,Sg as isSiteEditRuntimeContainerTag,fg as isSiteEditRuntimeTextTag,KT as isSiteEditRuntimeVoidElementTag,fx as isSiteEditSourceDeleteProtectedPath,$m as isSiteEditSourceDirectoryPath,ma as isSiteEditSourcePath,ps as isSiteEditTextSourcePath,K0 as isSiteStructureKnownFieldPath,G0 as isSiteStructureLocalizableFieldPath,WI as isWorkflowTaskTypeForNode,Hu as makeSiteEditRepeatInstanceKey,BR as migrationProductsCopyForLocale,J0 as normalizeCmsPublicApiBase,Dr as normalizeFormOptionLabelIdentity,mn as normalizeGscDomain,Ra as normalizeStep5SeoKeyword,bp as pageSlugToRouteFilePath,rE as parseCmsPageDirectory,LR as parseComponentI18nResourcesJson,OS as parseE2bPreviewProxyDomain,Eg as parseExactEditEngineVersion,rx as parseSiteEditCompositionKey,$u as parseSiteEditRepeatInstanceKey,HE as parseSiteEditSourceIdentityKey,E0 as projectFormSpecToCmsSchema,NS as reconcileSitemapNavigation,c_ as resolveFont,l_ as resolveFontDisplayName,x0 as resolveFormTemplateText,zI as resolvePublishedWorkflowDefinition,yy as resolveRedisConnectionConfig,sk as resolveRequestedEditEngineVersion,ga as resolveSelectableSiteLocale,zT as resolveSiteEditRuntimeOperationSummary,Ix as resolveSiteLocaleFromIso6393,Ex as resolveSiteTextDirection,R_ as resolveStep6RadiusId,ik as resolveSystemCurrentEditEngineVersion,Dd as selectPublishedWorkflowDefinition,Vy as selectReferenceVisualImage,II as siteBuildStatusFromCode,PI as siteBuildStatusToCode,RI as siteDeploymentStatusFromCode,wI as siteDeploymentStatusToCode,h_ as siteFontVariables,TI as siteWorkflowStatusFromCode,AI as siteWorkflowStatusToCode,Tg as splitSubsiteGlossaryEntry,ST as stripSiteEditRepeatInstanceKeys,kI as taskExecutionStatusFromCode,vI as taskExecutionStatusToCode,Y1 as toStep6GenerationVisualHints,eo as tryCanonicalizeAsciiPageSlug,Bo as validateComponentI18nResources,S0 as validateFormSpecIdentityTransition};
1
+ import{z as e}from"zod";import{z as Cm}from"zod";var G=Cm.uuidv7(),rs=G,yy=G,xy=G,Ey=G,Iy=G,Ry=G,Ty=G,I=G,St=G,Ji=G,ke=G,cs=G,x=G,ea=G,V=G,ta=G,pn=G,Ge=G,ky=G,Py=G,na=G,Le=G,sa=G,wy=G,Ay=G,vy=G,ot=G,Cy=G,Dy=G,jy=G;import{z as dn}from"zod";var ia=dn.object({primary_products:dn.string().trim().min(1).max(1e3).optional(),current_markets:dn.string().trim().min(1).max(1e3).optional(),qualifications:dn.string().trim().min(1).max(1e3).optional()}).strict();function Ly(t){return Object.values(t).some(n=>typeof n=="string"&&n.trim().length>0)}import{z as jt}from"zod";import{z as ms}from"zod";var L=t=>ms.object({code:ms.number().int(),data:t,message:ms.string()});var ft=2e3,Dm=jt.object({note:jt.string().trim().max(ft),updated_at:jt.string().min(1)}).strict(),zy=jt.object({note:jt.string().trim().max(ft)}).strict(),Ky=L(Dm.nullable());import{z as Ot}from"zod";var jm=40,rt=Ot.object({protocol:Ot.enum(["phone","form","download","route","external"]),ctaLabel:Ot.string().min(1).max(jm),ctaTarget:Ot.string().min(1).max(200).optional(),requiresOwnerDetail:Ot.boolean().optional()});var bt=["queued","preparing_source","building","artifact_ready","deploying","released","lock_failed","source_prepare_failed","build_failed","artifact_fetch_failed","artifact_validation_failed","deploy_failed","cleanup_failed"];function Hy(t){let n=t.VCP_REDIS_URL??t.REDIS_URL;if(n){let s=new URL(n);return{url:n,host:s.hostname,port:s.port?Number(s.port):6379,password:s.password?decodeURIComponent(s.password):void 0}}return{host:t.VCP_REDIS_HOST??"127.0.0.1",port:Om(t.VCP_REDIS_PORT,56379)}}function Om(t,n){if(!t)return n;let s=Number(t);return Number.isInteger(s)&&s>0?s:n}import{z as Y}from"zod";var oa=G,aa=200,Nm=4e3,ra=Y.enum(["succeeded","degraded","no_changes","failed"]),Nt=Y.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"]),Lm=["sandbox_unavailable"];function Qy(t){return t!=null&&Lm.includes(t)}var Mm=Y.enum(["pending","delivered","failed"]),Um=Y.enum(["running","succeeded","degraded","no_changes","failed"]),Zy=Y.object({site_id:I,external_run_id:Y.string().min(1).max(aa),external_thread_id:Y.string().min(1).max(aa),prompt:Y.string().min(1).max(Nm)}).strict(),ca=Y.object({id:oa,site_id:I,external_run_id:Y.string().min(1),external_thread_id:Y.string().min(1),status:Um,outcome:ra.nullable(),degraded_reason:Nt.nullable(),vcp_run_id:V.nullable(),base_snapshot_id:x,snapshot_id:x.nullable(),preview_url:Y.string().url().nullable(),summary:Y.string().nullable(),error_code:Y.string().nullable(),build_verified:Y.boolean().nullable(),callback_status:Mm,created_at:Y.string().min(1),started_at:Y.string().min(1).nullable(),finished_at:Y.string().min(1).nullable()}).strict(),Jy=Y.object({task:ca}).strict(),ex=Y.object({task:ca}).strict(),tx=Y.object({task_id:oa,external_run_id:Y.string().min(1),external_thread_id:Y.string().min(1),site_id:I,vcp_run_id:V.nullable(),outcome:ra,degraded_reason:Nt.nullable(),snapshot_id:x.nullable(),preview_url:Y.string().url().nullable(),summary:Y.string().nullable(),error_code:Y.string().nullable(),build_verified:Y.boolean().nullable(),retryable:Y.boolean(),finished_at:Y.string().min(1)}).strict(),nx=Y.object({received:Y.literal(!0)}).strict();import{z as D}from"zod";var ls=D.enum(["text","url","document","image"]),ps=D.enum(["pending","ready","failed"]),qm=D.enum(["pending","ready","failed"]),Fm=D.enum(["product","price","contact","copy","audience","other"]),un=D.object({fact:D.string().min(1).max(300),kind:Fm,source_id:ot,quote:D.string().min(1).max(500),trust:D.enum(["verbatim","ocr"]).default("verbatim")}),Gm=D.object({page_type:D.string().min(1).max(40),sections:D.array(D.string().min(1).max(40)).max(12)}),gn=D.object({source_id:ot,nav_structure:D.array(D.string().min(1).max(30)).max(12),page_patterns:D.array(Gm).max(10),tone:D.array(D.string().min(1).max(20)).max(8),screenshot_ref:D.string().optional()}),zm=D.object({source_id:ot,type:ls,status:ps,title:D.string().max(120).optional(),original_ref:D.string().min(1),source_metadata:D.record(D.string(),D.unknown()),error_code:D.string().optional(),submitted:D.boolean().optional()}),_n=D.object({topic:D.string().min(1).max(80),variants:D.array(D.object({value:D.string().min(1).max(300),source_id:ot})).min(2)}),Km=D.object({type:D.literal("text"),content:D.string().min(20).max(1e4),title:D.string().min(1).max(120).optional()}).strict(),Bm=D.object({type:D.literal("url"),url:D.string().url().max(2048),rights_ack:D.boolean().optional(),title:D.string().min(1).max(120).optional()}).strict(),ox=D.discriminatedUnion("type",[Km,Bm]),rx=[".docx",".html",".md",".txt"],cx=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],mx=10*1024*1024,lx=2,px=D.object({consent_cross_border:D.union([D.literal(!0),D.literal("true")]),consent_text_version:D.string().min(1).max(120),title:D.string().min(1).max(120).optional()}).strict();function dx(t){return t===!0||t==="true"}var ux=[".png",".jpg",".jpeg",".webp"],gx=["image/png","image/jpeg","image/webp","application/octet-stream"],_x=8*1024*1024,hx=10,Wm=D.enum(["asset","reference"]),Sx=D.object({image_role:Wm,title:D.string().min(1).max(120).optional()}).strict(),fx=D.object({version:D.literal(1),site_id:I,tenant_id:D.string().min(1),user_prompt:D.string(),status:qm,sources:D.array(zm).max(16),facts:D.array(un).max(120),reference:gn.optional(),conflicts:D.array(_n).max(20)}).superRefine((t,n)=>{let s=new Map(t.sources.map(a=>[a.source_id,a]));for(let[a,i]of t.facts.entries()){let r=s.get(i.source_id);(!r||r.type==="url")&&n.addIssue({code:"custom",path:["facts",a,"source_id"],message:"facts must reference a text/document/image source (never url)"})}if(t.reference){let a=s.get(t.reference.source_id),i=a?.type==="image"&&a.source_metadata.image_role==="reference";(!a||a.type!=="url"&&!i)&&n.addIssue({code:"custom",path:["reference","source_id"],message:"reference must point at a url source or reference image source"})}});function bx(t){for(let n of t.sources)if(n.type==="image"&&n.status==="ready"&&n.source_metadata?.image_role==="reference")return{source_id:n.source_id};return t.reference?.screenshot_ref?{source_id:t.reference.source_id}:null}import{z as v}from"zod";import{z as Sn}from"zod";import{z as X}from"zod";var Ie=X.string().min(1),hn=X.string().min(1).refine(t=>t.startsWith("/")&&!t.includes("?")&&!t.includes("#"),{message:"page_path must start with / and must not contain ? or #"}),Vm=X.object({template_id:Ie,safe_name:X.string().min(1),entry_file:X.string().min(1),kind:X.enum(["default","additional"])}).strict(),Ix=X.object({schema_version:X.literal(1),route_id:X.string().min(1),canonical_entry_file:X.string().min(1),route_key:X.string().min(1),default_template_id:Ie,templates:X.array(Vm).min(1)}).strict().superRefine((t,n)=>{let s=new Set,a,i=0;for(let[r,g]of t.templates.entries())s.has(g.template_id)&&n.addIssue({code:"custom",path:["templates",r,"template_id"],message:`Duplicate template_id: ${g.template_id}`}),s.add(g.template_id),g.kind==="default"&&(i+=1,a=g.template_id);i!==1?n.addIssue({code:"custom",path:["templates"],message:"templates must contain exactly one default item"}):a!==t.default_template_id&&n.addIssue({code:"custom",path:["default_template_id"],message:"default_template_id must match the default template"})}),Rx=X.object({page_path:hn,template_id:Ie,instruction:X.string().min(1)}).strict(),ma=t=>[...new Set(t)],Tx=X.object({page_path:hn,template_id:Ie,exit_template_ids:X.array(Ie).default([]).transform(ma)}).strict(),kx=X.object({page_path:hn,template_ids:X.array(Ie).min(1).transform(ma)}).strict(),ds={ok:X.literal(!0),site_id:I,page_path:hn,route_id:X.string().min(1),default_template_id:Ie,snapshot_id:x,route_mode:X.literal("delegated")},Px=X.object({...ds,template_id:Ie,status:X.literal("created")}).strict(),wx=X.object({...ds,promoted_template_id:Ie,deleted_template_ids:X.array(Ie),status:X.literal("promoted")}).strict(),Ax=X.object({...ds,deleted_template_ids:X.array(Ie),status:X.literal("cleaned")}).strict(),vx=X.enum(["PAGE_TEMPLATE_REQUEST_INVALID","PAGE_TEMPLATE_PAGE_NOT_FOUND","PAGE_TEMPLATE_NOT_FOUND","PAGE_TEMPLATE_ALREADY_EXISTS","PAGE_TEMPLATE_ID_COLLISION","PAGE_TEMPLATE_MANAGED_SOURCE_INVALID","PAGE_TEMPLATE_DEFAULT_PROTECTED","PAGE_TEMPLATE_DEFAULT_ALREADY_ACTIVE","PAGE_TEMPLATE_ASSET_IN_USE","PAGE_TEMPLATE_SNAPSHOT_CONFLICT","PAGE_TEMPLATE_DYNAMIC_ROUTE_UNSUPPORTED","PAGE_TEMPLATE_SOURCE_UNSUPPORTED","PAGE_TEMPLATE_GENERATION_FAILED","PAGE_TEMPLATE_PATCH_FAILED"]);var ne=Sn.object({routeId:Sn.string().min(1),templateId:Ie.optional()}).strict(),M=Sn.object({routeId:Sn.string().min(1),effectiveTemplateId:Ie.optional()}).strict();function us(t){return JSON.stringify([t.routeId,t.effectiveTemplateId??null])}function Ox(t){let n;try{n=JSON.parse(t)}catch{return null}if(!Array.isArray(n)||n.length!==2)return null;let[s,a]=n,i=M.safeParse(a===null?{routeId:s}:{routeId:s,effectiveTemplateId:a});return i.success?i.data:null}var Hm=["design.md","DESIGN.md"],la=["components/site","src/components/site","lib/generated","src/lib/generated","public"],$m=["app/globals.css","src/app/globals.css"],Ym=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],Xm=new Set(Ym),gs="source-delete",pa=v.literal(gs),pe=v.string().min(1).refine(ua,"Invalid site edit source path"),Qm=v.string().min(1).refine(al,"Invalid site edit source directory path"),Ux=v.enum(["text","binary"]),fn=v.object({composition:M,path:pe,language:v.string().min(1).nullable(),sizeBytes:v.number().int().nonnegative(),contentHash:v.string().min(1).optional()}).strict(),Zm=v.discriminatedUnion("kind",[fn.extend({kind:v.literal("text"),language:v.string().min(1),readonly:v.boolean().default(!1)}),fn.extend({kind:v.literal("binary"),language:v.null(),mimeType:v.string().min(1).optional(),readonly:v.literal(!0)})]),da=v.lazy(()=>v.discriminatedUnion("kind",[v.object({kind:v.literal("directory"),name:v.string().min(1),path:Qm,children:v.array(da)}),v.object({kind:v.literal("file"),name:v.string().min(1),path:pe,file:Zm}).superRefine((t,n)=>{t.path!==t.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),Jm=v.enum(["max-files","max-depth","max-total-bytes"]),el=v.object({reasons:v.array(Jm).min(1),maxFiles:v.number().int().positive(),maxDepth:v.number().int().positive(),maxTotalBytes:v.number().int().positive()}),qx=v.object({composition:M,nodes:v.array(da),defaultPath:pe.optional(),totalFiles:v.number().int().nonnegative(),truncated:el.optional()}).strict(),Fx=v.object({composition:ne}).strict(),Gx=v.object({path:pe,composition:ne}).strict(),tl=fn.extend({kind:v.literal("text"),language:v.string().min(1),readonly:v.boolean().default(!1),content:v.string()}),nl=v.enum(["too-large","unsupported-mime","bytes-unavailable"]),sl=fn.extend({kind:v.literal("binary"),language:v.null(),readonly:v.literal(!0),mimeType:v.string().min(1),contentBase64:v.string().min(1).optional(),previewUnavailableReason:nl.optional()}),zx=v.discriminatedUnion("kind",[tl,sl]),Kx=v.object({key:v.string().min(1),composition:ne}).strict(),il=v.object({startLine:v.number().int().positive(),startColumn:v.number().int().nonnegative(),endLine:v.number().int().positive(),endColumn:v.number().int().nonnegative()}),Bx=v.object({key:v.string().min(1),composition:M,sourceFile:pe,componentName:v.string().min(1),openingElementRange:il,structuralPath:v.string().min(1),textPreview:v.string().min(1).optional()}).strict();function ua(t){return!Sa(t)||ha(t)?!1:Ss(t)||_a(t)||ga(t)||la.some(n=>t===n||t.startsWith(`${n}/`))}function _s(t){return Ss(t)||Xm.has(ol(t))}function al(t){return!Sa(t)||ha(t)?!1:t==="app"||t.startsWith("app/")||t==="src"||t==="src/app"||t.startsWith("src/app/")||la.some(n=>t===n||t.startsWith(`${n}/`)||n.startsWith(`${t}/`))}function hs(t){return ua(t)?Ss(t)?"design-document":ga(t)?"route-entry":_a(t)?"app-global-style":t.toLowerCase()==="lib/generated/media-assets.ts"||t.toLowerCase()==="src/lib/generated/media-assets.ts"?"generated-media-manifest":null:null}function Wx(t){return hs(t)!==null}function ga(t){return/^(?:src\/)?app\/(?:.*\/)?page\.[cm]?[jt]sx?$/.test(t.toLowerCase())}function _a(t){return $m.some(n=>n.toLowerCase()===t.toLowerCase())}function ol(t){let n=t.split("/").at(-1)??t,s=n.lastIndexOf(".");return s>0?n.slice(s).toLowerCase():""}function Ss(t){return!t.includes("/")&&Hm.some(n=>n.toLowerCase()===t.toLowerCase())}function ha(t){let n=t.toLowerCase(),s=n.split("/"),i=(s.at(-1)??n).replace(/\.[^.]+$/,"");return/^(?:src\/)?app\/api(?:\/|$)/.test(n)||/^(?:src\/)?app\/(?:.*\/)?route\.[cm]?[jt]sx?$/.test(n)||/^(?:src\/)?app\/(?:.*\/)?(?:action|actions)\.[cm]?[jt]sx?$/.test(n)||/(^|\/)[^/]+\.server\.[cm]?[jt]sx?$/.test(n)||n==="lib/server"||n.startsWith("lib/server")||n==="src/lib/server"||n.startsWith("src/lib/server")||n==="lib/db"||n.startsWith("lib/db")||n==="src/lib/db"||n.startsWith("src/lib/db")||n==="lib/cms"||n.startsWith("lib/cms/")||n==="src/lib/cms"||n.startsWith("src/lib/cms/")?!0:i==="server"||i==="db"||i==="database"||i==="auth"||i==="secret"||i==="secrets"||i==="token"||i==="tokens"||i==="credential"||i==="credentials"||s.includes("server")||s.includes("secrets")}function Sa(t){return!t||t.startsWith("/")||t.includes("\\")?!1:t.split("/").every(n=>!(n.length===0||n==="."||n===".."||n.startsWith(".")||n==="package.json"||n==="node_modules"||n==="recipes"||n.startsWith(".env")))}import{z as rl}from"zod";var Lt=["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"],cl=["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"],ml=[...Lt,...cl],ll=new Set(["ar","fa","he"]),$x=[{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"}],pl={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"},dl=new Set(Lt);function fa(t){return dl.has(t)?t:pl[t]}var ul="en";function Yx(t){let n=t.toLowerCase().split("-",1)[0]??"";return ll.has(n)?"rtl":"ltr"}var gl={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 Xx(t){return gl[t]??ul}var _l=["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"],hl=new Set(_l);function Qx(t){return hl.has(t)}var de=rl.enum(ml);import{z as Sl}from"zod";var ba=Sl.string().uuid();import{z as o}from"zod";var re=o.string().trim().min(1).max(128),Ye=o.string().trim().min(1).max(200),je=o.string().trim().min(1).max(2e3),bs=o.string().trim().max(200),Mt=o.string().regex(/^[a-f0-9]{64}$/),ys=o.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),ct=["market","persona","product","brand","competition","structure","language","seogeo","content","conversion","risk"],fe=ct.length,En=o.enum(ct),In=En,Ia=["recommended","conservative","focused"],yt=o.enum(Ia),Rn=o.enum(["single_country","regional_combination","multi_market"]),Tn=o.object({code:o.string().trim().regex(/^[A-Z]{2}$/),name_zh:Ye,name_en:Ye,region:Ye}).strict(),fs=o.object({id:yt,label:Ye,note:je,impact:o.string().trim().max(500).nullish(),set_value:o.string().trim().max(500).nullish(),site_locale:de.nullish(),market_type:Rn.nullish(),markets:o.array(Tn).max(32).optional()}).loose(),fl=o.object({lead:o.string().trim().min(1).max(500),title:Ye,columns:o.array(o.string().trim().min(1).max(80)).min(1).max(8),rows:o.array(o.array(o.string().trim().max(500)).min(1).max(8)).max(100)}).strict().superRefine((t,n)=>{t.rows.forEach((s,a)=>{s.length!==t.columns.length&&n.addIssue({code:"custom",path:["rows",a],message:"Each Step5 plan row must match the column count."})})}),bl=o.object({goal:je,issue:je,criteria:o.array(je).min(1).max(12),resources:o.array(je).min(1).max(12),risks:o.array(je).min(1).max(12),execution:o.object({standard:o.array(je).min(1).max(12),acceptance:o.array(je).min(1).max(12),downstream:o.array(je).min(1).max(12)}).strict()}).strict(),yl=o.object({source_type:o.enum(["step2","step3"]),source_id:re,field_path:o.string().trim().max(300).nullish()}).strict(),xl=o.enum(["ready","disabled","empty","timeout","rate_limited","quota_exhausted","failed"]),El=["INFORMATIONAL","NAVIGATIONAL","COMMERCIAL","TRANSACTIONAL"],Ra=o.enum(El),bn=50,yn=60,ya=7,sE=["COMMERCIAL","TRANSACTIONAL"],Il=["C","T"];function Ta(t){return Il.includes(t)}var Rl=o.object({id:re,term:o.string().trim().min(1).max(255),source_type:o.enum(["step2","step3","step5"]),source_id:re,field_path:o.string().trim().min(1).max(300),source_field:o.string().trim().min(1).max(300).optional(),source_evidence:o.string().trim().min(1).max(2e3).optional(),business_subject:o.string().trim().min(1).max(255).optional(),reason:o.string().trim().min(1).max(1e3).optional()}).strict(),Tl=o.object({keyword:o.string().trim().min(1).max(255),normalized_keyword:o.string().trim().min(1).max(255),intents:o.array(Ra).min(1).max(4),search_volume:o.number().int().min(bn),keyword_difficulty:o.number().min(0).max(yn),cpc:o.number().nonnegative().nullish(),trend:o.array(o.number().int().min(0).max(100)).length(12),serp_features:o.array(o.string().trim().min(1).max(80)).max(64),fit:o.object({seo:o.number().int().min(0).max(100),geo:o.number().int().min(0).max(100),buyer:o.number().int().min(0).max(100)}).strict(),recommended_channel:o.enum(["SEO","GEO","DUAL"]),priority:o.enum(["P0","P1","P2","P3"]),already_in_plan:o.boolean(),page_level:o.union([o.literal(1),o.literal(2)]).default(1)}).strict(),kl=o.object({id:re,intent:Ra,title:Ye,landing_page_type:o.enum(["blog","product","category","landing"]),keywords:o.array(Tl).min(1).max(100)}).strict(),Pl=o.enum(["NO_SEEDS","NO_PROVIDER_CANDIDATES","NO_METRIC_ELIGIBLE_CANDIDATES","NO_COMMERCIAL_INTENT_CANDIDATES","NO_FIT_ELIGIBLE_CANDIDATES"]),wl=o.object({fetched_count:o.number().int().nonnegative(),unique_count:o.number().int().nonnegative(),metric_gate_pass_count:o.number().int().nonnegative(),commercial_intent_pass_count:o.number().int().nonnegative(),fit_pass_count:o.number().int().nonnegative(),selected_count:o.number().int().nonnegative()}).strict().superRefine((t,n)=>{let s=[t.fetched_count,t.unique_count,t.metric_gate_pass_count,t.commercial_intent_pass_count,t.fit_pass_count,t.selected_count];s.some((a,i)=>i>0&&a>s[i-1])&&n.addIssue({code:"custom",message:"Semrush selection counts must be monotonically non-increasing."})}),xa={provider:o.literal("semrush"),api_version:o.literal("v4"),fetched_at:o.string().datetime({offset:!0}),context_hash:Mt,status:xl,seeds:o.array(Rl).max(20),intent_groups:o.array(kl).max(16),selection_summary:wl.optional(),empty_reason_code:Pl.nullish(),error_code:o.string().trim().regex(/^[A-Z0-9_]+$/).max(64).nullish()},Al=o.discriminatedUnion("schema_version",[o.object({schema_version:o.literal(1),...xa,database:o.string().trim().regex(/^[A-Z]{2}$/),country:o.string().trim().regex(/^[A-Z]{2}$/)}).strict(),o.object({schema_version:o.literal(2),...xa,database:o.string().trim().regex(/^[a-z]{2}$/),country:o.string().trim().regex(/^[A-Z]{2}$/)}).strict()]).superRefine((t,n)=>{if(t.schema_version===1&&t.database!==t.country&&n.addIssue({code:"custom",path:["database"],message:"Semrush database must match the ISO country code."}),t.status==="ready"&&t.intent_groups.length===0&&n.addIssue({code:"custom",path:["intent_groups"],message:"Ready Semrush recommendations require an intent group."}),t.status==="ready"&&t.error_code&&n.addIssue({code:"custom",path:["error_code"],message:"Ready Semrush recommendations cannot contain an error code."}),t.empty_reason_code&&t.status!=="empty"&&n.addIssue({code:"custom",path:["empty_reason_code"],message:"Semrush empty reason is only valid for an empty snapshot."}),t.selection_summary){let s=t.intent_groups.reduce((a,i)=>a+i.keywords.length,0);t.selection_summary.selected_count!==s&&n.addIssue({code:"custom",path:["selection_summary","selected_count"],message:"Semrush selected count must match the persisted keywords."})}}),ka=0,vl=o.union([o.literal(ka),o.literal(1)]),iE=o.object({seed_keyword:o.string().trim().min(1).max(255),database:o.string().trim().toLowerCase().regex(/^[a-z]{2}$/).default("us"),limit:o.number().int().min(1).max(100).default(20),offset:o.number().int().nonnegative().default(0),min_search_volume:o.number().int().nonnegative().default(bn),max_keyword_difficulty:o.number().finite().min(0).max(100).default(yn),min_relevance_score:vl.default(ka)}).strict(),Cl=o.object({keyword:o.string().trim().min(1).max(255),search_volume:o.number().int().nonnegative().nullable(),keyword_difficulty:o.number().nonnegative().nullable(),cpc:o.number().nonnegative().nullable(),competition:o.number().nonnegative().nullable(),result_count:o.number().int().nonnegative().nullable(),intent:o.string().trim().max(64).nullable(),trend:o.array(o.string()).nullable(),serp_features:o.array(o.string()).nullable(),fit:o.number().finite().min(0).max(10),currency:o.string().trim().regex(/^[A-Z]{3}$/).nullable()}).strict(),Dl=o.object({request_id:o.string().trim().min(1).max(128),snapshot_id:o.string().uuid(),seed_keyword:o.string().trim().min(1).max(255),database:o.string().trim().min(1).max(16),limit:o.number().int().min(1).max(100),offset:o.number().int().nonnegative(),freshness:o.enum(["live","cached","historical"]),collected_at:o.string().datetime({offset:!0}),items:o.array(Cl).max(100),result_count:o.number().int().nonnegative()}).strict(),aE=o.object({code:o.literal(0),message:o.string(),data:Dl}).strict(),oE=o.object({snapshot_id:o.string().uuid(),selected_keywords:o.array(o.string().trim().min(2).max(160)).min(1).max(50)}).strict(),jl=o.object({candidate_id:re,keyword:o.string().trim().min(2).max(160),classification_status:o.string().trim().min(1).max(64),selection_status:o.string().trim().min(1).max(64),selected_at:o.string().datetime({offset:!0})}).strict(),Ol=o.object({selection_batch_id:re,snapshot_id:o.string().uuid(),selected_count:o.number().int().nonnegative(),created_count:o.number().int().nonnegative(),updated_count:o.number().int().nonnegative(),deselected_count:o.number().int().nonnegative(),items:o.array(jl).max(50)}).strict().superRefine((t,n)=>{t.selected_count!==t.items.length&&n.addIssue({code:"custom",path:["selected_count"],message:"selected_count must equal items.length."})}),rE=o.object({code:o.literal(0),message:o.string(),data:Ol}).strict(),Nl=o.enum(["ok","degraded"]),Ll=["category","selection","application","parameter","cost","trust","compliance","delivery"],Pa=o.object({id:re,question:o.string().trim().min(8).max(300).refine(t=>/^[\x20-\x7E]+$/.test(t)),question_type:o.enum(Ll),intent_strength:o.enum(["high","medium","low"]),source:o.enum(["ai_generation","user_input"])}).strict(),Ml=Pa.extend({source:o.literal("ai_generation")}).strict(),xs=o.object({key:In,position:o.number().int().min(1).max(fe),category:Ye,title:Ye,summary:je,rationale:je,parameter:o.string().trim().max(500).nullish(),options:o.tuple([fs,fs,fs]),plan:fl.nullish(),structure_detail:bl.nullish(),note_tips:o.array(o.string().trim().min(1).max(200)).max(6),note_placeholder:o.string().trim().min(1).max(300),evidence_refs:o.array(yl).min(1).max(8),semrush_recommendations:Al.nullish(),seo_payload:o.lazy(()=>Es).nullish(),geo_questions:o.array(Ml).max(20).optional(),generation_status:Nl.optional()}).loose().superRefine((t,n)=>{let s=ct.indexOf(t.key)+1;t.position!==s&&n.addIssue({code:"custom",path:["position"],message:`Step5 strategy ${t.key} uses an invalid position.`}),t.options.forEach((a,i)=>{a.id!==Ia[i]&&n.addIssue({code:"custom",path:["options",i,"id"],message:"Step5 strategy options must use the canonical order."})}),t.semrush_recommendations&&t.key!=="seogeo"&&n.addIssue({code:"custom",path:["semrush_recommendations"],message:"Semrush recommendations are only valid for the seogeo item."}),t.seo_payload&&t.key!=="seogeo"&&n.addIssue({code:"custom",path:["seo_payload"],message:"SEO payloads are only valid for the seogeo item."}),(t.geo_questions?.length??0)>0&&t.key!=="seogeo"&&n.addIssue({code:"custom",path:["geo_questions"],message:"GEO questions are only valid for the seogeo item."}),t.structure_detail&&t.key!=="structure"&&n.addIssue({code:"custom",path:["structure_detail"],message:"Structure detail is only valid for the structure item."}),t.geo_questions&&new Set(t.geo_questions.map(a=>a.question.trim().toLocaleLowerCase())).size!==t.geo_questions.length&&n.addIssue({code:"custom",path:["geo_questions"],message:"GEO citation questions must be unique."})}),xn=9,wa=o.object({id:re,type:o.union([o.literal(1),o.literal(2)]).default(1),cells:o.tuple([o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500),o.string().trim().max(500)])}).strict(),Ul=2,ql=0,cE=20,Fl=50,Aa=o.object({id:re,keyword:o.string().trim().min(1).max(500),intent_code:o.string().trim().min(1).max(16),intent_type:o.string().trim().min(1).max(200),strength:o.enum(["high","medium"]),search_volume:o.number().int().nonnegative().nullable(),cpc:o.number().finite().nonnegative().nullable()}).strict(),Gl=Aa.superRefine((t,n)=>{Ta(t.intent_code)||n.addIssue({code:"custom",path:["intent_code"],message:"New legacy SEO keyword selections must use commercial or transactional intent."})}),kn=o.object({id:re,keyword:o.string().trim().min(2).max(160),normalized_keyword:o.string().trim().min(2).max(160),intc:o.enum(["I","N","C","T"]),keyword_type:o.string().trim().min(1).max(80),intent_strength:o.enum(["high","medium","low"]),monthly_volume:o.number().int().nonnegative().nullable(),keyword_difficulty:o.number().finite().min(0).max(100).nullable(),fit:o.number().finite().min(0).max(10).nullable(),sem_cpc:o.number().finite().nonnegative().nullable(),currency:o.string().trim().regex(/^[A-Z]{3}$/).nullable(),landing_page:o.string().trim().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*)?$/),content_format:o.string().trim().min(1).max(80),priority:o.enum(["P0","P1","P2","P3"]),source:o.enum(["step5_generation","semrush"]),source_market:o.string().trim().toLowerCase().regex(/^[a-z]{2,8}$/),metric_timestamp:o.string().datetime({offset:!0}).nullable()}).strict().superRefine((t,n)=>{let s=Da(t.keyword);t.normalized_keyword!==s&&n.addIssue({code:"custom",path:["normalized_keyword"],message:"normalized_keyword must match the canonical keyword form."})}),zl=o.object({request_id:o.string().trim().min(1).max(128),snapshot_id:re,selected_keywords:o.array(o.string().trim().min(2).max(160)).min(1).max(50)}).strict(),Es=o.object({schema_version:o.literal(Ul),seo_keywords:o.array(kn).min(ql).max(Fl),semrush_snapshot_refs:o.array(zl).max(20).optional(),geo_questions:o.array(Pa).max(20).optional()}).strict().superRefine(ep),Kl=Es.superRefine((t,n)=>{t.seo_keywords.forEach((s,a)=>{Ta(s.intc)||n.addIssue({code:"custom",path:["seo_keywords",a,"intc"],message:"New SEO keyword selections must use commercial or transactional intent."})})}),Bl=o.object({rows:o.array(wa).max(100).optional(),seo_keywords:o.array(Aa).max(100).optional()}).strict(),Wl=o.object({rows:o.array(wa).max(100).optional(),seo_keywords:o.array(Gl).max(100).optional()}).strict(),Vl=o.union([Es,Bl]),va=o.union([Kl,Wl]),Hl=o.object({item_key:En,selected_option_id:yt,note:bs,custom_payload:va.optional()}).strict().superRefine((t,n)=>{t.item_key==="seogeo"&&t.custom_payload&&!("schema_version"in t.custom_payload)&&Jl(t.custom_payload,n)}),Is=o.object({item_key:En,selected_option_id:yt,note:bs,custom_payload:Vl.optional(),market_type:Rn.nullish(),markets:o.array(Tn).max(32).optional(),selected_value:o.unknown().nullable(),accepted_at:o.string().datetime({offset:!0})}).loose(),$l=o.enum(["running","succeeded","failed"]),Yl=o.object({schema_version:o.literal(1),source_job_id:re,site_id:re,output_locale:ys.optional(),items:o.array(xs).length(fe),decisions:o.array(Is).length(fe)}).loose(),Xl=o.object({strategy_version_id:re,site_id:re,source_job_id:re,output_locale:ys.optional(),version:o.number().int().positive(),checksum:Mt,snapshot:Yl,committed_at:o.string().datetime({offset:!0})}).loose(),Ca=o.object({job_id:re,site_id:re,output_locale:ys.optional(),status:$l,revision:o.number().int().nonnegative(),items:o.array(xs).max(fe),decisions:o.array(Is).max(fe),output_checksum:Mt.nullish(),error_code:o.string().trim().max(64).nullish(),error_message:o.string().trim().max(500).nullish(),committed_version:Xl.nullish()}).loose().superRefine((t,n)=>{let s=t.items.map(i=>i.key);new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["items"],message:"Step5 job items must have unique keys."});let a=t.decisions.map(i=>i.item_key);new Set(a).size!==a.length&&n.addIssue({code:"custom",path:["decisions"],message:"Step5 job decisions must have unique item keys."})}),mE=o.object({force_refresh:o.boolean().optional().default(!1)}).strict(),lE=Ca.extend({cached:o.boolean()}).strict(),pE=o.object({expected_revision:o.number().int().nonnegative()}).strict(),dE=o.object({expected_revision:o.number().int().nonnegative(),selected_option_id:yt,note:bs,custom_payload:va.optional()}).strict(),uE=o.object({revision:o.number().int().positive(),decision:Is}).strict(),gE=o.object({idempotency_key:o.string().trim().min(8).max(128),expected_revision:o.number().int().nonnegative(),decisions:o.array(Hl).length(fe)}).strict().superRefine((t,n)=>{let s=t.decisions.map(a=>a.item_key);new Set(s).size!==ct.length&&n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit must contain ${fe} unique decisions.`}),ct.forEach(a=>{s.includes(a)||n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit is missing ${a}.`})})}),_E=o.object({strategy_version_id:re,version:o.number().int().positive(),checksum:Mt,next_path:o.string().trim().min(1).max(500)}).strict(),Ql=Ca.extend({completed:o.number().int().min(0).max(fe),total:o.literal(fe)}).loose(),Zl=["snapshot","strategy_item_start","strategy_item_done","strategy_items_invalidated","strategy_generation_done","failed"];function hE(t){return typeof t=="string"&&Zl.includes(t)}var SE=o.discriminatedUnion("event",[o.object({id:o.number().int().nonnegative(),event:o.literal("snapshot"),data:Ql}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_item_start"),data:o.object({key:En,position:o.number().int().min(1).max(fe)}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_item_done"),data:o.object({item:xs}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_items_invalidated"),data:o.object({after_position:o.number().int().min(0).max(fe)}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_generation_done"),data:o.object({item_count:o.literal(fe),schema_version:o.literal(1),checksum:Mt}).strict()}).strict(),o.object({id:o.number().int().positive(),event:o.literal("failed"),data:o.object({code:o.string().trim().min(1).max(64),message:o.string().trim().min(1).max(500),retryable:o.boolean(),item_key:In.optional()}).loose()}).loose()]);function Ea(t){let n=t.trim().toLocaleLowerCase();return n===""||n==="/"?"/":`/${n.replace(/^\/+|\/+$/g,"")}`}function Jl(t,n){let s=(t.rows??[]).filter(i=>i.type===1);t.rows&&s.length===0&&n.addIssue({code:"custom",path:["custom_payload","rows"],message:"SEO plans must keep at least one primary page."});let a=s.some(i=>Ea(i.cells[3])==="/");s.length+(a?0:1)>xn&&n.addIssue({code:"custom",path:["custom_payload","rows"],message:`Initial generation supports at most ${xn} primary pages including home.`}),s.forEach((i,r)=>{/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/.test(Ea(i.cells[3]))||n.addIssue({code:"custom",path:["custom_payload","rows",r,"cells",3],message:"Primary intent pages must use root or one-segment kebab-case paths."})})}function Da(t){return t.normalize("NFKC").trim().replace(/\s+/g," ").toLowerCase()}function ep(t,n){let s=new Set;t.seo_keywords.forEach((r,g)=>{s.has(r.normalized_keyword)&&n.addIssue({code:"custom",path:["seo_keywords",g,"normalized_keyword"],message:"SEO keywords must be unique after Unicode normalization."}),s.add(r.normalized_keyword),(r.monthly_volume===null||r.monthly_volume<bn)&&n.addIssue({code:"custom",path:["seo_keywords",g,"monthly_volume"],message:`Selected SEO keywords require monthly_volume >= ${bn}.`}),(r.keyword_difficulty===null||r.keyword_difficulty>yn)&&n.addIssue({code:"custom",path:["seo_keywords",g,"keyword_difficulty"],message:`Selected SEO keywords require keyword_difficulty <= ${yn}.`}),(r.fit===null||r.fit<ya)&&n.addIssue({code:"custom",path:["seo_keywords",g,"fit"],message:`Selected SEO keywords require fit >= ${ya.toFixed(1)}.`})});let a=new Set((t.semrush_snapshot_refs??[]).flatMap(r=>r.selected_keywords.map(Da)));t.seo_keywords.forEach((r,g)=>{r.source==="semrush"&&!a.has(r.normalized_keyword)&&n.addIssue({code:"custom",path:["seo_keywords",g,"source"],message:"Semrush keywords must reference a persisted Semrush snapshot selection."})});let i=(t.geo_questions??[]).map(r=>r.question.trim().toLocaleLowerCase());new Set(i).size!==i.length&&n.addIssue({code:"custom",path:["geo_questions"],message:"GEO citation questions must be unique."})}import{z as tp}from"zod";var Oe=tp.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 yE(t,n){let s=Oe.safeParse(t),a=Oe.safeParse(n);if(!s.success||!a.success)return null;let i=ja(s.data),r=ja(a.data);for(let c=0;c<3;c+=1){let _=Oa(i.release[c],r.release[c]);if(_!==0)return _}if(!i.prerelease&&!r.prerelease)return 0;if(!i.prerelease)return 1;if(!r.prerelease)return-1;let g=Math.max(i.prerelease.length,r.prerelease.length);for(let c=0;c<g;c+=1){let _=i.prerelease[c],j=r.prerelease[c];if(_===void 0)return-1;if(j===void 0)return 1;if(_===j)continue;let E=/^\d+$/u.test(_),O=/^\d+$/u.test(j);return E&&O?Oa(BigInt(_),BigInt(j)):E?-1:O?1:np(_,j)}return 0}function ja(t){let n=t.indexOf("+"),s=n===-1?t:t.slice(0,n),a=s.indexOf("-"),i=a===-1?s:s.slice(0,a),r=a===-1?void 0:s.slice(a+1),[g,c,_]=i.split(".");return{release:[BigInt(g),BigInt(c),BigInt(_)],...r?{prerelease:r.split(".")}:{}}}function Oa(t,n){return t<n?-1:t>n?1:0}function np(t,n){return t<n?-1:t>n?1:0}import{z}from"zod";import{z as be}from"zod";var Rs=64,sp=512*1024,Ts=4*1024*1024,ip=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function ap(t){return ip.test(t)}var Na=be.string().min(1).refine(ap,{message:"Materialization pathTemplate must be a safe relative path."}),op=be.object({pathTemplate:Na,content:be.string(),role:be.string().min(1).optional()}).strict(),rp=be.union([be.object({kind:be.literal("default")}).strict(),be.object({kind:be.literal("named"),name:be.string().min(1)}).strict()]),cp=be.object({pathTemplate:Na,export:rp}).strict(),mp=be.array(be.never()).optional(),mt=be.object({instanceBaseName:be.string().min(1),files:be.array(op).min(1).max(Rs),entry:cp,dataRequirements:mp}).strict().superRefine((t,n)=>{let s=new Set,a=t.entry.pathTemplate,i=0;for(let[r,g]of t.files.entries()){s.has(g.pathTemplate)&&n.addIssue({code:"custom",path:["files",r,"pathTemplate"],message:`Duplicate materialization pathTemplate: ${g.pathTemplate}`}),s.add(g.pathTemplate);let c=new TextEncoder().encode(g.content).length;c>sp&&n.addIssue({code:"custom",path:["files",r,"content"],message:"Materialization file content exceeds the per-file byte limit."}),i+=c}s.has(a)||n.addIssue({code:"custom",path:["entry","pathTemplate"],message:"Materialization entry pathTemplate must match a file."}),i>Ts&&n.addIssue({code:"custom",path:["files"],message:"Materialization exceeds the total content byte limit."})});var La="insertNewComponent",kE={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"},ks=z.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),Ma=z.lazy(()=>z.object({id:z.string().uuid(),key:z.string().min(1),name:z.string(),children:z.array(Ma)}).strict()),Ua=z.object({category_group_key:z.literal(La),categories:z.array(Ma)}).strict(),lp=z.object({resource_id:z.string().min(1),name:z.string(),description:z.string().nullable(),thumbnail_url:z.string().nullable(),resolved_version:ks,category_id:z.string().uuid().nullable()}).strict(),qa=z.object({category_group_key:z.literal(La),items:z.array(lp),next_cursor:z.string().min(1).nullable()}).strict(),PE=z.object({resource_id:z.string().min(1),resolved_version:ks,anchor_block_id:z.string().min(1),placement:z.enum(["before","after"])}).strict(),wE=z.object({status:z.literal("mock_acknowledged")}).strict(),AE=z.object({category_id:z.string().uuid().optional(),include_descendants:z.enum(["true","false"]).optional().transform(t=>t==="true"),limit:z.coerce.number().int().min(1).max(100).optional().default(20),cursor:z.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),lt=ks,vE=z.object({version:lt}).strict(),Fa=z.object({resource_id:z.string().min(1),resolved_version:lt,revision_id:z.string().uuid().optional(),digest_sha256:z.string().regex(/^[a-f0-9]{64}$/),materialization:mt}).strict();import{z as b}from"zod";import{z as h}from"zod";var Ba="/",Wa=255,pp=5e3,dp=64;function up(t){if(!t.startsWith("/")||t.includes("//")||/[?#\\\s\u0000-\u001f\u007f]/u.test(t))return!1;try{let n=decodeURIComponent(t);return n.includes("//")||/[?#\\\s\u0000-\u001f\u007f]/u.test(n)||n.split("/").length!==t.split("/").length||/%25/iu.test(t)?!1:n.split("/").every(s=>![".",".."].includes(s))}catch{return!1}}var ze=h.string().min(1).max(Wa).refine(up,"url_path must be a safe site-relative path"),As=h.string().max(Wa),Pn=h.preprocess(t=>t===0?!1:t===1?!0:t,h.boolean()),Ut=h.union([h.url(),ze]),vs=h.enum(["landing_page","general_page","detail_page"]),Cs=h.enum([...vs.options,"list_page","category_page","tag_page","author_page","search_page","date_page"]);function OE(t){return t.vcp_managed&&t.url!==null&&vs.safeParse(t.page_type).success&&ze.safeParse(t.url_path).success}function Ga(t){return t.includes("{")||t.includes("}")}function NE(t){if(!Ga(t.url_path))return za(t.url_path);if(t.url===null)return null;let n=/^[a-z][a-z0-9+.-]*:\/\//iu.test(t.url)?gp(t.url):t.url;return n===null||Ga(n)?null:za(n)}function za(t){let n=ze.safeParse(t);return n.success?n.data:null}function gp(t){try{return new URL(t).pathname}catch{return null}}var Va=h.lazy(()=>h.object({cms_page_id:h.number().int().positive(),title:h.string().trim().min(1).max(255),url_path:As,url:Ut.nullable(),page_type:Cs,vcp_managed:Pn,children:h.array(Va)}).strict()),_p=h.object({group_id:h.string().min(1),title:h.string().trim().min(1).max(255),collection_slug:h.string(),pages:h.array(Va)}).strict(),Ka=h.object({groups:h.array(_p)}).strict(),Ha=h.lazy(()=>h.object({id:h.number().int().positive(),title:h.string().trim().min(1).max(120),url_path:As,parent_id:h.number().int().nonnegative(),group_type:h.string().min(1),page_type:Cs,plugin_id:h.number().int().nonnegative(),is_default:Pn,is_published:Pn,url:Ut.nullable(),vcp_managed:Pn,children:h.array(Ha)})),hp=h.object({plugin_id:h.number().int().nonnegative(),slug:h.string(),group_name:h.string().trim().min(1).max(255),pages:h.array(Ha)}).passthrough(),Sp=h.array(hp);function $a(t){return{cms_page_id:t.id,title:t.title,url_path:t.url_path,url:t.url,page_type:t.page_type,vcp_managed:t.vcp_managed,children:t.children.map(n=>$a(n))}}function LE(t){if(!fp(t))return null;let n=Ka.safeParse(t);if(n.success)return n.data;let s=Sp.safeParse(t);if(!s.success)return null;let a=Ka.safeParse({groups:s.data.map(i=>({group_id:String(i.plugin_id),title:i.group_name,collection_slug:i.slug,pages:i.pages.map($a)}))});return a.success?a.data:null}function fp(t){let n=Array.isArray(t)?t:Ps(t)&&Array.isArray(t.groups)?t.groups:[],s=[];for(let i of n)if(!(!Ps(i)||!Array.isArray(i.pages)))for(let r of i.pages)s.push({node:r,depth:1});let a=0;for(;s.length>0;){let i=s.pop();if(a+=1,a>pp||i.depth>dp)return!1;if(!(!Ps(i.node)||!Array.isArray(i.node.children)))for(let r of i.node.children)s.push({node:r,depth:i.depth+1})}return!0}function Ps(t){return typeof t=="object"&&t!==null}var bp=h.enum(["invalid_url_path","missing_url","not_vcp_managed","unsupported_page_type"]),yp=h.enum(["home_page","invalid_url_path","not_selectable","not_vcp_managed","page_has_children","last_selectable_page","cms_unbound","unsupported_page_type"]),Ya=h.lazy(()=>h.object({cms_page_id:h.number().int().positive().nullable(),title:h.string().trim().min(1).max(255),url_path:As,preview_url_path:ze.nullable(),url:Ut.nullable(),page_type:Cs,vcp_managed:h.boolean(),selectable:h.boolean(),disabled_reason:bp.nullable(),can_delete:h.boolean(),delete_block_reason:yp.nullable(),has_cms_children:h.boolean(),children:h.array(Ya)}).strict()),Xa=h.object({group_id:h.string().min(1),title:h.string().trim().min(1).max(255),pages:h.array(Ya)}).strict(),ME=h.object({base_snapshot_id:x,expected_url_path:ze}).strict(),xp=h.enum(["succeeded","failed"]),Ep=h.object({url_path:ze,phase:h.enum(["ensure","binding","delete"]),code:h.string().min(1),message:h.string().min(1)}).strict(),Ds=h.object({status:xp,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(Ep),warnings:h.array(h.string().min(1))}).strict(),Ip=h.object({result_snapshot_id:x,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:Ut.nullable(),previous_url:Ut.nullable(),cms_reconcile_result:Ds}).strict(),UE=h.object({code:h.literal(0),message:h.string(),data:Ip}).strict(),qE=h.object({snapshot_id:x}).strict(),Rp=h.object({snapshot_id:x,warnings:h.array(h.string().min(1)),cms_reconcile_result:Ds}).strict(),FE=h.object({code:h.literal(0),message:h.string(),data:Rp}).strict(),GE=h.object({source_committed:h.boolean(),result_snapshot_id:x.optional(),cms_reconcile_result:Ds.optional()}).strict().superRefine((t,n)=>{t.source_committed&&!t.result_snapshot_id&&n.addIssue({code:"custom",path:["result_snapshot_id"],message:"committed source requires result_snapshot_id"})}),Tp=vs,kp=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(),Qa=h.object({url_path:ze,title:h.string().trim().min(1).max(255),kind:Tp,route_file:h.string().min(1),collection_id:h.string().trim().min(1).optional(),seo:kp.optional()}).strict().superRefine((t,n)=>{t.kind==="detail_page"&&t.seo&&n.addIssue({code:"custom",path:["seo"],message:"detail_page target cannot carry seo (owned by the collection binding flow)"}),t.kind==="detail_page"&&!t.collection_id&&n.addIssue({code:"custom",path:["collection_id"],message:"detail_page target requires collection_id"}),t.kind!=="detail_page"&&t.collection_id&&n.addIssue({code:"custom",path:["collection_id"],message:`${t.kind} target cannot have collection_id`}),t.kind==="landing_page"!=(t.url_path===Ba)&&n.addIssue({code:"custom",path:["kind"],message:"The home target must be the only landing_page target."})}),Pp=h.object({complete:h.literal(!0),targets:h.array(Qa)}).strict().superRefine((t,n)=>{t.targets.length<1&&n.addIssue({code:"too_small",minimum:1,inclusive:!0,origin:"array",path:["targets"],message:"A complete page target set must contain at least one page."}),t.targets.filter(a=>a.url_path===Ba).length!==1&&n.addIssue({code:"custom",path:["targets"],message:"A complete page target set must contain exactly one home page."})}),zE=h.discriminatedUnion("complete",[Pp,h.object({complete:h.literal(!1),targets:h.array(Qa),errors:h.array(h.string().min(1)).min(1)}).strict()]),ws=h.string().regex(/^sha256:[0-9a-f]{64}$/),KE=h.object({projection_hash:ws.nullable()}).strict(),BE=h.object({expected_projection_hash:ws.nullable(),projection_hash:ws}).strict();var Za="insertNewPage",XE={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"},pt=b.enum(["page","pages"]),wp=b.object({resource_id:b.string().min(1),resource_type:pt,resolved_version:lt,template_page_id:b.string().min(1)}).strict(),Ja=b.lazy(()=>b.object({id:b.string().uuid(),key:b.string().min(1),name:b.string(),children:b.array(Ja)}).strict()),eo=b.object({category_group_key:b.literal(Za),categories:b.array(Ja)}).strict(),Ap=b.object({resource_id:b.string().min(1),resource_type:pt,name:b.string(),description:b.string().nullable(),thumbnail_url:b.string().nullable(),preview_images:b.array(b.object({url:b.string().min(1),page_id:b.string().min(1).nullable(),is_primary:b.boolean()}).strict()).optional(),resolved_version:lt,category_id:b.string().uuid().nullable()}).strict(),to=b.object({category_group_key:b.literal(Za),items:b.array(Ap),next_cursor:b.string().min(1).nullable()}).strict(),QE=b.object({category_id:b.string().uuid().optional(),include_descendants:b.enum(["true","false"]).optional().transform(t=>t==="true"),limit:b.coerce.number().int().min(1).max(100).optional().default(20),cursor:b.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),qt=lt,wn=b.string().regex(/^\/[a-z0-9]+(?:-[a-z0-9]+)*$/),ZE=b.string().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),vp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:wn}).strict(),Cp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),source:wp.optional(),blocks:b.array(b.discriminatedUnion("kind",[b.object({kind:b.literal("package-component"),instance_id:b.string().min(1),component_id:b.string().min(1),label:b.string().trim().min(1).max(120)}).strict(),b.object({kind:b.literal("component-resource"),instance_id:b.string().min(1),resource_id:b.string().min(1),resolved_version:lt,label:b.string().trim().min(1).max(120)}).strict()])).optional(),route:b.object({input:b.string(),append_random_suffix:b.boolean().optional(),random_suffix_length:b.number().int().min(4).max(16).optional(),final:wn}).strict()}).strict(),Dp=b.object({resource_id:b.string().min(1),resource_type:pt,resolved_version:qt,pages:b.array(Cp).min(1)}).strict().superRefine((t,n)=>{Xe(t.pages.map(s=>s.template_page_id),"pages",n),Xe(t.pages.map(s=>s.route.final),"routes",n);for(let[s,a]of t.pages.entries()){if(!a.blocks)continue;let i=new Set;for(let[r,g]of a.blocks.entries())i.has(g.instance_id)&&n.addIssue({code:"custom",path:["pages",s,"blocks",r,"instance_id"],message:`Duplicate block instance identifier within page: ${g.instance_id}`}),i.add(g.instance_id)}});function js(t,n){t.resource_type==="page"&&t.pages.length!==1&&n.addIssue({code:"custom",path:["pages"],message:"page resources must contain exactly one page"}),t.resource_type==="pages"&&t.pages.length<2&&n.addIssue({code:"custom",path:["pages"],message:"pages resources must contain at least two pages"})}function Xe(t,n,s){let a=new Set;for(let[i,r]of t.entries())a.has(r)&&s.addIssue({code:"custom",path:[n,i],message:`Duplicate ${n} identifier: ${r}`}),a.add(r)}var JE=b.object({resource_type:pt,version:qt,pages:b.array(vp).min(1)}).strict().superRefine((t,n)=>{js(t,n),Xe(t.pages.map(s=>s.template_page_id),"pages",n),Xe(t.pages.map(s=>s.final_route),"routes",n)}),jp=b.object({instance_id:b.string().min(1),component_id:b.string().min(1)}).strict(),Op=b.object({component_id:b.string().min(1),materialization:mt}).strict(),Np=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:wn,materialization:mt,components:b.array(jp)}).strict(),Os=b.object({resource_id:b.string().min(1),resource_type:pt,resolved_version:qt,revision_id:b.string().uuid().optional(),digest_sha256:b.string().regex(/^[a-f0-9]{64}$/),components:b.array(Op),pages:b.array(Np).min(1),project_dependencies:b.record(b.string(),b.never()).optional()}).strict().superRefine((t,n)=>{js(t,n);let s=t.components.map(i=>i.component_id),a=new Set(s);Xe(s,"components",n),Xe(t.pages.map(i=>i.template_page_id),"pages",n),Xe(t.pages.map(i=>i.final_route),"routes",n);for(let[i,r]of t.pages.entries()){let g=new Set;for(let[c,_]of r.components.entries())a.has(_.component_id)||n.addIssue({code:"custom",path:["pages",i,"components",c,"component_id"],message:`Unknown component reference: ${_.component_id}`}),g.has(_.instance_id)&&n.addIssue({code:"custom",path:["pages",i,"components",c,"instance_id"],message:`Duplicate component instance identifier within page: ${_.instance_id}`}),g.add(_.instance_id)}}),no=Os,so=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:wn,route_file_path:b.string().regex(/^app\/[a-z0-9]+(?:-[a-z0-9]+)*\/page\.tsx$/)}).strict(),Lp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),composition_supported:b.boolean(),blocks:b.array(b.object({instance_id:b.string().min(1),component_id:b.string().min(1),label:b.string().trim().min(1).max(120)}).strict())}).strict(),io=b.object({resource_id:b.string().min(1),resource_type:pt,resolved_version:qt,pages:b.array(Lp).min(1)}).strict().superRefine((t,n)=>{js(t,n),Xe(t.pages.map(s=>s.template_page_id),"pages",n)}),eI=b.object({resource_type:pt,version:qt}).strict(),tI=b.object({draft:Dp}).strict(),ao=b.object({groups:b.array(Xa)}).strict(),oo=b.object({candidate:b.record(b.string(),b.unknown())}).strict();var xt="[a-z0-9]+(?:-[a-z0-9]+)*",Ft=new RegExp(`^/(?:${xt}(?:/${xt})*)?$`),ro=["/privacy","/cookie-policy","/system/not-found"],Mp=ro.map(t=>`app/${t.slice(1)}/page.tsx`);function Up(t){return t.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function co(t){return typeof t=="string"&&Ft.test(t)}function mo(t){if(typeof t!="string")return null;let n=t.trim();if(/[^\x00-\x7F]/.test(n))return null;let s=n.replace(/^\/+|\/+$/g,"");if(s==="")return"/";let a=s.split("/");if(a.some(c=>c==="."||c===".."))return null;let i=s.toLowerCase();if(i==="index"||i==="home")return"/";let r=a.map(Up).filter(c=>c.length>0);if(r.length===0)return null;let g=`/${r.join("/")}`;return co(g)?g:null}function lo(t){let n=mo(t);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function qp(t){let n=lo(t);return n==="/"?"app/page.tsx":`app/${n.slice(1)}/page.tsx`}import{z as Q}from"zod";import{z as p}from"zod";import{z as we}from"zod";var Fp=we.object({code:we.string().min(1),message:we.string().min(1)}),oI=we.object({code:we.string().min(1),message:we.string().min(1)});function Ns(t){return we.object({ok:we.literal(!0),composition:M,data:t}).strict()}function Gp(t){let n={ok:we.literal(!1),composition:M,error:Fp.extend({code:t.codeSchema})};return t.currentSchema&&(n.current=t.currentSchema.optional()),t.diagnosticsSchema&&(n.diagnostics=we.array(t.diagnosticsSchema).optional()),t.dataSchema&&(n.data=t.dataSchema.optional()),we.object(n).strict()}function po(t){return we.discriminatedUnion("ok",[Ns(t.dataSchema),Gp({codeSchema:t.codeSchema,currentSchema:t.currentSchema,diagnosticsSchema:t.diagnosticsSchema,dataSchema:t.failureDataSchema})])}import{z as B}from"zod";var dt=B.object({start:B.number().int().nonnegative(),end:B.number().int().nonnegative()}).superRefine((t,n)=>{t.end<t.start&&n.addIssue({code:"custom",path:["end"],message:"end must be greater than or equal to start"})}),zp=B.object({code:B.enum(["missing-class-name","unsupported-attribute-name","source-locator-warning","invalid-new-attr","version-conflict","write-failed"]),message:B.string().min(1)}),uo=B.object({path:B.string().min(1),content:B.string(),hash:B.string().min(1).optional()}),pI=B.object({composition:M,revision:B.string().min(1),entryCss:uo,stylesheets:B.array(uo).default([])}).strict(),dI=B.object({composition:ne}).strict(),uI=B.object({key:B.string().min(1),composition:ne}).strict(),go=B.object({key:B.string().min(1),composition:M,filePath:B.string().min(1),componentName:B.string().min(1),sourceKind:B.enum(["missing","stringLiteral","expression"]),attrRaw:B.string().min(1).nullable(),valueRaw:B.string().min(1).nullable(),attrRange:dt.nullable(),openingElementRange:dt,version:B.object({documentVersion:B.number().int().nonnegative(),contentHash:B.string().min(1)}),diagnostics:B.array(zp),computedStyle:B.record(B.string(),B.string()).optional()}).strict().superRefine((t,n)=>{if(t.sourceKind==="missing"){(t.attrRaw!==null||t.valueRaw!==null||t.attrRange!==null)&&n.addIssue({code:"custom",message:"missing className source must not include attr raw or range"});return}(t.attrRaw===null||t.valueRaw===null||t.attrRange===null)&&n.addIssue({code:"custom",message:"present className source must include attr raw and ranges"})}),gI=go,_I=Ns(go),Ls=B.object({source:B.enum(["style-panel","class-source-editor"]),operation:B.enum(["replace-static-classname","replace-expression","create-attribute","remove-attribute"])});import{z as Kp}from"zod";var Ms=Kp.enum(["src","alt","poster","href","width","height"]);import{z as Et}from"zod";var Gt=Et.object({editingSessionId:Et.string().min(1),lockId:Et.string().min(1),ownerId:Et.string().min(1),leaseAssertion:Et.string().min(1)}).strict(),yI="signed-designer-mutations-v1",xI=Et.object({mutationContext:Gt}).strict();import{z as d}from"zod";import{z as zt}from"zod";var An="::",Us=zt.object({file:zt.string().min(1),component:zt.string().min(1),structuralPath:zt.string().min(1),key:zt.string().min(1)}).superRefine((t,n)=>{let s=Bp(t.file,t.component,t.structuralPath);t.key!==s&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function Bp(t,n,s){return`${t}${An}${n}${An}${s}`}function RI(t){let[n,s,...a]=t.split(An);return!n||!s||a.length===0?null:{file:n,component:s,structuralPath:a.join(An)}}var vn=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"]),Kt=d.object({code:d.string().min(1),message:d.string().min(1)}).strict(),Wp=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()]),Vp=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(),Hp=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(),$p=d.object({key:d.string().min(1),containerKey:d.string().min(1),businessMemberKeys:d.array(d.string().min(1)),isMultiMember:d.boolean()}).strict(),ho=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:ne}).strict(),Yp=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:M,placementUnitKey:d.string().min(1),relation:d.enum(["before","after","prepend","append"])}).strict(),So=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:ne,placementUnitKey:d.string().min(1),relation:d.enum(["before","after","prepend","append"])}).strict(),fo=d.object({kind:d.literal("page-unit"),composition:ne,placementUnitKey:d.string().min(1)}).strict(),bo=d.object({kind:d.literal("page-unit"),composition:M,placementUnitKey:d.string().min(1)}).strict();function Ke(t,n,s,a,i){let r=new Set;for(let[g,c]of t.entries()){let _=a(c);r.has(_)&&n.addIssue({code:"custom",path:[s,g,i],message:`Duplicate ${s} key: ${_}`}),r.add(_)}}var Xp=d.object({status:d.literal("supported"),version:d.number().int().nonnegative(),composition:M,container:Wp,sourceMembers:d.array(Vp),businessMembers:d.array(Hp),placementUnits:d.array($p),placements:d.array(Yp)}).strict().superRefine((t,n)=>{Ke(t.sourceMembers,n,"sourceMembers",c=>c.key,"key"),Ke(t.businessMembers,n,"businessMembers",c=>c.key,"key"),Ke(t.placementUnits,n,"placementUnits",c=>c.key,"key"),Ke(t.placements,n,"placements",c=>c.placementKey,"placementKey");let s=new Set(t.sourceMembers.map(c=>c.key)),a=new Set(t.placementUnits.map(c=>c.key)),i=new Map(t.sourceMembers.map(c=>[c.key,c])),r=new Map(t.businessMembers.map(c=>[c.key,c]));for(let[c,_]of t.sourceMembers.entries()){_.containerKey!==t.container.key&&!s.has(_.containerKey)&&n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member parent must reference the page container or another source member."}),_.containerKey===_.key&&n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member cannot contain itself."});let j=new Set([_.key]),E=_.containerKey;for(;E!==t.container.key;){if(j.has(E)){n.addIssue({code:"custom",path:["sourceMembers",c,"containerKey"],message:"Source member hierarchy must be acyclic."});break}j.add(E);let O=i.get(E);if(!O)break;E=O.containerKey}}t.container.kind==="jsx-container"&&!s.has(t.container.sourceMemberKey)&&n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."});for(let[c,_]of t.businessMembers.entries())s.has(_.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",c,"sourceMemberKey"],message:"Business member must reference a source member."}),a.has(_.containerKey)||n.addIssue({code:"custom",path:["businessMembers",c,"containerKey"],message:"Business member must reference a placement unit container."});for(let[c,_]of t.placementUnits.entries()){let j=i.get(_.containerKey);j?j.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",c,"containerKey"],message:"Placement unit must reference a direct child of the page container."}):n.addIssue({code:"custom",path:["placementUnits",c,"containerKey"],message:"Placement unit containerKey must reference a source member."});let E=new Set;for(let[O,q]of _.businessMemberKeys.entries()){let F=r.get(q);if(!F){n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Placement unit must reference existing business members."});continue}E.has(q)&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Placement unit cannot reference the same business member twice."}),E.add(q),F.containerKey!==_.key&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Business member containerKey must match its placement unit."});let ee=F.sourceMemberKey,ae=new Set;for(;ee&&ee!==_.containerKey&&!ae.has(ee);)ae.add(ee),ee=i.get(ee)?.containerKey;ee!==_.containerKey&&n.addIssue({code:"custom",path:["placementUnits",c,"businessMemberKeys",O],message:"Placement unit business members must belong to its source subtree."})}}for(let[c,_]of t.businessMembers.entries())t.placementUnits.find(E=>E.key===_.containerKey)?.businessMemberKeys.includes(_.key)||n.addIssue({code:"custom",path:["businessMembers",c,"containerKey"],message:"Business member must be listed by its placement unit container."});let g=new Map;for(let c of t.placementUnits)g.set(c.containerKey,(g.get(c.containerKey)??0)+1);for(let[c,_]of t.sourceMembers.entries())_.containerKey===t.container.key&&g.get(_.key)!==1&&n.addIssue({code:"custom",path:["sourceMembers",c,"key"],message:"Every direct source member must be owned by exactly one placement unit."});for(let[c,_]of t.placements.entries())Eo(_.composition,t.composition)||n.addIssue({code:"custom",path:["placements",c,"composition"],message:"Page placement composition must match page composition."}),_.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",c,"documentVersion"],message:"Page placement version must match page composition version."}),a.has(_.placementUnitKey)||n.addIssue({code:"custom",path:["placements",c,"placementUnitKey"],message:"Placement option must reference an existing placement unit."})}),Qp=d.object({status:d.literal("unsupported"),version:d.number().int().nonnegative(),composition:M,reason:vn,diagnostics:d.array(Kt)}).strict(),Zp=d.discriminatedUnion("status",[Xp,Qp]),yo=2,AI="page-composition-v2",xo=d.object({start:d.number().int().nonnegative(),end:d.number().int().nonnegative(),startLine:d.number().int().positive().optional(),startColumn:d.number().int().nonnegative().optional(),endLine:d.number().int().positive().optional(),endColumn:d.number().int().nonnegative().optional()}).strict().superRefine((t,n)=>{t.end<t.start&&n.addIssue({code:"custom",path:["end"],message:"Source range end must be greater than or equal to start."});let s=[t.startLine,t.startColumn,t.endLine,t.endColumn],a=s.some(r=>r!==void 0),i=s.every(r=>r!==void 0);a&&!i&&n.addIssue({code:"custom",path:["startLine"],message:"Source line and column locations must be provided together."}),t.startLine!==void 0&&t.endLine!==void 0&&t.endLine<t.startLine&&n.addIssue({code:"custom",path:["endLine"],message:"Source range endLine must not precede startLine."}),t.startLine!==void 0&&t.endLine===t.startLine&&t.startColumn!==void 0&&t.endColumn!==void 0&&t.endColumn<t.startColumn&&n.addIssue({code:"custom",path:["endColumn"],message:"Source range endColumn must not precede startColumn."})}),Jp=d.object({key:d.string().min(1),instanceIndex:d.number().int().nonnegative().optional(),instanceCount:d.number().int().positive().optional(),textSegmentIndex:d.number().int().nonnegative().optional()}).strict().superRefine((t,n)=>{t.instanceIndex!==void 0&&t.instanceCount!==void 0&&t.instanceIndex>=t.instanceCount&&n.addIssue({code:"custom",path:["instanceIndex"],message:"instanceIndex must be lower than instanceCount."})}),ed=d.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),td=d.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),nd=d.discriminatedUnion("kind",[d.object({kind:d.literal("virtual-route-root"),key:d.null(),routeReturn:d.object({sourceIdentity:Us,sourceRange:xo}).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()]),sd=d.object({key:d.string().min(1),kind:ed,parentKey:d.string().min(1).nullable(),childKeys:d.array(d.string().min(1)),order:d.number().int().nonnegative(),label:d.string().min(1),sourceIdentity:Us,sourceRange:xo.nullable(),atomicKind:td}).strict().superRefine((t,n)=>{let s=t.kind==="component-call"||t.kind==="native-jsx"?"none":t.kind;t.atomicKind!==s&&n.addIssue({code:"custom",path:["atomicKind"],message:`atomicKind must be ${s} for ${t.kind}.`});let a=new Set;for(let[i,r]of t.childKeys.entries())a.has(r)&&n.addIssue({code:"custom",path:["childKeys",i],message:`Duplicate child source member key: ${r}`}),a.add(r)}),id=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(),ad=d.enum(["independent","atomic","container"]),od=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:ad,isIndependent:d.boolean(),isMultiMember:d.boolean()}).strict().superRefine((t,n)=>{_o(t.sourceMemberKeys,n,"sourceMemberKeys","source member"),_o(t.businessMemberKeys,n,"businessMemberKeys","business member");let s=t.sourceMemberKeys.length>1||t.businessMemberKeys.length>1;t.isMultiMember!==s&&n.addIssue({code:"custom",path:["isMultiMember"],message:"isMultiMember must reflect the source and business member cardinality."});let a=t.boundaryMode==="independent";t.isIndependent!==a&&n.addIssue({code:"custom",path:["isIndependent"],message:"isIndependent must match boundaryMode."})}),rd=d.enum(["before","after","prepend","append","replace"]),cd=d.enum(["insert-sibling","insert-child","replace-placeholder"]),md=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:M,placementUnitKey:d.string().min(1),containerKey:d.string().min(1).nullable(),relation:rd,writeMode:cd}).strict().superRefine((t,n)=>{let s=t.relation==="before"||t.relation==="after"?"insert-sibling":t.relation==="prepend"||t.relation==="append"?"insert-child":"replace-placeholder";t.writeMode!==s&&n.addIssue({code:"custom",path:["writeMode"],message:`writeMode must be ${s} for ${t.relation}.`})}),ld=d.object({key:d.string().min(1),placementUnitKey:d.string().min(1),runtimeRefs:d.array(Jp).min(1)}).strict(),pd=d.object({schemaVersion:d.literal(yo),status:d.literal("supported"),version:d.number().int().nonnegative(),composition:M,container:nd,sourceMembers:d.array(sd),businessMembers:d.array(id),placementUnits:d.array(od),placements:d.array(md),visualAnchors:d.array(ld).optional(),diagnostics:d.array(Kt)}).strict().superRefine((t,n)=>{gd(t,n)}),dd=d.object({schemaVersion:d.literal(yo),status:d.literal("unsupported"),version:d.number().int().nonnegative(),composition:M,reason:vn,diagnostics:d.array(Kt)}).strict(),ud=d.discriminatedUnion("status",[pd,dd]),vI=d.union([ud,Zp]);function _o(t,n,s,a){let i=new Set;for(let[r,g]of t.entries())i.has(g)&&n.addIssue({code:"custom",path:[s,r],message:`Duplicate ${a} key: ${g}`}),i.add(g)}function Eo(t,n){return us(t)===us(n)}function gd(t,n){Ke(t.sourceMembers,n,"sourceMembers",E=>E.key,"key"),Ke(t.businessMembers,n,"businessMembers",E=>E.key,"key"),Ke(t.placementUnits,n,"placementUnits",E=>E.key,"key"),Ke(t.placements,n,"placements",E=>E.placementKey,"placementKey"),Ke(t.visualAnchors??[],n,"visualAnchors",E=>E.key,"key"),_d(t,n);let s=new Map(t.sourceMembers.map(E=>[E.key,E])),a=new Map(t.businessMembers.map(E=>[E.key,E])),i=new Map(t.placementUnits.map(E=>[E.key,E]));hd(t,s,n),t.container.kind!=="virtual-route-root"&&(s.has(t.container.sourceMemberKey)||n.addIssue({code:"custom",path:["container","sourceMemberKey"],message:"Container sourceMemberKey must reference a source member."}));let r=new Map,g=new Map,c=new Set;for(let[E,O]of t.placementUnits.entries()){O.containerKey!==t.container.key&&n.addIssue({code:"custom",path:["placementUnits",E,"containerKey"],message:"Placement unit containerKey must match the page container."});let q=`${O.containerKey??"<virtual>"}:${O.order}`;c.has(q)&&n.addIssue({code:"custom",path:["placementUnits",E,"order"],message:"Placement unit order must be unique within its container."}),c.add(q);for(let[F,ee]of O.sourceMemberKeys.entries()){s.has(ee)||n.addIssue({code:"custom",path:["placementUnits",E,"sourceMemberKeys",F],message:"Placement unit must reference existing source members."});let ae=r.get(ee);ae&&ae!==O.key&&n.addIssue({code:"custom",path:["placementUnits",E,"sourceMemberKeys",F],message:`Source member is already assigned to ${ae}.`}),r.set(ee,O.key)}for(let[F,ee]of O.businessMemberKeys.entries()){let ae=a.get(ee);if(!ae){n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",F],message:"Placement unit must reference existing business members."});continue}ae.placementUnitKey!==O.key&&n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",F],message:"Placement unit and business member must reference each other."}),O.sourceMemberKeys.includes(ae.sourceMemberKey)||n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",F],message:"Business member sourceMemberKey must belong to the placement unit."});let Dt=g.get(ee);Dt&&Dt!==O.key&&n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",F],message:`Business member is already assigned to ${Dt}.`}),g.set(ee,O.key)}}for(let[E,O]of t.businessMembers.entries()){s.has(O.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",E,"sourceMemberKey"],message:"Business member must reference a source member."});let q=i.get(O.placementUnitKey);if(!q){n.addIssue({code:"custom",path:["businessMembers",E,"placementUnitKey"],message:"Business member must reference a placement unit."});continue}q.businessMemberKeys.includes(O.key)||n.addIssue({code:"custom",path:["businessMembers",E,"placementUnitKey"],message:"Business member and placement unit must reference each other."}),q.sourceMemberKeys.includes(O.sourceMemberKey)||n.addIssue({code:"custom",path:["businessMembers",E,"sourceMemberKey"],message:"Business member sourceMemberKey must belong to its placement unit."});let F=q.isIndependent&&q.businessMemberKeys.length===1;O.isIndependent!==F&&n.addIssue({code:"custom",path:["businessMembers",E,"isIndependent"],message:"Business member independence must match its placement unit boundary."})}let _=new Set;for(let[E,O]of t.placements.entries()){O.documentVersion!==t.version&&n.addIssue({code:"custom",path:["placements",E,"documentVersion"],message:"Page placement version must match page composition version."}),Eo(O.composition,t.composition)||n.addIssue({code:"custom",path:["placements",E,"composition"],message:"Page placement composition must match page composition."});let q=i.get(O.placementUnitKey);q?O.containerKey!==q.containerKey&&n.addIssue({code:"custom",path:["placements",E,"containerKey"],message:"Placement containerKey must match its placement unit."}):n.addIssue({code:"custom",path:["placements",E,"placementUnitKey"],message:"Placement option must reference a placement unit."});let F=`${O.placementUnitKey}:${O.relation}`;_.has(F)&&n.addIssue({code:"custom",path:["placements",E,"relation"],message:"A placement unit cannot expose the same relation more than once."}),_.add(F),O.relation==="replace"&&t.container.kind!=="starter-placeholder"&&n.addIssue({code:"custom",path:["placements",E,"relation"],message:"replace is only valid for a starter placeholder container."}),t.container.kind==="starter-placeholder"&&O.relation!=="replace"&&n.addIssue({code:"custom",path:["placements",E,"relation"],message:"Starter placeholder placements must use replace."})}let j=new Set;for(let[E,O]of(t.visualAnchors??[]).entries())i.has(O.placementUnitKey)||n.addIssue({code:"custom",path:["visualAnchors",E,"placementUnitKey"],message:"Visual anchor must reference a placement unit."}),j.has(O.placementUnitKey)&&n.addIssue({code:"custom",path:["visualAnchors",E,"placementUnitKey"],message:"A placement unit may expose only one visual anchor."}),j.add(O.placementUnitKey)}function _d(t,n){let s=[];t.container.key!==null&&s.push({key:t.container.key,path:["container","key"],namespace:"container"});for(let[i,r]of t.sourceMembers.entries())s.push({key:r.key,path:["sourceMembers",i,"key"],namespace:"source member"});for(let[i,r]of t.businessMembers.entries())s.push({key:r.key,path:["businessMembers",i,"key"],namespace:"business member"});for(let[i,r]of t.placementUnits.entries())s.push({key:r.key,path:["placementUnits",i,"key"],namespace:"placement unit"});for(let[i,r]of(t.visualAnchors??[]).entries())s.push({key:r.key,path:["visualAnchors",i,"key"],namespace:"visual anchor"});let a=new Map;for(let i of s){let r=a.get(i.key);r?n.addIssue({code:"custom",path:i.path,message:`${i.namespace} key collides with ${r}: ${i.key}`}):a.set(i.key,i.namespace)}}function hd(t,n,s){let a=new Set;for(let[i,r]of t.sourceMembers.entries()){let g=`${r.parentKey??"<root>"}:${r.order}`;if(a.has(g)&&s.addIssue({code:"custom",path:["sourceMembers",i,"order"],message:"Source member order must be unique among siblings."}),a.add(g),r.parentKey===r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member cannot be its own parent."}),r.parentKey!==null){let j=n.get(r.parentKey);j?j.childKeys.includes(r.key)||s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member parentKey must reference a source member."})}for(let[j,E]of r.childKeys.entries()){if(E===r.key){s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source member cannot be its own child."});continue}let O=n.get(E);O?O.parentKey!==r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source child key must reference a source member."})}let c=new Set,_=r;for(;_;){if(c.has(_.key)){s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member graph must be acyclic."});break}c.add(_.key),_=_.parentKey===null?void 0:n.get(_.parentKey)}}}var Bt=p.enum(["update-text","update-array-item","remove-node","insert-child","move-node","set-class-name-source","set-props","apply-style-draft","source-edit","insert-page-resource","delete-page-source"]),Io=p.lazy(()=>p.union([p.string(),p.number(),p.boolean(),p.null(),p.array(Io),p.record(p.string(),Io)])),Sd=p.discriminatedUnion("kind",[p.object({kind:p.literal("node"),key:p.string().min(1)}).strict(),fo,p.object({kind:p.literal("route"),composition:ne}).strict(),p.object({kind:p.literal("source-file"),path:pe}).strict(),p.object({kind:p.literal("source-batch"),paths:p.array(pe).min(1)}).superRefine((t,n)=>{let s=new Set;for(let[a,i]of t.paths.entries())s.has(i)&&n.addIssue({code:"custom",path:["paths",a],message:`Duplicate source target path: ${i}`}),s.add(i)}).strict(),p.object({kind:p.literal("project")}).strict()]),fd=p.discriminatedUnion("kind",[p.object({kind:p.literal("node"),key:p.string().min(1)}).strict(),bo,p.object({kind:p.literal("route"),composition:M}).strict(),p.object({kind:p.literal("source-file"),path:pe}).strict(),p.object({kind:p.literal("source-batch"),paths:p.array(pe).min(1)}).strict(),p.object({kind:p.literal("project")}).strict()]),To=p.enum(["display","position","top","right","bottom","left","zIndex","flexDirection","flexWrap","flexGrow","flexShrink","flexBasis","order","gridTemplateColumns","gridTemplateRows","columns","gridColumn","gridRow","gap","gapX","gapY","spaceX","spaceY","alignItems","justifyContent","marginTop","marginRight","marginBottom","marginLeft","paddingTop","paddingRight","paddingBottom","paddingLeft","width","height","minWidth","minHeight","maxWidth","maxHeight","overflow","fontFamily","fontSize","fontWeight","lineHeight","letterSpacing","textAlign","textTransform","textDecoration","textOverflow","textIndent","writingMode","whiteSpace","wordBreak","lineClamp","fontVariantNumeric","screenReaderOnly","color","backgroundColor","backgroundImage","backgroundRepeat","backgroundSize","backgroundPosition","backgroundAttachment","backgroundClip","backgroundOrigin","borderStyle","borderWidth","borderRadius","borderColor","objectFit","objectPosition","aspectRatio","opacity","boxShadow","transform","transformOrigin","transitionProperty","transitionDuration","transitionTimingFunction","animation","pointerEvents","cursor","userSelect","fontStyle","textUnderlineOffset","scrollMarginTop","alignSelf","flex","outlineStyle","resize","ringWidth","ringColor","backdropFilter","overscrollBehavior","divideWidth","divideColor"]),ko=p.enum(["hover","active","focus","disabled"]),Po=p.enum(["sm","md","lg","xl","2xl"]),Ro=p.union([p.object({relation:p.enum(["before","after"]),anchorKey:p.string().min(1)}),p.object({relation:p.enum(["prepend","append"]),parentKey:p.string().min(1)}),So]),bd=p.union([p.object({kind:p.literal("native-tag"),tag:p.string().min(1),text:p.string().optional()}),p.object({kind:p.literal("component-call"),component:p.object({source:p.string().min(1),exportName:p.string().min(1)}),materialization:p.never().optional(),props:p.record(p.string(),p.unknown()).optional()}).strict(),p.object({kind:p.literal("component-call"),component:p.never().optional(),materialization:mt,props:p.record(p.string(),p.never()).optional()}).strict()]),yd=p.discriminatedUnion("kind",[p.object({kind:p.literal("update-text"),segmentIndex:p.number().int().min(0),value:p.string()}),p.object({kind:p.literal("update-array-item"),segmentIndex:p.number().int().min(0),index:p.number().int().min(0),value:p.string()}),p.object({kind:p.literal("remove-node")}),p.object({kind:p.literal("insert-child"),node:bd,position:p.union([Ro,ho])}),p.object({kind:p.literal("move-node"),target:Ro,preserveBindings:p.boolean().optional()}),p.object({kind:p.literal("set-class-name-source"),filePath:p.string().min(1),expectedVersion:p.object({documentVersion:p.number().int().nonnegative(),contentHash:p.string().min(1)}),oldAttrRaw:p.string().min(1).nullable(),oldAttrRange:dt.nullable(),openingElementRange:dt,newAttrRaw:p.string().min(1).nullable(),intent:Ls}),p.object({kind:p.literal("set-props"),props:p.partialRecord(Ms,p.string())}),p.object({kind:p.literal("apply-style-draft"),className:p.object({filePath:p.string().min(1),expectedVersion:p.object({documentVersion:p.number().int().nonnegative(),contentHash:p.string().min(1)}),oldAttrRaw:p.string().min(1).nullable(),oldAttrRange:dt.nullable(),openingElementRange:dt,newAttrRaw:p.string().min(1).nullable(),intent:Ls}).optional(),props:p.partialRecord(Ms,p.string()).optional()}).superRefine((t,n)=>{!t.className&&!t.props&&n.addIssue({code:"custom",message:"apply-style-draft requires className or props"})}),p.object({kind:p.literal("source-edit"),conflictPolicy:p.enum(["compare-and-swap","overwrite"]),edits:p.array(p.discriminatedUnion("operation",[p.object({operation:p.literal("upsert"),path:pe,content:p.string(),baseContentHash:p.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{_s(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit upsert only accepts allowlisted text source files"}),t.content.includes("\0")&&n.addIssue({code:"custom",path:["content"],message:"source-edit content must be valid text"})}),p.object({operation:p.literal("delete"),path:pe,capability:pa,confirmDelete:p.literal(!0),confirmPath:pe,baseContentHash:p.string().min(1).nullable().optional()}).strict().superRefine((t,n)=>{t.capability!==gs&&n.addIssue({code:"custom",path:["capability"],message:"delete requires source-delete capability"}),t.confirmPath!==t.path&&n.addIssue({code:"custom",path:["confirmPath"],message:"delete confirmation path must match edit path"}),_s(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit delete only accepts allowlisted text source files"});let s=hs(t.path);s&&n.addIssue({code:"custom",path:["path"],message:`Protected source file cannot be deleted: ${t.path} (${s})`})})])).min(1),reason:p.string().min(1).optional()}).strict().superRefine((t,n)=>{let s=new Set;for(let[a,i]of t.edits.entries())s.has(i.path)&&n.addIssue({code:"custom",path:["edits",a,"path"],message:`Duplicate source edit path: ${i.path}`}),s.add(i.path),t.conflictPolicy==="compare-and-swap"&&i.baseContentHash===void 0&&n.addIssue({code:"custom",path:["edits",a,"baseContentHash"],message:"source-edit compare-and-swap requires baseContentHash for every edit"})}),p.object({kind:p.literal("insert-page-resource"),artifact:Os}).strict(),p.object({kind:p.literal("delete-page-source"),expectedUrlPath:p.string().startsWith("/")}).strict()]),wo=p.enum(["NODE_NOT_FOUND","HOME_PAGE_LOCKED","ROUTE_NOT_FOUND","CAPABILITY_REJECTED","CONSTRAINT_VIOLATED","INVALID_PARAMS","PLAN_FAILED","TRANSACTION_PREFLIGHT_FAILED","ROUTE_REBUILD_FAILED","HISTORY_COMMIT_FAILED","MATERIALIZATION_CONFLICT","MATERIALIZATION_REJECTED","MUTATION_ASSERTION_REQUIRED","MUTATION_ASSERTION_INVALID","VERSION_STALE","AST_PARSE_ERROR","UNSUPPORTED_OPERATION","LOCATOR_FAILED","INVALID_TARGET","WRITE_IO_ERROR","CONCURRENT_MODIFIED","ROLLBACK_FAILED","RECOVERY_REQUIRED","RECOVERY_PERSIST_FAILED","MUTATION_SESSION_REQUIRED","LEASE_ASSERTION_INVALID","LEASE_ASSERTION_EXPIRED","LEASE_ASSERTION_SCOPE_MISMATCH","CROSS_PAGE_MOVE_UNSUPPORTED","INTERNAL_ERROR"]),Ao=p.object({code:wo,message:p.string().min(1),details:p.record(p.string(),p.unknown()).optional()}),vo=p.object({key:p.string().min(1),instanceIndex:p.number().int().nonnegative().optional(),instanceCount:p.number().int().positive().optional()}),qs=p.object({id:p.string().min(1),siteId:I,baseSnapshotId:x,composition:ne,kind:Bt,target:Sd,documentVersion:p.number().int().nonnegative(),selectionRef:vo.optional(),mutationContext:Gt.optional(),params:yd}).strict().superRefine((t,n)=>{if(t.kind!==t.params.kind&&n.addIssue({code:"custom",path:["params","kind"],message:"params.kind must match operation kind"}),t.kind==="source-edit"){if(t.target.kind!=="source-file"&&t.target.kind!=="source-batch")n.addIssue({code:"custom",path:["target","kind"],message:"source-edit requires a source-file or source-batch target"});else if(t.params.kind==="source-edit"){let s=t.params.edits.map(i=>i.path),a=t.target.kind==="source-file"?[t.target.path]:t.target.paths;Rd(s,a)||n.addIssue({code:"custom",path:["target"],message:"source-edit target paths must match edit paths"})}}else(t.target.kind==="source-file"||t.target.kind==="source-batch")&&n.addIssue({code:"custom",path:["target","kind"],message:"source targets are only valid for source-edit"});t.target.kind==="page-unit"&&(t.kind!=="insert-child"&&t.kind!=="move-node"&&t.kind!=="remove-node"&&n.addIssue({code:"custom",path:["target","kind"],message:"page-unit target is only valid for page-level operations"}),t.kind==="move-node"&&t.params.kind==="move-node"&&(!("kind"in t.params.target)||t.params.target.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","target","kind"],message:"page-unit move-node target requires page-composition placement"})),t.params.kind==="insert-child"&&"kind"in t.params.position&&t.params.position.kind==="page-composition"&&t.target.kind!=="page-unit"&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-composition position requires page-unit target"}),t.kind==="insert-page-resource"||t.kind==="delete-page-source"?t.target.kind!=="project"&&n.addIssue({code:"custom",path:["target","kind"],message:`${t.kind} requires a project target`}):t.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project target is only valid for insert-page-resource or delete-page-source"}),t.kind==="insert-child"&&t.target.kind==="page-unit"&&t.params.kind==="insert-child"&&(!("kind"in t.params.position)||t.params.position.kind!=="page-composition")&&n.addIssue({code:"custom",path:["params","position","kind"],message:"page-unit target requires page-composition position"})}),KI=qs,xd=p.object({kind:p.literal("insert-page-resource"),package_instance_id:p.string().min(1),pages:p.array(so).min(1)}).strict().superRefine((t,n)=>{let s=new Set,a=new Set;for(let[i,r]of t.pages.entries())s.has(r.template_page_id)&&n.addIssue({code:"custom",path:["pages",i,"template_page_id"],message:`Duplicate template page route mapping: ${r.template_page_id}`}),a.has(r.final_route)&&n.addIssue({code:"custom",path:["pages",i,"final_route"],message:`Duplicate final route mapping: ${r.final_route}`}),s.add(r.template_page_id),a.add(r.final_route)}),Ed=p.object({kind:p.literal("delete-page-source"),deleted_files:p.array(p.string().min(1)),updated_files:p.array(p.string().min(1)),preserved_shared_files:p.array(p.string().min(1)),warnings:p.array(p.string().min(1))}).strict(),Id=p.discriminatedUnion("kind",[xd,Ed]),Co=p.object({requestId:p.string().min(1),kind:Bt,composition:M,target:fd,resultVersion:p.number().int().nonnegative(),affectedFiles:p.array(p.string().min(1)).optional(),selectionRef:vo.optional(),output:Id.optional()}).strict(),Fs=Co.superRefine((t,n)=>{let s=t.kind==="insert-page-resource"||t.kind==="delete-page-source";s&&t.target.kind!=="project"?n.addIssue({code:"custom",path:["target","kind"],message:`${t.kind} result requires a project target`}):!s&&t.target.kind==="project"&&n.addIssue({code:"custom",path:["target","kind"],message:"project result target requires a project operation"}),s&&!t.output&&n.addIssue({code:"custom",path:["output"],message:`${t.kind} result requires typed output`}),t.output&&t.output.kind!==t.kind&&n.addIssue({code:"custom",path:["output","kind"],message:"output.kind must match operation kind"})}),BI=po({dataSchema:Fs,codeSchema:wo,failureDataSchema:Co.partial()});function Rd(t,n){return t.length===n.length&&t.every((s,a)=>s===n[a])}var Td=Q.enum(["component","page","pages"]),kd=Q.object({resource_kind:Td,resource_name:Q.string().trim().min(1).max(200),file_count:Q.number().int().min(1).max(64),total_bytes:Q.number().int().min(0).max(4*1024*1024),content_digest:Q.string().regex(/^sha256:[a-f0-9]{64}$/),custom_prompt:Q.string().trim().min(1).max(4e3).optional(),final_routes:Q.array(Q.string().min(1)).max(64)}).strict(),Pd=Q.discriminatedUnion("kind",[Q.object({kind:Q.literal("none")}).strict(),Q.object({kind:Q.literal("primary"),items:Q.array(Q.object({label:Q.string().trim().min(1).max(120),href:Q.string().startsWith("/").max(200)}).strict()).min(1).max(64)}).strict().superRefine((t,n)=>{let s=new Set;for(let[a,i]of t.items.entries())s.has(i.href)&&n.addIssue({code:"custom",path:["items",a,"href"],message:`Duplicate navigation href: ${i.href}`}),s.add(i.href)})]),wd=Q.object({base_snapshot_id:Q.string().min(1),operation:qs,navigation_selection:Pd.optional()}).strict().superRefine((t,n)=>{t.base_snapshot_id!==t.operation.baseSnapshotId&&n.addIssue({code:"custom",path:["operation","baseSnapshotId"],message:"Resource operation baseSnapshotId must match base_snapshot_id."})});function Ad(t){return t.kind==="insert-child"&&t.params.kind==="insert-child"&&t.params.node.kind==="component-call"&&"materialization"in t.params.node&&t.params.node.materialization?[t.params.node.materialization]:t.kind==="insert-page-resource"&&t.params.kind==="insert-page-resource"?[...t.params.artifact.components.map(n=>n.materialization),...t.params.artifact.pages.map(n=>n.materialization)]:[]}var Do=Q.object({id:Q.string().min(1),tenant_id:Q.string().min(1),site_id:Q.string().min(1),run_id:Q.string().min(1).optional(),correlation_id:Q.string().min(1).optional(),sent_at:Q.string().min(1),type:Q.literal("client.resource.operation.create"),payload:Q.object({client_message_id:Q.string().min(1),display:kd,transient_resource_input:wd}).strict()}).strict().superRefine((t,n)=>{let{display:s,transient_resource_input:a}=t.payload;t.site_id!==a.operation.siteId&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","siteId"],message:"Resource operation siteId must match envelope site_id."});let i=s.resource_kind==="component"?"insert-child":"insert-page-resource";a.operation.kind!==i&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation","kind"],message:`${s.resource_kind} resources require ${i}.`});let g=Ad(a.operation).flatMap(_=>_.files),c=g.reduce((_,j)=>_+new TextEncoder().encode(j.content).byteLength,0);if(g.length>Rs&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate file count limit."}),c>Ts&&n.addIssue({code:"custom",path:["payload","transient_resource_input","operation"],message:"Resource operation exceeds the aggregate content byte limit."}),s.file_count!==g.length&&n.addIssue({code:"custom",path:["payload","display","file_count"],message:"Resource summary file_count must match the transient operation."}),s.total_bytes!==c&&n.addIssue({code:"custom",path:["payload","display","total_bytes"],message:"Resource summary total_bytes must match the transient operation."}),a.operation.kind==="insert-page-resource"&&a.operation.params.kind==="insert-page-resource"){let _=a.operation.params.artifact;_.resource_type!==s.resource_kind&&n.addIssue({code:"custom",path:["payload","display","resource_kind"],message:"Resource summary kind must match the page artifact resource_type."});let j=_.pages.map(E=>E.final_route);(j.length!==s.final_routes.length||j.some((E,O)=>E!==s.final_routes[O]))&&n.addIssue({code:"custom",path:["payload","display","final_routes"],message:"Resource summary final_routes must match the page artifact routes."})}if(a.navigation_selection?.kind==="primary"){let _=new Set(s.final_routes);for(let[j,E]of a.navigation_selection.items.entries())_.has(E.href)||n.addIssue({code:"custom",path:["payload","transient_resource_input","navigation_selection","items",j,"href"],message:"Navigation selection href must reference a final resource route."})}});import{z as P}from"zod";var vd=["with_website","without_website"],Cn=P.enum(vd),Gs=P.string().trim().url().refine(t=>{let n=new URL(t).protocol;return n==="http:"||n==="https:"},{message:"Website must use the http or https protocol."}),Cd=["welcome","website_scan","customer_materials","analysis","diagnosis","strategy","structure_planning","preview_personalization","publishing"],Wt=P.enum(Cd),Dd=["company_info","website_crawl","website_basic_info_extract","website_metrics_evaluate","intelligent_analysis","strategy_recommendation"],Oo=P.enum(Dd),jd=["started","running","succeeded","failed","invalidated"],No=P.enum(jd),Od=["draft","structure_saved","generating","workspace_ready"],zs=P.enum(Od),Nd=["not_deployed","deploying","deployed"],Ks=P.enum(Nd),Ld=["active","completed"],Md=P.enum(Ld),Ud=["completed","current","locked"],qd=P.enum(Ud),Lo={draft:10,structure_saved:20,generating:30,workspace_ready:40},Mo={not_deployed:10,deploying:20,deployed:30},Uo={active:10,completed:20},qo={started:10,running:20,succeeded:30,failed:40,invalidated:50};function Dn(t){return new Map(Object.entries(t).map(([n,s])=>[s,n]))}var Fd=Dn(Lo),Gd=Dn(Mo),zd=Dn(Uo),Kd=Dn(qo);function eR(t){let n=Fd.get(t);if(!n)throw new Error(`Unknown site build status code: ${t}`);return n}function tR(t){let n=Gd.get(t);if(!n)throw new Error(`Unknown site deployment status code: ${t}`);return n}function nR(t){let n=zd.get(t);if(!n)throw new Error(`Unknown site workflow status code: ${t}`);return n}function sR(t){let n=Kd.get(t);if(!n)throw new Error(`Unknown task execution status code: ${t}`);return n}function iR(t){return Lo[t]}function aR(t){return Mo[t]}function oR(t){return Uo[t]}function rR(t){return qo[t]}var Bs=[{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}]}}],cR=Bs[0].definitions,Fo=P.number().int().min(1),Bd=P.object({id:G,flow_type:Cn,definition_version:Fo,node_code:Wt,label:P.string().min(1),sort_order:P.number().int().min(1),is_enabled:P.boolean(),state:qd}),Go=P.object({id:sa,tenant_id:P.string().min(1),site_id:I,workflow_id:Le,node_code:Wt,task_type:Oo,external_task_id:P.string().min(1),execution_status:No,idempotency_key:P.string().min(1),attempt_no:P.number().int().min(1),superseded_at:P.string().min(1).nullable(),created_at:P.string().min(1),updated_at:P.string().min(1)}),Wd=P.object({id:Le,tenant_id:P.string().min(1),site_id:I,flow_type:Cn,website:Gs.nullable(),definition_version:Fo,current_node_code:Wt,status:Md,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)}),Ws=P.object({workflow:Wd,menu:P.array(Bd),task_refs:P.array(Go),site:P.object({default_locale:de.optional(),status:zs,deployment_status:Ks,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()})}),mR=L(Ws),lR=L(Go),jo=P.array(P.string().min(1).max(64)).max(16).optional(),pR=P.discriminatedUnion("flow_type",[P.object({flow_type:P.literal("with_website"),website:Gs,client_capabilities:jo}).strict(),P.object({flow_type:P.literal("without_website"),website:P.null().optional(),client_capabilities:jo}).strict()]),dR=P.object({expected_current_node:P.literal("website_scan"),website:Gs}).strict(),uR=P.object({expected_current_node:Wt}).strict(),gR=P.object({expected_current_node:P.literal("publishing")}).strict(),Vd=P.object({node_code:Wt,task_type:Oo,external_task_id:P.string().min(1).max(255),idempotency_key:P.string().min(1).max(255)}),_R=Vd.extend({workflow_id:Le}).strict(),hR=P.object({external_task_id:P.string().min(1).max(255),execution_status:No}),Hd=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)}),SR=Hd.extend({workflow_id:Le}).strict(),$d=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)}),fR=$d.extend({workflow_id:Le}).strict(),bR=P.object({}).strict();function Yd(t,n,s){return t.find(a=>a.definition_version===s)?.definitions[n]}function Xd(t,n){return Yd(Bs,t,n)}function Qd(t,n=1){let s=Xd(t,n);if(!s)throw new Error(`Unknown workflow definition: ${t} v${n}.`);return s}function Zd(t,n,s){let a=new Set(s);return t.filter(i=>i.published&&(i.required_client_capability===null||a.has(i.required_client_capability))).sort((i,r)=>r.definition_version-i.definition_version).map(i=>({definition_version:i.definition_version,items:i.definitions[n]}))[0]}function yR(t,n){return Zd(Bs,t,n)}function xR(t,n){return Qd(t).findIndex(s=>s.node_code===n)}function ER(t,n){return t==="website_scan"?n==="website_crawl"||n==="website_basic_info_extract"||n==="website_metrics_evaluate":t==="customer_materials"?n==="company_info":t==="analysis"?n==="intelligent_analysis":t==="strategy"?n==="strategy_recommendation":!1}function IR(t,n){if(t===n)return n;if(!{started:["running","succeeded","failed","invalidated"],running:["succeeded","failed","invalidated"],succeeded:["invalidated"],failed:["invalidated"],invalidated:[]}[t].includes(n))throw new Error(`Invalid task execution status transition: ${t} -> ${n}`);return n}function RR(t,n){if(t===n)return n;if(!{draft:["structure_saved"],structure_saved:["generating","draft"],generating:["workspace_ready","structure_saved"],workspace_ready:[]}[t].includes(n))throw new Error(`Invalid site build status transition: ${t} -> ${n}`);return n}import{z as y}from"zod";var Vs=y.string().min(1).max(120).regex(/^[a-z][a-z0-9_-]*$/),Re=y.string().min(1).max(120).regex(/^[A-Za-z_][A-Za-z0-9_]*$/),Jd=y.enum(["text","select","multi_select","tags","category_list","boolean","number"]),Vt=y.string().min(1).max(512).regex(/^\/(?:[^?#]*)$/),eu=y.object({minimum:y.number().finite(),maximum:y.number().finite(),step:y.number().finite().positive()}).strict().refine(t=>t.minimum<t.maximum,{message:"minimum must be less than maximum"}),tu=y.string().trim().min(1).max(100),Ko=y.array(tu).max(5).refine(t=>new Set(t.map(n=>n.toLowerCase())).size===t.length,{message:"popular_terms must be unique ignoring case"}),wR=y.array(y.string()).max(20).transform(t=>{let n=new Set;return t.map(s=>s.trim()).filter(s=>{if(s.length===0||s.length>100)return!1;let a=s.toLowerCase();return n.has(a)?!1:(n.add(a),!0)}).slice(0,5)}),Bo=y.object({filter_enabled:y.boolean(),selected_fields:y.array(Re).max(64),selected_card_fields:y.array(Re).max(64).default([]),popular_terms_enabled:y.boolean().default(!1),popular_terms:Ko.optional()}).strict(),nu=y.object({app_slug:Vs}).extend(Bo.shape).strict(),Hs=y.object({kind:y.literal("product_search_confirmation"),baseline_snapshot_id:x,target_route_id:Vt,applications:y.array(y.object({app_slug:Vs,label:y.string().min(1).max(200),popular_terms:Ko.default([]),current_config:Bo.nullable().default(null),affected_routes:y.array(Vt).max(64).default([]),fields:y.array(y.object({field_name:Re,label:y.string().min(1).max(200),value_shape:Jd,option_count:y.number().int().nonnegative().optional(),filter_meta:eu.optional()}).strict()).max(64)}).strict()).min(1).max(12),current_config:nu.nullable().optional(),affected_routes:y.array(Vt).min(1).max(64).optional()}).strict(),su=y.object({kind:y.literal("product_search_confirmation"),action:y.enum(["confirm","modify"]),app_slug:Vs,filter_enabled:y.boolean(),popular_terms_enabled:y.boolean().default(!1),selected_fields:y.array(Re).max(64),selected_card_fields:y.array(Re).max(64).default([])}).strict().superRefine((t,n)=>{t.filter_enabled&&t.selected_fields.length===0&&n.addIssue({code:"custom",path:["selected_fields"],message:"selected_fields must not be empty while filters are enabled"}),new Set(t.selected_fields).size!==t.selected_fields.length&&n.addIssue({code:"custom",path:["selected_fields"],message:"selected_fields must be unique"}),new Set(t.selected_card_fields).size!==t.selected_card_fields.length&&n.addIssue({code:"custom",path:["selected_card_fields"],message:"selected_card_fields must be unique"})}),jn=y.union([su,y.object({kind:y.literal("product_search_confirmation"),action:y.literal("cancel")}).strict()]),Ht=y.union([y.string().max(255),y.number().finite(),y.boolean()]),iu=y.object({values:y.array(Ht).min(1).max(20).refine(t=>new Set(t.map(n=>`${typeof n}:${String(n)}`)).size===t.length,{message:"values must be unique"})}).strict(),au=y.object({min:y.number().finite().optional(),max:y.number().finite().optional(),include_unlabeled:y.boolean().optional()}).strict().refine(t=>t.min!==void 0||t.max!==void 0||t.include_unlabeled===!0,{message:"a numeric boundary or include_unlabeled is required"}).refine(t=>t.min===void 0||t.max===void 0||t.min<=t.max,{message:"min must not be greater than max"}),ou=y.object({q:y.string().max(200),page:y.number().int().min(1).max(500),page_size:y.union([y.literal(9),y.literal(20)]),sort:y.enum(["published_at_desc","published_at_asc","product_name_asc","product_name_desc"]),filters:y.record(Re,y.union([iu,au])).superRefine((t,n)=>{Object.keys(t).length>12&&n.addIssue({code:"custom",message:"filters must contain at most 12 fields"})}),display_fields:y.array(Re).max(64).default([]),missing_count_fields:y.array(Re).max(12).default([]),relaxation_count_fields:y.array(Re).max(12).default([]),facets:y.array(y.object({field:Re,query:y.string().max(100),page:y.number().int().min(1).max(100),page_size:y.literal(10),include_values:y.array(Ht).max(20)}).strict()).max(8)}).strict(),zo=y.object({value:Ht,label:y.string().max(200),count:y.number().int().nonnegative()}).strict(),ru=y.union([Ht,y.array(Ht).max(50)]),cu=y.object({items:y.array(y.object({id:y.number().int().positive(),thumbnail:y.string().max(2048).nullable(),title:y.string().max(300),summary:y.string().max(2e3),category:y.string().max(300).nullable(),field_values:y.record(Re,ru).default({}),url:y.string().min(1).max(2048)}).strict()).max(20),page:y.object({total:y.number().int().nonnegative(),page:y.number().int().positive(),page_size:y.union([y.literal(9),y.literal(20)])}).strict(),facets:y.array(y.object({field:Re,total:y.number().int().nonnegative(),page:y.number().int().positive(),page_size:y.literal(10),values:y.array(zo).max(10),selected_values:y.array(zo).max(20)}).strict()).max(8),missing_counts:y.record(Re,y.number().int().nonnegative()).default({}),relaxation_counts:y.record(Re,y.number().int().nonnegative()).default({})}).strict(),AR=y.object({contract_version:y.literal(1),request:ou,response:cu}).strict();import{z as $t}from"zod";var mu=["deployment_queued","prepare_source","build_artifact","publish_site","site_released","cleanup_release"],lu=$t.enum(mu),pu=$t.enum(["running","succeeded","failed"]),du=$t.object({code:lu,status:pu,message:$t.string().trim().min(1)}).strict(),Wo=$t.array(du);import{z as T}from"zod";var uu=T.enum(["pending","running","succeeded","failed"]),gu=T.enum(["TASK_FAILED","WEBSITE_UNREACHABLE"]),_u=T.object({task_id:T.string().uuid(),site_url:T.string().url(),crawler_task_id:T.string().min(1).max(255).nullable(),crawler_error_code:gu.nullable().optional(),crawler_failure_stage:T.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]).nullable().optional(),page_count:T.number().int().min(0).max(20),status:uu,error:T.string().nullable(),created_at:T.string().min(1),updated_at:T.string().min(1)}),NR=L(_u),$s=T.enum(["existing_site","new_site"]),Vo=T.enum(["google_indexing","ai_recommendation","qualification_verifiability","content_freshness","inquiry_form","inquiry_response","privacy_compliance","prohibited_content"]),Ys=T.object({label:T.string().trim(),value:T.union([T.string(),T.number(),T.boolean(),T.null()]),summary:T.string().trim(),tone:T.enum(["good","warn","bad","unknown"]),status:T.enum(["ok","unknown"])}),On=T.object({key:T.string().trim().min(1).max(100),label:T.string().trim().min(1).max(100),value:T.union([T.string().max(1e3),T.number(),T.boolean(),T.null()]),tone:T.enum(["good","warn","bad","unknown"]),status:T.enum(["ok","unknown"]),evidence:T.string().trim().max(2e3).optional()}).strict(),hu=T.object({url:T.string().url().max(2048),title:T.string().trim().max(300),words:T.number().int().nonnegative().max(1e7)}).strict(),Su=T.object({site_url:T.string().url().max(2048),scanned_at:T.string().datetime({offset:!0}),reach:T.array(On).max(64),trust:T.array(On).max(64),convert:T.array(On).max(64),safe:T.array(On).max(64),pages:T.array(hu).max(100)}).strict(),Nn=T.object({company_task_id:T.string().min(1).max(128),scan_task_id:T.string().min(1).max(128),type:$s,result:T.object({company_name:T.string(),website:T.string().url().optional(),primary_product:T.string(),current_market:T.string(),qualifications:T.string(),scan_cards:T.record(T.string(),Ys),scan_result:Su.optional()})}),fu=T.object({saved:T.literal(!0),company_task_id:T.string().min(1).max(128),scan_task_id:T.string().min(1).max(128)}),LR=L(fu),bu=T.enum(["snapshot","task"]),yu=Nn.shape.result.extend({type:$s,structured_facts:T.unknown().optional()}).extend({company_name:T.string(),primary_product:T.string(),current_market:T.string(),qualifications:T.string()}),xu=T.object({site_id:T.string().min(1).max(128),company_task_id:T.string().min(1).max(128),scan_task_id:T.string().min(1).max(128),type:$s,data_source:bu,result:yu}),MR=L(xu.nullable());import{z as ue}from"zod";var Qe=ue.enum(["company","product_service","case_qualification","market","contact_inquiry","privacy_compliance","news_freshness"]),Eu=ue.object({ordinal:ue.number().int().min(1).max(1e4),path:ue.string().min(1).max(2048).refine(t=>!Tu(t),{message:"path must be a site-relative path, not an absolute URL"}),last_modified:ue.string().max(64).nullable()}).strict(),FR=ue.object({candidates:ue.array(Eu).min(1).max(1e4),selection_limit:ue.number().int().min(1).max(19)}).strict().superRefine((t,n)=>{let s=t.candidates.map(a=>a.ordinal).sort((a,i)=>a-i);for(let[a,i]of s.entries())if(i!==a+1){n.addIssue({code:"custom",path:["candidates"],message:"candidates ordinals must be unique and consecutive from 1"});return}}),Iu=ue.object({ordinal:ue.number().int().positive().max(1e4),roles:ue.array(Qe).min(1).max(7)}).strict(),Ru=ue.object({role:Qe,status:ue.enum(["selected","not_found"]),selected_ordinals:ue.array(ue.number().int().positive().max(1e4)).max(19)}).strict(),GR=ue.object({selections:ue.array(Iu).max(19),coverage:ue.array(Ru).length(7)}).strict().superRefine((t,n)=>{let s=new Set;for(let[i,r]of t.coverage.entries())s.has(r.role)&&n.addIssue({code:"custom",path:["coverage",i,"role"],message:"coverage roles must be unique"}),s.add(r.role);for(let i of Qe.options)s.has(i)||n.addIssue({code:"custom",path:["coverage"],message:`coverage must include every page role (missing ${i})`});let a=new Map;for(let i of t.selections)for(let r of i.roles){let g=a.get(r)??new Set;g.add(i.ordinal),a.set(r,g)}for(let[i,r]of t.coverage.entries()){let g=a.get(r.role);r.selected_ordinals.some(_=>!g?.has(_))&&n.addIssue({code:"custom",path:["coverage",i,"selected_ordinals"],message:"selected_ordinals must reference selections carrying the same role"})}});function Tu(t){let n=t.toLowerCase();return n.startsWith("http://")||n.startsWith("https://")||t.startsWith("//")}import{z as S}from"zod";var WR=S.object({force_refresh:S.boolean().optional()}),$o=S.enum(["running","succeeded","failed"]),ku=S.object({agent_id:S.string().min(1),name:S.string().min(1),icon:S.string().min(1),capability:S.string().min(1),data_source:S.string().min(1),output_topics:S.string().min(1)}),Pu=S.object({site_mode:S.enum(["existing_site","new_site"]),scan_required:S.boolean(),scheduled_agent_ids:S.array(S.string().min(1)),omitted_agent_ids:S.array(S.string().min(1)),next_stage:S.enum(["diagnostic_report","strategy"])}),wu=S.object({t:S.string(),d:S.string(),evidence:S.object({from:S.string(),url:S.string().nullable().optional(),value:S.string().nullable().optional()})}),Au=S.enum(["complete","partial","insufficient_data","failed"]),vu=S.enum(["ok","failed","insufficient_data"]),Xs=S.object({agent_id:S.string().min(1),name:S.string().min(1),icon:S.string().min(1),status:vu,topics:S.array(S.object({topic_id:S.string().min(1),status:Au,evidence_refs:S.array(S.string())})).length(3),findings:S.array(wu).max(3),elapsed_ms:S.number().nonnegative(),note:S.string().optional(),error:S.string().optional()}),Yo=S.object({total:S.number().int().nonnegative(),ok:S.number().int().nonnegative(),degraded:S.number().int().nonnegative(),total_findings:S.number().int().nonnegative(),elapsed_ms:S.number().nonnegative(),site_mode:S.enum(["existing_site","new_site"]).optional(),scheduled_agent_ids:S.array(S.string()).optional(),omitted_agent_ids:S.array(S.string()).optional(),scheduled:S.number().int().nonnegative().optional(),complete:S.number().int().nonnegative().optional(),partial:S.number().int().nonnegative().optional(),insufficient:S.number().int().nonnegative().optional(),failed:S.number().int().nonnegative().optional(),next_stage:S.enum(["diagnostic_report","strategy"]).optional()}),Cu=S.object({agents_done:S.boolean(),analysis:S.record(S.string(),Xs),step4_scoring_input:S.unknown().optional(),summary:Yo}),Xo=S.object({job_id:S.string().min(1),site_id:S.string().min(1),model_version:S.string().min(1),output_locale:S.string().min(2),cached:S.boolean().optional(),status:$o,result:Cu.nullable().optional(),error:S.string().nullable().optional()}),VR=L(S.array(ku)),HR=L(Pu),$R=L(Xo),YR=L(Xo.nullable()),Be=S.object({id:S.union([S.number().int().nonnegative(),S.string().regex(/^(0|[1-9]\d*)$/u).transform(Number)]).pipe(S.number().int().nonnegative())}),Ho=S.object({percent:S.number().int().min(0).max(100),phase:S.enum(["preparing","analyzing","finalizing","completed","failed"]),stage:S.enum(["queued","baseline_ready","source_pages_ready","external_evidence_ready","knowledge_evidence_ready","page_evidence_ready","analysis_context_ready","preparation_saved","workflow_ready","agent_started","agent_completed","workflow_completed","scoring_input_ready","red_texts_ready","result_ready","result_persisted","completed","failed"]),agents_done:S.number().int().nonnegative(),agents_total:S.number().int().nonnegative(),agent_id:S.string().min(1).optional()}),XR=S.discriminatedUnion("event",[Be.extend({event:S.literal("snapshot"),data:S.object({job_id:S.string().min(1),status:$o,done:S.number().int().nonnegative(),total:S.number().int().nonnegative(),results:S.array(Xs),progress:Ho.optional()})}),Be.extend({event:S.literal("progress"),data:Ho}),Be.extend({event:S.literal("preparing_started"),data:S.object({stage:S.literal("baseline")})}),Be.extend({event:S.literal("preparing_progress"),data:S.object({stage:S.enum(["context","external_evidence"])})}),Be.extend({event:S.literal("preparing_done"),data:S.object({evidence_count:S.number().int().nonnegative(),rule_count:S.number().int().nonnegative(),degraded_capabilities:S.array(S.string())})}),Be.extend({event:S.literal("agent_start"),data:S.object({agent_id:S.string().min(1),name:S.string().min(1),icon:S.string().min(1)})}),Be.extend({event:S.literal("agent_done"),data:Xs}),Be.extend({event:S.literal("done"),data:S.object({agents_done:S.literal(!0),summary:Yo})}),Be.extend({event:S.literal("failed"),data:S.object({message:S.string().min(1)})})]);import{z as C}from"zod";var Zs=C.enum(["reach","trust","convert","safe"]),ye=C.number().finite(),Du=C.number().finite().positive(),Qs=["reach","trust","convert","safe"],ju=17,Ou=C.enum(["passed","partial","failed"]),Nu=C.object({landing_page_mode:C.enum(["intent_dynamic","static","none"]),ab_test_enabled:C.boolean()}).strict(),Lu=C.union([C.boolean(),C.number().finite(),Ou,Nu]).nullable(),Mu=C.union([C.boolean(),C.number().finite()]).nullable(),Uu=C.object({competitor_avg:C.number().finite(),score_items:C.record(C.string(),Lu),penalty_items:C.record(C.string(),Mu),red_texts:C.array(C.string())}).strict(),qu=C.record(Zs,Uu),Fu=C.object({key:Zs,score:ye,pass_score:ye,gap:ye}),Gu=C.object({key:C.string(),title:C.string(),is_redline_option:C.boolean().optional(),score:ye,max_score:Du,pass_score:ye,passed:C.boolean(),description:C.string()}),zu=C.object({key:Zs,title:C.string(),alias:C.string(),slogan:C.string(),score:ye,max_score:C.literal(100),pass_score:ye,competitor_average:ye,status:C.enum(["reached","near","not_reached"]),status_name:C.enum(["\u8FBE\u6807","\u63A5\u8FD1","\u672A\u8FBE\u6807"]),summary:C.string(),sub_dimensions:C.array(Gu),red_texts:C.array(C.string()),redline_hit:C.boolean().optional()}),Ku=C.object({id:C.number().int().positive(),task_code:C.string().min(1).max(128),is_sync:C.literal(0),status:C.literal("succeeded"),rules:qu,scores_list:C.object({overview:C.object({pass_scores:C.object({reach:ye,trust:ye,convert:ye,safe:ye}),total_score:ye,total_pass_score:ye,score_gap:ye,competitor_average_score:ye,scoring_criteria_text:C.string().min(1),gap_dimensions:C.array(Fu).max(4),overall_passed:C.boolean(),all_scores_passed:C.boolean(),diagnosis_passed:C.boolean(),commitment_eligible:C.boolean(),safe_redline_hit:C.boolean()}),dimensions:C.array(zu).length(4)}),created_at:C.string().datetime({offset:!0}),updated_at:C.string().datetime({offset:!0})}).superRefine((t,n)=>{Bu(t.scores_list.dimensions)||n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include each canonical score dimension."}),t.scores_list.dimensions.reduce((a,i)=>a+i.sub_dimensions.length,0)!==ju&&n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include 17 subdimensions in total."});for(let[a,i]of t.scores_list.dimensions.entries()){if(i.redline_hit===void 0)continue;let r=i.sub_dimensions.findIndex(g=>g.is_redline_option===void 0);r!==-1&&n.addIssue({code:"custom",path:["scores_list","dimensions",a,"sub_dimensions",r,"is_redline_option"],message:"subdimensions must define is_redline_option when redline_hit is defined."})}}),eT=L(Ku);function Bu(t){let n=t.map(s=>s.key);return n.length===Qs.length&&new Set(n).size===Qs.length&&Qs.every(s=>n.includes(s))}var Ze={queued:["preparing_source","lock_failed","deploy_failed"],preparing_source:["building","source_prepare_failed","deploy_failed"],building:["artifact_ready","build_failed","artifact_fetch_failed","artifact_validation_failed","deploy_failed"],artifact_ready:["deploying","deploy_failed"],deploying:["released","deploy_failed"],released:[],lock_failed:[],source_prepare_failed:[],build_failed:[],artifact_fetch_failed:[],artifact_validation_failed:[],deploy_failed:[],cleanup_failed:[]};for(let t of Object.values(Ze))Object.freeze(t);Object.freeze(Ze);var sT=Object.freeze(bt.filter(t=>Ze[t].length>0)),iT=Object.freeze(bt.filter(t=>Ze[t].length===0)),Wu=Object.freeze(["preparing_source","building","artifact_ready","deploying","released"]),Vu="DEPLOYMENT_TRANSITION_INVALID",Js=class extends Error{constructor(n,s){super(`Invalid deployment transition: ${n} -> ${s}`),this.currentStatus=n,this.nextStatus=s,this.code=Vu,this.name="DeploymentTransitionError"}};function aT(t){return Ze[t]}function oT(t){return bt.filter(n=>Ze[n].some(s=>s===t))}function Hu(t){return Ze[t].length>0}function rT(t){return!Hu(t)}function cT(t,n){if(!Ze[t].some(s=>s===n))throw new Js(t,n);return n}function mT(){return Wu}import{z as $u}from"zod";var dT=".i18n.json",Ln="translation",Qo=new Set(["__proto__","constructor","prototype"]);function Jo(t){if(!Mn(t)||Object.keys(t).length===0)return Je("I18N_ROOT_INVALID","Component i18n resources must be a non-empty object.",[]);for(let[n,s]of Object.entries(t)){if(Qo.has(n))return Zo([n]);if(!Yu(n))return Je("I18N_LOCALE_INVALID",`Component i18n locale must be canonical BCP-47: ${n}`,[n]);if(!Mn(s))return Je("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let a=Object.keys(s);if(a.length!==1||a[0]!==Ln)return Je("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let i=s[Ln];if(!Mn(i))return Je("I18N_RESOURCE_TREE_INVALID",`Component i18n translation namespace for ${n} must be an object.`,[n,Ln]);let r=[{value:i,path:[n,Ln]}];for(;r.length>0;){let g=r.pop();for(let[c,_]of Object.entries(g.value)){let j=[...g.path,c];if(Qo.has(c))return Zo(j);if(typeof _!="string"){if(!Mn(_))return Je("I18N_RESOURCE_TREE_INVALID","Component i18n resource leaves must be strings.",j);r.push({value:_,path:j})}}}}return{success:!0,data:t}}function uT(t){let n;try{n=JSON.parse(t)}catch{return Je("I18N_JSON_INVALID","Component i18n resource file must contain valid JSON.",[])}return Jo(n)}var gT=$u.custom(t=>Jo(t).success,"Invalid component i18n resources.");function Yu(t){try{let n=Intl.getCanonicalLocales(t);return n.length===1&&n[0]===t}catch{return!1}}function Mn(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null}function Zo(t){return Je("I18N_RESOURCE_KEY_FORBIDDEN",`Component i18n resource key is forbidden: ${t.at(-1)??""}`,t)}function Je(t,n,s){return{success:!1,error:{code:t,message:n,path:s}}}var We="products",Xu=`/${We}`,hT=Xu,ST=`${We} detail`,fT="cms_collection_view",bT="list",yT="detail",Me={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"}},Qu=new Set(Object.values(Me).map(t=>t.pageTitle)),Zu=new Set(Object.values(Me).flatMap(t=>[t.blockLabel,t.detailBlockLabel,t.heroBlockLabel]));function xT(t){let n=t?.trim().toLowerCase()??"";if(n==="zh-tw"||n==="zh-hk"||n==="zh-mo")return Me.zhHant;if(n.startsWith("zh"))return Me.zhHans;switch(n.split("-")[0]){case"de":return Me.de;case"fr":return Me.fr;case"es":return Me.es;case"ja":return Me.ja;case"ko":return Me.ko;case"en":default:return Me.en}}function ET(t){return Qu.has(t.trim())}function IT(t){return Zu.has(t.trim())}import{z as ge}from"zod";var PT=ge.object({key:ge.string().min(1),composition:ne}).strict(),qn=ge.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),Ju=ge.enum(["direct","proxy","upstream","readonly","unsupported"]),eg=ge.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),Un=ge.object({mode:Ju,reasonCode:ge.string().min(1).optional()}),tg=ge.object({kind:eg,message:ge.string().min(1)}),Fn=ge.object({composition:M,key:ge.string().min(1),canUpdateText:ge.boolean(),canInsertChild:ge.boolean(),canMove:ge.boolean(),canRemove:ge.boolean(),editModes:ge.object({updateText:Un.optional(),insertChild:Un.optional(),move:Un.optional(),remove:Un.optional()}).optional(),constraints:ge.array(tg)}).strict();import{z as K}from"zod";var OT=K.discriminatedUnion("type",[K.object({type:K.literal("site-edit.document.changed"),siteId:I,snapshotId:x,composition:M,version:K.number().int().nonnegative(),at:K.string().min(1)}).strict(),K.object({type:K.literal("site-edit.operation.planned"),siteId:I,operationId:K.string().min(1),baseSnapshotId:x,composition:M,changedFiles:K.array(K.string().min(1)),at:K.string().min(1)}).strict(),K.object({type:K.literal("site-edit.operation.completed"),siteId:I,composition:M,result:Fs,at:K.string().min(1)}).strict(),K.object({type:K.literal("site-edit.operation.failed"),siteId:I,composition:M,requestId:K.string().min(1),error:Ao,at:K.string().min(1)}).strict(),K.object({type:K.literal("site-edit.capability.changed"),siteId:I,composition:M,keys:K.array(K.string().min(1)),at:K.string().min(1)}).strict(),K.object({type:K.literal("site-edit.graph.invalidated"),siteId:I,composition:M,at:K.string().min(1)}).strict(),K.object({type:K.literal("site-edit.graph.ready"),siteId:I,composition:M,version:K.number().int().nonnegative(),at:K.string().min(1)}).strict(),K.object({type:K.literal("site-edit.graph.error"),siteId:I,composition:M,message:K.string().min(1),at:K.string().min(1)}).strict()]);import{z as Z}from"zod";var UT="durable-history-v1",Gn=Z.object({initiatingComposition:M.optional(),affectedCompositions:Z.array(M)}).strict(),qT=Z.enum(["writable","read-only-recovery","unavailable"]),ng=Z.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),sg=Z.object({code:ng,message:Z.string().min(1),occurredAt:Z.iso.datetime().optional()}).strict(),ig=Z.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),er={revision:Z.number().int().nonnegative(),undoDepth:Z.number().int().nonnegative(),redoDepth:Z.number().int().nonnegative()},ag=Z.object({mode:Z.literal("writable"),composition:M,...er,canUndo:Z.boolean(),canRedo:Z.boolean(),provenance:Gn.optional()}).strict().superRefine((t,n)=>{t.canUndo!==t.undoDepth>0&&n.addIssue({code:"custom",path:["canUndo"],message:"canUndo must reflect undoDepth."}),t.canRedo!==t.redoDepth>0&&n.addIssue({code:"custom",path:["canRedo"],message:"canRedo must reflect redoDepth."})}),og=Z.object({mode:Z.literal("read-only-recovery"),composition:M,...er,canUndo:Z.literal(!1),canRedo:Z.literal(!1),recoveryDiagnostic:sg,provenance:Gn.optional()}).strict(),rg=Z.object({mode:Z.literal("unavailable"),composition:M,revision:Z.literal(0),undoDepth:Z.literal(0),redoDepth:Z.literal(0),canUndo:Z.literal(!1),canRedo:Z.literal(!1),reason:ig,provenance:Gn.optional()}).strict(),cg=Z.discriminatedUnion("mode",[ag,og,rg]),FT=Z.object({composition:M,status:cg,provenance:Gn}).strict();import{z as _e}from"zod";var mg=_e.string().min(1).refine(t=>!t.startsWith("/")&&!t.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),lg=_e.string().regex(/^sha256:[a-f0-9]{64}$/),pg=_e.object({path:mg,operation:_e.enum(["create","update","delete"]),expectedHash:lg.optional(),fullContent:_e.string().optional()}).superRefine((t,n)=>{t.operation==="delete"&&t.fullContent!==void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"delete patches must not include fullContent"}),t.operation!=="delete"&&t.fullContent===void 0&&n.addIssue({code:"custom",path:["fullContent"],message:"create/update patches must include fullContent"})}),dg=_e.object({siteId:I,baseSnapshotId:x,operationId:_e.string().min(1),reason:_e.string().min(1),patches:_e.array(pg).min(1),changedCompositions:_e.array(M),changedRouteIds:_e.array(_e.string().min(1)).optional(),diagnostics:_e.array(_e.object({code:_e.string().min(1),message:_e.string().min(1),path:_e.string().min(1).optional()})).default([])}).strict().superRefine((t,n)=>{let s=new Set;for(let[i,r]of t.patches.entries())s.has(r.path)&&n.addIssue({code:"custom",path:["patches",i,"path"],message:`Duplicate patch path: ${r.path}`}),s.add(r.path);let a=[...new Set(t.changedCompositions.map(i=>i.routeId))];t.changedRouteIds!==void 0&&(t.changedRouteIds.length!==a.length||t.changedRouteIds.some((i,r)=>i!==a[r]))&&n.addIssue({code:"custom",path:["changedRouteIds"],message:"changedRouteIds must be the stable deduplicated route projection of changedCompositions."})}),WT=dg.transform(t=>({...t,changedRouteIds:[...new Set(t.changedCompositions.map(n=>n.routeId))]}));var ei="::repeat-item#";function ug(t,n){return`${t}${ei}${n}`}function HT(t,n){return n.reduce((s,a)=>ug(s,a),t)}function gg(t){if(typeof t!="string"||t.length===0)return null;let n=[],s=t;for(;;){let a=s.lastIndexOf(ei);if(a<0)break;let i=Number(s.slice(a+ei.length));if(!Number.isInteger(i)||i<0)return null;n.unshift({repeatIndex:i}),s=s.slice(0,a)}return!s||n.length===0?null:{baseKey:s,parts:n}}function $T(t){return gg(t)?.baseKey??t??null}import{z as m}from"zod";import{z as Ee}from"zod";var _g=Ee.object({placementKey:Ee.string().min(1),placementUnitKey:Ee.string().min(1),relation:Ee.enum(["before","after","prepend","append"])}).strict(),hg=Ee.object({status:Ee.literal("supported"),containerKey:Ee.string().min(1),hasBusinessMembers:Ee.boolean(),placementUnitKeys:Ee.array(Ee.string().min(1)),placements:Ee.array(_g)}).strict().superRefine((t,n)=>{let s=new Set(t.placementUnitKeys);s.size!==t.placementUnitKeys.length&&n.addIssue({code:"custom",path:["placementUnitKeys"],message:"Render page composition placement unit keys must be unique."});let a=new Set;t.placements.forEach((i,r)=>{a.has(i.placementKey)&&n.addIssue({code:"custom",path:["placements",r,"placementKey"],message:"Render page composition placement keys must be unique."}),a.add(i.placementKey),s.has(i.placementUnitKey)||n.addIssue({code:"custom",path:["placements",r,"placementUnitKey"],message:"Render page composition placement must reference a projected unit."})})}),Sg=Ee.object({status:Ee.literal("unsupported"),reason:vn,diagnostics:Ee.array(Kt)}).strict(),tr=Ee.discriminatedUnion("status",[hg,Sg]);var fg=m.object({canUpdateText:m.boolean(),canInsertChild:m.boolean(),canMove:m.boolean(),canRemove:m.boolean()}),nr=m.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),bg=m.enum(["cms-field","api-field"]),yg=m.enum(["text","attribute","richtext","repeat-region","conditional-region","component-prop"]),xg=m.enum(["exact","safe-derived","partial","unknown"]),Eg=m.object({file:m.string().min(1),symbol:m.string().min(1).optional(),reason:m.string().min(1)}),Ig=m.object({sourceKind:nr,sourceType:bg,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:yg,targetName:m.string().min(1),confidence:xg,readonly:m.literal(!0),evidence:m.array(Eg)}),sr=m.object({hasDynamicData:m.boolean(),bindings:m.array(Ig)}),ir=m.object({hasDynamicData:m.boolean(),sourceKinds:m.array(nr),primaryEndpoint:m.string().min(1).optional(),primaryCollection:m.string().min(1).optional(),primaryFieldPath:m.string().min(1).optional()}),Rg=m.object({key:m.string().min(1),pageCompositionUnitKey:m.string().min(1).optional(),operationSummary:fg,dynamicDataSummary:ir.optional()}).strict(),mk=m.object({composition:ne}).strict(),lk=m.object({key:m.string().min(1),composition:ne}).strict(),pk=m.object({siteId:I,snapshotId:x,composition:M,version:m.number().int().nonnegative(),entries:m.array(Rg),pageComposition:tr}).strict(),ti=m.enum(["api-field","cms-field","i18n-message","config-entry"]),ar=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()}),ni=m.object({index:m.number().int().min(0),value:m.string(),editable:m.boolean(),source:ar.nullable()}),Yt=m.object({key:m.string().min(1),label:m.string().min(1),tag:m.string().min(1)}),dk=m.object({composition:M,key:m.string().min(1),canUpdateText:m.boolean(),canInsertChild:m.boolean(),canMove:m.boolean(),canRemove:m.boolean(),boundaryKind:qn.nullable(),isOpaque:m.boolean()}).strict(),Tg=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()}),kg=m.object({kind:m.enum(["jsx-node","value-path","route-export","external-entry"]),file:m.string().min(1).optional(),isProxy:m.boolean(),displayPath:m.string().min(1).optional(),sourceType:ti.optional(),sourceId:m.string().min(1).optional()}),or=m.object({kind:m.union([m.enum(["jsx-literal","component-prop","binding","imported-binding","object-field","array-item","repeat-template","conditional-branch"]),ti]),file:m.string().min(1),displayPath:m.string().min(1),externalSource:m.object({sourceType:ti,sourceId:m.string().min(1),adapterId:m.string().min(1).optional()}).optional()}),Pg=m.object({kind:or.shape.kind,file:m.string().min(1),displayName:m.string().min(1),canEditHere:m.boolean()}),Xt=m.object({finalSource:or.nullable(),chain:m.array(Pg),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)}))}),wg=m.object({kind:m.literal("css-style-model"),properties:m.array(m.object({property:To,value:m.union([m.string(),m.number(),m.boolean(),m.null()]),resolvedValue:m.union([m.string(),m.number(),m.boolean(),m.null()]).optional(),breakpoint:Po.optional(),state:ko.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(Bt).optional()}))}),uk=m.union([m.record(m.string(),m.unknown()),wg]),rr=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(Bt),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()}),Ag=m.object({startLine:m.number().int().positive(),startColumn:m.number().int().nonnegative(),endLine:m.number().int().positive(),endColumn:m.number().int().nonnegative()}),si=m.object({sourceFile:m.string().min(1),componentName:m.string().min(1),openingElementRange:Ag,structuralPath:m.string().min(1),textPreview:m.string().min(1).optional()}),gk=m.object({composition:M,key:m.string().min(1),tag:m.string().min(1),componentName:m.string().min(1),sourceFile:m.string().min(1),sourceLocator:si.optional(),label:m.string().min(1),capabilities:Fn,writeTarget:Tg,effectiveWriteTarget:kg.optional(),provenanceChain:Xt.optional(),componentSemantic:m.record(m.string(),m.unknown()).optional(),contentModel:m.record(m.string(),m.unknown()).optional(),mediaModel:m.record(m.string(),m.unknown()).optional(),styleSource:rr.optional(),conditional:m.record(m.string(),m.unknown()).optional(),dynamicData:sr.optional(),textSegments:m.array(ni),boundaryKind:qn.nullable(),isOpaque:m.boolean(),ancestors:m.array(Yt),children:m.array(Yt),siblings:m.array(Yt)}).strict(),_k=m.object({composition:M,key:m.string().min(1),tag:m.string().min(1),label:m.string().min(1),sourceLocator:si.optional(),capabilities:m.object({constraints:Fn.shape.constraints}),isOpaque:m.boolean(),provenanceChain:m.object({editMode:Xt.shape.editMode,diagnostics:Xt.shape.diagnostics}).optional(),dynamicDataSummary:ir.optional(),ancestors:m.array(Yt)}).strict(),hk=m.object({composition:M,key:m.string().min(1),tag:m.string().min(1),label:m.string().min(1),sourceLocator:si.optional(),isOpaque:m.boolean(),ancestors:m.array(Yt),componentName:m.string().min(1),sourceFile:m.string().min(1),capabilities:Fn,provenanceChain:m.object({editMode:Xt.shape.editMode,diagnostics:Xt.shape.diagnostics}).optional(),textSegments:m.array(m.object({index:ni.shape.index,editable:ni.shape.editable,sourceKind:ar.shape.kind.nullable()})),dynamicData:sr.optional(),boundaryKind:qn.nullable()}).strict(),Sk=m.object({composition:M,key:m.string().min(1),mediaModel:m.record(m.string(),m.unknown()).optional(),styleSource:rr.optional()}).strict();var vg=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],Cg=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],Dg=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],jg=new Set(vg),Og=new Set(Cg),Ng=new Set(Dg),Lg={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function bk(t){return jg.has(ii(t))}function Mg(t){return Og.has(ii(t))}function Ug(t){return Ng.has(ii(t))}function yk(t){let{operationSummary:n}=t;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:t.fallbackMode!=="preview"?{...Lg}:{canUpdateText:Ug(t.tagName),canInsertChild:Mg(t.tagName),canMove:!1,canRemove:!1}}function ii(t){return t?.trim().toLowerCase()??""}import{z as qg}from"zod";var Tk=qg.object({composition:ne,mutationContext:Gt.optional()}).strict();var Pk={PATCH_VALIDATION_FAILED:"The code didn't pass validation. Try describing the change more specifically.",PATCH_BATCH_FAILED:"The site code couldn't be generated. Please regenerate the site.",PATCH_BATCH_INVALID:"The change couldn't be applied. Try simpler instructions.",VALIDATION_FAILED:"Your message couldn't be sent as written. Please edit it and try again.",WORKSPACE_MESSAGE_CONTAINS_SECRET:"Your message looks like it contains a secret or token, so it wasn't sent. Remove it and try again.",WORKSPACE_TOOL_RESULT_INVALID:"This change couldn't be completed and was rolled back. Please try again.",WORKSPACE_TOOL_FAILED:"A tool step failed. Please try again.",WORKSPACE_TOOL_RESULT_MISSING:"The tool didn't return a usable result. Please try again.",WORKSPACE_MODEL_STREAM_FAILED:"The model stream ended unexpectedly. Please try again.",WORKSPACE_MODEL_STREAM_ABORTED:"Generation was interrupted before finishing. Please try again.",MODEL_OUTPUT_TRUNCATED:"The response was too long and was cut off before any change was applied. Try again, or split the request into smaller changes.",WORKSPACE_EDIT_NOT_APPLIED:"No change was applied. Try describing the change differently.",PRODUCT_SEARCH_APPLY_NOT_AVAILABLE:"Product search changes aren't available yet. Please try again later.",WORKSPACE_INITIAL_EXECUTION_FAILED:"Initial generation failed. Please retry from the brief.",WORKSPACE_INITIAL_GENERATION_CHECK_FAILED:"Initial generation could not be verified. Please retry.",WORKSPACE_INITIAL_GENERATION_FINALIZE_FAILED:"Initial generation could not finalize. Please retry.",WORKSPACE_INITIAL_GENERATION_QUALITY_GATE_FAILED:"Initial generation failed quality checks. Please regenerate the site.",WORKSPACE_ITERATION_QUALITY_GATE_FAILED:"Quality check failed. The change was rolled back; try a smaller or more specific request.",WORKSPACE_SOCKET_DEAD:"The workspace connection was lost. Please retry.",WORKSPACE_RUN_CANCELLED:"The run was cancelled.",WORKSPACE_RUN_ABANDONED:"This run was interrupted and did not finish. Please try again.",WORKSPACE_RUN_REQUEST_FAILED:"Couldn't start the workspace. Please try again.",WORKSPACE_RUN_BAD_RESPONSE:"The server response was malformed. Please try again.",WORKSPACE_SOCKET_UNAVAILABLE:"Workspace connection unavailable. Please try again.",WORKSPACE_SOCKET_ERROR:"The workspace connection had an error. Please try again.",WORKSPACE_SOCKET_CLOSED:"The workspace connection closed. Please try again.",WORKSPACE_SOCKET_OPEN_TIMEOUT:"Couldn't reach the workspace in time. Please try again.",WORKSPACE_CLIENT_MESSAGE_ID_MISSING:"Something went wrong sending your message. Please try again.",SITE_SNAPSHOT_REQUIRED:"This site has no usable snapshot yet. Complete Step 3 first.",AGENT_TIMEOUT:"That took longer than expected. Try breaking the change into smaller pieces.",SANDBOX_NOT_AVAILABLE:"The preview environment isn't ready. Your edits have still been saved.",PREVIEW_BUILD_FAILED:"Preview is available, but the production build failed. Fix the reported build error before deploying.",PREVIEW_BUILD_NOT_CONFIGURED:"Preview is available, but the production build check is not configured.",PREVIEW_BUILD_SANDBOX_NOT_FOUND:"Preview is available, but the build check could not find the active preview sandbox.",WS_CONNECTION_ERROR:"Connection lost. Reconnecting\u2026",USER_MESSAGE_PERSIST_FAILED:"Your message wasn't saved. Please send it again.",CLARIFICATION_REPLY_STALE:"That question has expired. Please tell me what you'd like to do now.",CLARIFY_MODEL_FAILED:"Clarify couldn't finish generating questions. Please try again.",WORKSPACE_RUN_IN_FLIGHT:"Another session is already running. Please try again in a moment.",SITE_OPERATION_LOCKED:"Another change is already running for this site. Wait for it to finish, then try again.",EDIT_ENGINE_VERSION_INVALID:"Invalid editor version. Refresh the page and try again.",SANDBOX_DEPENDENCY_SYNC_FAILED:"The preview runtime could not be prepared. Please try again.",SANDBOX_PREVIEW_FAILED:"The site preview failed to start. Please try again.",SANDBOX_DEPENDENCY_VERSION_MISMATCH:"The preview runtime could not be verified. Please try again.",SANDBOX_RUNTIME_NOT_READY:"The preview needs to be refreshed before this change can be applied. Refresh the preview and try again.",GENERIC:"Something went wrong. Please try again."},wk={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."},Ak={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},vk={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var cr="0.8.4",Dk="x-vcp-edit-engine-version",jk="x-vcp-edit-engine-version-source",ai=class extends Error{constructor(n="Invalid edit-engine version."){super(n),this.code="EDIT_ENGINE_VERSION_INVALID",this.name="EditEngineVersionParseError"}},Fg=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/;function Gg(t){return Fg.test(t)}function zg(t){if(typeof t!="string"||!Gg(t))throw new ai;return t}function Ok(t){return t==null?{version:cr,source:"fallback_current"}:{version:zg(t),source:"explicit"}}function Nk(){return{version:cr,source:"system_current"}}import{z as Ne}from"zod";var Kg=200,Bg=200;function Wg(t){let n=t.indexOf(":");if(n<=0)return null;let s=t.slice(0,n).trim(),a=t.slice(n+1).trim();return s.length===0||a.length===0?null:{source:s,target:a}}var Vg=Ne.string().min(3).max(Kg).refine(t=>Wg(t)!==null,{message:'glossary entries must be "source:target" pairs split on a half-width colon, e.g. "\u7C73:Rice"'}),Uk=Ne.array(Vg).max(Bg),qk=Ne.object({website_name:Ne.string().min(1).max(200),website_industry:Ne.string().min(1).max(200).optional(),website_description:Ne.string().min(1).max(1e3).optional()}),Hg=Ne.enum(["regional","fonts_only"]),zn=Ne.string().regex(/^#[0-9a-fA-F]{6}$/,'color must be a "#rrggbb" value'),$g=Ne.object({primary:zn.optional(),accent:zn.optional(),foreground:zn.optional(),neutral:zn.optional()}),Yg=600,Fk=Ne.object({mode:Hg.default("regional"),seeds:$g.optional(),note:Ne.string().min(1).max(Yg).optional()}),Gk={mode:"regional"};function zk(t){return t===void 0?!1:Object.values(t).some(n=>typeof n=="string"&&n.length>0)}import{z as Te}from"zod";var Xg=Te.string().trim().min(1),It=Te.string().uuid(),Qg=Te.string().min(1).max(2048).refine(t=>t.startsWith("/")||t.includes("\\")?!1:t.split("/").every(n=>n.length>0&&n!=="."&&n!==".."),"object_key must be a relative snapshot store path without empty, '.' or '..' segments"),mr=Te.object({snapshot_id:It,object_key:Qg}),Wk=Te.object({tenant_id:Xg,parent_site_id:It,subsite_site_id:It,base:mr,target:mr}),Vk=Te.object({subsite_site_id:It,pending_pages:Te.array(Te.string().min(1)),hash_diverged_count:Te.number().int().nonnegative(),child_only_count:Te.number().int().nonnegative(),base_snapshot_id:It,target_snapshot_id:It}),Zg=Te.enum(["SUBSITE_DIFF_REQUEST_INVALID","SUBSITE_DIFF_STORE_NOT_CONFIGURED","SUBSITE_DIFF_MANIFEST_MISSING","SUBSITE_DIFF_MANIFEST_INVALID"]),Hk=Te.object({error_code:Zg,message:Te.string().min(1),side:Te.enum(["base","target"]).optional()});import{z as ce}from"zod";var Qk=ce.object({tenant_id:ce.string().min(1),site_id:I,snapshot_id:x,manifest_hash:ce.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:ce.string().min(1).max(2048),page_slug:ce.string().max(512).optional()}),Zk=ce.object({site_id:I,snapshot_id:x,unit_count:ce.number().int().nonnegative(),file_count:ce.number().int().nonnegative(),markdown:ce.string().min(1),page_slug:ce.string().optional(),page_file:ce.string().optional(),entries:ce.array(ce.object({id:ce.string().min(1),file_path:ce.string().min(1),line:ce.number().int().nullable(),kind:ce.string().min(1),text:ce.string(),media_key:ce.string().optional()})).optional()});import{z as Jg}from"zod";var e_=/^\/[a-z0-9][a-z0-9-]{0,30}$/,t_=Object.freeze(["api","_next","assets","static","robots.txt","sitemap.xml",".well-known"]),n_=new Set(t_);function s_(t){return n_.has(t)}var t1=Jg.string().regex(e_).refine(t=>!s_(t.slice(1)),{message:"mount_path must not use a reserved segment (api, _next, assets, static, robots.txt, sitemap.xml, .well-known)"});import{z as se}from"zod";var i_=se.enum(["active","paused","blocked"]),lr=se.enum(["typecheck_failed","health_failed","validation_failed"]),a_={status:i_,attempts:se.number().int().nonnegative(),attempted_template_version:Oe.nullable(),last_error_code:lr.nullable()},Rt=se.object(a_).strict(),Kn=se.object({template_id:se.string().trim().min(1),target_template_version:Oe}).strict(),a1=Kn,o_=se.discriminatedUnion("action",[se.object({action:se.literal("proceed"),state:Rt.extend({status:se.literal("active")})}).strict(),se.object({action:se.literal("skip_not_newer"),state:Rt.extend({status:se.literal("active")})}).strict(),se.object({action:se.literal("skip_paused"),state:Rt.extend({status:se.literal("paused")})}).strict(),se.object({action:se.literal("skip_blocked"),state:Rt.extend({status:se.literal("blocked")})}).strict()]),o1=Kn,r1=o_,c1=Kn.extend({error_code:lr}),m1=se.object({state:Rt}).strict(),l1=Kn,p1=se.object({state:Rt}).strict();import{z as U}from"zod";var r_=744*60*60*1e3,c_=U.enum(["eligible","fast_path","upgraded","skipped","lock_skipped","cas_aborted","validation_failed","blocked","paused"]),m_=U.enum(["typecheck","build","health","validation"]),l_=U.enum(["not_attempted","promoted","aborted"]),h1=U.object({template_id:U.string().trim().min(1).max(128),from_version:Oe.nullable(),to_version:Oe,outcome:c_,attempt:U.number().int().nonnegative().max(2147483647),duration_ms:U.number().int().nonnegative().max(2147483647),replaced_group_count:U.number().int().nonnegative().max(2147483647),skipped_group_count:U.number().int().nonnegative().max(2147483647),validation_stage:m_.nullable(),cas_outcome:l_.nullable()}).strict(),S1=U.object({recorded:U.literal(!0)}).strict(),pr=U.object({from:U.iso.datetime(),to:U.iso.datetime()}).strict().refine(({from:t,to:n})=>Date.parse(t)<Date.parse(n),{message:"from must be earlier than to",path:["to"]}).refine(({from:t,to:n})=>Date.parse(n)-Date.parse(t)<=r_,{message:"report window must not exceed 31 days",path:["to"]}),f1=pr,p_=U.object({eligible:U.number().int().nonnegative(),fast_path:U.number().int().nonnegative(),upgraded:U.number().int().nonnegative(),skipped:U.number().int().nonnegative(),lock_skipped:U.number().int().nonnegative(),cas_aborted:U.number().int().nonnegative(),validation_failed:U.number().int().nonnegative(),blocked:U.number().int().nonnegative(),paused:U.number().int().nonnegative()}).strict(),b1=U.object({window:pr,outcome_counts:p_,current_state_counts:U.object({blocked:U.number().int().nonnegative(),paused:U.number().int().nonnegative()}).strict(),duration_ms:U.object({p50:U.number().int().nonnegative().nullable(),p95:U.number().int().nonnegative().nullable(),sample_count:U.number().int().nonnegative()}).strict()}).strict(),y1=U.object({older_than:U.iso.datetime(),limit:U.coerce.number().int().min(1).max(200).default(50),include_candidates:U.enum(["true","false"]).default("false").transform(t=>t==="true")}).strict(),d_=U.object({site_id:I,snapshot_id:x,status:U.enum(["candidate","deleting"]),created_at:U.iso.datetime()}).strict(),x1=U.object({snapshots:U.array(d_)}).strict();import{z as Ve}from"zod";var u_=Ve.enum(["PREVIEW_SESSION_NOT_FOUND","PREVIEW_SESSION_INVALID","PREVIEW_SESSION_STALE","PREVIEW_SESSION_LOOKUP_FAILED","PREVIEW_SANDBOX_NOT_FOUND","PREVIEW_SANDBOX_CONNECT_FAILED","PREVIEW_SANDBOX_OWNERSHIP_MISMATCH","PREVIEW_ACTIVATION_TIMEOUT","PREVIEW_PREFLIGHT_FAILED","PREVIEW_ENV_LOOKUP_FAILED","PREVIEW_SERVER_START_FAILED","PREVIEW_HEALTH_CHECK_FAILED","SANDBOX_NOT_CONFIGURED"]),g_=Ve.object({status:Ve.literal("ready"),preview_url:Ve.string().url()}).strict(),__=Ve.object({status:Ve.literal("failed"),code:u_,message:Ve.string().min(1),retryable:Ve.boolean()}).strict(),R1=Ve.discriminatedUnion("status",[g_,__]);import{z as oe}from"zod";var v1="build-context.json",C1=2e5,dr=oe.string().regex(/^sha256:[a-f0-9]{64}$/u),ur=1e3;function h_(t){return Array.from(t).length<=ur}var S_=oe.object({kind:oe.enum(["customer_materials","website_scan_diagnosis","committed_strategy"]),digest:dr}).strict(),f_=oe.object({schema_version:oe.literal(1),flow_type:Cn,sources:oe.array(S_).min(2).max(2)}).strict().superRefine((t,n)=>{let s=new Set(t.sources.map(i=>i.kind)),a=t.flow_type==="with_website"?["website_scan_diagnosis","committed_strategy"]:["customer_materials","committed_strategy"];(s.size!==a.length||a.some(i=>!s.has(i)))&&n.addIssue({code:"custom",path:["sources"],message:"Site-build provenance sources must match the persisted workflow flow."})}),b_=oe.object({schema_version:oe.literal(1),seed:dr.optional(),cms_settings:oe.object({main_products:oe.string().trim().min(1).refine(h_,{message:`main_products must contain at most ${ur} characters`}).optional()}).strict().optional(),provenance:f_.optional()}).strict(),y_=oe.object({schema_version:oe.literal(1),site_id:I,workflow_id:Le,brief:oe.string().min(1),source:oe.enum(["business_provider","mock"]),payload:b_}).strict().superRefine((t,n)=>{t.source==="business_provider"&&!t.payload.provenance&&n.addIssue({code:"custom",path:["payload","provenance"],message:"Business site-build context requires persisted provenance."})}),D1=oe.object({source_snapshot_id:x,source_run_id:V,build_context:y_,page_slugs:oe.array(oe.string().min(1)).optional()}).strict(),j1=oe.object({disposition:oe.enum(["reused","rebased"]),snapshot_id:x}).strict(),x_=oe.object({snapshot:Ws,workspace_run_id:V.nullable()}).strict(),O1=L(x_);import{z as Ue}from"zod";import{z as Ae}from"zod";import{z as ie}from"zod";import{z as E_}from"zod";var I_=["company_profile","product_manual","product_list","customer_case","product_help","qualification","industry_material"],gr=E_.enum(I_);var _r=ie.enum(["pending","running","ready","failed","missing"]),R_=ie.object({task_id:ie.string().min(1).max(500),status:_r}).strict(),F1=ie.object({items:ie.array(R_).max(100)}).strict(),Qt=ie.string().trim().min(1).max(255),G1=ie.object({knowledge_site_id:Qt,source_ids:ie.array(Qt).min(1).max(200)}).strict().superRefine((t,n)=>{new Set(t.source_ids).size!==t.source_ids.length&&n.addIssue({code:"custom",message:"Knowledge source IDs must be unique.",path:["source_ids"]})}),T_=ie.object({source_file_id:Qt,category_code:gr.nullable(),category_confirmed:ie.boolean(),status:_r}).strict(),z1=ie.object({ready:ie.boolean(),files:ie.array(T_),counts:ie.object({total:ie.number().int().nonnegative(),pending:ie.number().int().nonnegative(),running:ie.number().int().nonnegative(),ready:ie.number().int().nonnegative(),failed:ie.number().int().nonnegative(),missing:ie.number().int().nonnegative(),unclassified:ie.number().int().nonnegative()}).strict()}).strict();var me=t=>Ae.string().trim().max(t),hr=Ae.array(Ae.string().trim().min(1).max(120)).max(20),oi=Ae.object({company_name:Ae.string().trim().min(1).max(200),brand_name:me(200),primary_products:Ae.string().trim().min(1).max(1e3),industry:me(200),applications:me(1e3),business_summary:me(2e3),registered_capital:me(200).default(""),legal_representative:me(200).default(""),target_markets:hr,customer_industries:me(1e3),customer_roles:me(1e3),buying_scenarios:me(2e3),differentiators:me(2e3),competitors:me(1e3),trust_proof:me(2e3),customer_cases:me(3e3),channels:hr,expected_domain:me(255),brand_tone:me(500),contact_name:me(200),contact_info:me(500),timezone:me(100),launch_timing:me(200),input_source_ids:Ae.array(Qt).max(50)}).strict(),k_=Ae.enum(["draft","submitted"]),ri=oi.extend({id:G,tenant_id:Ae.string().min(1),site_id:I,workflow_id:Le,status:k_,submitted_at:Ae.string().min(1).nullable(),created_at:Ae.string().min(1),updated_at:Ae.string().min(1)}).strict(),$1=L(ri),Y1=L(ri),X1=L(ri.nullable());var t0=Nn.extend({expected_current_node:Ue.literal("website_scan"),type:Ue.literal("existing_site"),result:Nn.shape.result.extend({website:Ue.string().url(),scan_cards:Ue.partialRecord(Vo,Ys).refine(t=>Object.keys(t).length>0,{message:"At least one recognized scan card is required."})}).strict()}).strict(),n0=Ue.object({expected_current_node:Ue.literal("customer_materials"),materials:oi}).strict(),s0=Ue.object({expected_current_node:Ue.literal("diagnosis")}).strict(),i0=Ue.object({expected_current_node:Ue.literal("strategy")}).strict();import{z as w}from"zod";var Zt={Inter:{import:"Inter"},"Inter Tight":{import:"Inter_Tight"},"DM Sans":{import:"DM_Sans"},"Source Sans 3":{import:"Source_Sans_3"},"Libre Franklin":{import:"Libre_Franklin"},Montserrat:{import:"Montserrat"},Archivo:{import:"Archivo"},"Space Grotesk":{import:"Space_Grotesk"},Manrope:{import:"Manrope"},"IBM Plex Sans":{import:"IBM_Plex_Sans"},Oswald:{import:"Oswald"},"Roboto Condensed":{import:"Roboto_Condensed"},"Bebas Neue":{import:"Bebas_Neue",weights:["400"]},"Playfair Display":{import:"Playfair_Display"},Lora:{import:"Lora"},Fraunces:{import:"Fraunces"},"Cormorant Garamond":{import:"Cormorant_Garamond"},"JetBrains Mono":{import:"JetBrains_Mono"},"IBM Plex Mono":{import:"IBM_Plex_Mono"},"Noto Sans SC":{import:"Noto_Sans_SC",download:!1},"Noto Serif SC":{import:"Noto_Serif_SC",download:!1}},P_={heading:"Inter",body:"Inter"},Sr=Zt.Inter;function Bn(t){return t.trim().replace(/\s+/g,"_").toLowerCase()}var xr=(()=>{let t=new Map;for(let[n,s]of Object.entries(Zt))t.set(Bn(n),s),t.set(Bn(s.import),s);return t})();function w_(t){return typeof t!="string"||t.trim().length===0?Sr:xr.get(Bn(t))??Sr}var A_=(()=>{let t=new Map;for(let[n,s]of Object.entries(Zt))t.set(s.import,n);return t})();function v_(t){if(typeof t!="string"||t.trim().length===0)return"Inter";let n=xr.get(Bn(t));return n?A_.get(n.import)??"Inter":"Inter"}var C_=Object.keys(Zt),fr='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',br='Georgia, "Times New Roman", serif',yr='"SFMono-Regular", Consolas, monospace',D_=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),j_=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(t=>t.toLowerCase())),O_=new Set(["JetBrains Mono","IBM Plex Mono"].map(t=>t.toLowerCase()));function N_(t){let n=t.toLowerCase();return O_.has(n)||n.includes("mono")?"mono":j_.has(n)||n.includes("serif")?"serif":"sans"}function ci(t,n){let s=_=>(_??"").trim().replace(/^['"]|['"]$/g,"").replace(/[^A-Za-z0-9 _-]+/g,"").trim().slice(0,60),a=s(t),i=s(n),r=_=>D_.has(_.toLowerCase());if(a&&r(a)){let _=a.toLowerCase();return _.includes("mono")?yr:_.includes("serif")?br:fr}let g=a;g||(g=r(i)?"":i),g||(g="Inter");let c=N_(g);return c==="mono"?`"${g}", ${yr}`:c==="serif"?`"${g}", ${br}`:`"${g}", ${fr}`}function L_(t){return{"--site-font-sans":ci(t?.body,"Inter"),"--site-font-heading":ci(t?.heading,t?.body??"Inter")}}var mi=["archivo-inter","playfair-source-sans","space-grotesk-manrope","fraunces-libre-franklin","noto-serif-sc-noto-sans-sc","noto-sans-sc"],Er=[{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 Ir(t){let n=Er.find(s=>s.id===t);if(!n)throw new Error(`Unknown font pairing: ${t}`);return n}var li=["compact","comfortable","airy"],Rr=["none","sm","md","lg","xl"],Tr="lg",pi=["subtle","moderate","expressive"],M_=[{id:"subtle",motionLevel:"subtle"},{id:"moderate",motionLevel:"moderate"},{id:"expressive",motionLevel:"expressive"}];function kr(t){let n=M_.find(s=>s.id===t);if(!n)throw new Error(`Unknown motion preset: ${t}`);return n}var Pr=["ocean","forest","clay","violet","graphite","crimson"],wr=["ai-forest","ai-navy","ai-steel"],Ar=/^gen-[0-9a-f]{8}$/,di=[{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"}],ui=[{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 c0(t){let n=ui.find(s=>s.id===t);if(!n)throw new Error(`Unknown theme preset: ${t}`);return n}function vr(t){return ui.find(n=>n.id===t)?.radius??di.find(n=>n.id===t)?.radius}var gi=w.string().regex(/^#[0-9A-F]{6}$/i),Jt=w.string().trim().min(1).max(500),Cr=w.string().datetime({offset:!0}),U_=w.enum(Pr),q_=w.enum(wr),F_=w.string().regex(Ar),en=w.union([U_,q_,F_]),tn=w.enum(mi),nn=w.enum(pi),sn=w.enum(li),Wn=w.enum(Rr),Dr=300,G_=w.string().trim().min(1).max(Dr),Vn=w.object({primary:gi,accent:gi,foreground:gi}).strict(),z_=w.object({id:en,rank:w.number().int().min(1).max(3),name:w.string().trim().min(1).max(120),description:w.string().trim().min(1).max(240),color_seeds:Vn,surface_mode:w.enum(["light","dark"]),radius:Wn,font_pairing_id:tn,motion_preset_id:nn,density:sn,reason:Jt}).strict(),jr=w.object({name:w.string().trim().min(1).max(120),description:w.string().trim().min(1).max(240),reason:Jt,color_seeds:Vn,surface_mode:w.enum(["light","dark"]),radius:Wn,font_pairing_id:tn,motion_preset_id:nn,density:sn}).strict(),Or=w.object({version:w.number().int().min(1),recommendation_id:w.string().uuid(),theme_preset_id:en,color_seeds:Vn,surface_mode:w.enum(["light","dark"]),font_pairing_id:tn,motion_preset_id:nn,density:sn,radius:Wn.optional(),aesthetic_note:G_.optional(),updated_at:Cr}).strict(),K_=w.object({id:w.string().uuid(),version:w.number().int().min(1),catalog_version:w.string().trim().min(1).max(80),source:w.object({mode:w.enum(["ai","fallback"]),fallback_reason:w.string().trim().min(1).max(80).nullable()}).strict(),inputs:w.object({industry:w.string().trim().min(1).max(160).optional(),site_language:w.string().trim().min(2).max(35),owner_locale:de.optional(),strategy_version:w.number().int().min(1),input_digest:w.string().regex(/^sha256:[a-f0-9]{64}$/)}).strict(),theme:w.object({recommended_id:en,candidate_ids:w.array(en).length(3),candidates:w.array(z_).length(3)}).strict().superRefine((t,n)=>{t.recommended_id!==t.candidate_ids[0]&&n.addIssue({code:"custom",path:["recommended_id"],message:"recommended_id must be the first candidate"}),t.candidates.some((s,a)=>s.id!==t.candidate_ids[a]||s.rank!==a+1)&&n.addIssue({code:"custom",path:["candidates"],message:"Candidates must follow candidate_ids order."})}),font:w.object({recommended_id:tn,reason:Jt}).strict(),motion:w.object({recommended_id:nn,reason:Jt}).strict(),density:w.object({recommended_id:sn,reason:Jt}).strict(),conversion:rt.optional(),generated_at:Cr}).strict(),b0=w.object({force_refresh:w.boolean().optional()}).strict(),y0=w.object({request_id:w.string().trim().min(1).max(160),site_id:I,cached:w.boolean(),recommendation:K_,selection:Or}).strict(),x0=w.object({recommendation_id:w.string().uuid(),expected_version:w.number().int().min(1),theme_preset_id:en,color_seeds:Vn,surface_mode:w.enum(["light","dark"]),font_pairing_id:tn,motion_preset_id:nn,density:sn,radius:Wn.optional(),aesthetic_note:w.string().trim().max(Dr).optional()}).strict(),E0=w.object({selection:Or}).strict(),I0=w.object({tenant_id:w.string().trim().min(1).max(160),site_id:I,site_language:w.string().trim().min(2).max(35),owner_locale:de,industry:w.string().trim().min(1).max(160).optional(),strategy_version_id:w.string().uuid(),strategy_version:w.number().int().min(1),strategy_checksum:w.string().regex(/^[a-f0-9]{64}$/),strategy_summary:w.array(w.string().trim().min(1).max(500)).min(1).max(fe),reference_image_source_id:ot.optional(),owner_whole_site_request:w.string().trim().min(1).max(ft).optional()}).strict(),R0=w.object({theme_candidates:w.array(jr).length(3),conversion:rt.optional()}).strict().superRefine((t,n)=>{let s=new Set;t.theme_candidates.forEach((a,i)=>{let r=JSON.stringify(a.color_seeds).toUpperCase();s.has(r)&&n.addIssue({code:"custom",path:["theme_candidates",i,"color_seeds"],message:"Theme candidates must have pairwise distinct color_seeds"}),s.add(r)})});function T0(){return di.map(t=>jr.parse({name:t.name,description:t.description,reason:t.fallbackReason,color_seeds:t.colorSeeds,surface_mode:t.surfaceMode,radius:t.radius,font_pairing_id:mi[0],motion_preset_id:pi[0],density:li[1]}))}function B_(t){return t.radius??vr(t.theme_preset_id)??"lg"}function k0(t){let n=Ir(t.font_pairing_id),s=kr(t.motion_preset_id);return{colorSeeds:t.color_seeds,surfaceMode:t.surface_mode,fonts:{heading:n.heading,body:n.body},density:t.density,motionLevel:s.motionLevel,motionPreset:s.id,radius:B_(t)}}function P0(t,n){let s=t.theme.candidates[0];return{version:1,recommendation_id:t.id,theme_preset_id:s.id,color_seeds:s.color_seeds,surface_mode:s.surface_mode,font_pairing_id:t.font.recommended_id,motion_preset_id:t.motion.recommended_id,density:t.density.recommended_id,radius:s.radius,updated_at:n.toISOString()}}import{z as et}from"zod";var C0=et.object({site_id:I,site_language:et.string().trim().min(2).max(35),business_facts:et.array(et.string().trim().min(1).max(1e3)).min(1).max(8)}).strict(),W_=et.enum(["high","medium","low"]),D0=et.object({skill_name:et.string().trim().min(1).max(80).nullable(),confidence:W_,reason:et.string().trim().min(1).max(240)}).strict();import{z as W}from"zod";var V_=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],Nr=W.object({name:W.string().min(1).max(100),type:W.enum(V_),label:W.string().min(1).max(255),required:W.boolean().optional(),options:W.array(W.string()).optional()}),N0=W.object({name:W.string(),cms_type:W.string(),label:W.string().optional(),required:W.boolean().optional(),value_shape:W.string().optional(),front_display:W.enum(["visible","internal","forbidden"]).optional(),choices:W.array(W.object({value:W.union([W.string(),W.number()]),label:W.string()})).optional()}),L0=W.object({route_file_path:W.string().min(1),target_component_path:W.string().min(1),content_type_hint:W.string().min(1),collection_purpose:W.enum(["generic","product"]).optional(),required_fields:W.array(Nr).optional(),mode:W.enum(["bind_existing","provision"]),list_mode:W.enum(["page","embedded"]).optional(),fields:W.array(Nr).optional(),seed_records:W.array(W.record(W.string(),W.unknown())).optional()});import{z as le}from"zod";var Hn=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number","file"],H_=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number"],$_=le.object({name:le.string().min(1).max(100),type:le.enum(H_),label:le.string().min(1).max(255),required:le.boolean().optional(),options:le.array(le.string()).optional()}),Y_=le.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),q0=le.object({mode:le.enum(["bind_existing","provision"],{error:'mode is required. Use "bind_existing" or "provision". Never call connect_form with {}.'}),form_hint:le.string().min(1).optional(),name:le.string().min(1).max(255).optional(),component_slug:Y_,description:le.string().min(1).max(1e3).optional(),fields:le.array($_).optional()}).superRefine((t,n)=>{t.mode==="bind_existing"&&!t.form_hint?.trim()&&n.addIssue({code:"custom",path:["form_hint"],message:"form_hint is required for bind_existing"}),t.mode==="provision"&&!t.name?.trim()&&n.addIssue({code:"custom",path:["name"],message:"name is required for provision"})}),F0=le.object({name:le.string(),label:le.string(),cms_type:le.string(),required:le.boolean()});import{z as l}from"zod";var an=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,kt=/^[A-Za-z][A-Za-z0-9_-]{0,127}$/,$n=/^[A-Za-z][A-Za-z0-9_]{0,99}$/,qr=/^[A-Za-z0-9][A-Za-z0-9_-]{0,99}$/,hi=/^[a-z][a-z0-9-]{0,99}$/,Fr=/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/,Lr=2,Mr=3,Yn=l.string().regex(an),X_=l.string().regex(an),Si=l.string().regex(an),on=l.string().regex($n),fi=l.string().regex(qr),Q_=l.discriminatedUnion("status",[l.object({status:l.literal("unbound"),form_code:l.null()}).strict(),l.object({status:l.literal("bound"),form_code:l.string().regex(kt)}).strict(),l.object({status:l.literal("missing"),form_code:l.string().regex(kt)}).strict()]),Z_=l.object({value:fi,label:l.string().trim().min(1).max(255)}).strict(),J_=l.object({kind:l.literal("field"),field_name:on,type:l.enum(Hn),label:l.string().trim().min(1).max(255),required:l.boolean(),span:l.enum(["full","half"]),options:l.array(Z_).max(100),max_files:l.number().int().min(1).max(5).optional()}).strict(),eh=l.object({kind:l.literal("step-break"),step_id:l.string().regex(an)}).strict(),th=l.discriminatedUnion("kind",[J_,eh]),nh=l.object({field_name:on,type:l.enum(Hn),last_label:l.string().max(255)}).strict(),sh=l.object({field_name:on,value:fi,last_label:l.string().max(255)}).strict(),ih=l.discriminatedUnion("kind",[l.object({kind:l.literal("custom")}).strict(),l.object({kind:l.literal("template"),slug:l.string().regex(hi),version:l.string().regex(Fr)}).strict()]),ah={select:2,radio:2,multiselect:1,DropdownSelection:2,RadioButton:2,Checkbox:1};function qe(t){return t.toLowerCase()}function Gr(t,n){return t.trim().toLocaleLowerCase(n)}function Tt(t,n){return`${qe(t)}\0${n}`}function he(t,n,s,a){let i=new Set;for(let r of t){if(i.has(r)){a.addIssue({code:"custom",path:n,message:s});return}i.add(r)}}function bi(t,n,s,a){let i=ah[t]??0;i>0&&n<i?a.addIssue({code:"custom",path:s,message:`choice field requires at least ${i} option${i===1?"":"s"}`}):i===0&&n>0&&a.addIssue({code:"custom",path:s,message:"non-choice fields must use an empty options array"})}var yi=l.object({schema_version:l.literal(1),min_runtime_version:l.number().int().positive(),form_definition_id:Yn,binding:Q_,content_locale:de,features:l.object({multistep:l.boolean()}).strict(),copy:l.object({title:l.string().max(255),description:l.string().max(1e3),submit_button:l.string().trim().min(1).max(100),success_message:l.string().trim().min(1).max(500),error_message:l.string().max(500)}).strict(),layout:l.object({columns:l.enum(["one","two"])}).strict(),nodes:l.array(th).min(1).max(200),source:ih,retired:l.object({fields:l.array(nh).max(1e3),options:l.array(sh).max(5e3)}).strict(),compatibility:l.object({standardization_version:l.number().int().positive(),diagnostics:l.array(l.string().trim().min(1).max(500)).max(100)}).strict()}).strict().superRefine((t,n)=>{let s=t.nodes.flatMap((c,_)=>c.kind==="field"?[[_,c]]:[]),a=s.map(([,c])=>c);a.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"at least one field node is required"});let i=t.nodes.filter(c=>c.kind==="step-break");!t.features.multistep&&i.length>0&&n.addIssue({code:"custom",path:["nodes"],message:"step-break requires the multistep feature"}),t.features.multistep&&(t.min_runtime_version<Lr&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`multistep requires runtime version ${Lr}`}),i.length===0&&n.addIssue({code:"custom",path:["nodes"],message:"multistep requires at least one step-break"}));for(let[c,_]of t.nodes.entries())_.kind==="step-break"&&(c===0||c===t.nodes.length-1||t.nodes[c-1]?.kind==="step-break"||t.nodes[c+1]?.kind==="step-break")&&n.addIssue({code:"custom",path:["nodes",c],message:"step-break must separate two non-empty steps"});he(i.map(c=>c.step_id),["nodes"],"step_id must be unique",n),he(a.map(c=>qe(c.field_name)),["nodes"],"field_name must be unique",n),he(t.retired.fields.map(c=>qe(c.field_name)),["retired","fields"],"retired field_name must be unique",n);let r=new Set(t.retired.fields.map(c=>qe(c.field_name)));for(let[c,_]of s)r.has(qe(_.field_name))&&n.addIssue({code:"custom",path:["nodes",c,"field_name"],message:"retired field_name cannot be reused"}),bi(_.type,_.options.length,["nodes",c,"options"],n),_.type==="file"?t.min_runtime_version<Mr&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`file fields require runtime version ${Mr}`}):_.max_files!==void 0&&n.addIssue({code:"custom",path:["nodes",c,"max_files"],message:"max_files is only valid for file fields"}),he(_.options.map(j=>j.value),["nodes",c,"options"],"option value must be unique within a field",n),he(_.options.map(j=>Gr(j.label,t.content_locale)),["nodes",c,"options"],"option label must be unique within a field",n);he(t.retired.options.map(c=>Tt(c.field_name,c.value)),["retired","options"],"retired option identity must be unique",n);let g=new Set(t.retired.options.map(c=>Tt(c.field_name,c.value)));for(let[c,_]of s)for(let[j,E]of _.options.entries())g.has(Tt(_.field_name,E.value))&&n.addIssue({code:"custom",path:["nodes",c,"options",j,"value"],message:"retired option value cannot be reused"})}),oh=["copy.title","copy.description","copy.submit_button","copy.success_message","copy.error_message","nodes.*.label","nodes.*.options.*.label"],rh=new Set(oh);function H0(t){let n=t.map(s=>typeof s=="number"||/^\d+$/.test(s)?"*":s).join(".");return rh.has(n)}function $0(t,n){let s=[],a=t.nodes.filter(c=>c.kind==="field"),i=new Map(n.nodes.filter(c=>c.kind==="field").map(c=>[qe(c.field_name),c])),r=new Map(n.retired.fields.map(c=>[qe(c.field_name),c])),g=new Map(n.retired.options.map(c=>[Tt(c.field_name,c.value),c]));for(let c of a){let _=qe(c.field_name),j=i.get(_),E=r.get(_);j&&j.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),j&&j.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),!j&&E&&E.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),!j&&E&&E.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),!j&&!r.has(_)&&s.push({code:"FIELD_RETIREMENT_MISSING",field_name:c.field_name});let O=new Set(j?.options.map(q=>q.value)??[]);for(let q of c.options){let F=g.get(Tt(c.field_name,q.value));!O.has(q.value)&&F&&F.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),!O.has(q.value)&&!F&&s.push({code:"OPTION_RETIREMENT_MISSING",field_name:c.field_name,value:q.value})}}for(let c of t.retired.fields){let _=r.get(qe(c.field_name));_&&_.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),_&&_.type!==c.type&&s.push({code:"FIELD_TYPE_CHANGED",field_name:c.field_name}),_||s.push({code:"FIELD_RETIREMENT_MISSING",field_name:c.field_name})}for(let c of t.retired.options){let _=g.get(Tt(c.field_name,c.value));_&&_.field_name!==c.field_name&&s.push({code:"FIELD_IDENTITY_CHANGED",field_name:c.field_name}),_||s.push({code:"OPTION_RETIREMENT_MISSING",field_name:c.field_name,value:c.value})}return s}var ch=l.enum(Lt),tt=l.object({english:l.string().max(1e3),translations:l.partialRecord(ch,l.string().max(1e3)).optional()}).strict(),mh=l.object({template_option_key:l.string().regex(qr),label:tt}).strict(),lh=l.object({template_field_key:l.string().regex($n),type:l.enum(Hn),label:tt,required:l.boolean(),span:l.enum(["full","half"]),options:l.array(mh).max(100)}).strict(),ph=l.object({template_step_key:l.string().regex($n),after_field_key:l.string().regex($n)}).strict(),Y0=["lead-generation","trial-and-samples","quote-and-commerce","appointments-and-visits","resources-and-subscriptions","service-and-channel"],X0=[1,1,1,1,1,1],zr=l.string().regex(hi),dh=l.object({schema_version:l.literal(1),slug:zr,name:tt,template_count:l.number().int().min(0).max(500)}).strict().superRefine((t,n)=>{t.name.english.trim()===""&&n.addIssue({code:"custom",path:["name","english"],message:"English category name is required"})}),uh=l.object({schema_version:l.literal(1),slug:l.string().regex(hi),version:l.string().regex(Fr),category:zr,copy:l.object({title:tt,description:tt,submit_button:tt,success_message:tt,error_message:tt}).strict(),layout:l.object({columns:l.enum(["one","two"])}).strict(),fields:l.array(lh).min(1).max(200),step_breaks:l.array(ph).max(20).optional()}).strict().superRefine((t,n)=>{for(let r of["title","description","submit_button","success_message","error_message"])t.copy[r].english.trim()===""&&n.addIssue({code:"custom",path:["copy",r,"english"],message:"English baseline text is required"});he(t.fields.map(r=>r.template_field_key),["fields"],"template_field_key must be unique",n);let s=new Map(t.fields.map((r,g)=>[r.template_field_key,g])),a=t.step_breaks??[];he(a.map(r=>r.template_step_key),["step_breaks"],"template_step_key must be unique",n),he(a.map(r=>r.after_field_key),["step_breaks"],"step breaks must not share an anchor field",n);let i=-1;for(let[r,g]of a.entries()){let c=s.get(g.after_field_key);c===void 0||c>=t.fields.length-1?n.addIssue({code:"custom",path:["step_breaks",r,"after_field_key"],message:"step break must follow an existing non-final field"}):c<=i&&n.addIssue({code:"custom",path:["step_breaks",r,"after_field_key"],message:"step breaks must follow field order"}),i=c??i}t.fields.length+a.length>200&&n.addIssue({code:"custom",path:["step_breaks"],message:"template fields and step breaks must not exceed 200 nodes"});for(let[r,g]of t.fields.entries()){g.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",r,"label","english"],message:"English field label is required"}),bi(g.type,g.options.length,["fields",r,"options"],n),he(g.options.map(c=>c.template_option_key),["fields",r,"options"],"template_option_key must be unique within a field",n),he(g.options.map(c=>c.label.english.trim().toLowerCase()),["fields",r,"options"],"English option labels must be unique within a field",n);for(let[c,_]of g.options.entries())_.label.english.trim()===""&&n.addIssue({code:"custom",path:["fields",r,"options",c,"label","english"],message:"English option label is required"})}}),Q0=l.object({schema_version:l.literal(1),visibility:l.enum(["internal","public"]),categories:l.array(dh).max(500),templates:l.array(uh).max(500)}).strict().superRefine((t,n)=>{let s=(i,r)=>{let g=Lt.filter(c=>!i.translations?.[c]?.trim());g.length>0&&n.addIssue({code:"custom",path:[...r,"translations"],message:`public template copy is missing locales: ${g.join(", ")}`})};he(t.categories.map(i=>i.slug),["categories"],"template category slug must be unique",n);let a=new Set(t.categories.map(i=>i.slug));for(let[i,r]of t.categories.entries()){let g=t.templates.filter(c=>c.category===r.slug).length;r.template_count!==g&&n.addIssue({code:"custom",path:["categories",i,"template_count"],message:"template_count must match catalog templates"})}he(t.templates.map(i=>i.slug),["templates"],"template slug must be unique",n);for(let[i,r]of t.templates.entries())a.has(r.category)||n.addIssue({code:"custom",path:["templates",i,"category"],message:"template category must exist in catalog categories"});if(t.visibility==="public"){for(let[i,r]of t.categories.entries())s(r.name,["categories",i,"name"]);for(let[i,r]of t.templates.entries()){for(let[g,c]of Object.entries(r.copy))s(c,["templates",i,"copy",g]);for(let[g,c]of r.fields.entries()){s(c.label,["templates",i,"fields",g,"label"]);for(let[_,j]of c.options.entries())s(j.label,["templates",i,"fields",g,"options",_,"label"])}}}});function Z0(t,n){let s=fa(n),a=s?t.translations?.[s]:void 0;return a!==void 0&&a.trim()!==""?a:t.english}var gh=["Text","Summary","Email","Phone","DropdownSelection","RadioButton","Checkbox","Boolean","Date","Num","MultipleFile","SpecificFile"],_h={text:"Text",textarea:"Summary",email:"Email",phone:"Phone",select:"DropdownSelection",radio:"RadioButton",multiselect:"Checkbox",boolean:"Boolean",date:"Date",number:"Num",file:"MultipleFile"},hh=l.object({value:fi,label:l.string().trim().min(1).max(255)}).strict(),Sh=l.object({field_name:on,field_type:l.enum(gh),field_label:l.string().trim().min(1).max(255),is_required:l.boolean(),sort_order:l.number().int().nonnegative(),options:l.array(hh).max(100)}).strict(),Kr=l.object({version:l.literal(1),locale:de,fields:l.array(Sh).min(1).max(200)}).strict().superRefine((t,n)=>{he(t.fields.map(s=>qe(s.field_name)),["fields"],"field_name must be unique",n);for(let[s,a]of t.fields.entries())bi(a.field_type,a.options.length,["fields",s,"options"],n),he(a.options.map(i=>i.value),["fields",s,"options"],"option value must be unique within a field",n),he(a.options.map(i=>Gr(i.label,t.locale)),["fields",s,"options"],"option label must be unique within a field",n)});function J0(t){let n=t.nodes.filter(s=>s.kind==="field").map((s,a)=>({field_name:s.field_name,field_type:s.type==="file"&&s.max_files===1?"SpecificFile":_h[s.type],field_label:s.label,is_required:s.required,sort_order:a,options:s.options.map(i=>({...i}))}));return Kr.parse({version:1,locale:t.content_locale,fields:n})}var te=l.string().regex(/^sha256:[0-9a-f]{64}$/),fh=l.union([pe,l.enum(["app/api/forms/[code]/route.ts","hooks/use-cms-form-submit.ts","lib/cms/forms.ts","lib/cms/client.ts"])]),bh=l.object({path:fh,content_hash:te.nullable()}).strict(),yh=l.array(bh).min(1).max(500).superRefine((t,n)=>{he(t.map(s=>s.path),[],"affected file paths must be unique",n)}),xi=l.object({grade:l.enum(["standard","A","B","C"]),required:l.boolean(),pending_confirmations:l.array(l.object({item_id:l.string().regex(an),field_name:on.optional(),kind:l.enum(["form_copy","layout","field_label","field_type","field_required","field_options"]),message:l.string().trim().min(1).max(500)}).strict().superRefine((t,n)=>{t.kind.startsWith("field_")&&!t.field_name&&n.addIssue({code:"custom",path:["field_name"],message:"field confirmation items require field_name"})})).max(200)}).strict().superRefine((t,n)=>{let s=t.grade==="standard";s===t.required&&n.addIssue({code:"custom",path:["required"],message:s?"standard forms do not require standardization confirmation":"legacy forms require standardization confirmation"}),t.grade==="C"&&t.pending_confirmations.length===0&&n.addIssue({code:"custom",path:["pending_confirmations"],message:"grade C requires at least one pending confirmation"}),t.grade!=="C"&&t.pending_confirmations.length>0&&n.addIssue({code:"custom",path:["pending_confirmations"],message:"only grade C can contain pending confirmations"})}),xh=l.object({site_id:I,form_definition_id:Yn,base_snapshot_id:x,expected_form_spec_hash:te,expected_cms_schema_hash:te.nullable(),draft_form_spec_hash:te,desired_cms_schema_hash:te,affected_files_hash:te,shared_reference_hash:te,shared_reference_count:l.number().int().positive(),confirm_shared_update:l.boolean(),recreate_missing_binding:l.boolean(),standardization:xi,confirm_standardization:l.boolean()}).strict(),Br=l.object({reference_hash:te,page_count:l.number().int().positive(),block_count:l.number().int().positive()}).strict().refine(t=>t.page_count<=t.block_count,{message:"page_count cannot exceed block_count"}),eP=l.object({site_id:I,form_block_id:X_,base_snapshot_id:x,form_spec:yi,runtime_upgrade_required:l.boolean(),expected_form_spec_hash:te,expected_cms_schema_hash:te.nullable(),affected_files_hash:te,shared_impact:Br,standardization:xi}).strict(),Eh=l.object({operation_id:Si,operation_fingerprint:te,site_id:I,form_definition_id:Yn,base_snapshot_id:x,expected_form_spec_hash:te,expected_cms_schema_hash:te.nullable(),draft_form_spec:yi,draft_form_spec_hash:te,desired_cms_schema_hash:te,affected_files_hash:te,shared_impact:Br,confirm_shared_update:l.boolean(),recreate_missing_binding:l.boolean(),standardization:xi,confirm_standardization:l.boolean()}).strict().superRefine((t,n)=>{t.form_definition_id!==t.draft_form_spec.form_definition_id&&n.addIssue({code:"custom",path:["form_definition_id"],message:"form_definition_id must match draft_form_spec"}),t.shared_impact.block_count>1&&!t.confirm_shared_update&&n.addIssue({code:"custom",path:["confirm_shared_update"],message:"shared definition updates require explicit confirmation"});let s=t.draft_form_spec.binding.status==="missing";s!==t.recreate_missing_binding&&n.addIssue({code:"custom",path:["recreate_missing_binding"],message:s?"missing bindings require explicit recreation confirmation":"only missing bindings can be recreated"});let a=t.draft_form_spec.binding.status==="bound",i=a&&t.standardization.required&&(t.standardization.grade==="B"||t.standardization.grade==="C");(a&&!i&&t.expected_cms_schema_hash===null||!a&&t.expected_cms_schema_hash!==null)&&n.addIssue({code:"custom",path:["expected_cms_schema_hash"],message:a?"bound standard forms require the current CMS schema hash":"unbound or missing forms cannot claim a current CMS schema hash"}),t.confirm_standardization!==t.standardization.required&&n.addIssue({code:"custom",path:["confirm_standardization"],message:t.standardization.required?"legacy standardization requires explicit confirmation":"standard forms cannot claim legacy standardization confirmation"})}),Ih=["created","validated","binding_reserved","candidate_ready","cms_applied","snapshot_promoted","committed","compensating","recovery_required","failed"],Ei=l.enum(Ih),Rh=["pending","running","succeeded","failed","recovery_required"],Wr=l.enum(Rh),Th=["candidate_abandon","snapshot_reconcile","cms_restore"],Vr=l.enum(Th),kh=["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"],Ii=l.enum(kh),Hr=l.enum(["wait","resume","retry_new_operation","manual_recovery","none"]),$r=l.enum(["not_started","pending","succeeded","failed"]),Yr=l.object({operation_id:Si,operation_fingerprint:te,site_id:I,form_definition_id:Yn,stage:Ei,status:Wr,base_snapshot_id:x,candidate_snapshot_id:x.nullable(),before_form_code:l.string().regex(kt).nullable(),materialized_form_code:l.string().regex(kt).nullable(),expected_form_spec_hash:te,draft_form_spec_hash:te,materialized_form_spec_hash:te.nullable(),expected_cms_schema_hash:te.nullable(),desired_cms_schema_hash:te,retry_count:l.number().int().nonnegative(),failure_stage:Vr.nullable(),last_error_code:Ii.nullable(),retryable:l.boolean(),next_action:Hr,preview_refresh_status:$r,created_at:l.string().datetime({offset:!0}),updated_at:l.string().datetime({offset:!0})}).strict().superRefine((t,n)=>{if(!(t.stage!=="committed"&&t.status!=="succeeded")){(t.stage!=="committed"||t.status!=="succeeded")&&n.addIssue({code:"custom",path:["status"],message:"committed stage and succeeded status must be reported together"});for(let s of["candidate_snapshot_id","materialized_form_code","materialized_form_spec_hash"])t[s]===null&&n.addIssue({code:"custom",path:[s],message:`${s} is required for a committed success`});(t.failure_stage!==null||t.last_error_code!==null||t.retryable||t.next_action!=="none")&&n.addIssue({code:"custom",path:["next_action"],message:"a committed success cannot retain an error or retry action"})}}),Ri=l.object({operation:Yr}).strict(),tP=Ri,nP=Ri,sP=l.object({operation_fingerprint:te}).strict(),iP=Ri,Ph=l.preprocess(t=>!t||typeof t!="object"||Array.isArray(t)||"standardization"in t||"confirm_standardization"in t?t:{...t,standardization:{grade:"standard",required:!1,pending_confirmations:[]},confirm_standardization:!1},Eh),aP=l.object({operation:Yr,request:Ph,cms_replace_result:l.unknown().nullable()}).strict(),wh=l.object({stage:Ei.optional(),status:Wr.optional(),candidate_snapshot_id:x.nullable().optional(),before_form_code:l.string().regex(kt).nullable().optional(),materialized_form_code:l.string().regex(kt).nullable().optional(),materialized_form_spec_hash:te.nullable().optional(),retry_count:l.number().int().nonnegative().optional(),failure_stage:Vr.nullable().optional(),last_error_code:Ii.nullable().optional(),retryable:l.boolean().optional(),next_action:Hr.optional(),preview_refresh_status:$r.optional()}).strict(),oP=l.object({expected_updated_at:l.string().datetime({offset:!0}),operation:wh,cms_replace_result:l.unknown().nullable().optional()}).strict().refine(t=>Object.keys(t.operation).length>0||Object.hasOwn(t,"cms_replace_result"),{message:"transition must change operation state or CMS result"}),rP=l.object({code:Ii,message:l.string().trim().min(1).max(500),retryable:l.boolean(),operation_id:Si.optional(),stage:Ei.optional()}).strict();function Ah(t){return xh.parse({site_id:t.site_id,form_definition_id:t.form_definition_id,base_snapshot_id:t.base_snapshot_id,expected_form_spec_hash:t.expected_form_spec_hash,expected_cms_schema_hash:t.expected_cms_schema_hash,draft_form_spec_hash:t.draft_form_spec_hash,desired_cms_schema_hash:t.desired_cms_schema_hash,affected_files_hash:t.affected_files_hash,shared_reference_hash:t.shared_impact.reference_hash,shared_reference_count:t.shared_impact.block_count,confirm_shared_update:t.confirm_shared_update,recreate_missing_binding:t.recreate_missing_binding,standardization:t.standardization,confirm_standardization:t.confirm_standardization})}function Ur(t){for(let n=0;n<t.length;n+=1){let s=t.charCodeAt(n);if(s>=55296&&s<=56319){let a=t.charCodeAt(n+1);if(n+1>=t.length||a<56320||a>57343)throw new TypeError("canonical JSON cannot contain a lone surrogate");n+=1}else if(s>=56320&&s<=57343)throw new TypeError("canonical JSON cannot contain a lone surrogate")}}function _i(t,n){if(t===null)return"null";if(typeof t=="boolean")return t?"true":"false";if(typeof t=="number"){if(!Number.isFinite(t))throw new TypeError("canonical JSON numbers must be finite");return JSON.stringify(t)}if(typeof t=="string")return Ur(t),JSON.stringify(t);if(typeof t!="object")throw new TypeError("value is not valid JSON");if(n.has(t))throw new TypeError("canonical JSON cannot contain cycles");n.add(t);try{if(Array.isArray(t)){let r=[];for(let g=0;g<t.length;g+=1){if(!(g in t))throw new TypeError("canonical JSON cannot contain sparse arrays");r.push(_i(t[g],n))}return`[${r.join(",")}]`}let s=Object.getPrototypeOf(t);if(s!==Object.prototype&&s!==null)throw new TypeError("canonical JSON objects must be plain records");let a=t;return`{${Object.keys(a).sort().map(r=>(Ur(r),`${JSON.stringify(r)}:${_i(a[r],n)}`)).join(",")}}`}finally{n.delete(t)}}function Ti(t){return _i(t,new Set)}async function Xn(t){let n=Ti(t),s=new TextEncoder().encode(n),a=globalThis.crypto?.subtle?new Uint8Array(await globalThis.crypto.subtle.digest("SHA-256",s)):(await import("@noble/hashes/sha256")).sha256(s);return`sha256:${Array.from(a,r=>r.toString(16).padStart(2,"0")).join("")}`}async function cP(t){return Xn(yi.parse(t))}async function mP(t){return Xn(Kr.parse(t))}async function lP(t){let n=yh.parse(t).map(s=>({...s})).sort((s,a)=>s.path<a.path?-1:s.path>a.path?1:0);return Xn({version:1,files:n})}async function pP(t){return Xn(Ah(t))}import{z as A}from"zod";var gP=["page-seo","root-layout-metadata","nav-items"],_P=A.object({path:A.string(),title:A.string(),description:A.string().optional(),keywords:A.string().optional(),meta_tags_json:A.record(A.string(),A.record(A.string(),A.string())).nullish(),schema_json:A.union([A.record(A.string(),A.unknown()),A.array(A.record(A.string(),A.unknown())),A.string()]).nullish(),breadcrumbs_json:A.array(A.object({name:A.string().optional(),text:A.string().optional(),url:A.string().nullish()})).nullish()}),hP=A.object({metadataBase:A.string().optional(),title:A.union([A.string(),A.object({default:A.string().optional(),template:A.string().optional(),absolute:A.string().optional()})]).optional(),description:A.string().optional(),keywords:A.string().optional(),openGraph:A.object({title:A.string().optional(),description:A.string().optional(),type:A.string().optional(),siteName:A.string().optional(),url:A.string().optional(),locale:A.string().optional(),images:A.array(A.union([A.string(),A.object({url:A.string(),alt:A.string().optional()})])).optional()}).optional(),twitter:A.object({card:A.string().optional(),title:A.string().optional(),description:A.string().optional(),images:A.array(A.string()).optional()}).optional(),alternates:A.object({canonical:A.string().optional()}).optional()}),Xr=()=>A.object({label:A.string(),href:A.string().optional(),targetType:A.enum(["page","anchor","external","email","phone","file","group"]).optional(),role:A.enum(["link","cta"]).optional(),openInNewTab:A.boolean().optional(),nofollow:A.boolean().optional(),description:A.string().optional(),badge:A.string().optional(),iconKey:A.string().optional()}),SP=Xr().extend({children:A.array(Xr()).optional()}),vh=["title","description","keywords","breadcrumbs_json.*.name","breadcrumbs_json.*.text"],Ch=["path","meta_tags_json.**","schema_json.**","breadcrumbs_json.*.url"],Dh=["title","title.default","title.template","title.absolute","description","keywords","openGraph.title","openGraph.description","openGraph.siteName","openGraph.images.*.alt","twitter.title","twitter.description"],jh=["metadataBase","openGraph.type","openGraph.url","openGraph.locale","openGraph.images.*","openGraph.images.*.url","twitter.card","twitter.images.*","alternates.canonical"],Oh=["label","description","badge"],Nh=["href","targetType","role","iconKey"],Qr={"page-seo":{localizable:vh,machine:Ch},"root-layout-metadata":{localizable:Dh,machine:jh},"nav-items":{localizable:Oh,machine:Nh}},Zr="*",Jr="**",Lh="children";function Mh(t){return typeof t=="number"||/^\d+$/.test(t)?Zr:t}function ec(t,n){let s=n.map(Mh);return t!=="nav-items"?s:s.filter(a=>a!==Zr&&a!==Lh)}function tc(t,n){let s=t.split(".");for(let a=0;a<s.length;a+=1){if(s[a]===Jr)return!0;if(a>=n.length||s[a]!==n[a])return!1}return s.length===n.length}function Uh(t,n){let s=t.split(".");if(n.length>=s.length)return!1;for(let a=0;a<n.length;a+=1){if(s[a]===Jr)return!0;if(s[a]!==n[a])return!1}return!0}function fP(t,n){let s=ec(t,n);return s.length===0?!1:Qr[t].localizable.some(a=>tc(a,s))}function bP(t,n){let s=ec(t,n);if(s.length===0)return!0;let{localizable:a,machine:i}=Qr[t];return[...a,...i].some(r=>tc(r,s)||Uh(r,s))}var EP=["product-search","migration-products","standard-form","form-submission-infrastructure"],qh=[{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/${We}.ts`,materializer:"migration-products"},{path:`components/site/generated/${We}-list.tsx`,materializer:"migration-products"},{path:`components/site/generated/${We}-list-view.tsx`,materializer:"migration-products"},{path:`components/site/generated/${We}-detail-view.tsx`,materializer:"migration-products"},{path:`app/${We}/[slug]/page.tsx`,materializer:"migration-products"},{path:`components/site/generated/${We}-breadcrumb.tsx`,materializer:"migration-products"},{path:"components/site/generated/forms/vcp-form-runtime.tsx",materializer:"standard-form"},{path:"app/api/forms/[code]/route.ts",materializer:"form-submission-infrastructure"},{path:"hooks/use-cms-form-submit.ts",materializer:"form-submission-infrastructure"},{path:"lib/cms/forms.ts",materializer:"form-submission-infrastructure"}],Fh=[{prefix:"components/site/generated/forms/form-",suffix:".tsx",materializer:"standard-form"}],IP=[{path:"lib/cms/client.ts",reason:"\u4E0D\u662F\u7269\u5316\u4EA7\u7269\uFF1A\u6A21\u677F\u81EA\u5E26\u7684 CMS \u4F20\u8F93\u5C42\uFF0C\u7269\u5316\u5668\u53EA\u5BF9\u5B83\u505A\u5B9A\u70B9\u5B57\u7B26\u4E32\u5347\u7EA7\uFF08\u591A\u90E8\u5206\u8868\u5355\u63D0\u4EA4\u3001no-store \u8BFB\uFF09\uFF0C\u6574\u4EFD\u8986\u5199\u53CD\u800C\u4F1A\u62B9\u6389\u7AD9\u70B9\u4FA7\u7684\u5176\u4ED6\u5347\u7EA7\u3002"},{path:"components/site/generated/forms/form-<id>.spec.ts",reason:"\u8DEF\u5F84\u5F52\u5E73\u53F0\u3001\u5185\u5BB9\u5F52\u7AD9\u70B9\uFF1A\u8868\u5355\u8BBE\u8BA1\u5668\u5199\u7684\u5B57\u6BB5\u6587\u6848\uFF0C\u5F52 FORM_SPEC_LOCALIZABLE_FIELD_PATHS \u7684\u5B57\u6BB5\u7EA7\u6E05\u5355\u7BA1\u8F96\u3002"}];function Gh(t){return t.length>0&&!t.includes("/")&&!t.includes(".")}function RP(t){return qh.some(n=>n.path===t)?!0:Fh.some(n=>!t.startsWith(n.prefix)||!t.endsWith(n.suffix)?!1:Gh(t.slice(n.prefix.length,t.length-n.suffix.length)))}import{z as He}from"zod";var zh=["provisioning","cms_app_created","seeded","ready","failed"],wP=He.object({tenant_id:He.string().min(1),site_id:I,collection_slug:He.string().min(1),cms_collection_id:He.string().min(1).nullable(),status:He.enum(zh),owned_by_vcp:He.boolean(),run_id:V.nullable(),last_error:He.string().nullable(),created_at:He.string().datetime(),updated_at:He.string().datetime()});var nc="/vibe/v1";function vP(t){let n=t?.trim().replace(/\/+$/,"");if(!n)return null;try{let s=new URL(n),a=s.pathname.replace(/\/+$/,"");return s.search="",s.hash="",s.pathname=a.endsWith(nc)?a:nc,s.href.replace(/\/+$/,"")}catch{return n}}import{z as u}from"zod";var Qn=u.string().url().refine(cS,{message:"URL must use http or https"}),sc=u.string().trim().pipe(Qn),Kh=u.object({task_type:u.literal("home_url"),task_url:sc,planned_num:u.number().int().min(1).max(20).optional()}).strict(),Bh=u.object({task_type:u.literal("url_list"),urls:u.array(Qn).min(1).max(1e4)}).strict(),OP=u.discriminatedUnion("task_type",[Kh,Bh]),NP=u.object({page:u.coerce.number().int().positive().default(1),page_size:u.coerce.number().int().min(1).max(20).default(20)}).strict(),LP=u.object({home_url:sc}).strict(),ut=u.string().uuid(),Pt=u.string().uuid(),MP=u.object({task_uuid:ut}).strict(),ic=u.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]),Wh=u.object({task_uuid:ut,status:u.literal("NOT_STARTED"),total:u.literal(0)}).strict(),Vh=u.object({task_uuid:ut,status:u.literal("PROCESSING"),total:u.literal(0)}).strict(),UP=u.enum(["no_suitable_page_candidate","page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"]),Hh=u.discriminatedUnion("status",[u.object({role:Qe,status:u.literal("selected"),reason_code:u.null()}).strict(),u.object({role:Qe,status:u.literal("not_found"),reason_code:u.literal("no_suitable_page_candidate")}).strict(),u.object({role:Qe,status:u.literal("unknown"),reason_code:u.enum(["page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"])}).strict()]),ac=u.array(Hh).length(7).superRefine((t,n)=>{let s=new Set(t.map(a=>a.role));s.size!==t.length&&n.addIssue({code:"custom",message:"discovery coverage roles must be unique"});for(let a of Qe.options)s.has(a)||n.addIssue({code:"custom",message:`discovery coverage is missing role ${a}`})}),$h=u.object({task_uuid:ut,status:u.literal("SUCCEEDED"),total:u.number().int().positive(),discovery_coverage:ac.optional()}).strict(),Yh=u.enum(["TASK_FAILED","PROVIDER_CAPABILITY_LIMIT","WEBSITE_UNREACHABLE"]),Xh=u.object({task_uuid:ut,status:u.literal("FAILED"),total:u.literal(0),error_code:Yh,error_message:u.string().min(1),failure_stage:ic}).strict(),qP=u.discriminatedUnion("status",[Wh,Vh,$h,Xh]),Qh=u.object({url:Qn,raw_html:u.string().min(1)}).strict(),FP=u.object({task_uuid:ut,status:u.literal("SUCCEEDED"),page:u.number().int().positive(),page_size:u.number().int().min(1).max(20),total:u.number().int().positive(),total_pages:u.number().int().positive(),pages:u.array(Qh).max(20),discovery_coverage:ac.optional()}).strict().superRefine((t,n)=>{t.total_pages!==Math.ceil(t.total/t.page_size)&&n.addIssue({code:"custom",path:["total_pages"],message:"total_pages must equal ceil(total / page_size)"}),t.pages.length>t.page_size&&n.addIssue({code:"custom",path:["pages"],message:"pages must not exceed page_size"})}),GP=u.object({task_code:Pt}).strict(),Zh=u.object({task_code:Pt,status:u.literal("NOT_STARTED")}).strict(),Jh=u.object({task_code:Pt,status:u.literal("PROCESSING")}).strict(),eS=u.object({task_code:Pt,status:u.literal("SUCCEEDED"),urls:u.array(Qn)}).strict(),tS=u.literal("SITEMAP_DISCOVERY_FAILED"),nS=u.object({task_code:Pt,status:u.literal("FAILED"),error_code:tS,error_message:u.string().min(1)}).strict(),zP=u.discriminatedUnion("status",[Zh,Jh,eS,nS]),KP=u.object({company_name:u.string().regex(/\S/u)}).strict(),sS=u.object({company_name:u.string(),brand_name:u.string(),main_products:u.array(u.string()),industry:u.array(u.string()),subfields:u.array(u.string()),business_intro:u.string(),registered_capital:u.string(),legal_representative:u.string(),target_markets:u.array(u.string()),target_customer_industries:u.array(u.string()),target_customer_roles:u.array(u.string()),purchase_scenarios:u.string(),differentiators:u.array(u.string()),competitors:u.array(u.object({name:u.string(),official_url:u.string()}).strict()).max(3),qualifications:u.array(u.string()),representative_cases:u.array(u.string()),acquisition_channels:u.array(u.string()),desired_domain:u.string(),brand_tone:u.string(),timezone:u.string()}).strict(),Zn=u.object({company_uuid:u.string().uuid(),company_info:sS,created_at:u.string().datetime(),updated_at:u.string().datetime()}),iS=Zn.extend({status:u.literal("NOT_STARTED"),last_error_code:u.null(),last_error_message:u.null(),started_at:u.null(),completed_at:u.null()}).strict(),aS=Zn.extend({status:u.literal("PROCESSING"),last_error_code:u.null(),last_error_message:u.null(),started_at:u.string().datetime(),completed_at:u.null()}).strict(),oc=Zn.extend({status:u.literal("SUCCEEDED"),last_error_code:u.null(),last_error_message:u.null(),started_at:u.string().datetime(),completed_at:u.string().datetime()}).strict(),rc=Zn.extend({status:u.literal("FAILED"),last_error_code:u.string().min(1),last_error_message:u.string().min(1),started_at:u.string().datetime(),completed_at:u.string().datetime()}).strict(),BP=u.discriminatedUnion("status",[oc,rc]),WP=u.discriminatedUnion("status",[iS,aS,oc,rc]),oS=["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"],rS=u.enum(oS),VP=u.object({error_code:rS,error_message:u.string().min(1),failure_stage:ic.optional(),task_uuid:ut.optional(),task_code:Pt.optional()}).strict();function cS(t){try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as N}from"zod";var ve=N.string().url().refine(pS,{message:"URL must use http or https"}),cc=N.string().min(1).max(512),Jn=N.string().datetime({offset:!0}),mc=N.enum(["scraping","completed","failed","expired"]),YP=N.object({url:ve,ignore_cache:N.boolean(),sitemap:N.enum(["include","skip"]),include_subdomains:N.boolean(),ignore_query_parameters:N.boolean(),limit:N.number().int().min(1).max(1e5)}).strict(),XP=N.object({links:N.array(ve).max(1e5)}).strict(),QP=N.object({url:ve,limit:N.number().int().min(1).max(1e5),max_discovery_depth:N.literal(1),crawl_entire_domain:N.literal(!1),allow_subdomains:N.literal(!0),sitemap:N.literal("skip")}).strict(),ZP=N.object({crawl_id:cc,expires_at:Jn.optional()}).strict(),JP=N.object({status:mc,urls:N.array(ve).max(1e5),next:ve.optional(),expires_at:Jn}).strict(),ew=N.object({url:ve,formats:N.tuple([N.literal("rawHtml")]),only_main_content:N.literal(!1),max_age:N.number().int().nonnegative()}).strict(),tw=N.object({url:ve,raw_html:N.string().min(1),status_code:N.number().int().min(100).max(599).nullable()}).strict(),nw=N.object({urls:N.array(ve).min(1).max(1e4),formats:N.tuple([N.literal("rawHtml")]),ignore_invalid_urls:N.literal(!1),max_age:N.number().int().nonnegative(),max_concurrency:N.number().int().positive().optional()}).strict(),sw=N.object({batch_id:cc,expires_at:Jn.optional()}).strict(),mS=N.object({url:ve,raw_html:N.string().min(1)}).strict(),iw=N.object({status:mc,total:N.number().int().nonnegative(),completed:N.number().int().nonnegative(),pages:N.array(mS).max(1e4),next:ve.optional(),expires_at:Jn}).strict().superRefine((t,n)=>{t.completed>t.total&&n.addIssue({code:"custom",path:["completed"],message:"completed must not exceed total"})}),lS=N.object({url:ve,error_message:N.string().min(1)}).strict(),aw=N.object({errors:N.array(lS).max(1e4),robots_blocked:N.array(ve).max(1e4)}).strict(),ow=N.object({active:N.number().int().nonnegative(),waiting:N.number().int().nonnegative(),max_concurrency:N.number().int().positive()}).strict();function pS(t){try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as f}from"zod";var pc=f.lazy(()=>cn),dS=f.enum(["page","block"]),ts=f.enum(["component","page","pages"]),uS=f.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),gt=uS,dc=f.object({requested_locale:gt,resolved_locale:gt,fallback_used:f.boolean()}).strict(),rn=f.object({id:f.string().uuid(),key:f.string().min(1),name:f.string().min(1)}).strict(),es=rn.extend({color:f.string().nullable()}).strict(),pw=f.object({kind:dS,category_id:f.string().uuid().optional(),tag_id:f.string().uuid().optional(),search:f.string().trim().min(1).max(200).optional(),limit:f.coerce.number().int().min(1).max(50).default(20),cursor:f.string().min(1).optional()}).strict(),gS=f.object({stable_key:f.string().min(1),type:ts,title:f.string().min(1).max(200),description:f.string().max(1e3),thumbnail_url:f.string().url().nullable(),resolved_version:f.number().int().positive(),content_schema_version:f.literal(3),category:rn.nullable(),tags:f.array(es),page_count:f.number().int().nonnegative(),component_count:f.number().int().nonnegative(),locale:dc}).strict(),dw=f.object({items:f.array(gS),facets:f.object({categories:f.array(rn),tags:f.array(es)}).strict(),next_cursor:f.string().nullable()}).strict(),uw=f.object({operation_id:f.string().uuidv7(),resolved_version:f.number().int().positive(),base_sitemap_id:f.string().uuid(),base_sitemap_version:f.number().int().positive(),sitemap:pc,target_page_id:f.string().min(1).optional()}).strict(),gw=f.object({next_sitemap:pc,applied:f.object({stable_key:f.string().min(1),resolved_version:f.number().int().positive(),template_type:ts,page_ids:f.array(f.string().min(1)),block_ids:f.array(f.string().min(1))}).strict(),locale:dc,warnings:f.array(f.string())}).strict(),uc=f.object({nodeId:f.string().uuid(),type:f.string().trim().min(1).max(100),label:f.string().trim().min(1).max(200),variant:f.string().trim().min(1).max(100).optional(),order:f.number().int().nonnegative(),props:f.record(f.string(),f.unknown()),thumbnail:f.string().url().optional(),source:f.unknown().optional()}).strict(),lc=f.object({nodeId:f.string().uuid().optional(),slug:f.string().regex(/^\/$|^\/[a-z0-9]+(?:-[a-z0-9]+)*(?:\/[a-z0-9]+(?:-[a-z0-9]+)*)*$/u),navigation:f.object({showInHeader:f.boolean(),showInFooter:f.boolean(),order:f.number().int().nonnegative()}).strict(),components:f.array(uc).min(1).max(100),thumbnail:f.string().url().optional(),source:f.unknown().optional()}).strict(),_S=f.union([uc,lc,f.object({pages:f.array(lc).min(1).max(50),thumbnail:f.string().url().optional(),source:f.unknown().optional()}).strict()]),hS=f.object({title:f.string().min(1).max(200),description:f.string().min(1).max(1e3),prompt:f.string().min(1).max(8192)}).strict(),SS=f.object({locale:gt,title:f.string().min(1).max(200),content:f.object({description:f.string().min(1).max(1e3),prompt:f.string().min(1).max(8192),nodes:f.record(f.string().uuid(),hS)}).strict()}).strict(),_w=f.object({templateId:f.string().uuid(),stableKey:f.string().min(1),type:ts,resolvedVersion:f.number().int().positive(),contentSchemaVersion:f.literal(3),structure:_S,requestedLocale:gt,resolvedLocale:gt,fallbackUsed:f.boolean(),contents:f.array(SS).length(1)}).strict().superRefine((t,n)=>{(t.type==="component"&&!("type"in t.structure)||t.type==="page"&&!("components"in t.structure)||t.type==="pages"&&!("pages"in t.structure))&&n.addIssue({code:"custom",path:["structure"],message:"Template type and structure must match."});let s=fS(t.structure),a=new Set(Object.keys(t.contents[0]?.content.nodes??{}));(s.size!==a.size||[...s].some(i=>!a.has(i)))&&n.addIssue({code:"custom",path:["contents",0,"content","nodes"],message:"Localized nodes must exactly match the structure nodes."}),t.contents[0]?.locale!==t.resolvedLocale&&n.addIssue({code:"custom",path:["contents"],message:"Resolved locale must match returned content."}),t.fallbackUsed!==(t.requestedLocale!==t.resolvedLocale)&&n.addIssue({code:"custom",path:["fallbackUsed"],message:"fallbackUsed must match locale resolution."})}),hw=f.object({items:f.array(f.object({stableKey:f.string().min(1),type:ts,title:f.string().min(1).max(200),description:f.string().max(1e3),thumbnailUrl:f.string().url().nullable(),resolvedVersion:f.number().int().positive(),contentSchemaVersion:f.literal(3),category:rn.nullable(),tags:f.array(es),pageCount:f.number().int().nonnegative(),componentCount:f.number().int().nonnegative(),requestedLocale:gt,resolvedLocale:gt,fallbackUsed:f.boolean()}).strict()),facets:f.object({categories:f.array(rn),tags:f.array(es)}).strict(),nextCursor:f.string().nullable()}).strict().superRefine((t,n)=>{t.items.forEach((s,a)=>{s.fallbackUsed!==(s.requestedLocale!==s.resolvedLocale)&&n.addIssue({code:"custom",path:["items",a,"fallbackUsed"],message:"fallbackUsed must match locale resolution."})})});function fS(t){if("type"in t)return new Set([t.nodeId]);let n="pages"in t?t.pages:[t];return new Set(n.flatMap(s=>[...s.nodeId?[s.nodeId]:[],...s.components.map(a=>a.nodeId)]))}function Sw(t){return Ti({tenant_id:t.tenant_id,site_id:t.site_id,stable_key:t.stable_key,resolved_version:t.request.resolved_version,base_sitemap_id:t.request.base_sitemap_id,base_sitemap_version:t.request.base_sitemap_version,sitemap:t.request.sitemap,target_page_id:t.request.target_page_id??null})}import{z as H}from"zod";var bS=["pending_dns","active","failed","removing"],yS=H.enum(bS),xS=["serve_site","redirect_301"],ES=H.enum(xS),IS=["traffic","ownership","certificate_delegation"],_c=H.enum(IS),RS=["pending","verified"],TS=H.enum(RS),ki=H.enum(["prepare_configuration","apply_configuration","verify_dns"]),kS=H.enum(["accepted","running","succeeded","failed"]),PS=H.object({code:H.string().min(1),message:H.string().min(1)}).strict(),wS=H.object({purpose:_c,verified:H.boolean(),observedValues:H.array(H.string())}).strict(),AS=H.object({ready:H.boolean(),providerReady:H.boolean(),dnsVerified:H.boolean(),records:H.array(wS)}).strict(),vS=H.object({purpose:_c,type:H.string().min(1),name:H.string().min(1),value:H.string().min(1),verificationStatus:TS}).strict(),gc=H.object({id:H.string().min(1),hostname:H.string().min(1),isPrimary:H.boolean(),routingMode:ES,observedStatus:yS,lastVerifiedAt:H.string().datetime().nullable(),dnsRecords:H.array(vS)}).strict().superRefine((t,n)=>{CS(t.hostname)||n.addIssue({code:"custom",path:["hostname"],message:"hostname must be a canonical ASCII hostname"}),t.isPrimary&&t.routingMode!=="serve_site"&&n.addIssue({code:"custom",path:["routingMode"],message:"a primary domain must serve the site"}),!t.isPrimary&&t.routingMode!=="redirect_301"&&n.addIssue({code:"custom",path:["routingMode"],message:"a non-primary domain must redirect with 301"})}),hc=H.object({primaryDomain:gc.nullable(),redirectDomains:H.array(gc)}).strict().superRefine((t,n)=>{t.primaryDomain!==null&&(!t.primaryDomain.isPrimary||t.primaryDomain.routingMode!=="serve_site")&&n.addIssue({code:"custom",path:["primaryDomain"],message:"primaryDomain must be primary and serve the site"});for(let[a,i]of t.redirectDomains.entries())(i.isPrimary||i.routingMode!=="redirect_301")&&n.addIssue({code:"custom",path:["redirectDomains",a],message:"redirectDomains must be non-primary 301 redirects"});t.primaryDomain!==null&&t.redirectDomains.some(i=>i.hostname===t.primaryDomain?.hostname)&&n.addIssue({code:"custom",path:["redirectDomains"],message:"primaryDomain must not also be a redirect"});let s=[...t.primaryDomain===null?[]:[t.primaryDomain.hostname],...t.redirectDomains.map(a=>a.hostname)];new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["redirectDomains"],message:"domain hostnames must be unique"})}),Pi=H.object({id:H.string().min(1),type:ki,status:kS,error:PS.nullable(),result:AS.nullable().optional()}).strict().superRefine((t,n)=>{t.status==="failed"&&t.error===null&&n.addIssue({code:"custom",path:["error"],message:"failed operations must include a stable error"}),t.status!=="failed"&&t.error!==null&&n.addIssue({code:"custom",path:["error"],message:"non-failed operations must not include an error"}),t.result!==void 0&&t.result!==null&&(t.type!=="verify_dns"||t.status!=="succeeded")&&n.addIssue({code:"custom",path:["result"],message:"DNS verification results only belong to succeeded verify_dns operations"})});function CS(t){if(t!==t.trim()||t!==t.toLowerCase()||t.length>253||t.endsWith("."))return!1;let n=t.split(".");return n.length>=2&&n[n.length-1].length>=2&&n.every(s=>s.length>=1&&s.length<=63&&/^[a-z0-9-]+$/.test(s)&&!s.startsWith("-")&&!s.endsWith("-"))}import{z as Ce}from"zod";import{z as R}from"zod";var DS=R.enum(["active","completed","canceled"]),jS=R.enum(["quality","domain","gsc","publish"]),Sc=R.enum(["pending","running","succeeded","failed"]),fc=R.enum(["pending","running","completed"]),OS=R.object({group_code:R.string().min(1),name:R.string().min(1),score:R.number().nonnegative(),total_score:R.number().nonnegative(),pass_score:R.number().nonnegative(),running_status:fc,result_text:R.string()}).strict(),NS=R.object({dimension_code:R.enum(["reach","trust","convert","safe"]),name:R.string().min(1),alias_en:R.string().min(1),description:R.string(),tips:R.string(),score:R.number().nonnegative(),total_score:R.number().nonnegative(),pass_score:R.number().nonnegative(),running_status:fc,problem_group_count:R.number().int().nonnegative(),groups:R.array(OS)}).strict(),LS=R.object({id:R.number().int().positive(),task_code:R.string().uuid(),scene_code:R.enum(["site_publish","vcp_published_pages","content_publish"]),tenant_id:R.string().min(1),vcp_site_id:I,cms_site_id:R.string().min(1),checked_url:R.string().url(),quality_params:R.record(R.string(),R.unknown()).nullable(),status:Sc,error_info:R.record(R.string(),R.unknown()).nullable(),created_at:R.string().min(1),updated_at:R.string().min(1)}).strict(),MS=R.union([R.object({}).strict(),R.object({remediation_items:R.record(R.string(),R.unknown()),summary:R.object({final_score:R.number().nonnegative(),pass_score:R.number().nonnegative(),group_count:R.number().int().nonnegative(),problem_group_count:R.number().int().nonnegative()}).strict(),dimensions:R.array(NS)}).strict()]),US=R.object({quality_info:LS,quality_detail:MS}).strict().superRefine((t,n)=>{t.quality_info.status==="succeeded"&&!("summary"in t.quality_detail)&&n.addIssue({code:"custom",message:"succeeded quality tasks require complete detail",path:["quality_detail"]})}),_t=R.object({id:na,tenant_id:R.string().min(1),site_id:I,status:DS,current_step:jS,quality_task_code:R.string().uuid().nullable(),quality_task_status:Sc,publish_deployment_id:Ge.nullable(),domain_hostname:R.string().min(1).nullable(),domain_operation_type:ki.nullable(),domain_operation_payload:R.record(R.string(),R.unknown()).nullable(),domain_preparation_operation_id:R.string().min(1).nullable(),domain_operation_id:R.string().min(1).nullable(),revision:R.number().int().positive(),created_at:R.string().min(1),updated_at:R.string().min(1),completed_at:R.string().min(1).nullable(),canceled_at:R.string().min(1).nullable()}).strict().superRefine((t,n)=>{if(t.domain_operation_type===null){t.domain_operation_payload!==null&&n.addIssue({code:"custom",path:["domain_operation_payload"],message:"domain_operation_payload must be null without an active domain operation"}),t.domain_operation_id!==null&&n.addIssue({code:"custom",path:["domain_operation_id"],message:"domain_operation_id must be null without an active domain operation"});return}t.domain_hostname===null&&n.addIssue({code:"custom",path:["domain_hostname"],message:"an active domain operation requires a hostname"}),t.domain_operation_payload===null&&n.addIssue({code:"custom",path:["domain_operation_payload"],message:"an active domain operation requires a payload"})}),kw=R.object({}).strict(),Pw=R.object({expected_revision:R.number().int().nonnegative(),current_step:R.enum(["domain","gsc","publish"]),skip_domain_binding:R.boolean().optional()}).strict(),ww=R.object({expected_revision:R.number().int().nonnegative()}).strict(),qS=R.object({workflow:_t.nullable(),can_cancel:R.boolean()}).strict(),Aw=L(qS).strict(),FS=R.object({workflow:_t,can_cancel:R.boolean()}).strict(),vw=L(FS).strict(),GS=R.object({workflow:_t,deployment:R.lazy(()=>nt)}).strict(),Cw=L(GS).strict(),zS=R.object({workflow:_t,can_cancel:R.boolean(),quality_result:US.optional(),message:R.string().min(1).optional()}).strict(),Dw=L(zS).strict();var KS=Ce.object({hostname:Ce.string().min(1),expected_revision:Ce.number().int().nonnegative()}).strict(),bc=Ce.object({workflow:_t,operation:Pi}).strict(),BS=L(bc).strict(),wi=Ce.object({workflow:_t,operation:Pi.nullable()}).strict(),WS=L(wi).strict(),VS=wi,HS=L(VS).strict(),Uw=L(hc).strict(),$S=Ce.object({published:Ce.boolean(),hostname:Ce.string(),url:Ce.string(),sandbox_url:Ce.union([Ce.string().url(),Ce.literal("")])}).strict().superRefine((t,n)=>{t.published||(t.hostname!==""&&n.addIssue({code:"custom",path:["hostname"],message:"unpublished sites must not include a hostname"}),t.url!==""&&n.addIssue({code:"custom",path:["url"],message:"unpublished sites must not include a URL"}))}),qw=L($S).strict(),Fw=KS,Gw=bc,zw=BS,Kw=wi,Bw=WS,Ww=HS;import{z as Pe}from"zod";var YS=["started","success","failed","canceled"],Ai=Pe.enum(YS),XS=["inactive","pending_binding","active"],vi=Pe.enum(XS),QS=["domain","url_prefix"],Ci=Pe.enum(QS),ZS=["not_connected","authorizing","matching_property","ready","failed","canceled","domain_mismatch"],Di=Pe.enum(ZS),Fe=Pe.string().nullable(),yc=Pe.object({}).strict(),ji=Pe.object({authorize_url:Pe.string().url(),custom_domain:Fe}).strict(),xc=L(ji),JS=Pe.object({auth_status:Ai,binding_status:vi,credential_connected:Pe.boolean(),custom_domain:Fe,gsc_site_url:Fe,property_type:Ci.nullable(),auth_error_code:Fe,auth_error_message:Fe}).strict(),Ec=Pe.object({auth_status:Ai,binding_status:vi,credential_connected:Pe.boolean(),custom_domain:Fe,gsc_site_url:Fe,property_type:Ci.nullable(),auth_error_code:Fe,auth_error_message:Fe,current_domain:Fe,state:Di,ready:Pe.boolean()}).strict().superRefine((t,n)=>{let s=tf(t,t.current_domain),a=s==="ready";t.state!==s&&n.addIssue({code:"custom",path:["state"],message:`state must equal ${s} for the supplied GSC facts`}),t.ready!==a&&n.addIssue({code:"custom",path:["ready"],message:`ready must equal ${String(a)} for the supplied GSC facts`})}),ef=L(Ec);function mn(t){let n=t?.trim()??"";if(!n)return"";let s=/^[a-z][a-z0-9+.-]*:\/\//i.test(n)?n:`https://${n}`;try{return new URL(s).hostname.replace(/\.+$/,"").toLowerCase()}catch{return n.replace(/^[a-z][a-z0-9+.-]*:\/\//i,"").split(/[/?#]/,1)[0].replace(/\.+$/,"").toLowerCase()}}function tf(t,n){let s=t.gsc_site_url?.trim()??"",a=mn(t.custom_domain),i=mn(n??("current_domain"in t?t.current_domain:void 0)),r=a.length>0&&i.length>0&&a===i,g=nf(s,t.property_type,i);return t.auth_status==="canceled"?"canceled":t.auth_status==="failed"?"failed":t.auth_status==="started"?"authorizing":!t.credential_connected||t.binding_status==="inactive"?"not_connected":s.length===0||t.property_type===null?"matching_property":!r||!g?"domain_mismatch":t.binding_status==="pending_binding"?"matching_property":t.auth_status==="success"&&t.binding_status==="active"&&t.credential_connected&&s.length>0&&r&&g?"ready":"failed"}function nf(t,n,s){let a=t?.trim()??"",i=mn(s);if(!a||!i||!n)return!1;if(n==="domain"){let r=/^sc-domain:(.+)$/i.exec(a);if(!r)return!1;let g=r[1].trim();if(!g||/[/:?#]/.test(g))return!1;let c=mn(g);return c?i===c||i.endsWith(`.${c}`):!1}try{let r=new URL(a);return r.protocol!=="https:"||r.username||r.password||r.port||r.pathname!=="/"||r.search||r.hash?!1:mn(r.hostname)===i}catch{return!1}}var Yw=yc,Xw=ji,Qw=xc,Zw=Di,Jw=Ai,eA=vi,tA=Ci,nA=Di,sA=yc,iA=ji,aA=xc,oA=JS,rA=Ec,cA=ef;var Ic=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,Rc="VCP_E2B_PREVIEW_PROXY_DOMAIN must be a valid hostname.";function sf(t){let n=t?.trim().toLowerCase()??"";if(!n)return null;if(n.length>253||!n.includes(".")||!n.split(".").every(s=>Ic.test(s)))throw new Error(Rc);return n}function lA(t){let n=sf(t.proxyDomain);if(!n)return null;let s=t.sandboxId.trim();if(!Ic.test(s))throw new Error("sandboxId must be a valid DNS label.");if(`${s}.${n}`.length>253)throw new Error(Rc);return`https://${s}.${n}/`}function af(t,n,s=t){let a=new Map(t.map(c=>[c.slug,c])),i=new Map(s.map(c=>[c.id,c])),r=new Map(t.map(c=>{let _=i.get(c.id);return _&&_.slug!==null&&_.slug!==c.slug?[_.slug,c]:null}).filter(c=>c!==null)),g=new Set(s.map(c=>c.slug).filter(c=>c!==null&&!a.has(c)));return{primaryLinks:Tc(n.primaryLinks,t,a,r,g,i,"showInHeader"),footerLinks:Tc(n.footerLinks,t,a,r,g,i,"showInFooter")}}function Tc(t,n,s,a,i,r,g){let c=new Set,_=[];for(let[q,F]of t.entries()){let ee=of(F.href),ae=ee===null?void 0:s.get(ee)??a.get(ee);if(ee!==null&&i.has(ee)&&!s.has(ee)&&!a.has(ee))continue;if(ae?.slug==="/"){_.push({kind:"independent",link:{...F,label:kc(F,ae,r)}});continue}if(!ae){_.push({kind:"independent",link:F});continue}if(!ae.navigation[g])continue;c.add(ae.slug);let Dt=ee===ae.slug?F.href:rf(F.href,ae.slug);_.push({kind:"page",page:ae,link:{...F,label:kc(F,ae,r),href:Dt},index:q})}let j=_.filter(q=>q.kind==="page").sort((q,F)=>q.page.navigation.order-F.page.navigation.order||q.index-F.index),E=0,O=_.map(q=>q.kind==="page"?j[E++].link:q.link);for(let q of[...n].filter(F=>F.slug!=="/"&&F.navigation[g]).sort((F,ee)=>F.navigation.order-ee.navigation.order))c.has(q.slug)||O.push({label:q.title,href:q.slug});return O}function kc(t,n,s){let a=s.get(n.id);return t.label===(a?.title??n.title)?n.title:t.label}function of(t){if(!t.startsWith("/")||t.startsWith("//"))return null;let n=t.search(/[?#]/u);return n===-1?t:t.slice(0,n)}function rf(t,n){let s=t.search(/[?#]/u);return s===-1?n:`${n}${t.slice(s)}`}import{z as k}from"zod";var Pc=20*1024*1024,cf=Pc,wc=["jpg","jpeg","png","gif","webp","bmp"],Ac=["mp4","avi","mov","webm","mkv"],vc=["mp3","wav","aac","flac","ogg","wma","m4a"],Cc=["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","md","csv"],Dc=[...Cc,"zip","rar","json","xmind","psd","ai","fig","sketch"],mf=[...wc,...Ac,...vc,...Dc],jc=["image/jpeg","image/png","image/gif","image/webp","image/bmp"],Oc=["video/mp4","video/x-msvideo","video/quicktime","video/webm","video/x-matroska"],Nc=["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"],lf=[...jc,...Oc,...Nc],Lc=k.enum(["image","video","audio","file"]),Mc=k.enum(["external","ai_generated","unsplash"]),Oi=k.object({resource_id:k.string().min(1),name:k.string().min(1).max(255),url:k.string().url(),thumbnail_url:k.union([k.string().url(),k.literal("")]),mime_type:k.string().trim().min(3).max(127),size:k.number().int().nonnegative(),width:k.number().int().positive().nullable(),height:k.number().int().positive().nullable(),source:Mc,created_at:k.string().min(1).nullable()}),pf=k.object({page:k.coerce.number().int().min(1).default(1),page_size:k.coerce.number().int().min(1).max(100).default(24),keyword:k.string().trim().max(100).optional(),file_type:Lc.default("image")}),df=k.object({code:k.literal(0),message:k.string(),data:k.object({items:k.array(Oi),page:k.number().int().min(1),page_size:k.number().int().min(1),total:k.number().int().nonnegative()})}),uf=k.object({code:k.literal(0),message:k.string(),data:Oi}),Uc=k.object({provider_id:k.string().min(1),url:k.string().url(),thumbnail_url:k.string().url(),width:k.number().int().positive(),height:k.number().int().positive(),alt:k.string(),photographer_name:k.string().min(1),photographer_url:k.string().url(),photo_url:k.string().url(),download_location:k.string().url(),dominant_color:k.string().nullable()}),gf=k.object({query:k.string().trim().min(1).max(100),page:k.coerce.number().int().min(1).default(1),page_size:k.coerce.number().int().min(1).max(30).default(18),orientation:k.enum(["landscape","portrait","squarish"]).optional()}),_f=k.object({code:k.literal(0),message:k.string(),data:k.object({items:k.array(Uc),page:k.number().int().min(1),page_size:k.number().int().min(1),total:k.number().int().nonnegative(),total_pages:k.number().int().nonnegative()})}),qc=k.string().url().refine(yf,{message:"download_location must be an official Unsplash download URL"}),hf=k.object({download_location:qc}),Sf=k.object({code:k.literal(0),message:k.string(),data:k.object({reported:k.boolean()})}),ff=k.object({source_id:k.number().int().positive(),source_title:k.string().min(1).max(255),source_url:ze,resource_id:k.number().int().positive()}),bf=k.object({code:k.literal(0),message:k.string(),data:k.object({reported:k.boolean()})});function yf(t){if(!URL.canParse(t))return!1;let n=new URL(t);return n.protocol==="https:"&&n.hostname==="api.unsplash.com"&&n.username===""&&n.password===""&&n.port===""&&n.hash===""&&/^\/photos\/[^/]+\/download$/.test(n.pathname)}import{z as De}from"zod";var xf=De.object({colorSeeds:De.object({primary:De.string().min(1).max(40),accent:De.string().min(1).max(40),foreground:De.string().min(1).max(40).optional()}).strict().optional(),surfaceMode:De.enum(["light","dark"]).optional(),fonts:De.object({heading:De.string().min(1).max(60),body:De.string().min(1).max(60)}).strict().optional()}).strict().refine(t=>t.colorSeeds!==void 0||t.surfaceMode!==void 0||t.fonts!==void 0,{message:"colorSeeds, surfaceMode, or fonts is required"}),Ef=De.object({ok:De.literal(!0),design_plan_version:De.number().int().positive(),snapshot_id:x});var Mi=e.object({heading:e.string().min(1).max(160).optional(),body:e.string().min(1).max(160).optional(),paletteIntent:e.string().min(1).max(400).optional(),surfaceMode:e.enum(["light","dark"]).optional(),radius:e.enum(["none","sm","md","lg","xl"]).optional(),density:e.enum(["compact","comfortable","airy","editorial"]).optional(),motionPreset:e.enum(["subtle","moderate","expressive"]).optional(),colorSeeds:e.object({primary:e.string().min(1).max(40),accent:e.string().min(1).max(40),foreground:e.string().min(1).max(40).optional(),neutral:e.string().min(1).max(40).optional(),supporting:e.array(e.string().min(1).max(40)).max(4).optional()}).optional(),imagePalette:e.object({background:e.string().min(1).max(40).optional(),foreground:e.string().min(1).max(40).optional(),card:e.string().min(1).max(40).optional(),muted:e.string().min(1).max(40).optional(),border:e.string().min(1).max(40).optional()}).optional(),themeId:e.string().min(1).max(60).optional(),themeDescription:e.string().min(1).max(400).optional(),aestheticNote:e.string().min(1).max(300).optional()}),Ni=e.enum(["material","reference","brief","industry"]),If=e.object({market:e.object({value:e.string().min(1).max(200),source:Ni}),customer:e.object({value:e.string().min(1).max(200),source:Ni}),purpose:e.object({options:e.array(e.string().min(1).max(60)).min(2).max(4),selected:e.string().min(1).max(60),source:Ni})}),Rf=e.enum(["text-options","motion-slider","positioning"]),Ui=e.enum(["none","subtle","moderate","expressive"]),Tf=e.enum(["compact","comfortable","airy","editorial"]),kf=Ui,Bc=e.object({skill_name:e.string().min(1),rationale:e.string().min(4).max(200),confidence:e.enum(["high","medium","low"]).optional(),displayName:e.object({zh:e.string().min(1),en:e.string().min(1)}).partial().optional()}),Pf=e.object({value:e.string(),label:e.string(),desc:e.string().optional(),impact:e.string().optional(),isRecommended:e.boolean().optional(),preselect:e.boolean().optional(),visualHints:Mi.optional(),conversionHints:rt.optional()}),wf=e.object({id:e.string(),type:Rf,question:e.string(),tag:e.string(),aiThinking:e.string(),options:e.array(Pf),source:e.enum(["ai-detected","always-ask"]),sourceDetail:e.string(),positioning:If.optional()}),qi=e.object({questions:e.array(wf).min(1).max(6)}),FA=e.object({tenant_id:e.string().min(1),site_id:I,brief_id:St,brief:e.string().min(20).max(1e3),site_default_locale:de.optional(),owner_locale:de.optional(),input_context:e.object({facts:e.array(un).max(120),conflicts:e.array(_n).max(20),reference:gn.optional(),sources:e.array(e.object({type:ls,title:e.string().max(120).optional(),status:ps})).max(16).optional()}).optional()}),Wc=e.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),GA=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:V,at:e.string().min(1)}),e.object({type:e.literal("skill.selecting"),category:e.literal("page-generation"),available:e.array(e.object({id:e.string().min(1),name:e.string().min(1)})).max(20),at:e.string().min(1)}),e.object({type:e.literal("skill.selected"),category:e.literal("page-generation"),selected:e.object({id:e.string().min(1),name:e.string().min(1),reason:e.string().min(1).max(200)}),at:e.string().min(1)}),e.object({type:e.literal("clarify.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("clarify.archetype_proposals"),proposals:e.array(Bc).min(1).max(5),at:e.string().min(1)}),e.object({type:e.literal("clarify.finished"),questions_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),error_category:Wc.optional(),retryable:e.boolean().optional(),attempts:e.number().int().positive().optional(),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),at:e.string().min(1)})]),zA="SITE_PLANNING_INPUT_FROZEN",KA="SITE_PLANNING_LOCKED",BA="SITE_STRUCTURE_CONFIRMATION_REQUIRED",WA="SITE_STRUCTURE_CONFIRMATION_STALE",VA=e.object({tenant_id:e.string().min(1),owner_user_id:rs,name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),HA=e.object({name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),$A=e.object({name:e.string().min(1).max(120)}),YA=e.object({name:e.string().min(1).max(120),default_locale:de.optional()}),XA=e.object({body:e.string().min(20).max(1e3)}),QA=e.object({body:e.string().min(20).max(1e3)}),Fi=e.string().url().refine(t=>{try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}},{message:"URL must use http or https protocol"}),ZA=e.object({tenant_id:e.string().min(1),site_id:I.optional(),site_url:Fi,site_name:e.string().trim().min(1).max(255).optional()}),JA=L(Ua),ev=L(qa),tv=L(Fa),nv=L(eo),sv=L(to),iv=L(no),av=L(io),ov=L(ao),rv=L(oo),cv=L(e.object({site_id:I,site_url:Fi})),at=e.object({id:I,tenant_id:e.string().min(1),owner_user_id:rs.nullable(),name:e.string().min(1),slug:e.string().min(1),status:zs,deployment_status:Ks,archived_at:e.string().min(1).nullable(),current_sitemap_id:ke.nullable(),confirmed_sitemap_id:ke.nullable().optional(),confirmed_sitemap_version:e.number().int().positive().nullable().optional(),structure_confirmed_at:e.string().min(1).nullable().optional(),migration_content_requested:e.boolean().optional(),current_snapshot_id:x.nullable(),published_deployment_id:Ge.nullable().optional(),deployed_url:e.string().url().nullable(),default_locale:de,owner_locale:de.optional(),cms_site_id:ba.nullable().optional(),cms_site_url:Fi.nullable().optional(),parent_site_id:I.nullable().optional(),mount_path:e.string().min(1).nullable().optional(),schema_version:e.literal(1),created_at:e.string().min(1),updated_at:e.string().min(1)}),Gi=e.object({id:St,tenant_id:e.string().min(1),site_id:I,body:e.string().min(1),source:e.enum(["user","import","system"]),created_at:e.string().min(1),updated_at:e.string().min(1)}),mv=e.object({site:at,brief:Gi,next_step:e.literal("clarify")}),lv=e.object({site:at,brief:Gi}),pv=e.object({brief:Gi}),Af=e.enum(["queued","running","succeeded","failed","cancelled"]),Vc=e.enum(["clarify","sitemap","workspace"]),Hc=e.enum(["clarify","sitemap","initial_generation","iteration"]),$c=e.enum(["clarify","sitemap","workspace","summarize"]),it=e.object({id:V,tenant_id:e.string().min(1),site_id:I,agent_type:Vc,run_kind:Hc,status:Af,model_route:$c,started_at:e.string().min(1).nullable(),finished_at:e.string().min(1).nullable(),error_code:e.string().min(1).nullable(),created_at:e.string().min(1)}),dv=e.object({run_id:V.optional(),site_id:I,agent_type:Vc,run_kind:Hc.optional(),model_route:$c,input:e.record(e.string(),e.unknown()).optional()}).superRefine((t,n)=>{ln(t.input)&&n.addIssue({code:"custom",path:["input"],message:"Agent run input must not contain secrets"})}),uv=e.object({agent_run:it,next_step:e.literal("stream_events")}),Yc=e.enum(["draft","candidate","deleting","current","failed"]),$e=e.object({id:x,tenant_id:e.string().min(1),site_id:I,version:e.number().int().positive(),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),template_version:Oe.nullable().optional(),reason:e.enum(["initial_generation","workspace_edit","pre_deploy","manual_save","rollback","template_upgrade","subsite_clone"]),status:Yc,created_at:e.string().min(1)}),gv=e.object({snapshot_id:x,creation_key:e.string().min(1),manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),object_key:e.string().min(1),template_version:Oe.optional(),reason:$e.shape.reason,status:e.enum(["draft","candidate","current","failed"]).default("candidate"),source_run_id:V.optional()}),_v=e.object({site:at,snapshot:$e,next_step:e.literal("workspace")}),hv=e.object({expected_manifest_hash:$e.shape.manifest_hash,manifest_hash:$e.shape.manifest_hash,object_key:$e.shape.object_key}).strict(),Sv=e.union([e.object({base_snapshot_id:x.nullable(),source_run_id:V.optional()}).strict(),e.object({skip_base_check:e.literal(!0)}).strict()]),vf=e.object({site:at,snapshot:$e,next_step:e.literal("workspace")}),fv=e.object({snapshot:$e}),bv=e.object({status:e.literal("deleting"),snapshot_id:x,object_key:e.string().min(1)}),yv=e.object({status:e.literal("deleted"),snapshot_id:x}),as=e.object({id:ea,tenant_id:e.string().min(1),site_id:I,snapshot_id:x,version:e.number().int().positive(),accepted_commit:e.string().min(1),source_run_id:V.nullable(),created_at:e.string().min(1)}),Cf=as.extend({reason:$e.shape.reason,status:Yc}),xv=e.object({accepted_commit:e.string().min(1),source_run_id:V.optional()}),Ev=e.object({site_version:as,next_step:e.literal("workspace")}),Iv=e.object({owner_id:e.string().min(1)}).strict(),Rv=e.discriminatedUnion("acquired",[e.object({acquired:e.literal(!0)}).strict(),e.object({acquired:e.literal(!1)}).strict()]),Tv=e.object({owner_id:e.string().min(1)}).strict(),kv=e.object({released:e.literal(!0)}).strict(),Pv="TEMPLATE_UPGRADE_LOCK_LOST",wv=e.object({base_snapshot_id:x,accepted_commit:as.shape.accepted_commit,owner_id:e.string().min(1)}).strict(),Av=vf.strict(),vv=e.object({site_versions:e.array(Cf)}),Cv=e.object({site:at,snapshot:$e,site_version:as,next_step:e.literal("workspace")}),Dv=e.object({snapshot_id:x,force_rehydrate:e.boolean().optional()}),Df=e.discriminatedUnion("status",[e.object({status:e.literal("ready"),snapshot_id:x,preview_url:e.string().min(1)}),e.object({status:e.literal("failed"),code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})]),jv=e.object({tenant_id:e.string().min(1),site_id:I,snapshot_id:x}).strict(),Ov=Df,zi=e.enum(bt),Xc=e.enum(["quality_check","publish"]),nt=e.object({id:Ge,tenant_id:e.string().min(1),site_id:I,snapshot_id:x,type:Xc.default("publish"),version:e.number().int().positive(),status:zi,provider:e.enum(["cloudflare"]),url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),Nv=e.object({tenant_id:e.string().min(1),site_id:I,expected_snapshot_id:x}).strict(),Lv=e.object({deployment:nt}),Mv=e.object({tenant_id:e.string().min(1),site_id:I,deployment_id:Ge}).strict(),Uv=e.object({deployment:nt}),qv=e.object({}).strict(),Fv=e.object({snapshot_id:x.optional()}).strict(),jf=e.object({deployment:nt}),Gv=L(jf),zv=e.object({deployment:nt.nullable()}),Kv=e.object({deployment:nt}),Fc=e.object({id:Ge,type:Xc.default("publish"),status:zi,url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable()}),Of=e.object({current:Fc.nullable(),latest_released:Fc.nullable()}),Bv=L(Of),Nf=e.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),wt=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:I,deployment_id:Ge,seq:e.number().int().positive(),sent_at:e.string().min(1)}),ns=e.object({deployment:nt,steps:Wo.default([])}),Wv=e.discriminatedUnion("type",[wt.extend({type:e.literal("deployment.snapshot"),payload:ns}),wt.extend({type:e.literal("deployment.status.changed"),payload:ns}),wt.extend({type:e.literal("deployment.finished"),payload:ns}),wt.extend({type:e.literal("deployment.failed"),payload:ns}),wt.extend({type:e.literal("deployment.realtime.recovered"),payload:e.object({action:e.literal("refresh")})}),wt.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})})]),Vv=e.object({tenant_id:e.string().min(1),site_id:I,deployment_id:Ge,status:zi,updated_at:e.string().min(1)}),Lf="vcp:deployments",Hv={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:Lf,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...Nf.options]},Mf=e.object({error:e.object({code:e.string().min(1),message:e.string().min(1),details:e.unknown().optional(),request_id:e.string().min(1).optional(),retryable:e.boolean().default(!1)})}),$v=e.object({error:Mf.shape.error.extend({code:e.literal("AGENT_RUN_IN_FLIGHT"),details:e.object({code:e.literal("AGENT_RUN_IN_FLIGHT"),message:e.string().min(1),agent_run:it})})}),Yv=e.object({colors:e.record(e.string(),e.string()).default({}),typography:e.record(e.string(),e.string()).default({}),spacing:e.record(e.string(),e.string()).default({}),motion:e.record(e.string(),e.string()).default({})}),Uf=e.object({theme_id:e.string().min(1),paletteIntent:e.string().min(1),tone:e.string().min(1),mediaMood:e.string().min(1),motionLevel:Ui.optional(),userVisualHints:Mi.optional()}),qf=e.object({question:e.string().min(1),answer:e.string().min(1)}),Xv=e.object({query:e.string().min(1),keywords:e.array(e.string()).default([]),orientation:e.enum(["landscape","portrait","square"]).optional(),role:e.enum(["hero","section","card","gallery","testimonial","decorative"]),altHint:e.string().min(1)}),Qv=e.object({id:e.string().min(1),role:e.enum(["site_background","nav_background","footer_background"]),query:e.string().min(1),keywords:e.array(e.string()).default([]),treatment:e.enum(["cover","fixed-cover","subtle-texture"]),altHint:e.string().optional()}),Ff=e.object({provider:e.enum(["unsplash","pexels"]),providerLabel:e.enum(["Unsplash","Pexels"]),providerHref:e.string().url(),photoHref:e.string().url().optional(),photographerName:e.string().optional(),photographerHref:e.string().url().optional(),requiresAttribution:e.boolean()}),Zv=e.object({src:e.string().min(1),alt:e.string().min(1),width:e.number().int().positive().optional(),height:e.number().int().positive().optional(),provider:e.enum(["unsplash","pexels","placeholder"]).optional(),providerId:e.string().optional(),photoUrl:e.string().url().optional(),photographer:e.string().optional(),photographerUrl:e.string().url().optional(),credit:e.string().optional(),dominantColor:e.string().optional(),attribution:Ff.optional()}),Gf=e.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),At=e.object({id:e.string().min(1),name:e.string().min(1),category:e.literal("page-generation"),version:e.string().min(1).optional(),reason:e.string().min(1).max(200),source:Gf.default("system_recommended")}),$=e.string().min(1).max(2e3),Gc=e.string().min(1).max(120),Qc=e.object({visualDirection:$,brandFeeling:$,paletteIntent:$,typographyIntent:$,density:Tf,motionLevel:kf,motionPreset:e.enum(["subtle","moderate","expressive"]).optional(),mediaStrategy:$,compositionRules:e.array($).max(20),avoidPatterns:e.array($).max(20),fonts:e.object({heading:e.string().min(1),body:e.string().min(1)}).optional(),colorSeeds:e.object({primary:e.string().min(1).max(40),accent:e.string().min(1).max(40),foreground:e.string().min(1).max(40).optional(),neutral:e.string().min(1).max(40).optional(),supporting:e.array(e.string().min(1).max(40)).max(4).optional()}).optional(),surfaceMode:e.enum(["light","dark"]).optional(),radius:e.enum(["none","sm","md","lg","xl"]).optional(),imagePalette:e.object({background:e.string().min(1).max(40).optional(),foreground:e.string().min(1).max(40).optional(),card:e.string().min(1).max(40).optional(),muted:e.string().min(1).max(40).optional(),border:e.string().min(1).max(40).optional()}).optional()}),Ki=160,Zc=e.object({routeGoal:$,narrativeArc:$,firstViewportIntent:$,visualContinuity:$,sectionRhythm:$,avoidPatterns:e.array($).max(20),displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(Ki).optional(),metaTitle:e.string().min(1).max(120).optional(),metaDescription:e.string().min(1).max(320).optional(),primaryKeyword:e.string().min(1).max(160).optional(),longTailKeywords:e.array(e.string().min(1).max(160)).max(3).optional()}),Jc=e.enum(["model_call","validation","repair","preview","worker_group"]),st=e.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),em=e.object({sectionRole:$,contentIntent:$,layoutIntent:$,visualIntent:$,mediaIntent:$,motionIntent:$,copyTone:$,displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(Ki).optional(),ctaIntent:$.optional(),continuityWithPrevious:$.optional(),avoidRepeating:e.array($).max(20).optional(),industryRecipeRefs:e.array(Gc).max(12).optional(),templateRecipeRefs:e.array(Gc).max(12).optional()}),tm=e.object({siteName:e.string().min(1).max(120),tagline:e.string().min(1).max(200).optional(),primaryCta:e.object({label:e.string().min(1).max(60),target:e.string().min(1).max(200)}).optional(),trustSignals:e.array(e.string().min(1).max(60)).max(6).optional(),industry:e.string().min(1).max(40).optional()}),zf=e.enum(["solid","floating"]),Kf=e.enum(["background","card","primary","frosted"]),Bf=e.enum(["sticky","hide-on-scroll","static"]),Wf=e.enum(["bar","island"]),Vf=e.object({variant:zf,surface:Kf.optional(),behavior:Bf.optional(),shape:Wf.optional()}),Hf=e.object({form:$,layoutIntent:$,scrollBehavior:$,shell:Vf.optional(),avoidPatterns:e.array($).max(10).optional()}),$f=e.enum(["background","card","primary","inverse"]),Yf=e.object({surface:$f}),Xf=e.object({form:$,composition:$,shell:Yf.optional(),avoidPatterns:e.array($).max(10).optional()}),Qf=e.object({pattern:$,intent:$}),nm=e.object({header:Hf,footer:Xf,mobileNav:Qf}),sm=e.object({schemaVersion:e.literal(1).default(1),siteDesignContext:Qc,routeCards:e.record(e.string().min(1),Zc),blockContexts:e.record(e.string().min(1),em),selectedSkillPacks:e.array(At).max(3).optional(),branding:tm.optional(),chromeDesign:nm.optional()}),Jv=e.object({siteDesignContext:Qc.omit({imagePalette:!0}).optional(),routeCards:e.record(e.string().min(1),Zc).optional(),blockContexts:e.record(e.string().min(1),em).optional(),branding:tm.optional(),chromeDesign:nm.optional()}),xe=e.string().trim().min(1),Bi=e.object({id:xe,label:e.string().trim().min(1),type:e.string(),variant:e.string().optional(),order:e.number(),props:e.record(e.string(),e.unknown()),meta:e.object({aiGenerated:e.boolean(),userEdited:e.boolean(),lastEditedAt:e.string(),lastEditedBy:e.enum(["ai","user"]),userInstruction:e.string().optional()}).optional()}).strict(),im=e.string().regex(Ft,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),Zf=new RegExp(`^/(?:${xt}(?:/${xt})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),Jf=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,eb=e.union([e.string().regex(Zf),e.string().regex(Jf)]),zc=e.object({label:e.string(),href:eb}).passthrough(),tb=e.object({primaryLinks:e.array(zc),footerLinks:e.array(zc)}),am=e.object({showInHeader:e.boolean(),showInFooter:e.boolean(),order:e.number()}).strict(),Wi=e.object({id:xe,slug:im,title:e.string().trim().min(1),blocks:e.array(Bi).min(1),navigation:am}).strict(),nb=Bi.extend({type:e.string().nullable()}).strict(),sb=Wi.extend({slug:im.nullable(),navigation:am.extend({showInHeader:e.boolean().nullable(),showInFooter:e.boolean().nullable()}).strict(),blocks:e.array(nb).min(1)}).strict(),ib=Bi.extend({id:e.string()}),ab=Wi.extend({id:e.string(),slug:e.string().min(1),blocks:e.array(ib).min(1)}),Kc=e.object({label:e.string(),href:e.string().min(1)}),ob=e.object({primaryLinks:e.array(Kc),footerLinks:e.array(Kc)}),rb=e.discriminatedUnion("kind",[e.object({kind:e.literal("brief_clarify"),brief_id:St,answer_ids:e.array(e.string().min(1)).max(10)}).strict(),e.object({kind:e.literal("step5_strategy"),strategy_version_id:e.string().uuid(),strategy_version:e.number().int().positive(),strategy_checksum:e.string().regex(/^[a-f0-9]{64}$/)}).strict()]),ss=e.object({site_name:e.string().min(1).max(80).optional(),version:e.number().int().positive(),pages:e.array(Wi).min(1),navigation:tb,integrations:e.object({cms:e.unknown().optional(),analytics:e.unknown().optional()}).optional(),meta:e.object({generatedAt:e.string(),generatedBy:e.literal("sitemap-agent"),source_brief_id:e.string().optional(),source_answer_ids:e.array(e.string()).optional(),source:rb.optional()}),skillSelection:At,visualTheme:Uf.optional(),userChoices:e.array(qf).optional(),confirmedChoices:e.object({conversion:rt.optional()}).optional(),seoKeywords:e.array(kn).min(1).max(50).optional()}).strict(),vt=ss.superRefine((t,n)=>{cm(t.pages,n)}),cn=ss.extend({pages:e.array(sb).min(1)}).strict().superRefine((t,n)=>{cm(t.pages,n)}),cb=e.enum(["slug","showInHeader","showInFooter"]),mb=e.object({page_id:xe,fields:e.array(cb).min(1).max(3)}).strict(),lb=e.object({page_id:xe,block_id:xe,fields:e.tuple([e.literal("type")])}).strict(),om=100,rm=500,pb=e.object({pages:e.array(mb).max(om),blocks:e.array(lb).max(rm)}).strict().superRefine((t,n)=>{let s=new Set;t.pages.forEach((i,r)=>{s.has(i.page_id)&&n.addIssue({code:"custom",path:["pages",r,"page_id"],message:`Duplicate page target '${i.page_id}'.`}),s.add(i.page_id),new Set(i.fields).size!==i.fields.length&&n.addIssue({code:"custom",path:["pages",r,"fields"],message:"Page target fields must be unique."})});let a=new Set;t.blocks.forEach((i,r)=>{let g=`${i.page_id}\0${i.block_id}`;a.has(g)&&n.addIssue({code:"custom",path:["blocks",r],message:`Duplicate block target '${i.page_id}/${i.block_id}'.`}),a.add(g)})}),eC=e.object({sitemap:cn,targets:pb}).strict(),tC=e.object({pages:e.array(e.object({page_id:xe,slug:e.string().min(1).optional(),show_in_header:e.boolean().optional(),show_in_footer:e.boolean().optional()}).strict()).max(om),blocks:e.array(e.object({page_id:xe,block_id:xe,type:e.string().trim().min(1)}).strict()).max(rm)}).strict().superRefine((t,n)=>{let s=new Set;t.pages.forEach((i,r)=>{s.has(i.page_id)&&n.addIssue({code:"custom",path:["pages",r,"page_id"],message:`Duplicate page output '${i.page_id}'.`}),s.add(i.page_id)});let a=new Set;t.blocks.forEach((i,r)=>{let g=`${i.page_id}\0${i.block_id}`;a.has(g)&&n.addIssue({code:"custom",path:["blocks",r],message:`Duplicate block output '${i.page_id}/${i.block_id}'.`}),a.add(g)})}),nC=e.object({sitemap:vt}).strict();function cm(t,n){let s=new Map,a=new Map,i=new Map,r=0;t.forEach((g,c)=>{let _=s.get(g.id);if(_!==void 0?n.addIssue({code:"custom",path:["pages",c,"id"],message:`Duplicate page id '${g.id}' (first used at pages.${_}.id).`}):s.set(g.id,c),g.blocks.forEach((E,O)=>{let q=a.get(E.id);q!==void 0?n.addIssue({code:"custom",path:["pages",c,"blocks",O,"id"],message:`Duplicate block id '${E.id}' (first used at pages.${q.pageIndex}.blocks.${q.blockIndex}.id).`}):a.set(E.id,{pageIndex:c,blockIndex:O})}),g.slug===null)return;g.slug==="/"&&(r+=1);let j=i.get(g.slug);j!==void 0?n.addIssue({code:"custom",path:["pages",c,"slug"],message:`Duplicate page slug '${g.slug}' (first used at pages.${j}.slug).`}):i.set(g.slug,c)}),(r!==1||t[0]?.slug!=="/")&&n.addIssue({code:"custom",path:["pages"],message:"Sitemap must contain exactly one home page at pages[0] with slug '/'."})}var sC=ss.omit({skillSelection:!0,visualTheme:!0,userChoices:!0,confirmedChoices:!0,seoKeywords:!0}).extend({meta:ss.shape.meta.omit({source:!0}),site_name:e.string().min(1).max(80),pages:e.array(ab).min(1),navigation:ob}),db=e.enum(["ai","user"]),Ct=e.object({site_id:I,page_id:xe,edited_by:db.default("ai"),source_agent_run_id:V.optional()}),iC=Ct.extend({block_id:xe,target_index:e.number().int().min(0)}),ub=Ct.extend({block_id:xe}),gb=Ct.extend({block_id:xe,instruction:e.string()}),aC=Ct.extend({block_id:xe,variant:e.string().min(1).nullable()}),oC=Ct.extend({block_id:xe,props:e.record(e.string(),e.unknown()),mode:e.enum(["replace","merge"]).default("replace")}),rC=Ct.extend({block:e.object({id:xe,label:e.string().trim().min(1),type:e.string().min(1),variant:e.string().min(1).optional(),props:e.record(e.string(),e.unknown()).default({}),insert_index:e.number().int().min(0).optional()})}),_b=e.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),cC=e.discriminatedUnion("operation",[e.object({operation:e.literal("delete_block"),input:ub}).strict(),e.object({operation:e.literal("update_block_instruction"),input:gb}).strict()]),hb=e.enum(["SITEMAP_EDIT_INVALID","SITEMAP_API_NOT_CONFIGURED","SITEMAP_NOT_FOUND","SITEMAP_PAGE_NOT_FOUND","SITEMAP_BLOCK_NOT_FOUND","SITEMAP_BLOCK_ALREADY_EXISTS","SITEMAP_LAST_BLOCK_DELETE_FORBIDDEN","SITEMAP_EDIT_FAILED"]),Sb=e.object({status:e.literal("updated"),operation:_b,site_id:I,sitemap_id:ke,version:e.number().int().positive(),changed_pages:e.array(xe).min(1),requires_code_patch:e.literal(!0)}),fb=e.object({status:e.literal("failed"),code:hb,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),mC=e.discriminatedUnion("status",[Sb,fb]),Vi=e.object({question_id:e.string().min(1),value:e.string().min(1),label:e.string().min(1).optional(),question:e.string().min(1).optional(),option_label:e.string().min(1).optional(),motion_level:Ui.optional(),visual_tonality:Mi.optional(),conversion:rt.optional(),positioning:e.object({market:e.string().min(1).max(200),customer:e.string().min(1).max(200),purpose:e.string().min(1).max(60)}).optional()}),bb=e.object({id:e.string().trim().min(1).max(128),type:e.literal(1),search_intent:e.string().trim().min(1).max(255),path:e.string().trim().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),channel:e.string().trim().min(1).max(80),content_format:e.string().trim().min(1).max(80),priority:e.enum(["P0","P1","P2","P3"])}).strict(),lC=e.object({source:e.object({kind:e.literal("step5_strategy")}).strict()}).strict(),yb=e.object({item_key:In,title:e.string().trim().min(1).max(200),selected_option_id:yt,selected_label:e.string().trim().min(1).max(200),selected_value:e.string().trim().min(1).max(500),selected_description:e.string().trim().min(1).max(2e3),impact:e.string().trim().min(1).max(500).optional(),customer_note:e.string().trim().min(1).max(200).optional(),market_type:Rn.optional(),markets:e.array(Tn).max(32).optional()}).strict(),xb=e.object({order:e.number().int().min(1).max(9),menu_label:e.string().trim().min(1).max(200),decision_stage:e.string().trim().min(1).max(200),visitor_task:e.string().trim().min(1).max(500),primary_cta:e.string().trim().min(1).max(200)}).strict(),Eb=e.object({pages:e.array(xb).length(9)}).strict().superRefine((t,n)=>{t.pages.forEach((i,r)=>{i.order!==r+1&&n.addIssue({code:"custom",path:["pages",r,"order"],message:"Structure plan pages must be ordered from 1 to 9."})}),t.pages[0]?.menu_label.toLocaleLowerCase()!=="home"&&n.addIssue({code:"custom",path:["pages",0,"menu_label"],message:"The first structure plan page must be Home."});let s=t.pages.map(i=>i.menu_label.toLocaleLowerCase());new Set(s).size!==s.length&&n.addIssue({code:"custom",path:["pages"],message:"Structure plan menu labels must be unique."});let a=t.pages.map(i=>i.visitor_task.toLocaleLowerCase());new Set(a).size!==a.length&&n.addIssue({code:"custom",path:["pages"],message:"Structure plan visitor tasks must be unique."})}),Ib=e.object({kind:e.literal("step5_strategy"),site_name:e.string().trim().min(1).max(80).optional(),strategy_version_id:e.string().uuid(),strategy_version:e.number().int().positive(),strategy_checksum:e.string().regex(/^[a-f0-9]{64}$/),decisions:e.array(yb).length(fe),structure_plan:Eb.optional(),seo_keywords:e.array(kn).min(1).max(50).optional()}).strict().superRefine((t,n)=>{t.decisions.forEach((s,a)=>{s.item_key!==ct[a]&&n.addIssue({code:"custom",path:["decisions",a,"item_key"],message:"Step5 sitemap decisions must use the canonical order."})})}),mm=e.object({tenant_id:e.string().min(1),site_id:I,brief_id:St,brief:e.string().min(20).max(1e3),answers:e.array(Vi).min(1).max(10),skillSelection:At,site_default_locale:de.optional(),owner_locale:de.optional(),cms_site_id:e.string().min(1).nullish(),intent_pages:e.array(bb).max(xn).optional(),reference:gn.optional(),input_context:e.object({facts:e.array(un).max(120),conflicts:e.array(_n).max(20)}).optional(),business_facts:ia.optional(),extra_requirement:e.string().trim().min(1).max(ft).optional(),migration_products_enabled:e.boolean().optional()}),Rb=mm.pick({tenant_id:!0,site_id:!0,skillSelection:!0,site_default_locale:!0,owner_locale:!0,cms_site_id:!0,reference:!0,input_context:!0,business_facts:!0,extra_requirement:!0,migration_products_enabled:!0}).partial({skillSelection:!0}).extend({source:Ib}).strict(),pC=e.union([mm,Rb]),lm=e.enum(["planning","generating","validating","ready"]),Tb=e.enum(["salvaged","deterministic_fallback"]),kb=e.enum(["model_exception_settled_prefix","model_exception_safe_root"]),pm={outcome:Tb.optional(),reason:kb.optional(),attempts:e.number().int().positive().optional()};function dm(t,n){if(t.type!=="sitemap.generated")return;let s=t.outcome!==void 0,a=t.reason!==void 0;s!==a&&n.addIssue({code:"custom",path:[s?"reason":"outcome"],message:"sitemap.generated outcome and reason must be provided together"})}var Pb=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:V,at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:lm,message:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generated"),sitemap_id:ke,sitemap:vt,...pm,at:e.string().min(1)}),e.object({type:e.literal("sitemap.clamped"),reason:e.enum(["page_early_stop","finalize_best_effort"]),original_page_count:e.number().int().nonnegative().optional(),final_page_count:e.number().int().nonnegative().optional(),original_block_count:e.number().int().nonnegative().optional(),final_block_count:e.number().int().nonnegative().optional(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.started"),slot_count:e.number().int().nonnegative(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.finished"),slot_count:e.number().int().nonnegative(),provider_counts:e.object({unsplash:e.number().int().nonnegative(),pexels:e.number().int().nonnegative(),placeholder:e.number().int().nonnegative()}),fallback_count:e.number().int().nonnegative(),error_codes:e.array(e.string()),at:e.string().min(1)}),e.object({type:e.literal("snapshot.created"),snapshot_id:x,manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),snapshot_id:x.optional(),at:e.string().min(1)})]),dC=Pb.superRefine(dm),um=e.object({id:ke,tenant_id:e.string().min(1),site_id:I,version:e.number().int().positive(),source_agent_run_id:V.nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}).strict();function gm(t,n){t.version!==t.sitemap.version&&n.addIssue({code:"custom",path:["sitemap","version"],message:`Sitemap JSON version ${t.sitemap.version} must equal record version ${t.version}.`})}var _m=um.extend({sitemap:vt}).superRefine(gm),wb=um.extend({sitemap:cn}).superRefine(gm),uC=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:vt,source_agent_run_id:V.optional()}),gC=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:cn,expected_current_sitemap_id:ke,expected_current_sitemap_version:e.number().int().positive(),migration_content_requested:e.boolean().optional()}),_C=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:vt,source_agent_run_id:V}),hC=e.object({site:at,sitemap:_m,next_step:e.literal("workspace")}).strict(),SC=e.object({site:at,sitemap:wb,next_step:e.literal("workspace")}).strict(),fC=e.object({site:at,sitemap:_m,next_step:e.literal("sitemap_review")}).strict(),Ab=e.object({id:Ji,tenant_id:e.string().min(1),site_id:I,brief_id:St,questions:qi,answers:e.array(Vi),selected_archetype:At.optional(),completed_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),bC=e.object({answers:e.array(Vi).min(1),questions:qi,selected_archetype:At.optional()}),yC=e.object({clarify_session:Ab}),xC=e.object({questions:qi,selected_archetype:At}),vb=e.object({id:cs,tenant_id:e.string().min(1),site_id:I,version:e.number().int().positive(),design_plan:sm,source_agent_run_id:V.nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),EC=e.object({design_plan_id:cs.optional(),design_plan:sm,source_agent_run_id:V.optional()}),IC=e.object({design_plan:vb}),os=e.enum(["initial_generation","iteration"]),Cb=e.object({label:e.string().min(1).max(48),prompt:e.string().min(1).max(160)}).strict(),Db=e.enum(["model","derived","mixed","advisor"]),hm=e.object({suggestions:e.array(Cb).min(1).max(4),source:Db}).strict(),jb=e.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),Ob=e.enum(["generation_succeeded","entry_slots_omitted","quality_gate_exhausted","schema_gate_exhausted","generation_timeout","stream_schema_mismatch","stream_generation_error","generation_error","fallback_compiler_error","legacy_result_missing_metadata"]),Nb=e.enum(["progress","assistant_final"]),Sm=e.enum(["run.started","message.delta","user.message","plan.updated","clarify.partial","clarify.archetype_proposals","clarify.finished","sitemap.generating","sitemap.partial","sitemap.generated","sitemap.clamped","sitemap.updated","sitemap.resync.failed","sitemap.resync.warning","block.changed","tool.started","tool.finished","workspace.plan.created","workspace.worker.updated","workspace.task.updated","workspace.degraded","workspace.design_plan.outcome","workspace.suggestions","file.changed","snapshot.created","snapshot.finalized","preview.preparing","preview.ready","preview.build.started","preview.build.succeeded","preview.build.failed","run.failed","run.finished","media_resolution.started","media_resolution.finished","skill.selecting","skill.selected","activity.started","activity.updated","activity.finished","activity.failed"]),Lb=e.object({id:e.string().min(1),title:e.string().min(1),status:e.enum(["pending","running","completed","failed"])}),ht=e.enum(["pending","running","completed","completed_with_skips","failed","skipped"]),Hi=e.enum(["style_media","chrome","sections","layout","pages","detect_typecheck","repair","finalize","sitemap_resync","preview"]),$i=e.object({code:e.string().min(1),message:e.string().min(1),path:e.string().min(1).optional(),task_id:e.string().min(1).optional(),details:e.record(e.string(),e.unknown()).optional()}),Se=e.string().min(1).refine(t=>Am(t),{message:"Snapshot file paths must be safe relative POSIX paths without traversal."}),Yi=e.object({deduped_paths:e.array(Se),skipped_tasks:e.array(e.string().min(1)),failed_tasks:e.array(e.string().min(1)),fallback_files:e.array(e.string().min(1)),applied_paths:e.array(Se)}),Xi=e.object({group_id:e.string().min(1),phase:Hi,title:e.string().min(1),status:ht,task_ids:e.array(e.string().min(1)),depends_on_groups:e.array(e.string().min(1)),target_paths:e.array(Se)}),Mb=e.enum(["style","media","chrome","section","layout","page"]),Qi=e.object({task_id:e.string().min(1),group_id:e.string().min(1),kind:Mb,target_path:Se,block_id:e.string().min(1).optional(),block_type:e.string().min(1).optional(),block_variant:e.string().min(1).optional(),block_order:e.number().int().nonnegative().optional(),user_instruction:e.string().min(1).optional(),page_id:e.string().min(1).optional(),page_slug:e.string().min(1).optional(),page_title:e.string().min(1).optional(),title:e.string().min(1).max(60).optional(),description:e.string().min(1).max(Ki).optional(),status:ht,required_reads:e.array(Se).optional(),search_params_sections:e.array(Se).optional(),standard_form_view:Se.optional()}),Zi=e.object({from_group_id:e.string().min(1),to_group_id:e.string().min(1),reason:e.enum(["style_media","chrome","sections","layout","page_composition","quality_gate"])}),RC=e.object({plan_id:e.string().min(1),run_kind:os,model_route:e.object({planner:e.literal("workspace_planner"),worker:e.literal("workspace")}),groups:e.array(Xi),tasks:e.array(Qi),dependencies:e.array(Zi),expected_outputs:e.array(Se),diagnostics:Yi}),TC=e.object({task_id:e.string().min(1),patch:e.unknown().optional(),snapshot_id:x.optional(),read_files:e.array(Se),diagnostics:e.array($i),status:ht}),fm=e.object({worker_count:e.number().int().nonnegative(),task_count:e.number().int().nonnegative(),group_count:e.number().int().nonnegative()}),bm=e.object({pending:e.number().int().nonnegative(),running:e.number().int().nonnegative(),completed:e.number().int().nonnegative(),completed_with_skips:e.number().int().nonnegative(),failed:e.number().int().nonnegative(),skipped:e.number().int().nonnegative()}),Ub=e.object({type:e.literal("text"),text:e.string(),state:e.enum(["streaming","done"]).optional()}),qb=e.object({type:e.literal("reasoning"),text:e.string(),state:e.enum(["streaming","done"]).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),Fb=e.object({type:e.literal("file"),mediaType:e.string().min(1),filename:e.string().min(1).optional(),url:e.string().min(1)}),Gb=e.object({type:e.literal("source-url"),sourceId:e.string().min(1),url:e.string().min(1),title:e.string().min(1).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),zb=e.object({type:e.literal("source-document"),sourceId:e.string().min(1),mediaType:e.string().min(1),title:e.string().min(1),filename:e.string().min(1).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),Kb=e.object({type:e.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:e.string().min(1).optional(),data:e.unknown()}),Bb=e.object({type:e.string().regex(/^tool-[a-zA-Z0-9_-]+$/),toolCallId:e.string().min(1),state:e.enum(["input-streaming","input-available","output-available","output-error"]),input:e.unknown().optional(),output:e.unknown().optional(),errorText:e.string().min(1).optional()}),Wb=e.object({type:e.literal("error"),errorText:e.string().min(1)}),Vb=e.object({type:e.literal("step-start")}),is=e.union([Ub,qb,Fb,Gb,zb,Kb,Bb,Wb,Vb]),Hb=e.string().min(1).max(512).refine(t=>Am(t)&&!/^[A-Za-z]:\//.test(t),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),$b=e.array(Hb).min(1).max(64),Yb=e.array(e.string().min(1).max(120)).min(1).max(64),Xb=e.discriminatedUnion("type",[e.object({type:e.literal("run.started"),runId:V,at:e.string().min(1)}),e.object({type:e.literal("message.delta"),text:e.string().min(1),history_purpose:Nb.optional(),at:e.string().min(1)}),e.object({type:e.literal("user.message"),client_message_id:e.string().min(1),message_id:e.string().min(1),parts:e.array(is).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),interaction_response:jn.optional(),at:e.string().min(1)}),e.object({type:e.literal("plan.updated"),steps:e.array(Lb),at:e.string().min(1)}),e.object({type:e.literal("clarify.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("clarify.archetype_proposals"),proposals:e.array(Bc).min(1).max(5),at:e.string().min(1)}),e.object({type:e.literal("clarify.finished"),questions_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generating"),stage:lm,message:e.string().min(1).optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.partial"),object:e.unknown(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.generated"),sitemap_id:ke,sitemap:vt,...pm,at:e.string().min(1)}),e.object({type:e.literal("sitemap.clamped"),reason:e.enum(["page_early_stop","finalize_best_effort"]),original_page_count:e.number().int().nonnegative().optional(),final_page_count:e.number().int().nonnegative().optional(),original_block_count:e.number().int().nonnegative().optional(),final_block_count:e.number().int().nonnegative().optional(),at:e.string().min(1)}).strict(),e.object({type:e.literal("sitemap.updated"),sitemap_id:ke,version:e.number().int().positive(),reason:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("sitemap.resync.failed"),error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),diagnostics:e.unknown().optional(),at:e.string().min(1)}),e.object({type:e.literal("sitemap.resync.warning"),code:e.string().min(1),message:e.string().min(1),diagnostics:e.unknown().optional(),at:e.string().min(1)}),e.object({type:e.literal("block.changed"),block_id:e.string().min(1),change_type:e.enum(["add","update","delete","move"]),at:e.string().min(1)}),e.object({type:e.literal("tool.started"),tool_call_id:e.string().min(1),name:e.string().min(1),summary:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("tool.finished"),tool_call_id:e.string().min(1),name:e.string().min(1),result_summary:e.string().min(1),interaction_request:Hs.optional(),at:e.string().min(1)}),e.object({type:e.literal("workspace.plan.created"),plan_id:e.string().min(1),run_kind:os,groups:e.array(Xi),tasks:e.array(Qi),dependencies:e.array(Zi),expected_outputs:e.array(Se),diagnostics:Yi,summary:fm,at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.worker.updated"),group_id:e.string().min(1),phase:Hi,status:ht,task_counts:bm,target_paths:e.array(Se),diagnostics:e.array(e.string().min(1)),at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.task.updated"),task_id:e.string().min(1),group_id:e.string().min(1),status:ht,target_path:Se,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array($i).optional(),at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.degraded"),reason:e.enum(["block_placeholder","form_placeholder","patch_protected_dropped","preview_health_degraded","design_plan_fallback","generated_code_rescue","cms_page_directory_degraded","form_prebuild_skipped","form_section_fallback","first_settings_sync_failed"]),degraded_block_ids:e.array(e.string().min(1)).min(1).optional(),dropped_files:e.array(e.string().min(1)).min(1).optional(),degraded_file_paths:$b.optional(),degraded_page_ids:Yb.optional(),snapshot_id:x.optional(),code:e.string().min(1).optional(),message:e.string().min(1).optional(),diagnostics:e.string().min(1).optional(),retryable:e.boolean().optional(),at:e.string().min(1)}).strict().superRefine((t,n)=>{if(!(t.reason==="generated_code_rescue")){for(let a of["degraded_file_paths","degraded_page_ids"])t[a]!==void 0&&n.addIssue({code:"custom",path:[a],message:`${a} is only allowed for generated_code_rescue`});return}t.degraded_file_paths===void 0&&n.addIssue({code:"custom",path:["degraded_file_paths"],message:"generated_code_rescue requires degraded_file_paths"});for(let a of["degraded_block_ids","dropped_files","snapshot_id","code","message","diagnostics","retryable"])t[a]!==void 0&&n.addIssue({code:"custom",path:[a],message:`${a} is not allowed for generated_code_rescue`})}),e.object({type:e.literal("workspace.design_plan.outcome"),design_plan_outcome:jb,reason:Ob,gate_diagnostics:e.object({gate:e.enum(["quality","schema"]),issue_codes:e.array(e.string().min(1)).max(20),issue_paths:e.array(e.string()).max(20),finish_reason:e.string().min(1).optional()}).strict().optional(),at:e.string().min(1)}).strict(),hm.extend({type:e.literal("workspace.suggestions"),at:e.string().min(1)}).strict(),e.object({type:e.literal("file.changed"),path:e.string().min(1),change_type:e.enum(["create","update","delete"]),diff:e.string().optional(),at:e.string().min(1)}),e.object({type:e.literal("snapshot.created"),snapshot_id:x,manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/),at:e.string().min(1)}),e.object({type:e.literal("snapshot.finalized"),snapshot_id:x,at:e.string().min(1)}),e.object({type:e.literal("preview.preparing"),at:e.string().min(1)}),e.object({type:e.literal("preview.ready"),url:e.string().url(),at:e.string().min(1)}),e.object({type:e.literal("preview.build.started"),snapshot_id:x,at:e.string().min(1)}),e.object({type:e.literal("preview.build.succeeded"),snapshot_id:x,at:e.string().min(1)}),e.object({type:e.literal("preview.build.failed"),snapshot_id:x,message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean(),at:e.string().min(1)}),e.object({type:e.literal("run.failed"),error_code:e.string().min(1),message:e.string().min(1),error_category:Wc.optional(),retryable:e.boolean().optional(),attempts:e.number().int().positive().optional(),outcome:e.literal("retained_previous").optional(),details:e.record(e.string(),e.unknown()).optional(),at:e.string().min(1)}),e.object({type:e.literal("run.finished"),snapshot_id:x.optional(),degraded_reason:Nt.optional(),build_verified:e.boolean().optional(),at:e.string().min(1)}),e.object({type:e.literal("media_resolution.started"),slot_count:e.number().int().nonnegative(),at:e.string().datetime()}),e.object({type:e.literal("media_resolution.finished"),slot_count:e.number().int().nonnegative(),provider_counts:e.object({unsplash:e.number().int().nonnegative(),pexels:e.number().int().nonnegative(),placeholder:e.number().int().nonnegative()}),fallback_count:e.number().int().nonnegative(),error_codes:e.array(e.string()),at:e.string().datetime()}),e.object({type:e.literal("skill.selecting"),category:e.literal("page-generation"),available:e.array(e.object({id:e.string().min(1),name:e.string().min(1)})).max(20),at:e.string().min(1)}),e.object({type:e.literal("skill.selected"),category:e.literal("page-generation"),selected:e.object({id:e.string().min(1),name:e.string().min(1),reason:e.string().min(1).max(200)}),at:e.string().min(1)}),e.object({type:e.literal("activity.started"),activity_id:e.string().min(1),parent_activity_id:e.string().min(1).optional(),kind:Jc,title:e.string().min(1).max(200),detail:e.string().max(360).optional(),title_code:st.optional(),detail_code:st.optional(),locks_input:e.boolean(),at:e.string().min(1)}),e.object({type:e.literal("activity.updated"),activity_id:e.string().min(1),title:e.string().min(1).max(200).optional(),detail:e.string().max(360).optional(),title_code:st.optional(),detail_code:st.optional(),at:e.string().min(1)}),e.object({type:e.literal("activity.finished"),activity_id:e.string().min(1),at:e.string().min(1)}),e.object({type:e.literal("activity.failed"),activity_id:e.string().min(1),detail:e.string().max(360).optional(),at:e.string().min(1)})]),ym=Xb.superRefine(dm).superRefine((t,n)=>{if(t.type==="user.message"&&t.interaction_response&&!t.in_reply_to_tool_call_id&&n.addIssue({code:"custom",path:["in_reply_to_tool_call_id"],message:"in_reply_to_tool_call_id is required for an interaction response"}),t.type!=="tool.finished")return;let s=t.name==="prepare_product_search_entry";s!==!!t.interaction_request&&n.addIssue({code:"custom",path:["interaction_request"],message:s?"prepare_product_search_entry requires interaction_request":"interaction_request is only valid for prepare_product_search_entry"})}),Li=e.object({id:ta,tenant_id:e.string().min(1),site_id:I,agent_run_id:V,sequence:e.number().int().positive(),event_type:Sm,payload:ym,created_at:e.string().min(1)}),kC=e.object({event_type:Sm,payload:ym}).superRefine((t,n)=>{t.event_type!==t.payload.type&&n.addIssue({code:"custom",path:["payload","type"],message:"payload.type must match event_type"}),ln(t.payload)&&n.addIssue({code:"custom",path:["payload"],message:"AgentEvent payload must not contain secrets"})}),PC=e.discriminatedUnion("status",[e.object({status:e.literal("appended"),agent_run:it,event:Li,next_cursor:e.number().int().nonnegative()}),e.object({status:e.literal("duplicate_ignored"),agent_run:it,event:Li,next_cursor:e.number().int().nonnegative()})]),wC=e.object({events:e.array(Li),next_cursor:e.number().int().nonnegative().optional()}),AC=e.object({after_sequence:e.coerce.number().int().nonnegative().default(0)}),vC=e.enum(["implemented","skeleton","planned"]),CC=e.enum(["GET","POST","PUT","PATCH","DELETE"]),DC=[{method:"PATCH",path:"/internal/sites/:site_id/snapshots/:snapshot_id/manifest",tag:"snapshots",summary:"Compare-and-set the manifest hash for the active current snapshot after an in-place object replacement.",status:"implemented",request_body_schema:"UpdateCurrentSnapshotManifestRequestSchema",response_schema:"SnapshotRecordSchema",notes:["Internal Agent authentication is required. The update succeeds only when site current_snapshot_id, snapshot status, object key, and expected manifest hash still match."]},{method:"GET",path:"/health",tag:"system",summary:"API health check.",status:"implemented",response_schema:"ApiHealth"},{method:"POST",path:"/sites",tag:"sites",summary:"Create a site and Step 1 brief in the current dev context.",status:"implemented",request_body_schema:"CreateSiteBriefRequestSchema",response_schema:"CreateSiteBriefResponseSchema"},{method:"POST",path:"/sites/drafts",tag:"sites",summary:"Create a draft site without a brief in the current tenant so /s/:site_id can collect Step 1 later.",status:"implemented",request_body_schema:"CreateSiteDraftRequestSchema",response_schema:"SiteRecordSchema"},{method:"GET",path:"/sites",tag:"sites",summary:"List current tenant sites.",status:"implemented",response_schema:"SiteRecordSchema[]"},{method:"GET",path:"/sites/by-cms/:cms_site_id",tag:"sites",summary:"Resolve an external CMS site id to one tenant-scoped VCP site.",status:"implemented",response_schema:"SiteRecordSchema",notes:["Used by the browser /d/:cms_site_id handoff route; lookup is scoped by current request tenant and returns 404 when the CMS site has not been synchronized."]},{method:"GET",path:"/sites/:site_id",tag:"sites",summary:"Get one tenant-scoped site.",status:"implemented",response_schema:"SiteRecordSchema"},{method:"POST",path:"/sites/:site_id/workflow",tag:"site-workflows",summary:"Create one version-bound site workflow from a published flow definition.",status:"implemented",request_body_schema:"CreateSiteWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/workflow",tag:"site-workflows",summary:"Read the current site workflow snapshot and derived menu state.",status:"implemented",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"PUT",path:"/sites/:site_id/workflow/website",tag:"site-workflows",summary:"Update the source website while website_scan is current.",status:"implemented",request_body_schema:"UpdateSiteWorkflowWebsiteRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/advance",tag:"site-workflows",summary:"Advance one non-terminal workflow node with an expected-current-node guard.",status:"implemented",request_body_schema:"AdvanceSiteWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/complete",tag:"site-workflows",summary:"Complete the workflow from its final publishing node after server-side release checks pass.",status:"implemented",request_body_schema:"CompleteSiteWorkflowRequestSchema",response_schema:"SiteWorkflowSnapshotResponseSchema",notes:["The browser supplies only the expected current node; the server verifies persisted release facts before completing the workflow."]},{method:"POST",path:"/sites/:site_id/workflow/tasks/register",tag:"site-workflows",summary:"Register a business-owned external task id and its idempotency key.",status:"implemented",request_body_schema:"RegisterWorkflowTaskCommandRequestSchema",response_schema:"SiteWorkflowTaskRefResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/step2-site-initialization/tasks",tag:"site-workflows/step2-site-initialization",summary:"Create or reuse the current workflow's Step2 website crawl task.",status:"implemented",response_schema:"Step2SiteInitializationTaskResponseSchema",notes:["The server derives tenantId, sessionId, and siteUrl from trusted request/workflow state; the browser cannot submit upstream scope fields."]},{method:"GET",path:"/sites/:site_id/workflow/step2-site-initialization/tasks/:task_id",tag:"site-workflows/step2-site-initialization",summary:"Poll the workflow-owned Step2 website crawl task.",status:"implemented",response_schema:"Step2SiteInitializationTaskResponseSchema",notes:["The task id must match the current non-superseded website_crawl task reference for the workflow."]},{method:"POST",path:"/sites/:site_id/workflow/tasks/:task_type/replace",tag:"site-workflows",summary:"Replace one task reference while retaining its superseded history.",status:"implemented",request_body_schema:"ReplaceWorkflowTaskCommandRequestSchema",response_schema:"SiteWorkflowTaskRefResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/tasks/website_crawl/replace-and-invalidate-dependents",tag:"site-workflows",summary:"Replace website crawl and invalidate basic-info and metrics dependents atomically.",status:"implemented",request_body_schema:"ReplaceCrawlWorkflowTaskCommandRequestSchema",response_schema:"SiteWorkflowTaskRefResponseSchema"},{method:"POST",path:"/sites/:site_id/workflow/build",tag:"site-workflows",summary:"Start the server-owned site build and workspace snapshot lifecycle.",status:"implemented",request_body_schema:"StartSiteBuildRequestSchema",response_schema:"StartSiteBuildResponseSchema",notes:["The browser may start or query the build, but cannot write site build or deployment summary status directly."]},{method:"GET",path:"/sites/:site_id/workflow/customer-materials",tag:"site-workflows",summary:"Read the persisted no-website customer materials draft.",status:"implemented",response_schema:"CustomerMaterialsNullableResponseSchema"},{method:"PUT",path:"/sites/:site_id/workflow/customer-materials",tag:"site-workflows",summary:"Save the no-website customer materials before submission.",status:"implemented",request_body_schema:"CustomerMaterialsDraftSchema",response_schema:"CustomerMaterialsResponseSchema",notes:["A submitted record is immutable and rejects later writes."]},{method:"POST",path:"/sites/:site_id/workflow/customer-materials/submit",tag:"site-workflows",summary:"Submit and freeze customer materials before analysis.",status:"implemented",request_body_schema:"CustomerMaterialsDraftSchema",response_schema:"CustomerMaterialsResponseSchema",notes:["Repeated submissions return 409; clients may retry only the separate workflow advance."]},{method:"GET",path:"/sites/:site_id/designer/component-library/categories",tag:"designer-component-library",summary:"List the fixed insert-new-component category tree for a site.",status:"implemented",response_schema:"ListDesignerComponentCategoriesResponseSchema",notes:["The server validates site ownership and fixes category_group_key to insertNewComponent."]},{method:"GET",path:"/sites/:site_id/designer/component-library/resources",tag:"designer-component-library",summary:"List component resources from the fixed designer catalog group.",status:"implemented",query_schema:"ListDesignerComponentsQuerySchema",response_schema:"ListDesignerComponentsResponseSchema",notes:["The server fixes resource type to component and does not expose resource-platform secrets, internal hosts, or product-line selection."]},{method:"POST",path:"/sites/:site_id/designer/component-library/resources/:resource_id/install",tag:"designer-component-library",summary:"Install one exact component version and return a strict SiteEditEngine materialization.",status:"implemented",request_body_schema:"InstallDesignerComponentBodySchema",response_schema:"InstallDesignerComponentResponseSchema",notes:["The server downloads the resource ZIP with the configured secret, validates main.json identity and compatibility, and returns only the strict materialization plus immutable revision metadata."]},{method:"GET",path:"/sites/:site_id/designer/page-library/categories",tag:"designer-page-library",summary:"List the fixed insert-new-page category tree for a site.",status:"implemented",response_schema:"ListDesignerPageCategoriesResponseSchema",notes:["The server validates site ownership and fixes category_group_key to insertNewPage."]},{method:"GET",path:"/sites/:site_id/designer/page-library/resources",tag:"designer-page-library",summary:"List page and pages resources from the fixed designer catalog.",status:"implemented",query_schema:"ListDesignerPagesQuerySchema",response_schema:"ListDesignerPagesResponseSchema",notes:["The server fixes resource types to page and pages and does not expose resource-platform credentials or internal routing."]},{method:"POST",path:"/sites/:site_id/designer/page-library/resources/:resource_id/prepare",tag:"designer-page-library",summary:"Resolve one exact page resource version for designer-side draft configuration.",status:"implemented",request_body_schema:"PrepareDesignerPageBodySchema",response_schema:"PrepareDesignerPageResponseSchema"},{method:"POST",path:"/sites/:site_id/designer/page-library/resources/:resource_id/install",tag:"designer-page-library",summary:"Install one exact page resource version and return a strict PageResourceArtifact.",status:"implemented",request_body_schema:"InstallDesignerPageBodySchema",response_schema:"InstallDesignerPageResponseSchema",notes:["The server validates the explicit resource type, immutable package identity, page selections, materializations, and package-local references."]},{method:"GET",path:"/sites/:site_id/designer/pages",tag:"designer-page-library",summary:"List designer pages from the stable first-phase fixture source.",status:"implemented",response_schema:"ListDesignerSitePagesResponseSchema"},{method:"POST",path:"/sites/:site_id/designer/page-resources/enhance",tag:"designer-page-library",summary:"Echo a designer page-resource candidate without model execution or normalization.",status:"implemented",request_body_schema:"EnhanceDesignerPageResourceBodySchema",response_schema:"EnhanceDesignerPageResourceResponseSchema"},{method:"POST",path:"/sites/:site_id/designer/page-resources/compose",tag:"designer-page-library",summary:"Compose exact page and component resources into one strict page artifact.",status:"implemented",request_body_schema:"ComposeDesignerPageResourceBodySchema",response_schema:"InstallDesignerPageResponseSchema",notes:["The server installs every immutable source, validates ordered page blocks, scopes component materializations, and returns one artifact without exposing resource-platform credentials."]},{method:"POST",path:"/sites/:site_id/designer/page-resources/blank",tag:"designer-page-library",summary:"Create the deterministic built-in blank page artifact for one configured route.",status:"implemented",request_body_schema:"InstallDesignerPageBodySchema",response_schema:"InstallDesignerPageResponseSchema"},{method:"PATCH",path:"/sites/:site_id",tag:"sites",summary:"Update site display name and optional generated-site locale for the current tenant.",status:"implemented",request_body_schema:"UpdateSiteRequestSchema",response_schema:"SiteRecordSchema"},{method:"DELETE",path:"/sites/:site_id",tag:"sites",summary:"Archive a site so it no longer appears in the tenant site list.",status:"implemented",response_schema:"SiteRecordSchema"},{method:"GET",path:"/sites/:site_id/workspace/source-files",tag:"sites",summary:"List source files available in the ready preview sandbox.",status:"implemented",response_schema:"WorkspaceSourceFileListItemSchema[]"},{method:"GET",path:"/sites/:site_id/workspace/source-file",tag:"sites",summary:"Read a source file from the ready preview sandbox.",status:"implemented",query_schema:"WorkspaceSourceFilePathQuerySchema",response_schema:"WorkspaceSourceFileResponseSchema"},{method:"GET",path:"/sites/:site_id/media-assets",tag:"media-assets",summary:"List or search enterprise image assets through the CMS adapter.",status:"implemented",query_schema:"ListMediaLibraryAssetsQuerySchema",response_schema:"ListMediaLibraryAssetsResponseSchema"},{method:"POST",path:"/sites/:site_id/media-assets",tag:"media-assets",summary:"Upload one validated image and create its enterprise asset.",status:"implemented",response_schema:"UploadMediaLibraryAssetResponseSchema",notes:["Accepts one multipart field named file; only the image MIME allowlist is accepted and the maximum size is 20 MiB."]},{method:"GET",path:"/sites/:site_id/media-assets/unsplash/search",tag:"media-assets",summary:"Search Unsplash through the VCP server-side client.",status:"implemented",query_schema:"SearchUnsplashMediaQuerySchema",response_schema:"SearchUnsplashMediaResponseSchema",notes:["The browser never receives the Unsplash access key; CMS is not involved in search."]},{method:"POST",path:"/sites/:site_id/media-assets/unsplash/:provider_id/use",tag:"media-assets",summary:"Best-effort report that an Unsplash image was selected.",status:"implemented",request_body_schema:"UseUnsplashMediaRequestSchema",response_schema:"UseUnsplashMediaResponseSchema",notes:["CMS report failure returns reported=false and does not roll back the image replacement."]},{method:"POST",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Confirm the currently reviewed Sitemap Draft and advance the site to structure_saved.",status:"implemented",request_body_schema:"ConfirmSiteStructureRequestSchema",response_schema:"PersistSiteSitemapDraftResponseSchema"},{method:"POST",path:"/internal/sites/:site_id/sitemap-draft",tag:"sitemaps",summary:"Persist an agent-generated sitemap draft without confirming the structure.",status:"implemented",request_body_schema:"PersistGeneratedSitemapDraftRequestSchema",response_schema:"PersistGeneratedSitemapDraftResponseSchema"},{method:"GET",path:"/sites/:site_id/sitemap",tag:"sitemaps",summary:"Read the current Sitemap Draft for a site.",status:"implemented",response_schema:"SitemapDraftRecordSchema"},{method:"POST",path:"/sites/:site_id/clarify/answers",tag:"clarify",summary:"Persist the Step 2 clarify answers (and the answered questions) into the site's clarify session.",status:"implemented",request_body_schema:"PersistClarifyAnswersRequestSchema",response_schema:"PersistClarifyAnswersResponseSchema"},{method:"PATCH",path:"/sites/:site_id/clarify/archetype",tag:"clarify",summary:"Switch the Step 2 industry archetype (user_picked) into the site's clarify session via an idempotent upsert.",status:"implemented",request_body_schema:"UpdateClarifyArchetypeRequestSchema",response_schema:"PersistClarifyAnswersResponseSchema",notes:["Independent of generate: materializes a clarify_sessions row when none exists (using the supplied questions) or updates only selected_archetype; never writes answers/completed_at. Forces source=user_picked."]},{method:"POST",path:"/internal/sites/:site_id/design-plan",tag:"design-plans",summary:"Persist a generated design plan version for a site (internal agent-only write).",status:"implemented",request_body_schema:"PersistSiteDesignPlanRequestSchema",response_schema:"PersistSiteDesignPlanResponseSchema",notes:["Guarded by the internal agent token; only the Workspace/Sitemap agent writes design plans."]},{method:"GET",path:"/internal/sites/:site_id/design-plan",tag:"design-plans",summary:"Read the current (latest version) design plan for a site (internal agent-only read).",status:"implemented",response_schema:"DesignPlanRecordSchema",notes:["Guarded by the internal agent token; only the Workspace/Sitemap agent reads design plans."]},{method:"GET",path:"/sites/:site_id/design-plan",tag:"design-plans",summary:"Read the current (latest version) design plan for a site so Workspace UI can inspect the generated design contract.",status:"implemented",response_schema:"DesignPlanRecordSchema"},{method:"GET",path:"/sites/:site_id/brief",tag:"briefs",summary:"Read the persisted Step 1 brief for a site so the Workspace Agent can seed first full-site generation without a new write surface.",status:"implemented",response_schema:"BriefRecordSchema"},{method:"PUT",path:"/sites/:site_id/brief/draft",tag:"briefs",summary:"Save a draft site's Step 1 brief without advancing the workflow.",status:"implemented",request_body_schema:"SaveBriefDraftRequestSchema",response_schema:"SaveBriefDraftResponseSchema",notes:["Only sites in the editable build phase are writable; the brief row is upserted idempotently while site status, locale, and workflow stage remain unchanged."]},{method:"PATCH",path:"/sites/:site_id/brief",tag:"briefs",summary:"Create or update a draft site's Step 1 brief and advance it to Clarify without allowing later workflow states to roll back.",status:"implemented",request_body_schema:"UpdateBriefRequestSchema",response_schema:"UpdateBriefResponseSchema",notes:["Only sites in the editable build phase are writable; missing brief rows are created on first save; identical retries are idempotent."]},{method:"POST",path:"/internal/sites/:cms_site_id/external-sync",tag:"sites",summary:"Synchronize a trusted external CMS site URL into VCP by tenant_id + cms_site_id, creating a draft VCP site on first sync.",status:"implemented",request_body_schema:"ExternalSyncSiteRequestSchema",response_schema:"ExternalSyncSiteResponseSchema",notes:["This trusted external entry does not require browser login or internal bearer auth; tenant_id is written directly to tenants.id and the response uses the internal { code, data, message } success envelope."]},{method:"POST",path:"/internal/sites/:site_id/page-templates",tag:"page-templates",summary:"Create a private page template through the authenticated VCP internal service surface.",status:"implemented",request_body_schema:"PageTemplateCreateRequestSchema",response_schema:"PageTemplateCreateResponseSchema",notes:["Internal service endpoint; callers use the API bearer token plus trusted tenant/user headers. API delegates to Agent with its own AGENT_INTERNAL_TOKEN and never forwards caller Authorization."]},{method:"POST",path:"/internal/sites/:site_id/page-templates/promote",tag:"page-templates",summary:"Promote a private page template through the authenticated VCP internal service surface.",status:"implemented",request_body_schema:"PageTemplatePromoteRequestSchema",response_schema:"PageTemplatePromoteResponseSchema",notes:["Internal service endpoint; uses the same bearer + tenant/user context as create and delegates to Agent with API-owned credentials."]},{method:"POST",path:"/internal/sites/:site_id/page-templates/cleanup",tag:"page-templates",summary:"Clean up private page templates through the authenticated VCP internal service surface.",status:"implemented",request_body_schema:"PageTemplateCleanupRequestSchema",response_schema:"PageTemplateCleanupResponseSchema",notes:["Internal service endpoint; cleanup remains explicit and default-template protection is enforced by the Agent lifecycle service."]},{method:"POST",path:"/sites/:site_id/snapshots",tag:"snapshots",summary:"Persist snapshot metadata without changing the current site snapshot.",status:"implemented",request_body_schema:"PersistSiteSnapshotRequestSchema",response_schema:"PersistSiteSnapshotResponseSchema"},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/promote",tag:"snapshots",summary:"Promote a site snapshot as the current workspace version.",status:"implemented",request_body_schema:"PromoteSiteSnapshotRequestSchema",response_schema:"PromoteSiteSnapshotResponseSchema"},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/lock/try-acquire",tag:"snapshots",summary:"Try to acquire the short-lived template-upgrade site lock.",status:"implemented",request_body_schema:"TryAcquireTemplateUpgradeLockRequestSchema",response_schema:"TryAcquireTemplateUpgradeLockResponseSchema",notes:["Internal agent-only endpoint; lock contention returns acquired=false instead of a user-facing conflict."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/lock/release",tag:"snapshots",summary:"Release the calling template-upgrade attempt's site lock.",status:"implemented",request_body_schema:"ReleaseTemplateUpgradeLockRequestSchema",response_schema:"ReleaseTemplateUpgradeLockResponseSchema",notes:["Internal agent-only endpoint; release is scoped by tenant, site, operation type, and owner."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/snapshots/:snapshot_id/promote",tag:"snapshots",summary:"CAS-promote a validated template-upgrade candidate and bind its accepted commit atomically.",status:"implemented",request_body_schema:"PromoteTemplateUpgradeSnapshotRequestSchema",response_schema:"PromoteTemplateUpgradeSnapshotResponseSchema",notes:["Internal agent-only endpoint; accepted_commit is never part of the public promote request or response."]},{method:"GET",path:"/internal/sites/:site_id/template-upgrade/state",tag:"snapshots",summary:"Inspect the projected tenant-scoped template-upgrade state without mutation.",status:"implemented",query_schema:"InspectTemplateUpgradeStateRequestSchema",response_schema:"InspectTemplateUpgradeStateResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and the repository path is read-only."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/state/prepare",tag:"snapshots",summary:"Prepare the tenant-scoped template-upgrade retry state for a target version.",status:"implemented",request_body_schema:"PrepareTemplateUpgradeStateRequestSchema",response_schema:"PrepareTemplateUpgradeStateResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and is never accepted in the request body."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/state/failure",tag:"snapshots",summary:"Record a finite validation failure for the prepared template-upgrade target.",status:"implemented",request_body_schema:"RecordTemplateUpgradeFailureRequestSchema",response_schema:"RecordTemplateUpgradeFailureResponseSchema",notes:["Internal agent-only endpoint; accepts a finite error code and never raw validation output."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/state/success",tag:"snapshots",summary:"Reset retry state after the prepared template-upgrade target succeeds.",status:"implemented",request_body_schema:"RecordTemplateUpgradeSuccessRequestSchema",response_schema:"RecordTemplateUpgradeSuccessResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and is never accepted in the request body."]},{method:"POST",path:"/internal/sites/:site_id/template-upgrade/events",tag:"snapshots",summary:"Record one bounded template-upgrade observability event.",status:"implemented",request_body_schema:"RecordTemplateUpgradeEventRequestSchema",response_schema:"RecordTemplateUpgradeEventResponseSchema",notes:["Internal agent-only endpoint; tenant identity is derived from trusted request context and the strict request excludes raw errors, source content, and file paths."]},{method:"GET",path:"/internal/template-upgrades/report",tag:"snapshots",summary:"Read tenant-scoped template-upgrade outcome, state, and duration aggregates.",status:"implemented",query_schema:"GetTemplateUpgradeReportQuerySchema",response_schema:"GetTemplateUpgradeReportResponseSchema",notes:["Internal endpoint; tenant identity is derived from trusted request context and all aggregates are tenant-scoped."]},{method:"GET",path:"/internal/template-upgrades/snapshot-deletions/pending",tag:"snapshots",summary:"List tenant-scoped stale template-upgrade snapshot deletions for dry-run or reconciliation.",status:"implemented",query_schema:"ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema",response_schema:"ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema",notes:["Defaults to retrying deleting tombstones. Including candidate snapshots is an explicit maintenance action and should use a conservative age threshold."]},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/abandon",tag:"snapshots",summary:"Mark an unpromoted candidate snapshot as failed.",status:"implemented",response_schema:"AbandonSiteSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/snapshots/:snapshot_id",tag:"snapshots",summary:"Read one tenant-scoped snapshot metadata record for a site.",status:"implemented",response_schema:"SnapshotRecordSchema"},{method:"DELETE",path:"/sites/:site_id/snapshots/:snapshot_id",tag:"snapshots",summary:"Prepare two-phase deletion of a candidate snapshot and return its object key; refuses non-candidate/current/referenced snapshots.",status:"implemented",response_schema:"DeleteSiteSnapshotResponseSchema",notes:["Internal Agent authentication is required. This endpoint only creates a deleting tombstone; object removal and completion are separate steps."]},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/deletion/complete",tag:"snapshots",summary:"Complete deletion after the snapshot object has been removed; only accepts deleting snapshots.",status:"implemented",response_schema:"CompleteSiteSnapshotDeletionResponseSchema",notes:["Internal Agent authentication is required; callers must remove the object before completing the DB deletion."]},{method:"POST",path:"/agent-runs",tag:"agent-runs",summary:"Create an agent run for event persistence and replay.",status:"implemented",request_body_schema:"CreateAgentRunRequestSchema",response_schema:"CreateAgentRunResponseSchema"},{method:"POST",path:"/agent-runs/:run_id/events",tag:"agent-runs",summary:"Append one normalized AgentEvent to a run.",status:"implemented",request_body_schema:"AppendAgentEventRequestSchema",response_schema:"AppendAgentEventResponseSchema",notes:["Internal-only write surface: only internal-service callers may append, except browser (oidc) contexts may append run.failed (the WS connect-stage unlock path, equivalent to POST /agent-runs/workspace/cancel). All other oidc appends \u2014 run.finished, run.started, tool/system/progress, file/snapshot \u2014 are rejected with 403 FORBIDDEN. The browser sends user messages over the Workspace WebSocket (recorded server-side as user.message) and otherwise only reads the GET replay."]},{method:"GET",path:"/agent-runs/:run_id/events",tag:"agent-runs",summary:"Replay AgentEvents after a run-local sequence cursor.",status:"implemented",response_schema:"ListAgentEventsResponseSchema"},{method:"POST",path:"/internal/agent-runs/fail-stale-in-flight",tag:"agent-runs",summary:"Fail stale in-flight workspace runs (internal maintenance, cross-tenant sweep).",status:"implemented",response_schema:"FailStaleInFlightWorkspaceRunsResponseSchema",notes:["Internal maintenance endpoint guarded by InternalAgentAuthGuard (Bearer VCP_AGENT_INTERNAL_TOKEN, production fail-closed); the /internal/** prefix is exempt from browser auth middleware so the guard is the sole trust boundary. Not exposed to the browser via agent-proxy; called by an external admin cron / controlled ops script."]},{method:"GET",path:"/deployments",tag:"deployments",summary:"Deployment resource summary endpoint until publish APIs land.",status:"skeleton"},{method:"POST",path:"/sites/:site_id/workspace/runs",tag:"workspace",summary:"Start an asynchronous Workspace Agent run from the current snapshot.",status:"implemented",request_body_schema:"StartWorkspaceRunRequestSchema",response_schema:"StartWorkspaceRunResponseSchema",notes:["Long-running work must be event-driven and must not block API transactions."]},{method:"POST",path:"/v1/agent/workspace/:site_id/form-design-operations",tag:"agent/workspace",summary:"Create or replay a deterministic FORM_SPEC save operation.",status:"implemented",request_body_schema:"FormDesignSaveRequestSchema",response_schema:"FormDesignOperationResponseSchema"},{method:"GET",path:"/v1/agent/workspace/:site_id/form-design-operations/:operation_id",tag:"agent/workspace",summary:"Read a persisted FORM_SPEC save operation.",status:"implemented",response_schema:"FormDesignOperationResponseSchema"},{method:"POST",path:"/v1/agent/workspace/:site_id/form-design-operations/:operation_id/resume",tag:"agent/workspace",summary:"Resume a recoverable FORM_SPEC save with its original fingerprint.",status:"implemented",request_body_schema:"FormDesignResumeRequestSchema",response_schema:"FormDesignOperationResponseSchema"},{method:"GET",path:"/sites/:site_id/workspace/runs/latest",tag:"workspace",summary:"Look up the latest workspace Agent run for a site so Step 4 re-entry can replay persisted events without re-triggering the model.",status:"implemented",response_schema:"LatestWorkspaceRunResponseSchema"},{method:"POST",path:"/internal/sites/:site_id/preview-sessions",tag:"sandbox-sessions",summary:"Persist or update an Agent-owned on-demand preview session; optional current/ready-session guards support current-snapshot CAS and guarded in-place snapshot advance.",status:"implemented",request_body_schema:"PersistPreviewSessionRequestSchema",response_schema:"PersistPreviewSessionResponseSchema"},{method:"GET",path:"/sites/:site_id/preview-sessions/current",tag:"sandbox-sessions",summary:"Read the latest tenant-scoped preview session for a site.",status:"implemented",response_schema:"SandboxSessionSchema"},{method:"POST",path:"/sites/:site_id/preview/activate",tag:"site-preview",summary:"Activate the existing preview sandbox for a site.",status:"implemented",response_schema:"SitePreviewActivateResponseSchema"},{method:"POST",path:"/v1/agent/site-preview/:site_id/activate",tag:"agent/site-preview",summary:"Activate the existing preview sandbox for a site through Agent.",status:"implemented",response_schema:"SitePreviewActivateResponseSchema"},{method:"POST",path:"/sites/:site_id/deployments",tag:"deployments",summary:"Queue an explicit user-confirmed publish from the latest current snapshot.",status:"implemented",request_body_schema:"CreateDeploymentRequestSchema",response_schema:"CreateDeploymentResponseSchema",notes:["The server resolves the latest current snapshot and validates site and snapshot existence, in-flight deployment state, and site operation lock before creating the deployment record and queue job.","The API returns after creating the deployment record and queue job; worker-service claims deployment_jobs for build and Cloudflare publish."]},{method:"POST",path:"/sites/:site_id/deployments/quality-check",tag:"deployments",summary:"Queue a quality-check deployment from a snapshot.",status:"implemented",request_body_schema:"CreateQualityCheckDeploymentRequestSchema",response_schema:"CreateDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/quality-check/status",tag:"deployments",summary:"Read the latest quality-check deployment status.",status:"implemented",response_schema:"GetDeploymentsStatusResponseSchema"},{method:"POST",path:"/internal/site-deployments/quality-check",tag:"deployments",summary:"Queue a quality-check deployment for the current site through the internal Agent API.",status:"implemented",response_schema:"InternalCreateDeploymentResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id.","POST accepts no request body; VCP resolves the current snapshot. Quality-check and publish deployments are independent."]},{method:"GET",path:"/internal/site-deployments/quality-check/status",tag:"deployments",summary:"Read the latest internal quality-check deployment status for the current site.",status:"implemented",response_schema:"InternalGetDeploymentsStatusResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id."]},{method:"POST",path:"/internal/site-deployments/publish",tag:"deployments",summary:"Queue a publish deployment for the current site through the internal Agent API.",status:"implemented",response_schema:"InternalCreateDeploymentResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id.","POST accepts no request body; VCP resolves the latest current snapshot. Quality-check and publish deployments are independent."]},{method:"GET",path:"/internal/site-deployments/publish/status",tag:"deployments",summary:"Read the latest internal publish deployment status for the current site.",status:"implemented",response_schema:"InternalGetDeploymentsStatusResponseSchema",notes:["InternalAgentAuthGuard is required; request context is supplied by x-vcp-tenant-id, x-vcp-user-id, and x-vcp-site-id."]},{method:"GET",path:"/sites/:site_id/deployments/current",tag:"deployments",summary:"Read the latest deployment for workspace refresh recovery.",status:"implemented",response_schema:"CurrentDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/status",tag:"deployments",summary:"Read current in-flight deployment and latest released deployment.",status:"implemented",response_schema:"GetDeploymentsStatusResponseSchema"},{method:"GET",path:"/sites/:site_id/deployments/:deployment_id",tag:"deployments",summary:"Read one tenant-scoped deployment for status polling.",status:"implemented",response_schema:"GetDeploymentResponseSchema"},{method:"GET",path:"/sites/:site_id/cms/collections",tag:"cms",summary:"List CMS collections for a site.",status:"planned"},{method:"POST",path:"/sites/:site_id/cms/collections",tag:"cms",summary:"Create a CMS collection bound to generated content.",status:"planned"},{method:"GET",path:"/sites/:site_id/cms/collections/:collection_id/entries",tag:"cms",summary:"List CMS entries for a collection.",status:"planned"},{method:"POST",path:"/sites/:site_id/cms/collections/:collection_id/entries",tag:"cms",summary:"Create a CMS entry.",status:"planned"},{method:"PATCH",path:"/sites/:site_id/cms/collections/:collection_id/entries/:entry_id",tag:"cms",summary:"Update a CMS entry.",status:"planned"},{method:"POST",path:"/sites/:site_id/snapshots/:snapshot_id/version-record",tag:"versions",summary:"Record the sandbox accepted git commit for a promoted snapshot version.",status:"implemented",request_body_schema:"RecordSnapshotVersionRequestSchema",response_schema:"RecordSnapshotVersionResponseSchema"},{method:"GET",path:"/sites/:site_id/versions",tag:"versions",summary:"List snapshot-backed site versions.",status:"implemented",response_schema:"ListSiteVersionsResponseSchema"},{method:"POST",path:"/sites/:site_id/versions/:snapshot_id/restore",tag:"versions",summary:"Restore a site to an earlier snapshot version.",status:"implemented",response_schema:"RestoreSiteSnapshotResponseSchema"},{method:"GET",path:"/sites/:site_id/domains/configuration",tag:"custom-domains",summary:"Read the authoritative site domain configuration.",status:"implemented",response_schema:"GetSiteDomainConfigurationResponseSchema"},{method:"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/integrations/gsc/auth/start",tag:"gsc",summary:"Start Google Search Console authorization for a site.",status:"implemented",request_body_schema:"StartGscAuthRequestSchema",response_schema:"StartGscAuthResponseSchema"},{method:"GET",path:"/sites/:site_id/integrations/gsc/status",tag:"gsc",summary:"Read Google Search Console authorization and property status.",status:"implemented",response_schema:"GscStatusResponseSchema"},{method:"GET",path:"/admin/tenants",tag:"admin",summary:"Admin tenant listing.",status:"planned"},{method:"GET",path:"/usage/summary",tag:"usage",summary:"Summarize tenant usage and cost controls.",status:"planned"},{method:"GET",path:"/sites/:site_id/publish-workflow/active",tag:"publish-workflow",summary:"Read the active site publish workflow.",status:"implemented",response_schema:"SitePublishWorkflowActiveResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/start",tag:"publish-workflow",summary:"Start or recover the site publish workflow.",status:"implemented",request_body_schema:"StartSitePublishWorkflowRequestSchema",response_schema:"SitePublishWorkflowMutationResponseSchema"},{method:"POST",path:"/sites/:site_id/publish-workflow/:workflow_id/quality-task",tag:"publish-workflow",summary:"Create a new quality task for a failed publish workflow.",status:"implemented",request_body_schema:"SitePublishWorkflowRevisionRequestSchema",response_schema:"SitePublishWorkflowMutationResponseSchema"},{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"}],jC=[{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"]}],Qb=e.object({id:e.string().min(1),role:e.enum(["system","user","assistant"]),metadata:e.unknown().optional(),parts:e.array(is).min(1)}),xm=Qb.extend({role:e.literal("user")}),OC=e.object({base_snapshot_id:x.optional(),message:xm.optional(),client_run_key:e.string().min(1).max(200).optional()}).superRefine((t,n)=>{ln(t.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),Zb=e.object({path:e.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:V,base_snapshot_id:x,run_kind:os}),NC=e.object({agent_run:it,websocket:Zb,next_step:e.literal("workspace_socket")}),LC=e.object({agent_run:it}),MC=e.object({agent_type:e.enum(["clarify","sitemap","workspace"])}),UC=e.object({agent_run:it}),qC=e.enum(["client.message.create","client.resource.operation.create","client.run.cancel","client.tool.approve","server.run.started","server.user.message","server.assistant.delta","server.tool.started","server.tool.completed","server.workspace.suggestions","workspace.plan.created","workspace.worker.updated","workspace.task.updated","server.patch.applied","server.sitemap.updated","server.snapshot.created","server.snapshot.finalized","server.preview.invalidated","preview.build.started","preview.build.succeeded","preview.build.failed","server.run.finished","server.run.failed","server.error","server.activity.started","server.activity.updated","server.activity.finished","server.activity.failed"]),J=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:I,run_id:V.optional(),correlation_id:e.string().min(1).optional(),seq:e.number().int().positive().optional(),sent_at:e.string().min(1)}),Jb=e.object({key:e.string().min(1),label:e.string().min(1),source_file:e.string().min(1).optional(),component_name:e.string().min(1).optional(),opening_element_range:e.object({start_line:e.number().int().positive(),start_column:e.number().int().nonnegative(),end_line:e.number().int().positive(),end_column:e.number().int().nonnegative()}).optional(),structural_path:e.string().min(1).optional(),text_preview:e.string().min(1).optional()}),ey=e.discriminatedUnion("type",[J.extend({type:e.literal("client.message.create"),payload:e.object({client_message_id:e.string().min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),current_route_id:Vt.optional(),interaction_response:jn.optional(),selected_component:Jb.optional(),message:xm,base_snapshot_id:x.optional()}).superRefine((t,n)=>{t.interaction_response&&!t.in_reply_to_tool_call_id&&n.addIssue({code:"custom",path:["in_reply_to_tool_call_id"],message:"in_reply_to_tool_call_id is required for an interaction response"})})}),J.extend({type:e.literal("client.run.cancel"),payload:e.object({run_id:V,reason:e.string().min(1).optional()})}),J.extend({type:e.literal("client.tool.approve"),payload:e.object({tool_call_id:e.string().min(1),decision:e.enum(["approve","reject"]),reason:e.string().min(1).optional()})}),Do]),ty=e.discriminatedUnion("type",[J.extend({type:e.literal("server.run.started"),payload:e.object({run_id:V,agent_type:e.literal("workspace")})}),J.extend({type:e.literal("server.user.message"),payload:e.object({client_message_id:e.string().min(1),message_id:e.string().min(1),parts:e.array(is).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),interaction_response:jn.optional()})}),J.extend({type:e.literal("server.assistant.delta"),payload:e.object({message_id:e.string().min(1),parts:e.array(is).min(1),status:e.enum(["streaming","ready"])})}),J.extend({type:e.literal("server.tool.started"),payload:e.object({tool_call_id:e.string().min(1),name:e.string().min(1),summary:e.string().min(1)})}),J.extend({type:e.literal("server.tool.completed"),payload:e.object({tool_call_id:e.string().min(1),name:e.string().min(1),result_summary:e.string().min(1),interaction_request:Hs.optional()})}),J.extend({type:e.literal("server.workspace.suggestions"),payload:hm.extend({run_id:V}).strict()}),J.extend({type:e.literal("workspace.plan.created"),payload:e.object({plan_id:e.string().min(1),run_kind:os,groups:e.array(Xi),tasks:e.array(Qi),dependencies:e.array(Zi),expected_outputs:e.array(Se),diagnostics:Yi,summary:fm})}),J.extend({type:e.literal("workspace.worker.updated"),payload:e.object({group_id:e.string().min(1),phase:Hi,status:ht,task_counts:bm,target_paths:e.array(Se),diagnostics:e.array(e.string().min(1))})}),J.extend({type:e.literal("workspace.task.updated"),payload:e.object({task_id:e.string().min(1),group_id:e.string().min(1),status:ht,target_path:Se,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array($i).optional()})}),J.extend({type:e.literal("server.patch.applied"),payload:e.object({patch_batch_id:e.string().min(1),changed_files:e.array(e.string().min(1)),sitemap_resync_queued:e.boolean()})}),J.extend({type:e.literal("server.sitemap.updated"),payload:e.object({sitemap_id:ke,version:e.number().int().positive(),reason:e.string().min(1)})}),J.extend({type:e.literal("server.snapshot.created"),payload:e.object({snapshot_id:x,manifest_hash:e.string().regex(/^sha256:[a-f0-9]{64}$/)})}),J.extend({type:e.literal("server.snapshot.finalized"),payload:e.object({snapshot_id:x})}),J.extend({type:e.literal("server.preview.invalidated"),payload:e.object({reason:e.string().min(1),next_preview_url:e.string().url().optional()})}),J.extend({type:e.literal("preview.build.started"),payload:e.object({snapshot_id:x})}),J.extend({type:e.literal("preview.build.succeeded"),payload:e.object({snapshot_id:x})}),J.extend({type:e.literal("preview.build.failed"),payload:e.object({snapshot_id:x,message:e.string().min(1),diagnostics:e.string().min(1),retryable:e.boolean()})}),J.extend({type:e.literal("server.run.finished"),payload:e.object({run_id:V,snapshot_id:x,degraded_reason:Nt.optional(),build_verified:e.boolean().optional()})}),J.extend({type:e.literal("server.run.failed"),payload:e.object({run_id:V,error_code:e.string().min(1),message:e.string().min(1),retryable:e.boolean(),outcome:e.literal("retained_previous").optional(),details:e.record(e.string(),e.unknown()).optional()})}),J.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})}),J.extend({type:e.literal("server.activity.started"),payload:e.object({activity_id:e.string().min(1),parent_activity_id:e.string().min(1).optional(),kind:Jc,title:e.string().min(1).max(200),title_code:st.optional(),detail:e.string().max(360).optional(),detail_code:st.optional(),locks_input:e.boolean()})}),J.extend({type:e.literal("server.activity.updated"),payload:e.object({activity_id:e.string().min(1),title:e.string().min(1).max(200).optional(),title_code:st.optional(),detail:e.string().max(360).optional(),detail_code:st.optional()})}),J.extend({type:e.literal("server.activity.finished"),payload:e.object({activity_id:e.string().min(1)})}),J.extend({type:e.literal("server.activity.failed"),payload:e.object({activity_id:e.string().min(1),detail:e.string().max(360).optional()})})]),ny=ty.superRefine((t,n)=>{if(t.type==="server.user.message"&&t.payload.interaction_response&&!t.payload.in_reply_to_tool_call_id&&n.addIssue({code:"custom",path:["payload","in_reply_to_tool_call_id"],message:"in_reply_to_tool_call_id is required for an interaction response"}),t.type!=="server.tool.completed")return;let s=t.payload.name==="prepare_product_search_entry";s!==!!t.payload.interaction_request&&n.addIssue({code:"custom",path:["payload","interaction_request"],message:s?"prepare_product_search_entry requires interaction_request":"interaction_request is only valid for prepare_product_search_entry"})}),FC=e.union([ey,ny]),GC={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."]},Em=e.string().regex(/^sha256:[a-f0-9]{64}$/),sy=e.enum(["create","update","delete","str_replace"]),Im=e.enum(["sitemap_resync","smoke_test","prepare_preview"]),iy=e.object({old_string:e.string().min(1).describe("Exact text to find in the current file. Must match the file uniquely; include enough surrounding context (usually 2-4 adjacent lines)."),new_string:e.string().describe("Replacement text. May be empty to delete the matched text."),replace_all:e.boolean().optional()}).strict(),ay=e.object({path:Se,operation:sy,expected_hash:Em.optional(),full_content:e.string().describe("Complete file content for create/update patches. Only this single field is a string value: every double quote inside the source code must be escaped so the field stays valid JSON. Avoid ASCII double quotes inside JSX attribute values and use corner quotes like \u300C\u751F\u65E5\u5FEB\u4E50\u300D for visitor-facing quoted examples. The surrounding patch object and the patches array are ordinary JSON structures, not strings.").optional(),edits:e.array(iy).min(1).max(20).optional()}).strict().superRefine((t,n)=>{let s=t.full_content!==void 0;if(t.operation==="delete"){s&&n.addIssue({code:"custom",path:["full_content"],message:"delete patches must not include full_content"}),t.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"});return}if(Sy(t.path)||n.addIssue({code:"custom",path:["path"],message:"Static App Router page paths must use lowercase ASCII kebab-case public segments."}),t.operation==="str_replace"){t.full_content!==void 0&&n.addIssue({code:"custom",path:["full_content"],message:"str_replace patches must not include full_content"}),(!t.edits||t.edits.length===0)&&n.addIssue({code:"custom",path:["edits"],message:"str_replace patches must include a non-empty edits array"});return}s||n.addIssue({code:"custom",path:["full_content"],message:"create/update patches must include full_content"}),t.edits!==void 0&&n.addIssue({code:"custom",path:["edits"],message:"edits is only allowed for str_replace patches"})}),oy=e.object({kind:e.enum(["block","page","site","chrome"]),id:e.string().min(1).max(120)}),ry=e.object({base_key:e.string().min(1).max(120).regex(/^[A-Za-z0-9._:-]+$/).refine(t=>!t.includes(".."),{message:"base_key must not contain '..'"}),owner:oy,count:e.number().int().min(1).max(12),query:e.string().min(1).max(400),role:e.enum(["hero","section","card","gallery","testimonial","decorative","site_background","nav_background","footer_background"]),orientation:e.enum(["landscape","portrait","square"]).optional(),altHint:e.string().min(1).max(300)}),Rm=e.object({site_id:I,base_snapshot_id:x,reason:e.string().min(1),patches:e.array(ay).min(1).describe("A real JSON array of patch objects. Never JSON.stringify this array, and never put an encoded JSON array inside a string \u2014 emit the array itself. Only full_content within a patch object is a string field."),media_requests:e.array(ry).max(24).optional(),post_actions:e.array(Im).optional()});function Tm(t,n){let s=new Set;for(let[a,i]of t.patches.entries())s.has(i.path)&&n.addIssue({code:"custom",path:["patches",a,"path"],message:`Duplicate patch path: ${i.path}`}),s.add(i.path)}var zC=Rm.superRefine(Tm),KC=Rm.omit({base_snapshot_id:!0}).extend({site_id:I.optional()}).superRefine(Tm),cy=pe,my=e.object({path:cy,operation:e.enum(["upsert","delete"]).optional()}),km=e.enum(["sync_cms_pages","sync_cms_navigation"]),BC=e.object({files:e.array(my).min(1),post_actions:e.array(km).optional()}).strict().overwrite(t=>t.post_actions?{...t,post_actions:[...new Set(t.post_actions)]}:t),ly=e.enum(["BASE_SNAPSHOT_NOT_FOUND","PATCH_TARGET_NOT_FOUND","PATCH_TARGET_ALREADY_EXISTS","PATCH_EXPECTED_HASH_MISMATCH","PATCH_DIFF_UNSUPPORTED","PATCH_PROTECTED_FILE","PATCH_VALIDATION_FAILED","PATCH_MEDIA_REFERENCE_NOT_DECLARED","PATCH_BATCH_INVALID","PATCH_BATCH_FAILED","PATCH_BATCH_TOO_LARGE","STR_REPLACE_NOT_FOUND","STR_REPLACE_NOT_UNIQUE","STR_REPLACE_BINARY_FILE","STR_REPLACE_REQUIRES_READ"]),py=e.object({status:e.literal("applied"),patch_batch_id:e.string().min(1),site_id:I,base_snapshot_id:x,snapshot_id:x,manifest_hash:Em,object_key:e.string().min(1),changed_files:e.array(Se).min(1),post_actions_queued:e.array(Im),dropped_protected_files:e.array(e.string().min(1)).min(1).optional()}),dy=e.object({status:e.literal("failed"),code:ly,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),WC=e.discriminatedUnion("status",[py,dy]),VC=e.object({ok:e.literal(!0),post_actions:e.array(e.object({action:km,status:e.enum(["succeeded","failed"])}).strict()).default([])}),Pm=pe,uy=e.enum(["text","binary"]),wm=e.object({path:Pm,kind:uy,language:e.string().min(1).nullable(),size_bytes:e.number().int().nonnegative()}),HC=e.object({path:Pm}),gy=wm.extend({kind:e.literal("text"),language:e.string().min(1),content:e.string()}),_y=wm.extend({kind:e.literal("binary"),language:e.null(),mime_type:e.string().min(1),content_base64:e.string().min(1)}),$C=e.union([gy,_y]);function ln(t){return typeof t=="string"?/authorization\s*:|bearer\s+|token\s*=|secret\s*=|api[_-]?key\s*=|access[_\s-]?key\s*=|\bsk-[a-z0-9_-]{20,}|eyJ[a-z0-9_-]{10,}\.[a-z0-9_-]{10,}\.[a-z0-9_-]{10,}/i.test(t):!t||typeof t!="object"?!1:Array.isArray(t)?t.some(n=>ln(n)):Object.entries(t).some(([n,s])=>hy(n)||ln(s))}function hy(t){let n=t.replace(/([a-z0-9])([A-Z])/g,"$1_$2").replace(/\s+/g,"_").toLowerCase();return/(^|[_-])(authorization|token|secret|api[_-]?key|apikey|access[_-]?key|accesskey)([_-]|$)/.test(n)}function Am(t){let n=t.split("/");return t.length>0&&!t.startsWith("/")&&!t.includes("\\")&&n.every(s=>s!==""&&s!=="."&&s!=="..")}function Sy(t){let n=/^app\/(?:(.*)\/)?page\.(?:tsx|jsx)$/.exec(t);if(!n)return!0;let a=(n[1]??"").split("/").filter(r=>r.length>0);return a.some(r=>r.startsWith("_"))?!0:a.filter(r=>!r.startsWith("@")&&!/^\(.+\)$/.test(r)).map(r=>r.replace(/^\((?:\.|\.\.|\.\.\.)\)/,"")).filter(r=>r.length>0).every(r=>/^\[.*\]$/.test(r)||Ft.test(`/${r}`))}var vm=e.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),fy=e.object({id:pn,tenant_id:e.string().min(1),site_id:I,sandbox_id:e.string().min(1).nullable(),status:vm,source_snapshot_id:x.nullable(),last_snapshot_id:x.nullable(),preview_url:e.string().url().nullable(),browser_preview_url:e.string().url().nullable().optional(),last_activity_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),YC=e.object({session_id:pn.optional(),sandbox_id:e.string().min(1).optional(),source_snapshot_id:x.optional(),last_snapshot_id:x,expected_current_snapshot_id:x.optional(),expected_ready_session_id:pn.optional(),expected_ready_session_last_snapshot_id:x.optional(),status:vm,preview_url:e.string().url().optional()}),XC=e.object({preview_session:fy,next_step:e.literal("preview")}),QC=e.object({failed_count:e.number().int().nonnegative()}),ZC=e.object({site_id:I}),JC=e.object({status:e.enum(["cancelled","no_active_run"]),agent_run:it.nullable()});export{Dr as AESTHETIC_NOTE_MAX_LENGTH,fv as AbandonSiteSnapshotResponseSchema,$S as ActiveSiteDomainDataSchema,Jc as ActivityKindSchema,st as ActivityTitleCodeSchema,uR as AdvanceSiteWorkflowRequestSchema,Wc as AgentErrorCategorySchema,ta as AgentEventIdSchema,Li as AgentEventRecordSchema,ym as AgentEventSchema,Sm as AgentEventTypeSchema,Nb as AgentMessageHistoryPurposeSchema,$c as AgentModelRouteSchema,Lb as AgentPlanStepSchema,V as AgentRunIdSchema,Hc as AgentRunKindSchema,it as AgentRunRecordSchema,Af as AgentRunStatusSchema,Vc as AgentRunTypeSchema,Kb as AiSdkUiDataPartSchema,Wb as AiSdkUiErrorPartSchema,Fb as AiSdkUiFilePartSchema,is as AiSdkUiMessagePartSchema,Qb as AiSdkUiMessageSchema,qb as AiSdkUiReasoningPartSchema,zb as AiSdkUiSourceDocumentPartSchema,Gb as AiSdkUiSourceUrlPartSchema,Vb as AiSdkUiStepStartPartSchema,Ub as AiSdkUiTextPartSchema,Bb as AiSdkUiToolPartSchema,vC as ApiContractStatusSchema,Mf as ApiErrorEnvelopeSchema,L as ApiResponseSchema,kC as AppendAgentEventRequestSchema,PC as AppendAgentEventResponseSchema,ly as ApplyPatchBatchErrorCodeSchema,dy as ApplyPatchBatchFailureSchema,zC as ApplyPatchBatchInputSchema,ay as ApplyPatchBatchPatchSchema,Im as ApplyPatchBatchPostActionSchema,WC as ApplyPatchBatchResultSchema,py as ApplyPatchBatchSuccessSchema,KC as ApplyPatchBatchToolInputSchema,iy as ApplyPatchEditSchema,sy as ApplyPatchOperationSchema,Bc as ArchetypeProposalSchema,Dy as AuditLogIdSchema,yy as AuthIdentityIdSchema,Ry as AuthLoginCodeIdSchema,Iy as AuthOidcStateIdSchema,xy as AuthSessionIdSchema,Ey as AuthTokenIdSchema,Ty as AuthWsTicketIdSchema,zh as BINDING_STATUSES,em as BlockGenerationContextSchema,Xv as BlockMediaIntentSchema,Bi as BlockSchema,tm as BrandingSchema,St as BriefIdSchema,Gi as BriefRecordSchema,ia as BusinessFactsSchema,vk as CHAT_COPY,Ak as CLARIFICATION_COPY,gh as CMS_FORM_FIELD_TYPES,ur as CMS_MAIN_PRODUCTS_MAX_LENGTH,dp as CMS_PAGE_DIRECTORY_MAX_DEPTH,pp as CMS_PAGE_DIRECTORY_MAX_NODES,Wa as CMS_PAGE_URL_PATH_MAX_LENGTH,dT as COMPONENT_I18N_FILE_SUFFIX,Ln as COMPONENT_I18N_NAMESPACE,jm as CONVERSION_CTA_LABEL_MAX_LENGTH,oS as CRAWLER_INTERNAL_ERROR_CODES,cr as CURRENT_EDIT_ENGINE_VERSION,ZC as CancelActiveWorkspaceRunRequestSchema,JC as CancelActiveWorkspaceRunResponseSchema,bc as CheckSitePublishDomainDataSchema,KS as CheckSitePublishDomainRequestSchema,BS as CheckSitePublishDomainResponseSchema,nm as ChromeDesignSchema,Xf as ChromeFooterDesignSchema,Yf as ChromeFooterShellSchema,Hf as ChromeHeaderDesignSchema,Vf as ChromeHeaderShellSchema,Qf as ChromeMobileNavDesignSchema,Pf as ClarifyQuestionOptionSchema,wf as ClarifyQuestionSchema,Rf as ClarifyQuestionTypeSchema,qi as ClarifyQuestionsSchema,FA as ClarifyRunInputSchema,Ji as ClarifySessionIdSchema,Ab as ClarifySessionRecordSchema,GA as ClarifyStreamEventSchema,jy as CmsCollectionBindingIdSchema,wP as CmsCollectionBindingSchema,Kr as CmsFormSchemaProjectionSchema,vs as CmsManagedPageTypeSchema,_p as CmsPageDirectoryGroupSchema,Va as CmsPageDirectoryNodeSchema,Ka as CmsPageDirectorySchema,Cs as CmsPageTypeSchema,ze as CmsPageUrlPathSchema,ba as CmsSiteIdSchema,sS as CompanyInfoSchema,KP as CompanyInfoTaskCreateRequestSchema,BP as CompanyInfoTaskCreateResponseSchema,WP as CompanyInfoTaskResponseSchema,n0 as CompleteCustomerMaterialsRequestSchema,s0 as CompleteDiagnosisRequestSchema,yv as CompleteSiteSnapshotDeletionResponseSchema,gR as CompleteSiteWorkflowRequestSchema,i0 as CompleteStrategyRequestSchema,t0 as CompleteWebsiteScanRequestSchema,gT as ComponentI18nResourcesSchema,tI as ComposeDesignerPageResourceBodySchema,gC as ConfirmSiteStructureRequestSchema,L0 as ConnectDynamicCollectionInputSchema,q0 as ConnectFormInputSchema,rt as ConversionHintsSchema,rS as CrawlerInternalErrorCodeSchema,VP as CrawlerInternalErrorSchema,Pt as CrawlerTaskCodeSchema,OP as CrawlerTaskCreateRequestSchema,MP as CrawlerTaskCreateResponseSchema,Yh as CrawlerTaskFailureErrorCodeSchema,ic as CrawlerTaskFailureStageSchema,Qh as CrawlerTaskPageSchema,NP as CrawlerTaskPagesQuerySchema,FP as CrawlerTaskPagesResponseSchema,qP as CrawlerTaskStatusResponseSchema,ut as CrawlerTaskUuidSchema,$v as CreateAgentRunConflictResponseSchema,dv as CreateAgentRunRequestSchema,uv as CreateAgentRunResponseSchema,qv as CreateDeploymentRequestSchema,jf as CreateDeploymentResponseSchema,px as CreateDocumentUploadRequestSchema,Zy as CreateExternalSiteEditRequestSchema,Jy as CreateExternalSiteEditResponseSchema,Sx as CreateImageUploadRequestSchema,ox as CreateInputSourceRequestSchema,Fv as CreateQualityCheckDeploymentRequestSchema,HA as CreateSiteBriefRequestSchema,mv as CreateSiteBriefResponseSchema,$A as CreateSiteDraftRequestSchema,VA as CreateSiteInputSchema,pR as CreateSiteWorkflowRequestSchema,Km as CreateTextInputSourceRequestSchema,Bm as CreateUrlInputSourceRequestSchema,zv as CurrentDeploymentResponseSchema,Y1 as CustomerMaterialsDraftResponseSchema,oi as CustomerMaterialsDraftSchema,X1 as CustomerMaterialsNullableResponseSchema,ri as CustomerMaterialsRecordSchema,$1 as CustomerMaterialsResponseSchema,k_ as CustomerMaterialsStatusSchema,P_ as DEFAULT_FONTS,Tr as DEFAULT_SITE_DESIGN_RADIUS_ID,ul as DEFAULT_SITE_LOCALE,Gk as DEFAULT_SUBSITE_PALETTE,sT as DEPLOYMENT_ACTIVE_STATUSES,Ze as DEPLOYMENT_LIFECYCLE_TRANSITIONS,mu as DEPLOYMENT_PROGRESS_STEP_CODES,Lf as DEPLOYMENT_REALTIME_CHANNEL,bt as DEPLOYMENT_STATUSES,iT as DEPLOYMENT_TERMINAL_STATUSES,Vu as DEPLOYMENT_TRANSITION_ERROR_CODE,Hv as DEPLOYMENT_WEBSOCKET_CONTRACT,kE as DESIGNER_COMPONENT_LIBRARY_ERROR_CODES,XE as DESIGNER_PAGE_LIBRARY_ERROR_CODES,rx as DOCUMENT_EXTENSION_WHITELIST,cx as DOCUMENT_MIME_WHITELIST,IS as DOMAIN_DNS_PURPOSES,RS as DOMAIN_DNS_VERIFICATION_STATUSES,bS as DOMAIN_OBSERVED_STATUSES,xS as DOMAIN_ROUTING_MODES,GE as DeleteDesignerPageErrorDetailsSchema,ME as DeleteDesignerPageRequestSchema,UE as DeleteDesignerPageResponseSchema,Ip as DeleteDesignerPageResultSchema,bv as DeleteSiteSnapshotResponseSchema,Ge as DeploymentIdSchema,ky as DeploymentJobIdSchema,lu as DeploymentProgressStepCodeSchema,du as DeploymentProgressStepSchema,pu as DeploymentProgressStepStatusSchema,Wo as DeploymentProgressStepsSchema,nt as DeploymentRecordSchema,Vv as DeploymentRedisPubSubEventSchema,zi as DeploymentStatusSchema,Fc as DeploymentStatusSummarySchema,Js as DeploymentTransitionError,Xc as DeploymentTypeSchema,ns as DeploymentWsDeploymentPayloadSchema,Wv as DeploymentWsServerMessageSchema,Nf as DeploymentWsServerMessageTypeSchema,jb as DesignPlanGenerationOutcomeSchema,Ob as DesignPlanGenerationReasonSchema,cs as DesignPlanIdSchema,Jv as DesignPlanPatchSchema,vb as DesignPlanRecordSchema,sm as DesignPlanSchema,Yv as DesignTokensSchema,lp as DesignerComponentCatalogItemSchema,Ua as DesignerComponentCategoriesDataSchema,Ma as DesignerComponentCategoryNodeSchema,lt as DesignerComponentExactVersionSchema,Fa as DesignerComponentInstallDataSchema,qa as DesignerComponentsDataSchema,Ap as DesignerPageCatalogItemSchema,eo as DesignerPageCategoriesDataSchema,Ja as DesignerPageCategoryNodeSchema,yp as DesignerPageDeleteBlockReasonSchema,bp as DesignerPageDisabledReasonSchema,qt as DesignerPageExactVersionSchema,Xa as DesignerPageGroupSchema,no as DesignerPageInstallDataSchema,Ya as DesignerPageNodeSchema,io as DesignerPageResourcePreparationDataSchema,wp as DesignerPageResourceSourceSchema,Lp as DesignerPageResourceTemplateSchema,pt as DesignerPageResourceTypeSchema,to as DesignerPagesDataSchema,ks as DesignerResourceVersionSchema,ao as DesignerSitePagesDataSchema,ZE as DesignerSiteRouteIdSchema,hc as DomainConfigurationSchema,_c as DomainDnsPurposeSchema,vS as DomainDnsRecordSchema,wS as DomainDnsVerificationObservationSchema,AS as DomainDnsVerificationResultSchema,TS as DomainDnsVerificationStatusSchema,yS as DomainObservedStatusSchema,PS as DomainOperationErrorSchema,Pi as DomainOperationSchema,kS as DomainOperationStatusSchema,ki as DomainOperationTypeSchema,gc as DomainRecordSchema,ES as DomainRoutingModeSchema,Dk as EDIT_ENGINE_VERSION_HEADER,jk as EDIT_ENGINE_VERSION_SOURCE_HEADER,Pk as ERROR_COPY,Lm as EXTERNAL_SITE_EDIT_INFRASTRUCTURE_REASONS,Nm as EXTERNAL_SITE_EDIT_PROMPT_MAX_LENGTH,ai as EditEngineVersionParseError,oo as EnhanceDesignerPageResourceBodySchema,rv as EnhanceDesignerPageResourceResponseSchema,nx as ExternalSiteEditCallbackAckSchema,tx as ExternalSiteEditCallbackPayloadSchema,Mm as ExternalSiteEditCallbackStatusSchema,Nt as ExternalSiteEditDegradedReasonSchema,ra as ExternalSiteEditOutcomeSchema,oa as ExternalSiteEditTaskIdSchema,ca as ExternalSiteEditTaskSchema,Um as ExternalSiteEditTaskStatusSchema,ZA as ExternalSyncSiteRequestSchema,cv as ExternalSyncSiteResponseSchema,Fm as ExtractedFactKindSchema,un as ExtractedFactSchema,V_ as FIELD_TYPES,Er as FONT_PAIRINGS,mi as FONT_PAIRING_IDS,kh as FORM_DESIGN_ERROR_CODES,Th as FORM_DESIGN_FAILURE_STAGES,Ih as FORM_DESIGN_OPERATION_STAGES,Rh as FORM_DESIGN_OPERATION_STATUSES,Hn as FORM_FIELD_TYPES,_h as FORM_SPEC_FIELD_TYPE_TO_CMS,Mr as FORM_SPEC_FILE_MIN_RUNTIME_VERSION,oh as FORM_SPEC_LOCALIZABLE_FIELD_PATHS,Lr as FORM_SPEC_MULTISTEP_MIN_RUNTIME_VERSION,X0 as FORM_TEMPLATE_CATEGORY_COUNTS,Y0 as FORM_TEMPLATE_CATEGORY_SLUGS,QC as FailStaleInFlightWorkspaceRunsResponseSchema,Nr as FieldDeclSchema,nw as FirecrawlBatchCreateRequestSchema,sw as FirecrawlBatchCreatedResponseSchema,lS as FirecrawlBatchErrorSchema,aw as FirecrawlBatchErrorsResponseSchema,mS as FirecrawlBatchPageSchema,iw as FirecrawlBatchStatusResponseSchema,QP as FirecrawlCrawlCreateRequestSchema,ZP as FirecrawlCrawlCreatedResponseSchema,JP as FirecrawlCrawlStatusResponseSchema,mc as FirecrawlJobStatusSchema,YP as FirecrawlMapRequestSchema,XP as FirecrawlMapResponseSchema,ow as FirecrawlQueueStatusResponseSchema,ew as FirecrawlScrapeRequestSchema,tw as FirecrawlScrapeResponseSchema,$f as FooterShellSurfaceSchema,X_ as FormBlockIdSchema,Yn as FormDefinitionIdSchema,yh as FormDesignAffectedFilesSchema,Ii as FormDesignErrorCodeSchema,rP as FormDesignErrorSchema,Vr as FormDesignFailureStageSchema,te as FormDesignHashSchema,eP as FormDesignOpenResponseSchema,xh as FormDesignOperationFingerprintInputSchema,Si as FormDesignOperationIdSchema,Hr as FormDesignOperationNextActionSchema,wy as FormDesignOperationRecordIdSchema,aP as FormDesignOperationRecordSchema,Ri as FormDesignOperationResponseSchema,Yr as FormDesignOperationSchema,Ei as FormDesignOperationStageSchema,Wr as FormDesignOperationStatusSchema,oP as FormDesignOperationTransitionRequestSchema,$r as FormDesignPreviewRefreshStatusSchema,nP as FormDesignQueryResponseSchema,sP as FormDesignResumeRequestSchema,iP as FormDesignResumeResponseSchema,Eh as FormDesignSaveRequestSchema,tP as FormDesignSaveResponseSchema,Br as FormDesignSharedImpactSchema,xi as FormDesignStandardizationSchema,$_ as FormFieldDeclSchema,on as FormFieldNameSchema,fi as FormOptionValueSchema,Q_ as FormSpecBindingSchema,J_ as FormSpecFieldNodeSchema,th as FormSpecNodeSchema,Z_ as FormSpecOptionSchema,eh as FormSpecStepBreakNodeSchema,yi as FormSpecV1Schema,Q0 as FormTemplateCatalogResponseSchema,zr as FormTemplateCategorySlugSchema,dh as FormTemplateCategoryV1Schema,tt as FormTemplateTextSchema,uh as FormTemplateV1Schema,YS as GSC_AUTH_STATUSES,XS as GSC_BINDING_STATUSES,QS as GSC_PROPERTY_TYPES,qw as GetActiveSiteDomainResponseSchema,Kv as GetDeploymentResponseSchema,Of as GetDeploymentsStatusResponseSchema,ex as GetExternalSiteEditResponseSchema,Uw as GetSiteDomainConfigurationResponseSchema,wi as GetSitePublishDomainOperationDataSchema,WS as GetSitePublishDomainOperationResponseSchema,f1 as GetTemplateUpgradeReportQuerySchema,b1 as GetTemplateUpgradeReportResponseSchema,iA as GoogleSearchConsoleAuthStartDataSchema,sA as GoogleSearchConsoleAuthStartRequestSchema,aA as GoogleSearchConsoleAuthStartResponseSchema,Jw as GoogleSearchConsoleAuthStatusSchema,eA as GoogleSearchConsoleBindingStatusSchema,tA as GoogleSearchConsolePropertyTypeSchema,nA as GoogleSearchConsoleStateSchema,rA as GoogleSearchConsoleStatusDataSchema,oA as GoogleSearchConsoleStatusInputSchema,cA as GoogleSearchConsoleStatusResponseSchema,Xw as GscAuthStartDataSchema,Yw as GscAuthStartRequestSchema,Qw as GscAuthStartResponseSchema,Ai as GscAuthStatusSchema,vi as GscBindingStatusSchema,Ci as GscPropertyTypeSchema,JS as GscStateInputSchema,Zw as GscStateSchema,Ec as GscStatusDataSchema,ef as GscStatusResponseSchema,Ba as HOME_PAGE_URL_PATH,Bf as HeaderShellBehaviorSchema,Wf as HeaderShellShapeSchema,Kf as HeaderShellSurfaceSchema,zf as HeaderShellVariantSchema,Kh as HomeUrlCrawlerTaskCreateRequestSchema,Gs as HttpUrlSchema,ux as IMAGE_EXTENSION_WHITELIST,gx as IMAGE_MIME_WHITELIST,La as INSERT_NEW_COMPONENT_CATEGORY_GROUP_KEY,Za as INSERT_NEW_PAGE_CATEGORY_GROUP_KEY,gl as ISO_639_3_TO_SITE_LOCALE,Wm as ImageRoleSchema,xm as InboundUserMessageSchema,C0 as IndustryClassificationRequestSchema,D0 as IndustryClassificationResultSchema,W_ as IndustryConfidenceSchema,qm as InputBundleStatusSchema,_n as InputConflictSchema,fx as InputContextBundleSchema,ot as InputContextSourceIdSchema,zm as InputSourceSchema,ps as InputSourceStatusSchema,ls as InputSourceTypeSchema,o1 as InspectTemplateUpgradeStateRequestSchema,r1 as InspectTemplateUpgradeStateResponseSchema,vE as InstallDesignerComponentBodySchema,tv as InstallDesignerComponentResponseSchema,JE as InstallDesignerPageBodySchema,iv as InstallDesignerPageResponseSchema,Gv as InternalCreateDeploymentResponseSchema,Nv as InternalEnsureSubsitePublishRequestSchema,Lv as InternalEnsureSubsitePublishResponseSchema,G as InternalEntityIdSchema,Bv as InternalGetDeploymentsStatusResponseSchema,Mv as InternalGetSubsitePublishStatusRequestSchema,Uv as InternalGetSubsitePublishStatusResponseSchema,jv as InternalPrepareSubsitePreviewRequestSchema,Ov as InternalPrepareSubsitePreviewResponseSchema,I_ as KNOWLEDGE_CATEGORY_CODES,gr as KnowledgeCategoryCodeSchema,z1 as KnowledgeContextReadinessSchema,T_ as KnowledgeSourceReadinessSchema,_r as KnowledgeSourceReadinessStatusSchema,F1 as KnowledgeTaskStatusBatchSchema,R_ as KnowledgeTaskStatusSchema,cl as LEGACY_SITE_LOCALE_CODES,MC as LatestAgentRunQuerySchema,UC as LatestAgentRunResponseSchema,LC as LatestWorkspaceRunResponseSchema,uw as LauncherPromptTemplateApplyRequestSchema,gw as LauncherPromptTemplateApplyResponseSchema,gS as LauncherPromptTemplateCatalogItemSchema,pw as LauncherPromptTemplateCatalogQuerySchema,dw as LauncherPromptTemplateCatalogSchema,dS as LauncherPromptTemplateKindSchema,uS as LauncherPromptTemplateLocaleSchema,ts as LauncherPromptTemplateTypeSchema,AC as ListAgentEventsQuerySchema,wC as ListAgentEventsResponseSchema,JA as ListDesignerComponentCategoriesResponseSchema,AE as ListDesignerComponentsQuerySchema,ev as ListDesignerComponentsResponseSchema,nv as ListDesignerPageCategoriesResponseSchema,QE as ListDesignerPagesQuerySchema,sv as ListDesignerPagesResponseSchema,ov as ListDesignerSitePagesResponseSchema,pf as ListMediaLibraryAssetsQuerySchema,df as ListMediaLibraryAssetsResponseSchema,vv as ListSiteVersionsResponseSchema,y1 as ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema,x1 as ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema,lx as MAX_DOCUMENT_SOURCES_PER_SITE,mx as MAX_DOCUMENT_UPLOAD_BYTES,hx as MAX_IMAGE_SOURCES_PER_SITE,_x as MAX_IMAGE_UPLOAD_BYTES,vc as MEDIA_LIBRARY_AUDIO_EXTENSIONS,Nc as MEDIA_LIBRARY_AUDIO_MIME_TYPES,Cc as MEDIA_LIBRARY_DOCUMENT_EXTENSIONS,mf as MEDIA_LIBRARY_EXTENSIONS,Dc as MEDIA_LIBRARY_FILE_EXTENSIONS,wc as MEDIA_LIBRARY_IMAGE_EXTENSIONS,cf as MEDIA_LIBRARY_IMAGE_MAX_BYTES,jc as MEDIA_LIBRARY_IMAGE_MIME_TYPES,Pc as MEDIA_LIBRARY_MAX_BYTES,lf as MEDIA_LIBRARY_MIME_TYPES,Ac as MEDIA_LIBRARY_VIDEO_EXTENSIONS,Oc as MEDIA_LIBRARY_VIDEO_MIME_TYPES,ST as MIGRATION_PRODUCTS_CMS_DETAIL_PAGE_TITLE,hT as MIGRATION_PRODUCTS_DETAIL_PREFIX,yT as MIGRATION_PRODUCTS_DETAIL_VIEW_VARIANT,bT as MIGRATION_PRODUCTS_LIST_VIEW_VARIANT,Xu as MIGRATION_PRODUCTS_ROUTE,We as MIGRATION_PRODUCTS_SLUG,fT as MIGRATION_PRODUCTS_VIEW_BLOCK_TYPE,H_ as MODEL_DECLARABLE_FORM_FIELD_TYPES,M_ as MOTION_PRESETS,pi as MOTION_PRESET_IDS,Ix as ManagedPageTemplateRouteManifestV1Schema,Zv as MediaAssetSchema,Ff as MediaAttributionSchema,Oi as MediaLibraryAssetSchema,Lc as MediaLibraryFileTypeSchema,Mc as MediaLibrarySourceSchema,oy as MediaRequestOwnerSchema,Cy as MediaResolutionCacheIdSchema,wE as MockDesignerComponentInsertDataSchema,PE as MockDesignerComponentInsertRequestSchema,Ui as MotionLevelSchema,Oh as NAV_ITEMS_LOCALIZABLE_FIELD_PATHS,Nh as NAV_ITEMS_MACHINE_FIELD_PATHS,C_ as NEXT_FONT_DISPLAY_NAMES,Zt as NEXT_FONT_REGISTRY,_l as NON_LATIN_SITE_LOCALE_CODES,SP as NavItemSchema,vh as PAGE_SEO_LOCALIZABLE_FIELD_PATHS,Ch as PAGE_SEO_MACHINE_FIELD_PATHS,Ft as PAGE_SLUG_PATTERN,xt as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,IP as PLATFORM_MATERIALIZED_EXEMPTIONS,qh as PLATFORM_MATERIALIZED_FILES,Fh as PLATFORM_MATERIALIZED_FILE_PATTERNS,EP as PLATFORM_MATERIALIZERS,ro as PLATFORM_OWNED_PAGE_SLUGS,Mp as PLATFORM_OWNED_ROUTE_FILE_PATHS,Ep as PageDirectoryReconcileFailedPageSchema,Ds as PageDirectoryReconcileResultSchema,KE as PageDirectoryReconcileStateSchema,xp as PageDirectoryReconcileStatusSchema,Hh as PageDiscoveryCoverageEntrySchema,UP as PageDiscoveryCoverageReasonSchema,ac as PageDiscoveryCoverageSchema,am as PageNavigationSchema,Os as PageResourceArtifactSchema,jp as PageResourceComponentReferenceSchema,Op as PageResourceComponentSchema,Cp as PageResourceDraftPageSchema,Dp as PageResourceDraftSchema,wn as PageResourceFinalRouteSchema,Np as PageResourcePageSchema,vp as PageResourcePageSelectionSchema,so as PageResourceRouteMappingSchema,Wi as PageSchema,_P as PageSeoDeclSchema,im as PageSlugSchema,Tp as PageTargetKindSchema,ws as PageTargetProjectionHashSchema,Qa as PageTargetSchema,kp as PageTargetSeoSchema,zE as PageTargetSetSchema,kx as PageTemplateCleanupRequestSchema,Ax as PageTemplateCleanupResponseSchema,Rx as PageTemplateCreateRequestSchema,Px as PageTemplateCreateResponseSchema,vx as PageTemplateErrorCodeSchema,Ie as PageTemplateIdSchema,hn as PageTemplatePagePathSchema,Tx as PageTemplatePromoteRequestSchema,wx as PageTemplatePromoteResponseSchema,bC as PersistClarifyAnswersRequestSchema,yC as PersistClarifyAnswersResponseSchema,_C as PersistGeneratedSitemapDraftRequestSchema,fC as PersistGeneratedSitemapDraftResponseSchema,YC as PersistPreviewSessionRequestSchema,XC as PersistPreviewSessionResponseSchema,EC as PersistSiteDesignPlanRequestSchema,IC as PersistSiteDesignPlanResponseSchema,SC as PersistSiteSitemapDraftResponseSchema,uC as PersistSiteSitemapRequestSchema,hC as PersistSiteSitemapResponseSchema,gv as PersistSiteSnapshotRequestSchema,_v as PersistSiteSnapshotResponseSchema,If as PositioningPrefillSchema,Ni as PositioningSourceSchema,eI as PrepareDesignerPageBodySchema,av as PrepareDesignerPageResponseSchema,D1 as PrepareSiteBuildInitialGenerationBaseRequestSchema,j1 as PrepareSiteBuildInitialGenerationBaseResultSchema,a1 as PrepareTemplateUpgradeStateRequestSchema,o_ as PrepareTemplateUpgradeStateResponseSchema,Dv as PrepareVersionPreviewRequestSchema,Df as PrepareVersionPreviewResponseSchema,Bo as ProductSearchAppConfigDraftSchema,Vs as ProductSearchAppSlugSchema,AR as ProductSearchContractFixtureSchema,nu as ProductSearchDraftConfigSchema,Re as ProductSearchFieldNameSchema,eu as ProductSearchFilterMetaSchema,Hs as ProductSearchInteractionRequestSchema,jn as ProductSearchInteractionResponseSchema,wR as ProductSearchPopularTermsReadSchema,Ko as ProductSearchPopularTermsSchema,ou as ProductSearchRequestSchema,cu as ProductSearchResponseSchema,Vt as ProductSearchRouteIdSchema,Jd as ProductSearchValueShapeSchema,Sv as PromoteSiteSnapshotRequestSchema,vf as PromoteSiteSnapshotResponseSchema,wv as PromoteTemplateUpgradeSnapshotRequestSchema,Av as PromoteTemplateUpgradeSnapshotResponseSchema,fc as QualityRunningStatusSchema,wk as REFUSAL_COPY,DC as REST_API_ENDPOINTS,Dh as ROOT_LAYOUT_METADATA_LOCALIZABLE_FIELD_PATHS,jh as ROOT_LAYOUT_METADATA_MACHINE_FIELD_PATHS,VS as ReconcileSitePublishDomainOperationDataSchema,HS as ReconcileSitePublishDomainOperationResponseSchema,xv as RecordSnapshotVersionRequestSchema,Ev as RecordSnapshotVersionResponseSchema,h1 as RecordTemplateUpgradeEventRequestSchema,S1 as RecordTemplateUpgradeEventResponseSchema,c1 as RecordTemplateUpgradeFailureRequestSchema,m1 as RecordTemplateUpgradeFailureResponseSchema,l1 as RecordTemplateUpgradeSuccessRequestSchema,p1 as RecordTemplateUpgradeSuccessResponseSchema,qE as RecoverDesignerPageProjectionRequestSchema,FE as RecoverDesignerPageProjectionResponseSchema,Rp as RecoverDesignerPageProjectionResultSchema,Gm as ReferencePagePatternSchema,gn as ReferenceSignalsSchema,ff as RegisterMediaResourceReferenceRequestSchema,bf as RegisterMediaResourceReferenceResponseSchema,_R as RegisterWorkflowTaskCommandRequestSchema,Vd as RegisterWorkflowTaskRequestSchema,Tv as ReleaseTemplateUpgradeLockRequestSchema,kv as ReleaseTemplateUpgradeLockResponseSchema,fR as ReplaceCrawlWorkflowTaskCommandRequestSchema,$d as ReplaceCrawlWorkflowTaskRequestSchema,SR as ReplaceWorkflowTaskCommandRequestSchema,Hd as ReplaceWorkflowTaskRequestSchema,N0 as ResolvedFieldSchema,F0 as ResolvedFormFieldSchema,CC as RestApiMethodSchema,Cv as RestoreSiteSnapshotResponseSchema,hP as RootLayoutMetadataSchema,Zc as RouteGenerationCardSchema,qu as RuleEngineInputSchema,Ku as RuleEngineScoreRecordSchema,Zs as RuleScoreDimensionKeySchema,zu as RuleScoreDimensionSchema,Lt as SELECTABLE_SITE_LOCALE_CODES,rm as SITEMAP_RESOLVER_MAX_BLOCK_TARGETS,om as SITEMAP_RESOLVER_MAX_PAGE_TARGETS,v1 as SITE_BUILD_CONTEXT_FILE_PATH,C1 as SITE_BUILD_CONTEXT_MAX_BYTES,Od as SITE_BUILD_STATUSES,Lo as SITE_BUILD_STATUS_CODES,Nd as SITE_DEPLOYMENT_STATUSES,Mo as SITE_DEPLOYMENT_STATUS_CODES,li as SITE_DESIGN_DENSITY_IDS,Rr as SITE_DESIGN_RADIUS_IDS,UT as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,sp as SITE_EDIT_MATERIALIZATION_MAX_FILE_CONTENT_BYTES,Rs as SITE_EDIT_MATERIALIZATION_MAX_FILE_COUNT,Ts as SITE_EDIT_MATERIALIZATION_MAX_TOTAL_CONTENT_BYTES,yo as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,AI as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,Cg as SITE_EDIT_RUNTIME_CONTAINER_TAGS,Dg as SITE_EDIT_RUNTIME_TEXT_TAGS,vg as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,yI as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,$m as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,la as SITE_EDIT_SOURCE_ALLOWED_DIRS,Hm as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,gs as SITE_EDIT_SOURCE_DELETE_CAPABILITY,Ym as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,ft as SITE_EXTRA_REQUIREMENT_MAX_LENGTH,ml as SITE_LOCALE_CODES,gP as SITE_LOCALIZATION_STRUCTURES,zA as SITE_PLANNING_FROZEN_ERROR_CODE,KA as SITE_PLANNING_LOCKED_ERROR_CODE,BA as SITE_STRUCTURE_CONFIRMATION_REQUIRED_ERROR_CODE,WA as SITE_STRUCTURE_CONFIRMATION_STALE_ERROR_CODE,Ld as SITE_WORKFLOW_STATUSES,Uo as SITE_WORKFLOW_STATUS_CODES,jC as SSE_STREAMS,Ll as STEP5_GEO_QUESTION_TYPES,xn as STEP5_PRIMARY_INTENT_PAGE_LIMIT,ka as STEP5_SEMRUSH_MIN_RELEVANCE_SCORE,El as STEP5_SEMRUSH_SEARCH_INTENTS,Il as STEP5_SEO_ALLOWED_INTENT_CODES,sE as STEP5_SEO_ALLOWED_SEARCH_INTENTS,cE as STEP5_SEO_KEYWORD_DEFAULT,Fl as STEP5_SEO_KEYWORD_MAX,ql as STEP5_SEO_KEYWORD_MIN,yn as STEP5_SEO_MAX_KEYWORD_DIFFICULTY,ya as STEP5_SEO_MIN_FIT,bn as STEP5_SEO_MIN_SEARCH_VOLUME,Ul as STEP5_SEO_PAYLOAD_SCHEMA_VERSION,Zl as STEP5_SSE_EVENT_NAMES,fe as STEP5_STRATEGY_COUNT,ct as STEP5_STRATEGY_KEYS,Ia as STEP5_STRATEGY_OPTION_IDS,wr as STEP6_AI_THEME_IDS,di as STEP6_AI_THEME_PRESETS,Ar as STEP6_GENERATED_THEME_ID_PATTERN,Kg as SUBSITE_GLOSSARY_ENTRY_MAX_CHARS,Bg as SUBSITE_GLOSSARY_MAX_ENTRIES,e_ as SUBSITE_MOUNT_PATH_PATTERN,Yg as SUBSITE_PALETTE_NOTE_MAX_CHARS,t_ as SUBSITE_RESERVED_MOUNT_SEGMENTS,$x as SUPPORTED_SITE_LOCALES,pn as SandboxSessionIdSchema,fy as SandboxSessionSchema,vm as SandboxSessionStatusSchema,QA as SaveBriefDraftRequestSchema,pv as SaveBriefDraftResponseSchema,zy as SaveSiteExtraRequirementRequestSchema,gf as SearchUnsplashMediaQuerySchema,_f as SearchUnsplashMediaResponseSchema,y_ as SiteBuildContextFileSchema,b_ as SiteBuildContextPayloadSchema,f_ as SiteBuildContextProvenanceSchema,S_ as SiteBuildContextProvenanceSourceSchema,zs as SiteBuildStatusSchema,Ks as SiteDeploymentStatusSchema,Qc as SiteDesignContextSchema,Tf as SiteDesignDensitySchema,kf as SiteDesignMotionLevelSchema,qn as SiteEditBoundaryKindSchema,tg as SiteEditCapabilityConstraintSchema,Ju as SiteEditCapabilityModeSchema,Un as SiteEditCapabilityModeViewSchema,PT as SiteEditCapabilityReadRequestSchema,zp as SiteEditClassNameSourceDiagnosticSchema,dt as SiteEditClassNameSourceRangeSchema,go as SiteEditClassNameSourceSchema,pI as SiteEditClassNameSourceStyleContextSchema,uo as SiteEditClassNameSourceStylesheetSchema,Ls as SiteEditClassNameSourceWriteIntentSchema,oI as SiteEditCommandDiagnosticSchema,Fp as SiteEditCommandErrorSchema,M as SiteEditCompositionContextSchema,ne as SiteEditCompositionSelectorSchema,eg as SiteEditConstraintKindSchema,Ed as SiteEditDeletePageSourceOutputSchema,xg as SiteEditDynamicConfidenceSchema,Ig as SiteEditDynamicDataBindingSchema,sr as SiteEditDynamicDataDetailSchema,ir as SiteEditDynamicDataSummarySchema,Eg as SiteEditDynamicEvidenceSchema,nr as SiteEditDynamicSourceKindSchema,bg as SiteEditDynamicSourceTypeSchema,yg as SiteEditDynamicTargetKindSchema,kg as SiteEditEffectiveWriteTargetSchema,Ms as SiteEditElementPropertySchema,OT as SiteEditEventSchema,ti as SiteEditExternalSourceKindSchema,_I as SiteEditGetClassNameSourceCommandResultSchema,uI as SiteEditGetClassNameSourceInputSchema,gI as SiteEditGetClassNameSourceResultSchema,mk as SiteEditGetDocumentInputSchema,lk as SiteEditGetObjectEditContextInputSchema,Gx as SiteEditGetSourceFileInputSchema,Fx as SiteEditGetSourceTreeInputSchema,dI as SiteEditGetStyleContextInputSchema,Gn as SiteEditHistoryProvenanceSchema,og as SiteEditHistoryReadOnlyRecoveryStatusSchema,ng as SiteEditHistoryRecoveryCodeSchema,sg as SiteEditHistoryRecoveryDiagnosticSchema,FT as SiteEditHistoryResultSchema,qT as SiteEditHistoryStatusModeSchema,cg as SiteEditHistoryStatusSchema,ig as SiteEditHistoryUnavailableReasonSchema,rg as SiteEditHistoryUnavailableStatusSchema,ag as SiteEditHistoryWritableStatusSchema,Tk as SiteEditInitializeSessionInputSchema,bd as SiteEditInsertNodeSpecSchema,xd as SiteEditInsertPageResourceOutputSchema,mp as SiteEditMaterializationDataRequirementsSchema,cp as SiteEditMaterializationEntrySchema,rp as SiteEditMaterializationExportSchema,op as SiteEditMaterializationFileSchema,Na as SiteEditMaterializationPathTemplateSchema,mt as SiteEditMaterializationSchema,Ro as SiteEditMoveTargetSchema,Gt as SiteEditMutationContextSchema,Fn as SiteEditNodeCapabilitySnapshotSchema,dk as SiteEditObjectCapabilitiesSchema,gk as SiteEditObjectDetailSchema,hk as SiteEditObjectEditContextSchema,Sk as SiteEditObjectStyleDetailSchema,_k as SiteEditObjectSummarySchema,BI as SiteEditOperationCommandResultSchema,wo as SiteEditOperationErrorCodeSchema,Ao as SiteEditOperationErrorSchema,Id as SiteEditOperationOutputSchema,yd as SiteEditOperationParamsSchema,Fs as SiteEditOperationPayloadSchema,qs as SiteEditOperationRequestSchema,fd as SiteEditOperationResultTargetSchema,vo as SiteEditOperationSelectionRefSchema,fg as SiteEditOperationSummarySchema,Sd as SiteEditOperationTargetSchema,Bt as SiteEditOperationTypeSchema,Io as SiteEditOperationValueSchema,vI as SiteEditPageCompositionAnyVersionSchema,td as SiteEditPageCompositionAtomicKindSchema,ad as SiteEditPageCompositionBoundaryModeSchema,Hp as SiteEditPageCompositionBusinessMemberSchema,Wp as SiteEditPageCompositionContainerSchema,Kt as SiteEditPageCompositionDiagnosticSchema,vn as SiteEditPageCompositionErrorCodeSchema,So as SiteEditPageCompositionPlacementTargetSchema,$p as SiteEditPageCompositionPlacementUnitSchema,Jp as SiteEditPageCompositionRuntimeRefSchema,Zp as SiteEditPageCompositionSchema,ed as SiteEditPageCompositionSourceMemberKindSchema,Vp as SiteEditPageCompositionSourceMemberSchema,xo as SiteEditPageCompositionSourceRangeSchema,Xp as SiteEditPageCompositionSupportedSchema,Qp as SiteEditPageCompositionUnsupportedSchema,id as SiteEditPageCompositionV2BusinessMemberSchema,nd as SiteEditPageCompositionV2ContainerSchema,rd as SiteEditPageCompositionV2PlacementRelationSchema,md as SiteEditPageCompositionV2PlacementSchema,od as SiteEditPageCompositionV2PlacementUnitSchema,ud as SiteEditPageCompositionV2Schema,sd as SiteEditPageCompositionV2SourceMemberSchema,pd as SiteEditPageCompositionV2SupportedSchema,dd as SiteEditPageCompositionV2UnsupportedSchema,cd as SiteEditPageCompositionV2WriteModeSchema,ld as SiteEditPageCompositionVisualAnchorSchema,Yp as SiteEditPagePlacementOptionSchema,ho as SiteEditPagePlacementSchema,bo as SiteEditPageUnitResultTargetSchema,fo as SiteEditPageUnitTargetSchema,pg as SiteEditPatchPlanPatchSchema,WT as SiteEditPatchPlanSchema,Xt as SiteEditProvenanceChainSchema,Pg as SiteEditProvenanceHopSchema,pk as SiteEditRenderDocumentSchema,Yt as SiteEditRenderEntryRefSchema,Rg as SiteEditRenderEntrySchema,tr as SiteEditRenderPageCompositionSchema,hg as SiteEditRenderPageCompositionSupportedSchema,Sg as SiteEditRenderPageCompositionUnsupportedSchema,_g as SiteEditRenderPagePlacementSchema,xI as SiteEditRequiredMutationContextEnvelopeSchema,Kx as SiteEditResolveSourceLocationInputSchema,or as SiteEditSemanticSourceSchema,KI as SiteEditSignedOperationRequestSchema,pa as SiteEditSourceDeleteCapabilitySchema,Qm as SiteEditSourceDirectoryPathSchema,nl as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,sl as SiteEditSourceFileBinaryResponseSchema,Ux as SiteEditSourceFileKindSchema,Zm as SiteEditSourceFileListItemSchema,zx as SiteEditSourceFileResponseSchema,tl as SiteEditSourceFileTextResponseSchema,Us as SiteEditSourceIdentitySchema,il as SiteEditSourceLocationRangeSchema,Bx as SiteEditSourceLocationSchema,Ag as SiteEditSourceLocatorRangeSchema,si as SiteEditSourceLocatorSchema,pe as SiteEditSourcePathSchema,da as SiteEditSourceTreeNodeSchema,qx as SiteEditSourceTreeResponseSchema,Jm as SiteEditSourceTreeTruncationReasonSchema,el as SiteEditSourceTreeTruncationSchema,Po as SiteEditStyleBreakpointSchema,uk as SiteEditStyleModelSchema,To as SiteEditStylePropertySchema,rr as SiteEditStyleSourceSchema,ko as SiteEditStyleStateModeSchema,ni as SiteEditTextSegmentSchema,ar as SiteEditTextSourceSchema,Tg as SiteEditWriteTargetSchema,Ky as SiteExtraRequirementResponseSchema,Dm as SiteExtraRequirementSchema,I as SiteIdSchema,de as SiteLocaleSchema,Qv as SiteMediaIntentSchema,Py as SiteOperationLockIdSchema,u_ as SitePreviewActivateErrorCodeSchema,__ as SitePreviewActivateFailedSchema,g_ as SitePreviewActivateReadySchema,R1 as SitePreviewActivateResponseSchema,Gw as SitePublishDomainCheckDataSchema,Fw as SitePublishDomainCheckRequestSchema,zw as SitePublishDomainCheckResponseSchema,Kw as SitePublishDomainOperationDataSchema,Bw as SitePublishDomainOperationResponseSchema,Ww as SitePublishDomainReconcileOperationResponseSchema,Sc as SitePublishQualityTaskStatusSchema,Aw as SitePublishWorkflowActiveResponseSchema,na as SitePublishWorkflowIdSchema,FS as SitePublishWorkflowMutationDataSchema,vw as SitePublishWorkflowMutationResponseSchema,GS as SitePublishWorkflowPublishDataSchema,Cw as SitePublishWorkflowPublishResponseSchema,zS as SitePublishWorkflowQualityDataSchema,Dw as SitePublishWorkflowQualityResponseSchema,_t as SitePublishWorkflowRecordSchema,ww as SitePublishWorkflowRevisionRequestSchema,DS as SitePublishWorkflowStatusSchema,jS as SitePublishWorkflowStepSchema,at as SiteRecordSchema,Ay as SiteTemplateUpgradeStateIdSchema,ea as SiteVersionIdSchema,Cf as SiteVersionListItemSchema,as as SiteVersionRecordSchema,Le as SiteWorkflowIdSchema,Wd as SiteWorkflowRecordSchema,mR as SiteWorkflowSnapshotResponseSchema,Ws as SiteWorkflowSnapshotSchema,Md as SiteWorkflowStatusSchema,sa as SiteWorkflowTaskRefIdSchema,lR as SiteWorkflowTaskRefResponseSchema,Go as SiteWorkflowTaskRefSchema,rC as SitemapAddBlockInputSchema,Vi as SitemapAnswerSchema,aC as SitemapChangeBlockVariantInputSchema,ub as SitemapDeleteBlockInputSchema,nb as SitemapDraftBlockSchema,sb as SitemapDraftPageSchema,wb as SitemapDraftRecordSchema,cn as SitemapDraftSchema,db as SitemapEditActorSchema,hb as SitemapEditErrorCodeSchema,fb as SitemapEditFailureSchema,_b as SitemapEditOperationSchema,mC as SitemapEditResultSchema,Sb as SitemapEditSuccessSchema,pC as SitemapGenerationInputSchema,Tb as SitemapGenerationOutcomeSchema,kb as SitemapGenerationReasonSchema,lm as SitemapGenerationStageSchema,ke as SitemapIdSchema,bb as SitemapIntentPageSchema,sC as SitemapModelOutputSchema,ab as SitemapModelPageSchema,iC as SitemapMoveBlockInputSchema,eb as SitemapNavigationHrefSchema,xe as SitemapNodeIdSchema,_m as SitemapRecordSchema,tC as SitemapResolverModelOutputSchema,eC as SitemapResolverRequestSchema,nC as SitemapResolverResponseSchema,pb as SitemapResolverTargetsSchema,mm as SitemapRunInputSchema,vt as SitemapSchema,rb as SitemapSourceProvenanceSchema,dC as SitemapStreamEventSchema,LP as SitemapTaskCreateRequestSchema,GP as SitemapTaskCreateResponseSchema,tS as SitemapTaskFailureErrorCodeSchema,zP as SitemapTaskResponseSchema,gb as SitemapUpdateBlockInstructionInputSchema,oC as SitemapUpdateBlockPropsInputSchema,qf as SitemapUserChoiceSchema,At as SkillSelectionSchema,Gf as SkillSelectionSourceSchema,Em as SnapshotContentHashSchema,Se as SnapshotFilePathSchema,x as SnapshotIdSchema,$e as SnapshotRecordSchema,Yc as SnapshotStatusSchema,ji as StartGscAuthDataSchema,yc as StartGscAuthRequestSchema,xc as StartGscAuthResponseSchema,bR as StartSiteBuildRequestSchema,O1 as StartSiteBuildResponseSchema,x_ as StartSiteBuildResultSchema,kw as StartSitePublishWorkflowRequestSchema,OC as StartWorkspaceRunRequestSchema,NC as StartWorkspaceRunResponseSchema,bu as Step2FinalResultDataSourceSchema,Nn as Step2FinalResultRequestSchema,MR as Step2FinalResultResponseSchema,LR as Step2FinalResultSaveResponseSchema,fu as Step2FinalResultSaveResultSchema,$s as Step2FinalResultTypeSchema,xu as Step2FinalResultViewSchema,Vo as Step2FinalScanCardKeySchema,Ys as Step2FinalScanCardSchema,Su as Step2FinalScanResultSchema,Qt as Step2KnowledgeOpaqueIdSchema,G1 as Step2KnowledgeScopeSchema,Qe as Step2PageRoleSchema,FR as Step2PageSelectionRequestSchema,GR as Step2PageSelectionResponseSchema,gu as Step2SiteInitializationCrawlerErrorCodeSchema,uu as Step2SiteInitializationStatusSchema,NR as Step2SiteInitializationTaskResponseSchema,_u as Step2SiteInitializationTaskSchema,Xs as Step3AgentAnalysisSchema,wu as Step3AnalysisFindingSchema,$R as Step3AnalysisJobResponseSchema,Xo as Step3AnalysisJobSchema,$o as Step3AnalysisJobStatusSchema,YR as Step3AnalysisLatestResponseSchema,Ho as Step3AnalysisProgressSchema,Cu as Step3AnalysisResultSchema,HR as Step3AnalysisScheduleResponseSchema,Pu as Step3AnalysisScheduleSchema,XR as Step3AnalysisSseFrameSchema,WR as Step3AnalysisStartRequestSchema,Yo as Step3AnalysisSummarySchema,ku as Step3AnalystSchema,VR as Step3AnalystsResponseSchema,eT as Step4DiagnosisResponseSchema,En as Step5ActiveStrategyKeySchema,gE as Step5CommitStrategyRequestSchema,_E as Step5CommitStrategyResponseSchema,Xl as Step5CommittedVersionSchema,va as Step5DecisionCustomPayloadInputSchema,Vl as Step5DecisionCustomPayloadSchema,yl as Step5EvidenceReferenceSchema,Nl as Step5GenerationStatusSchema,Pa as Step5GeoQuestionSchema,$l as Step5JobStatusSchema,Wl as Step5LegacyDecisionCustomPayloadInputSchema,Bl as Step5LegacyDecisionCustomPayloadSchema,Gl as Step5LegacySeoKeywordInputSchema,Aa as Step5LegacySeoKeywordSchema,Tn as Step5MarketCountrySchema,Rn as Step5MarketTypeSchema,ys as Step5OutputLocaleSchema,pE as Step5RegenerateItemRequestSchema,dE as Step5SaveDecisionRequestSchema,uE as Step5SaveDecisionResponseSchema,Pl as Step5SemrushEmptyReasonCodeSchema,kl as Step5SemrushIntentGroupSchema,Cl as Step5SemrushKeywordCandidateSchema,Dl as Step5SemrushKeywordCandidateSearchDataSchema,iE as Step5SemrushKeywordCandidateSearchRequestSchema,aE as Step5SemrushKeywordCandidateSearchResponseSchema,Tl as Step5SemrushKeywordRecommendationSchema,Ol as Step5SemrushKeywordSelectionDataSchema,jl as Step5SemrushKeywordSelectionItemSchema,oE as Step5SemrushKeywordSelectionRequestSchema,rE as Step5SemrushKeywordSelectionResponseSchema,Rl as Step5SemrushRecommendationSeedSchema,Al as Step5SemrushRecommendationSnapshotSchema,xl as Step5SemrushRecommendationStatusSchema,Ra as Step5SemrushSearchIntentSchema,wl as Step5SemrushSelectionSummarySchema,zl as Step5SemrushSnapshotRefSchema,wa as Step5SeoGeoPlanRowSchema,kn as Step5SeoKeywordSchema,Kl as Step5SeoPayloadV2InputSchema,Es as Step5SeoPayloadV2Schema,yb as Step5SitemapDecisionSchema,Rb as Step5SitemapRunInputSchema,Ib as Step5SitemapSourceSchema,lC as Step5SitemapStartRequestSchema,mE as Step5StartStrategyRequestSchema,lE as Step5StartStrategyResponseSchema,Hl as Step5StrategyDecisionInputSchema,Is as Step5StrategyDecisionSchema,xs as Step5StrategyItemSchema,Ca as Step5StrategyJobSchema,In as Step5StrategyKeySchema,yt as Step5StrategyOptionIdSchema,fs as Step5StrategyOptionSchema,fl as Step5StrategyPlanSchema,Ql as Step5StrategySnapshotDataSchema,SE as Step5StrategySseFrameSchema,Yl as Step5StrategyVersionSnapshotSchema,bl as Step5StructureDetailSchema,xb as Step5StructurePlanPageSchema,Eb as Step5StructurePlanSchema,z_ as Step6AiThemeCandidateSchema,Vn as Step6ColorSeedsSchema,I0 as Step6DesignRecommendationGenerationInputSchema,R0 as Step6DesignRecommendationModelOutputSchema,K_ as Step6DesignRecommendationSchema,b0 as Step6DesignRecommendationsRequestSchema,y0 as Step6DesignRecommendationsResponseSchema,Or as Step6DesignSelectionSchema,jr as Step6GeneratedThemeCardSchema,Uk as SubsiteGlossariesSchema,Vg as SubsiteGlossaryEntrySchema,zn as SubsiteHexColorSchema,t1 as SubsiteMountPathSchema,Fk as SubsitePaletteLocalizationSchema,Hg as SubsitePaletteModeSchema,$g as SubsitePaletteSeedsSchema,qk as SubsiteSiteInfoSchema,Wk as SubsiteSyncDiffComputeRequestSchema,Vk as SubsiteSyncDiffComputeResponseSchema,Zg as SubsiteSyncDiffErrorCodeSchema,Hk as SubsiteSyncDiffErrorResponseSchema,Qk as SubsiteVisibleTextExportRequestSchema,Zk as SubsiteVisibleTextExportResponseSchema,jd as TASK_EXECUTION_STATUSES,qo as TASK_EXECUTION_STATUS_CODES,Pv as TEMPLATE_UPGRADE_LOCK_LOST_ERROR_CODE,ui as THEME_PRESETS,Pr as THEME_PRESET_IDS,No as TaskExecutionStatusSchema,l_ as TemplateUpgradeCasOutcomeSchema,lr as TemplateUpgradeErrorCodeSchema,p_ as TemplateUpgradeOutcomeCountsSchema,c_ as TemplateUpgradeOutcomeSchema,d_ as TemplateUpgradeSnapshotDeletionCandidateSchema,Rt as TemplateUpgradeStateSchema,i_ as TemplateUpgradeStatusSchema,m_ as TemplateUpgradeValidationStageSchema,Oe as TemplateVersionSchema,Iv as TryAcquireTemplateUpgradeLockRequestSchema,Rv as TryAcquireTemplateUpgradeLockResponseSchema,qc as UnsplashDownloadLocationSchema,Uc as UnsplashMediaAssetSchema,XA as UpdateBriefRequestSchema,lv as UpdateBriefResponseSchema,xC as UpdateClarifyArchetypeRequestSchema,hv as UpdateCurrentSnapshotManifestRequestSchema,BE as UpdatePageDirectoryReconcileStateRequestSchema,Pw as UpdateSitePublishWorkflowStepRequestSchema,YA as UpdateSiteRequestSchema,dR as UpdateSiteWorkflowWebsiteRequestSchema,x0 as UpdateStep6DesignSelectionRequestSchema,E0 as UpdateStep6DesignSelectionResponseSchema,hR as UpdateWorkflowTaskStatusRequestSchema,uf as UploadMediaLibraryAssetResponseSchema,hw as UpstreamPromptTemplateCatalogDataSchema,_w as UpstreamPromptTemplateConsumeDataSchema,Bh as UrlListCrawlerTaskCreateRequestSchema,vy as UsageRecordIdSchema,hf as UseUnsplashMediaRequestSchema,Sf as UseUnsplashMediaResponseSchema,rs as UserIdSchema,ZS as VCP_GSC_STATES,Di as VcpGscStateSchema,US as VcpQualityResultSchema,Mi as VisualHintsSchema,Uf as VisualThemeSchema,cR as WORKFLOW_DEFINITIONS_V1,Bs as WORKFLOW_DEFINITION_REGISTRY,vd as WORKFLOW_FLOW_TYPES,Ud as WORKFLOW_MENU_STATES,Cd as WORKFLOW_NODE_CODES,Dd as WORKFLOW_TASK_TYPES,GC as WORKSPACE_WEBSOCKET_CONTRACT,jo as WorkflowClientCapabilitiesSchema,Fo as WorkflowDefinitionVersionSchema,Cn as WorkflowFlowTypeSchema,Bd as WorkflowMenuItemSchema,qd as WorkflowMenuStateSchema,Wt as WorkflowNodeCodeSchema,Oo as WorkflowTaskTypeSchema,ey as WorkspaceClientMessageSchema,xf as WorkspaceDesignApplyRequestSchema,Ef as WorkspaceDesignApplyResponseSchema,$i as WorkspaceDiagnosticSchema,my as WorkspaceDirectEditFileSchema,cy as WorkspaceDirectEditPathSchema,km as WorkspaceDirectEditPostActionSchema,BC as WorkspaceDirectEditRequestSchema,VC as WorkspaceDirectEditResponseSchema,Yi as WorkspaceExecutionDiagnosticsSchema,RC as WorkspaceExecutionPlanSchema,ry as WorkspaceMediaRequestSchema,Zi as WorkspacePlanDependencySchema,fm as WorkspacePlanSummarySchema,Mb as WorkspacePlanTaskKindSchema,Qi as WorkspacePlanTaskSchema,Td as WorkspaceResourceKindSchema,Pd as WorkspaceResourceNavigationSelectionSchema,Do as WorkspaceResourceOperationClientMessageSchema,kd as WorkspaceResourceOperationSummarySchema,wd as WorkspaceResourceOperationTransientInputSchema,os as WorkspaceRunKindSchema,Jb as WorkspaceSelectedComponentSchema,ny as WorkspaceServerMessageSchema,cC as WorkspaceSitemapEditRequestSchema,Zb as WorkspaceSocketDescriptorSchema,_y as WorkspaceSourceFileBinaryResponseSchema,uy as WorkspaceSourceFileKindSchema,wm as WorkspaceSourceFileListItemSchema,HC as WorkspaceSourceFilePathQuerySchema,$C as WorkspaceSourceFileResponseSchema,gy as WorkspaceSourceFileTextResponseSchema,Pm as WorkspaceSourcePathSchema,Cb as WorkspaceSuggestionSchema,hm as WorkspaceSuggestionsSchema,Db as WorkspaceSuggestionsSourceSchema,bm as WorkspaceTaskCountsSchema,FC as WorkspaceWebSocketMessageSchema,qC as WorkspaceWebSocketMessageTypeSchema,Xi as WorkspaceWorkerGroupSchema,Hi as WorkspaceWorkerPhaseSchema,TC as WorkspaceWorkerResultSchema,ht as WorkspaceWorkerStatusSchema,cT as assertDeploymentTransition,RR as assertSiteBuildStatusTransition,IR as assertTaskExecutionStatusTransition,lA as buildE2bBrowserPreviewUrl,T0 as buildStep6FallbackThemeCards,Ti as canonicalizeFormDesignJson,Sw as canonicalizeLauncherPromptTemplateOperation,lo as canonicalizePageSlug,NE as cmsPagePreviewUrlPath,yE as compareTemplateVersions,HT as composeSiteEditRepeatInstanceKey,pP as computeFormDesignOperationFingerprint,us as computeSiteEditCompositionKey,Bp as computeSiteEditSourceIdentityKey,ln as containsSensitiveData,Gp as createSiteEditCommandFailureSchema,po as createSiteEditCommandResultSchema,Ns as createSiteEditCommandSuccessSchema,P0 as defaultStep6Selection,tf as deriveVcpGscState,nf as doesGscPropertyMatchDomain,Xd as findWorkflowDefinition,Yd as findWorkflowDefinitionInRegistry,ci as fontStack,Ah as formDesignOperationFingerprintInput,mT as getDeploymentHappyPathTransitions,oT as getDeploymentTransitionPredecessors,aT as getDeploymentTransitionTargets,Ir as getFontPairing,kr as getMotionPreset,vr as getSiteDesignThemeRadius,hs as getSiteEditSourceDeleteProtectionReason,c0 as getThemePreset,Qd as getWorkflowDefinition,xR as getWorkflowNodeIndex,Ly as hasAnyBusinessFact,zk as hasLockedSeeds,lP as hashAffectedFormDesignFiles,mP as hashCmsFormSchemaProjection,Xn as hashFormDesignJson,cP as hashFormSpec,co as isCanonicalPageSlug,h_ as isCmsMainProductsWithinLimit,OE as isCmsPageSelectable,Ga as isCmsTemplateUrlPath,dx as isConsentGranted,Hu as isDeploymentActiveStatus,rT as isDeploymentTerminalStatus,Gg as isExactEditEngineVersion,Qy as isExternalSiteEditInfrastructureReason,H0 as isFormSpecLocalizableFieldPath,hE as isKnownStep5SseEventName,IT as isMigrationProductsPresetBlockLabel,ET as isMigrationProductsPresetPageTitle,Qx as isNonLatinSiteLocale,RP as isPlatformMaterializedFile,s_ as isReservedSubsiteMountSegment,ap as isSiteEditMaterializationPathTemplate,Mg as isSiteEditRuntimeContainerTag,Ug as isSiteEditRuntimeTextTag,bk as isSiteEditRuntimeVoidElementTag,Wx as isSiteEditSourceDeleteProtectedPath,al as isSiteEditSourceDirectoryPath,ua as isSiteEditSourcePath,_s as isSiteEditTextSourcePath,bP as isSiteStructureKnownFieldPath,fP as isSiteStructureLocalizableFieldPath,Ta as isStep5SeoAllowedIntentCode,ER as isWorkflowTaskTypeForNode,ug as makeSiteEditRepeatInstanceKey,xT as migrationProductsCopyForLocale,vP as normalizeCmsPublicApiBase,Gr as normalizeFormOptionLabelIdentity,mn as normalizeGscDomain,Da as normalizeStep5SeoKeyword,qp as pageSlugToRouteFilePath,LE as parseCmsPageDirectory,uT as parseComponentI18nResourcesJson,sf as parseE2bPreviewProxyDomain,zg as parseExactEditEngineVersion,Ox as parseSiteEditCompositionKey,gg as parseSiteEditRepeatInstanceKey,RI as parseSiteEditSourceIdentityKey,J0 as projectFormSpecToCmsSchema,af as reconcileSitemapNavigation,w_ as resolveFont,v_ as resolveFontDisplayName,Z0 as resolveFormTemplateText,yR as resolvePublishedWorkflowDefinition,Hy as resolveRedisConnectionConfig,Ok as resolveRequestedEditEngineVersion,fa as resolveSelectableSiteLocale,yk as resolveSiteEditRuntimeOperationSummary,Xx as resolveSiteLocaleFromIso6393,Yx as resolveSiteTextDirection,B_ as resolveStep6RadiusId,Nk as resolveSystemCurrentEditEngineVersion,Zd as selectPublishedWorkflowDefinition,bx as selectReferenceVisualImage,eR as siteBuildStatusFromCode,iR as siteBuildStatusToCode,tR as siteDeploymentStatusFromCode,aR as siteDeploymentStatusToCode,L_ as siteFontVariables,nR as siteWorkflowStatusFromCode,oR as siteWorkflowStatusToCode,Wg as splitSubsiteGlossaryEntry,$T as stripSiteEditRepeatInstanceKeys,sR as taskExecutionStatusFromCode,rR as taskExecutionStatusToCode,k0 as toStep6GenerationVisualHints,mo as tryCanonicalizeAsciiPageSlug,Jo as validateComponentI18nResources,$0 as validateFormSpecIdentityTransition};