@vcp-dev/contracts 0.8.3 → 0.8.5

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 vm}from"zod";var G=vm.uuidv7(),os=G,dy=G,uy=G,gy=G,_y=G,hy=G,Sy=G,I=G,_t=G,Ji=G,ke=G,rs=G,x=G,ea=G,V=G,ta=G,ln=G,Fe=G,fy=G,by=G,na=G,Oe=G,sa=G,yy=G,xy=G,Ey=G,st=G,Iy=G,Ry=G,Ty=G;import{z as pn}from"zod";var ia=pn.object({primary_products:pn.string().trim().min(1).max(1e3).optional(),current_markets:pn.string().trim().min(1).max(1e3).optional(),qualifications:pn.string().trim().min(1).max(1e3).optional()}).strict();function wy(t){return Object.values(t).some(n=>typeof n=="string"&&n.trim().length>0)}import{z as Ct}from"zod";import{z as cs}from"zod";var L=t=>cs.object({code:cs.number().int(),data:t,message:cs.string()});var ht=2e3,Cm=Ct.object({note:Ct.string().trim().max(ht),updated_at:Ct.string().min(1)}).strict(),Oy=Ct.object({note:Ct.string().trim().max(ht)}).strict(),Ny=L(Cm.nullable());import{z as Dt}from"zod";var Dm=40,it=Dt.object({protocol:Dt.enum(["phone","form","download","route","external"]),ctaLabel:Dt.string().min(1).max(Dm),ctaTarget:Dt.string().min(1).max(200).optional(),requiresOwnerDetail:Dt.boolean().optional()});var St=["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 Fy(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:jm(t.VCP_REDIS_PORT,56379)}}function jm(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,Om=4e3,ra=Y.enum(["succeeded","degraded","no_changes","failed"]),jt=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"]),Nm=["sandbox_unavailable"];function zy(t){return t!=null&&Nm.includes(t)}var Lm=Y.enum(["pending","delivered","failed"]),Mm=Y.enum(["running","succeeded","degraded","no_changes","failed"]),By=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(Om)}).strict(),ca=Y.object({id:oa,site_id:I,external_run_id:Y.string().min(1),external_thread_id:Y.string().min(1),status:Mm,outcome:ra.nullable(),degraded_reason:jt.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:Lm,created_at:Y.string().min(1),started_at:Y.string().min(1).nullable(),finished_at:Y.string().min(1).nullable()}).strict(),Wy=Y.object({task:ca}).strict(),Vy=Y.object({task:ca}).strict(),$y=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:jt.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(),Hy=Y.object({received:Y.literal(!0)}).strict();import{z as D}from"zod";var ms=D.enum(["text","url","document","image"]),ls=D.enum(["pending","ready","failed"]),Um=D.enum(["pending","ready","failed"]),Fm=D.enum(["product","price","contact","copy","audience","other"]),dn=D.object({fact:D.string().min(1).max(300),kind:Fm,source_id:st,quote:D.string().min(1).max(500),trust:D.enum(["verbatim","ocr"]).default("verbatim")}),qm=D.object({page_type:D.string().min(1).max(40),sections:D.array(D.string().min(1).max(40)).max(12)}),un=D.object({source_id:st,nav_structure:D.array(D.string().min(1).max(30)).max(12),page_patterns:D.array(qm).max(10),tone:D.array(D.string().min(1).max(20)).max(8),screenshot_ref:D.string().optional()}),Gm=D.object({source_id:st,type:ms,status:ls,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()}),gn=D.object({topic:D.string().min(1).max(80),variants:D.array(D.object({value:D.string().min(1).max(300),source_id:st})).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(),zm=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(),Zy=D.discriminatedUnion("type",[Km,zm]),Jy=[".docx",".html",".md",".txt"],ex=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],tx=10*1024*1024,nx=2,sx=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 ix(t){return t===!0||t==="true"}var ax=[".png",".jpg",".jpeg",".webp"],ox=["image/png","image/jpeg","image/webp","application/octet-stream"],rx=8*1024*1024,cx=10,Bm=D.enum(["asset","reference"]),mx=D.object({image_role:Bm,title:D.string().min(1).max(120).optional()}).strict(),lx=D.object({version:D.literal(1),site_id:I,tenant_id:D.string().min(1),user_prompt:D.string(),status:Um,sources:D.array(Gm).max(16),facts:D.array(dn).max(120),reference:un.optional(),conflicts:D.array(gn).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 px(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 hn}from"zod";import{z as X}from"zod";var Ie=X.string().min(1),_n=X.string().min(1).refine(t=>t.startsWith("/")&&!t.includes("?")&&!t.includes("#"),{message:"page_path must start with / and must not contain ? or #"}),Wm=X.object({template_id:Ie,safe_name:X.string().min(1),entry_file:X.string().min(1),kind:X.enum(["default","additional"])}).strict(),_x=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(Wm).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"})}),hx=X.object({page_path:_n,template_id:Ie,instruction:X.string().min(1)}).strict(),ma=t=>[...new Set(t)],Sx=X.object({page_path:_n,template_id:Ie,exit_template_ids:X.array(Ie).default([]).transform(ma)}).strict(),fx=X.object({page_path:_n,template_ids:X.array(Ie).min(1).transform(ma)}).strict(),ps={ok:X.literal(!0),site_id:I,page_path:_n,route_id:X.string().min(1),default_template_id:Ie,snapshot_id:x,route_mode:X.literal("delegated")},bx=X.object({...ps,template_id:Ie,status:X.literal("created")}).strict(),yx=X.object({...ps,promoted_template_id:Ie,deleted_template_ids:X.array(Ie),status:X.literal("promoted")}).strict(),xx=X.object({...ps,deleted_template_ids:X.array(Ie),status:X.literal("cleaned")}).strict(),Ex=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=hn.object({routeId:hn.string().min(1),templateId:Ie.optional()}).strict(),M=hn.object({routeId:hn.string().min(1),effectiveTemplateId:Ie.optional()}).strict();function ds(t){return JSON.stringify([t.routeId,t.effectiveTemplateId??null])}function kx(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 Vm=["design.md","DESIGN.md"],la=["components/site","src/components/site","lib/generated","src/lib/generated","public"],$m=["app/globals.css","src/app/globals.css"],Hm=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],Ym=new Set(Hm),us="source-delete",pa=v.literal(us),pe=v.string().min(1).refine(ua,"Invalid site edit source path"),Xm=v.string().min(1).refine(il,"Invalid site edit source directory path"),vx=v.enum(["text","binary"]),Sn=v.object({composition:M,path:pe,language:v.string().min(1).nullable(),sizeBytes:v.number().int().nonnegative(),contentHash:v.string().min(1).optional()}).strict(),Qm=v.discriminatedUnion("kind",[Sn.extend({kind:v.literal("text"),language:v.string().min(1),readonly:v.boolean().default(!1)}),Sn.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:Xm,children:v.array(da)}),v.object({kind:v.literal("file"),name:v.string().min(1),path:pe,file:Qm}).superRefine((t,n)=>{t.path!==t.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),Zm=v.enum(["max-files","max-depth","max-total-bytes"]),Jm=v.object({reasons:v.array(Zm).min(1),maxFiles:v.number().int().positive(),maxDepth:v.number().int().positive(),maxTotalBytes:v.number().int().positive()}),Cx=v.object({composition:M,nodes:v.array(da),defaultPath:pe.optional(),totalFiles:v.number().int().nonnegative(),truncated:Jm.optional()}).strict(),Dx=v.object({composition:ne}).strict(),jx=v.object({path:pe,composition:ne}).strict(),el=Sn.extend({kind:v.literal("text"),language:v.string().min(1),readonly:v.boolean().default(!1),content:v.string()}),tl=v.enum(["too-large","unsupported-mime","bytes-unavailable"]),nl=Sn.extend({kind:v.literal("binary"),language:v.null(),readonly:v.literal(!0),mimeType:v.string().min(1),contentBase64:v.string().min(1).optional(),previewUnavailableReason:tl.optional()}),Ox=v.discriminatedUnion("kind",[el,nl]),Nx=v.object({key:v.string().min(1),composition:ne}).strict(),sl=v.object({startLine:v.number().int().positive(),startColumn:v.number().int().nonnegative(),endLine:v.number().int().positive(),endColumn:v.number().int().nonnegative()}),Lx=v.object({key:v.string().min(1),composition:M,sourceFile:pe,componentName:v.string().min(1),openingElementRange:sl,structuralPath:v.string().min(1),textPreview:v.string().min(1).optional()}).strict();function ua(t){return!Sa(t)||ha(t)?!1:hs(t)||_a(t)||ga(t)||la.some(n=>t===n||t.startsWith(`${n}/`))}function gs(t){return hs(t)||Ym.has(al(t))}function il(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 _s(t){return ua(t)?hs(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 Mx(t){return _s(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 al(t){let n=t.split("/").at(-1)??t,s=n.lastIndexOf(".");return s>0?n.slice(s).toLowerCase():""}function hs(t){return!t.includes("/")&&Vm.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 ol}from"zod";var Ot=["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"],rl=["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"],cl=[...Ot,...rl],ml=new Set(["ar","fa","he"]),qx=[{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"}],ll={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"},pl=new Set(Ot);function fa(t){return pl.has(t)?t:ll[t]}var dl="en";function Gx(t){let n=t.toLowerCase().split("-",1)[0]??"";return ml.has(n)?"rtl":"ltr"}var ul={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 Kx(t){return ul[t]??dl}var gl=["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"],_l=new Set(gl);function zx(t){return _l.has(t)}var de=ol.enum(cl);import{z as hl}from"zod";var ba=hl.string().uuid();import{z as o}from"zod";var re=o.string().trim().min(1).max(128),Ve=o.string().trim().min(1).max(200),fs=o.string().trim().min(1).max(2e3),bs=o.string().trim().max(200),Nt=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"]),at=["market","persona","product","brand","competition","structure","language","seogeo","content","conversion","risk"],fe=at.length,xn=o.enum(at),En=xn,Ra=["recommended","conservative","focused"],ft=o.enum(Ra),In=o.enum(["single_country","regional_combination","multi_market"]),Rn=o.object({code:o.string().trim().regex(/^[A-Z]{2}$/),name_zh:Ve,name_en:Ve,region:Ve}).strict(),Ss=o.object({id:ft,label:Ve,note:fs,impact:o.string().trim().max(500).nullish(),set_value:o.string().trim().max(500).nullish(),site_locale:de.nullish(),market_type:In.nullish(),markets:o.array(Rn).max(32).optional()}).loose(),Sl=o.object({lead:o.string().trim().min(1).max(500),title:Ve,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."})})}),fl=o.object({source_type:o.enum(["step2","step3"]),source_id:re,field_path:o.string().trim().max(300).nullish()}).strict(),bl=o.enum(["ready","disabled","empty","timeout","rate_limited","quota_exhausted","failed"]),yl=["INFORMATIONAL","NAVIGATIONAL","COMMERCIAL","TRANSACTIONAL"],Ta=o.enum(yl),fn=50,bn=60,ya=7,Yx=["COMMERCIAL","TRANSACTIONAL"],xl=["C","T"];function ka(t){return xl.includes(t)}var El=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(),Il=o.object({keyword:o.string().trim().min(1).max(255),normalized_keyword:o.string().trim().min(1).max(255),intents:o.array(Ta).min(1).max(4),search_volume:o.number().int().min(fn),keyword_difficulty:o.number().min(0).max(bn),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(),Rl=o.object({id:re,intent:Ta,title:Ve,landing_page_type:o.enum(["blog","product","category","landing"]),keywords:o.array(Il).min(1).max(100)}).strict(),Tl=o.enum(["NO_SEEDS","NO_PROVIDER_CANDIDATES","NO_METRIC_ELIGIBLE_CANDIDATES","NO_COMMERCIAL_INTENT_CANDIDATES","NO_FIT_ELIGIBLE_CANDIDATES"]),kl=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:Nt,status:bl,seeds:o.array(El).max(20),intent_groups:o.array(Rl).max(16),selection_summary:kl.optional(),empty_reason_code:Tl.nullish(),error_code:o.string().trim().regex(/^[A-Z0-9_]+$/).max(64).nullish()},Pl=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."})}}),Ea=0,Xx=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(fn),max_keyword_difficulty:o.number().finite().min(0).max(100).default(bn),min_relevance_score:o.literal(Ea).default(Ea)}).strict(),wl=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(),Al=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(wl).max(100),result_count:o.number().int().nonnegative()}).strict(),Qx=o.object({code:o.literal(0),message:o.string(),data:Al}).strict(),Zx=o.object({snapshot_id:o.string().uuid(),selected_keywords:o.array(o.string().trim().min(2).max(160)).min(1).max(50)}).strict(),vl=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(),Cl=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(vl).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:Cl}).strict(),Dl=o.enum(["ok","degraded"]),jl=["category","selection","application","parameter","cost","trust","compliance","delivery"],Ol=o.object({id:re,question:o.string().trim().min(8).max(300).refine(t=>/^[\x20-\x7E]+$/.test(t)),question_type:o.enum(jl),intent_strength:o.enum(["high","medium","low"]),source:o.literal("ai_generation")}).strict(),xs=o.object({key:En,position:o.number().int().min(1).max(fe),category:Ve,title:Ve,summary:fs,rationale:fs,parameter:o.string().trim().max(500).nullish(),options:o.tuple([Ss,Ss,Ss]),plan:Sl.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(fl).min(1).max(8),semrush_recommendations:Pl.nullish(),seo_payload:o.lazy(()=>Es).nullish(),geo_questions:o.array(Ol).max(20).optional(),generation_status:Dl.optional()}).loose().superRefine((t,n)=>{let s=at.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!==Ra[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.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."})}),yn=9,Pa=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(),Nl=2,Ll=1,eE=20,Ml=50,wa=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(),Ul=wa.superRefine((t,n)=>{ka(t.intent_code)||n.addIssue({code:"custom",path:["intent_code"],message:"New legacy SEO keyword selections must use commercial or transactional intent."})}),Tn=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=Ca(t.keyword);t.normalized_keyword!==s&&n.addIssue({code:"custom",path:["normalized_keyword"],message:"normalized_keyword must match the canonical keyword form."})}),Fl=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(Nl),seo_keywords:o.array(Tn).min(Ll).max(Ml),semrush_snapshot_refs:o.array(Fl).max(20).optional()}).strict().superRefine(Ql),ql=Es.superRefine((t,n)=>{t.seo_keywords.forEach((s,a)=>{ka(s.intc)||n.addIssue({code:"custom",path:["seo_keywords",a,"intc"],message:"New SEO keyword selections must use commercial or transactional intent."})})}),Gl=o.object({rows:o.array(Pa).max(100).optional(),seo_keywords:o.array(wa).max(100).optional()}).strict(),Kl=o.object({rows:o.array(Pa).max(100).optional(),seo_keywords:o.array(Ul).max(100).optional()}).strict(),zl=o.union([Es,Gl]),Aa=o.union([ql,Kl]),Bl=o.object({item_key:xn,selected_option_id:ft,note:bs,custom_payload:Aa.optional()}).strict().superRefine((t,n)=>{t.item_key==="seogeo"&&t.custom_payload&&!("schema_version"in t.custom_payload)&&Xl(t.custom_payload,n)}),Is=o.object({item_key:xn,selected_option_id:ft,note:bs,custom_payload:zl.optional(),market_type:In.nullish(),markets:o.array(Rn).max(32).optional(),selected_value:o.unknown().nullable(),accepted_at:o.string().datetime({offset:!0})}).loose(),Wl=o.enum(["running","succeeded","failed"]),Vl=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(),$l=o.object({strategy_version_id:re,site_id:re,source_job_id:re,output_locale:ys.optional(),version:o.number().int().positive(),checksum:Nt,snapshot:Vl,committed_at:o.string().datetime({offset:!0})}).loose(),va=o.object({job_id:re,site_id:re,output_locale:ys.optional(),status:Wl,revision:o.number().int().nonnegative(),items:o.array(xs).max(fe),decisions:o.array(Is).max(fe),output_checksum:Nt.nullish(),error_code:o.string().trim().max(64).nullish(),error_message:o.string().trim().max(500).nullish(),committed_version:$l.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."})}),tE=o.object({force_refresh:o.boolean().optional().default(!1)}).strict(),nE=va.extend({cached:o.boolean()}).strict(),sE=o.object({expected_revision:o.number().int().nonnegative()}).strict(),iE=o.object({expected_revision:o.number().int().nonnegative(),selected_option_id:ft,note:bs,custom_payload:Aa.optional()}).strict(),aE=o.object({revision:o.number().int().positive(),decision:Is}).strict(),oE=o.object({idempotency_key:o.string().trim().min(8).max(128),expected_revision:o.number().int().nonnegative(),decisions:o.array(Bl).length(fe)}).strict().superRefine((t,n)=>{let s=t.decisions.map(a=>a.item_key);new Set(s).size!==at.length&&n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit must contain ${fe} unique decisions.`}),at.forEach(a=>{s.includes(a)||n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit is missing ${a}.`})})}),rE=o.object({strategy_version_id:re,version:o.number().int().positive(),checksum:Nt,next_path:o.string().trim().min(1).max(500)}).strict(),Hl=va.extend({completed:o.number().int().min(0).max(fe),total:o.literal(fe)}).loose(),Yl=["snapshot","strategy_item_start","strategy_item_done","strategy_items_invalidated","strategy_generation_done","failed"];function cE(t){return typeof t=="string"&&Yl.includes(t)}var mE=o.discriminatedUnion("event",[o.object({id:o.number().int().nonnegative(),event:o.literal("snapshot"),data:Hl}).strict(),o.object({id:o.number().int().positive(),event:o.literal("strategy_item_start"),data:o.object({key:xn,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: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:En.optional()}).loose()}).loose()]);function Ia(t){let n=t.trim().toLocaleLowerCase();return n===""||n==="/"?"/":`/${n.replace(/^\/+|\/+$/g,"")}`}function Xl(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=>Ia(i.cells[3])==="/");s.length+(a?0:1)>yn&&n.addIssue({code:"custom",path:["custom_payload","rows"],message:`Initial generation supports at most ${yn} primary pages including home.`}),s.forEach((i,r)=>{/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/.test(Ia(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 Ca(t){return t.normalize("NFKC").trim().replace(/\s+/g," ").toLowerCase()}function Ql(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<fn)&&n.addIssue({code:"custom",path:["seo_keywords",r,"monthly_volume"],message:`Selected SEO keywords require monthly_volume >= ${fn}.`}),(i.keyword_difficulty===null||i.keyword_difficulty>bn)&&n.addIssue({code:"custom",path:["seo_keywords",r,"keyword_difficulty"],message:`Selected SEO keywords require keyword_difficulty <= ${bn}.`}),(i.fit===null||i.fit<ya)&&n.addIssue({code:"custom",path:["seo_keywords",r,"fit"],message:`Selected SEO keywords require fit >= ${ya.toFixed(1)}.`})});let a=new Set((t.semrush_snapshot_refs??[]).flatMap(i=>i.selected_keywords.map(Ca)));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 Zl}from"zod";var De=Zl.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 dE(t,n){let s=De.safeParse(t),a=De.safeParse(n);if(!s.success||!a.success)return null;let i=Da(s.data),r=Da(a.data);for(let c=0;c<3;c+=1){let g=ja(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?ja(BigInt(g),BigInt(j)):E?-1:O?1:Jl(g,j)}return 0}function Da(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 ja(t,n){return t<n?-1:t>n?1:0}function Jl(t,n){return t<n?-1:t>n?1:0}import{z as K}from"zod";import{z as be}from"zod";var Rs=64,ep=512*1024,Ts=4*1024*1024,tp=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function np(t){return tp.test(t)}var Oa=be.string().min(1).refine(np,{message:"Materialization pathTemplate must be a safe relative path."}),sp=be.object({pathTemplate:Oa,content:be.string(),role:be.string().min(1).optional()}).strict(),ip=be.union([be.object({kind:be.literal("default")}).strict(),be.object({kind:be.literal("named"),name:be.string().min(1)}).strict()]),ap=be.object({pathTemplate:Oa,export:ip}).strict(),op=be.array(be.never()).optional(),ot=be.object({instanceBaseName:be.string().min(1),files:be.array(sp).min(1).max(Rs),entry:ap,dataRequirements:op}).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>ep&&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 Na="insertNewComponent",fE={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=K.number().int().positive().refine(Number.isSafeInteger,"Must be a safe positive integer"),La=K.lazy(()=>K.object({id:K.string().uuid(),key:K.string().min(1),name:K.string(),children:K.array(La)}).strict()),Ma=K.object({category_group_key:K.literal(Na),categories:K.array(La)}).strict(),rp=K.object({resource_id:K.string().min(1),name:K.string(),description:K.string().nullable(),thumbnail_url:K.string().nullable(),resolved_version:ks,category_id:K.string().uuid().nullable()}).strict(),Ua=K.object({category_group_key:K.literal(Na),items:K.array(rp),next_cursor:K.string().min(1).nullable()}).strict(),bE=K.object({resource_id:K.string().min(1),resolved_version:ks,anchor_block_id:K.string().min(1),placement:K.enum(["before","after"])}).strict(),yE=K.object({status:K.literal("mock_acknowledged")}).strict(),xE=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"})}),rt=ks,EE=K.object({version:rt}).strict(),Fa=K.object({resource_id:K.string().min(1),resolved_version:rt,revision_id:K.string().uuid().optional(),digest_sha256:K.string().regex(/^[a-f0-9]{64}$/),materialization:ot}).strict();import{z as b}from"zod";import{z as h}from"zod";var za="/",Ba=255,cp=5e3,mp=64;function lp(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 ct=h.string().min(1).max(Ba).refine(lp,"url_path must be a safe site-relative path"),As=h.string().max(Ba),kn=h.preprocess(t=>t===0?!1:t===1?!0:t,h.boolean()),Lt=h.union([h.url(),ct]),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 kE(t){return t.vcp_managed&&t.url!==null&&vs.safeParse(t.page_type).success&&ct.safeParse(t.url_path).success}function qa(t){return t.includes("{")||t.includes("}")}function PE(t){if(!qa(t.url_path))return Ga(t.url_path);if(t.url===null)return null;let n=/^[a-z][a-z0-9+.-]*:\/\//iu.test(t.url)?pp(t.url):t.url;return n===null||qa(n)?null:Ga(n)}function Ga(t){let n=ct.safeParse(t);return n.success?n.data:null}function pp(t){try{return new URL(t).pathname}catch{return null}}var Wa=h.lazy(()=>h.object({cms_page_id:h.number().int().positive(),title:h.string().trim().min(1).max(255),url_path:As,url:Lt.nullable(),page_type:Cs,vcp_managed:kn,children:h.array(Wa)}).strict()),dp=h.object({group_id:h.string().min(1),title:h.string().trim().min(1).max(255),pages:h.array(Wa)}).strict(),Ka=h.object({groups:h.array(dp)}).strict(),Va=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:kn,is_published:kn,url:Lt.nullable(),vcp_managed:kn,children:h.array(Va)})),up=h.object({plugin_id:h.number().int().nonnegative(),slug:h.string(),group_name:h.string().trim().min(1).max(255),pages:h.array(Va)}).passthrough(),gp=h.array(up);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 wE(t){if(!_p(t))return null;let n=Ka.safeParse(t);if(n.success)return n.data;let s=gp.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,pages:i.pages.map($a)}))});return a.success?a.data:null}function _p(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>cp||i.depth>mp)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 hp=h.enum(["invalid_url_path","missing_url","not_vcp_managed","unsupported_page_type"]),Sp=h.enum(["home_page","invalid_url_path","not_selectable","not_vcp_managed","page_has_children","last_selectable_page","cms_unbound","unsupported_page_type"]),Ha=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:ct.nullable(),url:Lt.nullable(),page_type:Cs,vcp_managed:h.boolean(),selectable:h.boolean(),disabled_reason:hp.nullable(),can_delete:h.boolean(),delete_block_reason:Sp.nullable(),has_cms_children:h.boolean(),children:h.array(Ha)}).strict()),Ya=h.object({group_id:h.string().min(1),title:h.string().trim().min(1).max(255),pages:h.array(Ha)}).strict(),AE=h.object({base_snapshot_id:x,expected_url_path:ct}).strict(),fp=h.enum(["succeeded","failed"]),bp=h.object({url_path:ct,phase:h.enum(["ensure","binding","delete"]),code:h.string().min(1),message:h.string().min(1)}).strict(),Ds=h.object({status:fp,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(bp),warnings:h.array(h.string().min(1))}).strict(),yp=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:Lt.nullable(),previous_url:Lt.nullable(),cms_reconcile_result:Ds}).strict(),vE=h.object({code:h.literal(0),message:h.string(),data:yp}).strict(),CE=h.object({snapshot_id:x}).strict(),xp=h.object({snapshot_id:x,warnings:h.array(h.string().min(1)),cms_reconcile_result:Ds}).strict(),DE=h.object({code:h.literal(0),message:h.string(),data:xp}).strict(),jE=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"})}),Ep=vs,Ip=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(),Xa=h.object({url_path:ct,title:h.string().trim().min(1).max(255),kind:Ep,route_file:h.string().min(1),collection_id:h.string().trim().min(1).optional(),seo:Ip.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===za)&&n.addIssue({code:"custom",path:["kind"],message:"The home target must be the only landing_page target."})}),Rp=h.object({complete:h.literal(!0),targets:h.array(Xa)}).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===za).length!==1&&n.addIssue({code:"custom",path:["targets"],message:"A complete page target set must contain exactly one home page."})}),OE=h.discriminatedUnion("complete",[Rp,h.object({complete:h.literal(!1),targets:h.array(Xa),errors:h.array(h.string().min(1)).min(1)}).strict()]),ws=h.string().regex(/^sha256:[0-9a-f]{64}$/),NE=h.object({projection_hash:ws.nullable()}).strict(),LE=h.object({expected_projection_hash:ws.nullable(),projection_hash:ws}).strict();var Qa="insertNewPage",KE={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"},mt=b.enum(["page","pages"]),Tp=b.object({resource_id:b.string().min(1),resource_type:mt,resolved_version:rt,template_page_id:b.string().min(1)}).strict(),Za=b.lazy(()=>b.object({id:b.string().uuid(),key:b.string().min(1),name:b.string(),children:b.array(Za)}).strict()),Ja=b.object({category_group_key:b.literal(Qa),categories:b.array(Za)}).strict(),kp=b.object({resource_id:b.string().min(1),resource_type:mt,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:rt,category_id:b.string().uuid().nullable()}).strict(),eo=b.object({category_group_key:b.literal(Qa),items:b.array(kp),next_cursor:b.string().min(1).nullable()}).strict(),zE=b.object({category_id:b.string().uuid().optional(),include_descendants:b.enum(["true","false"]).optional().transform(t=>t==="true"),limit:b.coerce.number().int().min(1).max(100).optional().default(20),cursor:b.string().min(1).optional()}).strict().superRefine((t,n)=>{t.include_descendants&&!t.category_id&&n.addIssue({code:"custom",message:"include_descendants requires category_id"})}),Mt=rt,Pn=b.string().regex(/^\/[a-z0-9]+(?:-[a-z0-9]+)*$/),BE=b.string().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),Pp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:Pn}).strict(),wp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),source:Tp.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:rt,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:Pn}).strict()}).strict(),Ap=b.object({resource_id:b.string().min(1),resource_type:mt,resolved_version:Mt,pages:b.array(wp).min(1)}).strict().superRefine((t,n)=>{$e(t.pages.map(s=>s.template_page_id),"pages",n),$e(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 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 $e(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 WE=b.object({resource_type:mt,version:Mt,pages:b.array(Pp).min(1)}).strict().superRefine((t,n)=>{js(t,n),$e(t.pages.map(s=>s.template_page_id),"pages",n),$e(t.pages.map(s=>s.final_route),"routes",n)}),vp=b.object({instance_id:b.string().min(1),component_id:b.string().min(1)}).strict(),Cp=b.object({component_id:b.string().min(1),materialization:ot}).strict(),Dp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:Pn,materialization:ot,components:b.array(vp)}).strict(),Os=b.object({resource_id:b.string().min(1),resource_type:mt,resolved_version:Mt,revision_id:b.string().uuid().optional(),digest_sha256:b.string().regex(/^[a-f0-9]{64}$/),components:b.array(Cp),pages:b.array(Dp).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);$e(s,"components",n),$e(t.pages.map(i=>i.template_page_id),"pages",n),$e(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)}}),to=Os,no=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:Pn,route_file_path:b.string().regex(/^app\/[a-z0-9]+(?:-[a-z0-9]+)*\/page\.tsx$/)}).strict(),jp=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(),so=b.object({resource_id:b.string().min(1),resource_type:mt,resolved_version:Mt,pages:b.array(jp).min(1)}).strict().superRefine((t,n)=>{js(t,n),$e(t.pages.map(s=>s.template_page_id),"pages",n)}),VE=b.object({resource_type:mt,version:Mt}).strict(),$E=b.object({draft:Ap}).strict(),io=b.object({groups:b.array(Ya)}).strict(),ao=b.object({candidate:b.record(b.string(),b.unknown())}).strict();var bt="[a-z0-9]+(?:-[a-z0-9]+)*",Ut=new RegExp(`^/(?:${bt}(?:/${bt})*)?$`),oo=["/privacy","/cookie-policy"],Op=oo.map(t=>`app/${t.slice(1)}/page.tsx`);function Np(t){return t.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function ro(t){return typeof t=="string"&&Ut.test(t)}function co(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(Np).filter(c=>c.length>0);if(r.length===0)return null;let _=`/${r.join("/")}`;return ro(_)?_:null}function mo(t){let n=co(t);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function Lp(t){let n=mo(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 Mp=we.object({code:we.string().min(1),message:we.string().min(1)}),ZE=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 Up(t){let n={ok:we.literal(!1),composition:M,error:Mp.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 lo(t){return we.discriminatedUnion("ok",[Ns(t.dataSchema),Up({codeSchema:t.codeSchema,currentSchema:t.currentSchema,diagnosticsSchema:t.diagnosticsSchema,dataSchema:t.failureDataSchema})])}import{z as B}from"zod";var lt=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"})}),Fp=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)}),po=B.object({path:B.string().min(1),content:B.string(),hash:B.string().min(1).optional()}),sI=B.object({composition:M,revision:B.string().min(1),entryCss:po,stylesheets:B.array(po).default([])}).strict(),iI=B.object({composition:ne}).strict(),aI=B.object({key:B.string().min(1),composition:ne}).strict(),uo=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:lt.nullable(),openingElementRange:lt,version:B.object({documentVersion:B.number().int().nonnegative(),contentHash:B.string().min(1)}),diagnostics:B.array(Fp),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"})}),oI=uo,rI=Ns(uo),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 qp}from"zod";var Ms=qp.enum(["src","alt","poster","href","width","height"]);import{z as yt}from"zod";var Ft=yt.object({editingSessionId:yt.string().min(1),lockId:yt.string().min(1),ownerId:yt.string().min(1),leaseAssertion:yt.string().min(1)}).strict(),dI="signed-designer-mutations-v1",uI=yt.object({mutationContext:Ft}).strict();import{z as d}from"zod";import{z as qt}from"zod";var wn="::",Us=qt.object({file:qt.string().min(1),component:qt.string().min(1),structuralPath:qt.string().min(1),key:qt.string().min(1)}).superRefine((t,n)=>{let s=Gp(t.file,t.component,t.structuralPath);t.key!==s&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function Gp(t,n,s){return`${t}${wn}${n}${wn}${s}`}function hI(t){let[n,s,...a]=t.split(wn);return!n||!s||a.length===0?null:{file:n,component:s,structuralPath:a.join(wn)}}var An=d.enum(["VERSION_STALE","RECOVERY_REQUIRED","MULTIPLE_PAGE_RETURNS","INDIRECT_RETURN_ONLY","PAGE_CONTAINER_AMBIGUOUS","NO_SAFE_PAGE_PLACEMENT","MEMBER_NOT_INDEPENDENT","UNSUPPORTED_ROUTE_STRUCTURE","RUNTIME_ANCHOR_UNRESOLVED","ROUTE_RETURN_NOT_FOUND"]),Gt=d.object({code:d.string().min(1),message:d.string().min(1)}).strict(),Kp=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()]),zp=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(),Bp=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(),_o=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:ne}).strict(),Vp=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(),ho=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(),So=d.object({kind:d.literal("page-unit"),composition:ne,placementUnitKey:d.string().min(1)}).strict(),fo=d.object({kind:d.literal("page-unit"),composition:M,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 $p=d.object({status:d.literal("supported"),version:d.number().int().nonnegative(),composition:M,container:Kp,sourceMembers:d.array(zp),businessMembers:d.array(Bp),placementUnits:d.array(Wp),placements:d.array(Vp)}).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())xo(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."})}),Hp=d.object({status:d.literal("unsupported"),version:d.number().int().nonnegative(),composition:M,reason:An,diagnostics:d.array(Gt)}).strict(),Yp=d.discriminatedUnion("status",[$p,Hp]),bo=2,xI="page-composition-v2",yo=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."})}),Xp=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."})}),Qp=d.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),Zp=d.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),Jp=d.discriminatedUnion("kind",[d.object({kind:d.literal("virtual-route-root"),key:d.null(),routeReturn:d.object({sourceIdentity:Us,sourceRange:yo}).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()]),ed=d.object({key:d.string().min(1),kind:Qp,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:yo.nullable(),atomicKind:Zp}).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)}),td=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(),nd=d.enum(["independent","atomic","container"]),sd=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:nd,isIndependent:d.boolean(),isMultiMember:d.boolean()}).strict().superRefine((t,n)=>{go(t.sourceMemberKeys,n,"sourceMemberKeys","source member"),go(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."})}),id=d.enum(["before","after","prepend","append","replace"]),ad=d.enum(["insert-sibling","insert-child","replace-placeholder"]),od=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:id,writeMode:ad}).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}.`})}),rd=d.object({key:d.string().min(1),placementUnitKey:d.string().min(1),runtimeRefs:d.array(Xp).min(1)}).strict(),cd=d.object({schemaVersion:d.literal(bo),status:d.literal("supported"),version:d.number().int().nonnegative(),composition:M,container:Jp,sourceMembers:d.array(ed),businessMembers:d.array(td),placementUnits:d.array(sd),placements:d.array(od),visualAnchors:d.array(rd).optional(),diagnostics:d.array(Gt)}).strict().superRefine((t,n)=>{pd(t,n)}),md=d.object({schemaVersion:d.literal(bo),status:d.literal("unsupported"),version:d.number().int().nonnegative(),composition:M,reason:An,diagnostics:d.array(Gt)}).strict(),ld=d.discriminatedUnion("status",[cd,md]),EI=d.union([ld,Yp]);function go(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 xo(t,n){return ds(t)===ds(n)}function pd(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"),dd(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]));ud(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 vt=_.get(ee);vt&&vt!==O.key&&n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",q],message:`Business member is already assigned to ${vt}.`}),_.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."}),xo(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 dd(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 ud(t,n,s){let a=new Set;for(let[i,r]of t.sourceMembers.entries()){let _=`${r.parentKey??"<root>"}:${r.order}`;if(a.has(_)&&s.addIssue({code:"custom",path:["sourceMembers",i,"order"],message:"Source member order must be unique among siblings."}),a.add(_),r.parentKey===r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member cannot be its own parent."}),r.parentKey!==null){let j=n.get(r.parentKey);j?j.childKeys.includes(r.key)||s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member parentKey must reference a source member."})}for(let[j,E]of r.childKeys.entries()){if(E===r.key){s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source member cannot be its own child."});continue}let O=n.get(E);O?O.parentKey!==r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source child key must reference a source member."})}let c=new Set,g=r;for(;g;){if(c.has(g.key)){s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member graph must be acyclic."});break}c.add(g.key),g=g.parentKey===null?void 0:n.get(g.parentKey)}}}var Kt=p.enum(["update-text","update-array-item","remove-node","insert-child","move-node","set-class-name-source","set-props","apply-style-draft","source-edit","insert-page-resource","delete-page-source"]),Eo=p.lazy(()=>p.union([p.string(),p.number(),p.boolean(),p.null(),p.array(Eo),p.record(p.string(),Eo)])),gd=p.discriminatedUnion("kind",[p.object({kind:p.literal("node"),key:p.string().min(1)}).strict(),So,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()]),_d=p.discriminatedUnion("kind",[p.object({kind:p.literal("node"),key:p.string().min(1)}).strict(),fo,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()]),Ro=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"]),To=p.enum(["hover","active","focus","disabled"]),ko=p.enum(["sm","md","lg","xl","2xl"]),Io=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)}),ho]),hd=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:ot,props:p.record(p.string(),p.never()).optional()}).strict()]),Sd=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:hd,position:p.union([Io,_o])}),p.object({kind:p.literal("move-node"),target:Io,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:lt.nullable(),openingElementRange:lt,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:lt.nullable(),openingElementRange:lt,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)=>{gs(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!==us&&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"}),gs(t.path)||n.addIssue({code:"custom",path:["path"],message:"source-edit delete only accepts allowlisted text source files"});let s=_s(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()]),Po=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"]),wo=p.object({code:Po,message:p.string().min(1),details:p.record(p.string(),p.unknown()).optional()}),Ao=p.object({key:p.string().min(1),instanceIndex:p.number().int().nonnegative().optional(),instanceCount:p.number().int().positive().optional()}),Fs=p.object({id:p.string().min(1),siteId:I,baseSnapshotId:x,composition:ne,kind:Kt,target:gd,documentVersion:p.number().int().nonnegative(),selectionRef:Ao.optional(),mutationContext:Ft.optional(),params:Sd}).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;xd(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"})}),NI=Fs,fd=p.object({kind:p.literal("insert-page-resource"),package_instance_id:p.string().min(1),pages:p.array(no).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)}),bd=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(),yd=p.discriminatedUnion("kind",[fd,bd]),vo=p.object({requestId:p.string().min(1),kind:Kt,composition:M,target:_d,resultVersion:p.number().int().nonnegative(),affectedFiles:p.array(p.string().min(1)).optional(),selectionRef:Ao.optional(),output:yd.optional()}).strict(),qs=vo.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"})}),LI=lo({dataSchema:qs,codeSchema:Po,failureDataSchema:vo.partial()});function xd(t,n){return t.length===n.length&&t.every((s,a)=>s===n[a])}var Ed=Q.enum(["component","page","pages"]),Id=Q.object({resource_kind:Ed,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(),Rd=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)})]),Td=Q.object({base_snapshot_id:Q.string().min(1),operation:Fs,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 kd(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 Co=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:Id,transient_resource_input:Td}).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 _=kd(a.operation).flatMap(g=>g.files),c=_.reduce((g,j)=>g+new TextEncoder().encode(j.content).byteLength,0);if(_.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!==_.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 k}from"zod";var Pd=["with_website","without_website"],vn=k.enum(Pd),Gs=k.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."}),wd=["welcome","website_scan","customer_materials","analysis","diagnosis","strategy","structure_planning","preview_personalization","publishing"],zt=k.enum(wd),Ad=["company_info","website_crawl","website_basic_info_extract","website_metrics_evaluate","intelligent_analysis","strategy_recommendation"],jo=k.enum(Ad),vd=["started","running","succeeded","failed","invalidated"],Oo=k.enum(vd),Cd=["draft","structure_saved","generating","workspace_ready"],Ks=k.enum(Cd),Dd=["not_deployed","deploying","deployed"],zs=k.enum(Dd),jd=["active","completed"],Od=k.enum(jd),Nd=["completed","current","locked"],Ld=k.enum(Nd),No={draft:10,structure_saved:20,generating:30,workspace_ready:40},Lo={not_deployed:10,deploying:20,deployed:30},Mo={active:10,completed:20},Uo={started:10,running:20,succeeded:30,failed:40,invalidated:50};function Cn(t){return new Map(Object.entries(t).map(([n,s])=>[s,n]))}var Md=Cn(No),Ud=Cn(Lo),Fd=Cn(Mo),qd=Cn(Uo);function VI(t){let n=Md.get(t);if(!n)throw new Error(`Unknown site build status code: ${t}`);return n}function $I(t){let n=Ud.get(t);if(!n)throw new Error(`Unknown site deployment status code: ${t}`);return n}function HI(t){let n=Fd.get(t);if(!n)throw new Error(`Unknown site workflow status code: ${t}`);return n}function YI(t){let n=qd.get(t);if(!n)throw new Error(`Unknown task execution status code: ${t}`);return n}function XI(t){return No[t]}function QI(t){return Lo[t]}function ZI(t){return Mo[t]}function JI(t){return Uo[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}]}}],eR=Bs[0].definitions,Fo=k.number().int().min(1),Gd=k.object({id:G,flow_type:vn,definition_version:Fo,node_code:zt,label:k.string().min(1),sort_order:k.number().int().min(1),is_enabled:k.boolean(),state:Ld}),qo=k.object({id:sa,tenant_id:k.string().min(1),site_id:I,workflow_id:Oe,node_code:zt,task_type:jo,external_task_id:k.string().min(1),execution_status:Oo,idempotency_key:k.string().min(1),attempt_no:k.number().int().min(1),superseded_at:k.string().min(1).nullable(),created_at:k.string().min(1),updated_at:k.string().min(1)}),Kd=k.object({id:Oe,tenant_id:k.string().min(1),site_id:I,flow_type:vn,website:Gs.nullable(),definition_version:Fo,current_node_code:zt,status:Od,started_at:k.string().min(1),completed_at:k.string().min(1).nullable(),created_at:k.string().min(1),updated_at:k.string().min(1)}),Ws=k.object({workflow:Kd,menu:k.array(Gd),task_refs:k.array(qo),site:k.object({default_locale:de.optional(),status:Ks,deployment_status:zs,archived_at:k.string().min(1).nullable(),current_sitemap_id:k.string().nullable().optional(),current_sitemap_version:k.number().int().positive().nullable().optional(),confirmed_sitemap_id:k.string().nullable().optional(),confirmed_sitemap_version:k.number().int().positive().nullable().optional(),structure_confirmed_at:k.string().min(1).nullable().optional(),current_snapshot_id:k.string().nullable(),deployed_url:k.string().url().nullable(),cms_site_id:k.string().min(1).nullish()})}),tR=L(Ws),nR=L(qo),Do=k.array(k.string().min(1).max(64)).max(16).optional(),sR=k.discriminatedUnion("flow_type",[k.object({flow_type:k.literal("with_website"),website:Gs,client_capabilities:Do}).strict(),k.object({flow_type:k.literal("without_website"),website:k.null().optional(),client_capabilities:Do}).strict()]),iR=k.object({expected_current_node:k.literal("website_scan"),website:Gs}).strict(),aR=k.object({expected_current_node:zt}).strict(),oR=k.object({expected_current_node:k.literal("publishing")}).strict(),zd=k.object({node_code:zt,task_type:jo,external_task_id:k.string().min(1).max(255),idempotency_key:k.string().min(1).max(255)}),rR=zd.extend({workflow_id:Oe}).strict(),cR=k.object({external_task_id:k.string().min(1).max(255),execution_status:Oo}),Bd=k.object({previous_external_task_id:k.string().min(1).max(255),external_task_id:k.string().min(1).max(255),idempotency_key:k.string().min(1).max(255)}),mR=Bd.extend({workflow_id:Oe}).strict(),Wd=k.object({previous_external_task_id:k.string().min(1).max(255),external_task_id:k.string().min(1).max(255),idempotency_key:k.string().min(1).max(255)}),lR=Wd.extend({workflow_id:Oe}).strict(),pR=k.object({}).strict();function Vd(t,n,s){return t.find(a=>a.definition_version===s)?.definitions[n]}function $d(t,n){return Vd(Bs,t,n)}function Hd(t,n=1){let s=$d(t,n);if(!s)throw new Error(`Unknown workflow definition: ${t} v${n}.`);return s}function Yd(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 dR(t,n){return Yd(Bs,t,n)}function uR(t,n){return Hd(t).findIndex(s=>s.node_code===n)}function gR(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 _R(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 hR(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_]*$/),Xd=y.enum(["text","select","multi_select","tags","category_list","boolean","number"]),Bt=y.string().min(1).max(512).regex(/^\/(?:[^?#]*)$/),Qd=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"}),Zd=y.string().trim().min(1).max(100),Ko=y.array(Zd).max(5).refine(t=>new Set(t.map(n=>n.toLowerCase())).size===t.length,{message:"popular_terms must be unique ignoring case"}),yR=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)}),zo=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(),Jd=y.object({app_slug:Vs}).extend(zo.shape).strict(),$s=y.object({kind:y.literal("product_search_confirmation"),baseline_snapshot_id:x,target_route_id:Bt,applications:y.array(y.object({app_slug:Vs,label:y.string().min(1).max(200),popular_terms:Ko.default([]),current_config:zo.nullable().default(null),affected_routes:y.array(Bt).max(64).default([]),fields:y.array(y.object({field_name:Re,label:y.string().min(1).max(200),value_shape:Xd,option_count:y.number().int().nonnegative().optional(),filter_meta:Qd.optional()}).strict()).max(64)}).strict()).min(1).max(12),current_config:Jd.nullable().optional(),affected_routes:y.array(Bt).min(1).max(64).optional()}).strict(),eu=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"})}),Dn=y.union([eu,y.object({kind:y.literal("product_search_confirmation"),action:y.literal("cancel")}).strict()]),Wt=y.union([y.string().max(255),y.number().finite(),y.boolean()]),tu=y.object({values:y.array(Wt).min(1).max(20).refine(t=>new Set(t.map(n=>`${typeof n}:${String(n)}`)).size===t.length,{message:"values must be unique"})}).strict(),nu=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"}),su=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([tu,nu])).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(Wt).max(20)}).strict()).max(8)}).strict(),Go=y.object({value:Wt,label:y.string().max(200),count:y.number().int().nonnegative()}).strict(),iu=y.union([Wt,y.array(Wt).max(50)]),au=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,iu).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(Go).max(10),selected_values:y.array(Go).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(),xR=y.object({contract_version:y.literal(1),request:su,response:au}).strict();import{z as Vt}from"zod";var ou=["deployment_queued","prepare_source","build_artifact","publish_site","site_released","cleanup_release"],ru=Vt.enum(ou),cu=Vt.enum(["running","succeeded","failed"]),mu=Vt.object({code:ru,status:cu,message:Vt.string().trim().min(1)}).strict(),Bo=Vt.array(mu);import{z as T}from"zod";var lu=T.enum(["pending","running","succeeded","failed"]),pu=T.enum(["TASK_FAILED","WEBSITE_UNREACHABLE"]),du=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:pu.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:lu,error:T.string().nullable(),created_at:T.string().min(1),updated_at:T.string().min(1)}),PR=L(du),Hs=T.enum(["existing_site","new_site"]),Wo=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"])}),jn=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(),uu=T.object({url:T.string().url().max(2048),title:T.string().trim().max(300),words:T.number().int().nonnegative().max(1e7)}).strict(),gu=T.object({site_url:T.string().url().max(2048),scanned_at:T.string().datetime({offset:!0}),reach:T.array(jn).max(64),trust:T.array(jn).max(64),convert:T.array(jn).max(64),safe:T.array(jn).max(64),pages:T.array(uu).max(100)}).strict(),On=T.object({company_task_id:T.string().min(1).max(128),scan_task_id:T.string().min(1).max(128),type:Hs,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:gu.optional()})}),_u=T.object({saved:T.literal(!0),company_task_id:T.string().min(1).max(128),scan_task_id:T.string().min(1).max(128)}),wR=L(_u),hu=T.enum(["snapshot","task"]),Su=On.shape.result.extend({type:Hs,structured_facts:T.unknown().optional()}).extend({company_name:T.string(),primary_product:T.string(),current_market:T.string(),qualifications:T.string()}),fu=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:Hs,data_source:hu,result:Su}),AR=L(fu.nullable());import{z as ue}from"zod";var He=ue.enum(["company","product_service","case_qualification","market","contact_inquiry","privacy_compliance","news_freshness"]),bu=ue.object({ordinal:ue.number().int().min(1).max(1e4),path:ue.string().min(1).max(2048).refine(t=>!Eu(t),{message:"path must be a site-relative path, not an absolute URL"}),last_modified:ue.string().max(64).nullable()}).strict(),DR=ue.object({candidates:ue.array(bu).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}}),yu=ue.object({ordinal:ue.number().int().positive().max(1e4),roles:ue.array(He).min(1).max(7)}).strict(),xu=ue.object({role:He,status:ue.enum(["selected","not_found"]),selected_ordinals:ue.array(ue.number().int().positive().max(1e4)).max(19)}).strict(),jR=ue.object({selections:ue.array(yu).max(19),coverage:ue.array(xu).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 Eu(t){let n=t.toLowerCase();return n.startsWith("http://")||n.startsWith("https://")||t.startsWith("//")}import{z as S}from"zod";var MR=S.object({force_refresh:S.boolean().optional()}),$o=S.enum(["running","succeeded","failed"]),Iu=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)}),Ru=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"])}),Tu=S.object({t:S.string(),d:S.string(),evidence:S.object({from:S.string(),url:S.string().nullable().optional(),value:S.string().nullable().optional()})}),ku=S.enum(["complete","partial","insufficient_data","failed"]),Pu=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:Pu,topics:S.array(S.object({topic_id:S.string().min(1),status:ku,evidence_refs:S.array(S.string())})).length(3),findings:S.array(Tu).max(3),elapsed_ms:S.number().nonnegative(),note:S.string().optional(),error:S.string().optional()}),Ho=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()}),wu=S.object({agents_done:S.boolean(),analysis:S.record(S.string(),Xs),step4_scoring_input:S.unknown().optional(),summary:Ho}),Yo=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:wu.nullable().optional(),error:S.string().nullable().optional()}),UR=L(S.array(Iu)),FR=L(Ru),qR=L(Yo),GR=L(Yo.nullable()),Ge=S.object({id:S.union([S.number().int().nonnegative(),S.string().regex(/^(0|[1-9]\d*)$/u).transform(Number)]).pipe(S.number().int().nonnegative())}),Vo=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()}),KR=S.discriminatedUnion("event",[Ge.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:Vo.optional()})}),Ge.extend({event:S.literal("progress"),data:Vo}),Ge.extend({event:S.literal("preparing_started"),data:S.object({stage:S.literal("baseline")})}),Ge.extend({event:S.literal("preparing_progress"),data:S.object({stage:S.enum(["context","external_evidence"])})}),Ge.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())})}),Ge.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)})}),Ge.extend({event:S.literal("agent_done"),data:Xs}),Ge.extend({event:S.literal("done"),data:S.object({agents_done:S.literal(!0),summary:Ho})}),Ge.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(),Au=C.number().finite().positive(),Qs=["reach","trust","convert","safe"],vu=17,Cu=C.enum(["passed","partial","failed"]),Du=C.object({landing_page_mode:C.enum(["intent_dynamic","static","none"]),ab_test_enabled:C.boolean()}).strict(),ju=C.union([C.boolean(),C.number().finite(),Cu,Du]).nullable(),Ou=C.union([C.boolean(),C.number().finite()]).nullable(),Nu=C.object({competitor_avg:C.number().finite(),score_items:C.record(C.string(),ju),penalty_items:C.record(C.string(),Ou),red_texts:C.array(C.string())}).strict(),Lu=C.record(Zs,Nu),Mu=C.object({key:Zs,score:ye,pass_score:ye,gap:ye}),Uu=C.object({key:C.string(),title:C.string(),is_redline_option:C.boolean().optional(),score:ye,max_score:Au,pass_score:ye,passed:C.boolean(),description:C.string()}),Fu=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(Uu),red_texts:C.array(C.string()),redline_hit:C.boolean().optional()}),qu=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:Lu,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(Mu).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(Fu).length(4)}),created_at:C.string().datetime({offset:!0}),updated_at:C.string().datetime({offset:!0})}).superRefine((t,n)=>{Gu(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)!==vu&&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."})}}),VR=L(qu);function Gu(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 Ye={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(Ye))Object.freeze(t);Object.freeze(Ye);var YR=Object.freeze(St.filter(t=>Ye[t].length>0)),XR=Object.freeze(St.filter(t=>Ye[t].length===0)),Ku=Object.freeze(["preparing_source","building","artifact_ready","deploying","released"]),zu="DEPLOYMENT_TRANSITION_INVALID",Js=class extends Error{constructor(n,s){super(`Invalid deployment transition: ${n} -> ${s}`),this.currentStatus=n,this.nextStatus=s,this.code=zu,this.name="DeploymentTransitionError"}};function QR(t){return Ye[t]}function ZR(t){return St.filter(n=>Ye[n].some(s=>s===t))}function Bu(t){return Ye[t].length>0}function JR(t){return!Bu(t)}function eT(t,n){if(!Ye[t].some(s=>s===n))throw new Js(t,n);return n}function tT(){return Ku}import{z as Wu}from"zod";var iT=".i18n.json",Nn="translation",Xo=new Set(["__proto__","constructor","prototype"]);function Zo(t){if(!Ln(t)||Object.keys(t).length===0)return Xe("I18N_ROOT_INVALID","Component i18n resources must be a non-empty object.",[]);for(let[n,s]of Object.entries(t)){if(Xo.has(n))return Qo([n]);if(!Vu(n))return Xe("I18N_LOCALE_INVALID",`Component i18n locale must be canonical BCP-47: ${n}`,[n]);if(!Ln(s))return Xe("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]!==Nn)return Xe("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let i=s[Nn];if(!Ln(i))return Xe("I18N_RESOURCE_TREE_INVALID",`Component i18n translation namespace for ${n} must be an object.`,[n,Nn]);let r=[{value:i,path:[n,Nn]}];for(;r.length>0;){let _=r.pop();for(let[c,g]of Object.entries(_.value)){let j=[..._.path,c];if(Xo.has(c))return Qo(j);if(typeof g!="string"){if(!Ln(g))return Xe("I18N_RESOURCE_TREE_INVALID","Component i18n resource leaves must be strings.",j);r.push({value:g,path:j})}}}}return{success:!0,data:t}}function aT(t){let n;try{n=JSON.parse(t)}catch{return Xe("I18N_JSON_INVALID","Component i18n resource file must contain valid JSON.",[])}return Zo(n)}var oT=Wu.custom(t=>Zo(t).success,"Invalid component i18n resources.");function Vu(t){try{let n=Intl.getCanonicalLocales(t);return n.length===1&&n[0]===t}catch{return!1}}function Ln(t){if(typeof t!="object"||t===null||Array.isArray(t))return!1;let n=Object.getPrototypeOf(t);return n===Object.prototype||n===null}function Qo(t){return Xe("I18N_RESOURCE_KEY_FORBIDDEN",`Component i18n resource key is forbidden: ${t.at(-1)??""}`,t)}function Xe(t,n,s){return{success:!1,error:{code:t,message:n,path:s}}}var Ke="products",$u=`/${Ke}`,cT=$u,mT=`${Ke} detail`,lT="cms_collection_view",pT="list",dT="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"}},Hu=new Set(Object.values(Ne).map(t=>t.pageTitle)),Yu=new Set(Object.values(Ne).flatMap(t=>[t.blockLabel,t.detailBlockLabel,t.heroBlockLabel]));function uT(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 gT(t){return Hu.has(t.trim())}function _T(t){return Yu.has(t.trim())}import{z as ge}from"zod";var bT=ge.object({key:ge.string().min(1),composition:ne}).strict(),Un=ge.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),Xu=ge.enum(["direct","proxy","upstream","readonly","unsupported"]),Qu=ge.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),Mn=ge.object({mode:Xu,reasonCode:ge.string().min(1).optional()}),Zu=ge.object({kind:Qu,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:Mn.optional(),insertChild:Mn.optional(),move:Mn.optional(),remove:Mn.optional()}).optional(),constraints:ge.array(Zu)}).strict();import{z}from"zod";var kT=z.discriminatedUnion("type",[z.object({type:z.literal("site-edit.document.changed"),siteId:I,snapshotId:x,composition:M,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:M,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:M,result:qs,at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.operation.failed"),siteId:I,composition:M,requestId:z.string().min(1),error:wo,at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.capability.changed"),siteId:I,composition:M,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:M,at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.graph.ready"),siteId:I,composition:M,version:z.number().int().nonnegative(),at:z.string().min(1)}).strict(),z.object({type:z.literal("site-edit.graph.error"),siteId:I,composition:M,message:z.string().min(1),at:z.string().min(1)}).strict()]);import{z as Z}from"zod";var vT="durable-history-v1",qn=Z.object({initiatingComposition:M.optional(),affectedCompositions:Z.array(M)}).strict(),CT=Z.enum(["writable","read-only-recovery","unavailable"]),Ju=Z.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),eg=Z.object({code:Ju,message:Z.string().min(1),occurredAt:Z.iso.datetime().optional()}).strict(),tg=Z.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),Jo={revision:Z.number().int().nonnegative(),undoDepth:Z.number().int().nonnegative(),redoDepth:Z.number().int().nonnegative()},ng=Z.object({mode:Z.literal("writable"),composition:M,...Jo,canUndo:Z.boolean(),canRedo:Z.boolean(),provenance:qn.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."})}),sg=Z.object({mode:Z.literal("read-only-recovery"),composition:M,...Jo,canUndo:Z.literal(!1),canRedo:Z.literal(!1),recoveryDiagnostic:eg,provenance:qn.optional()}).strict(),ig=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:tg,provenance:qn.optional()}).strict(),ag=Z.discriminatedUnion("mode",[ng,sg,ig]),DT=Z.object({composition:M,status:ag,provenance:qn}).strict();import{z as _e}from"zod";var og=_e.string().min(1).refine(t=>!t.startsWith("/")&&!t.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),rg=_e.string().regex(/^sha256:[a-f0-9]{64}$/),cg=_e.object({path:og,operation:_e.enum(["create","update","delete"]),expectedHash:rg.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"})}),mg=_e.object({siteId:I,baseSnapshotId:x,operationId:_e.string().min(1),reason:_e.string().min(1),patches:_e.array(cg).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."})}),MT=mg.transform(t=>({...t,changedRouteIds:[...new Set(t.changedCompositions.map(n=>n.routeId))]}));var ei="::repeat-item#";function lg(t,n){return`${t}${ei}${n}`}function FT(t,n){return n.reduce((s,a)=>lg(s,a),t)}function pg(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 qT(t){return pg(t)?.baseKey??t??null}import{z as m}from"zod";import{z as Ee}from"zod";var dg=Ee.object({placementKey:Ee.string().min(1),placementUnitKey:Ee.string().min(1),relation:Ee.enum(["before","after","prepend","append"])}).strict(),ug=Ee.object({status:Ee.literal("supported"),containerKey:Ee.string().min(1),hasBusinessMembers:Ee.boolean(),placementUnitKeys:Ee.array(Ee.string().min(1)),placements:Ee.array(dg)}).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."})})}),gg=Ee.object({status:Ee.literal("unsupported"),reason:An,diagnostics:Ee.array(Gt)}).strict(),er=Ee.discriminatedUnion("status",[ug,gg]);var _g=m.object({canUpdateText:m.boolean(),canInsertChild:m.boolean(),canMove:m.boolean(),canRemove:m.boolean()}),tr=m.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),hg=m.enum(["cms-field","api-field"]),Sg=m.enum(["text","attribute","richtext","repeat-region","conditional-region","component-prop"]),fg=m.enum(["exact","safe-derived","partial","unknown"]),bg=m.object({file:m.string().min(1),symbol:m.string().min(1).optional(),reason:m.string().min(1)}),yg=m.object({sourceKind:tr,sourceType:hg,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:Sg,targetName:m.string().min(1),confidence:fg,readonly:m.literal(!0),evidence:m.array(bg)}),nr=m.object({hasDynamicData:m.boolean(),bindings:m.array(yg)}),sr=m.object({hasDynamicData:m.boolean(),sourceKinds:m.array(tr),primaryEndpoint:m.string().min(1).optional(),primaryCollection:m.string().min(1).optional(),primaryFieldPath:m.string().min(1).optional()}),xg=m.object({key:m.string().min(1),pageCompositionUnitKey:m.string().min(1).optional(),operationSummary:_g,dynamicDataSummary:sr.optional()}).strict(),tk=m.object({composition:ne}).strict(),nk=m.object({key:m.string().min(1),composition:ne}).strict(),sk=m.object({siteId:I,snapshotId:x,composition:M,version:m.number().int().nonnegative(),entries:m.array(xg),pageComposition:er}).strict(),ti=m.enum(["api-field","cms-field","i18n-message","config-entry"]),ir=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:ir.nullable()}),$t=m.object({key:m.string().min(1),label:m.string().min(1),tag:m.string().min(1)}),ik=m.object({composition:M,key:m.string().min(1),canUpdateText:m.boolean(),canInsertChild:m.boolean(),canMove:m.boolean(),canRemove:m.boolean(),boundaryKind:Un.nullable(),isOpaque:m.boolean()}).strict(),Eg=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()}),Ig=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()}),ar=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()}),Rg=m.object({kind:ar.shape.kind,file:m.string().min(1),displayName:m.string().min(1),canEditHere:m.boolean()}),Ht=m.object({finalSource:ar.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)}))}),Tg=m.object({kind:m.literal("css-style-model"),properties:m.array(m.object({property:Ro,value:m.union([m.string(),m.number(),m.boolean(),m.null()]),resolvedValue:m.union([m.string(),m.number(),m.boolean(),m.null()]).optional(),breakpoint:ko.optional(),state:To.optional(),variants:m.array(m.string().min(1)).optional(),options:m.array(m.union([m.string(),m.number()])).optional(),editable:m.boolean(),diagnostics:m.array(m.object({code:m.string().min(1),message:m.string().min(1)})).optional(),operationBoundary:m.array(Kt).optional()}))}),ak=m.union([m.record(m.string(),m.unknown()),Tg]),or=m.object({kind:m.literal("class-name-source"),className:m.string(),sourceKind:m.enum(["missing","static-attribute","static-expression","dynamic-expression"]),editable:m.boolean(),operationBoundary:m.array(Kt),sourcePath:m.string().min(1).optional(),diagnostics:m.array(m.object({code:m.enum(["missing-class-name","dynamic-binding","non-string-binding"]),message:m.string().min(1)})).optional()}),kg=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:kg,structuralPath:m.string().min(1),textPreview:m.string().min(1).optional()}),ok=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:Eg,effectiveWriteTarget:Ig.optional(),provenanceChain:Ht.optional(),componentSemantic:m.record(m.string(),m.unknown()).optional(),contentModel:m.record(m.string(),m.unknown()).optional(),mediaModel:m.record(m.string(),m.unknown()).optional(),styleSource:or.optional(),conditional:m.record(m.string(),m.unknown()).optional(),dynamicData:nr.optional(),textSegments:m.array(ni),boundaryKind:Un.nullable(),isOpaque:m.boolean(),ancestors:m.array($t),children:m.array($t),siblings:m.array($t)}).strict(),rk=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:Ht.shape.editMode,diagnostics:Ht.shape.diagnostics}).optional(),dynamicDataSummary:sr.optional(),ancestors:m.array($t)}).strict(),ck=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($t),componentName:m.string().min(1),sourceFile:m.string().min(1),capabilities:Fn,provenanceChain:m.object({editMode:Ht.shape.editMode,diagnostics:Ht.shape.diagnostics}).optional(),textSegments:m.array(m.object({index:ni.shape.index,editable:ni.shape.editable,sourceKind:ir.shape.kind.nullable()})),dynamicData:nr.optional(),boundaryKind:Un.nullable()}).strict(),mk=m.object({composition:M,key:m.string().min(1),mediaModel:m.record(m.string(),m.unknown()).optional(),styleSource:or.optional()}).strict();var Pg=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],wg=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],Ag=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],vg=new Set(Pg),Cg=new Set(wg),Dg=new Set(Ag),jg={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function pk(t){return vg.has(ii(t))}function Og(t){return Cg.has(ii(t))}function Ng(t){return Dg.has(ii(t))}function dk(t){let{operationSummary:n}=t;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:t.fallbackMode!=="preview"?{...jg}:{canUpdateText:Ng(t.tagName),canInsertChild:Og(t.tagName),canMove:!1,canRemove:!1}}function ii(t){return t?.trim().toLowerCase()??""}import{z as Lg}from"zod";var Sk=Lg.object({composition:ne,mutationContext:Ft.optional()}).strict();var bk={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."},yk={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."},xk={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},Ek={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var rr="0.8.3",Rk="x-vcp-edit-engine-version",Tk="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"}},Mg=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z]+(?:\.[0-9A-Za-z]+)*)?$/;function Ug(t){return Mg.test(t)}function Fg(t){if(typeof t!="string"||!Ug(t))throw new ai;return t}function kk(t){return t==null?{version:rr,source:"fallback_current"}:{version:Fg(t),source:"explicit"}}function Pk(){return{version:rr,source:"system_current"}}import{z as je}from"zod";var qg=200,Gg=200;function Kg(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 zg=je.string().min(3).max(qg).refine(t=>Kg(t)!==null,{message:'glossary entries must be "source:target" pairs split on a half-width colon, e.g. "\u7C73:Rice"'}),vk=je.array(zg).max(Gg),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()}),Bg=je.enum(["regional","fonts_only"]),Gn=je.string().regex(/^#[0-9a-fA-F]{6}$/,'color must be a "#rrggbb" value'),Wg=je.object({primary:Gn.optional(),accent:Gn.optional(),foreground:Gn.optional(),neutral:Gn.optional()}),Vg=600,Dk=je.object({mode:Bg.default("regional"),seeds:Wg.optional(),note:je.string().min(1).max(Vg).optional()}),jk={mode:"regional"};function Ok(t){return t===void 0?!1:Object.values(t).some(n=>typeof n=="string"&&n.length>0)}import{z as Te}from"zod";var $g=Te.string().trim().min(1),xt=Te.string().uuid(),Hg=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"),cr=Te.object({snapshot_id:xt,object_key:Hg}),Mk=Te.object({tenant_id:$g,parent_site_id:xt,subsite_site_id:xt,base:cr,target:cr}),Uk=Te.object({subsite_site_id:xt,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:xt,target_snapshot_id:xt}),Yg=Te.enum(["SUBSITE_DIFF_REQUEST_INVALID","SUBSITE_DIFF_STORE_NOT_CONFIGURED","SUBSITE_DIFF_MANIFEST_MISSING","SUBSITE_DIFF_MANIFEST_INVALID"]),Fk=Te.object({error_code:Yg,message:Te.string().min(1),side:Te.enum(["base","target"]).optional()});import{z as ce}from"zod";var zk=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()}),Bk=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 Xg}from"zod";var Qg=/^\/[a-z0-9][a-z0-9-]{0,30}$/,Zg=Object.freeze(["api","_next","assets","static","robots.txt","sitemap.xml",".well-known"]),Jg=new Set(Zg);function e_(t){return Jg.has(t)}var $k=Xg.string().regex(Qg).refine(t=>!e_(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 t_=se.enum(["active","paused","blocked"]),mr=se.enum(["typecheck_failed","health_failed","validation_failed"]),n_={status:t_,attempts:se.number().int().nonnegative(),attempted_template_version:De.nullable(),last_error_code:mr.nullable()},Et=se.object(n_).strict(),Kn=se.object({template_id:se.string().trim().min(1),target_template_version:De}).strict(),Qk=Kn,s_=se.discriminatedUnion("action",[se.object({action:se.literal("proceed"),state:Et.extend({status:se.literal("active")})}).strict(),se.object({action:se.literal("skip_not_newer"),state:Et.extend({status:se.literal("active")})}).strict(),se.object({action:se.literal("skip_paused"),state:Et.extend({status:se.literal("paused")})}).strict(),se.object({action:se.literal("skip_blocked"),state:Et.extend({status:se.literal("blocked")})}).strict()]),Zk=Kn,Jk=s_,e1=Kn.extend({error_code:mr}),t1=se.object({state:Et}).strict(),n1=Kn,s1=se.object({state:Et}).strict();import{z as U}from"zod";var i_=744*60*60*1e3,a_=U.enum(["eligible","fast_path","upgraded","skipped","lock_skipped","cas_aborted","validation_failed","blocked","paused"]),o_=U.enum(["typecheck","build","health","validation"]),r_=U.enum(["not_attempted","promoted","aborted"]),c1=U.object({template_id:U.string().trim().min(1).max(128),from_version:De.nullable(),to_version:De,outcome:a_,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:o_.nullable(),cas_outcome:r_.nullable()}).strict(),m1=U.object({recorded:U.literal(!0)}).strict(),lr=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)<=i_,{message:"report window must not exceed 31 days",path:["to"]}),l1=lr,c_=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(),p1=U.object({window:lr,outcome_counts:c_,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(),d1=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(),m_=U.object({site_id:I,snapshot_id:x,status:U.enum(["candidate","deleting"]),created_at:U.iso.datetime()}).strict(),u1=U.object({snapshots:U.array(m_)}).strict();import{z as ze}from"zod";var l_=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"]),p_=ze.object({status:ze.literal("ready"),preview_url:ze.string().url()}).strict(),d_=ze.object({status:ze.literal("failed"),code:l_,message:ze.string().min(1),retryable:ze.boolean()}).strict(),h1=ze.discriminatedUnion("status",[p_,d_]);import{z as oe}from"zod";var E1="build-context.json",I1=2e5,pr=oe.string().regex(/^sha256:[a-f0-9]{64}$/u),dr=1e3;function u_(t){return Array.from(t).length<=dr}var g_=oe.object({kind:oe.enum(["customer_materials","website_scan_diagnosis","committed_strategy"]),digest:pr}).strict(),__=oe.object({schema_version:oe.literal(1),flow_type:vn,sources:oe.array(g_).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."})}),h_=oe.object({schema_version:oe.literal(1),seed:pr.optional(),cms_settings:oe.object({main_products:oe.string().trim().min(1).refine(u_,{message:`main_products must contain at most ${dr} characters`}).optional()}).strict().optional(),provenance:__.optional()}).strict(),S_=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:h_}).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."})}),R1=oe.object({source_snapshot_id:x,source_run_id:V,build_context:S_,page_slugs:oe.array(oe.string().min(1)).optional()}).strict(),T1=oe.object({disposition:oe.enum(["reused","rebased"]),snapshot_id:x}).strict(),f_=oe.object({snapshot:Ws,workspace_run_id:V.nullable()}).strict(),k1=L(f_);import{z as Le}from"zod";import{z as Ae}from"zod";import{z as ie}from"zod";import{z as b_}from"zod";var y_=["company_profile","product_manual","product_list","customer_case","product_help","qualification","industry_material"],ur=b_.enum(y_);var gr=ie.enum(["pending","running","ready","failed","missing"]),x_=ie.object({task_id:ie.string().min(1).max(500),status:gr}).strict(),D1=ie.object({items:ie.array(x_).max(100)}).strict(),Yt=ie.string().trim().min(1).max(255),j1=ie.object({knowledge_site_id:Yt,source_ids:ie.array(Yt).min(1).max(200)}).strict().superRefine((t,n)=>{new Set(t.source_ids).size!==t.source_ids.length&&n.addIssue({code:"custom",message:"Knowledge source IDs must be unique.",path:["source_ids"]})}),E_=ie.object({source_file_id:Yt,category_code:ur.nullable(),category_confirmed:ie.boolean(),status:gr}).strict(),O1=ie.object({ready:ie.boolean(),files:ie.array(E_),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),_r=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:_r,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:_r,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(Yt).max(50)}).strict(),I_=Ae.enum(["draft","submitted"]),ri=oi.extend({id:G,tenant_id:Ae.string().min(1),site_id:I,workflow_id:Oe,status:I_,submitted_at:Ae.string().min(1).nullable(),created_at:Ae.string().min(1),updated_at:Ae.string().min(1)}).strict(),q1=L(ri),G1=L(ri),K1=L(ri.nullable());var $1=On.extend({expected_current_node:Le.literal("website_scan"),type:Le.literal("existing_site"),result:On.shape.result.extend({website:Le.string().url(),scan_cards:Le.partialRecord(Wo,Ys).refine(t=>Object.keys(t).length>0,{message:"At least one recognized scan card is required."})}).strict()}).strict(),H1=Le.object({expected_current_node:Le.literal("customer_materials"),materials:oi}).strict(),Y1=Le.object({expected_current_node:Le.literal("diagnosis")}).strict(),X1=Le.object({expected_current_node:Le.literal("strategy")}).strict();import{z as P}from"zod";var Xt={Inter:{import:"Inter"},"Inter Tight":{import:"Inter_Tight"},"DM Sans":{import:"DM_Sans"},"Source Sans 3":{import:"Source_Sans_3"},"Libre Franklin":{import:"Libre_Franklin"},Montserrat:{import:"Montserrat"},Archivo:{import:"Archivo"},"Space Grotesk":{import:"Space_Grotesk"},Manrope:{import:"Manrope"},"IBM Plex Sans":{import:"IBM_Plex_Sans"},Oswald:{import:"Oswald"},"Roboto Condensed":{import:"Roboto_Condensed"},"Bebas Neue":{import:"Bebas_Neue",weights:["400"]},"Playfair Display":{import:"Playfair_Display"},Lora:{import:"Lora"},Fraunces:{import:"Fraunces"},"Cormorant Garamond":{import:"Cormorant_Garamond"},"JetBrains Mono":{import:"JetBrains_Mono"},"IBM Plex Mono":{import:"IBM_Plex_Mono"},"Noto Sans SC":{import:"Noto_Sans_SC",download:!1},"Noto Serif SC":{import:"Noto_Serif_SC",download:!1}},R_={heading:"Inter",body:"Inter"},hr=Xt.Inter;function zn(t){return t.trim().replace(/\s+/g,"_").toLowerCase()}var yr=(()=>{let t=new Map;for(let[n,s]of Object.entries(Xt))t.set(zn(n),s),t.set(zn(s.import),s);return t})();function T_(t){return typeof t!="string"||t.trim().length===0?hr:yr.get(zn(t))??hr}var k_=(()=>{let t=new Map;for(let[n,s]of Object.entries(Xt))t.set(s.import,n);return t})();function P_(t){if(typeof t!="string"||t.trim().length===0)return"Inter";let n=yr.get(zn(t));return n?k_.get(n.import)??"Inter":"Inter"}var w_=Object.keys(Xt),Sr='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',fr='Georgia, "Times New Roman", serif',br='"SFMono-Regular", Consolas, monospace',A_=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),v_=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(t=>t.toLowerCase())),C_=new Set(["JetBrains Mono","IBM Plex Mono"].map(t=>t.toLowerCase()));function D_(t){let n=t.toLowerCase();return C_.has(n)||n.includes("mono")?"mono":v_.has(n)||n.includes("serif")?"serif":"sans"}function ci(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=>A_.has(g.toLowerCase());if(a&&r(a)){let g=a.toLowerCase();return g.includes("mono")?br:g.includes("serif")?fr:Sr}let _=a;_||(_=r(i)?"":i),_||(_="Inter");let c=D_(_);return c==="mono"?`"${_}", ${br}`:c==="serif"?`"${_}", ${fr}`:`"${_}", ${Sr}`}function j_(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"],xr=[{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 Er(t){let n=xr.find(s=>s.id===t);if(!n)throw new Error(`Unknown font pairing: ${t}`);return n}var li=["compact","comfortable","airy"],Ir=["none","sm","md","lg","xl"],Rr="lg",pi=["subtle","moderate","expressive"],O_=[{id:"subtle",motionLevel:"subtle"},{id:"moderate",motionLevel:"moderate"},{id:"expressive",motionLevel:"expressive"}];function Tr(t){let n=O_.find(s=>s.id===t);if(!n)throw new Error(`Unknown motion preset: ${t}`);return n}var kr=["ocean","forest","clay","violet","graphite","crimson"],Pr=["ai-forest","ai-navy","ai-steel"],wr=/^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 e0(t){let n=ui.find(s=>s.id===t);if(!n)throw new Error(`Unknown theme preset: ${t}`);return n}function Ar(t){return ui.find(n=>n.id===t)?.radius??di.find(n=>n.id===t)?.radius}var gi=P.string().regex(/^#[0-9A-F]{6}$/i),Qt=P.string().trim().min(1).max(500),vr=P.string().datetime({offset:!0}),N_=P.enum(kr),L_=P.enum(Pr),M_=P.string().regex(wr),Zt=P.union([N_,L_,M_]),Jt=P.enum(mi),en=P.enum(pi),tn=P.enum(li),Bn=P.enum(Ir),Cr=300,U_=P.string().trim().min(1).max(Cr),Wn=P.object({primary:gi,accent:gi,foreground:gi}).strict(),F_=P.object({id:Zt,rank:P.number().int().min(1).max(3),name:P.string().trim().min(1).max(120),description:P.string().trim().min(1).max(240),color_seeds:Wn,surface_mode:P.enum(["light","dark"]),radius:Bn,font_pairing_id:Jt,motion_preset_id:en,density:tn,reason:Qt}).strict(),Dr=P.object({name:P.string().trim().min(1).max(120),description:P.string().trim().min(1).max(240),reason:Qt,color_seeds:Wn,surface_mode:P.enum(["light","dark"]),radius:Bn,font_pairing_id:Jt,motion_preset_id:en,density:tn}).strict(),jr=P.object({version:P.number().int().min(1),recommendation_id:P.string().uuid(),theme_preset_id:Zt,color_seeds:Wn,surface_mode:P.enum(["light","dark"]),font_pairing_id:Jt,motion_preset_id:en,density:tn,radius:Bn.optional(),aesthetic_note:U_.optional(),updated_at:vr}).strict(),q_=P.object({id:P.string().uuid(),version:P.number().int().min(1),catalog_version:P.string().trim().min(1).max(80),source:P.object({mode:P.enum(["ai","fallback"]),fallback_reason:P.string().trim().min(1).max(80).nullable()}).strict(),inputs:P.object({industry:P.string().trim().min(1).max(160).optional(),site_language:P.string().trim().min(2).max(35),owner_locale:de.optional(),strategy_version:P.number().int().min(1),input_digest:P.string().regex(/^sha256:[a-f0-9]{64}$/)}).strict(),theme:P.object({recommended_id:Zt,candidate_ids:P.array(Zt).length(3),candidates:P.array(F_).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:P.object({recommended_id:Jt,reason:Qt}).strict(),motion:P.object({recommended_id:en,reason:Qt}).strict(),density:P.object({recommended_id:tn,reason:Qt}).strict(),conversion:it.optional(),generated_at:vr}).strict(),p0=P.object({force_refresh:P.boolean().optional()}).strict(),d0=P.object({request_id:P.string().trim().min(1).max(160),site_id:I,cached:P.boolean(),recommendation:q_,selection:jr}).strict(),u0=P.object({recommendation_id:P.string().uuid(),expected_version:P.number().int().min(1),theme_preset_id:Zt,color_seeds:Wn,surface_mode:P.enum(["light","dark"]),font_pairing_id:Jt,motion_preset_id:en,density:tn,radius:Bn.optional(),aesthetic_note:P.string().trim().max(Cr).optional()}).strict(),g0=P.object({selection:jr}).strict(),_0=P.object({tenant_id:P.string().trim().min(1).max(160),site_id:I,site_language:P.string().trim().min(2).max(35),owner_locale:de,industry:P.string().trim().min(1).max(160).optional(),strategy_version_id:P.string().uuid(),strategy_version:P.number().int().min(1),strategy_checksum:P.string().regex(/^[a-f0-9]{64}$/),strategy_summary:P.array(P.string().trim().min(1).max(500)).min(1).max(fe),reference_image_source_id:st.optional(),owner_whole_site_request:P.string().trim().min(1).max(ht).optional()}).strict(),h0=P.object({theme_candidates:P.array(Dr).length(3),conversion:it.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 S0(){return di.map(t=>Dr.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 G_(t){return t.radius??Ar(t.theme_preset_id)??"lg"}function f0(t){let n=Er(t.font_pairing_id),s=Tr(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:G_(t)}}function b0(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 Qe}from"zod";var I0=Qe.object({site_id:I,site_language:Qe.string().trim().min(2).max(35),business_facts:Qe.array(Qe.string().trim().min(1).max(1e3)).min(1).max(8)}).strict(),K_=Qe.enum(["high","medium","low"]),R0=Qe.object({skill_name:Qe.string().trim().min(1).max(80).nullable(),confidence:K_,reason:Qe.string().trim().min(1).max(240)}).strict();import{z as W}from"zod";var z_=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],Or=W.object({name:W.string().min(1).max(100),type:W.enum(z_),label:W.string().min(1).max(255),required:W.boolean().optional(),options:W.array(W.string()).optional()}),P0=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()}),w0=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(Or).optional(),mode:W.enum(["bind_existing","provision"]),list_mode:W.enum(["page","embedded"]).optional(),fields:W.array(Or).optional(),seed_records:W.array(W.record(W.string(),W.unknown())).optional()});import{z as le}from"zod";var Vn=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number","file"],B_=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number"],W_=le.object({name:le.string().min(1).max(100),type:le.enum(B_),label:le.string().min(1).max(255),required:le.boolean().optional(),options:le.array(le.string()).optional()}),V_=le.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),C0=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:V_,description:le.string().min(1).max(1e3).optional(),fields:le.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"})}),D0=le.object({name:le.string(),label:le.string(),cms_type:le.string(),required:le.boolean()});import{z as l}from"zod";var nn=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,Rt=/^[A-Za-z][A-Za-z0-9_-]{0,127}$/,$n=/^[A-Za-z][A-Za-z0-9_]{0,99}$/,Ur=/^[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.-]+)?$/,Nr=2,Lr=3,Hn=l.string().regex(nn),$_=l.string().regex(nn),Si=l.string().regex(nn),sn=l.string().regex($n),fi=l.string().regex(Ur),H_=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(Rt)}).strict(),l.object({status:l.literal("missing"),form_code:l.string().regex(Rt)}).strict()]),Y_=l.object({value:fi,label:l.string().trim().min(1).max(255)}).strict(),X_=l.object({kind:l.literal("field"),field_name:sn,type:l.enum(Vn),label:l.string().trim().min(1).max(255),required:l.boolean(),span:l.enum(["full","half"]),options:l.array(Y_).max(100),max_files:l.number().int().min(1).max(5).optional()}).strict(),Q_=l.object({kind:l.literal("step-break"),step_id:l.string().regex(nn)}).strict(),Z_=l.discriminatedUnion("kind",[X_,Q_]),J_=l.object({field_name:sn,type:l.enum(Vn),last_label:l.string().max(255)}).strict(),eh=l.object({field_name:sn,value:fi,last_label:l.string().max(255)}).strict(),th=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()]),nh={select:2,radio:2,multiselect:1,DropdownSelection:2,RadioButton:2,Checkbox:1};function Me(t){return t.toLowerCase()}function qr(t,n){return t.trim().toLocaleLowerCase(n)}function It(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 bi(t,n,s,a){let i=nh[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:Hn,binding:H_,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(Z_).min(1).max(200),source:th,retired:l.object({fields:l.array(J_).max(1e3),options:l.array(eh).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<Nr&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`multistep requires runtime version ${Nr}`}),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"}),bi(g.type,g.options.length,["nodes",c,"options"],n),g.type==="file"?t.min_runtime_version<Lr&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`file fields require runtime version ${Lr}`}):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=>qr(j.label,t.content_locale)),["nodes",c,"options"],"option label must be unique within a field",n);he(t.retired.options.map(c=>It(c.field_name,c.value)),["retired","options"],"retired option identity must be unique",n);let _=new Set(t.retired.options.map(c=>It(c.field_name,c.value)));for(let[c,g]of s)for(let[j,E]of g.options.entries())_.has(It(g.field_name,E.value))&&n.addIssue({code:"custom",path:["nodes",c,"options",j,"value"],message:"retired option value cannot be reused"})}),sh=["copy.title","copy.description","copy.submit_button","copy.success_message","copy.error_message","nodes.*.label","nodes.*.options.*.label"],ih=new Set(sh);function F0(t){let n=t.map(s=>typeof s=="number"||/^\d+$/.test(s)?"*":s).join(".");return ih.has(n)}function q0(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=>[It(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(It(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(It(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 ah=l.enum(Ot),Ze=l.object({english:l.string().max(1e3),translations:l.partialRecord(ah,l.string().max(1e3)).optional()}).strict(),oh=l.object({template_option_key:l.string().regex(Ur),label:Ze}).strict(),rh=l.object({template_field_key:l.string().regex($n),type:l.enum(Vn),label:Ze,required:l.boolean(),span:l.enum(["full","half"]),options:l.array(oh).max(100)}).strict(),ch=l.object({template_step_key:l.string().regex($n),after_field_key:l.string().regex($n)}).strict(),G0=["lead-generation","trial-and-samples","quote-and-commerce","appointments-and-visits","resources-and-subscriptions","service-and-channel"],K0=[1,1,1,1,1,1],Gr=l.string().regex(hi),mh=l.object({schema_version:l.literal(1),slug:Gr,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"})}),lh=l.object({schema_version:l.literal(1),slug:l.string().regex(hi),version:l.string().regex(Fr),category:Gr,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(rh).min(1).max(200),step_breaks:l.array(ch).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"}),bi(_.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"})}}),z0=l.object({schema_version:l.literal(1),visibility:l.enum(["internal","public"]),categories:l.array(mh).max(500),templates:l.array(lh).max(500)}).strict().superRefine((t,n)=>{let s=(i,r)=>{let _=Ot.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 B0(t,n){let s=fa(n),a=s?t.translations?.[s]:void 0;return a!==void 0&&a.trim()!==""?a:t.english}var ph=["Text","Summary","Email","Phone","DropdownSelection","RadioButton","Checkbox","Boolean","Date","Num","MultipleFile","SpecificFile"],dh={text:"Text",textarea:"Summary",email:"Email",phone:"Phone",select:"DropdownSelection",radio:"RadioButton",multiselect:"Checkbox",boolean:"Boolean",date:"Date",number:"Num",file:"MultipleFile"},uh=l.object({value:fi,label:l.string().trim().min(1).max(255)}).strict(),gh=l.object({field_name:sn,field_type:l.enum(ph),field_label:l.string().trim().min(1).max(255),is_required:l.boolean(),sort_order:l.number().int().nonnegative(),options:l.array(uh).max(100)}).strict(),Kr=l.object({version:l.literal(1),locale:de,fields:l.array(gh).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())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=>qr(i.label,t.locale)),["fields",s,"options"],"option label must be unique within a field",n)});function W0(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":dh[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}$/),_h=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"])]),hh=l.object({path:_h,content_hash:te.nullable()}).strict(),Sh=l.array(hh).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(nn),field_name:sn.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"})}),fh=l.object({site_id:I,form_definition_id:Hn,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(),zr=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"}),V0=l.object({site_id:I,form_block_id:$_,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:zr,standardization:xi}).strict(),bh=l.object({operation_id:Si,operation_fingerprint:te,site_id:I,form_definition_id:Hn,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:zr,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"})}),yh=["created","validated","binding_reserved","candidate_ready","cms_applied","snapshot_promoted","committed","compensating","recovery_required","failed"],Ei=l.enum(yh),xh=["pending","running","succeeded","failed","recovery_required"],Br=l.enum(xh),Eh=["candidate_abandon","snapshot_reconcile","cms_restore"],Wr=l.enum(Eh),Ih=["FORM_DESIGN_INVALID","FORM_DESIGN_UNSUPPORTED","FORM_DESIGN_STANDARDIZATION_AGENT_REQUIRED","FORM_DESIGN_STANDARDIZATION_UNSUPPORTED","FORM_DESIGN_FEATURE_NOT_ENABLED","FORM_DESIGN_PERMISSION_DENIED","FORM_DESIGN_LOCKED","FORM_DESIGN_CODE_CONFLICT","FORM_DESIGN_CMS_CONFLICT","FORM_DESIGN_CMS_SCHEMA_MISMATCH","FORM_DESIGN_CMS_NOT_FOUND","FORM_DESIGN_BINDING_MISSING","FORM_DESIGN_OPERATION_CONFLICT","FORM_DESIGN_CMS_UNAVAILABLE","FORM_DESIGN_PATCH_FAILED","FORM_DESIGN_COMPENSATION_FAILED","FORM_DESIGN_RECOVERY_REQUIRED"],Ii=l.enum(Ih),Vr=l.enum(["wait","resume","retry_new_operation","manual_recovery","none"]),$r=l.enum(["not_started","pending","succeeded","failed"]),Hr=l.object({operation_id:Si,operation_fingerprint:te,site_id:I,form_definition_id:Hn,stage:Ei,status:Br,base_snapshot_id:x,candidate_snapshot_id:x.nullable(),before_form_code:l.string().regex(Rt).nullable(),materialized_form_code:l.string().regex(Rt).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:Wr.nullable(),last_error_code:Ii.nullable(),retryable:l.boolean(),next_action:Vr,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:Hr}).strict(),$0=Ri,H0=Ri,Y0=l.object({operation_fingerprint:te}).strict(),X0=Ri,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},bh),Q0=l.object({operation:Hr,request:Rh,cms_replace_result:l.unknown().nullable()}).strict(),Th=l.object({stage:Ei.optional(),status:Br.optional(),candidate_snapshot_id:x.nullable().optional(),before_form_code:l.string().regex(Rt).nullable().optional(),materialized_form_code:l.string().regex(Rt).nullable().optional(),materialized_form_spec_hash:te.nullable().optional(),retry_count:l.number().int().nonnegative().optional(),failure_stage:Wr.nullable().optional(),last_error_code:Ii.nullable().optional(),retryable:l.boolean().optional(),next_action:Vr.optional(),preview_refresh_status:$r.optional()}).strict(),Z0=l.object({expected_updated_at:l.string().datetime({offset:!0}),operation:Th,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"}),J0=l.object({code:Ii,message:l.string().trim().min(1).max(500),retryable:l.boolean(),operation_id:Si.optional(),stage:Ei.optional()}).strict();function kh(t){return fh.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 Mr(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 Mr(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(_i(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=>(Mr(r),`${JSON.stringify(r)}:${_i(a[r],n)}`)).join(",")}}`}finally{n.delete(t)}}function Ti(t){return _i(t,new Set)}async function Yn(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 eP(t){return Yn(yi.parse(t))}async function tP(t){return Yn(Kr.parse(t))}async function nP(t){let n=Sh.parse(t).map(s=>({...s})).sort((s,a)=>s.path<a.path?-1:s.path>a.path?1:0);return Yn({version:1,files:n})}async function sP(t){return Yn(kh(t))}import{z as w}from"zod";var oP=["page-seo","root-layout-metadata","nav-items"],rP=w.object({path:w.string(),title:w.string(),description:w.string().optional(),keywords:w.string().optional(),meta_tags_json:w.record(w.string(),w.record(w.string(),w.string())).nullish(),schema_json:w.union([w.record(w.string(),w.unknown()),w.array(w.record(w.string(),w.unknown())),w.string()]).nullish(),breadcrumbs_json:w.array(w.object({name:w.string().optional(),text:w.string().optional(),url:w.string().nullish()})).nullish()}),cP=w.object({metadataBase:w.string().optional(),title:w.union([w.string(),w.object({default:w.string().optional(),template:w.string().optional(),absolute:w.string().optional()})]).optional(),description:w.string().optional(),keywords:w.string().optional(),openGraph:w.object({title:w.string().optional(),description:w.string().optional(),type:w.string().optional(),siteName:w.string().optional(),url:w.string().optional(),locale:w.string().optional(),images:w.array(w.union([w.string(),w.object({url:w.string(),alt:w.string().optional()})])).optional()}).optional(),twitter:w.object({card:w.string().optional(),title:w.string().optional(),description:w.string().optional(),images:w.array(w.string()).optional()}).optional(),alternates:w.object({canonical:w.string().optional()}).optional()}),Yr=()=>w.object({label:w.string(),href:w.string().optional(),targetType:w.enum(["page","anchor","external","email","phone","file","group"]).optional(),role:w.enum(["link","cta"]).optional(),openInNewTab:w.boolean().optional(),nofollow:w.boolean().optional(),description:w.string().optional(),badge:w.string().optional(),iconKey:w.string().optional()}),mP=Yr().extend({children:w.array(Yr()).optional()}),Ph=["title","description","keywords","breadcrumbs_json.*.name","breadcrumbs_json.*.text"],wh=["path","meta_tags_json.**","schema_json.**","breadcrumbs_json.*.url"],Ah=["title","title.default","title.template","title.absolute","description","keywords","openGraph.title","openGraph.description","openGraph.siteName","openGraph.images.*.alt","twitter.title","twitter.description"],vh=["metadataBase","openGraph.type","openGraph.url","openGraph.locale","openGraph.images.*","openGraph.images.*.url","twitter.card","twitter.images.*","alternates.canonical"],Ch=["label","description","badge"],Dh=["href","targetType","role","iconKey"],Xr={"page-seo":{localizable:Ph,machine:wh},"root-layout-metadata":{localizable:Ah,machine:vh},"nav-items":{localizable:Ch,machine:Dh}},Qr="*",Zr="**",jh="children";function Oh(t){return typeof t=="number"||/^\d+$/.test(t)?Qr:t}function Jr(t,n){let s=n.map(Oh);return t!=="nav-items"?s:s.filter(a=>a!==Qr&&a!==jh)}function ec(t,n){let s=t.split(".");for(let a=0;a<s.length;a+=1){if(s[a]===Zr)return!0;if(a>=n.length||s[a]!==n[a])return!1}return s.length===n.length}function Nh(t,n){let s=t.split(".");if(n.length>=s.length)return!1;for(let a=0;a<n.length;a+=1){if(s[a]===Zr)return!0;if(s[a]!==n[a])return!1}return!0}function lP(t,n){let s=Jr(t,n);return s.length===0?!1:Xr[t].localizable.some(a=>ec(a,s))}function pP(t,n){let s=Jr(t,n);if(s.length===0)return!0;let{localizable:a,machine:i}=Xr[t];return[...a,...i].some(r=>ec(r,s)||Nh(r,s))}var gP=["product-search","migration-products","standard-form","form-submission-infrastructure"],Lh=[{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"}],Mh=[{prefix:"components/site/generated/forms/form-",suffix:".tsx",materializer:"standard-form"}],_P=[{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 Uh(t){return t.length>0&&!t.includes("/")&&!t.includes(".")}function hP(t){return Lh.some(n=>n.path===t)?!0:Mh.some(n=>!t.startsWith(n.prefix)||!t.endsWith(n.suffix)?!1:Uh(t.slice(n.prefix.length,t.length-n.suffix.length)))}import{z as Be}from"zod";var Fh=["provisioning","cms_app_created","seeded","ready","failed"],yP=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(Fh),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 tc="/vibe/v1";function EP(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(tc)?a:tc,s.href.replace(/\/+$/,"")}catch{return n}}import{z as u}from"zod";var Xn=u.string().url().refine(aS,{message:"URL must use http or https"}),nc=u.string().trim().pipe(Xn),qh=u.object({task_type:u.literal("home_url"),task_url:nc,planned_num:u.number().int().min(1).max(20).optional()}).strict(),Gh=u.object({task_type:u.literal("url_list"),urls:u.array(Xn).min(1).max(1e4)}).strict(),kP=u.discriminatedUnion("task_type",[qh,Gh]),PP=u.object({page:u.coerce.number().int().positive().default(1),page_size:u.coerce.number().int().min(1).max(20).default(20)}).strict(),wP=u.object({home_url:nc}).strict(),pt=u.string().uuid(),Tt=u.string().uuid(),AP=u.object({task_uuid:pt}).strict(),sc=u.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]),Kh=u.object({task_uuid:pt,status:u.literal("NOT_STARTED"),total:u.literal(0)}).strict(),zh=u.object({task_uuid:pt,status:u.literal("PROCESSING"),total:u.literal(0)}).strict(),vP=u.enum(["no_suitable_page_candidate","page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"]),Bh=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()]),ic=u.array(Bh).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:pt,status:u.literal("SUCCEEDED"),total:u.number().int().positive(),discovery_coverage:ic.optional()}).strict(),Vh=u.enum(["TASK_FAILED","PROVIDER_CAPABILITY_LIMIT","WEBSITE_UNREACHABLE"]),$h=u.object({task_uuid:pt,status:u.literal("FAILED"),total:u.literal(0),error_code:Vh,error_message:u.string().min(1),failure_stage:sc}).strict(),CP=u.discriminatedUnion("status",[Kh,zh,Wh,$h]),Hh=u.object({url:Xn,raw_html:u.string().min(1)}).strict(),DP=u.object({task_uuid:pt,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(Hh).max(20),discovery_coverage:ic.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"})}),jP=u.object({task_code:Tt}).strict(),Yh=u.object({task_code:Tt,status:u.literal("NOT_STARTED")}).strict(),Xh=u.object({task_code:Tt,status:u.literal("PROCESSING")}).strict(),Qh=u.object({task_code:Tt,status:u.literal("SUCCEEDED"),urls:u.array(Xn)}).strict(),Zh=u.literal("SITEMAP_DISCOVERY_FAILED"),Jh=u.object({task_code:Tt,status:u.literal("FAILED"),error_code:Zh,error_message:u.string().min(1)}).strict(),OP=u.discriminatedUnion("status",[Yh,Xh,Qh,Jh]),NP=u.object({company_name:u.string().regex(/\S/u)}).strict(),eS=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(),Qn=u.object({company_uuid:u.string().uuid(),company_info:eS,created_at:u.string().datetime(),updated_at:u.string().datetime()}),tS=Qn.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(),nS=Qn.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(),ac=Qn.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(),oc=Qn.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(),LP=u.discriminatedUnion("status",[ac,oc]),MP=u.discriminatedUnion("status",[tS,nS,ac,oc]),sS=["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"],iS=u.enum(sS),UP=u.object({error_code:iS,error_message:u.string().min(1),failure_stage:sc.optional(),task_uuid:pt.optional(),task_code:Tt.optional()}).strict();function aS(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(cS,{message:"URL must use http or https"}),rc=N.string().min(1).max(512),Zn=N.string().datetime({offset:!0}),cc=N.enum(["scraping","completed","failed","expired"]),GP=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(),KP=N.object({links:N.array(ve).max(1e5)}).strict(),zP=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(),BP=N.object({crawl_id:rc,expires_at:Zn.optional()}).strict(),WP=N.object({status:cc,urls:N.array(ve).max(1e5),next:ve.optional(),expires_at:Zn}).strict(),VP=N.object({url:ve,formats:N.tuple([N.literal("rawHtml")]),only_main_content:N.literal(!1),max_age:N.number().int().nonnegative()}).strict(),$P=N.object({url:ve,raw_html:N.string().min(1),status_code:N.number().int().min(100).max(599).nullable()}).strict(),HP=N.object({urls:N.array(ve).min(1).max(1e4),formats:N.tuple([N.literal("rawHtml")]),ignore_invalid_urls:N.literal(!1),max_age:N.number().int().nonnegative(),max_concurrency:N.number().int().positive().optional()}).strict(),YP=N.object({batch_id:rc,expires_at:Zn.optional()}).strict(),oS=N.object({url:ve,raw_html:N.string().min(1)}).strict(),XP=N.object({status:cc,total:N.number().int().nonnegative(),completed:N.number().int().nonnegative(),pages:N.array(oS).max(1e4),next:ve.optional(),expires_at:Zn}).strict().superRefine((t,n)=>{t.completed>t.total&&n.addIssue({code:"custom",path:["completed"],message:"completed must not exceed total"})}),rS=N.object({url:ve,error_message:N.string().min(1)}).strict(),QP=N.object({errors:N.array(rS).max(1e4),robots_blocked:N.array(ve).max(1e4)}).strict(),ZP=N.object({active:N.number().int().nonnegative(),waiting:N.number().int().nonnegative(),max_concurrency:N.number().int().positive()}).strict();function cS(t){try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as f}from"zod";var lc=f.lazy(()=>on),mS=f.enum(["page","block"]),es=f.enum(["component","page","pages"]),lS=f.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),dt=lS,pc=f.object({requested_locale:dt,resolved_locale:dt,fallback_used:f.boolean()}).strict(),an=f.object({id:f.string().uuid(),key:f.string().min(1),name:f.string().min(1)}).strict(),Jn=an.extend({color:f.string().nullable()}).strict(),sw=f.object({kind:mS,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(),pS=f.object({stable_key:f.string().min(1),type:es,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:an.nullable(),tags:f.array(Jn),page_count:f.number().int().nonnegative(),component_count:f.number().int().nonnegative(),locale:pc}).strict(),iw=f.object({items:f.array(pS),facets:f.object({categories:f.array(an),tags:f.array(Jn)}).strict(),next_cursor:f.string().nullable()}).strict(),aw=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:lc,target_page_id:f.string().min(1).optional()}).strict(),ow=f.object({next_sitemap:lc,applied:f.object({stable_key:f.string().min(1),resolved_version:f.number().int().positive(),template_type:es,page_ids:f.array(f.string().min(1)),block_ids:f.array(f.string().min(1))}).strict(),locale:pc,warnings:f.array(f.string())}).strict(),dc=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(),mc=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(dc).min(1).max(100),thumbnail:f.string().url().optional(),source:f.unknown().optional()}).strict(),dS=f.union([dc,mc,f.object({pages:f.array(mc).min(1).max(50),thumbnail:f.string().url().optional(),source:f.unknown().optional()}).strict()]),uS=f.object({title:f.string().min(1).max(200),description:f.string().min(1).max(1e3),prompt:f.string().min(1).max(8192)}).strict(),gS=f.object({locale:dt,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(),uS)}).strict()}).strict(),rw=f.object({templateId:f.string().uuid(),stableKey:f.string().min(1),type:es,resolvedVersion:f.number().int().positive(),contentSchemaVersion:f.literal(3),structure:dS,requestedLocale:dt,resolvedLocale:dt,fallbackUsed:f.boolean(),contents:f.array(gS).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=_S(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."})}),cw=f.object({items:f.array(f.object({stableKey:f.string().min(1),type:es,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:an.nullable(),tags:f.array(Jn),pageCount:f.number().int().nonnegative(),componentCount:f.number().int().nonnegative(),requestedLocale:dt,resolvedLocale:dt,fallbackUsed:f.boolean()}).strict()),facets:f.object({categories:f.array(an),tags:f.array(Jn)}).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 _S(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 mw(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 $}from"zod";var hS=["pending_dns","active","failed","removing"],SS=$.enum(hS),fS=["serve_site","redirect_301"],bS=$.enum(fS),yS=["traffic","ownership","certificate_delegation"],gc=$.enum(yS),xS=["pending","verified"],ES=$.enum(xS),ki=$.enum(["prepare_configuration","apply_configuration","verify_dns"]),IS=$.enum(["accepted","running","succeeded","failed"]),RS=$.object({code:$.string().min(1),message:$.string().min(1)}).strict(),TS=$.object({purpose:gc,verified:$.boolean(),observedValues:$.array($.string())}).strict(),kS=$.object({ready:$.boolean(),providerReady:$.boolean(),dnsVerified:$.boolean(),records:$.array(TS)}).strict(),PS=$.object({purpose:gc,type:$.string().min(1),name:$.string().min(1),value:$.string().min(1),verificationStatus:ES}).strict(),uc=$.object({id:$.string().min(1),hostname:$.string().min(1),isPrimary:$.boolean(),routingMode:bS,observedStatus:SS,lastVerifiedAt:$.string().datetime().nullable(),dnsRecords:$.array(PS)}).strict().superRefine((t,n)=>{wS(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"})}),_c=$.object({primaryDomain:uc.nullable(),redirectDomains:$.array(uc)}).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=$.object({id:$.string().min(1),type:ki,status:IS,error:RS.nullable(),result:kS.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 wS(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 rn}from"zod";import{z as R}from"zod";var AS=R.enum(["active","completed","canceled"]),vS=R.enum(["quality","domain","gsc","publish"]),hc=R.enum(["pending","running","succeeded","failed"]),Sc=R.enum(["pending","running","completed"]),CS=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:Sc,result_text:R.string()}).strict(),DS=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:Sc,problem_group_count:R.number().int().nonnegative(),groups:R.array(CS)}).strict(),jS=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:hc,error_info:R.record(R.string(),R.unknown()).nullable(),created_at:R.string().min(1),updated_at:R.string().min(1)}).strict(),OS=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(DS)}).strict()]),NS=R.object({quality_info:jS,quality_detail:OS}).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"]})}),ut=R.object({id:na,tenant_id:R.string().min(1),site_id:I,status:AS,current_step:vS,quality_task_code:R.string().uuid().nullable(),quality_task_status:hc,publish_deployment_id:Fe.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"})}),fw=R.object({}).strict(),bw=R.object({expected_revision:R.number().int().nonnegative(),current_step:R.enum(["domain","gsc","publish"]),skip_domain_binding:R.boolean().optional()}).strict(),yw=R.object({expected_revision:R.number().int().nonnegative()}).strict(),LS=R.object({workflow:ut.nullable(),can_cancel:R.boolean()}).strict(),xw=L(LS).strict(),MS=R.object({workflow:ut,can_cancel:R.boolean()}).strict(),Ew=L(MS).strict(),US=R.object({workflow:ut,deployment:R.lazy(()=>Je)}).strict(),Iw=L(US).strict(),FS=R.object({workflow:ut,can_cancel:R.boolean(),quality_result:NS.optional(),message:R.string().min(1).optional()}).strict(),Rw=L(FS).strict();var qS=rn.object({hostname:rn.string().min(1),expected_revision:rn.number().int().nonnegative()}).strict(),fc=rn.object({workflow:ut,operation:Pi}).strict(),GS=L(fc).strict(),wi=rn.object({workflow:ut,operation:Pi.nullable()}).strict(),KS=L(wi).strict(),zS=wi,BS=L(zS).strict(),vw=L(_c).strict(),Cw=qS,Dw=fc,jw=GS,Ow=wi,Nw=KS,Lw=BS;import{z as Pe}from"zod";var WS=["started","success","failed","canceled"],Ai=Pe.enum(WS),VS=["inactive","pending_binding","active"],vi=Pe.enum(VS),$S=["domain","url_prefix"],Ci=Pe.enum($S),HS=["not_connected","authorizing","matching_property","ready","failed","canceled","domain_mismatch"],Di=Pe.enum(HS),Ue=Pe.string().nullable(),bc=Pe.object({}).strict(),ji=Pe.object({authorize_url:Pe.string().url(),custom_domain:Ue}).strict(),yc=L(ji),YS=Pe.object({auth_status:Ai,binding_status:vi,credential_connected:Pe.boolean(),custom_domain:Ue,gsc_site_url:Ue,property_type:Ci.nullable(),auth_error_code:Ue,auth_error_message:Ue}).strict(),xc=Pe.object({auth_status:Ai,binding_status:vi,credential_connected:Pe.boolean(),custom_domain:Ue,gsc_site_url:Ue,property_type:Ci.nullable(),auth_error_code:Ue,auth_error_message:Ue,current_domain:Ue,state:Di,ready:Pe.boolean()}).strict().superRefine((t,n)=>{let s=QS(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`})}),XS=L(xc);function cn(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 QS(t,n){let s=t.gsc_site_url?.trim()??"",a=cn(t.custom_domain),i=cn(n??("current_domain"in t?t.current_domain:void 0)),r=a.length>0&&i.length>0&&a===i,_=ZS(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 ZS(t,n,s){let a=t?.trim()??"",i=cn(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=cn(_);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:cn(r.hostname)===i}catch{return!1}}var qw=bc,Gw=ji,Kw=yc,zw=Di,Bw=Ai,Ww=vi,Vw=Ci,$w=Di,Hw=bc,Yw=ji,Xw=yc,Qw=YS,Zw=xc,Jw=XS;var Ec=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,Ic="VCP_E2B_PREVIEW_PROXY_DOMAIN must be a valid hostname.";function JS(t){let n=t?.trim().toLowerCase()??"";if(!n)return null;if(n.length>253||!n.includes(".")||!n.split(".").every(s=>Ec.test(s)))throw new Error(Ic);return n}function tA(t){let n=JS(t.proxyDomain);if(!n)return null;let s=t.sandboxId.trim();if(!Ec.test(s))throw new Error("sandboxId must be a valid DNS label.");if(`${s}.${n}`.length>253)throw new Error(Ic);return`https://${s}.${n}/`}function ef(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:Rc(n.primaryLinks,t,a,r,_,i,"showInHeader"),footerLinks:Rc(n.footerLinks,t,a,r,_,i,"showInFooter")}}function Rc(t,n,s,a,i,r,_){let c=new Set,g=[];for(let[F,q]of t.entries()){let ee=tf(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:Tc(q,ae,r)}});continue}if(!ae){g.push({kind:"independent",link:q});continue}if(!ae.navigation[_])continue;c.add(ae.slug);let vt=ee===ae.slug?q.href:nf(q.href,ae.slug);g.push({kind:"page",page:ae,link:{...q,label:Tc(q,ae,r),href:vt},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 Tc(t,n,s){let a=s.get(n.id);return t.label===(a?.title??n.title)?n.title:t.label}function tf(t){if(!t.startsWith("/")||t.startsWith("//"))return null;let n=t.search(/[?#]/u);return n===-1?t:t.slice(0,n)}function nf(t,n){let s=t.search(/[?#]/u);return s===-1?n:`${n}${t.slice(s)}`}import{z as A}from"zod";var kc=20*1024*1024,sf=kc,Pc=["jpg","jpeg","png","gif","webp","bmp"],wc=["mp4","avi","mov","webm","mkv"],Ac=["mp3","wav","aac","flac","ogg","wma","m4a"],vc=["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","md","csv"],Cc=[...vc,"zip","rar","json","xmind","psd","ai","fig","sketch"],af=[...Pc,...wc,...Ac,...Cc],Dc=["image/jpeg","image/png","image/gif","image/webp","image/bmp"],jc=["video/mp4","video/x-msvideo","video/quicktime","video/webm","video/x-matroska"],Oc=["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"],of=[...Dc,...jc,...Oc],Nc=A.enum(["image","video","audio","file"]),Lc=A.enum(["external","ai_generated","unsplash"]),Oi=A.object({resource_id:A.string().min(1),name:A.string().min(1).max(255),url:A.string().url(),thumbnail_url:A.union([A.string().url(),A.literal("")]),mime_type:A.string().trim().min(3).max(127),size:A.number().int().nonnegative(),width:A.number().int().positive().nullable(),height:A.number().int().positive().nullable(),source:Lc,created_at:A.string().min(1).nullable()}),rf=A.object({page:A.coerce.number().int().min(1).default(1),page_size:A.coerce.number().int().min(1).max(100).default(24),keyword:A.string().trim().max(100).optional(),file_type:Nc.default("image")}),cf=A.object({code:A.literal(0),message:A.string(),data:A.object({items:A.array(Oi),page:A.number().int().min(1),page_size:A.number().int().min(1),total:A.number().int().nonnegative()})}),mf=A.object({code:A.literal(0),message:A.string(),data:Oi}),Mc=A.object({provider_id:A.string().min(1),url:A.string().url(),thumbnail_url:A.string().url(),width:A.number().int().positive(),height:A.number().int().positive(),alt:A.string(),photographer_name:A.string().min(1),photographer_url:A.string().url(),photo_url:A.string().url(),download_location:A.string().url(),dominant_color:A.string().nullable()}),lf=A.object({query:A.string().trim().min(1).max(100),page:A.coerce.number().int().min(1).default(1),page_size:A.coerce.number().int().min(1).max(30).default(18),orientation:A.enum(["landscape","portrait","squarish"]).optional()}),pf=A.object({code:A.literal(0),message:A.string(),data:A.object({items:A.array(Mc),page:A.number().int().min(1),page_size:A.number().int().min(1),total:A.number().int().nonnegative(),total_pages:A.number().int().nonnegative()})}),Uc=A.string().url().refine(gf,{message:"download_location must be an official Unsplash download URL"}),df=A.object({download_location:Uc}),uf=A.object({code:A.literal(0),message:A.string(),data:A.object({reported:A.boolean()})});function gf(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 _f=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"}),hf=Ce.object({ok:Ce.literal(!0),design_plan_version:Ce.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"]),Sf=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})}),ff=e.enum(["text-options","motion-slider","positioning"]),Ui=e.enum(["none","subtle","moderate","expressive"]),bf=e.enum(["compact","comfortable","airy","editorial"]),yf=Ui,zc=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()}),xf=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:it.optional()}),Ef=e.object({id:e.string(),type:ff,question:e.string(),tag:e.string(),aiThinking:e.string(),options:e.array(xf),source:e.enum(["ai-detected","always-ask"]),sourceDetail:e.string(),positioning:Sf.optional()}),Fi=e.object({questions:e.array(Ef).min(1).max(6)}),vA=e.object({tenant_id:e.string().min(1),site_id:I,brief_id:_t,brief:e.string().min(20).max(1e3),site_default_locale:de.optional(),owner_locale:de.optional(),input_context:e.object({facts:e.array(dn).max(120),conflicts:e.array(gn).max(20),reference:un.optional(),sources:e.array(e.object({type:ms,title:e.string().max(120).optional(),status:ls})).max(16).optional()}).optional()}),Bc=e.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),CA=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(zc).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:Bc.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)})]),DA="SITE_PLANNING_INPUT_FROZEN",jA="SITE_PLANNING_LOCKED",OA="SITE_STRUCTURE_CONFIRMATION_REQUIRED",NA="SITE_STRUCTURE_CONFIRMATION_STALE",LA=e.object({tenant_id:e.string().min(1),owner_user_id:os,name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),MA=e.object({name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),UA=e.object({name:e.string().min(1).max(120)}),FA=e.object({name:e.string().min(1).max(120),default_locale:de.optional()}),qA=e.object({body:e.string().min(20).max(1e3)}),GA=e.object({body:e.string().min(20).max(1e3)}),qi=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"}),KA=e.object({tenant_id:e.string().min(1),site_id:I.optional(),site_url:qi,site_name:e.string().trim().min(1).max(255).optional()}),zA=L(Ma),BA=L(Ua),WA=L(Fa),VA=L(Ja),$A=L(eo),HA=L(to),YA=L(so),XA=L(io),QA=L(ao),ZA=L(e.object({site_id:I,site_url:qi})),nt=e.object({id:I,tenant_id:e.string().min(1),owner_user_id:os.nullable(),name:e.string().min(1),slug:e.string().min(1),status:Ks,deployment_status:zs,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:de,owner_locale:de.optional(),cms_site_id:ba.nullable().optional(),cms_site_url:qi.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:_t,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)}),JA=e.object({site:nt,brief:Gi,next_step:e.literal("clarify")}),ev=e.object({site:nt,brief:Gi}),tv=e.object({brief:Gi}),If=e.enum(["queued","running","succeeded","failed","cancelled"]),Wc=e.enum(["clarify","sitemap","workspace"]),Vc=e.enum(["clarify","sitemap","initial_generation","iteration"]),$c=e.enum(["clarify","sitemap","workspace","summarize"]),tt=e.object({id:V,tenant_id:e.string().min(1),site_id:I,agent_type:Wc,run_kind:Vc,status:If,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)}),nv=e.object({run_id:V.optional(),site_id:I,agent_type:Wc,run_kind:Vc.optional(),model_route:$c,input:e.record(e.string(),e.unknown()).optional()}).superRefine((t,n)=>{mn(t.input)&&n.addIssue({code:"custom",path:["input"],message:"Agent run input must not contain secrets"})}),sv=e.object({agent_run:tt,next_step:e.literal("stream_events")}),Hc=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:Hc,created_at:e.string().min(1)}),iv=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()}),av=e.object({site:nt,snapshot:We,next_step:e.literal("workspace")}),ov=e.object({expected_manifest_hash:We.shape.manifest_hash,manifest_hash:We.shape.manifest_hash,object_key:We.shape.object_key}).strict(),rv=e.union([e.object({base_snapshot_id:x.nullable(),source_run_id:V.optional()}).strict(),e.object({skip_base_check:e.literal(!0)}).strict()]),Rf=e.object({site:nt,snapshot:We,next_step:e.literal("workspace")}),cv=e.object({snapshot:We}),mv=e.object({status:e.literal("deleting"),snapshot_id:x,object_key:e.string().min(1)}),lv=e.object({status:e.literal("deleted"),snapshot_id:x}),is=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)}),Tf=is.extend({reason:We.shape.reason,status:Hc}),pv=e.object({accepted_commit:e.string().min(1),source_run_id:V.optional()}),dv=e.object({site_version:is,next_step:e.literal("workspace")}),uv=e.object({owner_id:e.string().min(1)}).strict(),gv=e.discriminatedUnion("acquired",[e.object({acquired:e.literal(!0)}).strict(),e.object({acquired:e.literal(!1)}).strict()]),_v=e.object({owner_id:e.string().min(1)}).strict(),hv=e.object({released:e.literal(!0)}).strict(),Sv="TEMPLATE_UPGRADE_LOCK_LOST",fv=e.object({base_snapshot_id:x,accepted_commit:is.shape.accepted_commit,owner_id:e.string().min(1)}).strict(),bv=Rf.strict(),yv=e.object({site_versions:e.array(Tf)}),xv=e.object({site:nt,snapshot:We,site_version:is,next_step:e.literal("workspace")}),Ev=e.object({snapshot_id:x,force_rehydrate:e.boolean().optional()}),kf=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()})]),Iv=e.object({tenant_id:e.string().min(1),site_id:I,snapshot_id:x}).strict(),Rv=kf,Ki=e.enum(St),Yc=e.enum(["quality_check","publish"]),Je=e.object({id:Fe,tenant_id:e.string().min(1),site_id:I,snapshot_id:x,type:Yc.default("publish"),version:e.number().int().positive(),status:Ki,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)}),Tv=e.object({tenant_id:e.string().min(1),site_id:I,expected_snapshot_id:x}).strict(),kv=e.object({deployment:Je}),Pv=e.object({tenant_id:e.string().min(1),site_id:I,deployment_id:Fe}).strict(),wv=e.object({deployment:Je}),Av=e.object({}).strict(),vv=e.object({snapshot_id:x.optional()}).strict(),Pf=e.object({deployment:Je}),Cv=L(Pf),Dv=e.object({deployment:Je.nullable()}),jv=e.object({deployment:Je}),Fc=e.object({id:Fe,type:Yc.default("publish"),status:Ki,url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable()}),wf=e.object({current:Fc.nullable(),latest_released:Fc.nullable()}),Ov=L(wf),Af=e.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),kt=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)}),ts=e.object({deployment:Je,steps:Bo.default([])}),Nv=e.discriminatedUnion("type",[kt.extend({type:e.literal("deployment.snapshot"),payload:ts}),kt.extend({type:e.literal("deployment.status.changed"),payload:ts}),kt.extend({type:e.literal("deployment.finished"),payload:ts}),kt.extend({type:e.literal("deployment.failed"),payload:ts}),kt.extend({type:e.literal("deployment.realtime.recovered"),payload:e.object({action:e.literal("refresh")})}),kt.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})})]),Lv=e.object({tenant_id:e.string().min(1),site_id:I,deployment_id:Fe,status:Ki,updated_at:e.string().min(1)}),vf="vcp:deployments",Mv={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:vf,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...Af.options]},Cf=e.object({error:e.object({code:e.string().min(1),message:e.string().min(1),details:e.unknown().optional(),request_id:e.string().min(1).optional(),retryable:e.boolean().default(!1)})}),Uv=e.object({error:Cf.shape.error.extend({code:e.literal("AGENT_RUN_IN_FLIGHT"),details:e.object({code:e.literal("AGENT_RUN_IN_FLIGHT"),message:e.string().min(1),agent_run:tt})})}),Fv=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({})}),Df=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()}),jf=e.object({question:e.string().min(1),answer:e.string().min(1)}),qv=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)}),Gv=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()}),Of=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()}),Kv=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:Of.optional()}),Nf=e.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),Pt=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:Nf.default("system_recommended")}),H=e.string().min(1).max(2e3),qc=e.string().min(1).max(120),Xc=e.object({visualDirection:H,brandFeeling:H,paletteIntent:H,typographyIntent:H,density:bf,motionLevel:yf,motionPreset:e.enum(["subtle","moderate","expressive"]).optional(),mediaStrategy:H,compositionRules:e.array(H).max(20),avoidPatterns:e.array(H).max(20),fonts:e.object({heading:e.string().min(1),body:e.string().min(1)}).optional(),colorSeeds:e.object({primary:e.string().min(1).max(40),accent:e.string().min(1).max(40),foreground:e.string().min(1).max(40).optional(),neutral:e.string().min(1).max(40).optional(),supporting:e.array(e.string().min(1).max(40)).max(4).optional()}).optional(),surfaceMode:e.enum(["light","dark"]).optional(),radius:e.enum(["none","sm","md","lg","xl"]).optional(),imagePalette:e.object({background:e.string().min(1).max(40).optional(),foreground:e.string().min(1).max(40).optional(),card:e.string().min(1).max(40).optional(),muted:e.string().min(1).max(40).optional(),border:e.string().min(1).max(40).optional()}).optional()}),zi=160,Qc=e.object({routeGoal:H,narrativeArc:H,firstViewportIntent:H,visualContinuity:H,sectionRhythm:H,avoidPatterns:e.array(H).max(20),displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(zi).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()}),Zc=e.enum(["model_call","validation","repair","preview","worker_group"]),et=e.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),Jc=e.object({sectionRole:H,contentIntent:H,layoutIntent:H,visualIntent:H,mediaIntent:H,motionIntent:H,copyTone:H,displayTitle:e.string().min(1).max(40).optional(),displayDescription:e.string().min(1).max(zi).optional(),ctaIntent:H.optional(),continuityWithPrevious:H.optional(),avoidRepeating:e.array(H).max(20).optional(),industryRecipeRefs:e.array(qc).max(12).optional(),templateRecipeRefs:e.array(qc).max(12).optional()}),em=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()}),Lf=e.enum(["solid","floating"]),Mf=e.enum(["background","card","primary","frosted"]),Uf=e.enum(["sticky","hide-on-scroll","static"]),Ff=e.enum(["bar","island"]),qf=e.object({variant:Lf,surface:Mf.optional(),behavior:Uf.optional(),shape:Ff.optional()}),Gf=e.object({form:H,layoutIntent:H,scrollBehavior:H,shell:qf.optional(),avoidPatterns:e.array(H).max(10).optional()}),Kf=e.enum(["background","card","primary","inverse"]),zf=e.object({surface:Kf}),Bf=e.object({form:H,composition:H,shell:zf.optional(),avoidPatterns:e.array(H).max(10).optional()}),Wf=e.object({pattern:H,intent:H}),tm=e.object({header:Gf,footer:Bf,mobileNav:Wf}),nm=e.object({schemaVersion:e.literal(1).default(1),siteDesignContext:Xc,routeCards:e.record(e.string().min(1),Qc),blockContexts:e.record(e.string().min(1),Jc),selectedSkillPacks:e.array(Pt).max(3).optional(),branding:em.optional(),chromeDesign:tm.optional()}),zv=e.object({siteDesignContext:Xc.omit({imagePalette:!0}).optional(),routeCards:e.record(e.string().min(1),Qc).optional(),blockContexts:e.record(e.string().min(1),Jc).optional(),branding:em.optional(),chromeDesign:tm.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(),sm=e.string().regex(Ut,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),Vf=new RegExp(`^/(?:${bt}(?:/${bt})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),$f=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,Hf=e.union([e.string().regex(Vf),e.string().regex($f)]),Gc=e.object({label:e.string(),href:Hf}).passthrough(),Yf=e.object({primaryLinks:e.array(Gc),footerLinks:e.array(Gc)}),im=e.object({showInHeader:e.boolean(),showInFooter:e.boolean(),order:e.number()}).strict(),Wi=e.object({id:xe,slug:sm,title:e.string().trim().min(1),blocks:e.array(Bi).min(1),navigation:im}).strict(),Xf=Bi.extend({type:e.string().nullable()}).strict(),Qf=Wi.extend({slug:sm.nullable(),navigation:im.extend({showInHeader:e.boolean().nullable(),showInFooter:e.boolean().nullable()}).strict(),blocks:e.array(Xf).min(1)}).strict(),Zf=Bi.extend({id:e.string()}),Jf=Wi.extend({id:e.string(),slug:e.string().min(1),blocks:e.array(Zf).min(1)}),Kc=e.object({label:e.string(),href:e.string().min(1)}),eb=e.object({primaryLinks:e.array(Kc),footerLinks:e.array(Kc)}),tb=e.discriminatedUnion("kind",[e.object({kind:e.literal("brief_clarify"),brief_id:_t,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()]),ns=e.object({site_name:e.string().min(1).max(80).optional(),version:e.number().int().positive(),pages:e.array(Wi).min(1),navigation:Yf,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:tb.optional()}),skillSelection:Pt,visualTheme:Df.optional(),userChoices:e.array(jf).optional(),confirmedChoices:e.object({conversion:it.optional()}).optional(),seoKeywords:e.array(Tn).min(1).max(50).optional()}).strict(),wt=ns.superRefine((t,n)=>{rm(t.pages,n)}),on=ns.extend({pages:e.array(Qf).min(1)}).strict().superRefine((t,n)=>{rm(t.pages,n)}),nb=e.enum(["slug","showInHeader","showInFooter"]),sb=e.object({page_id:xe,fields:e.array(nb).min(1).max(3)}).strict(),ib=e.object({page_id:xe,block_id:xe,fields:e.tuple([e.literal("type")])}).strict(),am=100,om=500,ab=e.object({pages:e.array(sb).max(am),blocks:e.array(ib).max(om)}).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(_)})}),Bv=e.object({sitemap:on,targets:ab}).strict(),Wv=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(am),blocks:e.array(e.object({page_id:xe,block_id:xe,type:e.string().trim().min(1)}).strict()).max(om)}).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(_)})}),Vv=e.object({sitemap:wt}).strict();function rm(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 $v=ns.omit({skillSelection:!0,visualTheme:!0,userChoices:!0,confirmedChoices:!0,seoKeywords:!0}).extend({meta:ns.shape.meta.omit({source:!0}),site_name:e.string().min(1).max(80),pages:e.array(Jf).min(1),navigation:eb}),ob=e.enum(["ai","user"]),At=e.object({site_id:I,page_id:xe,edited_by:ob.default("ai"),source_agent_run_id:V.optional()}),Hv=At.extend({block_id:xe,target_index:e.number().int().min(0)}),rb=At.extend({block_id:xe}),cb=At.extend({block_id:xe,instruction:e.string()}),Yv=At.extend({block_id:xe,variant:e.string().min(1).nullable()}),Xv=At.extend({block_id:xe,props:e.record(e.string(),e.unknown()),mode:e.enum(["replace","merge"]).default("replace")}),Qv=At.extend({block:e.object({id:xe,label:e.string().trim().min(1),type:e.string().min(1),variant:e.string().min(1).optional(),props:e.record(e.string(),e.unknown()).default({}),insert_index:e.number().int().min(0).optional()})}),mb=e.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),Zv=e.discriminatedUnion("operation",[e.object({operation:e.literal("delete_block"),input:rb}).strict(),e.object({operation:e.literal("update_block_instruction"),input:cb}).strict()]),lb=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"]),pb=e.object({status:e.literal("updated"),operation:mb,site_id:I,sitemap_id:ke,version:e.number().int().positive(),changed_pages:e.array(xe).min(1),requires_code_patch:e.literal(!0)}),db=e.object({status:e.literal("failed"),code:lb,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),Jv=e.discriminatedUnion("status",[pb,db]),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:it.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()}),ub=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(),eC=e.object({source:e.object({kind:e.literal("step5_strategy")}).strict()}).strict(),gb=e.object({item_key:En,title:e.string().trim().min(1).max(200),selected_option_id:ft,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:In.optional(),markets:e.array(Rn).max(32).optional()}).strict(),_b=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(gb).length(fe),seo_keywords:e.array(Tn).min(1).max(50).optional()}).strict().superRefine((t,n)=>{t.decisions.forEach((s,a)=>{s.item_key!==at[a]&&n.addIssue({code:"custom",path:["decisions",a,"item_key"],message:"Step5 sitemap decisions must use the canonical order."})})}),cm=e.object({tenant_id:e.string().min(1),site_id:I,brief_id:_t,brief:e.string().min(20).max(1e3),answers:e.array(Vi).min(1).max(10),skillSelection:Pt,site_default_locale:de.optional(),owner_locale:de.optional(),cms_site_id:e.string().min(1).nullish(),intent_pages:e.array(ub).max(yn).optional(),reference:un.optional(),input_context:e.object({facts:e.array(dn).max(120),conflicts:e.array(gn).max(20)}).optional(),business_facts:ia.optional(),extra_requirement:e.string().trim().min(1).max(ht).optional(),migration_products_enabled:e.boolean().optional()}),hb=cm.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:_b}).strict(),tC=e.union([cm,hb]),mm=e.enum(["planning","generating","validating","ready"]),Sb=e.enum(["salvaged","deterministic_fallback"]),fb=e.enum(["model_exception_settled_prefix","model_exception_safe_root"]),lm={outcome:Sb.optional(),reason:fb.optional(),attempts:e.number().int().positive().optional()};function pm(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 bb=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:mm,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:wt,...lm,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)})]),nC=bb.superRefine(pm),dm=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 um(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 gm=dm.extend({sitemap:wt}).superRefine(um),yb=dm.extend({sitemap:on}).superRefine(um),sC=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:wt,source_agent_run_id:V.optional()}),iC=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:on,expected_current_sitemap_id:ke,expected_current_sitemap_version:e.number().int().positive(),migration_content_requested:e.boolean().optional()}),aC=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:wt,source_agent_run_id:V}),oC=e.object({site:nt,sitemap:gm,next_step:e.literal("workspace")}).strict(),rC=e.object({site:nt,sitemap:yb,next_step:e.literal("workspace")}).strict(),cC=e.object({site:nt,sitemap:gm,next_step:e.literal("sitemap_review")}).strict(),xb=e.object({id:Ji,tenant_id:e.string().min(1),site_id:I,brief_id:_t,questions:Fi,answers:e.array(Vi),selected_archetype:Pt.optional(),completed_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),mC=e.object({answers:e.array(Vi).min(1),questions:Fi,selected_archetype:Pt.optional()}),lC=e.object({clarify_session:xb}),pC=e.object({questions:Fi,selected_archetype:Pt}),Eb=e.object({id:rs,tenant_id:e.string().min(1),site_id:I,version:e.number().int().positive(),design_plan:nm,source_agent_run_id:V.nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),dC=e.object({design_plan_id:rs.optional(),design_plan:nm,source_agent_run_id:V.optional()}),uC=e.object({design_plan:Eb}),as=e.enum(["initial_generation","iteration"]),Ib=e.object({label:e.string().min(1).max(48),prompt:e.string().min(1).max(160)}).strict(),Rb=e.enum(["model","derived","mixed","advisor"]),_m=e.object({suggestions:e.array(Ib).min(1).max(4),source:Rb}).strict(),Tb=e.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),kb=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"]),Pb=e.enum(["progress","assistant_final"]),hm=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"]),wb=e.object({id:e.string().min(1),title:e.string().min(1),status:e.enum(["pending","running","completed","failed"])}),gt=e.enum(["pending","running","completed","completed_with_skips","failed","skipped"]),$i=e.enum(["style_media","chrome","sections","layout","pages","detect_typecheck","repair","finalize","sitemap_resync","preview"]),Hi=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=>wm(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:$i,title:e.string().min(1),status:gt,task_ids:e.array(e.string().min(1)),depends_on_groups:e.array(e.string().min(1)),target_paths:e.array(Se)}),Ab=e.enum(["style","media","chrome","section","layout","page"]),Qi=e.object({task_id:e.string().min(1),group_id:e.string().min(1),kind:Ab,target_path:Se,block_id:e.string().min(1).optional(),block_type:e.string().min(1).optional(),block_variant:e.string().min(1).optional(),block_order:e.number().int().nonnegative().optional(),user_instruction:e.string().min(1).optional(),page_id:e.string().min(1).optional(),page_slug:e.string().min(1).optional(),page_title:e.string().min(1).optional(),title:e.string().min(1).max(60).optional(),description:e.string().min(1).max(zi).optional(),status:gt,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"])}),gC=e.object({plan_id:e.string().min(1),run_kind:as,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}),_C=e.object({task_id:e.string().min(1),patch:e.unknown().optional(),snapshot_id:x.optional(),read_files:e.array(Se),diagnostics:e.array(Hi),status:gt}),Sm=e.object({worker_count:e.number().int().nonnegative(),task_count:e.number().int().nonnegative(),group_count:e.number().int().nonnegative()}),fm=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()}),vb=e.object({type:e.literal("text"),text:e.string(),state:e.enum(["streaming","done"]).optional()}),Cb=e.object({type:e.literal("reasoning"),text:e.string(),state:e.enum(["streaming","done"]).optional(),providerMetadata:e.record(e.string(),e.unknown()).optional()}),Db=e.object({type:e.literal("file"),mediaType:e.string().min(1),filename:e.string().min(1).optional(),url:e.string().min(1)}),jb=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()}),Ob=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()}),Nb=e.object({type:e.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:e.string().min(1).optional(),data:e.unknown()}),Lb=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()}),Mb=e.object({type:e.literal("error"),errorText:e.string().min(1)}),Ub=e.object({type:e.literal("step-start")}),ss=e.union([vb,Cb,Db,jb,Ob,Nb,Lb,Mb,Ub]),Fb=e.string().min(1).max(512).refine(t=>wm(t)&&!/^[A-Za-z]:\//.test(t),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),qb=e.array(Fb).min(1).max(64),Gb=e.array(e.string().min(1).max(120)).min(1).max(64),Kb=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:Pb.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(ss).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),interaction_response:Dn.optional(),at:e.string().min(1)}),e.object({type:e.literal("plan.updated"),steps:e.array(wb),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(zc).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:mm,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:wt,...lm,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:$s.optional(),at:e.string().min(1)}),e.object({type:e.literal("workspace.plan.created"),plan_id:e.string().min(1),run_kind:as,groups:e.array(Xi),tasks:e.array(Qi),dependencies:e.array(Zi),expected_outputs:e.array(Se),diagnostics:Yi,summary:Sm,at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.worker.updated"),group_id:e.string().min(1),phase:$i,status:gt,task_counts:fm,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:gt,target_path:Se,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(Hi).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:qb.optional(),degraded_page_ids:Gb.optional(),snapshot_id:x.optional(),code:e.string().min(1).optional(),message:e.string().min(1).optional(),diagnostics:e.string().min(1).optional(),retryable:e.boolean().optional(),at:e.string().min(1)}).strict().superRefine((t,n)=>{if(!(t.reason==="generated_code_rescue")){for(let a of["degraded_file_paths","degraded_page_ids"])t[a]!==void 0&&n.addIssue({code:"custom",path:[a],message:`${a} is only allowed for generated_code_rescue`});return}t.degraded_file_paths===void 0&&n.addIssue({code:"custom",path:["degraded_file_paths"],message:"generated_code_rescue requires degraded_file_paths"});for(let a of["degraded_block_ids","dropped_files","snapshot_id","code","message","diagnostics","retryable"])t[a]!==void 0&&n.addIssue({code:"custom",path:[a],message:`${a} is not allowed for generated_code_rescue`})}),e.object({type:e.literal("workspace.design_plan.outcome"),design_plan_outcome:Tb,reason:kb,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(),_m.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:Bc.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:jt.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:Zc,title:e.string().min(1).max(200),detail:e.string().max(360).optional(),title_code:et.optional(),detail_code:et.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:et.optional(),detail_code:et.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)})]),bm=Kb.superRefine(pm).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:hm,payload:bm,created_at:e.string().min(1)}),hC=e.object({event_type:hm,payload:bm}).superRefine((t,n)=>{t.event_type!==t.payload.type&&n.addIssue({code:"custom",path:["payload","type"],message:"payload.type must match event_type"}),mn(t.payload)&&n.addIssue({code:"custom",path:["payload"],message:"AgentEvent payload must not contain secrets"})}),SC=e.discriminatedUnion("status",[e.object({status:e.literal("appended"),agent_run:tt,event:Li,next_cursor:e.number().int().nonnegative()}),e.object({status:e.literal("duplicate_ignored"),agent_run:tt,event:Li,next_cursor:e.number().int().nonnegative()})]),fC=e.object({events:e.array(Li),next_cursor:e.number().int().nonnegative().optional()}),bC=e.object({after_sequence:e.coerce.number().int().nonnegative().default(0)}),yC=e.enum(["implemented","skeleton","planned"]),xC=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/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"}],IC=[{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"]}],zb=e.object({id:e.string().min(1),role:e.enum(["system","user","assistant"]),metadata:e.unknown().optional(),parts:e.array(ss).min(1)}),ym=zb.extend({role:e.literal("user")}),RC=e.object({base_snapshot_id:x.optional(),message:ym.optional(),client_run_key:e.string().min(1).max(200).optional()}).superRefine((t,n)=>{mn(t.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),Bb=e.object({path:e.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:V,base_snapshot_id:x,run_kind:as}),TC=e.object({agent_run:tt,websocket:Bb,next_step:e.literal("workspace_socket")}),kC=e.object({agent_run:tt}),PC=e.object({agent_type:e.enum(["clarify","sitemap","workspace"])}),wC=e.object({agent_run:tt}),AC=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)}),Wb=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()}),Vb=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:Bt.optional(),interaction_response:Dn.optional(),selected_component:Wb.optional(),message:ym,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()})}),Co]),$b=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(ss).min(1),in_reply_to_tool_call_id:e.string().min(1).optional(),interaction_response:Dn.optional()})}),J.extend({type:e.literal("server.assistant.delta"),payload:e.object({message_id:e.string().min(1),parts:e.array(ss).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:$s.optional()})}),J.extend({type:e.literal("server.workspace.suggestions"),payload:_m.extend({run_id:V}).strict()}),J.extend({type:e.literal("workspace.plan.created"),payload:e.object({plan_id:e.string().min(1),run_kind:as,groups:e.array(Xi),tasks:e.array(Qi),dependencies:e.array(Zi),expected_outputs:e.array(Se),diagnostics:Yi,summary:Sm})}),J.extend({type:e.literal("workspace.worker.updated"),payload:e.object({group_id:e.string().min(1),phase:$i,status:gt,task_counts:fm,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:gt,target_path:Se,read_files_count:e.number().int().nonnegative(),diagnostics:e.array(e.string().min(1)),diagnostic_details:e.array(Hi).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:jt.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:Zc,title:e.string().min(1).max(200),title_code:et.optional(),detail:e.string().max(360).optional(),detail_code:et.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:et.optional(),detail:e.string().max(360).optional(),detail_code:et.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()})})]),Hb=$b.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"})}),vC=e.union([Vb,Hb]),CC={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."]},xm=e.string().regex(/^sha256:[a-f0-9]{64}$/),Yb=e.enum(["create","update","delete","str_replace"]),Em=e.enum(["sitemap_resync","smoke_test","prepare_preview"]),Xb=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(),Qb=e.object({path:Se,operation:Yb,expected_hash:xm.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(Xb).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(my(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"})}),Zb=e.object({kind:e.enum(["block","page","site","chrome"]),id:e.string().min(1).max(120)}),Jb=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:Zb,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)}),Im=e.object({site_id:I,base_snapshot_id:x,reason:e.string().min(1),patches:e.array(Qb).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(Jb).max(24).optional(),post_actions:e.array(Em).optional()});function Rm(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 DC=Im.superRefine(Rm),jC=Im.omit({base_snapshot_id:!0}).extend({site_id:I.optional()}).superRefine(Rm),ey=pe,ty=e.object({path:ey,operation:e.enum(["upsert","delete"]).optional()}),Tm=e.enum(["sync_cms_pages","sync_cms_navigation"]),OC=e.object({files:e.array(ty).min(1),post_actions:e.array(Tm).optional()}).strict().overwrite(t=>t.post_actions?{...t,post_actions:[...new Set(t.post_actions)]}:t),ny=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"]),sy=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:xm,object_key:e.string().min(1),changed_files:e.array(Se).min(1),post_actions_queued:e.array(Em),dropped_protected_files:e.array(e.string().min(1)).min(1).optional()}),iy=e.object({status:e.literal("failed"),code:ny,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),NC=e.discriminatedUnion("status",[sy,iy]),LC=e.object({ok:e.literal(!0),post_actions:e.array(e.object({action:Tm,status:e.enum(["succeeded","failed"])}).strict()).default([])}),km=pe,ay=e.enum(["text","binary"]),Pm=e.object({path:km,kind:ay,language:e.string().min(1).nullable(),size_bytes:e.number().int().nonnegative()}),MC=e.object({path:km}),oy=Pm.extend({kind:e.literal("text"),language:e.string().min(1),content:e.string()}),ry=Pm.extend({kind:e.literal("binary"),language:e.null(),mime_type:e.string().min(1),content_base64:e.string().min(1)}),UC=e.union([oy,ry]);function mn(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=>mn(n)):Object.entries(t).some(([n,s])=>cy(n)||mn(s))}function cy(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 wm(t){let n=t.split("/");return t.length>0&&!t.startsWith("/")&&!t.includes("\\")&&n.every(s=>s!==""&&s!=="."&&s!=="..")}function my(t){let n=/^app\/(?:(.*)\/)?page\.(?:tsx|jsx)$/.exec(t);if(!n)return!0;let a=(n[1]??"").split("/").filter(r=>r.length>0);return a.some(r=>r.startsWith("_"))?!0:a.filter(r=>!r.startsWith("@")&&!/^\(.+\)$/.test(r)).map(r=>r.replace(/^\((?:\.|\.\.|\.\.\.)\)/,"")).filter(r=>r.length>0).every(r=>/^\[.*\]$/.test(r)||Ut.test(`/${r}`))}var Am=e.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),ly=e.object({id:ln,tenant_id:e.string().min(1),site_id:I,sandbox_id:e.string().min(1).nullable(),status:Am,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)}),FC=e.object({session_id:ln.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:ln.optional(),expected_ready_session_last_snapshot_id:x.optional(),status:Am,preview_url:e.string().url().optional()}),qC=e.object({preview_session:ly,next_step:e.literal("preview")}),GC=e.object({failed_count:e.number().int().nonnegative()}),KC=e.object({site_id:I}),zC=e.object({status:e.enum(["cancelled","no_active_run"]),agent_run:tt.nullable()});export{Cr as AESTHETIC_NOTE_MAX_LENGTH,cv as AbandonSiteSnapshotResponseSchema,Zc as ActivityKindSchema,et as ActivityTitleCodeSchema,aR as AdvanceSiteWorkflowRequestSchema,Bc as AgentErrorCategorySchema,ta as AgentEventIdSchema,Li as AgentEventRecordSchema,bm as AgentEventSchema,hm as AgentEventTypeSchema,Pb as AgentMessageHistoryPurposeSchema,$c as AgentModelRouteSchema,wb as AgentPlanStepSchema,V as AgentRunIdSchema,Vc as AgentRunKindSchema,tt as AgentRunRecordSchema,If as AgentRunStatusSchema,Wc as AgentRunTypeSchema,Nb as AiSdkUiDataPartSchema,Mb as AiSdkUiErrorPartSchema,Db as AiSdkUiFilePartSchema,ss as AiSdkUiMessagePartSchema,zb as AiSdkUiMessageSchema,Cb as AiSdkUiReasoningPartSchema,Ob as AiSdkUiSourceDocumentPartSchema,jb as AiSdkUiSourceUrlPartSchema,Ub as AiSdkUiStepStartPartSchema,vb as AiSdkUiTextPartSchema,Lb as AiSdkUiToolPartSchema,yC as ApiContractStatusSchema,Cf as ApiErrorEnvelopeSchema,L as ApiResponseSchema,hC as AppendAgentEventRequestSchema,SC as AppendAgentEventResponseSchema,ny as ApplyPatchBatchErrorCodeSchema,iy as ApplyPatchBatchFailureSchema,DC as ApplyPatchBatchInputSchema,Qb as ApplyPatchBatchPatchSchema,Em as ApplyPatchBatchPostActionSchema,NC as ApplyPatchBatchResultSchema,sy as ApplyPatchBatchSuccessSchema,jC as ApplyPatchBatchToolInputSchema,Xb as ApplyPatchEditSchema,Yb as ApplyPatchOperationSchema,zc as ArchetypeProposalSchema,Ry as AuditLogIdSchema,dy as AuthIdentityIdSchema,hy as AuthLoginCodeIdSchema,_y as AuthOidcStateIdSchema,uy as AuthSessionIdSchema,gy as AuthTokenIdSchema,Sy as AuthWsTicketIdSchema,Fh as BINDING_STATUSES,Jc as BlockGenerationContextSchema,qv as BlockMediaIntentSchema,Bi as BlockSchema,em as BrandingSchema,_t as BriefIdSchema,Gi as BriefRecordSchema,ia as BusinessFactsSchema,Ek as CHAT_COPY,xk as CLARIFICATION_COPY,ph as CMS_FORM_FIELD_TYPES,dr as CMS_MAIN_PRODUCTS_MAX_LENGTH,mp as CMS_PAGE_DIRECTORY_MAX_DEPTH,cp as CMS_PAGE_DIRECTORY_MAX_NODES,Ba as CMS_PAGE_URL_PATH_MAX_LENGTH,iT as COMPONENT_I18N_FILE_SUFFIX,Nn as COMPONENT_I18N_NAMESPACE,Dm as CONVERSION_CTA_LABEL_MAX_LENGTH,sS as CRAWLER_INTERNAL_ERROR_CODES,rr as CURRENT_EDIT_ENGINE_VERSION,KC as CancelActiveWorkspaceRunRequestSchema,zC as CancelActiveWorkspaceRunResponseSchema,fc as CheckSitePublishDomainDataSchema,qS as CheckSitePublishDomainRequestSchema,GS as CheckSitePublishDomainResponseSchema,tm as ChromeDesignSchema,Bf as ChromeFooterDesignSchema,zf as ChromeFooterShellSchema,Gf as ChromeHeaderDesignSchema,qf as ChromeHeaderShellSchema,Wf as ChromeMobileNavDesignSchema,xf as ClarifyQuestionOptionSchema,Ef as ClarifyQuestionSchema,ff as ClarifyQuestionTypeSchema,Fi as ClarifyQuestionsSchema,vA as ClarifyRunInputSchema,Ji as ClarifySessionIdSchema,xb as ClarifySessionRecordSchema,CA as ClarifyStreamEventSchema,Ty as CmsCollectionBindingIdSchema,yP as CmsCollectionBindingSchema,Kr as CmsFormSchemaProjectionSchema,vs as CmsManagedPageTypeSchema,dp as CmsPageDirectoryGroupSchema,Wa as CmsPageDirectoryNodeSchema,Ka as CmsPageDirectorySchema,Cs as CmsPageTypeSchema,ct as CmsPageUrlPathSchema,ba as CmsSiteIdSchema,eS as CompanyInfoSchema,NP as CompanyInfoTaskCreateRequestSchema,LP as CompanyInfoTaskCreateResponseSchema,MP as CompanyInfoTaskResponseSchema,H1 as CompleteCustomerMaterialsRequestSchema,Y1 as CompleteDiagnosisRequestSchema,lv as CompleteSiteSnapshotDeletionResponseSchema,oR as CompleteSiteWorkflowRequestSchema,X1 as CompleteStrategyRequestSchema,$1 as CompleteWebsiteScanRequestSchema,oT as ComponentI18nResourcesSchema,$E as ComposeDesignerPageResourceBodySchema,iC as ConfirmSiteStructureRequestSchema,w0 as ConnectDynamicCollectionInputSchema,C0 as ConnectFormInputSchema,it as ConversionHintsSchema,iS as CrawlerInternalErrorCodeSchema,UP as CrawlerInternalErrorSchema,Tt as CrawlerTaskCodeSchema,kP as CrawlerTaskCreateRequestSchema,AP as CrawlerTaskCreateResponseSchema,Vh as CrawlerTaskFailureErrorCodeSchema,sc as CrawlerTaskFailureStageSchema,Hh as CrawlerTaskPageSchema,PP as CrawlerTaskPagesQuerySchema,DP as CrawlerTaskPagesResponseSchema,CP as CrawlerTaskStatusResponseSchema,pt as CrawlerTaskUuidSchema,Uv as CreateAgentRunConflictResponseSchema,nv as CreateAgentRunRequestSchema,sv as CreateAgentRunResponseSchema,Av as CreateDeploymentRequestSchema,Pf as CreateDeploymentResponseSchema,sx as CreateDocumentUploadRequestSchema,By as CreateExternalSiteEditRequestSchema,Wy as CreateExternalSiteEditResponseSchema,mx as CreateImageUploadRequestSchema,Zy as CreateInputSourceRequestSchema,vv as CreateQualityCheckDeploymentRequestSchema,MA as CreateSiteBriefRequestSchema,JA as CreateSiteBriefResponseSchema,UA as CreateSiteDraftRequestSchema,LA as CreateSiteInputSchema,sR as CreateSiteWorkflowRequestSchema,Km as CreateTextInputSourceRequestSchema,zm as CreateUrlInputSourceRequestSchema,Dv as CurrentDeploymentResponseSchema,G1 as CustomerMaterialsDraftResponseSchema,oi as CustomerMaterialsDraftSchema,K1 as CustomerMaterialsNullableResponseSchema,ri as CustomerMaterialsRecordSchema,q1 as CustomerMaterialsResponseSchema,I_ as CustomerMaterialsStatusSchema,R_ as DEFAULT_FONTS,Rr as DEFAULT_SITE_DESIGN_RADIUS_ID,dl as DEFAULT_SITE_LOCALE,jk as DEFAULT_SUBSITE_PALETTE,YR as DEPLOYMENT_ACTIVE_STATUSES,Ye as DEPLOYMENT_LIFECYCLE_TRANSITIONS,ou as DEPLOYMENT_PROGRESS_STEP_CODES,vf as DEPLOYMENT_REALTIME_CHANNEL,St as DEPLOYMENT_STATUSES,XR as DEPLOYMENT_TERMINAL_STATUSES,zu as DEPLOYMENT_TRANSITION_ERROR_CODE,Mv as DEPLOYMENT_WEBSOCKET_CONTRACT,fE as DESIGNER_COMPONENT_LIBRARY_ERROR_CODES,KE as DESIGNER_PAGE_LIBRARY_ERROR_CODES,Jy as DOCUMENT_EXTENSION_WHITELIST,ex as DOCUMENT_MIME_WHITELIST,yS as DOMAIN_DNS_PURPOSES,xS as DOMAIN_DNS_VERIFICATION_STATUSES,hS as DOMAIN_OBSERVED_STATUSES,fS as DOMAIN_ROUTING_MODES,jE as DeleteDesignerPageErrorDetailsSchema,AE as DeleteDesignerPageRequestSchema,vE as DeleteDesignerPageResponseSchema,yp as DeleteDesignerPageResultSchema,mv as DeleteSiteSnapshotResponseSchema,Fe as DeploymentIdSchema,fy as DeploymentJobIdSchema,ru as DeploymentProgressStepCodeSchema,mu as DeploymentProgressStepSchema,cu as DeploymentProgressStepStatusSchema,Bo as DeploymentProgressStepsSchema,Je as DeploymentRecordSchema,Lv as DeploymentRedisPubSubEventSchema,Ki as DeploymentStatusSchema,Fc as DeploymentStatusSummarySchema,Js as DeploymentTransitionError,Yc as DeploymentTypeSchema,ts as DeploymentWsDeploymentPayloadSchema,Nv as DeploymentWsServerMessageSchema,Af as DeploymentWsServerMessageTypeSchema,Tb as DesignPlanGenerationOutcomeSchema,kb as DesignPlanGenerationReasonSchema,rs as DesignPlanIdSchema,zv as DesignPlanPatchSchema,Eb as DesignPlanRecordSchema,nm as DesignPlanSchema,Fv as DesignTokensSchema,rp as DesignerComponentCatalogItemSchema,Ma as DesignerComponentCategoriesDataSchema,La as DesignerComponentCategoryNodeSchema,rt as DesignerComponentExactVersionSchema,Fa as DesignerComponentInstallDataSchema,Ua as DesignerComponentsDataSchema,kp as DesignerPageCatalogItemSchema,Ja as DesignerPageCategoriesDataSchema,Za as DesignerPageCategoryNodeSchema,Sp as DesignerPageDeleteBlockReasonSchema,hp as DesignerPageDisabledReasonSchema,Mt as DesignerPageExactVersionSchema,Ya as DesignerPageGroupSchema,to as DesignerPageInstallDataSchema,Ha as DesignerPageNodeSchema,so as DesignerPageResourcePreparationDataSchema,Tp as DesignerPageResourceSourceSchema,jp as DesignerPageResourceTemplateSchema,mt as DesignerPageResourceTypeSchema,eo as DesignerPagesDataSchema,ks as DesignerResourceVersionSchema,io as DesignerSitePagesDataSchema,BE as DesignerSiteRouteIdSchema,_c as DomainConfigurationSchema,gc as DomainDnsPurposeSchema,PS as DomainDnsRecordSchema,TS as DomainDnsVerificationObservationSchema,kS as DomainDnsVerificationResultSchema,ES as DomainDnsVerificationStatusSchema,SS as DomainObservedStatusSchema,RS as DomainOperationErrorSchema,Pi as DomainOperationSchema,IS as DomainOperationStatusSchema,ki as DomainOperationTypeSchema,uc as DomainRecordSchema,bS as DomainRoutingModeSchema,Rk as EDIT_ENGINE_VERSION_HEADER,Tk as EDIT_ENGINE_VERSION_SOURCE_HEADER,bk as ERROR_COPY,Nm as EXTERNAL_SITE_EDIT_INFRASTRUCTURE_REASONS,Om as EXTERNAL_SITE_EDIT_PROMPT_MAX_LENGTH,ai as EditEngineVersionParseError,ao as EnhanceDesignerPageResourceBodySchema,QA as EnhanceDesignerPageResourceResponseSchema,Hy as ExternalSiteEditCallbackAckSchema,$y as ExternalSiteEditCallbackPayloadSchema,Lm as ExternalSiteEditCallbackStatusSchema,jt as ExternalSiteEditDegradedReasonSchema,ra as ExternalSiteEditOutcomeSchema,oa as ExternalSiteEditTaskIdSchema,ca as ExternalSiteEditTaskSchema,Mm as ExternalSiteEditTaskStatusSchema,KA as ExternalSyncSiteRequestSchema,ZA as ExternalSyncSiteResponseSchema,Fm as ExtractedFactKindSchema,dn as ExtractedFactSchema,z_ as FIELD_TYPES,xr as FONT_PAIRINGS,mi as FONT_PAIRING_IDS,Ih as FORM_DESIGN_ERROR_CODES,Eh as FORM_DESIGN_FAILURE_STAGES,yh as FORM_DESIGN_OPERATION_STAGES,xh as FORM_DESIGN_OPERATION_STATUSES,Vn as FORM_FIELD_TYPES,dh as FORM_SPEC_FIELD_TYPE_TO_CMS,Lr as FORM_SPEC_FILE_MIN_RUNTIME_VERSION,sh as FORM_SPEC_LOCALIZABLE_FIELD_PATHS,Nr as FORM_SPEC_MULTISTEP_MIN_RUNTIME_VERSION,K0 as FORM_TEMPLATE_CATEGORY_COUNTS,G0 as FORM_TEMPLATE_CATEGORY_SLUGS,GC as FailStaleInFlightWorkspaceRunsResponseSchema,Or as FieldDeclSchema,HP as FirecrawlBatchCreateRequestSchema,YP as FirecrawlBatchCreatedResponseSchema,rS as FirecrawlBatchErrorSchema,QP as FirecrawlBatchErrorsResponseSchema,oS as FirecrawlBatchPageSchema,XP as FirecrawlBatchStatusResponseSchema,zP as FirecrawlCrawlCreateRequestSchema,BP as FirecrawlCrawlCreatedResponseSchema,WP as FirecrawlCrawlStatusResponseSchema,cc as FirecrawlJobStatusSchema,GP as FirecrawlMapRequestSchema,KP as FirecrawlMapResponseSchema,ZP as FirecrawlQueueStatusResponseSchema,VP as FirecrawlScrapeRequestSchema,$P as FirecrawlScrapeResponseSchema,Kf as FooterShellSurfaceSchema,$_ as FormBlockIdSchema,Hn as FormDefinitionIdSchema,Sh as FormDesignAffectedFilesSchema,Ii as FormDesignErrorCodeSchema,J0 as FormDesignErrorSchema,Wr as FormDesignFailureStageSchema,te as FormDesignHashSchema,V0 as FormDesignOpenResponseSchema,fh as FormDesignOperationFingerprintInputSchema,Si as FormDesignOperationIdSchema,Vr as FormDesignOperationNextActionSchema,yy as FormDesignOperationRecordIdSchema,Q0 as FormDesignOperationRecordSchema,Ri as FormDesignOperationResponseSchema,Hr as FormDesignOperationSchema,Ei as FormDesignOperationStageSchema,Br as FormDesignOperationStatusSchema,Z0 as FormDesignOperationTransitionRequestSchema,$r as FormDesignPreviewRefreshStatusSchema,H0 as FormDesignQueryResponseSchema,Y0 as FormDesignResumeRequestSchema,X0 as FormDesignResumeResponseSchema,bh as FormDesignSaveRequestSchema,$0 as FormDesignSaveResponseSchema,zr as FormDesignSharedImpactSchema,xi as FormDesignStandardizationSchema,W_ as FormFieldDeclSchema,sn as FormFieldNameSchema,fi as FormOptionValueSchema,H_ as FormSpecBindingSchema,X_ as FormSpecFieldNodeSchema,Z_ as FormSpecNodeSchema,Y_ as FormSpecOptionSchema,Q_ as FormSpecStepBreakNodeSchema,yi as FormSpecV1Schema,z0 as FormTemplateCatalogResponseSchema,Gr as FormTemplateCategorySlugSchema,mh as FormTemplateCategoryV1Schema,Ze as FormTemplateTextSchema,lh as FormTemplateV1Schema,WS as GSC_AUTH_STATUSES,VS as GSC_BINDING_STATUSES,$S as GSC_PROPERTY_TYPES,jv as GetDeploymentResponseSchema,wf as GetDeploymentsStatusResponseSchema,Vy as GetExternalSiteEditResponseSchema,vw as GetSiteDomainConfigurationResponseSchema,wi as GetSitePublishDomainOperationDataSchema,KS as GetSitePublishDomainOperationResponseSchema,l1 as GetTemplateUpgradeReportQuerySchema,p1 as GetTemplateUpgradeReportResponseSchema,Yw as GoogleSearchConsoleAuthStartDataSchema,Hw as GoogleSearchConsoleAuthStartRequestSchema,Xw as GoogleSearchConsoleAuthStartResponseSchema,Bw as GoogleSearchConsoleAuthStatusSchema,Ww as GoogleSearchConsoleBindingStatusSchema,Vw as GoogleSearchConsolePropertyTypeSchema,$w as GoogleSearchConsoleStateSchema,Zw as GoogleSearchConsoleStatusDataSchema,Qw as GoogleSearchConsoleStatusInputSchema,Jw as GoogleSearchConsoleStatusResponseSchema,Gw as GscAuthStartDataSchema,qw as GscAuthStartRequestSchema,Kw as GscAuthStartResponseSchema,Ai as GscAuthStatusSchema,vi as GscBindingStatusSchema,Ci as GscPropertyTypeSchema,YS as GscStateInputSchema,zw as GscStateSchema,xc as GscStatusDataSchema,XS as GscStatusResponseSchema,za as HOME_PAGE_URL_PATH,Uf as HeaderShellBehaviorSchema,Ff as HeaderShellShapeSchema,Mf as HeaderShellSurfaceSchema,Lf as HeaderShellVariantSchema,qh as HomeUrlCrawlerTaskCreateRequestSchema,Gs as HttpUrlSchema,ax as IMAGE_EXTENSION_WHITELIST,ox as IMAGE_MIME_WHITELIST,Na as INSERT_NEW_COMPONENT_CATEGORY_GROUP_KEY,Qa as INSERT_NEW_PAGE_CATEGORY_GROUP_KEY,ul as ISO_639_3_TO_SITE_LOCALE,Bm as ImageRoleSchema,ym as InboundUserMessageSchema,I0 as IndustryClassificationRequestSchema,R0 as IndustryClassificationResultSchema,K_ as IndustryConfidenceSchema,Um as InputBundleStatusSchema,gn as InputConflictSchema,lx as InputContextBundleSchema,st as InputContextSourceIdSchema,Gm as InputSourceSchema,ls as InputSourceStatusSchema,ms as InputSourceTypeSchema,Zk as InspectTemplateUpgradeStateRequestSchema,Jk as InspectTemplateUpgradeStateResponseSchema,EE as InstallDesignerComponentBodySchema,WA as InstallDesignerComponentResponseSchema,WE as InstallDesignerPageBodySchema,HA as InstallDesignerPageResponseSchema,Cv as InternalCreateDeploymentResponseSchema,Tv as InternalEnsureSubsitePublishRequestSchema,kv as InternalEnsureSubsitePublishResponseSchema,G as InternalEntityIdSchema,Ov as InternalGetDeploymentsStatusResponseSchema,Pv as InternalGetSubsitePublishStatusRequestSchema,wv as InternalGetSubsitePublishStatusResponseSchema,Iv as InternalPrepareSubsitePreviewRequestSchema,Rv as InternalPrepareSubsitePreviewResponseSchema,y_ as KNOWLEDGE_CATEGORY_CODES,ur as KnowledgeCategoryCodeSchema,O1 as KnowledgeContextReadinessSchema,E_ as KnowledgeSourceReadinessSchema,gr as KnowledgeSourceReadinessStatusSchema,D1 as KnowledgeTaskStatusBatchSchema,x_ as KnowledgeTaskStatusSchema,rl as LEGACY_SITE_LOCALE_CODES,PC as LatestAgentRunQuerySchema,wC as LatestAgentRunResponseSchema,kC as LatestWorkspaceRunResponseSchema,aw as LauncherPromptTemplateApplyRequestSchema,ow as LauncherPromptTemplateApplyResponseSchema,pS as LauncherPromptTemplateCatalogItemSchema,sw as LauncherPromptTemplateCatalogQuerySchema,iw as LauncherPromptTemplateCatalogSchema,mS as LauncherPromptTemplateKindSchema,lS as LauncherPromptTemplateLocaleSchema,es as LauncherPromptTemplateTypeSchema,bC as ListAgentEventsQuerySchema,fC as ListAgentEventsResponseSchema,zA as ListDesignerComponentCategoriesResponseSchema,xE as ListDesignerComponentsQuerySchema,BA as ListDesignerComponentsResponseSchema,VA as ListDesignerPageCategoriesResponseSchema,zE as ListDesignerPagesQuerySchema,$A as ListDesignerPagesResponseSchema,XA as ListDesignerSitePagesResponseSchema,rf as ListMediaLibraryAssetsQuerySchema,cf as ListMediaLibraryAssetsResponseSchema,yv as ListSiteVersionsResponseSchema,d1 as ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema,u1 as ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema,nx as MAX_DOCUMENT_SOURCES_PER_SITE,tx as MAX_DOCUMENT_UPLOAD_BYTES,cx as MAX_IMAGE_SOURCES_PER_SITE,rx as MAX_IMAGE_UPLOAD_BYTES,Ac as MEDIA_LIBRARY_AUDIO_EXTENSIONS,Oc as MEDIA_LIBRARY_AUDIO_MIME_TYPES,vc as MEDIA_LIBRARY_DOCUMENT_EXTENSIONS,af as MEDIA_LIBRARY_EXTENSIONS,Cc as MEDIA_LIBRARY_FILE_EXTENSIONS,Pc as MEDIA_LIBRARY_IMAGE_EXTENSIONS,sf as MEDIA_LIBRARY_IMAGE_MAX_BYTES,Dc as MEDIA_LIBRARY_IMAGE_MIME_TYPES,kc as MEDIA_LIBRARY_MAX_BYTES,of as MEDIA_LIBRARY_MIME_TYPES,wc as MEDIA_LIBRARY_VIDEO_EXTENSIONS,jc as MEDIA_LIBRARY_VIDEO_MIME_TYPES,mT as MIGRATION_PRODUCTS_CMS_DETAIL_PAGE_TITLE,cT as MIGRATION_PRODUCTS_DETAIL_PREFIX,dT as MIGRATION_PRODUCTS_DETAIL_VIEW_VARIANT,pT as MIGRATION_PRODUCTS_LIST_VIEW_VARIANT,$u as MIGRATION_PRODUCTS_ROUTE,Ke as MIGRATION_PRODUCTS_SLUG,lT as MIGRATION_PRODUCTS_VIEW_BLOCK_TYPE,B_ as MODEL_DECLARABLE_FORM_FIELD_TYPES,O_ as MOTION_PRESETS,pi as MOTION_PRESET_IDS,_x as ManagedPageTemplateRouteManifestV1Schema,Kv as MediaAssetSchema,Of as MediaAttributionSchema,Oi as MediaLibraryAssetSchema,Nc as MediaLibraryFileTypeSchema,Lc as MediaLibrarySourceSchema,Zb as MediaRequestOwnerSchema,Iy as MediaResolutionCacheIdSchema,yE as MockDesignerComponentInsertDataSchema,bE as MockDesignerComponentInsertRequestSchema,Ui as MotionLevelSchema,Ch as NAV_ITEMS_LOCALIZABLE_FIELD_PATHS,Dh as NAV_ITEMS_MACHINE_FIELD_PATHS,w_ as NEXT_FONT_DISPLAY_NAMES,Xt as NEXT_FONT_REGISTRY,gl as NON_LATIN_SITE_LOCALE_CODES,mP as NavItemSchema,Ph as PAGE_SEO_LOCALIZABLE_FIELD_PATHS,wh as PAGE_SEO_MACHINE_FIELD_PATHS,Ut as PAGE_SLUG_PATTERN,bt as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,_P as PLATFORM_MATERIALIZED_EXEMPTIONS,Lh as PLATFORM_MATERIALIZED_FILES,Mh as PLATFORM_MATERIALIZED_FILE_PATTERNS,gP as PLATFORM_MATERIALIZERS,oo as PLATFORM_OWNED_PAGE_SLUGS,Op as PLATFORM_OWNED_ROUTE_FILE_PATHS,bp as PageDirectoryReconcileFailedPageSchema,Ds as PageDirectoryReconcileResultSchema,NE as PageDirectoryReconcileStateSchema,fp as PageDirectoryReconcileStatusSchema,Bh as PageDiscoveryCoverageEntrySchema,vP as PageDiscoveryCoverageReasonSchema,ic as PageDiscoveryCoverageSchema,im as PageNavigationSchema,Os as PageResourceArtifactSchema,vp as PageResourceComponentReferenceSchema,Cp as PageResourceComponentSchema,wp as PageResourceDraftPageSchema,Ap as PageResourceDraftSchema,Pn as PageResourceFinalRouteSchema,Dp as PageResourcePageSchema,Pp as PageResourcePageSelectionSchema,no as PageResourceRouteMappingSchema,Wi as PageSchema,rP as PageSeoDeclSchema,sm as PageSlugSchema,Ep as PageTargetKindSchema,ws as PageTargetProjectionHashSchema,Xa as PageTargetSchema,Ip as PageTargetSeoSchema,OE as PageTargetSetSchema,fx as PageTemplateCleanupRequestSchema,xx as PageTemplateCleanupResponseSchema,hx as PageTemplateCreateRequestSchema,bx as PageTemplateCreateResponseSchema,Ex as PageTemplateErrorCodeSchema,Ie as PageTemplateIdSchema,_n as PageTemplatePagePathSchema,Sx as PageTemplatePromoteRequestSchema,yx as PageTemplatePromoteResponseSchema,mC as PersistClarifyAnswersRequestSchema,lC as PersistClarifyAnswersResponseSchema,aC as PersistGeneratedSitemapDraftRequestSchema,cC as PersistGeneratedSitemapDraftResponseSchema,FC as PersistPreviewSessionRequestSchema,qC as PersistPreviewSessionResponseSchema,dC as PersistSiteDesignPlanRequestSchema,uC as PersistSiteDesignPlanResponseSchema,rC as PersistSiteSitemapDraftResponseSchema,sC as PersistSiteSitemapRequestSchema,oC as PersistSiteSitemapResponseSchema,iv as PersistSiteSnapshotRequestSchema,av as PersistSiteSnapshotResponseSchema,Sf as PositioningPrefillSchema,Ni as PositioningSourceSchema,VE as PrepareDesignerPageBodySchema,YA as PrepareDesignerPageResponseSchema,R1 as PrepareSiteBuildInitialGenerationBaseRequestSchema,T1 as PrepareSiteBuildInitialGenerationBaseResultSchema,Qk as PrepareTemplateUpgradeStateRequestSchema,s_ as PrepareTemplateUpgradeStateResponseSchema,Ev as PrepareVersionPreviewRequestSchema,kf as PrepareVersionPreviewResponseSchema,zo as ProductSearchAppConfigDraftSchema,Vs as ProductSearchAppSlugSchema,xR as ProductSearchContractFixtureSchema,Jd as ProductSearchDraftConfigSchema,Re as ProductSearchFieldNameSchema,Qd as ProductSearchFilterMetaSchema,$s as ProductSearchInteractionRequestSchema,Dn as ProductSearchInteractionResponseSchema,yR as ProductSearchPopularTermsReadSchema,Ko as ProductSearchPopularTermsSchema,su as ProductSearchRequestSchema,au as ProductSearchResponseSchema,Bt as ProductSearchRouteIdSchema,Xd as ProductSearchValueShapeSchema,rv as PromoteSiteSnapshotRequestSchema,Rf as PromoteSiteSnapshotResponseSchema,fv as PromoteTemplateUpgradeSnapshotRequestSchema,bv as PromoteTemplateUpgradeSnapshotResponseSchema,Sc as QualityRunningStatusSchema,yk as REFUSAL_COPY,EC as REST_API_ENDPOINTS,Ah as ROOT_LAYOUT_METADATA_LOCALIZABLE_FIELD_PATHS,vh as ROOT_LAYOUT_METADATA_MACHINE_FIELD_PATHS,zS as ReconcileSitePublishDomainOperationDataSchema,BS as ReconcileSitePublishDomainOperationResponseSchema,pv as RecordSnapshotVersionRequestSchema,dv as RecordSnapshotVersionResponseSchema,c1 as RecordTemplateUpgradeEventRequestSchema,m1 as RecordTemplateUpgradeEventResponseSchema,e1 as RecordTemplateUpgradeFailureRequestSchema,t1 as RecordTemplateUpgradeFailureResponseSchema,n1 as RecordTemplateUpgradeSuccessRequestSchema,s1 as RecordTemplateUpgradeSuccessResponseSchema,CE as RecoverDesignerPageProjectionRequestSchema,DE as RecoverDesignerPageProjectionResponseSchema,xp as RecoverDesignerPageProjectionResultSchema,qm as ReferencePagePatternSchema,un as ReferenceSignalsSchema,rR as RegisterWorkflowTaskCommandRequestSchema,zd as RegisterWorkflowTaskRequestSchema,_v as ReleaseTemplateUpgradeLockRequestSchema,hv as ReleaseTemplateUpgradeLockResponseSchema,lR as ReplaceCrawlWorkflowTaskCommandRequestSchema,Wd as ReplaceCrawlWorkflowTaskRequestSchema,mR as ReplaceWorkflowTaskCommandRequestSchema,Bd as ReplaceWorkflowTaskRequestSchema,P0 as ResolvedFieldSchema,D0 as ResolvedFormFieldSchema,xC as RestApiMethodSchema,xv as RestoreSiteSnapshotResponseSchema,cP as RootLayoutMetadataSchema,Qc as RouteGenerationCardSchema,Lu as RuleEngineInputSchema,qu as RuleEngineScoreRecordSchema,Zs as RuleScoreDimensionKeySchema,Fu as RuleScoreDimensionSchema,Ot as SELECTABLE_SITE_LOCALE_CODES,om as SITEMAP_RESOLVER_MAX_BLOCK_TARGETS,am as SITEMAP_RESOLVER_MAX_PAGE_TARGETS,E1 as SITE_BUILD_CONTEXT_FILE_PATH,I1 as SITE_BUILD_CONTEXT_MAX_BYTES,Cd as SITE_BUILD_STATUSES,No as SITE_BUILD_STATUS_CODES,Dd as SITE_DEPLOYMENT_STATUSES,Lo as SITE_DEPLOYMENT_STATUS_CODES,li as SITE_DESIGN_DENSITY_IDS,Ir as SITE_DESIGN_RADIUS_IDS,vT as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,ep 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,bo as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,xI as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,wg as SITE_EDIT_RUNTIME_CONTAINER_TAGS,Ag as SITE_EDIT_RUNTIME_TEXT_TAGS,Pg as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,dI as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,$m as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,la as SITE_EDIT_SOURCE_ALLOWED_DIRS,Vm as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,us as SITE_EDIT_SOURCE_DELETE_CAPABILITY,Hm as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,ht as SITE_EXTRA_REQUIREMENT_MAX_LENGTH,cl as SITE_LOCALE_CODES,oP as SITE_LOCALIZATION_STRUCTURES,DA as SITE_PLANNING_FROZEN_ERROR_CODE,jA as SITE_PLANNING_LOCKED_ERROR_CODE,OA as SITE_STRUCTURE_CONFIRMATION_REQUIRED_ERROR_CODE,NA as SITE_STRUCTURE_CONFIRMATION_STALE_ERROR_CODE,jd as SITE_WORKFLOW_STATUSES,Mo as SITE_WORKFLOW_STATUS_CODES,IC as SSE_STREAMS,jl as STEP5_GEO_QUESTION_TYPES,yn as STEP5_PRIMARY_INTENT_PAGE_LIMIT,Ea as STEP5_SEMRUSH_MIN_RELEVANCE_SCORE,yl as STEP5_SEMRUSH_SEARCH_INTENTS,xl as STEP5_SEO_ALLOWED_INTENT_CODES,Yx as STEP5_SEO_ALLOWED_SEARCH_INTENTS,eE as STEP5_SEO_KEYWORD_DEFAULT,Ml as STEP5_SEO_KEYWORD_MAX,Ll as STEP5_SEO_KEYWORD_MIN,bn as STEP5_SEO_MAX_KEYWORD_DIFFICULTY,ya as STEP5_SEO_MIN_FIT,fn as STEP5_SEO_MIN_SEARCH_VOLUME,Nl as STEP5_SEO_PAYLOAD_SCHEMA_VERSION,Yl as STEP5_SSE_EVENT_NAMES,fe as STEP5_STRATEGY_COUNT,at as STEP5_STRATEGY_KEYS,Ra as STEP5_STRATEGY_OPTION_IDS,Pr as STEP6_AI_THEME_IDS,di as STEP6_AI_THEME_PRESETS,wr as STEP6_GENERATED_THEME_ID_PATTERN,qg as SUBSITE_GLOSSARY_ENTRY_MAX_CHARS,Gg as SUBSITE_GLOSSARY_MAX_ENTRIES,Qg as SUBSITE_MOUNT_PATH_PATTERN,Vg as SUBSITE_PALETTE_NOTE_MAX_CHARS,Zg as SUBSITE_RESERVED_MOUNT_SEGMENTS,qx as SUPPORTED_SITE_LOCALES,ln as SandboxSessionIdSchema,ly as SandboxSessionSchema,Am as SandboxSessionStatusSchema,GA as SaveBriefDraftRequestSchema,tv as SaveBriefDraftResponseSchema,Oy as SaveSiteExtraRequirementRequestSchema,lf as SearchUnsplashMediaQuerySchema,pf as SearchUnsplashMediaResponseSchema,S_ as SiteBuildContextFileSchema,h_ as SiteBuildContextPayloadSchema,__ as SiteBuildContextProvenanceSchema,g_ as SiteBuildContextProvenanceSourceSchema,Ks as SiteBuildStatusSchema,zs as SiteDeploymentStatusSchema,Xc as SiteDesignContextSchema,bf as SiteDesignDensitySchema,yf as SiteDesignMotionLevelSchema,Un as SiteEditBoundaryKindSchema,Zu as SiteEditCapabilityConstraintSchema,Xu as SiteEditCapabilityModeSchema,Mn as SiteEditCapabilityModeViewSchema,bT as SiteEditCapabilityReadRequestSchema,Fp as SiteEditClassNameSourceDiagnosticSchema,lt as SiteEditClassNameSourceRangeSchema,uo as SiteEditClassNameSourceSchema,sI as SiteEditClassNameSourceStyleContextSchema,po as SiteEditClassNameSourceStylesheetSchema,Ls as SiteEditClassNameSourceWriteIntentSchema,ZE as SiteEditCommandDiagnosticSchema,Mp as SiteEditCommandErrorSchema,M as SiteEditCompositionContextSchema,ne as SiteEditCompositionSelectorSchema,Qu as SiteEditConstraintKindSchema,bd as SiteEditDeletePageSourceOutputSchema,fg as SiteEditDynamicConfidenceSchema,yg as SiteEditDynamicDataBindingSchema,nr as SiteEditDynamicDataDetailSchema,sr as SiteEditDynamicDataSummarySchema,bg as SiteEditDynamicEvidenceSchema,tr as SiteEditDynamicSourceKindSchema,hg as SiteEditDynamicSourceTypeSchema,Sg as SiteEditDynamicTargetKindSchema,Ig as SiteEditEffectiveWriteTargetSchema,Ms as SiteEditElementPropertySchema,kT as SiteEditEventSchema,ti as SiteEditExternalSourceKindSchema,rI as SiteEditGetClassNameSourceCommandResultSchema,aI as SiteEditGetClassNameSourceInputSchema,oI as SiteEditGetClassNameSourceResultSchema,tk as SiteEditGetDocumentInputSchema,nk as SiteEditGetObjectEditContextInputSchema,jx as SiteEditGetSourceFileInputSchema,Dx as SiteEditGetSourceTreeInputSchema,iI as SiteEditGetStyleContextInputSchema,qn as SiteEditHistoryProvenanceSchema,sg as SiteEditHistoryReadOnlyRecoveryStatusSchema,Ju as SiteEditHistoryRecoveryCodeSchema,eg as SiteEditHistoryRecoveryDiagnosticSchema,DT as SiteEditHistoryResultSchema,CT as SiteEditHistoryStatusModeSchema,ag as SiteEditHistoryStatusSchema,tg as SiteEditHistoryUnavailableReasonSchema,ig as SiteEditHistoryUnavailableStatusSchema,ng as SiteEditHistoryWritableStatusSchema,Sk as SiteEditInitializeSessionInputSchema,hd as SiteEditInsertNodeSpecSchema,fd as SiteEditInsertPageResourceOutputSchema,op as SiteEditMaterializationDataRequirementsSchema,ap as SiteEditMaterializationEntrySchema,ip as SiteEditMaterializationExportSchema,sp as SiteEditMaterializationFileSchema,Oa as SiteEditMaterializationPathTemplateSchema,ot as SiteEditMaterializationSchema,Io as SiteEditMoveTargetSchema,Ft as SiteEditMutationContextSchema,Fn as SiteEditNodeCapabilitySnapshotSchema,ik as SiteEditObjectCapabilitiesSchema,ok as SiteEditObjectDetailSchema,ck as SiteEditObjectEditContextSchema,mk as SiteEditObjectStyleDetailSchema,rk as SiteEditObjectSummarySchema,LI as SiteEditOperationCommandResultSchema,Po as SiteEditOperationErrorCodeSchema,wo as SiteEditOperationErrorSchema,yd as SiteEditOperationOutputSchema,Sd as SiteEditOperationParamsSchema,qs as SiteEditOperationPayloadSchema,Fs as SiteEditOperationRequestSchema,_d as SiteEditOperationResultTargetSchema,Ao as SiteEditOperationSelectionRefSchema,_g as SiteEditOperationSummarySchema,gd as SiteEditOperationTargetSchema,Kt as SiteEditOperationTypeSchema,Eo as SiteEditOperationValueSchema,EI as SiteEditPageCompositionAnyVersionSchema,Zp as SiteEditPageCompositionAtomicKindSchema,nd as SiteEditPageCompositionBoundaryModeSchema,Bp as SiteEditPageCompositionBusinessMemberSchema,Kp as SiteEditPageCompositionContainerSchema,Gt as SiteEditPageCompositionDiagnosticSchema,An as SiteEditPageCompositionErrorCodeSchema,ho as SiteEditPageCompositionPlacementTargetSchema,Wp as SiteEditPageCompositionPlacementUnitSchema,Xp as SiteEditPageCompositionRuntimeRefSchema,Yp as SiteEditPageCompositionSchema,Qp as SiteEditPageCompositionSourceMemberKindSchema,zp as SiteEditPageCompositionSourceMemberSchema,yo as SiteEditPageCompositionSourceRangeSchema,$p as SiteEditPageCompositionSupportedSchema,Hp as SiteEditPageCompositionUnsupportedSchema,td as SiteEditPageCompositionV2BusinessMemberSchema,Jp as SiteEditPageCompositionV2ContainerSchema,id as SiteEditPageCompositionV2PlacementRelationSchema,od as SiteEditPageCompositionV2PlacementSchema,sd as SiteEditPageCompositionV2PlacementUnitSchema,ld as SiteEditPageCompositionV2Schema,ed as SiteEditPageCompositionV2SourceMemberSchema,cd as SiteEditPageCompositionV2SupportedSchema,md as SiteEditPageCompositionV2UnsupportedSchema,ad as SiteEditPageCompositionV2WriteModeSchema,rd as SiteEditPageCompositionVisualAnchorSchema,Vp as SiteEditPagePlacementOptionSchema,_o as SiteEditPagePlacementSchema,fo as SiteEditPageUnitResultTargetSchema,So as SiteEditPageUnitTargetSchema,cg as SiteEditPatchPlanPatchSchema,MT as SiteEditPatchPlanSchema,Ht as SiteEditProvenanceChainSchema,Rg as SiteEditProvenanceHopSchema,sk as SiteEditRenderDocumentSchema,$t as SiteEditRenderEntryRefSchema,xg as SiteEditRenderEntrySchema,er as SiteEditRenderPageCompositionSchema,ug as SiteEditRenderPageCompositionSupportedSchema,gg as SiteEditRenderPageCompositionUnsupportedSchema,dg as SiteEditRenderPagePlacementSchema,uI as SiteEditRequiredMutationContextEnvelopeSchema,Nx as SiteEditResolveSourceLocationInputSchema,ar as SiteEditSemanticSourceSchema,NI as SiteEditSignedOperationRequestSchema,pa as SiteEditSourceDeleteCapabilitySchema,Xm as SiteEditSourceDirectoryPathSchema,tl as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,nl as SiteEditSourceFileBinaryResponseSchema,vx as SiteEditSourceFileKindSchema,Qm as SiteEditSourceFileListItemSchema,Ox as SiteEditSourceFileResponseSchema,el as SiteEditSourceFileTextResponseSchema,Us as SiteEditSourceIdentitySchema,sl as SiteEditSourceLocationRangeSchema,Lx as SiteEditSourceLocationSchema,kg as SiteEditSourceLocatorRangeSchema,si as SiteEditSourceLocatorSchema,pe as SiteEditSourcePathSchema,da as SiteEditSourceTreeNodeSchema,Cx as SiteEditSourceTreeResponseSchema,Zm as SiteEditSourceTreeTruncationReasonSchema,Jm as SiteEditSourceTreeTruncationSchema,ko as SiteEditStyleBreakpointSchema,ak as SiteEditStyleModelSchema,Ro as SiteEditStylePropertySchema,or as SiteEditStyleSourceSchema,To as SiteEditStyleStateModeSchema,ni as SiteEditTextSegmentSchema,ir as SiteEditTextSourceSchema,Eg as SiteEditWriteTargetSchema,Ny as SiteExtraRequirementResponseSchema,Cm as SiteExtraRequirementSchema,I as SiteIdSchema,de as SiteLocaleSchema,Gv as SiteMediaIntentSchema,by as SiteOperationLockIdSchema,l_ as SitePreviewActivateErrorCodeSchema,d_ as SitePreviewActivateFailedSchema,p_ as SitePreviewActivateReadySchema,h1 as SitePreviewActivateResponseSchema,Dw as SitePublishDomainCheckDataSchema,Cw as SitePublishDomainCheckRequestSchema,jw as SitePublishDomainCheckResponseSchema,Ow as SitePublishDomainOperationDataSchema,Nw as SitePublishDomainOperationResponseSchema,Lw as SitePublishDomainReconcileOperationResponseSchema,hc as SitePublishQualityTaskStatusSchema,xw as SitePublishWorkflowActiveResponseSchema,na as SitePublishWorkflowIdSchema,MS as SitePublishWorkflowMutationDataSchema,Ew as SitePublishWorkflowMutationResponseSchema,US as SitePublishWorkflowPublishDataSchema,Iw as SitePublishWorkflowPublishResponseSchema,FS as SitePublishWorkflowQualityDataSchema,Rw as SitePublishWorkflowQualityResponseSchema,ut as SitePublishWorkflowRecordSchema,yw as SitePublishWorkflowRevisionRequestSchema,AS as SitePublishWorkflowStatusSchema,vS as SitePublishWorkflowStepSchema,nt as SiteRecordSchema,xy as SiteTemplateUpgradeStateIdSchema,ea as SiteVersionIdSchema,Tf as SiteVersionListItemSchema,is as SiteVersionRecordSchema,Oe as SiteWorkflowIdSchema,Kd as SiteWorkflowRecordSchema,tR as SiteWorkflowSnapshotResponseSchema,Ws as SiteWorkflowSnapshotSchema,Od as SiteWorkflowStatusSchema,sa as SiteWorkflowTaskRefIdSchema,nR as SiteWorkflowTaskRefResponseSchema,qo as SiteWorkflowTaskRefSchema,Qv as SitemapAddBlockInputSchema,Vi as SitemapAnswerSchema,Yv as SitemapChangeBlockVariantInputSchema,rb as SitemapDeleteBlockInputSchema,Xf as SitemapDraftBlockSchema,Qf as SitemapDraftPageSchema,yb as SitemapDraftRecordSchema,on as SitemapDraftSchema,ob as SitemapEditActorSchema,lb as SitemapEditErrorCodeSchema,db as SitemapEditFailureSchema,mb as SitemapEditOperationSchema,Jv as SitemapEditResultSchema,pb as SitemapEditSuccessSchema,tC as SitemapGenerationInputSchema,Sb as SitemapGenerationOutcomeSchema,fb as SitemapGenerationReasonSchema,mm as SitemapGenerationStageSchema,ke as SitemapIdSchema,ub as SitemapIntentPageSchema,$v as SitemapModelOutputSchema,Jf as SitemapModelPageSchema,Hv as SitemapMoveBlockInputSchema,Hf as SitemapNavigationHrefSchema,xe as SitemapNodeIdSchema,gm as SitemapRecordSchema,Wv as SitemapResolverModelOutputSchema,Bv as SitemapResolverRequestSchema,Vv as SitemapResolverResponseSchema,ab as SitemapResolverTargetsSchema,cm as SitemapRunInputSchema,wt as SitemapSchema,tb as SitemapSourceProvenanceSchema,nC as SitemapStreamEventSchema,wP as SitemapTaskCreateRequestSchema,jP as SitemapTaskCreateResponseSchema,Zh as SitemapTaskFailureErrorCodeSchema,OP as SitemapTaskResponseSchema,cb as SitemapUpdateBlockInstructionInputSchema,Xv as SitemapUpdateBlockPropsInputSchema,jf as SitemapUserChoiceSchema,Pt as SkillSelectionSchema,Nf as SkillSelectionSourceSchema,xm as SnapshotContentHashSchema,Se as SnapshotFilePathSchema,x as SnapshotIdSchema,We as SnapshotRecordSchema,Hc as SnapshotStatusSchema,ji as StartGscAuthDataSchema,bc as StartGscAuthRequestSchema,yc as StartGscAuthResponseSchema,pR as StartSiteBuildRequestSchema,k1 as StartSiteBuildResponseSchema,f_ as StartSiteBuildResultSchema,fw as StartSitePublishWorkflowRequestSchema,RC as StartWorkspaceRunRequestSchema,TC as StartWorkspaceRunResponseSchema,hu as Step2FinalResultDataSourceSchema,On as Step2FinalResultRequestSchema,AR as Step2FinalResultResponseSchema,wR as Step2FinalResultSaveResponseSchema,_u as Step2FinalResultSaveResultSchema,Hs as Step2FinalResultTypeSchema,fu as Step2FinalResultViewSchema,Wo as Step2FinalScanCardKeySchema,Ys as Step2FinalScanCardSchema,gu as Step2FinalScanResultSchema,Yt as Step2KnowledgeOpaqueIdSchema,j1 as Step2KnowledgeScopeSchema,He as Step2PageRoleSchema,DR as Step2PageSelectionRequestSchema,jR as Step2PageSelectionResponseSchema,pu as Step2SiteInitializationCrawlerErrorCodeSchema,lu as Step2SiteInitializationStatusSchema,PR as Step2SiteInitializationTaskResponseSchema,du as Step2SiteInitializationTaskSchema,Xs as Step3AgentAnalysisSchema,Tu as Step3AnalysisFindingSchema,qR as Step3AnalysisJobResponseSchema,Yo as Step3AnalysisJobSchema,$o as Step3AnalysisJobStatusSchema,GR as Step3AnalysisLatestResponseSchema,Vo as Step3AnalysisProgressSchema,wu as Step3AnalysisResultSchema,FR as Step3AnalysisScheduleResponseSchema,Ru as Step3AnalysisScheduleSchema,KR as Step3AnalysisSseFrameSchema,MR as Step3AnalysisStartRequestSchema,Ho as Step3AnalysisSummarySchema,Iu as Step3AnalystSchema,UR as Step3AnalystsResponseSchema,VR as Step4DiagnosisResponseSchema,xn as Step5ActiveStrategyKeySchema,oE as Step5CommitStrategyRequestSchema,rE as Step5CommitStrategyResponseSchema,$l as Step5CommittedVersionSchema,Aa as Step5DecisionCustomPayloadInputSchema,zl as Step5DecisionCustomPayloadSchema,fl as Step5EvidenceReferenceSchema,Dl as Step5GenerationStatusSchema,Ol as Step5GeoQuestionSchema,Wl as Step5JobStatusSchema,Kl as Step5LegacyDecisionCustomPayloadInputSchema,Gl as Step5LegacyDecisionCustomPayloadSchema,Ul as Step5LegacySeoKeywordInputSchema,wa as Step5LegacySeoKeywordSchema,Rn as Step5MarketCountrySchema,In as Step5MarketTypeSchema,ys as Step5OutputLocaleSchema,sE as Step5RegenerateItemRequestSchema,iE as Step5SaveDecisionRequestSchema,aE as Step5SaveDecisionResponseSchema,Tl as Step5SemrushEmptyReasonCodeSchema,Rl as Step5SemrushIntentGroupSchema,wl as Step5SemrushKeywordCandidateSchema,Al as Step5SemrushKeywordCandidateSearchDataSchema,Xx as Step5SemrushKeywordCandidateSearchRequestSchema,Qx as Step5SemrushKeywordCandidateSearchResponseSchema,Il as Step5SemrushKeywordRecommendationSchema,Cl as Step5SemrushKeywordSelectionDataSchema,vl as Step5SemrushKeywordSelectionItemSchema,Zx as Step5SemrushKeywordSelectionRequestSchema,Jx as Step5SemrushKeywordSelectionResponseSchema,El as Step5SemrushRecommendationSeedSchema,Pl as Step5SemrushRecommendationSnapshotSchema,bl as Step5SemrushRecommendationStatusSchema,Ta as Step5SemrushSearchIntentSchema,kl as Step5SemrushSelectionSummarySchema,Fl as Step5SemrushSnapshotRefSchema,Pa as Step5SeoGeoPlanRowSchema,Tn as Step5SeoKeywordSchema,ql as Step5SeoPayloadV2InputSchema,Es as Step5SeoPayloadV2Schema,gb as Step5SitemapDecisionSchema,hb as Step5SitemapRunInputSchema,_b as Step5SitemapSourceSchema,eC as Step5SitemapStartRequestSchema,tE as Step5StartStrategyRequestSchema,nE as Step5StartStrategyResponseSchema,Bl as Step5StrategyDecisionInputSchema,Is as Step5StrategyDecisionSchema,xs as Step5StrategyItemSchema,va as Step5StrategyJobSchema,En as Step5StrategyKeySchema,ft as Step5StrategyOptionIdSchema,Ss as Step5StrategyOptionSchema,Sl as Step5StrategyPlanSchema,Hl as Step5StrategySnapshotDataSchema,mE as Step5StrategySseFrameSchema,Vl as Step5StrategyVersionSnapshotSchema,F_ as Step6AiThemeCandidateSchema,Wn as Step6ColorSeedsSchema,_0 as Step6DesignRecommendationGenerationInputSchema,h0 as Step6DesignRecommendationModelOutputSchema,q_ as Step6DesignRecommendationSchema,p0 as Step6DesignRecommendationsRequestSchema,d0 as Step6DesignRecommendationsResponseSchema,jr as Step6DesignSelectionSchema,Dr as Step6GeneratedThemeCardSchema,vk as SubsiteGlossariesSchema,zg as SubsiteGlossaryEntrySchema,Gn as SubsiteHexColorSchema,$k as SubsiteMountPathSchema,Dk as SubsitePaletteLocalizationSchema,Bg as SubsitePaletteModeSchema,Wg as SubsitePaletteSeedsSchema,Ck as SubsiteSiteInfoSchema,Mk as SubsiteSyncDiffComputeRequestSchema,Uk as SubsiteSyncDiffComputeResponseSchema,Yg as SubsiteSyncDiffErrorCodeSchema,Fk as SubsiteSyncDiffErrorResponseSchema,zk as SubsiteVisibleTextExportRequestSchema,Bk as SubsiteVisibleTextExportResponseSchema,vd as TASK_EXECUTION_STATUSES,Uo as TASK_EXECUTION_STATUS_CODES,Sv as TEMPLATE_UPGRADE_LOCK_LOST_ERROR_CODE,ui as THEME_PRESETS,kr as THEME_PRESET_IDS,Oo as TaskExecutionStatusSchema,r_ as TemplateUpgradeCasOutcomeSchema,mr as TemplateUpgradeErrorCodeSchema,c_ as TemplateUpgradeOutcomeCountsSchema,a_ as TemplateUpgradeOutcomeSchema,m_ as TemplateUpgradeSnapshotDeletionCandidateSchema,Et as TemplateUpgradeStateSchema,t_ as TemplateUpgradeStatusSchema,o_ as TemplateUpgradeValidationStageSchema,De as TemplateVersionSchema,uv as TryAcquireTemplateUpgradeLockRequestSchema,gv as TryAcquireTemplateUpgradeLockResponseSchema,Uc as UnsplashDownloadLocationSchema,Mc as UnsplashMediaAssetSchema,qA as UpdateBriefRequestSchema,ev as UpdateBriefResponseSchema,pC as UpdateClarifyArchetypeRequestSchema,ov as UpdateCurrentSnapshotManifestRequestSchema,LE as UpdatePageDirectoryReconcileStateRequestSchema,bw as UpdateSitePublishWorkflowStepRequestSchema,FA as UpdateSiteRequestSchema,iR as UpdateSiteWorkflowWebsiteRequestSchema,u0 as UpdateStep6DesignSelectionRequestSchema,g0 as UpdateStep6DesignSelectionResponseSchema,cR as UpdateWorkflowTaskStatusRequestSchema,mf as UploadMediaLibraryAssetResponseSchema,cw as UpstreamPromptTemplateCatalogDataSchema,rw as UpstreamPromptTemplateConsumeDataSchema,Gh as UrlListCrawlerTaskCreateRequestSchema,Ey as UsageRecordIdSchema,df as UseUnsplashMediaRequestSchema,uf as UseUnsplashMediaResponseSchema,os as UserIdSchema,HS as VCP_GSC_STATES,Di as VcpGscStateSchema,NS as VcpQualityResultSchema,Mi as VisualHintsSchema,Df as VisualThemeSchema,eR as WORKFLOW_DEFINITIONS_V1,Bs as WORKFLOW_DEFINITION_REGISTRY,Pd as WORKFLOW_FLOW_TYPES,Nd as WORKFLOW_MENU_STATES,wd as WORKFLOW_NODE_CODES,Ad as WORKFLOW_TASK_TYPES,CC as WORKSPACE_WEBSOCKET_CONTRACT,Do as WorkflowClientCapabilitiesSchema,Fo as WorkflowDefinitionVersionSchema,vn as WorkflowFlowTypeSchema,Gd as WorkflowMenuItemSchema,Ld as WorkflowMenuStateSchema,zt as WorkflowNodeCodeSchema,jo as WorkflowTaskTypeSchema,Vb as WorkspaceClientMessageSchema,_f as WorkspaceDesignApplyRequestSchema,hf as WorkspaceDesignApplyResponseSchema,Hi as WorkspaceDiagnosticSchema,ty as WorkspaceDirectEditFileSchema,ey as WorkspaceDirectEditPathSchema,Tm as WorkspaceDirectEditPostActionSchema,OC as WorkspaceDirectEditRequestSchema,LC as WorkspaceDirectEditResponseSchema,Yi as WorkspaceExecutionDiagnosticsSchema,gC as WorkspaceExecutionPlanSchema,Jb as WorkspaceMediaRequestSchema,Zi as WorkspacePlanDependencySchema,Sm as WorkspacePlanSummarySchema,Ab as WorkspacePlanTaskKindSchema,Qi as WorkspacePlanTaskSchema,Ed as WorkspaceResourceKindSchema,Rd as WorkspaceResourceNavigationSelectionSchema,Co as WorkspaceResourceOperationClientMessageSchema,Id as WorkspaceResourceOperationSummarySchema,Td as WorkspaceResourceOperationTransientInputSchema,as as WorkspaceRunKindSchema,Wb as WorkspaceSelectedComponentSchema,Hb as WorkspaceServerMessageSchema,Zv as WorkspaceSitemapEditRequestSchema,Bb as WorkspaceSocketDescriptorSchema,ry as WorkspaceSourceFileBinaryResponseSchema,ay as WorkspaceSourceFileKindSchema,Pm as WorkspaceSourceFileListItemSchema,MC as WorkspaceSourceFilePathQuerySchema,UC as WorkspaceSourceFileResponseSchema,oy as WorkspaceSourceFileTextResponseSchema,km as WorkspaceSourcePathSchema,Ib as WorkspaceSuggestionSchema,_m as WorkspaceSuggestionsSchema,Rb as WorkspaceSuggestionsSourceSchema,fm as WorkspaceTaskCountsSchema,vC as WorkspaceWebSocketMessageSchema,AC as WorkspaceWebSocketMessageTypeSchema,Xi as WorkspaceWorkerGroupSchema,$i as WorkspaceWorkerPhaseSchema,_C as WorkspaceWorkerResultSchema,gt as WorkspaceWorkerStatusSchema,eT as assertDeploymentTransition,hR as assertSiteBuildStatusTransition,_R as assertTaskExecutionStatusTransition,tA as buildE2bBrowserPreviewUrl,S0 as buildStep6FallbackThemeCards,Ti as canonicalizeFormDesignJson,mw as canonicalizeLauncherPromptTemplateOperation,mo as canonicalizePageSlug,PE as cmsPagePreviewUrlPath,dE as compareTemplateVersions,FT as composeSiteEditRepeatInstanceKey,sP as computeFormDesignOperationFingerprint,ds as computeSiteEditCompositionKey,Gp as computeSiteEditSourceIdentityKey,mn as containsSensitiveData,Up as createSiteEditCommandFailureSchema,lo as createSiteEditCommandResultSchema,Ns as createSiteEditCommandSuccessSchema,b0 as defaultStep6Selection,QS as deriveVcpGscState,ZS as doesGscPropertyMatchDomain,$d as findWorkflowDefinition,Vd as findWorkflowDefinitionInRegistry,ci as fontStack,kh as formDesignOperationFingerprintInput,tT as getDeploymentHappyPathTransitions,ZR as getDeploymentTransitionPredecessors,QR as getDeploymentTransitionTargets,Er as getFontPairing,Tr as getMotionPreset,Ar as getSiteDesignThemeRadius,_s as getSiteEditSourceDeleteProtectionReason,e0 as getThemePreset,Hd as getWorkflowDefinition,uR as getWorkflowNodeIndex,wy as hasAnyBusinessFact,Ok as hasLockedSeeds,nP as hashAffectedFormDesignFiles,tP as hashCmsFormSchemaProjection,Yn as hashFormDesignJson,eP as hashFormSpec,ro as isCanonicalPageSlug,u_ as isCmsMainProductsWithinLimit,kE as isCmsPageSelectable,qa as isCmsTemplateUrlPath,ix as isConsentGranted,Bu as isDeploymentActiveStatus,JR as isDeploymentTerminalStatus,Ug as isExactEditEngineVersion,zy as isExternalSiteEditInfrastructureReason,F0 as isFormSpecLocalizableFieldPath,cE as isKnownStep5SseEventName,_T as isMigrationProductsPresetBlockLabel,gT as isMigrationProductsPresetPageTitle,zx as isNonLatinSiteLocale,hP as isPlatformMaterializedFile,e_ as isReservedSubsiteMountSegment,np as isSiteEditMaterializationPathTemplate,Og as isSiteEditRuntimeContainerTag,Ng as isSiteEditRuntimeTextTag,pk as isSiteEditRuntimeVoidElementTag,Mx as isSiteEditSourceDeleteProtectedPath,il as isSiteEditSourceDirectoryPath,ua as isSiteEditSourcePath,gs as isSiteEditTextSourcePath,pP as isSiteStructureKnownFieldPath,lP as isSiteStructureLocalizableFieldPath,ka as isStep5SeoAllowedIntentCode,gR as isWorkflowTaskTypeForNode,lg as makeSiteEditRepeatInstanceKey,uT as migrationProductsCopyForLocale,EP as normalizeCmsPublicApiBase,qr as normalizeFormOptionLabelIdentity,cn as normalizeGscDomain,Ca as normalizeStep5SeoKeyword,Lp as pageSlugToRouteFilePath,wE as parseCmsPageDirectory,aT as parseComponentI18nResourcesJson,JS as parseE2bPreviewProxyDomain,Fg as parseExactEditEngineVersion,kx as parseSiteEditCompositionKey,pg as parseSiteEditRepeatInstanceKey,hI as parseSiteEditSourceIdentityKey,W0 as projectFormSpecToCmsSchema,ef as reconcileSitemapNavigation,T_ as resolveFont,P_ as resolveFontDisplayName,B0 as resolveFormTemplateText,dR as resolvePublishedWorkflowDefinition,Fy as resolveRedisConnectionConfig,kk as resolveRequestedEditEngineVersion,fa as resolveSelectableSiteLocale,dk as resolveSiteEditRuntimeOperationSummary,Kx as resolveSiteLocaleFromIso6393,Gx as resolveSiteTextDirection,G_ as resolveStep6RadiusId,Pk as resolveSystemCurrentEditEngineVersion,Yd as selectPublishedWorkflowDefinition,px as selectReferenceVisualImage,VI as siteBuildStatusFromCode,XI as siteBuildStatusToCode,$I as siteDeploymentStatusFromCode,QI as siteDeploymentStatusToCode,j_ as siteFontVariables,HI as siteWorkflowStatusFromCode,ZI as siteWorkflowStatusToCode,Kg as splitSubsiteGlossaryEntry,qT as stripSiteEditRepeatInstanceKeys,YI as taskExecutionStatusFromCode,JI as taskExecutionStatusToCode,f0 as toStep6GenerationVisualHints,co as tryCanonicalizeAsciiPageSlug,Zo as validateComponentI18nResources,q0 as validateFormSpecIdentityTransition};
1
+ import{z as e}from"zod";import{z as vm}from"zod";var G=vm.uuidv7(),rs=G,fy=G,by=G,yy=G,xy=G,Ey=G,Iy=G,I=G,ht=G,Ji=G,ke=G,cs=G,x=G,ea=G,V=G,ta=G,pn=G,qe=G,Ry=G,Ty=G,na=G,Ne=G,sa=G,ky=G,Py=G,wy=G,at=G,Ay=G,vy=G,Cy=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 Oy(t){return Object.values(t).some(n=>typeof n=="string"&&n.trim().length>0)}import{z as Dt}from"zod";import{z as ms}from"zod";var L=t=>ms.object({code:ms.number().int(),data:t,message:ms.string()});var St=2e3,Cm=Dt.object({note:Dt.string().trim().max(St),updated_at:Dt.string().min(1)}).strict(),qy=Dt.object({note:Dt.string().trim().max(St)}).strict(),Gy=L(Cm.nullable());import{z as jt}from"zod";var Dm=40,ot=jt.object({protocol:jt.enum(["phone","form","download","route","external"]),ctaLabel:jt.string().min(1).max(Dm),ctaTarget:jt.string().min(1).max(200).optional(),requiresOwnerDetail:jt.boolean().optional()});var ft=["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 Wy(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:jm(t.VCP_REDIS_PORT,56379)}}function jm(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,Om=4e3,ra=Y.enum(["succeeded","degraded","no_changes","failed"]),Ot=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"]),Nm=["sandbox_unavailable"];function Yy(t){return t!=null&&Nm.includes(t)}var Lm=Y.enum(["pending","delivered","failed"]),Mm=Y.enum(["running","succeeded","degraded","no_changes","failed"]),Xy=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(Om)}).strict(),ca=Y.object({id:oa,site_id:I,external_run_id:Y.string().min(1),external_thread_id:Y.string().min(1),status:Mm,outcome:ra.nullable(),degraded_reason:Ot.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:Lm,created_at:Y.string().min(1),started_at:Y.string().min(1).nullable(),finished_at:Y.string().min(1).nullable()}).strict(),Qy=Y.object({task:ca}).strict(),Zy=Y.object({task:ca}).strict(),Jy=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:Ot.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(),ex=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"]),Um=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:at,quote:D.string().min(1).max(500),trust:D.enum(["verbatim","ocr"]).default("verbatim")}),qm=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:at,nav_structure:D.array(D.string().min(1).max(30)).max(12),page_patterns:D.array(qm).max(10),tone:D.array(D.string().min(1).max(20)).max(8),screenshot_ref:D.string().optional()}),Gm=D.object({source_id:at,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:at})).min(2)}),zm=D.object({type:D.literal("text"),content:D.string().min(20).max(1e4),title:D.string().min(1).max(120).optional()}).strict(),Km=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(),ix=D.discriminatedUnion("type",[zm,Km]),ax=[".docx",".html",".md",".txt"],ox=["application/vnd.openxmlformats-officedocument.wordprocessingml.document","text/html","text/markdown","text/x-markdown","text/plain","application/octet-stream"],rx=10*1024*1024,cx=2,mx=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 lx(t){return t===!0||t==="true"}var px=[".png",".jpg",".jpeg",".webp"],dx=["image/png","image/jpeg","image/webp","application/octet-stream"],ux=8*1024*1024,gx=10,Bm=D.enum(["asset","reference"]),_x=D.object({image_role:Bm,title:D.string().min(1).max(120).optional()}).strict(),hx=D.object({version:D.literal(1),site_id:I,tenant_id:D.string().min(1),user_prompt:D.string(),status:Um,sources:D.array(Gm).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 Sx(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 #"}),Wm=X.object({template_id:Ie,safe_name:X.string().min(1),entry_file:X.string().min(1),kind:X.enum(["default","additional"])}).strict(),xx=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(Wm).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"})}),Ex=X.object({page_path:hn,template_id:Ie,instruction:X.string().min(1)}).strict(),ma=t=>[...new Set(t)],Ix=X.object({page_path:hn,template_id:Ie,exit_template_ids:X.array(Ie).default([]).transform(ma)}).strict(),Rx=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")},Tx=X.object({...ds,template_id:Ie,status:X.literal("created")}).strict(),kx=X.object({...ds,promoted_template_id:Ie,deleted_template_ids:X.array(Ie),status:X.literal("promoted")}).strict(),Px=X.object({...ds,deleted_template_ids:X.array(Ie),status:X.literal("cleaned")}).strict(),wx=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 Dx(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 Vm=["design.md","DESIGN.md"],la=["components/site","src/components/site","lib/generated","src/lib/generated","public"],Hm=["app/globals.css","src/app/globals.css"],$m=[".cjs",".css",".cts",".html",".js",".json",".jsx",".md",".mdx",".mjs",".mts",".ts",".tsx",".txt",".yaml",".yml"],Ym=new Set($m),gs="source-delete",pa=v.literal(gs),pe=v.string().min(1).refine(ua,"Invalid site edit source path"),Xm=v.string().min(1).refine(il,"Invalid site edit source directory path"),Lx=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(),Qm=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:Xm,children:v.array(da)}),v.object({kind:v.literal("file"),name:v.string().min(1),path:pe,file:Qm}).superRefine((t,n)=>{t.path!==t.file.path&&n.addIssue({code:"custom",path:["file","path"],message:"file.path must match node path"})})])),Zm=v.enum(["max-files","max-depth","max-total-bytes"]),Jm=v.object({reasons:v.array(Zm).min(1),maxFiles:v.number().int().positive(),maxDepth:v.number().int().positive(),maxTotalBytes:v.number().int().positive()}),Mx=v.object({composition:M,nodes:v.array(da),defaultPath:pe.optional(),totalFiles:v.number().int().nonnegative(),truncated:Jm.optional()}).strict(),Ux=v.object({composition:ne}).strict(),Fx=v.object({path:pe,composition:ne}).strict(),el=fn.extend({kind:v.literal("text"),language:v.string().min(1),readonly:v.boolean().default(!1),content:v.string()}),tl=v.enum(["too-large","unsupported-mime","bytes-unavailable"]),nl=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:tl.optional()}),qx=v.discriminatedUnion("kind",[el,nl]),Gx=v.object({key:v.string().min(1),composition:ne}).strict(),sl=v.object({startLine:v.number().int().positive(),startColumn:v.number().int().nonnegative(),endLine:v.number().int().positive(),endColumn:v.number().int().nonnegative()}),zx=v.object({key:v.string().min(1),composition:M,sourceFile:pe,componentName:v.string().min(1),openingElementRange:sl,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)||Ym.has(al(t))}function il(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 Kx(t){return hs(t)!==null}function ga(t){return/^(?:src\/)?app\/(?:.*\/)?page\.[cm]?[jt]sx?$/.test(t.toLowerCase())}function _a(t){return Hm.some(n=>n.toLowerCase()===t.toLowerCase())}function al(t){let n=t.split("/").at(-1)??t,s=n.lastIndexOf(".");return s>0?n.slice(s).toLowerCase():""}function Ss(t){return!t.includes("/")&&Vm.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 ol}from"zod";var Nt=["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"],rl=["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"],cl=[...Nt,...rl],ml=new Set(["ar","fa","he"]),Vx=[{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"}],ll={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"},pl=new Set(Nt);function fa(t){return pl.has(t)?t:ll[t]}var dl="en";function Hx(t){let n=t.toLowerCase().split("-",1)[0]??"";return ml.has(n)?"rtl":"ltr"}var ul={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 $x(t){return ul[t]??dl}var gl=["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"],_l=new Set(gl);function Yx(t){return _l.has(t)}var de=ol.enum(cl);import{z as hl}from"zod";var ba=hl.string().uuid();import{z as o}from"zod";var re=o.string().trim().min(1).max(128),$e=o.string().trim().min(1).max(200),De=o.string().trim().min(1).max(2e3),bs=o.string().trim().max(200),Lt=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"]),rt=["market","persona","product","brand","competition","structure","language","seogeo","content","conversion","risk"],fe=rt.length,En=o.enum(rt),In=En,Ia=["recommended","conservative","focused"],bt=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:$e,name_en:$e,region:$e}).strict(),fs=o.object({id:bt,label:$e,note:De,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(),Sl=o.object({lead:o.string().trim().min(1).max(500),title:$e,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."})})}),fl=o.object({goal:De,issue:De,criteria:o.array(De).min(1).max(12),resources:o.array(De).min(1).max(12),risks:o.array(De).min(1).max(12),execution:o.object({standard:o.array(De).min(1).max(12),acceptance:o.array(De).min(1).max(12),downstream:o.array(De).min(1).max(12)}).strict()}).strict(),bl=o.object({source_type:o.enum(["step2","step3"]),source_id:re,field_path:o.string().trim().max(300).nullish()}).strict(),yl=o.enum(["ready","disabled","empty","timeout","rate_limited","quota_exhausted","failed"]),xl=["INFORMATIONAL","NAVIGATIONAL","COMMERCIAL","TRANSACTIONAL"],Ra=o.enum(xl),bn=50,yn=60,ya=7,tE=["COMMERCIAL","TRANSACTIONAL"],El=["C","T"];function Ta(t){return El.includes(t)}var Il=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(),Rl=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(),Tl=o.object({id:re,intent:Ra,title:$e,landing_page_type:o.enum(["blog","product","category","landing"]),keywords:o.array(Rl).min(1).max(100)}).strict(),kl=o.enum(["NO_SEEDS","NO_PROVIDER_CANDIDATES","NO_METRIC_ELIGIBLE_CANDIDATES","NO_COMMERCIAL_INTENT_CANDIDATES","NO_FIT_ELIGIBLE_CANDIDATES"]),Pl=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:Lt,status:yl,seeds:o.array(Il).max(20),intent_groups:o.array(Tl).max(16),selection_summary:Pl.optional(),empty_reason_code:kl.nullish(),error_code:o.string().trim().regex(/^[A-Z0-9_]+$/).max(64).nullish()},wl=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,Al=o.union([o.literal(ka),o.literal(1)]),nE=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:Al.default(ka)}).strict(),vl=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(),Cl=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(vl).max(100),result_count:o.number().int().nonnegative()}).strict(),sE=o.object({code:o.literal(0),message:o.string(),data:Cl}).strict(),iE=o.object({snapshot_id:o.string().uuid(),selected_keywords:o.array(o.string().trim().min(2).max(160)).min(1).max(50)}).strict(),Dl=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(),jl=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(Dl).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."})}),aE=o.object({code:o.literal(0),message:o.string(),data:jl}).strict(),Ol=o.enum(["ok","degraded"]),Nl=["category","selection","application","parameter","cost","trust","compliance","delivery"],Ll=o.object({id:re,question:o.string().trim().min(8).max(300).refine(t=>/^[\x20-\x7E]+$/.test(t)),question_type:o.enum(Nl),intent_strength:o.enum(["high","medium","low"]),source:o.literal("ai_generation")}).strict(),xs=o.object({key:In,position:o.number().int().min(1).max(fe),category:$e,title:$e,summary:De,rationale:De,parameter:o.string().trim().max(500).nullish(),options:o.tuple([fs,fs,fs]),plan:Sl.nullish(),structure_detail:fl.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(bl).min(1).max(8),semrush_recommendations:wl.nullish(),seo_payload:o.lazy(()=>Es).nullish(),geo_questions:o.array(Ll).max(20).optional(),generation_status:Ol.optional()}).loose().superRefine((t,n)=>{let s=rt.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,Pa=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(),Ml=2,Ul=1,oE=20,Fl=50,wa=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(),ql=wa.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=Ca(t.keyword);t.normalized_keyword!==s&&n.addIssue({code:"custom",path:["normalized_keyword"],message:"normalized_keyword must match the canonical keyword form."})}),Gl=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(Ml),seo_keywords:o.array(kn).min(Ul).max(Fl),semrush_snapshot_refs:o.array(Gl).max(20).optional()}).strict().superRefine(Jl),zl=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."})})}),Kl=o.object({rows:o.array(Pa).max(100).optional(),seo_keywords:o.array(wa).max(100).optional()}).strict(),Bl=o.object({rows:o.array(Pa).max(100).optional(),seo_keywords:o.array(ql).max(100).optional()}).strict(),Wl=o.union([Es,Kl]),Aa=o.union([zl,Bl]),Vl=o.object({item_key:En,selected_option_id:bt,note:bs,custom_payload:Aa.optional()}).strict().superRefine((t,n)=>{t.item_key==="seogeo"&&t.custom_payload&&!("schema_version"in t.custom_payload)&&Zl(t.custom_payload,n)}),Is=o.object({item_key:En,selected_option_id:bt,note:bs,custom_payload:Wl.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(),Hl=o.enum(["running","succeeded","failed"]),$l=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(),Yl=o.object({strategy_version_id:re,site_id:re,source_job_id:re,output_locale:ys.optional(),version:o.number().int().positive(),checksum:Lt,snapshot:$l,committed_at:o.string().datetime({offset:!0})}).loose(),va=o.object({job_id:re,site_id:re,output_locale:ys.optional(),status:Hl,revision:o.number().int().nonnegative(),items:o.array(xs).max(fe),decisions:o.array(Is).max(fe),output_checksum:Lt.nullish(),error_code:o.string().trim().max(64).nullish(),error_message:o.string().trim().max(500).nullish(),committed_version:Yl.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."})}),rE=o.object({force_refresh:o.boolean().optional().default(!1)}).strict(),cE=va.extend({cached:o.boolean()}).strict(),mE=o.object({expected_revision:o.number().int().nonnegative()}).strict(),lE=o.object({expected_revision:o.number().int().nonnegative(),selected_option_id:bt,note:bs,custom_payload:Aa.optional()}).strict(),pE=o.object({revision:o.number().int().positive(),decision:Is}).strict(),dE=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!==rt.length&&n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit must contain ${fe} unique decisions.`}),rt.forEach(a=>{s.includes(a)||n.addIssue({code:"custom",path:["decisions"],message:`Step5 commit is missing ${a}.`})})}),uE=o.object({strategy_version_id:re,version:o.number().int().positive(),checksum:Lt,next_path:o.string().trim().min(1).max(500)}).strict(),Xl=va.extend({completed:o.number().int().min(0).max(fe),total:o.literal(fe)}).loose(),Ql=["snapshot","strategy_item_start","strategy_item_done","strategy_items_invalidated","strategy_generation_done","failed"];function gE(t){return typeof t=="string"&&Ql.includes(t)}var _E=o.discriminatedUnion("event",[o.object({id:o.number().int().nonnegative(),event:o.literal("snapshot"),data:Xl}).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:Lt}).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 Zl(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 Ca(t){return t.normalize("NFKC").trim().replace(/\s+/g," ").toLowerCase()}function Jl(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<bn)&&n.addIssue({code:"custom",path:["seo_keywords",r,"monthly_volume"],message:`Selected SEO keywords require monthly_volume >= ${bn}.`}),(i.keyword_difficulty===null||i.keyword_difficulty>yn)&&n.addIssue({code:"custom",path:["seo_keywords",r,"keyword_difficulty"],message:`Selected SEO keywords require keyword_difficulty <= ${yn}.`}),(i.fit===null||i.fit<ya)&&n.addIssue({code:"custom",path:["seo_keywords",r,"fit"],message:`Selected SEO keywords require fit >= ${ya.toFixed(1)}.`})});let a=new Set((t.semrush_snapshot_refs??[]).flatMap(i=>i.selected_keywords.map(Ca)));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 ep}from"zod";var je=ep.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 fE(t,n){let s=je.safeParse(t),a=je.safeParse(n);if(!s.success||!a.success)return null;let i=Da(s.data),r=Da(a.data);for(let c=0;c<3;c+=1){let g=ja(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?ja(BigInt(g),BigInt(j)):E?-1:O?1:tp(g,j)}return 0}function Da(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 ja(t,n){return t<n?-1:t>n?1:0}function tp(t,n){return t<n?-1:t>n?1:0}import{z}from"zod";import{z as be}from"zod";var Rs=64,np=512*1024,Ts=4*1024*1024,sp=/^(?!\/)(?!.*\\)(?!.*(?:^|\/)\.\.(?:\/|$))(?!.*\/\/).+/;function ip(t){return sp.test(t)}var Oa=be.string().min(1).refine(ip,{message:"Materialization pathTemplate must be a safe relative path."}),ap=be.object({pathTemplate:Oa,content:be.string(),role:be.string().min(1).optional()}).strict(),op=be.union([be.object({kind:be.literal("default")}).strict(),be.object({kind:be.literal("named"),name:be.string().min(1)}).strict()]),rp=be.object({pathTemplate:Oa,export:op}).strict(),cp=be.array(be.never()).optional(),ct=be.object({instanceBaseName:be.string().min(1),files:be.array(ap).min(1).max(Rs),entry:rp,dataRequirements:cp}).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>np&&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 Na="insertNewComponent",RE={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"),La=z.lazy(()=>z.object({id:z.string().uuid(),key:z.string().min(1),name:z.string(),children:z.array(La)}).strict()),Ma=z.object({category_group_key:z.literal(Na),categories:z.array(La)}).strict(),mp=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(),Ua=z.object({category_group_key:z.literal(Na),items:z.array(mp),next_cursor:z.string().min(1).nullable()}).strict(),TE=z.object({resource_id:z.string().min(1),resolved_version:ks,anchor_block_id:z.string().min(1),placement:z.enum(["before","after"])}).strict(),kE=z.object({status:z.literal("mock_acknowledged")}).strict(),PE=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"})}),mt=ks,wE=z.object({version:mt}).strict(),Fa=z.object({resource_id:z.string().min(1),resolved_version:mt,revision_id:z.string().uuid().optional(),digest_sha256:z.string().regex(/^[a-f0-9]{64}$/),materialization:ct}).strict();import{z as b}from"zod";import{z as h}from"zod";var Ka="/",Ba=255,lp=5e3,pp=64;function dp(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 Ge=h.string().min(1).max(Ba).refine(dp,"url_path must be a safe site-relative path"),As=h.string().max(Ba),Pn=h.preprocess(t=>t===0?!1:t===1?!0:t,h.boolean()),Mt=h.union([h.url(),Ge]),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 DE(t){return t.vcp_managed&&t.url!==null&&vs.safeParse(t.page_type).success&&Ge.safeParse(t.url_path).success}function qa(t){return t.includes("{")||t.includes("}")}function jE(t){if(!qa(t.url_path))return Ga(t.url_path);if(t.url===null)return null;let n=/^[a-z][a-z0-9+.-]*:\/\//iu.test(t.url)?up(t.url):t.url;return n===null||qa(n)?null:Ga(n)}function Ga(t){let n=Ge.safeParse(t);return n.success?n.data:null}function up(t){try{return new URL(t).pathname}catch{return null}}var Wa=h.lazy(()=>h.object({cms_page_id:h.number().int().positive(),title:h.string().trim().min(1).max(255),url_path:As,url:Mt.nullable(),page_type:Cs,vcp_managed:Pn,children:h.array(Wa)}).strict()),gp=h.object({group_id:h.string().min(1),title:h.string().trim().min(1).max(255),collection_slug:h.string(),pages:h.array(Wa)}).strict(),za=h.object({groups:h.array(gp)}).strict(),Va=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:Mt.nullable(),vcp_managed:Pn,children:h.array(Va)})),_p=h.object({plugin_id:h.number().int().nonnegative(),slug:h.string(),group_name:h.string().trim().min(1).max(255),pages:h.array(Va)}).passthrough(),hp=h.array(_p);function Ha(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=>Ha(n))}}function OE(t){if(!Sp(t))return null;let n=za.safeParse(t);if(n.success)return n.data;let s=hp.safeParse(t);if(!s.success)return null;let a=za.safeParse({groups:s.data.map(i=>({group_id:String(i.plugin_id),title:i.group_name,collection_slug:i.slug,pages:i.pages.map(Ha)}))});return a.success?a.data:null}function Sp(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>lp||i.depth>pp)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 fp=h.enum(["invalid_url_path","missing_url","not_vcp_managed","unsupported_page_type"]),bp=h.enum(["home_page","invalid_url_path","not_selectable","not_vcp_managed","page_has_children","last_selectable_page","cms_unbound","unsupported_page_type"]),$a=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:Ge.nullable(),url:Mt.nullable(),page_type:Cs,vcp_managed:h.boolean(),selectable:h.boolean(),disabled_reason:fp.nullable(),can_delete:h.boolean(),delete_block_reason:bp.nullable(),has_cms_children:h.boolean(),children:h.array($a)}).strict()),Ya=h.object({group_id:h.string().min(1),title:h.string().trim().min(1).max(255),pages:h.array($a)}).strict(),NE=h.object({base_snapshot_id:x,expected_url_path:Ge}).strict(),yp=h.enum(["succeeded","failed"]),xp=h.object({url_path:Ge,phase:h.enum(["ensure","binding","delete"]),code:h.string().min(1),message:h.string().min(1)}).strict(),Ds=h.object({status:yp,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(xp),warnings:h.array(h.string().min(1))}).strict(),Ep=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:Mt.nullable(),previous_url:Mt.nullable(),cms_reconcile_result:Ds}).strict(),LE=h.object({code:h.literal(0),message:h.string(),data:Ep}).strict(),ME=h.object({snapshot_id:x}).strict(),Ip=h.object({snapshot_id:x,warnings:h.array(h.string().min(1)),cms_reconcile_result:Ds}).strict(),UE=h.object({code:h.literal(0),message:h.string(),data:Ip}).strict(),FE=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"})}),Rp=vs,Tp=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(),Xa=h.object({url_path:Ge,title:h.string().trim().min(1).max(255),kind:Rp,route_file:h.string().min(1),collection_id:h.string().trim().min(1).optional(),seo:Tp.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===Ka)&&n.addIssue({code:"custom",path:["kind"],message:"The home target must be the only landing_page target."})}),kp=h.object({complete:h.literal(!0),targets:h.array(Xa)}).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===Ka).length!==1&&n.addIssue({code:"custom",path:["targets"],message:"A complete page target set must contain exactly one home page."})}),qE=h.discriminatedUnion("complete",[kp,h.object({complete:h.literal(!1),targets:h.array(Xa),errors:h.array(h.string().min(1)).min(1)}).strict()]),ws=h.string().regex(/^sha256:[0-9a-f]{64}$/),GE=h.object({projection_hash:ws.nullable()}).strict(),zE=h.object({expected_projection_hash:ws.nullable(),projection_hash:ws}).strict();var Qa="insertNewPage",$E={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"},lt=b.enum(["page","pages"]),Pp=b.object({resource_id:b.string().min(1),resource_type:lt,resolved_version:mt,template_page_id:b.string().min(1)}).strict(),Za=b.lazy(()=>b.object({id:b.string().uuid(),key:b.string().min(1),name:b.string(),children:b.array(Za)}).strict()),Ja=b.object({category_group_key:b.literal(Qa),categories:b.array(Za)}).strict(),wp=b.object({resource_id:b.string().min(1),resource_type:lt,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:mt,category_id:b.string().uuid().nullable()}).strict(),eo=b.object({category_group_key:b.literal(Qa),items:b.array(wp),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=mt,wn=b.string().regex(/^\/[a-z0-9]+(?:-[a-z0-9]+)*$/),XE=b.string().regex(/^\/(?:[a-z0-9]+(?:-[a-z0-9]+)*)?$/),Ap=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:wn}).strict(),vp=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),source:Pp.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:mt,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(),Cp=b.object({resource_id:b.string().min(1),resource_type:lt,resolved_version:Ut,pages:b.array(vp).min(1)}).strict().superRefine((t,n)=>{Ye(t.pages.map(s=>s.template_page_id),"pages",n),Ye(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 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 Ye(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 QE=b.object({resource_type:lt,version:Ut,pages:b.array(Ap).min(1)}).strict().superRefine((t,n)=>{js(t,n),Ye(t.pages.map(s=>s.template_page_id),"pages",n),Ye(t.pages.map(s=>s.final_route),"routes",n)}),Dp=b.object({instance_id:b.string().min(1),component_id:b.string().min(1)}).strict(),jp=b.object({component_id:b.string().min(1),materialization:ct}).strict(),Op=b.object({template_page_id:b.string().min(1),title:b.string().trim().min(1).max(120),final_route:wn,materialization:ct,components:b.array(Dp)}).strict(),Os=b.object({resource_id:b.string().min(1),resource_type:lt,resolved_version:Ut,revision_id:b.string().uuid().optional(),digest_sha256:b.string().regex(/^[a-f0-9]{64}$/),components:b.array(jp),pages:b.array(Op).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);Ye(s,"components",n),Ye(t.pages.map(i=>i.template_page_id),"pages",n),Ye(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)}}),to=Os,no=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(),Np=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(),so=b.object({resource_id:b.string().min(1),resource_type:lt,resolved_version:Ut,pages:b.array(Np).min(1)}).strict().superRefine((t,n)=>{js(t,n),Ye(t.pages.map(s=>s.template_page_id),"pages",n)}),ZE=b.object({resource_type:lt,version:Ut}).strict(),JE=b.object({draft:Cp}).strict(),io=b.object({groups:b.array(Ya)}).strict(),ao=b.object({candidate:b.record(b.string(),b.unknown())}).strict();var yt="[a-z0-9]+(?:-[a-z0-9]+)*",Ft=new RegExp(`^/(?:${yt}(?:/${yt})*)?$`),oo=["/privacy","/cookie-policy","/system/not-found"],Lp=oo.map(t=>`app/${t.slice(1)}/page.tsx`);function Mp(t){return t.replace(/[^A-Za-z0-9-]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"").toLowerCase()}function ro(t){return typeof t=="string"&&Ft.test(t)}function co(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(Mp).filter(c=>c.length>0);if(r.length===0)return null;let _=`/${r.join("/")}`;return ro(_)?_:null}function mo(t){let n=co(t);if(n===null)throw new Error("Page slug must be an ASCII route without traversal segments.");return n}function Up(t){let n=mo(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)}),iI=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 qp(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 lo(t){return we.discriminatedUnion("ok",[Ns(t.dataSchema),qp({codeSchema:t.codeSchema,currentSchema:t.currentSchema,diagnosticsSchema:t.diagnosticsSchema,dataSchema:t.failureDataSchema})])}import{z as B}from"zod";var pt=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"})}),Gp=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)}),po=B.object({path:B.string().min(1),content:B.string(),hash:B.string().min(1).optional()}),mI=B.object({composition:M,revision:B.string().min(1),entryCss:po,stylesheets:B.array(po).default([])}).strict(),lI=B.object({composition:ne}).strict(),pI=B.object({key:B.string().min(1),composition:ne}).strict(),uo=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:pt.nullable(),openingElementRange:pt,version:B.object({documentVersion:B.number().int().nonnegative(),contentHash:B.string().min(1)}),diagnostics:B.array(Gp),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"})}),dI=uo,uI=Ns(uo),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 zp}from"zod";var Ms=zp.enum(["src","alt","poster","href","width","height"]);import{z as xt}from"zod";var qt=xt.object({editingSessionId:xt.string().min(1),lockId:xt.string().min(1),ownerId:xt.string().min(1),leaseAssertion:xt.string().min(1)}).strict(),fI="signed-designer-mutations-v1",bI=xt.object({mutationContext:qt}).strict();import{z as d}from"zod";import{z as Gt}from"zod";var An="::",Us=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=Kp(t.file,t.component,t.structuralPath);t.key!==s&&n.addIssue({code:"custom",path:["key"],message:"key must match file::component::structuralPath"})});function Kp(t,n,s){return`${t}${An}${n}${An}${s}`}function EI(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"]),zt=d.object({code:d.string().min(1),message:d.string().min(1)}).strict(),Bp=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()]),Wp=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(),Vp=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(),Hp=d.object({key:d.string().min(1),containerKey:d.string().min(1),businessMemberKeys:d.array(d.string().min(1)),isMultiMember:d.boolean()}).strict(),_o=d.object({kind:d.literal("page-composition"),placementKey:d.string().min(1),documentVersion:d.number().int().nonnegative(),composition:ne}).strict(),$p=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(),ho=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(),So=d.object({kind:d.literal("page-unit"),composition:ne,placementUnitKey:d.string().min(1)}).strict(),fo=d.object({kind:d.literal("page-unit"),composition:M,placementUnitKey:d.string().min(1)}).strict();function ze(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 Yp=d.object({status:d.literal("supported"),version:d.number().int().nonnegative(),composition:M,container:Bp,sourceMembers:d.array(Wp),businessMembers:d.array(Vp),placementUnits:d.array(Hp),placements:d.array($p)}).strict().superRefine((t,n)=>{ze(t.sourceMembers,n,"sourceMembers",c=>c.key,"key"),ze(t.businessMembers,n,"businessMembers",c=>c.key,"key"),ze(t.placementUnits,n,"placementUnits",c=>c.key,"key"),ze(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())xo(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."})}),Xp=d.object({status:d.literal("unsupported"),version:d.number().int().nonnegative(),composition:M,reason:vn,diagnostics:d.array(zt)}).strict(),Qp=d.discriminatedUnion("status",[Yp,Xp]),bo=2,PI="page-composition-v2",yo=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."})}),Zp=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."})}),Jp=d.enum(["component-call","native-jsx","dynamic-expression","indirect-expression","text","starter-placeholder"]),ed=d.enum(["none","dynamic-expression","indirect-expression","text","starter-placeholder"]),td=d.discriminatedUnion("kind",[d.object({kind:d.literal("virtual-route-root"),key:d.null(),routeReturn:d.object({sourceIdentity:Us,sourceRange:yo}).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()]),nd=d.object({key:d.string().min(1),kind:Jp,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:yo.nullable(),atomicKind:ed}).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)}),sd=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(),id=d.enum(["independent","atomic","container"]),ad=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:id,isIndependent:d.boolean(),isMultiMember:d.boolean()}).strict().superRefine((t,n)=>{go(t.sourceMemberKeys,n,"sourceMemberKeys","source member"),go(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."})}),od=d.enum(["before","after","prepend","append","replace"]),rd=d.enum(["insert-sibling","insert-child","replace-placeholder"]),cd=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:od,writeMode:rd}).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}.`})}),md=d.object({key:d.string().min(1),placementUnitKey:d.string().min(1),runtimeRefs:d.array(Zp).min(1)}).strict(),ld=d.object({schemaVersion:d.literal(bo),status:d.literal("supported"),version:d.number().int().nonnegative(),composition:M,container:td,sourceMembers:d.array(nd),businessMembers:d.array(sd),placementUnits:d.array(ad),placements:d.array(cd),visualAnchors:d.array(md).optional(),diagnostics:d.array(zt)}).strict().superRefine((t,n)=>{ud(t,n)}),pd=d.object({schemaVersion:d.literal(bo),status:d.literal("unsupported"),version:d.number().int().nonnegative(),composition:M,reason:vn,diagnostics:d.array(zt)}).strict(),dd=d.discriminatedUnion("status",[ld,pd]),wI=d.union([dd,Qp]);function go(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 xo(t,n){return us(t)===us(n)}function ud(t,n){ze(t.sourceMembers,n,"sourceMembers",E=>E.key,"key"),ze(t.businessMembers,n,"businessMembers",E=>E.key,"key"),ze(t.placementUnits,n,"placementUnits",E=>E.key,"key"),ze(t.placements,n,"placements",E=>E.placementKey,"placementKey"),ze(t.visualAnchors??[],n,"visualAnchors",E=>E.key,"key"),gd(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]));_d(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 Ct=_.get(ee);Ct&&Ct!==O.key&&n.addIssue({code:"custom",path:["placementUnits",E,"businessMemberKeys",q],message:`Business member is already assigned to ${Ct}.`}),_.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."}),xo(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 gd(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 _d(t,n,s){let a=new Set;for(let[i,r]of t.sourceMembers.entries()){let _=`${r.parentKey??"<root>"}:${r.order}`;if(a.has(_)&&s.addIssue({code:"custom",path:["sourceMembers",i,"order"],message:"Source member order must be unique among siblings."}),a.add(_),r.parentKey===r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member cannot be its own parent."}),r.parentKey!==null){let j=n.get(r.parentKey);j?j.childKeys.includes(r.key)||s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member parentKey must reference a source member."})}for(let[j,E]of r.childKeys.entries()){if(E===r.key){s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source member cannot be its own child."});continue}let O=n.get(E);O?O.parentKey!==r.key&&s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source parent and child references must be bidirectional."}):s.addIssue({code:"custom",path:["sourceMembers",i,"childKeys",j],message:"Source child key must reference a source member."})}let c=new Set,g=r;for(;g;){if(c.has(g.key)){s.addIssue({code:"custom",path:["sourceMembers",i,"parentKey"],message:"Source member graph must be acyclic."});break}c.add(g.key),g=g.parentKey===null?void 0:n.get(g.parentKey)}}}var Kt=p.enum(["update-text","update-array-item","remove-node","insert-child","move-node","set-class-name-source","set-props","apply-style-draft","source-edit","insert-page-resource","delete-page-source"]),Eo=p.lazy(()=>p.union([p.string(),p.number(),p.boolean(),p.null(),p.array(Eo),p.record(p.string(),Eo)])),hd=p.discriminatedUnion("kind",[p.object({kind:p.literal("node"),key:p.string().min(1)}).strict(),So,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()]),Sd=p.discriminatedUnion("kind",[p.object({kind:p.literal("node"),key:p.string().min(1)}).strict(),fo,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()]),Ro=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"]),To=p.enum(["hover","active","focus","disabled"]),ko=p.enum(["sm","md","lg","xl","2xl"]),Io=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)}),ho]),fd=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:ct,props:p.record(p.string(),p.never()).optional()}).strict()]),bd=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:fd,position:p.union([Io,_o])}),p.object({kind:p.literal("move-node"),target:Io,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:pt.nullable(),openingElementRange:pt,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:pt.nullable(),openingElementRange:pt,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()]),Po=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"]),wo=p.object({code:Po,message:p.string().min(1),details:p.record(p.string(),p.unknown()).optional()}),Ao=p.object({key:p.string().min(1),instanceIndex:p.number().int().nonnegative().optional(),instanceCount:p.number().int().positive().optional()}),Fs=p.object({id:p.string().min(1),siteId:I,baseSnapshotId:x,composition:ne,kind:Kt,target:hd,documentVersion:p.number().int().nonnegative(),selectionRef:Ao.optional(),mutationContext:qt.optional(),params:bd}).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"})}),GI=Fs,yd=p.object({kind:p.literal("insert-page-resource"),package_instance_id:p.string().min(1),pages:p.array(no).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)}),xd=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(),Ed=p.discriminatedUnion("kind",[yd,xd]),vo=p.object({requestId:p.string().min(1),kind:Kt,composition:M,target:Sd,resultVersion:p.number().int().nonnegative(),affectedFiles:p.array(p.string().min(1)).optional(),selectionRef:Ao.optional(),output:Ed.optional()}).strict(),qs=vo.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"})}),zI=lo({dataSchema:qs,codeSchema:Po,failureDataSchema:vo.partial()});function Id(t,n){return t.length===n.length&&t.every((s,a)=>s===n[a])}var Rd=Q.enum(["component","page","pages"]),Td=Q.object({resource_kind:Rd,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(),kd=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)})]),Pd=Q.object({base_snapshot_id:Q.string().min(1),operation:Fs,navigation_selection:kd.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 wd(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 Co=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:Td,transient_resource_input:Pd}).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 _=wd(a.operation).flatMap(g=>g.files),c=_.reduce((g,j)=>g+new TextEncoder().encode(j.content).byteLength,0);if(_.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!==_.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 P}from"zod";var Ad=["with_website","without_website"],Cn=P.enum(Ad),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."}),vd=["welcome","website_scan","customer_materials","analysis","diagnosis","strategy","structure_planning","preview_personalization","publishing"],Bt=P.enum(vd),Cd=["company_info","website_crawl","website_basic_info_extract","website_metrics_evaluate","intelligent_analysis","strategy_recommendation"],jo=P.enum(Cd),Dd=["started","running","succeeded","failed","invalidated"],Oo=P.enum(Dd),jd=["draft","structure_saved","generating","workspace_ready"],zs=P.enum(jd),Od=["not_deployed","deploying","deployed"],Ks=P.enum(Od),Nd=["active","completed"],Ld=P.enum(Nd),Md=["completed","current","locked"],Ud=P.enum(Md),No={draft:10,structure_saved:20,generating:30,workspace_ready:40},Lo={not_deployed:10,deploying:20,deployed:30},Mo={active:10,completed:20},Uo={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(No),qd=Dn(Lo),Gd=Dn(Mo),zd=Dn(Uo);function ZI(t){let n=Fd.get(t);if(!n)throw new Error(`Unknown site build status code: ${t}`);return n}function JI(t){let n=qd.get(t);if(!n)throw new Error(`Unknown site deployment status code: ${t}`);return n}function eR(t){let n=Gd.get(t);if(!n)throw new Error(`Unknown site workflow status code: ${t}`);return n}function tR(t){let n=zd.get(t);if(!n)throw new Error(`Unknown task execution status code: ${t}`);return n}function nR(t){return No[t]}function sR(t){return Lo[t]}function iR(t){return Mo[t]}function aR(t){return Uo[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}]}}],oR=Bs[0].definitions,Fo=P.number().int().min(1),Kd=P.object({id:G,flow_type:Cn,definition_version:Fo,node_code:Bt,label:P.string().min(1),sort_order:P.number().int().min(1),is_enabled:P.boolean(),state:Ud}),qo=P.object({id:sa,tenant_id:P.string().min(1),site_id:I,workflow_id:Ne,node_code:Bt,task_type:jo,external_task_id:P.string().min(1),execution_status:Oo,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)}),Bd=P.object({id:Ne,tenant_id:P.string().min(1),site_id:I,flow_type:Cn,website:Gs.nullable(),definition_version:Fo,current_node_code:Bt,status:Ld,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:Bd,menu:P.array(Kd),task_refs:P.array(qo),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()})}),rR=L(Ws),cR=L(qo),Do=P.array(P.string().min(1).max(64)).max(16).optional(),mR=P.discriminatedUnion("flow_type",[P.object({flow_type:P.literal("with_website"),website:Gs,client_capabilities:Do}).strict(),P.object({flow_type:P.literal("without_website"),website:P.null().optional(),client_capabilities:Do}).strict()]),lR=P.object({expected_current_node:P.literal("website_scan"),website:Gs}).strict(),pR=P.object({expected_current_node:Bt}).strict(),dR=P.object({expected_current_node:P.literal("publishing")}).strict(),Wd=P.object({node_code:Bt,task_type:jo,external_task_id:P.string().min(1).max(255),idempotency_key:P.string().min(1).max(255)}),uR=Wd.extend({workflow_id:Ne}).strict(),gR=P.object({external_task_id:P.string().min(1).max(255),execution_status:Oo}),Vd=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)}),_R=Vd.extend({workflow_id:Ne}).strict(),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)}),hR=Hd.extend({workflow_id:Ne}).strict(),SR=P.object({}).strict();function $d(t,n,s){return t.find(a=>a.definition_version===s)?.definitions[n]}function Yd(t,n){return $d(Bs,t,n)}function Xd(t,n=1){let s=Yd(t,n);if(!s)throw new Error(`Unknown workflow definition: ${t} v${n}.`);return s}function Qd(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 fR(t,n){return Qd(Bs,t,n)}function bR(t,n){return Xd(t).findIndex(s=>s.node_code===n)}function yR(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 xR(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 ER(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_]*$/),Zd=y.enum(["text","select","multi_select","tags","category_list","boolean","number"]),Wt=y.string().min(1).max(512).regex(/^\/(?:[^?#]*)$/),Jd=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"}),eu=y.string().trim().min(1).max(100),zo=y.array(eu).max(5).refine(t=>new Set(t.map(n=>n.toLowerCase())).size===t.length,{message:"popular_terms must be unique ignoring case"}),kR=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)}),Ko=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:zo.optional()}).strict(),tu=y.object({app_slug:Vs}).extend(Ko.shape).strict(),Hs=y.object({kind:y.literal("product_search_confirmation"),baseline_snapshot_id:x,target_route_id:Wt,applications:y.array(y.object({app_slug:Vs,label:y.string().min(1).max(200),popular_terms:zo.default([]),current_config:Ko.nullable().default(null),affected_routes:y.array(Wt).max(64).default([]),fields:y.array(y.object({field_name:Re,label:y.string().min(1).max(200),value_shape:Zd,option_count:y.number().int().nonnegative().optional(),filter_meta:Jd.optional()}).strict()).max(64)}).strict()).min(1).max(12),current_config:tu.nullable().optional(),affected_routes:y.array(Wt).min(1).max(64).optional()}).strict(),nu=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([nu,y.object({kind:y.literal("product_search_confirmation"),action:y.literal("cancel")}).strict()]),Vt=y.union([y.string().max(255),y.number().finite(),y.boolean()]),su=y.object({values:y.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(),iu=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"}),au=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([su,iu])).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(Vt).max(20)}).strict()).max(8)}).strict(),Go=y.object({value:Vt,label:y.string().max(200),count:y.number().int().nonnegative()}).strict(),ou=y.union([Vt,y.array(Vt).max(50)]),ru=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,ou).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(Go).max(10),selected_values:y.array(Go).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(),PR=y.object({contract_version:y.literal(1),request:au,response:ru}).strict();import{z as Ht}from"zod";var cu=["deployment_queued","prepare_source","build_artifact","publish_site","site_released","cleanup_release"],mu=Ht.enum(cu),lu=Ht.enum(["running","succeeded","failed"]),pu=Ht.object({code:mu,status:lu,message:Ht.string().trim().min(1)}).strict(),Bo=Ht.array(pu);import{z as T}from"zod";var du=T.enum(["pending","running","succeeded","failed"]),uu=T.enum(["TASK_FAILED","WEBSITE_UNREACHABLE"]),gu=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:uu.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:du,error:T.string().nullable(),created_at:T.string().min(1),updated_at:T.string().min(1)}),jR=L(gu),$s=T.enum(["existing_site","new_site"]),Wo=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(),_u=T.object({url:T.string().url().max(2048),title:T.string().trim().max(300),words:T.number().int().nonnegative().max(1e7)}).strict(),hu=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(_u).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:hu.optional()})}),Su=T.object({saved:T.literal(!0),company_task_id:T.string().min(1).max(128),scan_task_id:T.string().min(1).max(128)}),OR=L(Su),fu=T.enum(["snapshot","task"]),bu=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()}),yu=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:fu,result:bu}),NR=L(yu.nullable());import{z as ue}from"zod";var Xe=ue.enum(["company","product_service","case_qualification","market","contact_inquiry","privacy_compliance","news_freshness"]),xu=ue.object({ordinal:ue.number().int().min(1).max(1e4),path:ue.string().min(1).max(2048).refine(t=>!Ru(t),{message:"path must be a site-relative path, not an absolute URL"}),last_modified:ue.string().max(64).nullable()}).strict(),UR=ue.object({candidates:ue.array(xu).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}}),Eu=ue.object({ordinal:ue.number().int().positive().max(1e4),roles:ue.array(Xe).min(1).max(7)}).strict(),Iu=ue.object({role:Xe,status:ue.enum(["selected","not_found"]),selected_ordinals:ue.array(ue.number().int().positive().max(1e4)).max(19)}).strict(),FR=ue.object({selections:ue.array(Eu).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 Xe.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 Ru(t){let n=t.toLowerCase();return n.startsWith("http://")||n.startsWith("https://")||t.startsWith("//")}import{z as S}from"zod";var KR=S.object({force_refresh:S.boolean().optional()}),Ho=S.enum(["running","succeeded","failed"]),Tu=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)}),ku=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"])}),Pu=S.object({t:S.string(),d:S.string(),evidence:S.object({from:S.string(),url:S.string().nullable().optional(),value:S.string().nullable().optional()})}),wu=S.enum(["complete","partial","insufficient_data","failed"]),Au=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:Au,topics:S.array(S.object({topic_id:S.string().min(1),status:wu,evidence_refs:S.array(S.string())})).length(3),findings:S.array(Pu).max(3),elapsed_ms:S.number().nonnegative(),note:S.string().optional(),error:S.string().optional()}),$o=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()}),vu=S.object({agents_done:S.boolean(),analysis:S.record(S.string(),Xs),step4_scoring_input:S.unknown().optional(),summary:$o}),Yo=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:Ho,result:vu.nullable().optional(),error:S.string().nullable().optional()}),BR=L(S.array(Tu)),WR=L(ku),VR=L(Yo),HR=L(Yo.nullable()),Ke=S.object({id:S.union([S.number().int().nonnegative(),S.string().regex(/^(0|[1-9]\d*)$/u).transform(Number)]).pipe(S.number().int().nonnegative())}),Vo=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()}),$R=S.discriminatedUnion("event",[Ke.extend({event:S.literal("snapshot"),data:S.object({job_id:S.string().min(1),status:Ho,done:S.number().int().nonnegative(),total:S.number().int().nonnegative(),results:S.array(Xs),progress:Vo.optional()})}),Ke.extend({event:S.literal("progress"),data:Vo}),Ke.extend({event:S.literal("preparing_started"),data:S.object({stage:S.literal("baseline")})}),Ke.extend({event:S.literal("preparing_progress"),data:S.object({stage:S.enum(["context","external_evidence"])})}),Ke.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())})}),Ke.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)})}),Ke.extend({event:S.literal("agent_done"),data:Xs}),Ke.extend({event:S.literal("done"),data:S.object({agents_done:S.literal(!0),summary:$o})}),Ke.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(),Cu=C.number().finite().positive(),Qs=["reach","trust","convert","safe"],Du=17,ju=C.enum(["passed","partial","failed"]),Ou=C.object({landing_page_mode:C.enum(["intent_dynamic","static","none"]),ab_test_enabled:C.boolean()}).strict(),Nu=C.union([C.boolean(),C.number().finite(),ju,Ou]).nullable(),Lu=C.union([C.boolean(),C.number().finite()]).nullable(),Mu=C.object({competitor_avg:C.number().finite(),score_items:C.record(C.string(),Nu),penalty_items:C.record(C.string(),Lu),red_texts:C.array(C.string())}).strict(),Uu=C.record(Zs,Mu),Fu=C.object({key:Zs,score:ye,pass_score:ye,gap:ye}),qu=C.object({key:C.string(),title:C.string(),is_redline_option:C.boolean().optional(),score:ye,max_score:Cu,pass_score:ye,passed:C.boolean(),description:C.string()}),Gu=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(qu),red_texts:C.array(C.string()),redline_hit:C.boolean().optional()}),zu=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:Uu,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(Gu).length(4)}),created_at:C.string().datetime({offset:!0}),updated_at:C.string().datetime({offset:!0})}).superRefine((t,n)=>{Ku(t.scores_list.dimensions)||n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include each canonical score dimension."}),t.scores_list.dimensions.reduce((a,i)=>a+i.sub_dimensions.length,0)!==Du&&n.addIssue({code:"custom",path:["scores_list","dimensions"],message:"dimensions must include 17 subdimensions in total."});for(let[a,i]of t.scores_list.dimensions.entries()){if(i.redline_hit===void 0)continue;let r=i.sub_dimensions.findIndex(_=>_.is_redline_option===void 0);r!==-1&&n.addIssue({code:"custom",path:["scores_list","dimensions",a,"sub_dimensions",r,"is_redline_option"],message:"subdimensions must define is_redline_option when redline_hit is defined."})}}),ZR=L(zu);function Ku(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 Qe={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(Qe))Object.freeze(t);Object.freeze(Qe);var tT=Object.freeze(ft.filter(t=>Qe[t].length>0)),nT=Object.freeze(ft.filter(t=>Qe[t].length===0)),Bu=Object.freeze(["preparing_source","building","artifact_ready","deploying","released"]),Wu="DEPLOYMENT_TRANSITION_INVALID",Js=class extends Error{constructor(n,s){super(`Invalid deployment transition: ${n} -> ${s}`),this.currentStatus=n,this.nextStatus=s,this.code=Wu,this.name="DeploymentTransitionError"}};function sT(t){return Qe[t]}function iT(t){return ft.filter(n=>Qe[n].some(s=>s===t))}function Vu(t){return Qe[t].length>0}function aT(t){return!Vu(t)}function oT(t,n){if(!Qe[t].some(s=>s===n))throw new Js(t,n);return n}function rT(){return Bu}import{z as Hu}from"zod";var lT=".i18n.json",Ln="translation",Xo=new Set(["__proto__","constructor","prototype"]);function Zo(t){if(!Mn(t)||Object.keys(t).length===0)return Ze("I18N_ROOT_INVALID","Component i18n resources must be a non-empty object.",[]);for(let[n,s]of Object.entries(t)){if(Xo.has(n))return Qo([n]);if(!$u(n))return Ze("I18N_LOCALE_INVALID",`Component i18n locale must be canonical BCP-47: ${n}`,[n]);if(!Mn(s))return Ze("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 Ze("I18N_NAMESPACE_INVALID",`Component i18n locale ${n} must contain only the translation namespace.`,[n]);let i=s[Ln];if(!Mn(i))return Ze("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 _=r.pop();for(let[c,g]of Object.entries(_.value)){let j=[..._.path,c];if(Xo.has(c))return Qo(j);if(typeof g!="string"){if(!Mn(g))return Ze("I18N_RESOURCE_TREE_INVALID","Component i18n resource leaves must be strings.",j);r.push({value:g,path:j})}}}}return{success:!0,data:t}}function pT(t){let n;try{n=JSON.parse(t)}catch{return Ze("I18N_JSON_INVALID","Component i18n resource file must contain valid JSON.",[])}return Zo(n)}var dT=Hu.custom(t=>Zo(t).success,"Invalid component i18n resources.");function $u(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 Qo(t){return Ze("I18N_RESOURCE_KEY_FORBIDDEN",`Component i18n resource key is forbidden: ${t.at(-1)??""}`,t)}function Ze(t,n,s){return{success:!1,error:{code:t,message:n,path:s}}}var Be="products",Yu=`/${Be}`,gT=Yu,_T=`${Be} detail`,hT="cms_collection_view",ST="list",fT="detail",Le={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"}},Xu=new Set(Object.values(Le).map(t=>t.pageTitle)),Qu=new Set(Object.values(Le).flatMap(t=>[t.blockLabel,t.detailBlockLabel,t.heroBlockLabel]));function bT(t){let n=t?.trim().toLowerCase()??"";if(n==="zh-tw"||n==="zh-hk"||n==="zh-mo")return Le.zhHant;if(n.startsWith("zh"))return Le.zhHans;switch(n.split("-")[0]){case"de":return Le.de;case"fr":return Le.fr;case"es":return Le.es;case"ja":return Le.ja;case"ko":return Le.ko;case"en":default:return Le.en}}function yT(t){return Xu.has(t.trim())}function xT(t){return Qu.has(t.trim())}import{z as ge}from"zod";var TT=ge.object({key:ge.string().min(1),composition:ne}).strict(),Fn=ge.enum(["component-boundary","repeat-region","conditional-region","fragment-region","opaque-region"]),Zu=ge.enum(["direct","proxy","upstream","readonly","unsupported"]),Ju=ge.enum(["component-boundary","repeat-region","conditional-region","opaque-region","void-element","read-only","cross-file-required","import-required"]),Un=ge.object({mode:Zu,reasonCode:ge.string().min(1).optional()}),eg=ge.object({kind:Ju,message:ge.string().min(1)}),qn=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(eg)}).strict();import{z as K}from"zod";var DT=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:qs,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:wo,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 LT="durable-history-v1",Gn=Z.object({initiatingComposition:M.optional(),affectedCompositions:Z.array(M)}).strict(),MT=Z.enum(["writable","read-only-recovery","unavailable"]),tg=Z.enum(["INDEX_CORRUPT","ENTRY_MISSING","BLOB_MISSING","FILESYSTEM_UNAVAILABLE","ROLLBACK_INCOMPLETE","UNKNOWN"]),ng=Z.object({code:tg,message:Z.string().min(1),occurredAt:Z.iso.datetime().optional()}).strict(),sg=Z.enum(["NOT_INITIALIZED","FILESYSTEM_UNAVAILABLE","UNSUPPORTED_RUNTIME"]),Jo={revision:Z.number().int().nonnegative(),undoDepth:Z.number().int().nonnegative(),redoDepth:Z.number().int().nonnegative()},ig=Z.object({mode:Z.literal("writable"),composition:M,...Jo,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."})}),ag=Z.object({mode:Z.literal("read-only-recovery"),composition:M,...Jo,canUndo:Z.literal(!1),canRedo:Z.literal(!1),recoveryDiagnostic:ng,provenance:Gn.optional()}).strict(),og=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:sg,provenance:Gn.optional()}).strict(),rg=Z.discriminatedUnion("mode",[ig,ag,og]),UT=Z.object({composition:M,status:rg,provenance:Gn}).strict();import{z as _e}from"zod";var cg=_e.string().min(1).refine(t=>!t.startsWith("/")&&!t.includes(".."),{message:"Patch paths must be safe relative POSIX paths."}),mg=_e.string().regex(/^sha256:[a-f0-9]{64}$/),lg=_e.object({path:cg,operation:_e.enum(["create","update","delete"]),expectedHash:mg.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"})}),pg=_e.object({siteId:I,baseSnapshotId:x,operationId:_e.string().min(1),reason:_e.string().min(1),patches:_e.array(lg).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."})}),KT=pg.transform(t=>({...t,changedRouteIds:[...new Set(t.changedCompositions.map(n=>n.routeId))]}));var ei="::repeat-item#";function dg(t,n){return`${t}${ei}${n}`}function WT(t,n){return n.reduce((s,a)=>dg(s,a),t)}function ug(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 VT(t){return ug(t)?.baseKey??t??null}import{z as m}from"zod";import{z as Ee}from"zod";var gg=Ee.object({placementKey:Ee.string().min(1),placementUnitKey:Ee.string().min(1),relation:Ee.enum(["before","after","prepend","append"])}).strict(),_g=Ee.object({status:Ee.literal("supported"),containerKey:Ee.string().min(1),hasBusinessMembers:Ee.boolean(),placementUnitKeys:Ee.array(Ee.string().min(1)),placements:Ee.array(gg)}).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."})})}),hg=Ee.object({status:Ee.literal("unsupported"),reason:vn,diagnostics:Ee.array(zt)}).strict(),er=Ee.discriminatedUnion("status",[_g,hg]);var Sg=m.object({canUpdateText:m.boolean(),canInsertChild:m.boolean(),canMove:m.boolean(),canRemove:m.boolean()}),tr=m.enum(["vcp-cms-collection","vcp-cms-form","vcp-cms-settings","vcp-cms-navigation","site-api-route","external-api","unknown-api"]),fg=m.enum(["cms-field","api-field"]),bg=m.enum(["text","attribute","richtext","repeat-region","conditional-region","component-prop"]),yg=m.enum(["exact","safe-derived","partial","unknown"]),xg=m.object({file:m.string().min(1),symbol:m.string().min(1).optional(),reason:m.string().min(1)}),Eg=m.object({sourceKind:tr,sourceType:fg,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:bg,targetName:m.string().min(1),confidence:yg,readonly:m.literal(!0),evidence:m.array(xg)}),nr=m.object({hasDynamicData:m.boolean(),bindings:m.array(Eg)}),sr=m.object({hasDynamicData:m.boolean(),sourceKinds:m.array(tr),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:Sg,dynamicDataSummary:sr.optional()}).strict(),rk=m.object({composition:ne}).strict(),ck=m.object({key:m.string().min(1),composition:ne}).strict(),mk=m.object({siteId:I,snapshotId:x,composition:M,version:m.number().int().nonnegative(),entries:m.array(Ig),pageComposition:er}).strict(),ti=m.enum(["api-field","cms-field","i18n-message","config-entry"]),ir=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:ir.nullable()}),$t=m.object({key:m.string().min(1),label:m.string().min(1),tag:m.string().min(1)}),lk=m.object({composition:M,key:m.string().min(1),canUpdateText:m.boolean(),canInsertChild:m.boolean(),canMove:m.boolean(),canRemove:m.boolean(),boundaryKind:Fn.nullable(),isOpaque:m.boolean()}).strict(),Rg=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()}),Tg=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()}),ar=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()}),kg=m.object({kind:ar.shape.kind,file:m.string().min(1),displayName:m.string().min(1),canEditHere:m.boolean()}),Yt=m.object({finalSource:ar.nullable(),chain:m.array(kg),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)}))}),Pg=m.object({kind:m.literal("css-style-model"),properties:m.array(m.object({property:Ro,value:m.union([m.string(),m.number(),m.boolean(),m.null()]),resolvedValue:m.union([m.string(),m.number(),m.boolean(),m.null()]).optional(),breakpoint:ko.optional(),state:To.optional(),variants:m.array(m.string().min(1)).optional(),options:m.array(m.union([m.string(),m.number()])).optional(),editable:m.boolean(),diagnostics:m.array(m.object({code:m.string().min(1),message:m.string().min(1)})).optional(),operationBoundary:m.array(Kt).optional()}))}),pk=m.union([m.record(m.string(),m.unknown()),Pg]),or=m.object({kind:m.literal("class-name-source"),className:m.string(),sourceKind:m.enum(["missing","static-attribute","static-expression","dynamic-expression"]),editable:m.boolean(),operationBoundary:m.array(Kt),sourcePath:m.string().min(1).optional(),diagnostics:m.array(m.object({code:m.enum(["missing-class-name","dynamic-binding","non-string-binding"]),message:m.string().min(1)})).optional()}),wg=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:wg,structuralPath:m.string().min(1),textPreview:m.string().min(1).optional()}),dk=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:qn,writeTarget:Rg,effectiveWriteTarget:Tg.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:or.optional(),conditional:m.record(m.string(),m.unknown()).optional(),dynamicData:nr.optional(),textSegments:m.array(ni),boundaryKind:Fn.nullable(),isOpaque:m.boolean(),ancestors:m.array($t),children:m.array($t),siblings:m.array($t)}).strict(),uk=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:qn.shape.constraints}),isOpaque:m.boolean(),provenanceChain:m.object({editMode:Yt.shape.editMode,diagnostics:Yt.shape.diagnostics}).optional(),dynamicDataSummary:sr.optional(),ancestors:m.array($t)}).strict(),gk=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($t),componentName:m.string().min(1),sourceFile:m.string().min(1),capabilities:qn,provenanceChain:m.object({editMode:Yt.shape.editMode,diagnostics:Yt.shape.diagnostics}).optional(),textSegments:m.array(m.object({index:ni.shape.index,editable:ni.shape.editable,sourceKind:ir.shape.kind.nullable()})),dynamicData:nr.optional(),boundaryKind:Fn.nullable()}).strict(),_k=m.object({composition:M,key:m.string().min(1),mediaModel:m.record(m.string(),m.unknown()).optional(),styleSource:or.optional()}).strict();var Ag=["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"],vg=["article","aside","div","footer","form","header","li","main","nav","ol","section","select","table","tbody","tfoot","thead","tr","ul"],Cg=["a","button","em","h1","h2","h3","h4","h5","h6","label","p","small","span","strong"],Dg=new Set(Ag),jg=new Set(vg),Og=new Set(Cg),Ng={canUpdateText:!1,canInsertChild:!1,canMove:!1,canRemove:!1};function Sk(t){return Dg.has(ii(t))}function Lg(t){return jg.has(ii(t))}function Mg(t){return Og.has(ii(t))}function fk(t){let{operationSummary:n}=t;return n?{canUpdateText:n.canUpdateText,canInsertChild:n.canInsertChild,canMove:n.canMove,canRemove:n.canRemove}:t.fallbackMode!=="preview"?{...Ng}:{canUpdateText:Mg(t.tagName),canInsertChild:Lg(t.tagName),canMove:!1,canRemove:!1}}function ii(t){return t?.trim().toLowerCase()??""}import{z as Ug}from"zod";var Ik=Ug.object({composition:ne,mutationContext:qt.optional()}).strict();var Tk={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."},kk={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."},Pk={CARD_HEADER:"Needs your confirmation",FREE_TEXT_PLACEHOLDER:"Or describe what you'd like instead",SUBMIT_LABEL:"Submit"},wk={SEND_FAILED_RETRY:"Send failed \u2014 tap to retry"};var rr="0.8.5",vk="x-vcp-edit-engine-version",Ck="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 qg(t){return Fg.test(t)}function Gg(t){if(typeof t!="string"||!qg(t))throw new ai;return t}function Dk(t){return t==null?{version:rr,source:"fallback_current"}:{version:Gg(t),source:"explicit"}}function jk(){return{version:rr,source:"system_current"}}import{z as Oe}from"zod";var zg=200,Kg=200;function Bg(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 Wg=Oe.string().min(3).max(zg).refine(t=>Bg(t)!==null,{message:'glossary entries must be "source:target" pairs split on a half-width colon, e.g. "\u7C73:Rice"'}),Lk=Oe.array(Wg).max(Kg),Mk=Oe.object({website_name:Oe.string().min(1).max(200),website_industry:Oe.string().min(1).max(200).optional(),website_description:Oe.string().min(1).max(1e3).optional()}),Vg=Oe.enum(["regional","fonts_only"]),zn=Oe.string().regex(/^#[0-9a-fA-F]{6}$/,'color must be a "#rrggbb" value'),Hg=Oe.object({primary:zn.optional(),accent:zn.optional(),foreground:zn.optional(),neutral:zn.optional()}),$g=600,Uk=Oe.object({mode:Vg.default("regional"),seeds:Hg.optional(),note:Oe.string().min(1).max($g).optional()}),Fk={mode:"regional"};function qk(t){return t===void 0?!1:Object.values(t).some(n=>typeof n=="string"&&n.length>0)}import{z as Te}from"zod";var Yg=Te.string().trim().min(1),Et=Te.string().uuid(),Xg=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"),cr=Te.object({snapshot_id:Et,object_key:Xg}),Kk=Te.object({tenant_id:Yg,parent_site_id:Et,subsite_site_id:Et,base:cr,target:cr}),Bk=Te.object({subsite_site_id:Et,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:Et,target_snapshot_id:Et}),Qg=Te.enum(["SUBSITE_DIFF_REQUEST_INVALID","SUBSITE_DIFF_STORE_NOT_CONFIGURED","SUBSITE_DIFF_MANIFEST_MISSING","SUBSITE_DIFF_MANIFEST_INVALID"]),Wk=Te.object({error_code:Qg,message:Te.string().min(1),side:Te.enum(["base","target"]).optional()});import{z as ce}from"zod";var Yk=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()}),Xk=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 Zg}from"zod";var Jg=/^\/[a-z0-9][a-z0-9-]{0,30}$/,e_=Object.freeze(["api","_next","assets","static","robots.txt","sitemap.xml",".well-known"]),t_=new Set(e_);function n_(t){return t_.has(t)}var Jk=Zg.string().regex(Jg).refine(t=>!n_(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 s_=se.enum(["active","paused","blocked"]),mr=se.enum(["typecheck_failed","health_failed","validation_failed"]),i_={status:s_,attempts:se.number().int().nonnegative(),attempted_template_version:je.nullable(),last_error_code:mr.nullable()},It=se.object(i_).strict(),Kn=se.object({template_id:se.string().trim().min(1),target_template_version:je}).strict(),s1=Kn,a_=se.discriminatedUnion("action",[se.object({action:se.literal("proceed"),state:It.extend({status:se.literal("active")})}).strict(),se.object({action:se.literal("skip_not_newer"),state:It.extend({status:se.literal("active")})}).strict(),se.object({action:se.literal("skip_paused"),state:It.extend({status:se.literal("paused")})}).strict(),se.object({action:se.literal("skip_blocked"),state:It.extend({status:se.literal("blocked")})}).strict()]),i1=Kn,a1=a_,o1=Kn.extend({error_code:mr}),r1=se.object({state:It}).strict(),c1=Kn,m1=se.object({state:It}).strict();import{z as U}from"zod";var o_=744*60*60*1e3,r_=U.enum(["eligible","fast_path","upgraded","skipped","lock_skipped","cas_aborted","validation_failed","blocked","paused"]),c_=U.enum(["typecheck","build","health","validation"]),m_=U.enum(["not_attempted","promoted","aborted"]),g1=U.object({template_id:U.string().trim().min(1).max(128),from_version:je.nullable(),to_version:je,outcome:r_,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:c_.nullable(),cas_outcome:m_.nullable()}).strict(),_1=U.object({recorded:U.literal(!0)}).strict(),lr=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)<=o_,{message:"report window must not exceed 31 days",path:["to"]}),h1=lr,l_=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(),S1=U.object({window:lr,outcome_counts:l_,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(),f1=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(),p_=U.object({site_id:I,snapshot_id:x,status:U.enum(["candidate","deleting"]),created_at:U.iso.datetime()}).strict(),b1=U.object({snapshots:U.array(p_)}).strict();import{z as We}from"zod";var d_=We.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"]),u_=We.object({status:We.literal("ready"),preview_url:We.string().url()}).strict(),g_=We.object({status:We.literal("failed"),code:d_,message:We.string().min(1),retryable:We.boolean()}).strict(),E1=We.discriminatedUnion("status",[u_,g_]);import{z as oe}from"zod";var w1="build-context.json",A1=2e5,pr=oe.string().regex(/^sha256:[a-f0-9]{64}$/u),dr=1e3;function __(t){return Array.from(t).length<=dr}var h_=oe.object({kind:oe.enum(["customer_materials","website_scan_diagnosis","committed_strategy"]),digest:pr}).strict(),S_=oe.object({schema_version:oe.literal(1),flow_type:Cn,sources:oe.array(h_).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."})}),f_=oe.object({schema_version:oe.literal(1),seed:pr.optional(),cms_settings:oe.object({main_products:oe.string().trim().min(1).refine(__,{message:`main_products must contain at most ${dr} characters`}).optional()}).strict().optional(),provenance:S_.optional()}).strict(),b_=oe.object({schema_version:oe.literal(1),site_id:I,workflow_id:Ne,brief:oe.string().min(1),source:oe.enum(["business_provider","mock"]),payload:f_}).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."})}),v1=oe.object({source_snapshot_id:x,source_run_id:V,build_context:b_,page_slugs:oe.array(oe.string().min(1)).optional()}).strict(),C1=oe.object({disposition:oe.enum(["reused","rebased"]),snapshot_id:x}).strict(),y_=oe.object({snapshot:Ws,workspace_run_id:V.nullable()}).strict(),D1=L(y_);import{z as Me}from"zod";import{z as Ae}from"zod";import{z as ie}from"zod";import{z as x_}from"zod";var E_=["company_profile","product_manual","product_list","customer_case","product_help","qualification","industry_material"],ur=x_.enum(E_);var gr=ie.enum(["pending","running","ready","failed","missing"]),I_=ie.object({task_id:ie.string().min(1).max(500),status:gr}).strict(),U1=ie.object({items:ie.array(I_).max(100)}).strict(),Xt=ie.string().trim().min(1).max(255),F1=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"]})}),R_=ie.object({source_file_id:Xt,category_code:ur.nullable(),category_confirmed:ie.boolean(),status:gr}).strict(),q1=ie.object({ready:ie.boolean(),files:ie.array(R_),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),_r=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:_r,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:_r,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(Xt).max(50)}).strict(),T_=Ae.enum(["draft","submitted"]),ri=oi.extend({id:G,tenant_id:Ae.string().min(1),site_id:I,workflow_id:Ne,status:T_,submitted_at:Ae.string().min(1).nullable(),created_at:Ae.string().min(1),updated_at:Ae.string().min(1)}).strict(),V1=L(ri),H1=L(ri),$1=L(ri.nullable());var J1=Nn.extend({expected_current_node:Me.literal("website_scan"),type:Me.literal("existing_site"),result:Nn.shape.result.extend({website:Me.string().url(),scan_cards:Me.partialRecord(Wo,Ys).refine(t=>Object.keys(t).length>0,{message:"At least one recognized scan card is required."})}).strict()}).strict(),e0=Me.object({expected_current_node:Me.literal("customer_materials"),materials:oi}).strict(),t0=Me.object({expected_current_node:Me.literal("diagnosis")}).strict(),n0=Me.object({expected_current_node:Me.literal("strategy")}).strict();import{z as w}from"zod";var Qt={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}},k_={heading:"Inter",body:"Inter"},hr=Qt.Inter;function Bn(t){return t.trim().replace(/\s+/g,"_").toLowerCase()}var yr=(()=>{let t=new Map;for(let[n,s]of Object.entries(Qt))t.set(Bn(n),s),t.set(Bn(s.import),s);return t})();function P_(t){return typeof t!="string"||t.trim().length===0?hr:yr.get(Bn(t))??hr}var w_=(()=>{let t=new Map;for(let[n,s]of Object.entries(Qt))t.set(s.import,n);return t})();function A_(t){if(typeof t!="string"||t.trim().length===0)return"Inter";let n=yr.get(Bn(t));return n?w_.get(n.import)??"Inter":"Inter"}var v_=Object.keys(Qt),Sr='ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif',fr='Georgia, "Times New Roman", serif',br='"SFMono-Regular", Consolas, monospace',C_=new Set(["serif","sans-serif","sans serif","monospace","mono","cursive","fantasy","system-ui","ui-serif","ui-sans-serif","ui-monospace"]),D_=new Set(["Playfair Display","Lora","Fraunces","Cormorant Garamond","Noto Serif SC"].map(t=>t.toLowerCase())),j_=new Set(["JetBrains Mono","IBM Plex Mono"].map(t=>t.toLowerCase()));function O_(t){let n=t.toLowerCase();return j_.has(n)||n.includes("mono")?"mono":D_.has(n)||n.includes("serif")?"serif":"sans"}function ci(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=>C_.has(g.toLowerCase());if(a&&r(a)){let g=a.toLowerCase();return g.includes("mono")?br:g.includes("serif")?fr:Sr}let _=a;_||(_=r(i)?"":i),_||(_="Inter");let c=O_(_);return c==="mono"?`"${_}", ${br}`:c==="serif"?`"${_}", ${fr}`:`"${_}", ${Sr}`}function N_(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"],xr=[{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 Er(t){let n=xr.find(s=>s.id===t);if(!n)throw new Error(`Unknown font pairing: ${t}`);return n}var li=["compact","comfortable","airy"],Ir=["none","sm","md","lg","xl"],Rr="lg",pi=["subtle","moderate","expressive"],L_=[{id:"subtle",motionLevel:"subtle"},{id:"moderate",motionLevel:"moderate"},{id:"expressive",motionLevel:"expressive"}];function Tr(t){let n=L_.find(s=>s.id===t);if(!n)throw new Error(`Unknown motion preset: ${t}`);return n}var kr=["ocean","forest","clay","violet","graphite","crimson"],Pr=["ai-forest","ai-navy","ai-steel"],wr=/^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 o0(t){let n=ui.find(s=>s.id===t);if(!n)throw new Error(`Unknown theme preset: ${t}`);return n}function Ar(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),Zt=w.string().trim().min(1).max(500),vr=w.string().datetime({offset:!0}),M_=w.enum(kr),U_=w.enum(Pr),F_=w.string().regex(wr),Jt=w.union([M_,U_,F_]),en=w.enum(mi),tn=w.enum(pi),nn=w.enum(li),Wn=w.enum(Ir),Cr=300,q_=w.string().trim().min(1).max(Cr),Vn=w.object({primary:gi,accent:gi,foreground:gi}).strict(),G_=w.object({id:Jt,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:en,motion_preset_id:tn,density:nn,reason:Zt}).strict(),Dr=w.object({name:w.string().trim().min(1).max(120),description:w.string().trim().min(1).max(240),reason:Zt,color_seeds:Vn,surface_mode:w.enum(["light","dark"]),radius:Wn,font_pairing_id:en,motion_preset_id:tn,density:nn}).strict(),jr=w.object({version:w.number().int().min(1),recommendation_id:w.string().uuid(),theme_preset_id:Jt,color_seeds:Vn,surface_mode:w.enum(["light","dark"]),font_pairing_id:en,motion_preset_id:tn,density:nn,radius:Wn.optional(),aesthetic_note:q_.optional(),updated_at:vr}).strict(),z_=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:Jt,candidate_ids:w.array(Jt).length(3),candidates:w.array(G_).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:en,reason:Zt}).strict(),motion:w.object({recommended_id:tn,reason:Zt}).strict(),density:w.object({recommended_id:nn,reason:Zt}).strict(),conversion:ot.optional(),generated_at:vr}).strict(),S0=w.object({force_refresh:w.boolean().optional()}).strict(),f0=w.object({request_id:w.string().trim().min(1).max(160),site_id:I,cached:w.boolean(),recommendation:z_,selection:jr}).strict(),b0=w.object({recommendation_id:w.string().uuid(),expected_version:w.number().int().min(1),theme_preset_id:Jt,color_seeds:Vn,surface_mode:w.enum(["light","dark"]),font_pairing_id:en,motion_preset_id:tn,density:nn,radius:Wn.optional(),aesthetic_note:w.string().trim().max(Cr).optional()}).strict(),y0=w.object({selection:jr}).strict(),x0=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:at.optional(),owner_whole_site_request:w.string().trim().min(1).max(St).optional()}).strict(),E0=w.object({theme_candidates:w.array(Dr).length(3),conversion:ot.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 I0(){return di.map(t=>Dr.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 K_(t){return t.radius??Ar(t.theme_preset_id)??"lg"}function R0(t){let n=Er(t.font_pairing_id),s=Tr(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:K_(t)}}function T0(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 Je}from"zod";var A0=Je.object({site_id:I,site_language:Je.string().trim().min(2).max(35),business_facts:Je.array(Je.string().trim().min(1).max(1e3)).min(1).max(8)}).strict(),B_=Je.enum(["high","medium","low"]),v0=Je.object({skill_name:Je.string().trim().min(1).max(80).nullable(),confidence:B_,reason:Je.string().trim().min(1).max(240)}).strict();import{z as W}from"zod";var W_=["title","text","richtext","number","boolean","date","datetime","url","email","color","select","multiselect","tag"],Or=W.object({name:W.string().min(1).max(100),type:W.enum(W_),label:W.string().min(1).max(255),required:W.boolean().optional(),options:W.array(W.string()).optional()}),j0=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()}),O0=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(Or).optional(),mode:W.enum(["bind_existing","provision"]),list_mode:W.enum(["page","embedded"]).optional(),fields:W.array(Or).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"],V_=["text","textarea","email","phone","select","radio","multiselect","boolean","date","number"],H_=le.object({name:le.string().min(1).max(100),type:le.enum(V_),label:le.string().min(1).max(255),required:le.boolean().optional(),options:le.array(le.string()).optional()}),$_=le.string().regex(/^[a-z][a-z0-9-]{0,48}$/).optional(),M0=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:$_,description:le.string().min(1).max(1e3).optional(),fields:le.array(H_).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"})}),U0=le.object({name:le.string(),label:le.string(),cms_type:le.string(),required:le.boolean()});import{z as l}from"zod";var sn=/^[A-Za-z0-9][A-Za-z0-9_-]{0,127}$/,Tt=/^[A-Za-z][A-Za-z0-9_-]{0,127}$/,$n=/^[A-Za-z][A-Za-z0-9_]{0,99}$/,Ur=/^[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.-]+)?$/,Nr=2,Lr=3,Yn=l.string().regex(sn),Y_=l.string().regex(sn),Si=l.string().regex(sn),an=l.string().regex($n),fi=l.string().regex(Ur),X_=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(Tt)}).strict(),l.object({status:l.literal("missing"),form_code:l.string().regex(Tt)}).strict()]),Q_=l.object({value:fi,label:l.string().trim().min(1).max(255)}).strict(),Z_=l.object({kind:l.literal("field"),field_name:an,type:l.enum(Hn),label:l.string().trim().min(1).max(255),required:l.boolean(),span:l.enum(["full","half"]),options:l.array(Q_).max(100),max_files:l.number().int().min(1).max(5).optional()}).strict(),J_=l.object({kind:l.literal("step-break"),step_id:l.string().regex(sn)}).strict(),eh=l.discriminatedUnion("kind",[Z_,J_]),th=l.object({field_name:an,type:l.enum(Hn),last_label:l.string().max(255)}).strict(),nh=l.object({field_name:an,value:fi,last_label:l.string().max(255)}).strict(),sh=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()]),ih={select:2,radio:2,multiselect:1,DropdownSelection:2,RadioButton:2,Checkbox:1};function Ue(t){return t.toLowerCase()}function qr(t,n){return t.trim().toLocaleLowerCase(n)}function Rt(t,n){return`${Ue(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=ih[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:X_,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(eh).min(1).max(200),source:sh,retired:l.object({fields:l.array(th).max(1e3),options:l.array(nh).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<Nr&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`multistep requires runtime version ${Nr}`}),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=>Ue(c.field_name)),["nodes"],"field_name must be unique",n),he(t.retired.fields.map(c=>Ue(c.field_name)),["retired","fields"],"retired field_name must be unique",n);let r=new Set(t.retired.fields.map(c=>Ue(c.field_name)));for(let[c,g]of s)r.has(Ue(g.field_name))&&n.addIssue({code:"custom",path:["nodes",c,"field_name"],message:"retired field_name cannot be reused"}),bi(g.type,g.options.length,["nodes",c,"options"],n),g.type==="file"?t.min_runtime_version<Lr&&n.addIssue({code:"custom",path:["min_runtime_version"],message:`file fields require runtime version ${Lr}`}):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=>qr(j.label,t.content_locale)),["nodes",c,"options"],"option label must be unique within a field",n);he(t.retired.options.map(c=>Rt(c.field_name,c.value)),["retired","options"],"retired option identity must be unique",n);let _=new Set(t.retired.options.map(c=>Rt(c.field_name,c.value)));for(let[c,g]of s)for(let[j,E]of g.options.entries())_.has(Rt(g.field_name,E.value))&&n.addIssue({code:"custom",path:["nodes",c,"options",j,"value"],message:"retired option value cannot be reused"})}),ah=["copy.title","copy.description","copy.submit_button","copy.success_message","copy.error_message","nodes.*.label","nodes.*.options.*.label"],oh=new Set(ah);function W0(t){let n=t.map(s=>typeof s=="number"||/^\d+$/.test(s)?"*":s).join(".");return oh.has(n)}function V0(t,n){let s=[],a=t.nodes.filter(c=>c.kind==="field"),i=new Map(n.nodes.filter(c=>c.kind==="field").map(c=>[Ue(c.field_name),c])),r=new Map(n.retired.fields.map(c=>[Ue(c.field_name),c])),_=new Map(n.retired.options.map(c=>[Rt(c.field_name,c.value),c]));for(let c of a){let g=Ue(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(Rt(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(Ue(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(Rt(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 rh=l.enum(Nt),et=l.object({english:l.string().max(1e3),translations:l.partialRecord(rh,l.string().max(1e3)).optional()}).strict(),ch=l.object({template_option_key:l.string().regex(Ur),label:et}).strict(),mh=l.object({template_field_key:l.string().regex($n),type:l.enum(Hn),label:et,required:l.boolean(),span:l.enum(["full","half"]),options:l.array(ch).max(100)}).strict(),lh=l.object({template_step_key:l.string().regex($n),after_field_key:l.string().regex($n)}).strict(),H0=["lead-generation","trial-and-samples","quote-and-commerce","appointments-and-visits","resources-and-subscriptions","service-and-channel"],$0=[1,1,1,1,1,1],Gr=l.string().regex(hi),ph=l.object({schema_version:l.literal(1),slug:Gr,name:et,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"})}),dh=l.object({schema_version:l.literal(1),slug:l.string().regex(hi),version:l.string().regex(Fr),category:Gr,copy:l.object({title:et,description:et,submit_button:et,success_message:et,error_message:et}).strict(),layout:l.object({columns:l.enum(["one","two"])}).strict(),fields:l.array(mh).min(1).max(200),step_breaks:l.array(lh).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"}),bi(_.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(ph).max(500),templates:l.array(dh).max(500)}).strict().superRefine((t,n)=>{let s=(i,r)=>{let _=Nt.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=fa(n),a=s?t.translations?.[s]:void 0;return a!==void 0&&a.trim()!==""?a:t.english}var uh=["Text","Summary","Email","Phone","DropdownSelection","RadioButton","Checkbox","Boolean","Date","Num","MultipleFile","SpecificFile"],gh={text:"Text",textarea:"Summary",email:"Email",phone:"Phone",select:"DropdownSelection",radio:"RadioButton",multiselect:"Checkbox",boolean:"Boolean",date:"Date",number:"Num",file:"MultipleFile"},_h=l.object({value:fi,label:l.string().trim().min(1).max(255)}).strict(),hh=l.object({field_name:an,field_type:l.enum(uh),field_label:l.string().trim().min(1).max(255),is_required:l.boolean(),sort_order:l.number().int().nonnegative(),options:l.array(_h).max(100)}).strict(),zr=l.object({version:l.literal(1),locale:de,fields:l.array(hh).min(1).max(200)}).strict().superRefine((t,n)=>{he(t.fields.map(s=>Ue(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=>qr(i.label,t.locale)),["fields",s,"options"],"option label must be unique within a field",n)});function Q0(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":gh[s.type],field_label:s.label,is_required:s.required,sort_order:a,options:s.options.map(i=>({...i}))}));return zr.parse({version:1,locale:t.content_locale,fields:n})}var te=l.string().regex(/^sha256:[0-9a-f]{64}$/),Sh=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"])]),fh=l.object({path:Sh,content_hash:te.nullable()}).strict(),bh=l.array(fh).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(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"})}),yh=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(),Kr=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"}),Z0=l.object({site_id:I,form_block_id:Y_,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:Kr,standardization:xi}).strict(),xh=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:Kr,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"})}),Eh=["created","validated","binding_reserved","candidate_ready","cms_applied","snapshot_promoted","committed","compensating","recovery_required","failed"],Ei=l.enum(Eh),Ih=["pending","running","succeeded","failed","recovery_required"],Br=l.enum(Ih),Rh=["candidate_abandon","snapshot_reconcile","cms_restore"],Wr=l.enum(Rh),Th=["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(Th),Vr=l.enum(["wait","resume","retry_new_operation","manual_recovery","none"]),Hr=l.enum(["not_started","pending","succeeded","failed"]),$r=l.object({operation_id:Si,operation_fingerprint:te,site_id:I,form_definition_id:Yn,stage:Ei,status:Br,base_snapshot_id:x,candidate_snapshot_id:x.nullable(),before_form_code:l.string().regex(Tt).nullable(),materialized_form_code:l.string().regex(Tt).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:Wr.nullable(),last_error_code:Ii.nullable(),retryable:l.boolean(),next_action:Vr,preview_refresh_status:Hr,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:$r}).strict(),J0=Ri,eP=Ri,tP=l.object({operation_fingerprint:te}).strict(),nP=Ri,kh=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},xh),sP=l.object({operation:$r,request:kh,cms_replace_result:l.unknown().nullable()}).strict(),Ph=l.object({stage:Ei.optional(),status:Br.optional(),candidate_snapshot_id:x.nullable().optional(),before_form_code:l.string().regex(Tt).nullable().optional(),materialized_form_code:l.string().regex(Tt).nullable().optional(),materialized_form_spec_hash:te.nullable().optional(),retry_count:l.number().int().nonnegative().optional(),failure_stage:Wr.nullable().optional(),last_error_code:Ii.nullable().optional(),retryable:l.boolean().optional(),next_action:Vr.optional(),preview_refresh_status:Hr.optional()}).strict(),iP=l.object({expected_updated_at:l.string().datetime({offset:!0}),operation:Ph,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"}),aP=l.object({code:Ii,message:l.string().trim().min(1).max(500),retryable:l.boolean(),operation_id:Si.optional(),stage:Ei.optional()}).strict();function wh(t){return yh.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 Mr(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 Mr(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(_i(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=>(Mr(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 oP(t){return Xn(yi.parse(t))}async function rP(t){return Xn(zr.parse(t))}async function cP(t){let n=bh.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 mP(t){return Xn(wh(t))}import{z as A}from"zod";var dP=["page-seo","root-layout-metadata","nav-items"],uP=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()}),gP=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()}),Yr=()=>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()}),_P=Yr().extend({children:A.array(Yr()).optional()}),Ah=["title","description","keywords","breadcrumbs_json.*.name","breadcrumbs_json.*.text"],vh=["path","meta_tags_json.**","schema_json.**","breadcrumbs_json.*.url"],Ch=["title","title.default","title.template","title.absolute","description","keywords","openGraph.title","openGraph.description","openGraph.siteName","openGraph.images.*.alt","twitter.title","twitter.description"],Dh=["metadataBase","openGraph.type","openGraph.url","openGraph.locale","openGraph.images.*","openGraph.images.*.url","twitter.card","twitter.images.*","alternates.canonical"],jh=["label","description","badge"],Oh=["href","targetType","role","iconKey"],Xr={"page-seo":{localizable:Ah,machine:vh},"root-layout-metadata":{localizable:Ch,machine:Dh},"nav-items":{localizable:jh,machine:Oh}},Qr="*",Zr="**",Nh="children";function Lh(t){return typeof t=="number"||/^\d+$/.test(t)?Qr:t}function Jr(t,n){let s=n.map(Lh);return t!=="nav-items"?s:s.filter(a=>a!==Qr&&a!==Nh)}function ec(t,n){let s=t.split(".");for(let a=0;a<s.length;a+=1){if(s[a]===Zr)return!0;if(a>=n.length||s[a]!==n[a])return!1}return s.length===n.length}function Mh(t,n){let s=t.split(".");if(n.length>=s.length)return!1;for(let a=0;a<n.length;a+=1){if(s[a]===Zr)return!0;if(s[a]!==n[a])return!1}return!0}function hP(t,n){let s=Jr(t,n);return s.length===0?!1:Xr[t].localizable.some(a=>ec(a,s))}function SP(t,n){let s=Jr(t,n);if(s.length===0)return!0;let{localizable:a,machine:i}=Xr[t];return[...a,...i].some(r=>ec(r,s)||Mh(r,s))}var yP=["product-search","migration-products","standard-form","form-submission-infrastructure"],Uh=[{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/${Be}.ts`,materializer:"migration-products"},{path:`components/site/generated/${Be}-list.tsx`,materializer:"migration-products"},{path:`components/site/generated/${Be}-list-view.tsx`,materializer:"migration-products"},{path:`components/site/generated/${Be}-detail-view.tsx`,materializer:"migration-products"},{path:`app/${Be}/[slug]/page.tsx`,materializer:"migration-products"},{path:`components/site/generated/${Be}-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"}],xP=[{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 qh(t){return t.length>0&&!t.includes("/")&&!t.includes(".")}function EP(t){return Uh.some(n=>n.path===t)?!0:Fh.some(n=>!t.startsWith(n.prefix)||!t.endsWith(n.suffix)?!1:qh(t.slice(n.prefix.length,t.length-n.suffix.length)))}import{z as Ve}from"zod";var Gh=["provisioning","cms_app_created","seeded","ready","failed"],kP=Ve.object({tenant_id:Ve.string().min(1),site_id:I,collection_slug:Ve.string().min(1),cms_collection_id:Ve.string().min(1).nullable(),status:Ve.enum(Gh),owned_by_vcp:Ve.boolean(),run_id:V.nullable(),last_error:Ve.string().nullable(),created_at:Ve.string().datetime(),updated_at:Ve.string().datetime()});var tc="/vibe/v1";function wP(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(tc)?a:tc,s.href.replace(/\/+$/,"")}catch{return n}}import{z as u}from"zod";var Qn=u.string().url().refine(rS,{message:"URL must use http or https"}),nc=u.string().trim().pipe(Qn),zh=u.object({task_type:u.literal("home_url"),task_url:nc,planned_num:u.number().int().min(1).max(20).optional()}).strict(),Kh=u.object({task_type:u.literal("url_list"),urls:u.array(Qn).min(1).max(1e4)}).strict(),DP=u.discriminatedUnion("task_type",[zh,Kh]),jP=u.object({page:u.coerce.number().int().positive().default(1),page_size:u.coerce.number().int().min(1).max(20).default(20)}).strict(),OP=u.object({home_url:nc}).strict(),dt=u.string().uuid(),kt=u.string().uuid(),NP=u.object({task_uuid:dt}).strict(),sc=u.enum(["URL_DISCOVERY","PAGE_CRAWL","TASK_SCHEDULING","RESULT_PERSISTENCE"]),Bh=u.object({task_uuid:dt,status:u.literal("NOT_STARTED"),total:u.literal(0)}).strict(),Wh=u.object({task_uuid:dt,status:u.literal("PROCESSING"),total:u.literal(0)}).strict(),LP=u.enum(["no_suitable_page_candidate","page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"]),Vh=u.discriminatedUnion("status",[u.object({role:Xe,status:u.literal("selected"),reason_code:u.null()}).strict(),u.object({role:Xe,status:u.literal("not_found"),reason_code:u.literal("no_suitable_page_candidate")}).strict(),u.object({role:Xe,status:u.literal("unknown"),reason_code:u.enum(["page_discovery_unavailable","page_selection_unavailable","page_selection_invalid","page_content_unavailable"])}).strict()]),ic=u.array(Vh).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 Xe.options)s.has(a)||n.addIssue({code:"custom",message:`discovery coverage is missing role ${a}`})}),Hh=u.object({task_uuid:dt,status:u.literal("SUCCEEDED"),total:u.number().int().positive(),discovery_coverage:ic.optional()}).strict(),$h=u.enum(["TASK_FAILED","PROVIDER_CAPABILITY_LIMIT","WEBSITE_UNREACHABLE"]),Yh=u.object({task_uuid:dt,status:u.literal("FAILED"),total:u.literal(0),error_code:$h,error_message:u.string().min(1),failure_stage:sc}).strict(),MP=u.discriminatedUnion("status",[Bh,Wh,Hh,Yh]),Xh=u.object({url:Qn,raw_html:u.string().min(1)}).strict(),UP=u.object({task_uuid:dt,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(Xh).max(20),discovery_coverage:ic.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"})}),FP=u.object({task_code:kt}).strict(),Qh=u.object({task_code:kt,status:u.literal("NOT_STARTED")}).strict(),Zh=u.object({task_code:kt,status:u.literal("PROCESSING")}).strict(),Jh=u.object({task_code:kt,status:u.literal("SUCCEEDED"),urls:u.array(Qn)}).strict(),eS=u.literal("SITEMAP_DISCOVERY_FAILED"),tS=u.object({task_code:kt,status:u.literal("FAILED"),error_code:eS,error_message:u.string().min(1)}).strict(),qP=u.discriminatedUnion("status",[Qh,Zh,Jh,tS]),GP=u.object({company_name:u.string().regex(/\S/u)}).strict(),nS=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:nS,created_at:u.string().datetime(),updated_at:u.string().datetime()}),sS=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(),iS=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(),ac=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(),oc=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(),zP=u.discriminatedUnion("status",[ac,oc]),KP=u.discriminatedUnion("status",[sS,iS,ac,oc]),aS=["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"],oS=u.enum(aS),BP=u.object({error_code:oS,error_message:u.string().min(1),failure_stage:sc.optional(),task_uuid:dt.optional(),task_code:kt.optional()}).strict();function rS(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(lS,{message:"URL must use http or https"}),rc=N.string().min(1).max(512),Jn=N.string().datetime({offset:!0}),cc=N.enum(["scraping","completed","failed","expired"]),HP=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(),$P=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:rc,expires_at:Jn.optional()}).strict(),QP=N.object({status:cc,urls:N.array(ve).max(1e5),next:ve.optional(),expires_at:Jn}).strict(),ZP=N.object({url:ve,formats:N.tuple([N.literal("rawHtml")]),only_main_content:N.literal(!1),max_age:N.number().int().nonnegative()}).strict(),JP=N.object({url:ve,raw_html:N.string().min(1),status_code:N.number().int().min(100).max(599).nullable()}).strict(),ew=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(),tw=N.object({batch_id:rc,expires_at:Jn.optional()}).strict(),cS=N.object({url:ve,raw_html:N.string().min(1)}).strict(),nw=N.object({status:cc,total:N.number().int().nonnegative(),completed:N.number().int().nonnegative(),pages:N.array(cS).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"})}),mS=N.object({url:ve,error_message:N.string().min(1)}).strict(),sw=N.object({errors:N.array(mS).max(1e4),robots_blocked:N.array(ve).max(1e4)}).strict(),iw=N.object({active:N.number().int().nonnegative(),waiting:N.number().int().nonnegative(),max_concurrency:N.number().int().positive()}).strict();function lS(t){try{let n=new URL(t).protocol;return n==="http:"||n==="https:"}catch{return!1}}import{z as f}from"zod";var lc=f.lazy(()=>rn),pS=f.enum(["page","block"]),ts=f.enum(["component","page","pages"]),dS=f.enum(["en-US","zh-CN","zh-TW","fr-FR","de-DE","es-ES","ja-JP","ko-KR"]),ut=dS,pc=f.object({requested_locale:ut,resolved_locale:ut,fallback_used:f.boolean()}).strict(),on=f.object({id:f.string().uuid(),key:f.string().min(1),name:f.string().min(1)}).strict(),es=on.extend({color:f.string().nullable()}).strict(),mw=f.object({kind:pS,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(),uS=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:on.nullable(),tags:f.array(es),page_count:f.number().int().nonnegative(),component_count:f.number().int().nonnegative(),locale:pc}).strict(),lw=f.object({items:f.array(uS),facets:f.object({categories:f.array(on),tags:f.array(es)}).strict(),next_cursor:f.string().nullable()}).strict(),pw=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:lc,target_page_id:f.string().min(1).optional()}).strict(),dw=f.object({next_sitemap:lc,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:pc,warnings:f.array(f.string())}).strict(),dc=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(),mc=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(dc).min(1).max(100),thumbnail:f.string().url().optional(),source:f.unknown().optional()}).strict(),gS=f.union([dc,mc,f.object({pages:f.array(mc).min(1).max(50),thumbnail:f.string().url().optional(),source:f.unknown().optional()}).strict()]),_S=f.object({title:f.string().min(1).max(200),description:f.string().min(1).max(1e3),prompt:f.string().min(1).max(8192)}).strict(),hS=f.object({locale:ut,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(),_S)}).strict()}).strict(),uw=f.object({templateId:f.string().uuid(),stableKey:f.string().min(1),type:ts,resolvedVersion:f.number().int().positive(),contentSchemaVersion:f.literal(3),structure:gS,requestedLocale:ut,resolvedLocale:ut,fallbackUsed:f.boolean(),contents:f.array(hS).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=SS(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."})}),gw=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:on.nullable(),tags:f.array(es),pageCount:f.number().int().nonnegative(),componentCount:f.number().int().nonnegative(),requestedLocale:ut,resolvedLocale:ut,fallbackUsed:f.boolean()}).strict()),facets:f.object({categories:f.array(on),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 SS(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 _w(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 fS=["pending_dns","active","failed","removing"],bS=H.enum(fS),yS=["serve_site","redirect_301"],xS=H.enum(yS),ES=["traffic","ownership","certificate_delegation"],gc=H.enum(ES),IS=["pending","verified"],RS=H.enum(IS),ki=H.enum(["prepare_configuration","apply_configuration","verify_dns"]),TS=H.enum(["accepted","running","succeeded","failed"]),kS=H.object({code:H.string().min(1),message:H.string().min(1)}).strict(),PS=H.object({purpose:gc,verified:H.boolean(),observedValues:H.array(H.string())}).strict(),wS=H.object({ready:H.boolean(),providerReady:H.boolean(),dnsVerified:H.boolean(),records:H.array(PS)}).strict(),AS=H.object({purpose:gc,type:H.string().min(1),name:H.string().min(1),value:H.string().min(1),verificationStatus:RS}).strict(),uc=H.object({id:H.string().min(1),hostname:H.string().min(1),isPrimary:H.boolean(),routingMode:xS,observedStatus:bS,lastVerifiedAt:H.string().datetime().nullable(),dnsRecords:H.array(AS)}).strict().superRefine((t,n)=>{vS(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"})}),_c=H.object({primaryDomain:uc.nullable(),redirectDomains:H.array(uc)}).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:TS,error:kS.nullable(),result:wS.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 vS(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 R}from"zod";var CS=R.enum(["active","completed","canceled"]),DS=R.enum(["quality","domain","gsc","publish"]),hc=R.enum(["pending","running","succeeded","failed"]),Sc=R.enum(["pending","running","completed"]),jS=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:Sc,result_text:R.string()}).strict(),OS=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:Sc,problem_group_count:R.number().int().nonnegative(),groups:R.array(jS)}).strict(),NS=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:hc,error_info:R.record(R.string(),R.unknown()).nullable(),created_at:R.string().min(1),updated_at:R.string().min(1)}).strict(),LS=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(OS)}).strict()]),MS=R.object({quality_info:NS,quality_detail:LS}).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"]})}),gt=R.object({id:na,tenant_id:R.string().min(1),site_id:I,status:CS,current_step:DS,quality_task_code:R.string().uuid().nullable(),quality_task_status:hc,publish_deployment_id:qe.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"})}),Rw=R.object({}).strict(),Tw=R.object({expected_revision:R.number().int().nonnegative(),current_step:R.enum(["domain","gsc","publish"]),skip_domain_binding:R.boolean().optional()}).strict(),kw=R.object({expected_revision:R.number().int().nonnegative()}).strict(),US=R.object({workflow:gt.nullable(),can_cancel:R.boolean()}).strict(),Pw=L(US).strict(),FS=R.object({workflow:gt,can_cancel:R.boolean()}).strict(),ww=L(FS).strict(),qS=R.object({workflow:gt,deployment:R.lazy(()=>tt)}).strict(),Aw=L(qS).strict(),GS=R.object({workflow:gt,can_cancel:R.boolean(),quality_result:MS.optional(),message:R.string().min(1).optional()}).strict(),vw=L(GS).strict();var zS=cn.object({hostname:cn.string().min(1),expected_revision:cn.number().int().nonnegative()}).strict(),fc=cn.object({workflow:gt,operation:Pi}).strict(),KS=L(fc).strict(),wi=cn.object({workflow:gt,operation:Pi.nullable()}).strict(),BS=L(wi).strict(),WS=wi,VS=L(WS).strict(),Lw=L(_c).strict(),Mw=zS,Uw=fc,Fw=KS,qw=wi,Gw=BS,zw=VS;import{z as Pe}from"zod";var HS=["started","success","failed","canceled"],Ai=Pe.enum(HS),$S=["inactive","pending_binding","active"],vi=Pe.enum($S),YS=["domain","url_prefix"],Ci=Pe.enum(YS),XS=["not_connected","authorizing","matching_property","ready","failed","canceled","domain_mismatch"],Di=Pe.enum(XS),Fe=Pe.string().nullable(),bc=Pe.object({}).strict(),ji=Pe.object({authorize_url:Pe.string().url(),custom_domain:Fe}).strict(),yc=L(ji),QS=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(),xc=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=JS(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`})}),ZS=L(xc);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 JS(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,_=ef(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 ef(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 Vw=bc,Hw=ji,$w=yc,Yw=Di,Xw=Ai,Qw=vi,Zw=Ci,Jw=Di,eA=bc,tA=ji,nA=yc,sA=QS,iA=xc,aA=ZS;var Ec=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/,Ic="VCP_E2B_PREVIEW_PROXY_DOMAIN must be a valid hostname.";function tf(t){let n=t?.trim().toLowerCase()??"";if(!n)return null;if(n.length>253||!n.includes(".")||!n.split(".").every(s=>Ec.test(s)))throw new Error(Ic);return n}function rA(t){let n=tf(t.proxyDomain);if(!n)return null;let s=t.sandboxId.trim();if(!Ec.test(s))throw new Error("sandboxId must be a valid DNS label.");if(`${s}.${n}`.length>253)throw new Error(Ic);return`https://${s}.${n}/`}function nf(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:Rc(n.primaryLinks,t,a,r,_,i,"showInHeader"),footerLinks:Rc(n.footerLinks,t,a,r,_,i,"showInFooter")}}function Rc(t,n,s,a,i,r,_){let c=new Set,g=[];for(let[F,q]of t.entries()){let ee=sf(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:Tc(q,ae,r)}});continue}if(!ae){g.push({kind:"independent",link:q});continue}if(!ae.navigation[_])continue;c.add(ae.slug);let Ct=ee===ae.slug?q.href:af(q.href,ae.slug);g.push({kind:"page",page:ae,link:{...q,label:Tc(q,ae,r),href:Ct},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 Tc(t,n,s){let a=s.get(n.id);return t.label===(a?.title??n.title)?n.title:t.label}function sf(t){if(!t.startsWith("/")||t.startsWith("//"))return null;let n=t.search(/[?#]/u);return n===-1?t:t.slice(0,n)}function af(t,n){let s=t.search(/[?#]/u);return s===-1?n:`${n}${t.slice(s)}`}import{z as k}from"zod";var kc=20*1024*1024,of=kc,Pc=["jpg","jpeg","png","gif","webp","bmp"],wc=["mp4","avi","mov","webm","mkv"],Ac=["mp3","wav","aac","flac","ogg","wma","m4a"],vc=["pdf","doc","docx","xls","xlsx","ppt","pptx","txt","md","csv"],Cc=[...vc,"zip","rar","json","xmind","psd","ai","fig","sketch"],rf=[...Pc,...wc,...Ac,...Cc],Dc=["image/jpeg","image/png","image/gif","image/webp","image/bmp"],jc=["video/mp4","video/x-msvideo","video/quicktime","video/webm","video/x-matroska"],Oc=["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"],cf=[...Dc,...jc,...Oc],Nc=k.enum(["image","video","audio","file"]),Lc=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:Lc,created_at:k.string().min(1).nullable()}),mf=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:Nc.default("image")}),lf=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()})}),pf=k.object({code:k.literal(0),message:k.string(),data:Oi}),Mc=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()}),df=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()}),uf=k.object({code:k.literal(0),message:k.string(),data:k.object({items:k.array(Mc),page:k.number().int().min(1),page_size:k.number().int().min(1),total:k.number().int().nonnegative(),total_pages:k.number().int().nonnegative()})}),Uc=k.string().url().refine(ff,{message:"download_location must be an official Unsplash download URL"}),gf=k.object({download_location:Uc}),_f=k.object({code:k.literal(0),message:k.string(),data:k.object({reported:k.boolean()})}),hf=k.object({source_id:k.number().int().positive(),source_title:k.string().min(1).max(255),source_url:Ge,resource_id:k.number().int().positive()}),Sf=k.object({code:k.literal(0),message:k.string(),data:k.object({reported:k.boolean()})});function ff(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 bf=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"}),yf=Ce.object({ok:Ce.literal(!0),design_plan_version:Ce.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"]),xf=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})}),Ef=e.enum(["text-options","motion-slider","positioning"]),Ui=e.enum(["none","subtle","moderate","expressive"]),If=e.enum(["compact","comfortable","airy","editorial"]),Rf=Ui,Kc=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:Mi.optional(),conversionHints:ot.optional()}),kf=e.object({id:e.string(),type:Ef,question:e.string(),tag:e.string(),aiThinking:e.string(),options:e.array(Tf),source:e.enum(["ai-detected","always-ask"]),sourceDetail:e.string(),positioning:xf.optional()}),Fi=e.object({questions:e.array(kf).min(1).max(6)}),MA=e.object({tenant_id:e.string().min(1),site_id:I,brief_id:ht,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()}),Bc=e.enum(["model_schema_invalid","provider_rate_limited","provider_unavailable","aborted","unknown"]),UA=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(Kc).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:Bc.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)})]),FA="SITE_PLANNING_INPUT_FROZEN",qA="SITE_PLANNING_LOCKED",GA="SITE_STRUCTURE_CONFIRMATION_REQUIRED",zA="SITE_STRUCTURE_CONFIRMATION_STALE",KA=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)}),BA=e.object({name:e.string().min(1).max(120),brief:e.string().min(20).max(1e3)}),WA=e.object({name:e.string().min(1).max(120)}),VA=e.object({name:e.string().min(1).max(120),default_locale:de.optional()}),HA=e.object({body:e.string().min(20).max(1e3)}),$A=e.object({body:e.string().min(20).max(1e3)}),qi=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:qi,site_name:e.string().trim().min(1).max(255).optional()}),XA=L(Ma),QA=L(Ua),ZA=L(Fa),JA=L(Ja),ev=L(eo),tv=L(to),nv=L(so),sv=L(io),iv=L(ao),av=L(e.object({site_id:I,site_url:qi})),it=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:qe.nullable().optional(),deployed_url:e.string().url().nullable(),default_locale:de,owner_locale:de.optional(),cms_site_id:ba.nullable().optional(),cms_site_url:qi.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:ht,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)}),ov=e.object({site:it,brief:Gi,next_step:e.literal("clarify")}),rv=e.object({site:it,brief:Gi}),cv=e.object({brief:Gi}),Pf=e.enum(["queued","running","succeeded","failed","cancelled"]),Wc=e.enum(["clarify","sitemap","workspace"]),Vc=e.enum(["clarify","sitemap","initial_generation","iteration"]),Hc=e.enum(["clarify","sitemap","workspace","summarize"]),st=e.object({id:V,tenant_id:e.string().min(1),site_id:I,agent_type:Wc,run_kind:Vc,status:Pf,model_route:Hc,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)}),mv=e.object({run_id:V.optional(),site_id:I,agent_type:Wc,run_kind:Vc.optional(),model_route:Hc,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"})}),lv=e.object({agent_run:st,next_step:e.literal("stream_events")}),$c=e.enum(["draft","candidate","deleting","current","failed"]),He=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:je.nullable().optional(),reason:e.enum(["initial_generation","workspace_edit","pre_deploy","manual_save","rollback","template_upgrade","subsite_clone"]),status:$c,created_at:e.string().min(1)}),pv=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:je.optional(),reason:He.shape.reason,status:e.enum(["draft","candidate","current","failed"]).default("candidate"),source_run_id:V.optional()}),dv=e.object({site:it,snapshot:He,next_step:e.literal("workspace")}),uv=e.object({expected_manifest_hash:He.shape.manifest_hash,manifest_hash:He.shape.manifest_hash,object_key:He.shape.object_key}).strict(),gv=e.union([e.object({base_snapshot_id:x.nullable(),source_run_id:V.optional()}).strict(),e.object({skip_base_check:e.literal(!0)}).strict()]),wf=e.object({site:it,snapshot:He,next_step:e.literal("workspace")}),_v=e.object({snapshot:He}),hv=e.object({status:e.literal("deleting"),snapshot_id:x,object_key:e.string().min(1)}),Sv=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)}),Af=as.extend({reason:He.shape.reason,status:$c}),fv=e.object({accepted_commit:e.string().min(1),source_run_id:V.optional()}),bv=e.object({site_version:as,next_step:e.literal("workspace")}),yv=e.object({owner_id:e.string().min(1)}).strict(),xv=e.discriminatedUnion("acquired",[e.object({acquired:e.literal(!0)}).strict(),e.object({acquired:e.literal(!1)}).strict()]),Ev=e.object({owner_id:e.string().min(1)}).strict(),Iv=e.object({released:e.literal(!0)}).strict(),Rv="TEMPLATE_UPGRADE_LOCK_LOST",Tv=e.object({base_snapshot_id:x,accepted_commit:as.shape.accepted_commit,owner_id:e.string().min(1)}).strict(),kv=wf.strict(),Pv=e.object({site_versions:e.array(Af)}),wv=e.object({site:it,snapshot:He,site_version:as,next_step:e.literal("workspace")}),Av=e.object({snapshot_id:x,force_rehydrate:e.boolean().optional()}),vf=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()})]),vv=e.object({tenant_id:e.string().min(1),site_id:I,snapshot_id:x}).strict(),Cv=vf,zi=e.enum(ft),Yc=e.enum(["quality_check","publish"]),tt=e.object({id:qe,tenant_id:e.string().min(1),site_id:I,snapshot_id:x,type:Yc.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)}),Dv=e.object({tenant_id:e.string().min(1),site_id:I,expected_snapshot_id:x}).strict(),jv=e.object({deployment:tt}),Ov=e.object({tenant_id:e.string().min(1),site_id:I,deployment_id:qe}).strict(),Nv=e.object({deployment:tt}),Lv=e.object({}).strict(),Mv=e.object({snapshot_id:x.optional()}).strict(),Cf=e.object({deployment:tt}),Uv=L(Cf),Fv=e.object({deployment:tt.nullable()}),qv=e.object({deployment:tt}),Fc=e.object({id:qe,type:Yc.default("publish"),status:zi,url:e.string().url().nullable(),error_code:e.string().min(1).nullable(),provider_deployment_id:e.string().min(1).nullable()}),Df=e.object({current:Fc.nullable(),latest_released:Fc.nullable()}),Gv=L(Df),jf=e.enum(["deployment.snapshot","deployment.status.changed","deployment.finished","deployment.failed","deployment.realtime.recovered","server.error"]),Pt=e.object({id:e.string().min(1),tenant_id:e.string().min(1),site_id:I,deployment_id:qe,seq:e.number().int().positive(),sent_at:e.string().min(1)}),ns=e.object({deployment:tt,steps:Bo.default([])}),zv=e.discriminatedUnion("type",[Pt.extend({type:e.literal("deployment.snapshot"),payload:ns}),Pt.extend({type:e.literal("deployment.status.changed"),payload:ns}),Pt.extend({type:e.literal("deployment.finished"),payload:ns}),Pt.extend({type:e.literal("deployment.failed"),payload:ns}),Pt.extend({type:e.literal("deployment.realtime.recovered"),payload:e.object({action:e.literal("refresh")})}),Pt.extend({type:e.literal("server.error"),payload:e.object({code:e.string().min(1),message:e.string().min(1),retryable:e.boolean()})})]),Kv=e.object({tenant_id:e.string().min(1),site_id:I,deployment_id:qe,status:zi,updated_at:e.string().min(1)}),Of="vcp:deployments",Bv={path:"/v1/sites/:site_id/deployments/:deployment_id/socket",redis_channel:Of,outbound_message_schema:"DeploymentWsServerMessageSchema",message_types:[...jf.options]},Nf=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)})}),Wv=e.object({error:Nf.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:st})})}),Vv=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({})}),Lf=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()}),Mf=e.object({question:e.string().min(1),answer:e.string().min(1)}),Hv=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)}),$v=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()}),Uf=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:Uf.optional()}),Ff=e.enum(["system_recommended","user_picked","user_picked_extended","deterministic_fallback"]),wt=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:Ff.default("system_recommended")}),$=e.string().min(1).max(2e3),qc=e.string().min(1).max(120),Xc=e.object({visualDirection:$,brandFeeling:$,paletteIntent:$,typographyIntent:$,density:If,motionLevel:Rf,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,Qc=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()}),Zc=e.enum(["model_call","validation","repair","preview","worker_group"]),nt=e.enum(["generating","generating_design_plan","checking_quality","updating_design_memory"]),Jc=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(qc).max(12).optional(),templateRecipeRefs:e.array(qc).max(12).optional()}),em=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()}),qf=e.enum(["solid","floating"]),Gf=e.enum(["background","card","primary","frosted"]),zf=e.enum(["sticky","hide-on-scroll","static"]),Kf=e.enum(["bar","island"]),Bf=e.object({variant:qf,surface:Gf.optional(),behavior:zf.optional(),shape:Kf.optional()}),Wf=e.object({form:$,layoutIntent:$,scrollBehavior:$,shell:Bf.optional(),avoidPatterns:e.array($).max(10).optional()}),Vf=e.enum(["background","card","primary","inverse"]),Hf=e.object({surface:Vf}),$f=e.object({form:$,composition:$,shell:Hf.optional(),avoidPatterns:e.array($).max(10).optional()}),Yf=e.object({pattern:$,intent:$}),tm=e.object({header:Wf,footer:$f,mobileNav:Yf}),nm=e.object({schemaVersion:e.literal(1).default(1),siteDesignContext:Xc,routeCards:e.record(e.string().min(1),Qc),blockContexts:e.record(e.string().min(1),Jc),selectedSkillPacks:e.array(wt).max(3).optional(),branding:em.optional(),chromeDesign:tm.optional()}),Xv=e.object({siteDesignContext:Xc.omit({imagePalette:!0}).optional(),routeCards:e.record(e.string().min(1),Qc).optional(),blockContexts:e.record(e.string().min(1),Jc).optional(),branding:em.optional(),chromeDesign:tm.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(),sm=e.string().regex(Ft,"Page slug must be '/' or a lowercase ASCII kebab-case absolute path."),Xf=new RegExp(`^/(?:${yt}(?:/${yt})*)?(?:\\?[^#\\s]*)?(?:#[^\\s]*)?$`),Qf=/^(?:#[^\s]*|[a-z][a-z0-9+.-]*:[^\s]+|\/\/[^\s]+)$/i,Zf=e.union([e.string().regex(Xf),e.string().regex(Qf)]),Gc=e.object({label:e.string(),href:Zf}).passthrough(),Jf=e.object({primaryLinks:e.array(Gc),footerLinks:e.array(Gc)}),im=e.object({showInHeader:e.boolean(),showInFooter:e.boolean(),order:e.number()}).strict(),Wi=e.object({id:xe,slug:sm,title:e.string().trim().min(1),blocks:e.array(Bi).min(1),navigation:im}).strict(),eb=Bi.extend({type:e.string().nullable()}).strict(),tb=Wi.extend({slug:sm.nullable(),navigation:im.extend({showInHeader:e.boolean().nullable(),showInFooter:e.boolean().nullable()}).strict(),blocks:e.array(eb).min(1)}).strict(),nb=Bi.extend({id:e.string()}),sb=Wi.extend({id:e.string(),slug:e.string().min(1),blocks:e.array(nb).min(1)}),zc=e.object({label:e.string(),href:e.string().min(1)}),ib=e.object({primaryLinks:e.array(zc),footerLinks:e.array(zc)}),ab=e.discriminatedUnion("kind",[e.object({kind:e.literal("brief_clarify"),brief_id:ht,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:Jf,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:ab.optional()}),skillSelection:wt,visualTheme:Lf.optional(),userChoices:e.array(Mf).optional(),confirmedChoices:e.object({conversion:ot.optional()}).optional(),seoKeywords:e.array(kn).min(1).max(50).optional()}).strict(),At=ss.superRefine((t,n)=>{rm(t.pages,n)}),rn=ss.extend({pages:e.array(tb).min(1)}).strict().superRefine((t,n)=>{rm(t.pages,n)}),ob=e.enum(["slug","showInHeader","showInFooter"]),rb=e.object({page_id:xe,fields:e.array(ob).min(1).max(3)}).strict(),cb=e.object({page_id:xe,block_id:xe,fields:e.tuple([e.literal("type")])}).strict(),am=100,om=500,mb=e.object({pages:e.array(rb).max(am),blocks:e.array(cb).max(om)}).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(_)})}),Qv=e.object({sitemap:rn,targets:mb}).strict(),Zv=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(am),blocks:e.array(e.object({page_id:xe,block_id:xe,type:e.string().trim().min(1)}).strict()).max(om)}).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(_)})}),Jv=e.object({sitemap:At}).strict();function rm(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 eC=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(sb).min(1),navigation:ib}),lb=e.enum(["ai","user"]),vt=e.object({site_id:I,page_id:xe,edited_by:lb.default("ai"),source_agent_run_id:V.optional()}),tC=vt.extend({block_id:xe,target_index:e.number().int().min(0)}),pb=vt.extend({block_id:xe}),db=vt.extend({block_id:xe,instruction:e.string()}),nC=vt.extend({block_id:xe,variant:e.string().min(1).nullable()}),sC=vt.extend({block_id:xe,props:e.record(e.string(),e.unknown()),mode:e.enum(["replace","merge"]).default("replace")}),iC=vt.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()})}),ub=e.enum(["move_block","delete_block","update_block_instruction","change_block_variant","update_block_props","add_block"]),aC=e.discriminatedUnion("operation",[e.object({operation:e.literal("delete_block"),input:pb}).strict(),e.object({operation:e.literal("update_block_instruction"),input:db}).strict()]),gb=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"]),_b=e.object({status:e.literal("updated"),operation:ub,site_id:I,sitemap_id:ke,version:e.number().int().positive(),changed_pages:e.array(xe).min(1),requires_code_patch:e.literal(!0)}),hb=e.object({status:e.literal("failed"),code:gb,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),oC=e.discriminatedUnion("status",[_b,hb]),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:ot.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()}),Sb=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(),rC=e.object({source:e.object({kind:e.literal("step5_strategy")}).strict()}).strict(),fb=e.object({item_key:In,title:e.string().trim().min(1).max(200),selected_option_id:bt,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(),bb=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(),yb=e.object({pages:e.array(bb).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."})}),xb=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(fb).length(fe),structure_plan:yb.optional(),seo_keywords:e.array(kn).min(1).max(50).optional()}).strict().superRefine((t,n)=>{t.decisions.forEach((s,a)=>{s.item_key!==rt[a]&&n.addIssue({code:"custom",path:["decisions",a,"item_key"],message:"Step5 sitemap decisions must use the canonical order."})})}),cm=e.object({tenant_id:e.string().min(1),site_id:I,brief_id:ht,brief:e.string().min(20).max(1e3),answers:e.array(Vi).min(1).max(10),skillSelection:wt,site_default_locale:de.optional(),owner_locale:de.optional(),cms_site_id:e.string().min(1).nullish(),intent_pages:e.array(Sb).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(St).optional(),migration_products_enabled:e.boolean().optional()}),Eb=cm.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:xb}).strict(),cC=e.union([cm,Eb]),mm=e.enum(["planning","generating","validating","ready"]),Ib=e.enum(["salvaged","deterministic_fallback"]),Rb=e.enum(["model_exception_settled_prefix","model_exception_safe_root"]),lm={outcome:Ib.optional(),reason:Rb.optional(),attempts:e.number().int().positive().optional()};function pm(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 Tb=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:mm,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:At,...lm,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)})]),mC=Tb.superRefine(pm),dm=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 um(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 gm=dm.extend({sitemap:At}).superRefine(um),kb=dm.extend({sitemap:rn}).superRefine(um),lC=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:At,source_agent_run_id:V.optional()}),pC=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()}),dC=e.object({sitemap_id:ke,creation_key:e.string().min(1),sitemap:At,source_agent_run_id:V}),uC=e.object({site:it,sitemap:gm,next_step:e.literal("workspace")}).strict(),gC=e.object({site:it,sitemap:kb,next_step:e.literal("workspace")}).strict(),_C=e.object({site:it,sitemap:gm,next_step:e.literal("sitemap_review")}).strict(),Pb=e.object({id:Ji,tenant_id:e.string().min(1),site_id:I,brief_id:ht,questions:Fi,answers:e.array(Vi),selected_archetype:wt.optional(),completed_at:e.string().min(1).nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),hC=e.object({answers:e.array(Vi).min(1),questions:Fi,selected_archetype:wt.optional()}),SC=e.object({clarify_session:Pb}),fC=e.object({questions:Fi,selected_archetype:wt}),wb=e.object({id:cs,tenant_id:e.string().min(1),site_id:I,version:e.number().int().positive(),design_plan:nm,source_agent_run_id:V.nullable(),created_at:e.string().min(1),updated_at:e.string().min(1)}),bC=e.object({design_plan_id:cs.optional(),design_plan:nm,source_agent_run_id:V.optional()}),yC=e.object({design_plan:wb}),os=e.enum(["initial_generation","iteration"]),Ab=e.object({label:e.string().min(1).max(48),prompt:e.string().min(1).max(160)}).strict(),vb=e.enum(["model","derived","mixed","advisor"]),_m=e.object({suggestions:e.array(Ab).min(1).max(4),source:vb}).strict(),Cb=e.enum(["clean","salvaged","deterministic_fallback","baseline_retained"]),Db=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"]),jb=e.enum(["progress","assistant_final"]),hm=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"]),Ob=e.object({id:e.string().min(1),title:e.string().min(1),status:e.enum(["pending","running","completed","failed"])}),_t=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=>wm(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:_t,task_ids:e.array(e.string().min(1)),depends_on_groups:e.array(e.string().min(1)),target_paths:e.array(Se)}),Nb=e.enum(["style","media","chrome","section","layout","page"]),Qi=e.object({task_id:e.string().min(1),group_id:e.string().min(1),kind:Nb,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:_t,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"])}),xC=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}),EC=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:_t}),Sm=e.object({worker_count:e.number().int().nonnegative(),task_count:e.number().int().nonnegative(),group_count:e.number().int().nonnegative()}),fm=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()}),Lb=e.object({type:e.literal("text"),text:e.string(),state:e.enum(["streaming","done"]).optional()}),Mb=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)}),Fb=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()}),qb=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()}),Gb=e.object({type:e.string().regex(/^data-[a-zA-Z0-9_-]+$/),id:e.string().min(1).optional(),data:e.unknown()}),zb=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()}),Kb=e.object({type:e.literal("error"),errorText:e.string().min(1)}),Bb=e.object({type:e.literal("step-start")}),is=e.union([Lb,Mb,Ub,Fb,qb,Gb,zb,Kb,Bb]),Wb=e.string().min(1).max(512).refine(t=>wm(t)&&!/^[A-Za-z]:\//.test(t),{message:"Generated-code rescue paths must be safe relative POSIX paths without traversal."}),Vb=e.array(Wb).min(1).max(64),Hb=e.array(e.string().min(1).max(120)).min(1).max(64),$b=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:jb.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(Ob),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(Kc).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:mm,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:At,...lm,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:Sm,at:e.string().min(1)}).strict(),e.object({type:e.literal("workspace.worker.updated"),group_id:e.string().min(1),phase:Hi,status:_t,task_counts:fm,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:_t,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:Vb.optional(),degraded_page_ids:Hb.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:Cb,reason:Db,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(),_m.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:Bc.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:Ot.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:Zc,title:e.string().min(1).max(200),detail:e.string().max(360).optional(),title_code:nt.optional(),detail_code:nt.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:nt.optional(),detail_code:nt.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)})]),bm=$b.superRefine(pm).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:hm,payload:bm,created_at:e.string().min(1)}),IC=e.object({event_type:hm,payload:bm}).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"})}),RC=e.discriminatedUnion("status",[e.object({status:e.literal("appended"),agent_run:st,event:Li,next_cursor:e.number().int().nonnegative()}),e.object({status:e.literal("duplicate_ignored"),agent_run:st,event:Li,next_cursor:e.number().int().nonnegative()})]),TC=e.object({events:e.array(Li),next_cursor:e.number().int().nonnegative().optional()}),kC=e.object({after_sequence:e.coerce.number().int().nonnegative().default(0)}),PC=e.enum(["implemented","skeleton","planned"]),wC=e.enum(["GET","POST","PUT","PATCH","DELETE"]),AC=[{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/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"}],vC=[{method:"POST",path:"/v1/agent/clarify/:site_id",tag:"clarify",summary:"Stream Step 2 clarify questions as SSE; event_order includes optional skill.selecting, skill.selected, clarify.archetype_proposals, and run.failed on errors.",status:"implemented",request_body_schema:"ClarifyRunInputSchema without tenant_id/site_id",event_schema:"ClarifyStreamEventSchema",event_order:["run.started","skill.selecting","skill.selected","clarify.partial","clarify.archetype_proposals","clarify.finished","run.failed"]},{method:"POST",path:"/v1/agent/sitemap/:site_id",tag:"sitemap",summary:"Stream Step 3 sitemap generation as SSE; event_order includes sitemap.partial and run.failed on errors.",status:"implemented",request_body_schema:"Step5SitemapStartRequestSchema (browser marker only; API injects committed Step5 strategy)",event_schema:"SitemapStreamEventSchema",event_order:["run.started","sitemap.generating","sitemap.partial","sitemap.generated","sitemap.clamped","run.failed"]}],Yb=e.object({id:e.string().min(1),role:e.enum(["system","user","assistant"]),metadata:e.unknown().optional(),parts:e.array(is).min(1)}),ym=Yb.extend({role:e.literal("user")}),CC=e.object({base_snapshot_id:x.optional(),message:ym.optional(),client_run_key:e.string().min(1).max(200).optional()}).superRefine((t,n)=>{ln(t.message)&&n.addIssue({code:"custom",path:["message"],message:"Workspace startup message must not contain secrets",params:{errorCode:"WORKSPACE_MESSAGE_CONTAINS_SECRET"}})}),Xb=e.object({path:e.string().regex(/^\/v1\/workspace\/sites\/[^/]+\/socket$/),run_id:V,base_snapshot_id:x,run_kind:os}),DC=e.object({agent_run:st,websocket:Xb,next_step:e.literal("workspace_socket")}),jC=e.object({agent_run:st}),OC=e.object({agent_type:e.enum(["clarify","sitemap","workspace"])}),NC=e.object({agent_run:st}),LC=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)}),Qb=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()}),Zb=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:jn.optional(),selected_component:Qb.optional(),message:ym,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()})}),Co]),Jb=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:_m.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:Sm})}),J.extend({type:e.literal("workspace.worker.updated"),payload:e.object({group_id:e.string().min(1),phase:Hi,status:_t,task_counts:fm,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:_t,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:Ot.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:Zc,title:e.string().min(1).max(200),title_code:nt.optional(),detail:e.string().max(360).optional(),detail_code:nt.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:nt.optional(),detail:e.string().max(360).optional(),detail_code:nt.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()})})]),ey=Jb.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"})}),MC=e.union([Zb,ey]),UC={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."]},xm=e.string().regex(/^sha256:[a-f0-9]{64}$/),ty=e.enum(["create","update","delete","str_replace"]),Em=e.enum(["sitemap_resync","smoke_test","prepare_preview"]),ny=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(),sy=e.object({path:Se,operation:ty,expected_hash:xm.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(ny).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(_y(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"})}),iy=e.object({kind:e.enum(["block","page","site","chrome"]),id:e.string().min(1).max(120)}),ay=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:iy,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)}),Im=e.object({site_id:I,base_snapshot_id:x,reason:e.string().min(1),patches:e.array(sy).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(ay).max(24).optional(),post_actions:e.array(Em).optional()});function Rm(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 FC=Im.superRefine(Rm),qC=Im.omit({base_snapshot_id:!0}).extend({site_id:I.optional()}).superRefine(Rm),oy=pe,ry=e.object({path:oy,operation:e.enum(["upsert","delete"]).optional()}),Tm=e.enum(["sync_cms_pages","sync_cms_navigation"]),GC=e.object({files:e.array(ry).min(1),post_actions:e.array(Tm).optional()}).strict().overwrite(t=>t.post_actions?{...t,post_actions:[...new Set(t.post_actions)]}:t),cy=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"]),my=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:xm,object_key:e.string().min(1),changed_files:e.array(Se).min(1),post_actions_queued:e.array(Em),dropped_protected_files:e.array(e.string().min(1)).min(1).optional()}),ly=e.object({status:e.literal("failed"),code:cy,message:e.string().min(1),retryable:e.boolean().default(!1),details:e.unknown().optional()}),zC=e.discriminatedUnion("status",[my,ly]),KC=e.object({ok:e.literal(!0),post_actions:e.array(e.object({action:Tm,status:e.enum(["succeeded","failed"])}).strict()).default([])}),km=pe,py=e.enum(["text","binary"]),Pm=e.object({path:km,kind:py,language:e.string().min(1).nullable(),size_bytes:e.number().int().nonnegative()}),BC=e.object({path:km}),dy=Pm.extend({kind:e.literal("text"),language:e.string().min(1),content:e.string()}),uy=Pm.extend({kind:e.literal("binary"),language:e.null(),mime_type:e.string().min(1),content_base64:e.string().min(1)}),WC=e.union([dy,uy]);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])=>gy(n)||ln(s))}function gy(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 wm(t){let n=t.split("/");return t.length>0&&!t.startsWith("/")&&!t.includes("\\")&&n.every(s=>s!==""&&s!=="."&&s!=="..")}function _y(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 Am=e.enum(["idle","creating","restoring_snapshot","installing_dependencies","starting_preview","ready","active","stopping","stopped","failed"]),hy=e.object({id:pn,tenant_id:e.string().min(1),site_id:I,sandbox_id:e.string().min(1).nullable(),status:Am,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)}),VC=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:Am,preview_url:e.string().url().optional()}),HC=e.object({preview_session:hy,next_step:e.literal("preview")}),$C=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:st.nullable()});export{Cr as AESTHETIC_NOTE_MAX_LENGTH,_v as AbandonSiteSnapshotResponseSchema,Zc as ActivityKindSchema,nt as ActivityTitleCodeSchema,pR as AdvanceSiteWorkflowRequestSchema,Bc as AgentErrorCategorySchema,ta as AgentEventIdSchema,Li as AgentEventRecordSchema,bm as AgentEventSchema,hm as AgentEventTypeSchema,jb as AgentMessageHistoryPurposeSchema,Hc as AgentModelRouteSchema,Ob as AgentPlanStepSchema,V as AgentRunIdSchema,Vc as AgentRunKindSchema,st as AgentRunRecordSchema,Pf as AgentRunStatusSchema,Wc as AgentRunTypeSchema,Gb as AiSdkUiDataPartSchema,Kb as AiSdkUiErrorPartSchema,Ub as AiSdkUiFilePartSchema,is as AiSdkUiMessagePartSchema,Yb as AiSdkUiMessageSchema,Mb as AiSdkUiReasoningPartSchema,qb as AiSdkUiSourceDocumentPartSchema,Fb as AiSdkUiSourceUrlPartSchema,Bb as AiSdkUiStepStartPartSchema,Lb as AiSdkUiTextPartSchema,zb as AiSdkUiToolPartSchema,PC as ApiContractStatusSchema,Nf as ApiErrorEnvelopeSchema,L as ApiResponseSchema,IC as AppendAgentEventRequestSchema,RC as AppendAgentEventResponseSchema,cy as ApplyPatchBatchErrorCodeSchema,ly as ApplyPatchBatchFailureSchema,FC as ApplyPatchBatchInputSchema,sy as ApplyPatchBatchPatchSchema,Em as ApplyPatchBatchPostActionSchema,zC as ApplyPatchBatchResultSchema,my as ApplyPatchBatchSuccessSchema,qC as ApplyPatchBatchToolInputSchema,ny as ApplyPatchEditSchema,ty as ApplyPatchOperationSchema,Kc as ArchetypeProposalSchema,vy as AuditLogIdSchema,fy as AuthIdentityIdSchema,Ey as AuthLoginCodeIdSchema,xy as AuthOidcStateIdSchema,by as AuthSessionIdSchema,yy as AuthTokenIdSchema,Iy as AuthWsTicketIdSchema,Gh as BINDING_STATUSES,Jc as BlockGenerationContextSchema,Hv as BlockMediaIntentSchema,Bi as BlockSchema,em as BrandingSchema,ht as BriefIdSchema,Gi as BriefRecordSchema,ia as BusinessFactsSchema,wk as CHAT_COPY,Pk as CLARIFICATION_COPY,uh as CMS_FORM_FIELD_TYPES,dr as CMS_MAIN_PRODUCTS_MAX_LENGTH,pp as CMS_PAGE_DIRECTORY_MAX_DEPTH,lp as CMS_PAGE_DIRECTORY_MAX_NODES,Ba as CMS_PAGE_URL_PATH_MAX_LENGTH,lT as COMPONENT_I18N_FILE_SUFFIX,Ln as COMPONENT_I18N_NAMESPACE,Dm as CONVERSION_CTA_LABEL_MAX_LENGTH,aS as CRAWLER_INTERNAL_ERROR_CODES,rr as CURRENT_EDIT_ENGINE_VERSION,YC as CancelActiveWorkspaceRunRequestSchema,XC as CancelActiveWorkspaceRunResponseSchema,fc as CheckSitePublishDomainDataSchema,zS as CheckSitePublishDomainRequestSchema,KS as CheckSitePublishDomainResponseSchema,tm as ChromeDesignSchema,$f as ChromeFooterDesignSchema,Hf as ChromeFooterShellSchema,Wf as ChromeHeaderDesignSchema,Bf as ChromeHeaderShellSchema,Yf as ChromeMobileNavDesignSchema,Tf as ClarifyQuestionOptionSchema,kf as ClarifyQuestionSchema,Ef as ClarifyQuestionTypeSchema,Fi as ClarifyQuestionsSchema,MA as ClarifyRunInputSchema,Ji as ClarifySessionIdSchema,Pb as ClarifySessionRecordSchema,UA as ClarifyStreamEventSchema,Cy as CmsCollectionBindingIdSchema,kP as CmsCollectionBindingSchema,zr as CmsFormSchemaProjectionSchema,vs as CmsManagedPageTypeSchema,gp as CmsPageDirectoryGroupSchema,Wa as CmsPageDirectoryNodeSchema,za as CmsPageDirectorySchema,Cs as CmsPageTypeSchema,Ge as CmsPageUrlPathSchema,ba as CmsSiteIdSchema,nS as CompanyInfoSchema,GP as CompanyInfoTaskCreateRequestSchema,zP as CompanyInfoTaskCreateResponseSchema,KP as CompanyInfoTaskResponseSchema,e0 as CompleteCustomerMaterialsRequestSchema,t0 as CompleteDiagnosisRequestSchema,Sv as CompleteSiteSnapshotDeletionResponseSchema,dR as CompleteSiteWorkflowRequestSchema,n0 as CompleteStrategyRequestSchema,J1 as CompleteWebsiteScanRequestSchema,dT as ComponentI18nResourcesSchema,JE as ComposeDesignerPageResourceBodySchema,pC as ConfirmSiteStructureRequestSchema,O0 as ConnectDynamicCollectionInputSchema,M0 as ConnectFormInputSchema,ot as ConversionHintsSchema,oS as CrawlerInternalErrorCodeSchema,BP as CrawlerInternalErrorSchema,kt as CrawlerTaskCodeSchema,DP as CrawlerTaskCreateRequestSchema,NP as CrawlerTaskCreateResponseSchema,$h as CrawlerTaskFailureErrorCodeSchema,sc as CrawlerTaskFailureStageSchema,Xh as CrawlerTaskPageSchema,jP as CrawlerTaskPagesQuerySchema,UP as CrawlerTaskPagesResponseSchema,MP as CrawlerTaskStatusResponseSchema,dt as CrawlerTaskUuidSchema,Wv as CreateAgentRunConflictResponseSchema,mv as CreateAgentRunRequestSchema,lv as CreateAgentRunResponseSchema,Lv as CreateDeploymentRequestSchema,Cf as CreateDeploymentResponseSchema,mx as CreateDocumentUploadRequestSchema,Xy as CreateExternalSiteEditRequestSchema,Qy as CreateExternalSiteEditResponseSchema,_x as CreateImageUploadRequestSchema,ix as CreateInputSourceRequestSchema,Mv as CreateQualityCheckDeploymentRequestSchema,BA as CreateSiteBriefRequestSchema,ov as CreateSiteBriefResponseSchema,WA as CreateSiteDraftRequestSchema,KA as CreateSiteInputSchema,mR as CreateSiteWorkflowRequestSchema,zm as CreateTextInputSourceRequestSchema,Km as CreateUrlInputSourceRequestSchema,Fv as CurrentDeploymentResponseSchema,H1 as CustomerMaterialsDraftResponseSchema,oi as CustomerMaterialsDraftSchema,$1 as CustomerMaterialsNullableResponseSchema,ri as CustomerMaterialsRecordSchema,V1 as CustomerMaterialsResponseSchema,T_ as CustomerMaterialsStatusSchema,k_ as DEFAULT_FONTS,Rr as DEFAULT_SITE_DESIGN_RADIUS_ID,dl as DEFAULT_SITE_LOCALE,Fk as DEFAULT_SUBSITE_PALETTE,tT as DEPLOYMENT_ACTIVE_STATUSES,Qe as DEPLOYMENT_LIFECYCLE_TRANSITIONS,cu as DEPLOYMENT_PROGRESS_STEP_CODES,Of as DEPLOYMENT_REALTIME_CHANNEL,ft as DEPLOYMENT_STATUSES,nT as DEPLOYMENT_TERMINAL_STATUSES,Wu as DEPLOYMENT_TRANSITION_ERROR_CODE,Bv as DEPLOYMENT_WEBSOCKET_CONTRACT,RE as DESIGNER_COMPONENT_LIBRARY_ERROR_CODES,$E as DESIGNER_PAGE_LIBRARY_ERROR_CODES,ax as DOCUMENT_EXTENSION_WHITELIST,ox as DOCUMENT_MIME_WHITELIST,ES as DOMAIN_DNS_PURPOSES,IS as DOMAIN_DNS_VERIFICATION_STATUSES,fS as DOMAIN_OBSERVED_STATUSES,yS as DOMAIN_ROUTING_MODES,FE as DeleteDesignerPageErrorDetailsSchema,NE as DeleteDesignerPageRequestSchema,LE as DeleteDesignerPageResponseSchema,Ep as DeleteDesignerPageResultSchema,hv as DeleteSiteSnapshotResponseSchema,qe as DeploymentIdSchema,Ry as DeploymentJobIdSchema,mu as DeploymentProgressStepCodeSchema,pu as DeploymentProgressStepSchema,lu as DeploymentProgressStepStatusSchema,Bo as DeploymentProgressStepsSchema,tt as DeploymentRecordSchema,Kv as DeploymentRedisPubSubEventSchema,zi as DeploymentStatusSchema,Fc as DeploymentStatusSummarySchema,Js as DeploymentTransitionError,Yc as DeploymentTypeSchema,ns as DeploymentWsDeploymentPayloadSchema,zv as DeploymentWsServerMessageSchema,jf as DeploymentWsServerMessageTypeSchema,Cb as DesignPlanGenerationOutcomeSchema,Db as DesignPlanGenerationReasonSchema,cs as DesignPlanIdSchema,Xv as DesignPlanPatchSchema,wb as DesignPlanRecordSchema,nm as DesignPlanSchema,Vv as DesignTokensSchema,mp as DesignerComponentCatalogItemSchema,Ma as DesignerComponentCategoriesDataSchema,La as DesignerComponentCategoryNodeSchema,mt as DesignerComponentExactVersionSchema,Fa as DesignerComponentInstallDataSchema,Ua as DesignerComponentsDataSchema,wp as DesignerPageCatalogItemSchema,Ja as DesignerPageCategoriesDataSchema,Za as DesignerPageCategoryNodeSchema,bp as DesignerPageDeleteBlockReasonSchema,fp as DesignerPageDisabledReasonSchema,Ut as DesignerPageExactVersionSchema,Ya as DesignerPageGroupSchema,to as DesignerPageInstallDataSchema,$a as DesignerPageNodeSchema,so as DesignerPageResourcePreparationDataSchema,Pp as DesignerPageResourceSourceSchema,Np as DesignerPageResourceTemplateSchema,lt as DesignerPageResourceTypeSchema,eo as DesignerPagesDataSchema,ks as DesignerResourceVersionSchema,io as DesignerSitePagesDataSchema,XE as DesignerSiteRouteIdSchema,_c as DomainConfigurationSchema,gc as DomainDnsPurposeSchema,AS as DomainDnsRecordSchema,PS as DomainDnsVerificationObservationSchema,wS as DomainDnsVerificationResultSchema,RS as DomainDnsVerificationStatusSchema,bS as DomainObservedStatusSchema,kS as DomainOperationErrorSchema,Pi as DomainOperationSchema,TS as DomainOperationStatusSchema,ki as DomainOperationTypeSchema,uc as DomainRecordSchema,xS as DomainRoutingModeSchema,vk as EDIT_ENGINE_VERSION_HEADER,Ck as EDIT_ENGINE_VERSION_SOURCE_HEADER,Tk as ERROR_COPY,Nm as EXTERNAL_SITE_EDIT_INFRASTRUCTURE_REASONS,Om as EXTERNAL_SITE_EDIT_PROMPT_MAX_LENGTH,ai as EditEngineVersionParseError,ao as EnhanceDesignerPageResourceBodySchema,iv as EnhanceDesignerPageResourceResponseSchema,ex as ExternalSiteEditCallbackAckSchema,Jy as ExternalSiteEditCallbackPayloadSchema,Lm as ExternalSiteEditCallbackStatusSchema,Ot as ExternalSiteEditDegradedReasonSchema,ra as ExternalSiteEditOutcomeSchema,oa as ExternalSiteEditTaskIdSchema,ca as ExternalSiteEditTaskSchema,Mm as ExternalSiteEditTaskStatusSchema,YA as ExternalSyncSiteRequestSchema,av as ExternalSyncSiteResponseSchema,Fm as ExtractedFactKindSchema,un as ExtractedFactSchema,W_ as FIELD_TYPES,xr as FONT_PAIRINGS,mi as FONT_PAIRING_IDS,Th as FORM_DESIGN_ERROR_CODES,Rh as FORM_DESIGN_FAILURE_STAGES,Eh as FORM_DESIGN_OPERATION_STAGES,Ih as FORM_DESIGN_OPERATION_STATUSES,Hn as FORM_FIELD_TYPES,gh as FORM_SPEC_FIELD_TYPE_TO_CMS,Lr as FORM_SPEC_FILE_MIN_RUNTIME_VERSION,ah as FORM_SPEC_LOCALIZABLE_FIELD_PATHS,Nr as FORM_SPEC_MULTISTEP_MIN_RUNTIME_VERSION,$0 as FORM_TEMPLATE_CATEGORY_COUNTS,H0 as FORM_TEMPLATE_CATEGORY_SLUGS,$C as FailStaleInFlightWorkspaceRunsResponseSchema,Or as FieldDeclSchema,ew as FirecrawlBatchCreateRequestSchema,tw as FirecrawlBatchCreatedResponseSchema,mS as FirecrawlBatchErrorSchema,sw as FirecrawlBatchErrorsResponseSchema,cS as FirecrawlBatchPageSchema,nw as FirecrawlBatchStatusResponseSchema,YP as FirecrawlCrawlCreateRequestSchema,XP as FirecrawlCrawlCreatedResponseSchema,QP as FirecrawlCrawlStatusResponseSchema,cc as FirecrawlJobStatusSchema,HP as FirecrawlMapRequestSchema,$P as FirecrawlMapResponseSchema,iw as FirecrawlQueueStatusResponseSchema,ZP as FirecrawlScrapeRequestSchema,JP as FirecrawlScrapeResponseSchema,Vf as FooterShellSurfaceSchema,Y_ as FormBlockIdSchema,Yn as FormDefinitionIdSchema,bh as FormDesignAffectedFilesSchema,Ii as FormDesignErrorCodeSchema,aP as FormDesignErrorSchema,Wr as FormDesignFailureStageSchema,te as FormDesignHashSchema,Z0 as FormDesignOpenResponseSchema,yh as FormDesignOperationFingerprintInputSchema,Si as FormDesignOperationIdSchema,Vr as FormDesignOperationNextActionSchema,ky as FormDesignOperationRecordIdSchema,sP as FormDesignOperationRecordSchema,Ri as FormDesignOperationResponseSchema,$r as FormDesignOperationSchema,Ei as FormDesignOperationStageSchema,Br as FormDesignOperationStatusSchema,iP as FormDesignOperationTransitionRequestSchema,Hr as FormDesignPreviewRefreshStatusSchema,eP as FormDesignQueryResponseSchema,tP as FormDesignResumeRequestSchema,nP as FormDesignResumeResponseSchema,xh as FormDesignSaveRequestSchema,J0 as FormDesignSaveResponseSchema,Kr as FormDesignSharedImpactSchema,xi as FormDesignStandardizationSchema,H_ as FormFieldDeclSchema,an as FormFieldNameSchema,fi as FormOptionValueSchema,X_ as FormSpecBindingSchema,Z_ as FormSpecFieldNodeSchema,eh as FormSpecNodeSchema,Q_ as FormSpecOptionSchema,J_ as FormSpecStepBreakNodeSchema,yi as FormSpecV1Schema,Y0 as FormTemplateCatalogResponseSchema,Gr as FormTemplateCategorySlugSchema,ph as FormTemplateCategoryV1Schema,et as FormTemplateTextSchema,dh as FormTemplateV1Schema,HS as GSC_AUTH_STATUSES,$S as GSC_BINDING_STATUSES,YS as GSC_PROPERTY_TYPES,qv as GetDeploymentResponseSchema,Df as GetDeploymentsStatusResponseSchema,Zy as GetExternalSiteEditResponseSchema,Lw as GetSiteDomainConfigurationResponseSchema,wi as GetSitePublishDomainOperationDataSchema,BS as GetSitePublishDomainOperationResponseSchema,h1 as GetTemplateUpgradeReportQuerySchema,S1 as GetTemplateUpgradeReportResponseSchema,tA as GoogleSearchConsoleAuthStartDataSchema,eA as GoogleSearchConsoleAuthStartRequestSchema,nA as GoogleSearchConsoleAuthStartResponseSchema,Xw as GoogleSearchConsoleAuthStatusSchema,Qw as GoogleSearchConsoleBindingStatusSchema,Zw as GoogleSearchConsolePropertyTypeSchema,Jw as GoogleSearchConsoleStateSchema,iA as GoogleSearchConsoleStatusDataSchema,sA as GoogleSearchConsoleStatusInputSchema,aA as GoogleSearchConsoleStatusResponseSchema,Hw as GscAuthStartDataSchema,Vw as GscAuthStartRequestSchema,$w as GscAuthStartResponseSchema,Ai as GscAuthStatusSchema,vi as GscBindingStatusSchema,Ci as GscPropertyTypeSchema,QS as GscStateInputSchema,Yw as GscStateSchema,xc as GscStatusDataSchema,ZS as GscStatusResponseSchema,Ka as HOME_PAGE_URL_PATH,zf as HeaderShellBehaviorSchema,Kf as HeaderShellShapeSchema,Gf as HeaderShellSurfaceSchema,qf as HeaderShellVariantSchema,zh as HomeUrlCrawlerTaskCreateRequestSchema,Gs as HttpUrlSchema,px as IMAGE_EXTENSION_WHITELIST,dx as IMAGE_MIME_WHITELIST,Na as INSERT_NEW_COMPONENT_CATEGORY_GROUP_KEY,Qa as INSERT_NEW_PAGE_CATEGORY_GROUP_KEY,ul as ISO_639_3_TO_SITE_LOCALE,Bm as ImageRoleSchema,ym as InboundUserMessageSchema,A0 as IndustryClassificationRequestSchema,v0 as IndustryClassificationResultSchema,B_ as IndustryConfidenceSchema,Um as InputBundleStatusSchema,_n as InputConflictSchema,hx as InputContextBundleSchema,at as InputContextSourceIdSchema,Gm as InputSourceSchema,ps as InputSourceStatusSchema,ls as InputSourceTypeSchema,i1 as InspectTemplateUpgradeStateRequestSchema,a1 as InspectTemplateUpgradeStateResponseSchema,wE as InstallDesignerComponentBodySchema,ZA as InstallDesignerComponentResponseSchema,QE as InstallDesignerPageBodySchema,tv as InstallDesignerPageResponseSchema,Uv as InternalCreateDeploymentResponseSchema,Dv as InternalEnsureSubsitePublishRequestSchema,jv as InternalEnsureSubsitePublishResponseSchema,G as InternalEntityIdSchema,Gv as InternalGetDeploymentsStatusResponseSchema,Ov as InternalGetSubsitePublishStatusRequestSchema,Nv as InternalGetSubsitePublishStatusResponseSchema,vv as InternalPrepareSubsitePreviewRequestSchema,Cv as InternalPrepareSubsitePreviewResponseSchema,E_ as KNOWLEDGE_CATEGORY_CODES,ur as KnowledgeCategoryCodeSchema,q1 as KnowledgeContextReadinessSchema,R_ as KnowledgeSourceReadinessSchema,gr as KnowledgeSourceReadinessStatusSchema,U1 as KnowledgeTaskStatusBatchSchema,I_ as KnowledgeTaskStatusSchema,rl as LEGACY_SITE_LOCALE_CODES,OC as LatestAgentRunQuerySchema,NC as LatestAgentRunResponseSchema,jC as LatestWorkspaceRunResponseSchema,pw as LauncherPromptTemplateApplyRequestSchema,dw as LauncherPromptTemplateApplyResponseSchema,uS as LauncherPromptTemplateCatalogItemSchema,mw as LauncherPromptTemplateCatalogQuerySchema,lw as LauncherPromptTemplateCatalogSchema,pS as LauncherPromptTemplateKindSchema,dS as LauncherPromptTemplateLocaleSchema,ts as LauncherPromptTemplateTypeSchema,kC as ListAgentEventsQuerySchema,TC as ListAgentEventsResponseSchema,XA as ListDesignerComponentCategoriesResponseSchema,PE as ListDesignerComponentsQuerySchema,QA as ListDesignerComponentsResponseSchema,JA as ListDesignerPageCategoriesResponseSchema,YE as ListDesignerPagesQuerySchema,ev as ListDesignerPagesResponseSchema,sv as ListDesignerSitePagesResponseSchema,mf as ListMediaLibraryAssetsQuerySchema,lf as ListMediaLibraryAssetsResponseSchema,Pv as ListSiteVersionsResponseSchema,f1 as ListTemplateUpgradeSnapshotDeletionCandidatesQuerySchema,b1 as ListTemplateUpgradeSnapshotDeletionCandidatesResponseSchema,cx as MAX_DOCUMENT_SOURCES_PER_SITE,rx as MAX_DOCUMENT_UPLOAD_BYTES,gx as MAX_IMAGE_SOURCES_PER_SITE,ux as MAX_IMAGE_UPLOAD_BYTES,Ac as MEDIA_LIBRARY_AUDIO_EXTENSIONS,Oc as MEDIA_LIBRARY_AUDIO_MIME_TYPES,vc as MEDIA_LIBRARY_DOCUMENT_EXTENSIONS,rf as MEDIA_LIBRARY_EXTENSIONS,Cc as MEDIA_LIBRARY_FILE_EXTENSIONS,Pc as MEDIA_LIBRARY_IMAGE_EXTENSIONS,of as MEDIA_LIBRARY_IMAGE_MAX_BYTES,Dc as MEDIA_LIBRARY_IMAGE_MIME_TYPES,kc as MEDIA_LIBRARY_MAX_BYTES,cf as MEDIA_LIBRARY_MIME_TYPES,wc as MEDIA_LIBRARY_VIDEO_EXTENSIONS,jc as MEDIA_LIBRARY_VIDEO_MIME_TYPES,_T as MIGRATION_PRODUCTS_CMS_DETAIL_PAGE_TITLE,gT as MIGRATION_PRODUCTS_DETAIL_PREFIX,fT as MIGRATION_PRODUCTS_DETAIL_VIEW_VARIANT,ST as MIGRATION_PRODUCTS_LIST_VIEW_VARIANT,Yu as MIGRATION_PRODUCTS_ROUTE,Be as MIGRATION_PRODUCTS_SLUG,hT as MIGRATION_PRODUCTS_VIEW_BLOCK_TYPE,V_ as MODEL_DECLARABLE_FORM_FIELD_TYPES,L_ as MOTION_PRESETS,pi as MOTION_PRESET_IDS,xx as ManagedPageTemplateRouteManifestV1Schema,Yv as MediaAssetSchema,Uf as MediaAttributionSchema,Oi as MediaLibraryAssetSchema,Nc as MediaLibraryFileTypeSchema,Lc as MediaLibrarySourceSchema,iy as MediaRequestOwnerSchema,Ay as MediaResolutionCacheIdSchema,kE as MockDesignerComponentInsertDataSchema,TE as MockDesignerComponentInsertRequestSchema,Ui as MotionLevelSchema,jh as NAV_ITEMS_LOCALIZABLE_FIELD_PATHS,Oh as NAV_ITEMS_MACHINE_FIELD_PATHS,v_ as NEXT_FONT_DISPLAY_NAMES,Qt as NEXT_FONT_REGISTRY,gl as NON_LATIN_SITE_LOCALE_CODES,_P as NavItemSchema,Ah as PAGE_SEO_LOCALIZABLE_FIELD_PATHS,vh as PAGE_SEO_MACHINE_FIELD_PATHS,Ft as PAGE_SLUG_PATTERN,yt as PAGE_SLUG_SEGMENT_PATTERN_SOURCE,xP as PLATFORM_MATERIALIZED_EXEMPTIONS,Uh as PLATFORM_MATERIALIZED_FILES,Fh as PLATFORM_MATERIALIZED_FILE_PATTERNS,yP as PLATFORM_MATERIALIZERS,oo as PLATFORM_OWNED_PAGE_SLUGS,Lp as PLATFORM_OWNED_ROUTE_FILE_PATHS,xp as PageDirectoryReconcileFailedPageSchema,Ds as PageDirectoryReconcileResultSchema,GE as PageDirectoryReconcileStateSchema,yp as PageDirectoryReconcileStatusSchema,Vh as PageDiscoveryCoverageEntrySchema,LP as PageDiscoveryCoverageReasonSchema,ic as PageDiscoveryCoverageSchema,im as PageNavigationSchema,Os as PageResourceArtifactSchema,Dp as PageResourceComponentReferenceSchema,jp as PageResourceComponentSchema,vp as PageResourceDraftPageSchema,Cp as PageResourceDraftSchema,wn as PageResourceFinalRouteSchema,Op as PageResourcePageSchema,Ap as PageResourcePageSelectionSchema,no as PageResourceRouteMappingSchema,Wi as PageSchema,uP as PageSeoDeclSchema,sm as PageSlugSchema,Rp as PageTargetKindSchema,ws as PageTargetProjectionHashSchema,Xa as PageTargetSchema,Tp as PageTargetSeoSchema,qE as PageTargetSetSchema,Rx as PageTemplateCleanupRequestSchema,Px as PageTemplateCleanupResponseSchema,Ex as PageTemplateCreateRequestSchema,Tx as PageTemplateCreateResponseSchema,wx as PageTemplateErrorCodeSchema,Ie as PageTemplateIdSchema,hn as PageTemplatePagePathSchema,Ix as PageTemplatePromoteRequestSchema,kx as PageTemplatePromoteResponseSchema,hC as PersistClarifyAnswersRequestSchema,SC as PersistClarifyAnswersResponseSchema,dC as PersistGeneratedSitemapDraftRequestSchema,_C as PersistGeneratedSitemapDraftResponseSchema,VC as PersistPreviewSessionRequestSchema,HC as PersistPreviewSessionResponseSchema,bC as PersistSiteDesignPlanRequestSchema,yC as PersistSiteDesignPlanResponseSchema,gC as PersistSiteSitemapDraftResponseSchema,lC as PersistSiteSitemapRequestSchema,uC as PersistSiteSitemapResponseSchema,pv as PersistSiteSnapshotRequestSchema,dv as PersistSiteSnapshotResponseSchema,xf as PositioningPrefillSchema,Ni as PositioningSourceSchema,ZE as PrepareDesignerPageBodySchema,nv as PrepareDesignerPageResponseSchema,v1 as PrepareSiteBuildInitialGenerationBaseRequestSchema,C1 as PrepareSiteBuildInitialGenerationBaseResultSchema,s1 as PrepareTemplateUpgradeStateRequestSchema,a_ as PrepareTemplateUpgradeStateResponseSchema,Av as PrepareVersionPreviewRequestSchema,vf as PrepareVersionPreviewResponseSchema,Ko as ProductSearchAppConfigDraftSchema,Vs as ProductSearchAppSlugSchema,PR as ProductSearchContractFixtureSchema,tu as ProductSearchDraftConfigSchema,Re as ProductSearchFieldNameSchema,Jd as ProductSearchFilterMetaSchema,Hs as ProductSearchInteractionRequestSchema,jn as ProductSearchInteractionResponseSchema,kR as ProductSearchPopularTermsReadSchema,zo as ProductSearchPopularTermsSchema,au as ProductSearchRequestSchema,ru as ProductSearchResponseSchema,Wt as ProductSearchRouteIdSchema,Zd as ProductSearchValueShapeSchema,gv as PromoteSiteSnapshotRequestSchema,wf as PromoteSiteSnapshotResponseSchema,Tv as PromoteTemplateUpgradeSnapshotRequestSchema,kv as PromoteTemplateUpgradeSnapshotResponseSchema,Sc as QualityRunningStatusSchema,kk as REFUSAL_COPY,AC as REST_API_ENDPOINTS,Ch as ROOT_LAYOUT_METADATA_LOCALIZABLE_FIELD_PATHS,Dh as ROOT_LAYOUT_METADATA_MACHINE_FIELD_PATHS,WS as ReconcileSitePublishDomainOperationDataSchema,VS as ReconcileSitePublishDomainOperationResponseSchema,fv as RecordSnapshotVersionRequestSchema,bv as RecordSnapshotVersionResponseSchema,g1 as RecordTemplateUpgradeEventRequestSchema,_1 as RecordTemplateUpgradeEventResponseSchema,o1 as RecordTemplateUpgradeFailureRequestSchema,r1 as RecordTemplateUpgradeFailureResponseSchema,c1 as RecordTemplateUpgradeSuccessRequestSchema,m1 as RecordTemplateUpgradeSuccessResponseSchema,ME as RecoverDesignerPageProjectionRequestSchema,UE as RecoverDesignerPageProjectionResponseSchema,Ip as RecoverDesignerPageProjectionResultSchema,qm as ReferencePagePatternSchema,gn as ReferenceSignalsSchema,hf as RegisterMediaResourceReferenceRequestSchema,Sf as RegisterMediaResourceReferenceResponseSchema,uR as RegisterWorkflowTaskCommandRequestSchema,Wd as RegisterWorkflowTaskRequestSchema,Ev as ReleaseTemplateUpgradeLockRequestSchema,Iv as ReleaseTemplateUpgradeLockResponseSchema,hR as ReplaceCrawlWorkflowTaskCommandRequestSchema,Hd as ReplaceCrawlWorkflowTaskRequestSchema,_R as ReplaceWorkflowTaskCommandRequestSchema,Vd as ReplaceWorkflowTaskRequestSchema,j0 as ResolvedFieldSchema,U0 as ResolvedFormFieldSchema,wC as RestApiMethodSchema,wv as RestoreSiteSnapshotResponseSchema,gP as RootLayoutMetadataSchema,Qc as RouteGenerationCardSchema,Uu as RuleEngineInputSchema,zu as RuleEngineScoreRecordSchema,Zs as RuleScoreDimensionKeySchema,Gu as RuleScoreDimensionSchema,Nt as SELECTABLE_SITE_LOCALE_CODES,om as SITEMAP_RESOLVER_MAX_BLOCK_TARGETS,am as SITEMAP_RESOLVER_MAX_PAGE_TARGETS,w1 as SITE_BUILD_CONTEXT_FILE_PATH,A1 as SITE_BUILD_CONTEXT_MAX_BYTES,jd as SITE_BUILD_STATUSES,No as SITE_BUILD_STATUS_CODES,Od as SITE_DEPLOYMENT_STATUSES,Lo as SITE_DEPLOYMENT_STATUS_CODES,li as SITE_DESIGN_DENSITY_IDS,Ir as SITE_DESIGN_RADIUS_IDS,LT as SITE_EDIT_DURABLE_HISTORY_CAPABILITY,np 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,bo as SITE_EDIT_PAGE_COMPOSITION_SCHEMA_VERSION,PI as SITE_EDIT_PAGE_COMPOSITION_V2_CAPABILITY,vg as SITE_EDIT_RUNTIME_CONTAINER_TAGS,Cg as SITE_EDIT_RUNTIME_TEXT_TAGS,Ag as SITE_EDIT_RUNTIME_VOID_ELEMENT_TAGS,fI as SITE_EDIT_SIGNED_MUTATION_CAPABILITY,Hm as SITE_EDIT_SOURCE_ALLOWED_APP_FILES,la as SITE_EDIT_SOURCE_ALLOWED_DIRS,Vm as SITE_EDIT_SOURCE_ALLOWED_ROOT_FILES,gs as SITE_EDIT_SOURCE_DELETE_CAPABILITY,$m as SITE_EDIT_TEXT_SOURCE_EXTENSIONS,St as SITE_EXTRA_REQUIREMENT_MAX_LENGTH,cl as SITE_LOCALE_CODES,dP as SITE_LOCALIZATION_STRUCTURES,FA as SITE_PLANNING_FROZEN_ERROR_CODE,qA as SITE_PLANNING_LOCKED_ERROR_CODE,GA as SITE_STRUCTURE_CONFIRMATION_REQUIRED_ERROR_CODE,zA as SITE_STRUCTURE_CONFIRMATION_STALE_ERROR_CODE,Nd as SITE_WORKFLOW_STATUSES,Mo as SITE_WORKFLOW_STATUS_CODES,vC as SSE_STREAMS,Nl as STEP5_GEO_QUESTION_TYPES,xn as STEP5_PRIMARY_INTENT_PAGE_LIMIT,ka as STEP5_SEMRUSH_MIN_RELEVANCE_SCORE,xl as STEP5_SEMRUSH_SEARCH_INTENTS,El as STEP5_SEO_ALLOWED_INTENT_CODES,tE as STEP5_SEO_ALLOWED_SEARCH_INTENTS,oE as STEP5_SEO_KEYWORD_DEFAULT,Fl as STEP5_SEO_KEYWORD_MAX,Ul 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,Ml as STEP5_SEO_PAYLOAD_SCHEMA_VERSION,Ql as STEP5_SSE_EVENT_NAMES,fe as STEP5_STRATEGY_COUNT,rt as STEP5_STRATEGY_KEYS,Ia as STEP5_STRATEGY_OPTION_IDS,Pr as STEP6_AI_THEME_IDS,di as STEP6_AI_THEME_PRESETS,wr as STEP6_GENERATED_THEME_ID_PATTERN,zg as SUBSITE_GLOSSARY_ENTRY_MAX_CHARS,Kg as SUBSITE_GLOSSARY_MAX_ENTRIES,Jg as SUBSITE_MOUNT_PATH_PATTERN,$g as SUBSITE_PALETTE_NOTE_MAX_CHARS,e_ as SUBSITE_RESERVED_MOUNT_SEGMENTS,Vx as SUPPORTED_SITE_LOCALES,pn as SandboxSessionIdSchema,hy as SandboxSessionSchema,Am as SandboxSessionStatusSchema,$A as SaveBriefDraftRequestSchema,cv as SaveBriefDraftResponseSchema,qy as SaveSiteExtraRequirementRequestSchema,df as SearchUnsplashMediaQuerySchema,uf as SearchUnsplashMediaResponseSchema,b_ as SiteBuildContextFileSchema,f_ as SiteBuildContextPayloadSchema,S_ as SiteBuildContextProvenanceSchema,h_ as SiteBuildContextProvenanceSourceSchema,zs as SiteBuildStatusSchema,Ks as SiteDeploymentStatusSchema,Xc as SiteDesignContextSchema,If as SiteDesignDensitySchema,Rf as SiteDesignMotionLevelSchema,Fn as SiteEditBoundaryKindSchema,eg as SiteEditCapabilityConstraintSchema,Zu as SiteEditCapabilityModeSchema,Un as SiteEditCapabilityModeViewSchema,TT as SiteEditCapabilityReadRequestSchema,Gp as SiteEditClassNameSourceDiagnosticSchema,pt as SiteEditClassNameSourceRangeSchema,uo as SiteEditClassNameSourceSchema,mI as SiteEditClassNameSourceStyleContextSchema,po as SiteEditClassNameSourceStylesheetSchema,Ls as SiteEditClassNameSourceWriteIntentSchema,iI as SiteEditCommandDiagnosticSchema,Fp as SiteEditCommandErrorSchema,M as SiteEditCompositionContextSchema,ne as SiteEditCompositionSelectorSchema,Ju as SiteEditConstraintKindSchema,xd as SiteEditDeletePageSourceOutputSchema,yg as SiteEditDynamicConfidenceSchema,Eg as SiteEditDynamicDataBindingSchema,nr as SiteEditDynamicDataDetailSchema,sr as SiteEditDynamicDataSummarySchema,xg as SiteEditDynamicEvidenceSchema,tr as SiteEditDynamicSourceKindSchema,fg as SiteEditDynamicSourceTypeSchema,bg as SiteEditDynamicTargetKindSchema,Tg as SiteEditEffectiveWriteTargetSchema,Ms as SiteEditElementPropertySchema,DT as SiteEditEventSchema,ti as SiteEditExternalSourceKindSchema,uI as SiteEditGetClassNameSourceCommandResultSchema,pI as SiteEditGetClassNameSourceInputSchema,dI as SiteEditGetClassNameSourceResultSchema,rk as SiteEditGetDocumentInputSchema,ck as SiteEditGetObjectEditContextInputSchema,Fx as SiteEditGetSourceFileInputSchema,Ux as SiteEditGetSourceTreeInputSchema,lI as SiteEditGetStyleContextInputSchema,Gn as SiteEditHistoryProvenanceSchema,ag as SiteEditHistoryReadOnlyRecoveryStatusSchema,tg as SiteEditHistoryRecoveryCodeSchema,ng as SiteEditHistoryRecoveryDiagnosticSchema,UT as SiteEditHistoryResultSchema,MT as SiteEditHistoryStatusModeSchema,rg as SiteEditHistoryStatusSchema,sg as SiteEditHistoryUnavailableReasonSchema,og as SiteEditHistoryUnavailableStatusSchema,ig as SiteEditHistoryWritableStatusSchema,Ik as SiteEditInitializeSessionInputSchema,fd as SiteEditInsertNodeSpecSchema,yd as SiteEditInsertPageResourceOutputSchema,cp as SiteEditMaterializationDataRequirementsSchema,rp as SiteEditMaterializationEntrySchema,op as SiteEditMaterializationExportSchema,ap as SiteEditMaterializationFileSchema,Oa as SiteEditMaterializationPathTemplateSchema,ct as SiteEditMaterializationSchema,Io as SiteEditMoveTargetSchema,qt as SiteEditMutationContextSchema,qn as SiteEditNodeCapabilitySnapshotSchema,lk as SiteEditObjectCapabilitiesSchema,dk as SiteEditObjectDetailSchema,gk as SiteEditObjectEditContextSchema,_k as SiteEditObjectStyleDetailSchema,uk as SiteEditObjectSummarySchema,zI as SiteEditOperationCommandResultSchema,Po as SiteEditOperationErrorCodeSchema,wo as SiteEditOperationErrorSchema,Ed as SiteEditOperationOutputSchema,bd as SiteEditOperationParamsSchema,qs as SiteEditOperationPayloadSchema,Fs as SiteEditOperationRequestSchema,Sd as SiteEditOperationResultTargetSchema,Ao as SiteEditOperationSelectionRefSchema,Sg as SiteEditOperationSummarySchema,hd as SiteEditOperationTargetSchema,Kt as SiteEditOperationTypeSchema,Eo as SiteEditOperationValueSchema,wI as SiteEditPageCompositionAnyVersionSchema,ed as SiteEditPageCompositionAtomicKindSchema,id as SiteEditPageCompositionBoundaryModeSchema,Vp as SiteEditPageCompositionBusinessMemberSchema,Bp as SiteEditPageCompositionContainerSchema,zt as SiteEditPageCompositionDiagnosticSchema,vn as SiteEditPageCompositionErrorCodeSchema,ho as SiteEditPageCompositionPlacementTargetSchema,Hp as SiteEditPageCompositionPlacementUnitSchema,Zp as SiteEditPageCompositionRuntimeRefSchema,Qp as SiteEditPageCompositionSchema,Jp as SiteEditPageCompositionSourceMemberKindSchema,Wp as SiteEditPageCompositionSourceMemberSchema,yo as SiteEditPageCompositionSourceRangeSchema,Yp as SiteEditPageCompositionSupportedSchema,Xp as SiteEditPageCompositionUnsupportedSchema,sd as SiteEditPageCompositionV2BusinessMemberSchema,td as SiteEditPageCompositionV2ContainerSchema,od as SiteEditPageCompositionV2PlacementRelationSchema,cd as SiteEditPageCompositionV2PlacementSchema,ad as SiteEditPageCompositionV2PlacementUnitSchema,dd as SiteEditPageCompositionV2Schema,nd as SiteEditPageCompositionV2SourceMemberSchema,ld as SiteEditPageCompositionV2SupportedSchema,pd as SiteEditPageCompositionV2UnsupportedSchema,rd as SiteEditPageCompositionV2WriteModeSchema,md as SiteEditPageCompositionVisualAnchorSchema,$p as SiteEditPagePlacementOptionSchema,_o as SiteEditPagePlacementSchema,fo as SiteEditPageUnitResultTargetSchema,So as SiteEditPageUnitTargetSchema,lg as SiteEditPatchPlanPatchSchema,KT as SiteEditPatchPlanSchema,Yt as SiteEditProvenanceChainSchema,kg as SiteEditProvenanceHopSchema,mk as SiteEditRenderDocumentSchema,$t as SiteEditRenderEntryRefSchema,Ig as SiteEditRenderEntrySchema,er as SiteEditRenderPageCompositionSchema,_g as SiteEditRenderPageCompositionSupportedSchema,hg as SiteEditRenderPageCompositionUnsupportedSchema,gg as SiteEditRenderPagePlacementSchema,bI as SiteEditRequiredMutationContextEnvelopeSchema,Gx as SiteEditResolveSourceLocationInputSchema,ar as SiteEditSemanticSourceSchema,GI as SiteEditSignedOperationRequestSchema,pa as SiteEditSourceDeleteCapabilitySchema,Xm as SiteEditSourceDirectoryPathSchema,tl as SiteEditSourceFileBinaryPreviewUnavailableReasonSchema,nl as SiteEditSourceFileBinaryResponseSchema,Lx as SiteEditSourceFileKindSchema,Qm as SiteEditSourceFileListItemSchema,qx as SiteEditSourceFileResponseSchema,el as SiteEditSourceFileTextResponseSchema,Us as SiteEditSourceIdentitySchema,sl as SiteEditSourceLocationRangeSchema,zx as SiteEditSourceLocationSchema,wg as SiteEditSourceLocatorRangeSchema,si as SiteEditSourceLocatorSchema,pe as SiteEditSourcePathSchema,da as SiteEditSourceTreeNodeSchema,Mx as SiteEditSourceTreeResponseSchema,Zm as SiteEditSourceTreeTruncationReasonSchema,Jm as SiteEditSourceTreeTruncationSchema,ko as SiteEditStyleBreakpointSchema,pk as SiteEditStyleModelSchema,Ro as SiteEditStylePropertySchema,or as SiteEditStyleSourceSchema,To as SiteEditStyleStateModeSchema,ni as SiteEditTextSegmentSchema,ir as SiteEditTextSourceSchema,Rg as SiteEditWriteTargetSchema,Gy as SiteExtraRequirementResponseSchema,Cm as SiteExtraRequirementSchema,I as SiteIdSchema,de as SiteLocaleSchema,$v as SiteMediaIntentSchema,Ty as SiteOperationLockIdSchema,d_ as SitePreviewActivateErrorCodeSchema,g_ as SitePreviewActivateFailedSchema,u_ as SitePreviewActivateReadySchema,E1 as SitePreviewActivateResponseSchema,Uw as SitePublishDomainCheckDataSchema,Mw as SitePublishDomainCheckRequestSchema,Fw as SitePublishDomainCheckResponseSchema,qw as SitePublishDomainOperationDataSchema,Gw as SitePublishDomainOperationResponseSchema,zw as SitePublishDomainReconcileOperationResponseSchema,hc as SitePublishQualityTaskStatusSchema,Pw as SitePublishWorkflowActiveResponseSchema,na as SitePublishWorkflowIdSchema,FS as SitePublishWorkflowMutationDataSchema,ww as SitePublishWorkflowMutationResponseSchema,qS as SitePublishWorkflowPublishDataSchema,Aw as SitePublishWorkflowPublishResponseSchema,GS as SitePublishWorkflowQualityDataSchema,vw as SitePublishWorkflowQualityResponseSchema,gt as SitePublishWorkflowRecordSchema,kw as SitePublishWorkflowRevisionRequestSchema,CS as SitePublishWorkflowStatusSchema,DS as SitePublishWorkflowStepSchema,it as SiteRecordSchema,Py as SiteTemplateUpgradeStateIdSchema,ea as SiteVersionIdSchema,Af as SiteVersionListItemSchema,as as SiteVersionRecordSchema,Ne as SiteWorkflowIdSchema,Bd as SiteWorkflowRecordSchema,rR as SiteWorkflowSnapshotResponseSchema,Ws as SiteWorkflowSnapshotSchema,Ld as SiteWorkflowStatusSchema,sa as SiteWorkflowTaskRefIdSchema,cR as SiteWorkflowTaskRefResponseSchema,qo as SiteWorkflowTaskRefSchema,iC as SitemapAddBlockInputSchema,Vi as SitemapAnswerSchema,nC as SitemapChangeBlockVariantInputSchema,pb as SitemapDeleteBlockInputSchema,eb as SitemapDraftBlockSchema,tb as SitemapDraftPageSchema,kb as SitemapDraftRecordSchema,rn as SitemapDraftSchema,lb as SitemapEditActorSchema,gb as SitemapEditErrorCodeSchema,hb as SitemapEditFailureSchema,ub as SitemapEditOperationSchema,oC as SitemapEditResultSchema,_b as SitemapEditSuccessSchema,cC as SitemapGenerationInputSchema,Ib as SitemapGenerationOutcomeSchema,Rb as SitemapGenerationReasonSchema,mm as SitemapGenerationStageSchema,ke as SitemapIdSchema,Sb as SitemapIntentPageSchema,eC as SitemapModelOutputSchema,sb as SitemapModelPageSchema,tC as SitemapMoveBlockInputSchema,Zf as SitemapNavigationHrefSchema,xe as SitemapNodeIdSchema,gm as SitemapRecordSchema,Zv as SitemapResolverModelOutputSchema,Qv as SitemapResolverRequestSchema,Jv as SitemapResolverResponseSchema,mb as SitemapResolverTargetsSchema,cm as SitemapRunInputSchema,At as SitemapSchema,ab as SitemapSourceProvenanceSchema,mC as SitemapStreamEventSchema,OP as SitemapTaskCreateRequestSchema,FP as SitemapTaskCreateResponseSchema,eS as SitemapTaskFailureErrorCodeSchema,qP as SitemapTaskResponseSchema,db as SitemapUpdateBlockInstructionInputSchema,sC as SitemapUpdateBlockPropsInputSchema,Mf as SitemapUserChoiceSchema,wt as SkillSelectionSchema,Ff as SkillSelectionSourceSchema,xm as SnapshotContentHashSchema,Se as SnapshotFilePathSchema,x as SnapshotIdSchema,He as SnapshotRecordSchema,$c as SnapshotStatusSchema,ji as StartGscAuthDataSchema,bc as StartGscAuthRequestSchema,yc as StartGscAuthResponseSchema,SR as StartSiteBuildRequestSchema,D1 as StartSiteBuildResponseSchema,y_ as StartSiteBuildResultSchema,Rw as StartSitePublishWorkflowRequestSchema,CC as StartWorkspaceRunRequestSchema,DC as StartWorkspaceRunResponseSchema,fu as Step2FinalResultDataSourceSchema,Nn as Step2FinalResultRequestSchema,NR as Step2FinalResultResponseSchema,OR as Step2FinalResultSaveResponseSchema,Su as Step2FinalResultSaveResultSchema,$s as Step2FinalResultTypeSchema,yu as Step2FinalResultViewSchema,Wo as Step2FinalScanCardKeySchema,Ys as Step2FinalScanCardSchema,hu as Step2FinalScanResultSchema,Xt as Step2KnowledgeOpaqueIdSchema,F1 as Step2KnowledgeScopeSchema,Xe as Step2PageRoleSchema,UR as Step2PageSelectionRequestSchema,FR as Step2PageSelectionResponseSchema,uu as Step2SiteInitializationCrawlerErrorCodeSchema,du as Step2SiteInitializationStatusSchema,jR as Step2SiteInitializationTaskResponseSchema,gu as Step2SiteInitializationTaskSchema,Xs as Step3AgentAnalysisSchema,Pu as Step3AnalysisFindingSchema,VR as Step3AnalysisJobResponseSchema,Yo as Step3AnalysisJobSchema,Ho as Step3AnalysisJobStatusSchema,HR as Step3AnalysisLatestResponseSchema,Vo as Step3AnalysisProgressSchema,vu as Step3AnalysisResultSchema,WR as Step3AnalysisScheduleResponseSchema,ku as Step3AnalysisScheduleSchema,$R as Step3AnalysisSseFrameSchema,KR as Step3AnalysisStartRequestSchema,$o as Step3AnalysisSummarySchema,Tu as Step3AnalystSchema,BR as Step3AnalystsResponseSchema,ZR as Step4DiagnosisResponseSchema,En as Step5ActiveStrategyKeySchema,dE as Step5CommitStrategyRequestSchema,uE as Step5CommitStrategyResponseSchema,Yl as Step5CommittedVersionSchema,Aa as Step5DecisionCustomPayloadInputSchema,Wl as Step5DecisionCustomPayloadSchema,bl as Step5EvidenceReferenceSchema,Ol as Step5GenerationStatusSchema,Ll as Step5GeoQuestionSchema,Hl as Step5JobStatusSchema,Bl as Step5LegacyDecisionCustomPayloadInputSchema,Kl as Step5LegacyDecisionCustomPayloadSchema,ql as Step5LegacySeoKeywordInputSchema,wa as Step5LegacySeoKeywordSchema,Tn as Step5MarketCountrySchema,Rn as Step5MarketTypeSchema,ys as Step5OutputLocaleSchema,mE as Step5RegenerateItemRequestSchema,lE as Step5SaveDecisionRequestSchema,pE as Step5SaveDecisionResponseSchema,kl as Step5SemrushEmptyReasonCodeSchema,Tl as Step5SemrushIntentGroupSchema,vl as Step5SemrushKeywordCandidateSchema,Cl as Step5SemrushKeywordCandidateSearchDataSchema,nE as Step5SemrushKeywordCandidateSearchRequestSchema,sE as Step5SemrushKeywordCandidateSearchResponseSchema,Rl as Step5SemrushKeywordRecommendationSchema,jl as Step5SemrushKeywordSelectionDataSchema,Dl as Step5SemrushKeywordSelectionItemSchema,iE as Step5SemrushKeywordSelectionRequestSchema,aE as Step5SemrushKeywordSelectionResponseSchema,Il as Step5SemrushRecommendationSeedSchema,wl as Step5SemrushRecommendationSnapshotSchema,yl as Step5SemrushRecommendationStatusSchema,Ra as Step5SemrushSearchIntentSchema,Pl as Step5SemrushSelectionSummarySchema,Gl as Step5SemrushSnapshotRefSchema,Pa as Step5SeoGeoPlanRowSchema,kn as Step5SeoKeywordSchema,zl as Step5SeoPayloadV2InputSchema,Es as Step5SeoPayloadV2Schema,fb as Step5SitemapDecisionSchema,Eb as Step5SitemapRunInputSchema,xb as Step5SitemapSourceSchema,rC as Step5SitemapStartRequestSchema,rE as Step5StartStrategyRequestSchema,cE as Step5StartStrategyResponseSchema,Vl as Step5StrategyDecisionInputSchema,Is as Step5StrategyDecisionSchema,xs as Step5StrategyItemSchema,va as Step5StrategyJobSchema,In as Step5StrategyKeySchema,bt as Step5StrategyOptionIdSchema,fs as Step5StrategyOptionSchema,Sl as Step5StrategyPlanSchema,Xl as Step5StrategySnapshotDataSchema,_E as Step5StrategySseFrameSchema,$l as Step5StrategyVersionSnapshotSchema,fl as Step5StructureDetailSchema,bb as Step5StructurePlanPageSchema,yb as Step5StructurePlanSchema,G_ as Step6AiThemeCandidateSchema,Vn as Step6ColorSeedsSchema,x0 as Step6DesignRecommendationGenerationInputSchema,E0 as Step6DesignRecommendationModelOutputSchema,z_ as Step6DesignRecommendationSchema,S0 as Step6DesignRecommendationsRequestSchema,f0 as Step6DesignRecommendationsResponseSchema,jr as Step6DesignSelectionSchema,Dr as Step6GeneratedThemeCardSchema,Lk as SubsiteGlossariesSchema,Wg as SubsiteGlossaryEntrySchema,zn as SubsiteHexColorSchema,Jk as SubsiteMountPathSchema,Uk as SubsitePaletteLocalizationSchema,Vg as SubsitePaletteModeSchema,Hg as SubsitePaletteSeedsSchema,Mk as SubsiteSiteInfoSchema,Kk as SubsiteSyncDiffComputeRequestSchema,Bk as SubsiteSyncDiffComputeResponseSchema,Qg as SubsiteSyncDiffErrorCodeSchema,Wk as SubsiteSyncDiffErrorResponseSchema,Yk as SubsiteVisibleTextExportRequestSchema,Xk as SubsiteVisibleTextExportResponseSchema,Dd as TASK_EXECUTION_STATUSES,Uo as TASK_EXECUTION_STATUS_CODES,Rv as TEMPLATE_UPGRADE_LOCK_LOST_ERROR_CODE,ui as THEME_PRESETS,kr as THEME_PRESET_IDS,Oo as TaskExecutionStatusSchema,m_ as TemplateUpgradeCasOutcomeSchema,mr as TemplateUpgradeErrorCodeSchema,l_ as TemplateUpgradeOutcomeCountsSchema,r_ as TemplateUpgradeOutcomeSchema,p_ as TemplateUpgradeSnapshotDeletionCandidateSchema,It as TemplateUpgradeStateSchema,s_ as TemplateUpgradeStatusSchema,c_ as TemplateUpgradeValidationStageSchema,je as TemplateVersionSchema,yv as TryAcquireTemplateUpgradeLockRequestSchema,xv as TryAcquireTemplateUpgradeLockResponseSchema,Uc as UnsplashDownloadLocationSchema,Mc as UnsplashMediaAssetSchema,HA as UpdateBriefRequestSchema,rv as UpdateBriefResponseSchema,fC as UpdateClarifyArchetypeRequestSchema,uv as UpdateCurrentSnapshotManifestRequestSchema,zE as UpdatePageDirectoryReconcileStateRequestSchema,Tw as UpdateSitePublishWorkflowStepRequestSchema,VA as UpdateSiteRequestSchema,lR as UpdateSiteWorkflowWebsiteRequestSchema,b0 as UpdateStep6DesignSelectionRequestSchema,y0 as UpdateStep6DesignSelectionResponseSchema,gR as UpdateWorkflowTaskStatusRequestSchema,pf as UploadMediaLibraryAssetResponseSchema,gw as UpstreamPromptTemplateCatalogDataSchema,uw as UpstreamPromptTemplateConsumeDataSchema,Kh as UrlListCrawlerTaskCreateRequestSchema,wy as UsageRecordIdSchema,gf as UseUnsplashMediaRequestSchema,_f as UseUnsplashMediaResponseSchema,rs as UserIdSchema,XS as VCP_GSC_STATES,Di as VcpGscStateSchema,MS as VcpQualityResultSchema,Mi as VisualHintsSchema,Lf as VisualThemeSchema,oR as WORKFLOW_DEFINITIONS_V1,Bs as WORKFLOW_DEFINITION_REGISTRY,Ad as WORKFLOW_FLOW_TYPES,Md as WORKFLOW_MENU_STATES,vd as WORKFLOW_NODE_CODES,Cd as WORKFLOW_TASK_TYPES,UC as WORKSPACE_WEBSOCKET_CONTRACT,Do as WorkflowClientCapabilitiesSchema,Fo as WorkflowDefinitionVersionSchema,Cn as WorkflowFlowTypeSchema,Kd as WorkflowMenuItemSchema,Ud as WorkflowMenuStateSchema,Bt as WorkflowNodeCodeSchema,jo as WorkflowTaskTypeSchema,Zb as WorkspaceClientMessageSchema,bf as WorkspaceDesignApplyRequestSchema,yf as WorkspaceDesignApplyResponseSchema,$i as WorkspaceDiagnosticSchema,ry as WorkspaceDirectEditFileSchema,oy as WorkspaceDirectEditPathSchema,Tm as WorkspaceDirectEditPostActionSchema,GC as WorkspaceDirectEditRequestSchema,KC as WorkspaceDirectEditResponseSchema,Yi as WorkspaceExecutionDiagnosticsSchema,xC as WorkspaceExecutionPlanSchema,ay as WorkspaceMediaRequestSchema,Zi as WorkspacePlanDependencySchema,Sm as WorkspacePlanSummarySchema,Nb as WorkspacePlanTaskKindSchema,Qi as WorkspacePlanTaskSchema,Rd as WorkspaceResourceKindSchema,kd as WorkspaceResourceNavigationSelectionSchema,Co as WorkspaceResourceOperationClientMessageSchema,Td as WorkspaceResourceOperationSummarySchema,Pd as WorkspaceResourceOperationTransientInputSchema,os as WorkspaceRunKindSchema,Qb as WorkspaceSelectedComponentSchema,ey as WorkspaceServerMessageSchema,aC as WorkspaceSitemapEditRequestSchema,Xb as WorkspaceSocketDescriptorSchema,uy as WorkspaceSourceFileBinaryResponseSchema,py as WorkspaceSourceFileKindSchema,Pm as WorkspaceSourceFileListItemSchema,BC as WorkspaceSourceFilePathQuerySchema,WC as WorkspaceSourceFileResponseSchema,dy as WorkspaceSourceFileTextResponseSchema,km as WorkspaceSourcePathSchema,Ab as WorkspaceSuggestionSchema,_m as WorkspaceSuggestionsSchema,vb as WorkspaceSuggestionsSourceSchema,fm as WorkspaceTaskCountsSchema,MC as WorkspaceWebSocketMessageSchema,LC as WorkspaceWebSocketMessageTypeSchema,Xi as WorkspaceWorkerGroupSchema,Hi as WorkspaceWorkerPhaseSchema,EC as WorkspaceWorkerResultSchema,_t as WorkspaceWorkerStatusSchema,oT as assertDeploymentTransition,ER as assertSiteBuildStatusTransition,xR as assertTaskExecutionStatusTransition,rA as buildE2bBrowserPreviewUrl,I0 as buildStep6FallbackThemeCards,Ti as canonicalizeFormDesignJson,_w as canonicalizeLauncherPromptTemplateOperation,mo as canonicalizePageSlug,jE as cmsPagePreviewUrlPath,fE as compareTemplateVersions,WT as composeSiteEditRepeatInstanceKey,mP as computeFormDesignOperationFingerprint,us as computeSiteEditCompositionKey,Kp as computeSiteEditSourceIdentityKey,ln as containsSensitiveData,qp as createSiteEditCommandFailureSchema,lo as createSiteEditCommandResultSchema,Ns as createSiteEditCommandSuccessSchema,T0 as defaultStep6Selection,JS as deriveVcpGscState,ef as doesGscPropertyMatchDomain,Yd as findWorkflowDefinition,$d as findWorkflowDefinitionInRegistry,ci as fontStack,wh as formDesignOperationFingerprintInput,rT as getDeploymentHappyPathTransitions,iT as getDeploymentTransitionPredecessors,sT as getDeploymentTransitionTargets,Er as getFontPairing,Tr as getMotionPreset,Ar as getSiteDesignThemeRadius,hs as getSiteEditSourceDeleteProtectionReason,o0 as getThemePreset,Xd as getWorkflowDefinition,bR as getWorkflowNodeIndex,Oy as hasAnyBusinessFact,qk as hasLockedSeeds,cP as hashAffectedFormDesignFiles,rP as hashCmsFormSchemaProjection,Xn as hashFormDesignJson,oP as hashFormSpec,ro as isCanonicalPageSlug,__ as isCmsMainProductsWithinLimit,DE as isCmsPageSelectable,qa as isCmsTemplateUrlPath,lx as isConsentGranted,Vu as isDeploymentActiveStatus,aT as isDeploymentTerminalStatus,qg as isExactEditEngineVersion,Yy as isExternalSiteEditInfrastructureReason,W0 as isFormSpecLocalizableFieldPath,gE as isKnownStep5SseEventName,xT as isMigrationProductsPresetBlockLabel,yT as isMigrationProductsPresetPageTitle,Yx as isNonLatinSiteLocale,EP as isPlatformMaterializedFile,n_ as isReservedSubsiteMountSegment,ip as isSiteEditMaterializationPathTemplate,Lg as isSiteEditRuntimeContainerTag,Mg as isSiteEditRuntimeTextTag,Sk as isSiteEditRuntimeVoidElementTag,Kx as isSiteEditSourceDeleteProtectedPath,il as isSiteEditSourceDirectoryPath,ua as isSiteEditSourcePath,_s as isSiteEditTextSourcePath,SP as isSiteStructureKnownFieldPath,hP as isSiteStructureLocalizableFieldPath,Ta as isStep5SeoAllowedIntentCode,yR as isWorkflowTaskTypeForNode,dg as makeSiteEditRepeatInstanceKey,bT as migrationProductsCopyForLocale,wP as normalizeCmsPublicApiBase,qr as normalizeFormOptionLabelIdentity,mn as normalizeGscDomain,Ca as normalizeStep5SeoKeyword,Up as pageSlugToRouteFilePath,OE as parseCmsPageDirectory,pT as parseComponentI18nResourcesJson,tf as parseE2bPreviewProxyDomain,Gg as parseExactEditEngineVersion,Dx as parseSiteEditCompositionKey,ug as parseSiteEditRepeatInstanceKey,EI as parseSiteEditSourceIdentityKey,Q0 as projectFormSpecToCmsSchema,nf as reconcileSitemapNavigation,P_ as resolveFont,A_ as resolveFontDisplayName,X0 as resolveFormTemplateText,fR as resolvePublishedWorkflowDefinition,Wy as resolveRedisConnectionConfig,Dk as resolveRequestedEditEngineVersion,fa as resolveSelectableSiteLocale,fk as resolveSiteEditRuntimeOperationSummary,$x as resolveSiteLocaleFromIso6393,Hx as resolveSiteTextDirection,K_ as resolveStep6RadiusId,jk as resolveSystemCurrentEditEngineVersion,Qd as selectPublishedWorkflowDefinition,Sx as selectReferenceVisualImage,ZI as siteBuildStatusFromCode,nR as siteBuildStatusToCode,JI as siteDeploymentStatusFromCode,sR as siteDeploymentStatusToCode,N_ as siteFontVariables,eR as siteWorkflowStatusFromCode,iR as siteWorkflowStatusToCode,Bg as splitSubsiteGlossaryEntry,VT as stripSiteEditRepeatInstanceKeys,tR as taskExecutionStatusFromCode,aR as taskExecutionStatusToCode,R0 as toStep6GenerationVisualHints,co as tryCanonicalizeAsciiPageSlug,Zo as validateComponentI18nResources,V0 as validateFormSpecIdentityTransition};