archik 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -518,7 +518,7 @@ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.
518
518
  ${Zu(u.errors)}`);return u.value}function _v(o){return _ft.default.stringify(o,{indent:2,lineWidth:0})}var eVn=6;function Cft(o,c){return fte.relative(o,c).split(fte.sep).join("/")||fte.basename(c)}function tVn(o){return o.endsWith(".archik.yaml")&&!o.endsWith(".archik.suggested.yaml")}async function ul(o,c){let u=[],p=[],f=new Set,y=async v=>{if(f.has(v))return;f.add(v);let _;try{_=await YGn(v,"utf-8")}catch(T){p.push({abs:v,relPath:Cft(c,v),message:T instanceof Error?T.message:String(T)});return}try{let T=Xu(_);u.push({abs:v,relPath:Cft(c,v),doc:T})}catch(T){p.push({abs:v,relPath:Cft(c,v),message:T instanceof Error?T.message:String(T)})}};await y(o);let w=async(v,_)=>{if(_>eVn)return;let T;try{T=await QGn(v,{withFileTypes:!0})}catch{return}for(let R of T){let F=fte.join(v,R.name);if(R.isDirectory()){await w(F,_+1);continue}R.isFile()&&tVn(R.name)&&await y(F)}};return await w(fte.join(c,".archik"),0),{docs:u,errors:p}}var aon=li(Mv(),1);import{readFile as dVn,readdir as hVn}from"node:fs/promises";import gte from"node:path";var nVn=ct.enum(["sync","async","return","create","destroy"]),rVn=ct.enum(["over","left_of","right_of"]),iVn=ct.enum(["alt","opt","loop","par","break","ref"]),oVn=ct.strictObject({id:ba,nodeId:ba,label:ct.string().min(1).optional(),status:E3.optional()}),cVn=ct.strictObject({type:ct.literal("message"),id:ba,from:ba,to:ba,label:ct.string().min(1),arrow:nVn,activate:ct.boolean().optional(),status:E3.optional()}),aVn=ct.strictObject({type:ct.literal("note"),id:ba,position:rVn,participants:ct.array(ba).min(1),text:ct.string().min(1),status:E3.optional()}),sVn=ct.lazy(()=>ct.strictObject({label:ct.string().optional(),steps:ct.array(oon)})),lVn=ct.lazy(()=>ct.strictObject({type:ct.literal("group"),id:ba,kind:iVn,condition:ct.string().optional(),label:ct.string().optional(),branches:ct.array(sVn).optional(),seqFile:hte.optional(),participants:ct.array(ba).optional(),status:E3.optional()})),oon=ct.lazy(()=>ct.union([cVn,aVn,lVn]));function con(o,c){let u=[];for(let p of o)if(c.has(p.id)?u.push(p.id):c.add(p.id),p.type==="group"&&p.branches)for(let f of p.branches)u.push(...con(f.steps,c));return u}var uVn=ct.strictObject({useCase:ba,slice:ba}),pte=ct.strictObject({version:ct.literal("1.0"),name:ct.string().min(1),description:ct.string().optional(),realizes:uVn.optional(),participants:ct.array(oVn).min(1),steps:ct.array(oon)}).superRefine((o,c)=>{let u=new Set;for(let y=0;y<o.participants.length;y++){let w=o.participants[y];u.has(w.id)&&c.addIssue({code:ct.ZodIssueCode.custom,path:["participants",y,"id"],message:`duplicate participant id "${w.id}"`}),u.add(w.id)}let p=new Set,f=con(o.steps,p);for(let y of f)c.addIssue({code:ct.ZodIssueCode.custom,path:["steps"],message:`duplicate step id "${y}"`})});var fVn=6;function pVn(o,c){return gte.relative(o,c).split(gte.sep).join("/")||gte.basename(c)}async function Cv(o){let c=[],u=[],p=async y=>{let w=pVn(o,y),v;try{v=await dVn(y,"utf-8")}catch(_){u.push({abs:y,relPath:w,message:_ instanceof Error?_.message:String(_)});return}try{let _=aon.default.parse(v),T=pte.safeParse(_);if(!T.success){u.push({abs:y,relPath:w,message:T.error.issues.map(R=>R.message).join("; ")});return}c.push({abs:y,relPath:w,doc:T.data})}catch(_){u.push({abs:y,relPath:w,message:_ instanceof Error?_.message:String(_)})}},f=async(y,w)=>{if(w>fVn)return;let v;try{v=await hVn(y,{withFileTypes:!0})}catch{return}for(let _ of v){let T=gte.join(y,_.name);if(_.isDirectory()){await f(T,w+1);continue}_.isFile()&&_.name.endsWith(".archik.seq.yaml")&&await p(T)}};return await f(gte.join(o,".archik"),0),{docs:c,errors:u}}var lon=li(Mv(),1);import{readFile as xVn,readdir as SVn}from"node:fs/promises";import yte from"node:path";var gVn=ct.string().min(1).refine(o=>!o.startsWith("/")&&!/^[a-zA-Z]:[\\/]/.test(o),{message:"test path must be relative (no leading / or drive letter)"}).refine(o=>!o.includes("\\"),{message:"test path must use forward slashes"}).refine(o=>!o.split("/").some(c=>c===".."),{message:"test path must not contain `..` segments"}),yVn=/^[a-z][a-z0-9-]*\.\d+$/,bVn=ct.string().regex(yVn,"branchFrom must be `<flowId>.<stepNumber>` (e.g. basic.3)"),mVn=ct.strictObject({steps:ct.array(ct.string().min(1)).min(1)}),wVn=ct.strictObject({id:ba,branchFrom:bVn,steps:ct.array(ct.string().min(1)).min(1)}),vVn=ct.strictObject({basic:mVn,alternates:ct.array(wVn).optional()}),kVn=ct.strictObject({seqFile:hte}),MVn=ct.strictObject({id:ba,description:ct.string().min(1),flows:ct.array(ba).min(1),tests:ct.array(gVn).optional(),realization:kVn.optional(),status:E3.optional()}),son=ct.strictObject({version:ct.literal("1.0"),id:ba,name:ct.string().min(1),description:ct.string().optional(),status:E3.optional(),primaryActor:ba,secondaryActors:ct.array(ba).optional(),goal:ct.string().min(1),preconditions:ct.array(ct.string().min(1)).optional(),postconditions:ct.array(ct.string().min(1)).optional(),flows:vVn,slices:ct.array(MVn).min(1)}).superRefine((o,c)=>{let u=new Map;u.set("basic",o.flows.basic.steps.length);let p=new Set;o.flows.alternates&&(o.flows.alternates.forEach((y,w)=>{y.id==="basic"&&c.addIssue({code:ct.ZodIssueCode.custom,path:["flows","alternates",w,"id"],message:'alternate id "basic" collides with the basic flow'}),p.has(y.id)&&c.addIssue({code:ct.ZodIssueCode.custom,path:["flows","alternates",w,"id"],message:`duplicate alternate flow id "${y.id}"`}),p.add(y.id),u.set(y.id,y.steps.length)}),o.flows.alternates.forEach((y,w)=>{let[v,_]=y.branchFrom.split("."),T=Number(_),R=u.get(v);if(R===void 0){c.addIssue({code:ct.ZodIssueCode.custom,path:["flows","alternates",w,"branchFrom"],message:`branchFrom "${y.branchFrom}" references unknown flow "${v}"`});return}(T<1||T>R)&&c.addIssue({code:ct.ZodIssueCode.custom,path:["flows","alternates",w,"branchFrom"],message:`branchFrom "${y.branchFrom}" step ${T} is out of range (flow "${v}" has ${R} step(s))`})}));let f=new Set;o.slices.forEach((y,w)=>{f.has(y.id)&&c.addIssue({code:ct.ZodIssueCode.custom,path:["slices",w,"id"],message:`duplicate slice id "${y.id}"`}),f.add(y.id),y.flows.forEach((_,T)=>{u.has(_)||c.addIssue({code:ct.ZodIssueCode.custom,path:["slices",w,"flows",T],message:`slice "${y.id}" references unknown flow "${_}". Available: ${Array.from(u.keys()).join(", ")}.`})}),y.flows.includes("basic")||c.addIssue({code:ct.ZodIssueCode.custom,path:["slices",w,"flows"],message:`slice "${y.id}" does not include the basic flow. Slices must include "basic" plus zero or more alternates that branch off it; otherwise the alternate has no prefix to branch from.`}),!(y.status==="proposed"||y.status==="deprecated")&&(y.tests===void 0||y.tests.length===0)&&c.addIssue({code:ct.ZodIssueCode.custom,path:["slices",w,"tests"],message:`slice "${y.id}" has no tests. Active slices must declare at least one test path (each must exist on disk). Mark the slice \`status: proposed\` if the test isn't written yet.`})})});var _Vn=6;function CVn(o,c){return yte.relative(o,c).split(yte.sep).join("/")||yte.basename(c)}function IVn(o){return o.endsWith(".archik.uc.yaml")}async function Op(o){let c=[],u=[],p=async y=>{let w=CVn(o,y),v;try{v=await xVn(y,"utf-8")}catch(R){u.push({abs:y,relPath:w,message:R instanceof Error?R.message:String(R)});return}let _;try{_=lon.default.parse(v)}catch(R){u.push({abs:y,relPath:w,message:R instanceof Error?R.message:String(R)});return}let T=son.safeParse(_);if(!T.success){u.push({abs:y,relPath:w,message:T.error.issues.map(R=>R.message).join("; ")});return}c.push({abs:y,relPath:w,doc:T.data})},f=async(y,w)=>{if(w>_Vn)return;let v;try{v=await SVn(y,{withFileTypes:!0})}catch{return}for(let _ of v){let T=yte.join(y,_.name);if(_.isDirectory()){await f(T,w+1);continue}_.isFile()&&IVn(_.name)&&await p(T)}};return await f(yte.join(o,".archik","usecases"),0),{docs:c,errors:u}}var don=li(Mv(),1);import{readFile as LVn,readdir as TVn}from"node:fs/promises";import bte from"node:path";var EVn=ct.enum(["human","external-system","time","device"]),PVn=ct.strictObject({id:ba,kind:EVn,description:ct.string().min(1),goals:ct.array(ct.string().min(1)).optional(),status:E3.optional()}),uon=ct.strictObject({version:ct.literal("1.0"),description:ct.string().optional(),actors:ct.array(PVn).min(1)}).superRefine((o,c)=>{let u=new Set;o.actors.forEach((p,f)=>{u.has(p.id)&&c.addIssue({code:ct.ZodIssueCode.custom,path:["actors",f,"id"],message:`duplicate actor id "${p.id}"`}),u.add(p.id)})});var AVn=6;function NVn(o,c){return bte.relative(o,c).split(bte.sep).join("/")||bte.basename(c)}function RVn(o){return o.endsWith(".archik.actors.yaml")}async function aS(o){let c=[],u=[],p=async y=>{let w=NVn(o,y),v;try{v=await LVn(y,"utf-8")}catch(R){u.push({abs:y,relPath:w,message:R instanceof Error?R.message:String(R)});return}let _;try{_=don.default.parse(v)}catch(R){u.push({abs:y,relPath:w,message:R instanceof Error?R.message:String(R)});return}let T=uon.safeParse(_);if(!T.success){u.push({abs:y,relPath:w,message:T.error.issues.map(R=>R.message).join("; ")});return}c.push({abs:y,relPath:w,doc:T.data})},f=async(y,w)=>{if(w>AVn)return;let v;try{v=await TVn(y,{withFileTypes:!0})}catch{return}for(let _ of v){let T=bte.join(y,_.name);if(_.isDirectory()){await f(T,w+1);continue}_.isFile()&&RVn(_.name)&&await p(T)}};return await f(bte.join(o,".archik"),0),{docs:c,errors:u}}import{readFile as OVn,readdir as FVn}from"node:fs/promises";import mte from"node:path";var DVn=ct.strictObject({id:ba.optional(),from:ba,to:ba,label:ct.string().min(1),data:ct.strictObject({in:ct.unknown().optional(),out:ct.unknown().optional()}).optional(),status:ct.enum(["ok","error"]).default("ok")}),hon=ct.strictObject({version:ct.literal("1.0"),useCase:ba,slice:ba,seqFile:ct.string().min(1).optional(),recordedAt:ct.string().min(1),steps:ct.array(DVn).min(1)});var zVn=6;function $Vn(o,c){return mte.relative(o,c).split(mte.sep).join("/")||mte.basename(c)}async function lG(o){let c=[],u=[],p=async y=>{let w=$Vn(o,y),v;try{v=await OVn(y,"utf-8")}catch(_){u.push({abs:y,relPath:w,message:_ instanceof Error?_.message:String(_)});return}try{let _=JSON.parse(v),T=hon.safeParse(_);if(!T.success){u.push({abs:y,relPath:w,message:T.error.issues.map(R=>R.message).join("; ")});return}c.push({abs:y,relPath:w,doc:T.data})}catch(_){u.push({abs:y,relPath:w,message:_ instanceof Error?_.message:String(_)})}},f=async(y,w)=>{if(w>zVn)return;let v;try{v=await FVn(y,{withFileTypes:!0})}catch{return}for(let _ of v){let T=mte.join(y,_.name);if(_.isDirectory()){await f(T,w+1);continue}_.isFile()&&_.name.endsWith(".archik.trace.json")&&await p(T)}};return await f(mte.join(o,".archik"),0),{docs:c,errors:u}}function jVn(o){let c=new Set,u=p=>{for(let f of p){let y=f;if(y.type==="message"&&y.id&&c.add(y.id),y.branches)for(let w of y.branches)u(w.steps)}};return u(o),c}function fon(o,c,u){let p=[],f=[],y=new Set;for(let{doc:w}of c)for(let v of w.slices)y.add(`${w.id}/${v.id}`);for(let{relPath:w,doc:v}of o){if(!y.has(`${v.useCase}/${v.slice}`)){p.push({path:w,message:`trace targets unknown use case / slice "${v.useCase}/${v.slice}"`});continue}if(v.seqFile===void 0)continue;let _=u.find(B=>B.relPath===v.seqFile||B.abs.endsWith("/"+v.seqFile));if(_===void 0){p.push({path:w,message:`trace seqFile "${v.seqFile}" is not a discovered sequence diagram`});continue}let T=jVn(_.doc.steps),R=new Set(_.doc.participants.map(B=>B.id)),F=new Set;for(let B of v.steps){B.id!==void 0&&(T.has(B.id)?F.add(B.id):p.push({path:w,message:`trace step id "${B.id}" is not a message id in ${v.seqFile}`}));for(let V of[B.from,B.to])R.has(V)||p.push({path:w,message:`trace step references "${V}", not a participant in ${v.seqFile}`})}for(let B of T)F.has(B)||f.push(`${w}: seq step "${B}" was not exercised by this run`)}return{errors:p,info:f}}function pon(o,c,u,p){o.forEach((f,y)=>{let w=`${p}.${y}`;f.type==="message"?(c.has(f.from)||u.push({path:`${w}.from`,message:`participant "${f.from}" is not declared in participants`}),c.has(f.to)||u.push({path:`${w}.to`,message:`participant "${f.to}" is not declared in participants`})):f.type==="note"?f.participants.forEach((v,_)=>{c.has(v)||u.push({path:`${w}.participants.${_}`,message:`participant "${v}" is not declared in participants`})}):f.type==="group"&&f.branches&&f.branches.forEach((v,_)=>{pon(v.steps,c,u,`${w}.branches.${_}.steps`)})})}function gon(o,c){let u=[],p=new Set;return o.participants.forEach((f,y)=>{p.add(f.id),c.has(f.nodeId)||u.push({path:`participants.${y}.nodeId`,message:`nodeId "${f.nodeId}" does not match any architecture node. Run \`npx archik q list\` to see available node ids.`})}),pon(o.steps,p,u,"steps"),u}var BVn={boundary:new Set(["control"]),control:new Set(["boundary","control","entity"]),entity:new Set(["control","entity"])};function yon(o,c,u,p,f,y){o.forEach((w,v)=>{let _=`${f}.${v}`;if(w.type==="message"){let T=c.get(w.from),R=c.get(w.to);if(T===void 0||R===void 0)return;let F=BVn[T];F&&!F.has(R)&&y.push({path:`${u}:${_}`,message:`ECB violation in seq "${p}" message "${w.id}": ${T} \u2192 ${R} is forbidden by the robustness rules (boundaries don't talk to boundaries or entities; entities don't talk to boundaries). Insert a control between them, or revisit the stereotype assignment.`})}else w.type==="group"&&w.branches&&w.branches.forEach((T,R)=>{yon(T.steps,c,u,p,`${_}.branches.${R}.steps`,y)})})}function bon(o,c){let u=[],p=new Map;for(let{doc:f}of c)for(let y of f.nodes)y.stereotype!==void 0&&p.set(y.id,y.stereotype);for(let f of o){if(f.doc.realizes===void 0)continue;let y=new Map;for(let w of f.doc.participants){let v=p.get(w.nodeId);v!==void 0&&y.set(w.id,v)}yon(f.doc.steps,y,f.relPath,f.doc.name,"steps",u)}return u}function mon(o,c){let u=[],p=new Map;for(let{doc:f}of c)for(let y of f.nodes){let w=p.get(y.id)??new Set;for(let v of y.seqFiles??[])w.add(v);p.set(y.id,w)}for(let f of o){if(f.doc.realizes===void 0)continue;let y=new Set;for(let w of f.doc.participants){if(y.has(w.nodeId))continue;let v=p.get(w.nodeId);v!==void 0&&(v.has(f.relPath)||(y.add(w.nodeId),u.push({path:`${f.relPath}:participants.${w.id}`,message:`seq "${f.doc.name}" lists node "${w.nodeId}" as a participant, but that node's \`seqFiles\` array does not reference this diagram. Add "${f.relPath}" to node "${w.nodeId}"'s \`seqFiles\` array via \`npx archik suggest set\` so the canvas can surface the flow on that node.`})))}}return u}function won(o,c){let u=[],p=new Map(c.map(f=>[f.doc.id,f]));for(let f of o){if(f.doc.realizes===void 0)continue;let{useCase:y,slice:w}=f.doc.realizes,v=p.get(y);if(v===void 0){u.push({path:`${f.relPath}:realizes.useCase`,message:`seq diagram "${f.doc.name}" claims to realize use case "${y}" but no such use case file was found.`});continue}let _=v.doc.slices.find(T=>T.id===w);if(_===void 0){u.push({path:`${f.relPath}:realizes.slice`,message:`seq diagram "${f.doc.name}" claims to realize slice "${w}" of use case "${y}", but that use case has no slice with that id. Available slices: ${v.doc.slices.map(T=>T.id).join(", ")}.`});continue}if(_.realization===void 0){u.push({path:`${f.relPath}:realizes.slice`,message:`seq diagram "${f.doc.name}" realizes slice "${w}" of "${y}", but the slice does not declare \`realization.seqFile\`. Add \`realization: { seqFile: "${f.relPath}" }\` to slice "${w}" in ${v.relPath}.`});continue}_.realization.seqFile!==f.relPath&&u.push({path:`${f.relPath}:realizes.slice`,message:`seq diagram "${f.doc.name}" realizes slice "${w}" of "${y}", but that slice's realization.seqFile points at "${_.realization.seqFile}", not at this file ("${f.relPath}"). Pick one canonical seq file and update both sides.`})}return u}function von(o){let c=new Map,u=[];for(let{relPath:p,doc:f}of o)for(let y of f.actors){let w=c.get(y.id);if(w!==void 0){u.push({path:p,message:`actor id "${y.id}" is duplicated across actor files (also defined in ${w.relPath})`});continue}c.set(y.id,{relPath:p})}return{index:c,errors:u}}function kon(o){let c=new Map,u=[];for(let{relPath:p,doc:f}of o){let y=c.get(f.id);if(y!==void 0){u.push({path:p,message:`use case id "${f.id}" is duplicated across files (also defined in ${y.relPath})`});continue}c.set(f.id,{relPath:p})}return{index:c,errors:u}}function Mon(o,c){let u=[];for(let{relPath:p,doc:f}of o)c.has(f.primaryActor)||u.push({path:`${p}:primaryActor`,message:`use case "${f.id}" references unknown primaryActor "${f.primaryActor}". Define it in a *.archik.actors.yaml file.`}),f.secondaryActors&&f.secondaryActors.forEach((y,w)=>{c.has(y)||u.push({path:`${p}:secondaryActors.${w}`,message:`use case "${f.id}" references unknown secondary actor "${y}". Define it in a *.archik.actors.yaml file.`})});return u}function xon(o,c){let u=[];for(let{relPath:p,doc:f}of o)f.slices.forEach((y,w)=>{y.status==="proposed"||y.status==="deprecated"||y.tests!==void 0&&y.tests.forEach((_,T)=>{c(_)||u.push({path:`${p}:slices.${w}.tests.${T}`,message:`slice "${y.id}" test "${_}" does not exist on disk (resolved relative to project root). Either fix the path or mark the slice \`status: proposed\`.`})})});return u}function Son(o,c){let u=[],p=new Map(c.map(f=>[f.relPath,f]));for(let{relPath:f,doc:y}of o)y.slices.forEach((w,v)=>{if(w.realization===void 0)return;let _=p.get(w.realization.seqFile);if(_===void 0){u.push({path:`${f}:slices.${v}.realization.seqFile`,message:`slice "${w.id}" realization seqFile "${w.realization.seqFile}" does not exist or did not parse. Run \`npx archik q sequences\` to see available seq files.`});return}if(_.doc.realizes===void 0){u.push({path:`${f}:slices.${v}.realization.seqFile`,message:`slice "${w.id}" claims realization "${w.realization.seqFile}", but that seq diagram has no \`realizes\` block. Add \`realizes: { useCase: "${y.id}", slice: "${w.id}" }\` to ${_.relPath}, or remove the realization claim.`});return}(_.doc.realizes.useCase!==y.id||_.doc.realizes.slice!==w.id)&&u.push({path:`${f}:slices.${v}.realization.seqFile`,message:`slice "${w.id}" claims realization "${w.realization.seqFile}", but that seq diagram's \`realizes\` points at "${_.doc.realizes.useCase}/${_.doc.realizes.slice}", not at "${y.id}/${w.id}". Pick one canonical link.`})});return u}import wte from"node:path";function Iv(o){let c=wte.dirname(o),u=wte.basename(o),p=wte.extname(u),f=p.length>0?u.slice(0,-p.length):u;return wte.join(c,`${f}.suggested${p}`)}function uG(o){return wte.basename(o).endsWith(".archik.suggested.yaml")?"suggested":"normal"}function _on(o){return o.metadata?.suggestion!==void 0}function wge(o){if(o.metadata?.suggestion===void 0)return o;let{suggestion:c,...u}=o.metadata,p={...o};return Object.keys(u).length===0?delete p.metadata:p.metadata=u,p}function HVn(o){let c=new Map;for(let p of o)c.set(p.id,p.parentId);let u=new Map;for(let p of o){let f=new Set,y=p.parentId,w=0;for(;y!==void 0&&w<=o.length&&!f.has(y);)f.add(y),y=c.get(y),w++;u.set(p.id,f)}return u}function dG(o,c,u){if(c.id!==void 0&&o.id!==c.id||c.kind!==void 0&&o.kind!==c.kind||c.stereotype!==void 0&&o.stereotype!==c.stereotype)return!1;let p=u.get(o.id)??new Set;return!(c.parent!==void 0&&!p.has(c.parent)||c.notParent!==void 0&&p.has(c.notParent))}function vge(o,c,u,p){let f=o.filter(y=>y.abs!==c);return f.push({abs:c,relPath:u,doc:p}),Ift(f)}function Ift(o){let c=[],u=o.flatMap(_=>_.doc.nodes),p=o.flatMap(_=>_.doc.edges.map(T=>({edge:T,relPath:_.relPath}))),f=new Map(u.map(_=>[_.id,_])),y=HVn(u),w=[],v=new Map;for(let _ of o)for(let T of _.doc.constraints??[]){let R=v.get(T.id);if(R!==void 0){c.push({path:`constraints.${T.id}`,message:`duplicate constraint id "${T.id}" (already defined in ${R})`});continue}v.set(T.id,_.relPath),w.push({constraint:T,relPath:_.relPath})}for(let{constraint:_}of w){let T=new Set(_.except??[]);if(_.forbidEdge!==void 0){let R=_.forbidEdge;for(let{edge:F,relPath:B}of p)if(!T.has(F.id)&&!(R.relationship!==void 0&&F.relationship!==R.relationship)){if(R.from!==void 0){let V=f.get(F.from);if(V===void 0||!dG(V,R.from,y))continue}if(R.to!==void 0){let V=f.get(F.to);if(V===void 0||!dG(V,R.to,y))continue}c.push({path:`constraints.${_.id}`,message:`edge "${F.id}" (${F.from} \u2192 ${F.to} via ${F.relationship}, in ${B}) violates constraint "${_.id}": ${_.description} \u2014 fix the edge, or add "${F.id}" to the constraint's \`except\` list with a reason in review.`})}}if(_.requireEdge!==void 0){let R=_.requireEdge;for(let F of u){if(T.has(F.id)||!dG(F,R.node,y)||p.some(({edge:se})=>{if(R.relationship!==void 0&&se.relationship!==R.relationship)return!1;if(R.to!==void 0){if(se.from!==F.id)return!1;let ce=f.get(se.to);return ce!==void 0&&dG(ce,R.to,y)}if(se.to!==F.id)return!1;let ee=f.get(se.from);return ee!==void 0&&dG(ee,R.from,y)}))continue;let V=R.to!==void 0?`an outgoing edge to a node matching ${JSON.stringify(R.to)}`:`an incoming edge from a node matching ${JSON.stringify(R.from)}`;c.push({path:`constraints.${_.id}`,message:`node "${F.id}" (kind: ${F.kind}) violates constraint "${_.id}": ${_.description} \u2014 it needs ${V}`+(R.relationship!==void 0?` (relationship: ${R.relationship})`:"")+`, or add "${F.id}" to the constraint's \`except\` list.`})}}if(_.maxDependencies!==void 0){let R=_.maxDependencies;for(let F of u){if(T.has(F.id)||!dG(F,R.node,y))continue;let B=p.filter(({edge:V})=>V.from===F.id&&(R.relationship===void 0||V.relationship===R.relationship));B.length<=R.max||c.push({path:`constraints.${_.id}`,message:`node "${F.id}" (kind: ${F.kind}) violates constraint "${_.id}": ${_.description} \u2014 ${B.length} outgoing ${R.relationship??""} edge(s), max is ${R.max} (${B.map(V=>V.edge.to).join(", ")}). Split the node, introduce a port/gateway, or add "${F.id}" to \`except\`.`})}}if(_.requireOwner!==void 0){let R=_.requireOwner.kinds;for(let F of u)T.has(F.id)||R!==void 0&&!R.includes(F.kind)||F.owner===void 0&&c.push({path:`constraints.${_.id}`,message:`node "${F.id}" (kind: ${F.kind}) violates constraint "${_.id}": ${_.description} \u2014 add \`owner: <team>\` to the node, or add "${F.id}" to the constraint's \`except\` list.`})}}return c}var CE={maxNodes:15,maxEdges:20,maxChildren:6,maxDegree:6,maxDepth:3};function UVn(o,c){let u=0,p=c.get(o);for(;p!==void 0&&u<=c.size;)u++,p=c.get(p);return u}function kge(o,c){let u=[];for(let{doc:f,relPath:y}of o){f.nodes.length>c.maxNodes&&u.push({kind:"file-nodes",subject:y,value:f.nodes.length,limit:c.maxNodes,suggestion:`split ${y} into sub-files via archikFile (${f.nodes.length} nodes; limit ${c.maxNodes})`}),f.edges.length>c.maxEdges&&u.push({kind:"file-edges",subject:y,value:f.edges.length,limit:c.maxEdges,suggestion:`split ${y} into sub-files via archikFile (${f.edges.length} edges; limit ${c.maxEdges})`});let w=new Map,v=new Map;for(let _ of f.nodes)v.set(_.id,_.parentId);for(let _ of f.nodes)_.parentId!==void 0&&w.set(_.parentId,(w.get(_.parentId)??0)+1);for(let[_,T]of w)T>c.maxChildren&&u.push({kind:"container-children",subject:_,value:T,limit:c.maxChildren,suggestion:`give container '${_}' its own archikFile \u2014 ${T} children, limit ${c.maxChildren}`});for(let _ of f.nodes){let T=UVn(_.id,v);T>c.maxDepth&&u.push({kind:"nesting-depth",subject:_.id,value:T,limit:c.maxDepth,suggestion:`flatten or split \u2014 '${_.id}' is ${T} levels deep, limit ${c.maxDepth}`})}}let p=new Map;for(let{doc:f}of o)for(let y of f.edges)p.set(y.from,(p.get(y.from)??0)+1),p.set(y.to,(p.get(y.to)??0)+1);for(let[f,y]of p)y>c.maxDegree&&u.push({kind:"node-degree",subject:f,value:y,limit:c.maxDegree,suggestion:`'${f}' has ${y} connections \u2014 name a bounded context or add a port/gateway (limit ${c.maxDegree})`});return u.sort((f,y)=>y.value-y.limit-(f.value-f.limit)),u}var VVn=o=>{let c=dn(o,"json");return c!==void 0&&c!=="false"&&c!=="0"};function Ev(o){console.log(JSON.stringify(o,null,2))}async function AR(o){let c=VVn(o),u;try{u=await ac(o._[0])}catch(tn){let cn=tn instanceof Error?tn.message:String(tn);return c?Ev({ok:!1,errors:[{path:"<root>",message:cn}]}):console.error(`\u2717 ${cn}`),1}let p=Con.relative(process.cwd(),u)||u,f;try{f=await GVn(u,"utf-8")}catch(tn){let cn=tn instanceof Error?tn.message:String(tn);return c?Ev({ok:!1,file:p,errors:[{path:"<root>",message:cn}]}):(console.error(`\u2717 Cannot read ${p}`),console.error(cn)),1}let y;try{y=Ion.default.parse(f)}catch(tn){let Nr=[{path:"<root>",message:`Invalid YAML: ${tn instanceof Error?tn.message:String(tn)}`}];return c?Ev({ok:!1,file:p,errors:Nr}):(console.error(`\u2717 ${p}`),console.error(Zu(Nr))),1}let w=jg(y);if(!w.ok)return c?Ev({ok:!1,file:p,errors:w.errors}):(console.error(`\u2717 ${p}`),console.error(Zu(w.errors))),1;let v=Ba(u),_=tn=>qVn(Con.resolve(v,tn)),T=sG(w.value,_);if(T.length>0)return c?Ev({ok:!1,file:p,errors:T}):(console.error(`\u2717 ${p}`),console.error(Zu(T))),1;let R=uG(u),F=aG(w.value,R,_);if(F.length>0)return c?Ev({ok:!1,file:p,errors:F}):(console.error(`\u2717 ${p}`),console.error(Zu(F))),1;let B=await ul(u,v);if(B.errors.length>0){if(c)Ev({ok:!1,file:p,errors:B.errors.map(tn=>({path:tn.relPath,message:tn.message}))});else for(let tn of B.errors)console.error(`\u2717 ${tn.relPath}: ${tn.message}`);return 1}let V=new Set(B.docs.flatMap(tn=>tn.doc.nodes.map(cn=>cn.id))),se=[];for(let{doc:tn}of B.docs)se.push(...ion(tn,_));if(se.length>0){if(c)Ev({ok:!1,file:p,errors:se});else{console.error("\u2717 seqFiles path errors:");for(let tn of se)console.error(` \u2717 ${tn.path}: ${tn.message}`)}return 1}let ee=await Cv(v),ce=0;for(let tn of ee.errors)c||console.error(`\u2717 ${tn.relPath}: ${tn.message}`),ce++;for(let{relPath:tn,doc:cn}of ee.docs){let Nr=gon(cn,V);if(Nr.length>0){if(!c){console.error(`\u2717 ${tn}`);for(let oi of Nr)console.error(` \u2717 ${oi.path}: ${oi.message}`)}ce+=Nr.length}}if(ce>0)return c&&Ev({ok:!1,file:p,errors:[{path:"<seq>",message:`${ce} sequence diagram error(s)`}]}),1;let ge=await Op(v),Oe=await aS(v),ut=[];for(let tn of ge.errors)ut.push({path:tn.relPath,message:tn.message});for(let tn of Oe.errors)ut.push({path:tn.relPath,message:tn.message});if(ut.length===0){let tn=von(Oe.docs);ut.push(...tn.errors);let cn=kon(ge.docs);ut.push(...cn.errors),ut.length===0&&(ut.push(...Mon(ge.docs,tn.index)),ut.push(...xon(ge.docs,_)),ut.push(...Son(ge.docs,ee.docs)),ut.push(...won(ee.docs,ge.docs)),ut.push(...bon(ee.docs,B.docs)),ut.push(...mon(ee.docs,B.docs)))}if(ut.length>0)return c?Ev({ok:!1,file:p,errors:ut}):(console.error(`\u2717 ${p}`),console.error(Zu(ut))),1;let Se=await lG(v),Be=Se.errors.map(tn=>({path:tn.relPath,message:tn.message})),Ue=[];if(Be.length===0){let tn=fon(Se.docs,ge.docs,ee.docs);Be.push(...tn.errors),Ue=tn.info}if(Be.length>0)return c?Ev({ok:!1,file:p,errors:Be}):(console.error(`\u2717 ${p}`),console.error(Zu(Be))),1;let on=Ift(B.docs);if(on.length>0)return c?Ev({ok:!1,file:p,errors:on}):(console.error(`\u2717 ${p}`),console.error(Zu(on))),1;let Gt=Oe.docs.reduce((tn,cn)=>tn+cn.doc.actors.length,0),xn=ge.docs.length,Vn=kge(B.docs,CE).length;if(c)Ev({ok:!0,file:p,nodes:w.value.nodes.length,edges:w.value.edges.length,useCases:xn,actors:Gt,complexityHints:Vn});else{let tn=B.docs.reduce((Pi,ue)=>Pi+ue.doc.nodes.length,0),cn=B.docs.reduce((Pi,ue)=>Pi+ue.doc.edges.length,0),Nr=B.docs.length,oi=Nr>1?` (${Nr} files)`:"",wo=xn>0?`, ${xn} use case${xn===1?"":"s"}`:"",Za=Gt>0?`, ${Gt} actor${Gt===1?"":"s"}`:"";console.log(`\u2713 ${p}${oi} \u2014 ${tn} nodes, ${cn} edges${wo}${Za}`),Vn>0&&console.log(`\u24D8 ${Vn} complexity hint${Vn===1?"":"s"} \u2014 run \`archik complexity\` to see them`);for(let Pi of Ue)console.log(`\u24D8 ${Pi}`)}return 0}var M2t=li(P3(),1),x2t=li(Oye(),1),Kln=li(Mv(),1);import{mkdir as Jln,readFile as Zln,writeFile as Xln}from"node:fs/promises";import FG from"node:path";var Fsn=li(Nsn(),1);function ane(o,c){return o.length*c}function n0(o,c,u){if(c<=0)return"";let p=Math.floor(c/u);return o.length<=p?o:p<=1?"\u2026":o.slice(0,p-1)+"\u2026"}var sne={nodeSpacing:60,layerSpacing:100,padding:40,viewMode:"detailed"};function JXn(o){let c=o.nodeSpacing??sne.nodeSpacing,u=o.layerSpacing??sne.layerSpacing,p=o.padding??sne.padding;return{"elk.algorithm":"layered","elk.direction":"RIGHT","elk.edgeRouting":"ORTHOGONAL","elk.layered.spacing.nodeNodeBetweenLayers":String(u),"elk.spacing.nodeNode":String(c),"elk.padding":`[top=${p}, left=${p}, bottom=${p}, right=${p}]`,"elk.hierarchyHandling":"INCLUDE_CHILDREN","elk.edgeLabels.placement":"CENTER","elk.spacing.edgeLabel":"8","elk.spacing.labelLabel":"6","elk.spacing.edgeNode":"20","elk.spacing.edgeEdge":"12","elk.layered.spacing.edgeEdgeBetweenLayers":"12"}}var ed={width:172,height:82},Rsn={width:172,height:90},ZXn={service:ed,function:ed,worker:ed,agent:ed,database:{width:184,height:100},cache:Rsn,vectordb:ed,storage:ed,model:ed,dto:ed,dataobject:ed,queue:{width:188,height:80},topic:ed,stream:ed,gateway:ed,cdn:ed,route:ed,interface:ed,adapter:ed,port:ed,llm:ed,prompt:ed,tool:ed,auth:ed,observability:ed,cloud:{width:200,height:120},frontend:Rsn,page:ed,component:ed,store:ed,hook:ed,external:{width:184,height:100},human:{width:184,height:100},module:{width:240,height:130},custom:{width:240,height:130}},dl={width:152,height:36},Dsn={width:200,height:80},XXn={service:dl,function:dl,worker:dl,agent:dl,database:dl,cache:dl,vectordb:dl,storage:dl,model:dl,dto:dl,dataobject:dl,queue:{width:168,height:36},topic:dl,stream:dl,gateway:dl,cdn:dl,route:dl,interface:dl,adapter:dl,port:dl,llm:dl,prompt:dl,tool:dl,auth:dl,observability:dl,cloud:dl,frontend:dl,page:dl,component:dl,store:dl,hook:dl,external:{width:168,height:40},human:{width:168,height:40},module:Dsn,custom:Dsn},KXn=24,Osn=320;function YXn(o,c,u){if(o.kind==="module"||o.kind==="custom")return c;if(u==="compact"){let v=36+ane(o.name,5.9)+12;return Math.max(c,Math.min(Osn,Math.ceil(v)))}let p=ane(o.name,7.4),f=o.stack!==void 0?ane(o.stack,5.9):0,y=Math.max(p,f)+KXn;return Math.max(c,Math.min(Osn,Math.ceil(y)))}var QXn={top:48,left:18,bottom:18,right:18};function eKn(o,c,u,p){let f=u[o.kind],y={id:o.id,width:YXn(o,f.width,p),height:f.height};if(c.length>0){y.children=c;let w=p==="compact"?{top:30,left:12,bottom:12,right:12}:QXn;y.layoutOptions={"elk.padding":`[top=${w.top}, left=${w.left}, bottom=${w.bottom}, right=${w.right}]`}}return y}function tKn(o,c,u){let p=new Map;for(let v of o.nodes)p.set(v.id,v);let f=new Map;for(let v of o.nodes){let _=f.get(v.parentId)??[];_.push(v),f.set(v.parentId,_)}function y(v){let _=(f.get(v.id)??[]).map(y);return eKn(v,_,c,u)}return{roots:(f.get(void 0)??[]).map(y),byId:p}}function nKn(o){return o.fromFile===void 0&&o.toFile===void 0}function rKn(o){return o.edges.filter(nKn).map(c=>{let u={id:c.id,sources:[c.from],targets:[c.to]};return c.label!==void 0&&c.label.length>0&&(u.labels=[{text:c.label,width:Math.ceil(ane(c.label,5.9)),height:14}]),u})}function Gm(o){return o??0}function zsn(o,c){let u=c.get(o.id);if(!u)throw new Error(`ELK returned unknown node id "${o.id}"`);let p=(o.children??[]).map(f=>zsn(f,c));return{...u,x:Gm(o.x),y:Gm(o.y),width:Gm(o.width),height:Gm(o.height),children:p}}function iKn(o,c){let u=new Map,p=new Map,f=(T,R,F,B)=>{let V=R+Gm(T.x),se=F+Gm(T.y);u.set(T.id,{x:V,y:se}),p.set(T.id,B);let ee=[...B,T.id];for(let ce of T.children??[])f(ce,V,se,ee)};f(o,0,0,[]);let y=(T,R)=>{let F=p.get(T)??[],B=p.get(R)??[],V=0;for(;V<F.length&&V<B.length&&F[V]===B[V];)V++;let se=V===0?o.id:F[V-1];return u.get(se)??{x:0,y:0}},w=new Map,v=new Map,_=T=>{for(let R of T.edges??[]){let F=R.sources?.[0]??"",B=R.targets?.[0]??"",V=y(F,B),se=ge=>({x:Gm(ge.x)+V.x,y:Gm(ge.y)+V.y}),ee=(R.sections??[]).map(ge=>({startPoint:se(ge.startPoint),endPoint:se(ge.endPoint),bendPoints:(ge.bendPoints??[]).map(se)}));w.set(R.id,ee);let ce=(R.labels??[]).map(ge=>({text:typeof ge.text=="string"?ge.text:"",x:Gm(ge.x)+V.x,y:Gm(ge.y)+V.y,width:Gm(ge.width),height:Gm(ge.height)}));v.set(R.id,ce)}for(let R of T.children??[])_(R)};return _(o),c.edges.map(T=>({...T,sections:w.get(T.id)??[],labels:v.get(T.id)??[]}))}var oKn=new Fsn.default;async function cKn(o,c={}){if(o.nodes.length===0)return{document:o,width:0,height:0,roots:[],edges:[]};let u=c.viewMode==="compact"?"compact":"detailed",p=u==="compact"?XXn:ZXn,{roots:f,byId:y}=tKn(o,p,u),w={id:"__root__",layoutOptions:JXn(c),children:f,edges:rKn(o)},v=await oKn.layout(w),_=(v.children??[]).map(T=>zsn(T,y));return{document:o,width:Gm(v.width),height:Gm(v.height),roots:_,edges:iKn(v,o)}}var Fye={name:"elk",layout:cKn};var Dli={[Fye.name]:Fye},aKn=Fye;function NG(o,c){return aKn.layout(o,c)}function $sn(o,c,u){let p=new Map,f=(v,_)=>{let T=p.get(v)??new Set;T.add(_),p.set(v,T)};for(let v of o)f(v.from,v.to),f(v.to,v.from);let y=new Set([c]),w=new Set([c]);for(let v=0;v<u;v++){let _=new Set;for(let T of w)for(let R of p.get(T)??[])y.has(R)||(y.add(R),_.add(R));if(_.size===0)break;w=_}return y}function jsn(o,c,u){let p=o.flatMap(v=>v.doc.edges),f=$sn(p,c,u),y=[],w=[];for(let{doc:v,relPath:_}of o){for(let T of v.nodes)f.has(T.id)&&y.push({node:T,relPath:_});for(let T of v.edges)f.has(T.from)&&f.has(T.to)&&w.push({edge:T,relPath:_})}return{nodes:y,edges:w}}function Bsn(o,c,u){let p=$sn(o.edges,c,u);return{...o,nodes:o.nodes.filter(f=>p.has(f.id)).map(f=>f.parentId!==void 0&&!p.has(f.parentId)?(({parentId:y,...w})=>w)(f):f),edges:o.edges.filter(f=>p.has(f.from)&&p.has(f.to))}}function Hsn(o,c){let u=new Set(c.hideRel??[]),p=c.onlyRel?new Set(c.onlyRel):null,f=o.edges.filter(y=>!(p&&!p.has(y.relationship)||u.has(y.relationship)||c.hideStructural&&eon(y.relationship)==="structural"));return{...o,edges:f}}var zye="seq-arrow-filled",$ye="seq-arrow-open";function sKn(o){return Math.max(160,o.length*8+80)}function Usn(o,c,u,p,f,y=0){let w=u,v=[],_=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY;for(let R of o)if(R.type==="message"){let F=c.get(R.from),B=c.get(R.to),V=F?.cx??p,se=B?.cx??p;v.push({type:"message",id:R.id,fromCx:V,toCx:se,y:w,label:R.label,arrow:R.arrow,activate:R.activate??!1,isSelf:R.from===R.to,...R.status!==void 0?{status:R.status}:{}}),w+=R.from===R.to?56*1.5:56}else if(R.type==="note"){let F=R.participants.map(ce=>c.get(ce)?.cx).filter(ce=>ce!==void 0).sort((ce,ge)=>ce-ge),B=F[0]??p,V=F[F.length-1]??f,se=Math.min(Math.max(R.text.length*7.5+24,V-B+16,80),400),ee;R.position==="left_of"?ee=B-se-8:R.position==="right_of"?ee=V+8:ee=(B+V)/2-se/2,_=Math.min(_,ee),T=Math.max(T,ee+se),v.push({type:"note",id:R.id,x:ee,y:w,width:se,height:64,text:R.text,...R.status!==void 0?{status:R.status}:{}}),w+=72}else if(R.type==="group"){let F=Math.min(y*6,12),B=p-12+F,V=f-p+24-F*2,se=w;w+=24;let ee=[];if(R.branches)for(let ce=0;ce<R.branches.length;ce++){let ge=R.branches[ce],Oe=w,{items:ut,endY:Se,contentMinX:Be,contentMaxX:Ue}=Usn(ge.steps,c,w,p,f,y+1);w=Se,_=Math.min(_,Be),T=Math.max(T,Ue),ee.push({...ge.label!==void 0?{label:ge.label}:{},startY:Oe,...ce<R.branches.length-1?{dividerY:w}:{},steps:ut}),ce<R.branches.length-1&&(w+=4)}w+=12,v.push({type:"group",id:R.id,kind:R.kind,...R.condition!==void 0?{condition:R.condition}:{},...R.label!==void 0?{label:R.label}:{},...R.seqFile!==void 0?{seqFile:R.seqFile}:{},x:B,y:se,width:V,height:w-se,branches:ee,...R.status!==void 0?{status:R.status}:{}}),_=Math.min(_,B),T=Math.max(T,B+V),w+=20}return{items:v,endY:w,contentMinX:_,contentMaxX:T}}function qsn(o){let c=new Map;for(let u of o)if(u.type==="message"&&u.arrow==="destroy"&&c.set(u.toCx,u.y+56+20),u.type==="group")for(let p of u.branches)for(let[f,y]of qsn(p.steps))c.set(f,y);return c}function lKn(o){let c=[],u=new Map;function p(f){for(let y of f)if(y.type==="message"){if(y.activate&&y.arrow==="sync"&&!y.isSelf){let w=u.get(y.toCx)??[];w.push(y.y),u.set(y.toCx,w)}if(y.arrow==="return"&&!y.isSelf){let w=u.get(y.fromCx);if(w&&w.length>0){let v=w.pop();c.push({cx:y.fromCx,startY:v,endY:y.y}),w.length===0&&u.delete(y.fromCx)}}}else if(y.type==="group")for(let w of y.branches)p(w.steps)}p(o);for(let[f,y]of u)for(let w of y)c.push({cx:f,startY:w,endY:w+56/2});return c}function Gsn(o,c){let u=o.participants.map(on=>sKn(on.label??on.nodeId)),p=32,f=o.participants.map((on,Gt)=>{let xn=u[Gt],Vn=p+xn/2;p+=xn;let tn=c?.get(on.nodeId);return{id:on.id,nodeId:on.nodeId,label:on.label??on.nodeId,cx:Vn,colWidth:xn,...tn!==void 0?{kind:tn}:{},...on.status!==void 0?{status:on.status}:{},lifelineEndY:0}}),y=p+32,w=new Map(f.map(on=>[on.id,on])),v=f[0]?.cx??32,_=f[f.length-1]?.cx??y-32,T=24,{items:R,endY:F,contentMinX:B,contentMaxX:V}=Usn(o.steps,w,T,v,_),se=B<32&&Number.isFinite(B)?32-B:0,ee=Number.isFinite(V)?V+se+32:0,ce=Math.max(y+se,ee),ge=se>0?R.map(on=>Vsn(on,se)):R,Oe=se>0?f.map(on=>({...on,cx:on.cx+se})):f,ut=qsn(ge),Se=Oe.map(on=>({...on,lifelineEndY:ut.get(on.cx)??56+F+24})),Be=56+F+24,Ue=lKn(ge);return{participants:Se,steps:ge,activations:Ue,totalWidth:ce,totalHeight:Be}}function Vsn(o,c){return o.type==="message"?{...o,fromCx:o.fromCx+c,toCx:o.toCx+c}:o.type==="note"?{...o,x:o.x+c}:{...o,x:o.x+c,branches:o.branches.map(u=>({...u,steps:u.steps.map(p=>Vsn(p,c))}))}}var ci=li(u2t(),1);var D3=li(ec(),1),tln=(o,c,u)=>({width:o,height:o,viewBox:"0 0 24 24",fill:"none",stroke:c,strokeWidth:u,strokeLinecap:"round",strokeLinejoin:"round"});function nln({size:o=16,color:c="currentColor",strokeWidth:u=1.8}){return(0,D3.jsxs)("svg",{...tln(o,c,u),"aria-hidden":"true",children:[(0,D3.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"3.5",ry:"3.5"}),(0,D3.jsx)("line",{x1:"9",y1:"9",x2:"9",y2:"13"}),(0,D3.jsx)("line",{x1:"15",y1:"9",x2:"15",y2:"13"}),(0,D3.jsx)("circle",{cx:"12",cy:"16.5",r:"1",fill:c,stroke:"none"})]})}function rln({size:o=16,color:c="currentColor",strokeWidth:u=1.8}){return(0,D3.jsxs)("svg",{...tln(o,c,u),"aria-hidden":"true",children:[(0,D3.jsx)("path",{d:"M 7.5 6 L 3.5 12 L 7.5 18"}),(0,D3.jsx)("path",{d:"M 16.5 6 L 20.5 12 L 16.5 18"}),(0,D3.jsx)("circle",{cx:"13",cy:"8.6",r:"0.9",fill:c,stroke:"none"}),(0,D3.jsx)("line",{x1:"13",y1:"11",x2:"11",y2:"16.5"})]})}var Vm={service:{color:"#38bdf8",icon:ci.Server,description:"Long-running compute that owns business logic."},function:{color:"#22d3ee",icon:ci.FunctionSquare,description:"Stateless function-as-a-service / lambda."},worker:{color:"#06b6d4",icon:ci.Cog,description:"Background job processor or consumer loop."},agent:{color:"#14b8a6",icon:ci.Bot,description:"Autonomous AI agent driving tools and actions."},database:{color:"#34d399",icon:ci.Database,description:"Persistent state \u2014 relational, document, key-value."},cache:{color:"#a78bfa",icon:ci.Layers,description:"In-memory store for fast reads."},vectordb:{color:"#c084fc",icon:ci.Sparkles,description:"Vector store for embeddings / similarity search."},storage:{color:"#84cc16",icon:ci.HardDrive,description:"Object / blob storage (S3, GCS, etc.)."},model:{color:"#2dd4bf",icon:ci.Shapes,description:"Domain model \u2014 rich business object with behavior."},dto:{color:"#4ade80",icon:ci.FileJson2,description:"Data transfer object \u2014 shape crossing a boundary."},dataobject:{color:"#86efac",icon:ci.Braces,description:"Plain data structure / record, no behavior."},queue:{color:"#fbbf24",icon:ci.SendHorizontal,description:"Asynchronous work queue with at-least-once delivery."},topic:{color:"#f97316",icon:ci.Radio,description:"Pub/sub topic with multiple consumers."},stream:{color:"#fb923c",icon:ci.Waves,description:"Append-only event log (Kafka, Kinesis)."},gateway:{color:"#6366f1",icon:ci.DoorOpen,description:"API gateway, ingress, edge router."},cdn:{color:"#0ea5e9",icon:ci.Globe,description:"Content delivery network / static edge."},route:{color:"#f59e0b",icon:ci.Route,description:"HTTP / URL route \u2014 path + method mapped to a handler."},interface:{color:"#d946ef",icon:rln,description:"Abstract contract \u2014 the <i> a system commits to."},adapter:{color:"#c026d3",icon:ci.Cable,description:"Concrete implementation of an interface."},port:{color:"#a21caf",icon:nln,description:"Hexagonal-architecture port \u2014 the socket an adapter plugs into."},llm:{color:"#a855f7",icon:ci.Brain,description:"Large language model service."},prompt:{color:"#c4b5fd",icon:ci.MessageSquare,description:"Prompt template / instruction set."},tool:{color:"#fde047",icon:ci.Wrench,description:"Tool callable by an agent or LLM."},auth:{color:"#ef4444",icon:ci.Lock,description:"Identity provider, auth service."},observability:{color:"#10b981",icon:ci.Eye,description:"Metrics, logs, traces \u2014 operational telemetry."},cloud:{color:"#0284c7",icon:ci.Cloud,description:"Managed cloud service (compute, hosted, etc.)."},frontend:{color:"#f472b6",icon:ci.Monitor,description:"User-facing surface \u2014 browser, mobile, CLI."},page:{color:"#fb7185",icon:ci.LayoutTemplate,description:"Route-level UI screen mapped to a URL."},component:{color:"#8b5cf6",icon:ci.Component,description:"Reusable UI component / view fragment."},store:{color:"#facc15",icon:ci.Boxes,description:"Client-side state container \u2014 Redux, Zustand, Pinia."},hook:{color:"#0d9488",icon:ci.Anchor,description:"Reusable client logic \u2014 React hook, Vue composable."},external:{color:"#94a3b8",icon:ci.ExternalLink,description:"Third-party system you don't own."},human:{color:"#60a5fa",icon:ci.UserRound,description:"Human actor \u2014 end user, operator, or customer."},module:{color:"#7dd3fc",icon:ci.Package,description:"Module / component grouping (logical container)."},custom:{color:"#64748b",icon:ci.Box,description:"Container or anything not in the taxonomy."}};var Kz=li(ec(),1),XOe=36,q6r=128,G6r=7,iln=20,oln=24;function cln({participant:o,nodeKind:c}){let u=c?Vm[c]:void 0,p=u?.color??"var(--archik-fg-muted)",f=(56-XOe)/2,y=u?.icon,w=Math.max(q6r,o.label.length*G6r+oln+(y?iln:0)),v=w/2,_=y?v+iln/2:v,T=o.status,R=T==="proposed"?.55:T==="deprecated"?.35:1,F=T==="proposed"||T==="deprecated"?"4 3":void 0;return(0,Kz.jsxs)("g",{transform:`translate(${o.cx-v}, ${f})`,opacity:R,children:[(0,Kz.jsx)("rect",{width:w,height:XOe,rx:8,fill:"var(--archik-node-fill)",stroke:p,strokeWidth:1.4,...F!==void 0?{strokeDasharray:F}:{}}),y&&(0,Kz.jsx)("g",{transform:`translate(${oln/2}, ${(XOe-14)/2})`,children:(0,Kz.jsx)(y,{size:14,color:p,strokeWidth:1.5})}),(0,Kz.jsx)("text",{x:_,y:XOe/2+4,textAnchor:"middle",fontSize:12,fontWeight:500,fill:"var(--archik-fg)",fontFamily:"inherit",children:o.label})]})}var sln=li(ec(),1);function aln({participant:o}){let c=o.status,u=c==="proposed"?.3:c==="deprecated"?.2:.5;return(0,sln.jsx)("line",{x1:o.cx,y1:56,x2:o.cx,y2:o.lifelineEndY,stroke:"var(--archik-node-stroke)",strokeWidth:1,strokeDasharray:"4 4",opacity:u})}var u6=li(ec(),1),h2t=32,f2t=20,V6r=-6;function lln({msg:o}){let c=o.arrow==="return",u=o.arrow==="async",p=o.arrow==="create",f=c||p,y=o.arrow==="destroy",w=c||u?$ye:zye,v=o.status==="proposed"?.5:o.status==="deprecated"?.35:1;if(o.isSelf){let F=o.fromCx,B=o.y,V=`M ${F} ${B} L ${F+h2t} ${B} L ${F+h2t} ${B+f2t} L ${F} ${B+f2t}`;return(0,u6.jsxs)("g",{opacity:v,children:[(0,u6.jsx)("path",{d:V,fill:"none",stroke:"var(--archik-edge-filled)",strokeWidth:1.4,markerEnd:`url(#${w})`}),(0,u6.jsx)("text",{x:F+h2t+6,y:B+f2t/2+4,fontSize:11,fill:"var(--archik-fg)",fontFamily:"inherit",children:o.label})]})}let T=o.fromCx<o.toCx?o.toCx-6:o.toCx+6,R=(o.fromCx+o.toCx)/2;return(0,u6.jsxs)("g",{opacity:v,children:[(0,u6.jsx)("line",{x1:o.fromCx,y1:o.y,x2:T,y2:o.y,stroke:"var(--archik-edge-filled)",strokeWidth:1.4,strokeDasharray:f?"4 4":void 0,markerEnd:y?void 0:`url(#${w})`}),(0,u6.jsxs)("text",{x:R,y:o.y+V6r,textAnchor:"middle",fontSize:11,fill:"var(--archik-fg)",fontFamily:"inherit",children:[p&&"\xABcreate\xBB ",o.label]}),o.arrow==="destroy"&&(0,u6.jsxs)("g",{transform:`translate(${o.toCx-6}, ${o.y-6})`,children:[(0,u6.jsx)("line",{x1:0,y1:0,x2:12,y2:12,stroke:"var(--archik-fg-muted)",strokeWidth:1.5}),(0,u6.jsx)("line",{x1:12,y1:0,x2:0,y2:12,stroke:"var(--archik-fg-muted)",strokeWidth:1.5})]})]})}var Y9=li(ec(),1),W6r={alt:"#6366f1",opt:"#0ea5e9",loop:"#10b981",par:"#f59e0b",break:"#ef4444",ref:"#8b5cf6"},uln=36,p2t=18;function dln({group:o,renderStep:c,onRefClick:u}){let p=W6r[o.kind]??"var(--archik-fg-muted)",f=o.status==="proposed"?.55:o.status==="deprecated"?.35:1,y=o.kind==="ref"&&o.seqFile!==void 0&&u!==void 0;return(0,Y9.jsxs)("g",{opacity:f,onClick:y?()=>u(o.seqFile):void 0,style:y?{cursor:"pointer"}:void 0,children:[(0,Y9.jsx)("rect",{x:o.x,y:o.y,width:o.width,height:o.height,rx:4,fill:"none",stroke:p,strokeWidth:1.2,opacity:.6}),(0,Y9.jsx)("rect",{x:o.x,y:o.y,width:uln,height:p2t,rx:4,fill:p,opacity:.8}),(0,Y9.jsx)("text",{x:o.x+6,y:o.y+p2t-5,fontSize:10,fontWeight:600,fill:"#fff",fontFamily:"inherit",children:o.kind}),(o.condition??o.label)&&(0,Y9.jsx)("text",{x:o.x+uln+6,y:o.y+p2t-5,fontSize:10,fill:p,fontFamily:"inherit",children:o.condition??o.label}),o.branches.map((w,v)=>(0,Y9.jsxs)("g",{children:[w.label&&(0,Y9.jsx)("text",{x:o.x+6,y:w.startY+12,fontSize:10,fill:p,fontFamily:"inherit",children:w.label}),w.steps.map(_=>c(_)),w.dividerY!==void 0&&(0,Y9.jsx)("line",{x1:o.x,y1:w.dividerY,x2:o.x+o.width,y2:w.dividerY,stroke:p,strokeWidth:1,strokeDasharray:"4 2",opacity:.5})]},v))]})}var RG=li(ec(),1);function J6r(o,c){let u=Math.max(10,Math.floor(c/6.5));if(o.length<=u)return[o];let p=o.split(" "),f=[],y="";for(let w of p)(y+(y?" ":"")+w).length>u&&y?(f.push(y),y=w):y=y?y+" "+w:w;return y&&f.push(y),f.slice(0,3)}function hln({note:o}){let{x:c,y:u,width:p,height:f,text:y}=o,w=o.status==="proposed"?.55:o.status==="deprecated"?.35:1;return(0,RG.jsxs)("g",{opacity:w,children:[(0,RG.jsx)("path",{d:`M ${c} ${u} L ${c+p-10} ${u} L ${c+p} ${u+10} L ${c+p} ${u+f} L ${c} ${u+f} Z`,fill:"var(--archik-node-fill)",stroke:"var(--archik-node-stroke)",strokeWidth:1.2}),(0,RG.jsx)("path",{d:`M ${c+p-10} ${u} L ${c+p-10} ${u+10} L ${c+p} ${u+10}`,fill:"none",stroke:"var(--archik-node-stroke)",strokeWidth:1.2}),J6r(y,p-16).map((v,_)=>(0,RG.jsx)("text",{x:c+8,y:u+8+11+_*13,fontSize:11,fill:"var(--archik-fg)",fontFamily:"inherit",children:v},_))]})}var X0=li(ec(),1);function Z6r({id:o}){return(0,X0.jsx)("marker",{id:o,viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:(0,X0.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"context-stroke"})})}function X6r({id:o}){return(0,X0.jsx)("marker",{id:o,viewBox:"0 0 12 12",refX:"11",refY:"6",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:(0,X0.jsx)("path",{d:"M 1 1 L 11 6 L 1 11",fill:"none",stroke:"context-stroke",strokeWidth:"1.5",strokeLinejoin:"round"})})}function pln({step:o,onRefClick:c}){return o.type==="message"?(0,X0.jsx)(lln,{msg:o}):o.type==="note"?(0,X0.jsx)(hln,{note:o}):o.type==="group"?(0,X0.jsx)(dln,{group:o,...c!==void 0?{onRefClick:c}:{},renderStep:u=>(0,X0.jsx)(pln,{step:u,...c!==void 0?{onRefClick:c}:{}},u.id)}):null}function gln({laid:o,svgRef:c,onRefClick:u}){let{participants:p,steps:f,activations:y,totalWidth:w,totalHeight:v}=o;return(0,X0.jsxs)("svg",{ref:c,width:w,height:v,viewBox:`0 0 ${w} ${v}`,xmlns:"http://www.w3.org/2000/svg",style:{fontFamily:"var(--archik-font, system-ui)"},children:[(0,X0.jsxs)("defs",{children:[(0,X0.jsx)(Z6r,{id:zye}),(0,X0.jsx)(X6r,{id:$ye})]}),p.map(_=>(0,X0.jsx)(aln,{participant:_},_.id)),p.map(_=>(0,X0.jsx)(cln,{participant:_,..._.kind!==void 0?{nodeKind:_.kind}:{}},_.id)),(0,X0.jsxs)("g",{transform:`translate(0, ${56})`,children:[y.map(_=>(0,X0.jsx)("rect",{x:_.cx-8/2,y:_.startY,width:8,height:_.endY-_.startY,fill:"var(--archik-node-fill)",stroke:"var(--archik-node-stroke)",strokeWidth:1,rx:2},`${_.cx}-${_.startY}`)),f.map(_=>(0,X0.jsx)(pln,{step:_,...u!==void 0?{onRefClick:u}:{}},_.id))]})]})}var HE=li(ec(),1),r0=28;function DG({kind:o,iconAt:c,labelAt:u}){let p=Vm[o],f=p.icon,y=14;return(0,HE.jsxs)(HE.Fragment,{children:[(0,HE.jsx)("g",{transform:`translate(${c.cx-y/2}, ${c.cy-y/2})`,pointerEvents:"none","aria-hidden":"true",children:(0,HE.jsx)(f,{size:y,color:p.color,strokeWidth:1.8})}),(0,HE.jsx)("text",{x:u.cx,y:u.cy,textAnchor:"middle",fontSize:9.5,fontWeight:600,letterSpacing:"0.12em",fill:"var(--archik-node-caption)",children:o.toUpperCase()})]})}var UE=li(ec(),1),K6r=24;function yln({node:o,selected:c}){let u=o.width,p=o.height,f=o.stack!==void 0,y=r0+(p-r0)/2,w=f?y-4:y+4,v=y+14,_=Math.max(0,u-K6r),T=n0(o.name,_,7.4),R=f?n0(o.stack,_,5.9):"";return(0,UE.jsxs)("g",{className:`archik-node archik-node--${o.kind}`,children:[(0,UE.jsx)("rect",{className:c?"archik-selected-glow":void 0,width:u,height:p,rx:10,ry:10,fill:"var(--archik-node-fill)",stroke:c?"var(--archik-selected)":"var(--archik-node-stroke)",strokeWidth:c?1.8:1.4}),(0,UE.jsx)("line",{x1:0,y1:r0,x2:u,y2:r0,stroke:"var(--archik-node-stroke)",strokeOpacity:.25,strokeWidth:1}),(0,UE.jsx)(DG,{kind:o.kind,iconAt:{cx:18,cy:r0/2},labelAt:{cx:u/2,cy:r0/2+3}}),(0,UE.jsx)("text",{x:u/2,y:w,textAnchor:"middle",fontSize:13,fontWeight:600,fill:"var(--archik-node-text)",children:T}),f&&(0,UE.jsx)("text",{x:u/2,y:v,textAnchor:"middle",fontSize:11,fill:"var(--archik-node-text-dim)",children:R})]})}var qE=li(ec(),1);function bln({node:o,selected:c}){let u=o.width,p=o.height,f=Math.min(p/2,28),y=o.stack!==void 0,w=r0+(p-r0)/2,v=y?w-4:w+4,_=w+14,T=Math.max(0,u-2*f-8),R=n0(o.name,T,7.4),F=y?n0(o.stack,T,5.9):"",B=c?"var(--archik-selected)":"var(--archik-node-stroke)";return(0,qE.jsxs)("g",{className:"archik-node archik-node--queue",children:[(0,qE.jsx)("rect",{className:c?"archik-selected-glow":void 0,width:u,height:p,rx:f,ry:f,fill:"var(--archik-node-fill)",stroke:B,strokeWidth:c?1.8:1.4}),(0,qE.jsx)("line",{x1:f,y1:r0,x2:u-f,y2:r0,stroke:B,strokeOpacity:.25,strokeWidth:1}),(0,qE.jsx)(DG,{kind:"queue",iconAt:{cx:f+8,cy:r0/2},labelAt:{cx:u/2,cy:r0/2+3}}),(0,qE.jsx)("text",{x:u/2,y:v,textAnchor:"middle",fontSize:13,fontWeight:600,fill:"var(--archik-node-text)",children:R}),y&&(0,qE.jsx)("text",{x:u/2,y:_,textAnchor:"middle",fontSize:11,fill:"var(--archik-node-text-dim)",children:F})]})}var GE=li(ec(),1),Y6r=24;function mln({node:o,selected:c}){let u=o.width,p=o.height,f=o.description!==void 0,y=r0,w=y+(p-y)/2,v=f?w-2:w+4,_=p-12,T=Math.max(0,u-Y6r),R=n0(o.name,T,7.4),F=f?n0(o.description,T,5.9):"",B=c?"var(--archik-selected)":"var(--archik-node-stroke-soft)";return(0,GE.jsxs)("g",{className:`archik-node archik-node--${o.kind}`,children:[(0,GE.jsx)("rect",{className:c?"archik-selected-glow":void 0,width:u,height:p,rx:8,ry:8,fill:"var(--archik-node-fill-tinted)",stroke:B,strokeWidth:c?1.8:1.2,strokeDasharray:c?void 0:"6 4"}),(0,GE.jsx)("line",{x1:6,y1:r0,x2:u-6,y2:r0,stroke:B,strokeOpacity:.25,strokeWidth:1}),(0,GE.jsx)(DG,{kind:o.kind,iconAt:{cx:18,cy:r0/2},labelAt:{cx:u/2,cy:r0/2+3}}),(0,GE.jsx)("text",{x:u/2,y:v,textAnchor:"middle",fontSize:13,fontWeight:600,fill:"var(--archik-node-text)",children:R}),f&&(0,GE.jsx)("text",{x:u/2,y:_,textAnchor:"middle",fontSize:10,fill:"var(--archik-node-text-dim)",children:F})]})}var d6=li(ec(),1),Q6r=28,g2t=10,e8r=22;function wln({node:o,selected:c}){let u=o.width,p=o.height,f=u/2,y=g2t,w=Vm[o.kind],v=w.icon,_=c?"var(--archik-selected)":"var(--archik-node-stroke)",T=c?1.8:1.4,R=o.stack!==void 0,F=Math.max(0,u-Q6r),B=n0(o.name,F,7.4),V=R?n0(o.stack,F,5.9):"",se=p,ee=se-e8r,ce=(ee+se)/2,ut=(y+8+ee)/2,Se=R?ut-4:ut+4,Be=ut+14;return(0,d6.jsxs)("g",{className:"archik-node archik-node--database",children:[(0,d6.jsx)("path",{className:c?"archik-selected-glow":void 0,d:y2t(u,p,y),fill:"var(--archik-node-fill)",stroke:_,strokeWidth:T,strokeLinejoin:"round"}),(0,d6.jsx)("ellipse",{cx:f,cy:y,rx:u/2,ry:y,fill:"var(--archik-node-fill)",stroke:_,strokeWidth:T}),(0,d6.jsx)("text",{x:f,y:Se,textAnchor:"middle",fontSize:14,fontWeight:600,fill:"var(--archik-node-text)",children:B}),R&&(0,d6.jsx)("text",{x:f,y:Be,textAnchor:"middle",fontSize:11,fill:"var(--archik-node-text-dim)",children:V}),(0,d6.jsx)("line",{x1:4,y1:ee,x2:u-4,y2:ee,stroke:_,strokeOpacity:.45,strokeWidth:1}),(0,d6.jsx)("g",{transform:`translate(14, ${ce-7})`,pointerEvents:"none","aria-hidden":"true",children:(0,d6.jsx)(v,{size:14,color:w.color,strokeWidth:1.9})}),(0,d6.jsx)("text",{x:f,y:ce+4,textAnchor:"middle",fontSize:9.5,fontWeight:600,letterSpacing:"0.12em",fill:"var(--archik-node-caption)",children:o.kind.toUpperCase()})]})}var t8r=10;function y2t(o,c,u){let p=t8r;return[`M 0 ${u}`,`L 0 ${c-p}`,`A ${p} ${p} 0 0 0 ${p} ${c}`,`L ${o-p} ${c}`,`A ${p} ${p} 0 0 0 ${o} ${c-p}`,`L ${o} ${u}`,`A ${o/2} ${u} 0 0 0 0 ${u}`,"Z"].join(" ")}var bS=li(ec(),1),n8r=36,vln=18;function kln({node:o,selected:c}){let u=o.width,p=o.height,f=Vm[o.kind],y=f.icon,w=c?"var(--archik-selected)":"var(--archik-node-stroke)",v=c?1.8:1.4,_=o.stack!==void 0,T=Math.max(0,u-n8r),R=n0(o.name,T,7.4),F=_?n0(o.stack,T,5.9):"",B=u/2,V=p*.55,se=_?V-4:V+4,ee=V+14;return(0,bS.jsxs)("g",{className:"archik-node archik-node--cloud",children:[(0,bS.jsx)("path",{className:c?"archik-selected-glow":void 0,d:r8r(u,p),fill:"var(--archik-node-fill)",stroke:w,strokeWidth:v,strokeLinejoin:"round"}),(0,bS.jsx)("g",{transform:`translate(18, ${vln-6})`,pointerEvents:"none","aria-hidden":"true",children:(0,bS.jsx)(y,{size:14,color:f.color,strokeWidth:1.9})}),(0,bS.jsx)("text",{x:B,y:vln+4,textAnchor:"middle",fontSize:9.5,fontWeight:600,letterSpacing:"0.12em",fill:"var(--archik-node-caption)",children:o.kind.toUpperCase()}),(0,bS.jsx)("text",{x:B,y:se,textAnchor:"middle",fontSize:13,fontWeight:600,fill:"var(--archik-node-text)",children:R}),_&&(0,bS.jsx)("text",{x:B,y:ee,textAnchor:"middle",fontSize:11,fill:"var(--archik-node-text-dim)",children:F})]})}function r8r(o,c){let p=c-2,f=c*.62,y=Math.min(c*.18,14),w=o-4,v=c*.5,_=Math.min(w*.15,v*.85),T=Math.min(w*.18,v),R=Math.min(w*.15,v*.85),F=2*(_+T+R),B=Math.max(0,w-F)/4,V=2,se=o-2,ee=V+B,ce=ee+2*_,ge=ce+B,Oe=ge+2*T,ut=Oe+B,Se=ut+2*R;return[`M ${V} ${p-y}`,`Q ${V} ${p} ${V+y} ${p}`,`L ${se-y} ${p}`,`Q ${se} ${p} ${se} ${p-y}`,`L ${se} ${f}`,`L ${Se} ${f}`,`A ${R} ${R} 0 0 0 ${ut} ${f}`,`L ${Oe} ${f}`,`A ${T} ${T} 0 0 0 ${ge} ${f}`,`L ${ce} ${f}`,`A ${_} ${_} 0 0 0 ${ee} ${f}`,`L ${V} ${f}`,"Z"].join(" ")}var hb=li(ec(),1),OG=32,KOe=14,b2t=14;function Mln({node:o,selected:c,depth:u=0}){let p=o.width,f=o.height;if(!(o.children.length>0))return(0,hb.jsx)(o8r,{node:o,selected:!!c});let w=Vm[o.kind],v=w.icon,_=Math.min(.04+u*.06,.22),T=Math.min(.55+u*.12,.95),R=c?"var(--archik-selected)":"var(--archik-container-border)",F=c?1.8:1.2,B=Math.max(0,p-KOe*2-60),V=n0(o.name,B,7.4);return(0,hb.jsxs)("g",{className:`archik-node archik-node--${o.kind} archik-node--container`,children:[(0,hb.jsx)("rect",{className:c?"archik-selected-glow":void 0,width:p,height:f,rx:8,ry:8,fill:w.color,fillOpacity:_,stroke:R,strokeWidth:F,pointerEvents:"none"}),u>=1&&p>8&&f>8&&(0,hb.jsx)("rect",{x:3,y:3,width:p-6,height:f-6,rx:6,ry:6,fill:"none",stroke:w.color,strokeOpacity:Math.min(.18+(u-1)*.06,.32),strokeWidth:1,pointerEvents:"none"}),(0,hb.jsx)("path",{d:i8r(p,OG,8),fill:w.color,fillOpacity:T*.18}),(0,hb.jsx)("line",{x1:0,y1:OG,x2:p,y2:OG,stroke:R,strokeOpacity:.45,strokeWidth:1}),(0,hb.jsx)("g",{transform:`translate(${KOe}, ${OG/2-b2t/2})`,pointerEvents:"none","aria-hidden":"true",children:(0,hb.jsx)(v,{size:b2t,color:w.color,strokeWidth:1.9})}),(0,hb.jsx)("text",{x:KOe+b2t+8,y:OG/2+4,fontSize:13,fontWeight:600,fill:"var(--archik-node-text)",children:V}),(0,hb.jsx)("text",{x:p-KOe,y:OG/2+3,textAnchor:"end",fontSize:9.5,fontWeight:600,letterSpacing:"0.12em",fill:"var(--archik-node-caption)",children:o.kind.toUpperCase()})]})}function i8r(o,c,u){return`M ${u} 0 H ${o-u} A ${u} ${u} 0 0 1 ${o} ${u} V ${c} H 0 V ${u} A ${u} ${u} 0 0 1 ${u} 0 Z`}function o8r({node:o,selected:c}){let u=o.width,p=o.height,f=Vm[o.kind],y=c?"var(--archik-selected)":"var(--archik-node-stroke-soft)";return(0,hb.jsxs)("g",{className:`archik-node archik-node--${o.kind}`,children:[(0,hb.jsx)("rect",{className:c?"archik-selected-glow":void 0,width:u,height:p,rx:8,ry:8,fill:"var(--archik-node-fill-tinted)",stroke:y,strokeWidth:c?1.8:1.2,strokeDasharray:c?void 0:"5 4"}),(0,hb.jsx)("text",{x:u/2,y:p/2+4,textAnchor:"middle",fontSize:12,fontWeight:600,fill:f.color,children:o.name})]})}var fb=li(ec(),1),une=24,xln=10,m2t=28;function Sln({node:o,selected:c,depth:u=0}){let p=o.width,f=o.height,y=Vm[o.kind],w=y.icon,v=o.kind==="external";if(o.children.length>0)return(0,fb.jsx)(c8r,{node:o,selected:!!c,depth:u});let _=c?"var(--archik-selected)":v?"var(--archik-node-stroke-soft)":"var(--archik-node-stroke)",T=v?"var(--archik-node-fill-tinted)":"var(--archik-node-fill)",R=o.kind==="queue"?Math.min(f/2,18):8;return(0,fb.jsxs)("g",{className:`archik-node archik-node--${o.kind} archik-node--compact`,children:[(0,fb.jsx)("rect",{className:c?"archik-selected-glow":void 0,width:p,height:f,rx:R,ry:R,fill:T,stroke:_,strokeWidth:c?1.8:1.4,strokeDasharray:v&&!c?"5 4":void 0}),(0,fb.jsx)("g",{transform:`translate(${xln}, ${f/2-7})`,pointerEvents:"none","aria-hidden":"true",children:(0,fb.jsx)(w,{size:13,color:y.color,strokeWidth:1.9})}),(0,fb.jsx)("text",{x:m2t,y:f/2+4,fontSize:12,fontWeight:600,fill:"var(--archik-node-text)",children:n0(o.name,Math.max(0,p-m2t-8),5.9)})]})}function c8r({node:o,selected:c,depth:u}){let p=o.width,f=o.height,y=Vm[o.kind],w=y.icon,v=Math.min(.04+u*.035,.14),_=Math.min(.55+u*.08,.85),T=c?"var(--archik-selected)":"var(--archik-container-border)",R=Math.max(0,p-12-22),F=n0(o.name,R,5.9);return(0,fb.jsxs)("g",{className:`archik-node archik-node--${o.kind} archik-node--compact archik-node--container`,children:[(0,fb.jsx)("rect",{className:c?"archik-selected-glow":void 0,width:p,height:f,rx:6,ry:6,fill:y.color,fillOpacity:v,stroke:T,strokeWidth:c?1.8:1.2}),(0,fb.jsx)("path",{d:a8r(p,une,6),fill:y.color,fillOpacity:_*.18}),(0,fb.jsx)("line",{x1:0,y1:une,x2:p,y2:une,stroke:T,strokeOpacity:.45,strokeWidth:1}),(0,fb.jsx)("g",{transform:`translate(${xln}, ${une/2-6})`,pointerEvents:"none","aria-hidden":"true",children:(0,fb.jsx)(w,{size:12,color:y.color,strokeWidth:1.9})}),(0,fb.jsx)("text",{x:m2t,y:une/2+4,fontSize:12,fontWeight:600,fill:"var(--archik-node-text)",children:F})]})}function a8r(o,c,u){return`M ${u} 0 H ${o-u} A ${u} ${u} 0 0 1 ${o} ${u} V ${c} H 0 V ${u} A ${u} ${u} 0 0 1 ${u} 0 Z`}var Q9=li(u2t(),1),Cd=li(ec(),1),s8r=12,l8r=18;function _ln({Icon:o,cx:c,cy:u,size:p=s8r,color:f,strokeWidth:y=1.8}){return(0,Cd.jsx)("g",{transform:`translate(${c-p/2}, ${u-p/2})`,pointerEvents:"none","aria-hidden":"true",children:(0,Cd.jsx)(o,{size:p,color:f??"var(--archik-fg-dim)",strokeWidth:y})})}function Cln(o){return(0,Cd.jsx)(_ln,{Icon:Q9.Info,...o})}function Iln(o){return(0,Cd.jsx)(_ln,{Icon:Q9.StickyNote,...o})}function Eln({cx:o,cy:c,filePath:u,fileLabel:p,onClick:f,size:y=13}){return(0,Cd.jsxs)("g",{transform:`translate(${o-y/2}, ${c-y/2})`,style:{cursor:f?"pointer":"default"},onClick:f,children:[(0,Cd.jsx)("title",{children:`Cross-file edge \u2192 ${p} (${u})`}),(0,Cd.jsx)("circle",{cx:y/2,cy:y/2,r:y/2+.5,fill:"var(--archik-fg-dim)",fillOpacity:.12,stroke:"var(--archik-fg-dim)",strokeOpacity:.4,strokeWidth:1}),(0,Cd.jsx)("g",{transform:"translate(1, 1)",pointerEvents:"none",children:(0,Cd.jsx)(Q9.ArrowUpRight,{size:y-2,color:"var(--archik-fg-muted)",strokeWidth:2.2})})]})}function Pln({cx:o,cy:c,onClick:u,size:p=14}){return(0,Cd.jsxs)("g",{transform:`translate(${o-p/2}, ${c-p/2})`,style:{cursor:u?"pointer":"default"},onClick:u,children:[(0,Cd.jsx)("title",{children:"Open sub-architecture"}),(0,Cd.jsx)("circle",{cx:p/2,cy:p/2,r:p/2+.5,fill:"var(--archik-accent)",fillOpacity:.16,stroke:"var(--archik-accent)",strokeOpacity:.45,strokeWidth:1}),(0,Cd.jsx)("g",{transform:"translate(1, 1)",pointerEvents:"none",children:(0,Cd.jsx)(Q9.ChevronDown,{size:p-2,color:"var(--archik-accent)",strokeWidth:2.2})})]})}function Lln({cx:o,cy:c,files:u,count:p,size:f=14}){let y=u.length===1?`Open sequence diagram \u2192 ${u[0].label} (${u[0].path})`:`${u.length} sequence diagrams on this node:
519
519
  `+u.map(w=>` \u2022 ${w.label}`).join(`
520
520
  `)+`
521
- Click to open the first; the rest live in the inspector.`;return(0,Cd.jsxs)("g",{transform:`translate(${o-f/2}, ${c-f/2})`,style:{cursor:"pointer"},children:[(0,Cd.jsx)("title",{children:y}),(0,Cd.jsx)("circle",{cx:f/2,cy:f/2,r:f/2+.5,fill:"var(--archik-status-proposed)",fillOpacity:.16,stroke:"var(--archik-status-proposed)",strokeOpacity:.5,strokeWidth:1}),(0,Cd.jsx)("g",{transform:"translate(1, 1)",pointerEvents:"none",children:(0,Cd.jsx)(Q9.GitBranch,{size:f-2,color:"var(--archik-status-proposed)",strokeWidth:2.2})}),p!==void 0&&p>1&&(0,Cd.jsxs)("g",{pointerEvents:"none",children:[(0,Cd.jsx)("circle",{cx:f/2,cy:-3,r:5.5,fill:"var(--archik-canvas)"}),(0,Cd.jsx)("circle",{cx:f/2,cy:-3,r:4.5,fill:"var(--archik-status-proposed)"}),(0,Cd.jsx)("text",{x:f/2,y:-.5,fontSize:7.5,fontWeight:700,fill:"#ffffff",textAnchor:"middle",children:p})]})]})}function Tln(o,c,u,p=!1){if(p)return{right:{x:c-14,y:42}};switch(o){case"queue":{let y=Math.min(u/2,28);return{right:{x:c-y-4,y:14}}}case"database":return{right:{x:c-14,y:u-11}};case"module":case"custom":return{right:{x:c-14,y:42}};default:return{right:{x:c-14,y:14}}}}function Aln(o,c){return Array.from({length:c},(u,p)=>({x:o.x-p*l8r,y:o.y}))}var hl=li(ec(),1);function u8r({node:o,selected:c,viewMode:u,depth:p}){if(u==="compact")return(0,hl.jsx)(Sln,{node:o,selected:c,depth:p});if(o.children.length>0)return(0,hl.jsx)(Mln,{node:o,selected:c,depth:p});switch(o.kind){case"queue":return(0,hl.jsx)(bln,{node:o,selected:c});case"external":case"human":return(0,hl.jsx)(mln,{node:o,selected:c});case"database":return(0,hl.jsx)(wln,{node:o,selected:c});case"cloud":return(0,hl.jsx)(kln,{node:o,selected:c});case"module":case"custom":case"service":case"function":case"worker":case"agent":case"cache":case"vectordb":case"storage":case"model":case"dto":case"dataobject":case"topic":case"stream":case"gateway":case"cdn":case"route":case"interface":case"adapter":case"port":case"llm":case"prompt":case"tool":case"auth":case"observability":case"frontend":case"page":case"component":case"store":case"hook":return(0,hl.jsx)(yln,{node:o,selected:c});default:{let f=o.kind;throw new Error("unreachable node kind")}}}function w2t({node:o,selectedNodeIds:c,glowNodeIds:u,onSelectNode:p,onOpenSubFile:f,onCrossFileNavigate:y,crossFileByNode:w,viewMode:v="detailed",depth:_=0,showStereotypeBands:T=!0}){let R=c?.has(o.id)??!1,F=u?.has(o.id)??!1,B=o.children.length>0,V=B?_+1:_,se=p?ce=>{ce.stopPropagation(),p(o.id,ce)}:void 0,ee=o.description!==void 0&&o.description.length>0;return(0,hl.jsxs)("g",{"data-archik-node-id":o.id,...R?{"data-archik-selected":"true"}:{},...o.status!==void 0&&o.status!=="active"?{"data-archik-status":o.status}:{},...o.stereotype!==void 0?{"data-archik-stereotype":o.stereotype}:{},transform:`translate(${o.x}, ${o.y})`,...se!==void 0?{onClick:se}:{},style:p?{cursor:"pointer"}:void 0,children:[F&&(0,hl.jsx)("rect",{x:-4,y:-4,width:o.width+8,height:o.height+8,rx:10,fill:"none",stroke:"var(--archik-status-proposed)",strokeWidth:2,opacity:.85,style:{pointerEvents:"none"}}),(0,hl.jsx)(u8r,{node:o,selected:R,viewMode:v,depth:_}),o.stereotype!==void 0&&T&&(0,hl.jsxs)(hl.Fragment,{children:[(0,hl.jsx)("clipPath",{id:`archik-nclip-${o.id}`,children:o.kind==="database"?(0,hl.jsx)("path",{d:y2t(o.width,o.height,g2t)}):(0,hl.jsx)("rect",{width:o.width,height:o.height,rx:8,ry:8})}),(0,hl.jsx)("rect",{className:"archik-stereotype-band",x:0,y:0,width:o.width,height:4,clipPath:`url(#archik-nclip-${o.id})`,style:{pointerEvents:"none"}})]}),v==="detailed"&&(()=>{let ce=o.notes!==void 0&&o.notes.length>0,ge=o.archikFile!==void 0&&o.archikFile.length>0,Oe=w?.get(o.id),ut=Oe?Array.from(Oe).sort():[],Se=o.seqFiles??[],Be=[];ge&&Be.push("subarch"),Se.length>0&&Be.push({type:"seq",paths:Se});for(let Gt of ut)Be.push({type:"crossfile",path:Gt});if(ee&&Be.push("info"),ce&&Be.push("notes"),Be.length===0)return null;let Ue=Tln(o.kind,o.width,o.height,B),on=Aln(Ue.right,Be.length);return(0,hl.jsx)(hl.Fragment,{children:Be.map((Gt,xn)=>{let Vn=on[xn];if(typeof Gt=="object"&&Gt.type==="seq"){let tn=Gt.paths.map(Nr=>({path:Nr,label:Nr.split("/").pop().replace(/\.archik\.seq\.yaml$/,"")})),cn=`/__archik/seq?path=${encodeURIComponent(tn[0].path)}`;return(0,hl.jsx)("a",{href:cn,onClick:Nr=>Nr.stopPropagation(),children:(0,hl.jsx)(Lln,{cx:Vn.x,cy:Vn.y,files:tn,count:tn.length})},"seq")}if(typeof Gt=="object"&&Gt.type==="crossfile"){let tn=Gt.path,cn=tn.split("/").pop().replace(/\.archik\.yaml$/,""),Nr=y??f,oi=Nr?wo=>{wo.stopPropagation(),Nr(tn,cn)}:void 0;return(0,hl.jsx)(Eln,{cx:Vn.x,cy:Vn.y,filePath:tn,fileLabel:cn,...oi?{onClick:oi}:{}},`xf-${tn}`)}if(Gt==="subarch"){let tn=o.archikFile,cn=f?Nr=>{Nr.stopPropagation(),f(tn,o.name)}:void 0;return(0,hl.jsx)(Pln,{cx:Vn.x,cy:Vn.y,...cn?{onClick:cn}:{}},"subarch")}return Gt==="info"?(0,hl.jsx)(Cln,{cx:Vn.x,cy:Vn.y,color:"var(--archik-node-caption)"},"info"):(0,hl.jsxs)("g",{children:[(0,hl.jsx)(Iln,{cx:Vn.x,cy:Vn.y,color:"var(--archik-node-caption)"}),o.notes&&o.notes.length>1&&(0,hl.jsx)("text",{x:Vn.x+7,y:Vn.y-5,fontSize:8,fontWeight:700,fill:"var(--archik-accent)",textAnchor:"middle",pointerEvents:"none",children:o.notes.length})]},"notes")})})})(),o.children.map(ce=>(0,hl.jsx)(w2t,{node:ce,viewMode:v,depth:V,showStereotypeBands:T,...c!==void 0?{selectedNodeIds:c}:{},...u!==void 0?{glowNodeIds:u}:{},...p!==void 0?{onSelectNode:p}:{},...f!==void 0?{onOpenSubFile:f}:{},...y!==void 0?{onCrossFileNavigate:y}:{},...w!==void 0?{crossFileByNode:w}:{}},ce.id))]})}var h6=li(ec(),1),Wm="archik-arrow-filled",Yz="archik-arrow-open",YOe="archik-arrow-selected",dne="archik-arrow-triangle",QOe="archik-arrow-diamond";function Nln({id:o}){return(0,h6.jsx)("marker",{id:o,viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:(0,h6.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"context-stroke"})})}function Rln({id:o}){return(0,h6.jsx)("marker",{id:o,viewBox:"0 0 12 12",refX:"11",refY:"6",markerWidth:"7",markerHeight:"7",orient:"auto-start-reverse",children:(0,h6.jsx)("path",{d:"M 1 1 L 11 6 L 1 11",fill:"none",stroke:"context-stroke",strokeWidth:"1.5",strokeLinejoin:"round",strokeLinecap:"round"})})}function Dln({id:o}){return(0,h6.jsx)("marker",{id:o,viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"6",markerHeight:"6",orient:"auto-start-reverse",children:(0,h6.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--archik-selected)"})})}function Oln({id:o}){return(0,h6.jsx)("marker",{id:o,viewBox:"0 0 14 14",refX:"13",refY:"7",markerWidth:"9",markerHeight:"9",orient:"auto-start-reverse",children:(0,h6.jsx)("path",{d:"M 1 1 L 13 7 L 1 13 z",fill:"var(--archik-panel)",stroke:"context-stroke",strokeWidth:"1.5",strokeLinejoin:"round"})})}function Fln({id:o}){return(0,h6.jsx)("marker",{id:o,viewBox:"0 0 14 10",refX:"1",refY:"5",markerWidth:"9",markerHeight:"7",orient:"auto",children:(0,h6.jsx)("path",{d:"M 1 5 L 7 1 L 13 5 L 7 9 z",fill:"context-stroke"})})}var Qz=li(ec(),1),f6="var(--archik-edge-filled)",hne="var(--archik-edge-dim)",d8r={http_call:{stroke:f6,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Wm},grpc:{stroke:f6,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Wm},invokes:{stroke:f6,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Wm},routes_to:{stroke:f6,strokeWidth:1.4,markerId:Wm},websocket:{stroke:f6,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Wm,markerStartId:Wm},webhook:{stroke:f6,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Wm},reads:{stroke:f6,strokeWidth:1.4,markerId:Yz},writes:{stroke:f6,strokeWidth:1.4,markerId:Wm},publishes:{stroke:f6,strokeWidth:1.4,markerId:Wm},subscribes:{stroke:f6,strokeWidth:1.4,markerId:Wm},streams_to:{stroke:f6,strokeWidth:1.4,markerId:Wm},implements:{stroke:hne,strokeWidth:1.2,strokeDasharray:"7 5",markerId:dne},extends:{stroke:hne,strokeWidth:1.2,markerId:dne},depends_on:{stroke:hne,strokeWidth:1.2,strokeDasharray:"7 5",markerId:Yz},has_a:{stroke:hne,strokeWidth:1.2,markerId:Yz,markerStartId:QOe},uses:{stroke:hne,strokeWidth:1.2,markerId:Yz}};function zln(o){return o.map(c=>`${c.x},${c.y}`).join(" ")}function h8r(o){if(o.length===0)return;let c=Math.floor(o.length/2);if(o.length%2===1)return o[c];let u=o[c-1],p=o[c];return{x:(u.x+p.x)/2,y:(u.y+p.y)/2}}function $ln({edge:o,selectedEdgeIds:c,onSelectEdge:u}){let p=o.sections[0];if(!p)return null;let f=[p.startPoint,...p.bendPoints,p.endPoint],y=d8r[o.relationship],w=o.labels[0],v=w?{x:w.x+w.width/2,y:w.y+w.height/2}:h8r(f),_=c?.has(o.id)??!1,T=o.status==="proposed"?"var(--archik-status-proposed)":o.status==="deprecated"?"var(--archik-status-deprecated)":void 0,R=_?"var(--archik-selected)":T??o.color??y.stroke,F=_?y.strokeWidth+.5:y.strokeWidth,B=_?YOe:y.markerId,V=!_&&y.markerStartId!==void 0?y.markerStartId:void 0,se=!_&&y.animated?"archik-edge-flowing":void 0,ee=y.strokeDasharray!==void 0?y.strokeDasharray.trim().split(/\s+/).reduce((Oe,ut)=>Oe+Number(ut),0):0,ce=se!==void 0&&ee>0?{"--archik-dash-period":String(ee)}:void 0,ge=u?Oe=>{Oe.stopPropagation(),u(o.id,Oe)}:void 0;return(0,Qz.jsxs)("g",{"data-archik-edge-id":o.id,"data-archik-edge-relationship":o.relationship,..._?{"data-archik-selected":"true"}:{},...o.status!==void 0&&o.status!=="active"?{"data-archik-status":o.status}:{},className:`archik-edge archik-edge--${o.relationship}`,...ge!==void 0?{onClick:ge}:{},style:u?{cursor:"pointer"}:void 0,children:[u&&(0,Qz.jsx)("polyline",{"data-archik-edge-hitarea":"",points:zln(f),fill:"none",stroke:"transparent",strokeWidth:14,strokeLinecap:"round",strokeLinejoin:"round"}),(0,Qz.jsx)("polyline",{className:se,points:zln(f),fill:"none",stroke:R,strokeWidth:F,strokeLinecap:"round",strokeLinejoin:"round",markerEnd:`url(#${B})`,...V!==void 0?{markerStart:`url(#${V})`}:{},...y.strokeDasharray!==void 0?{strokeDasharray:y.strokeDasharray}:{},...ce!==void 0?{style:ce}:{}}),o.label!==void 0&&v!==void 0&&(0,Qz.jsx)("g",{transform:`translate(${v.x}, ${w?v.y+4:v.y-6})`,children:(0,Qz.jsx)("text",{textAnchor:"middle",fontSize:11,fontWeight:_?700:500,fill:_?"var(--archik-selected)":"var(--archik-fg-dim)",stroke:"var(--archik-panel)",strokeWidth:_?4:3,paintOrder:"stroke",children:o.label})})]})}var pb=li(ec(),1);var v2t={added:"var(--archik-success)",removed:"var(--archik-danger)",changed:"var(--archik-warning)"};function f8r(o){let c=[],u=(p,f,y)=>{for(let w of p){let v=f+w.x,_=y+w.y;c.push({...w,absX:v,absY:_}),w.children.length>0&&u(w.children,v,_)}};return u(o,0,0),c}function p8r(o){return o.replace(/[^a-z0-9-]/g,c=>`\\${c}`)}function Hln({statuses:o,scopeClass:c}){let u=[];for(let[f,y]of o.nodes)y==="removed"&&u.push(f);if(u.length===0)return null;let p=u.map(f=>`.${c} [data-archik-node-id="${p8r(f)}"] { opacity: 0.35; }`).join(`
521
+ Click to open the first; the rest live in the inspector.`;return(0,Cd.jsxs)("g",{transform:`translate(${o-f/2}, ${c-f/2})`,style:{cursor:"pointer"},children:[(0,Cd.jsx)("title",{children:y}),(0,Cd.jsx)("circle",{cx:f/2,cy:f/2,r:f/2+.5,fill:"var(--archik-status-proposed)",fillOpacity:.16,stroke:"var(--archik-status-proposed)",strokeOpacity:.5,strokeWidth:1}),(0,Cd.jsx)("g",{transform:"translate(1, 1)",pointerEvents:"none",children:(0,Cd.jsx)(Q9.GitBranch,{size:f-2,color:"var(--archik-status-proposed)",strokeWidth:2.2})}),p!==void 0&&p>1&&(0,Cd.jsxs)("g",{pointerEvents:"none",children:[(0,Cd.jsx)("circle",{cx:f/2,cy:-3,r:5.5,fill:"var(--archik-canvas)"}),(0,Cd.jsx)("circle",{cx:f/2,cy:-3,r:4.5,fill:"var(--archik-status-proposed)"}),(0,Cd.jsx)("text",{x:f/2,y:-.5,fontSize:7.5,fontWeight:700,fill:"#ffffff",textAnchor:"middle",children:p})]})]})}function Tln(o,c,u,p=!1){if(p)return{right:{x:c-14,y:42}};switch(o){case"queue":{let y=Math.min(u/2,28);return{right:{x:c-y-4,y:14}}}case"database":return{right:{x:c-14,y:u-11}};case"module":case"custom":return{right:{x:c-14,y:42}};default:return{right:{x:c-14,y:14}}}}function Aln(o,c){return Array.from({length:c},(u,p)=>({x:o.x-p*l8r,y:o.y}))}var hl=li(ec(),1);function u8r({node:o,selected:c,viewMode:u,depth:p}){if(u==="compact")return(0,hl.jsx)(Sln,{node:o,selected:c,depth:p});if(o.children.length>0)return(0,hl.jsx)(Mln,{node:o,selected:c,depth:p});switch(o.kind){case"queue":return(0,hl.jsx)(bln,{node:o,selected:c});case"external":case"human":return(0,hl.jsx)(mln,{node:o,selected:c});case"database":return(0,hl.jsx)(wln,{node:o,selected:c});case"cloud":return(0,hl.jsx)(kln,{node:o,selected:c});case"module":case"custom":case"service":case"function":case"worker":case"agent":case"cache":case"vectordb":case"storage":case"model":case"dto":case"dataobject":case"topic":case"stream":case"gateway":case"cdn":case"route":case"interface":case"adapter":case"port":case"llm":case"prompt":case"tool":case"auth":case"observability":case"frontend":case"page":case"component":case"store":case"hook":return(0,hl.jsx)(yln,{node:o,selected:c});default:{let f=o.kind;throw new Error("unreachable node kind")}}}function w2t({node:o,selectedNodeIds:c,glowNodeIds:u,onSelectNode:p,onOpenSubFile:f,onCrossFileNavigate:y,crossFileByNode:w,viewMode:v="detailed",depth:_=0,showStereotypeBands:T=!0}){let R=c?.has(o.id)??!1,F=u?.has(o.id)??!1,B=o.children.length>0,V=B?_+1:_,se=p?ce=>{ce.stopPropagation(),p(o.id,ce)}:void 0,ee=o.description!==void 0&&o.description.length>0;return(0,hl.jsxs)("g",{"data-archik-node-id":o.id,...R?{"data-archik-selected":"true"}:{},...o.status!==void 0&&o.status!=="active"?{"data-archik-status":o.status}:{},...o.stereotype!==void 0?{"data-archik-stereotype":o.stereotype}:{},transform:`translate(${o.x}, ${o.y})`,...se!==void 0?{onClick:se}:{},style:p?{cursor:"pointer"}:void 0,children:[F&&(0,hl.jsx)("rect",{x:-4,y:-4,width:o.width+8,height:o.height+8,rx:10,fill:"none",stroke:"var(--archik-status-proposed)",strokeWidth:2,opacity:.85,style:{pointerEvents:"none"}}),(0,hl.jsx)(u8r,{node:o,selected:R,viewMode:v,depth:_}),o.stereotype!==void 0&&T&&(0,hl.jsxs)(hl.Fragment,{children:[(0,hl.jsx)("clipPath",{id:`archik-nclip-${o.id}`,children:o.kind==="database"?(0,hl.jsx)("path",{d:y2t(o.width,o.height,g2t)}):(0,hl.jsx)("rect",{width:o.width,height:o.height,rx:8,ry:8})}),(0,hl.jsx)("rect",{className:"archik-stereotype-band",x:0,y:0,width:o.width,height:4,clipPath:`url(#archik-nclip-${o.id})`,style:{pointerEvents:"none"}})]}),v==="detailed"&&(()=>{let ce=o.notes!==void 0&&o.notes.length>0,ge=o.archikFile!==void 0&&o.archikFile.length>0,Oe=w?.get(o.id),ut=Oe?Array.from(Oe).sort():[],Se=o.seqFiles??[],Be=[];ge&&Be.push("subarch"),Se.length>0&&Be.push({type:"seq",paths:Se});for(let Gt of ut)Be.push({type:"crossfile",path:Gt});if(ee&&Be.push("info"),ce&&Be.push("notes"),Be.length===0)return null;let Ue=Tln(o.kind,o.width,o.height,B),on=Aln(Ue.right,Be.length);return(0,hl.jsx)(hl.Fragment,{children:Be.map((Gt,xn)=>{let Vn=on[xn];if(typeof Gt=="object"&&Gt.type==="seq"){let tn=Gt.paths.map(Nr=>({path:Nr,label:Nr.split("/").pop().replace(/\.archik\.seq\.yaml$/,"")})),cn=`/__archik/seq?path=${encodeURIComponent(tn[0].path)}`;return(0,hl.jsx)("a",{href:cn,onClick:Nr=>Nr.stopPropagation(),children:(0,hl.jsx)(Lln,{cx:Vn.x,cy:Vn.y,files:tn,count:tn.length})},"seq")}if(typeof Gt=="object"&&Gt.type==="crossfile"){let tn=Gt.path,cn=tn.split("/").pop().replace(/\.archik\.yaml$/,""),Nr=y??f,oi=Nr?wo=>{wo.stopPropagation(),Nr(tn,cn)}:void 0;return(0,hl.jsx)(Eln,{cx:Vn.x,cy:Vn.y,filePath:tn,fileLabel:cn,...oi?{onClick:oi}:{}},`xf-${tn}`)}if(Gt==="subarch"){let tn=o.archikFile,cn=f?Nr=>{Nr.stopPropagation(),f(tn,o.name)}:void 0;return(0,hl.jsx)(Pln,{cx:Vn.x,cy:Vn.y,...cn?{onClick:cn}:{}},"subarch")}return Gt==="info"?(0,hl.jsx)(Cln,{cx:Vn.x,cy:Vn.y,color:"var(--archik-node-caption)"},"info"):(0,hl.jsxs)("g",{children:[(0,hl.jsx)(Iln,{cx:Vn.x,cy:Vn.y,color:"var(--archik-node-caption)"}),o.notes&&o.notes.length>1&&(0,hl.jsx)("text",{x:Vn.x+7,y:Vn.y-5,fontSize:8,fontWeight:700,fill:"var(--archik-accent)",textAnchor:"middle",pointerEvents:"none",children:o.notes.length})]},"notes")})})})(),o.children.map(ce=>(0,hl.jsx)(w2t,{node:ce,viewMode:v,depth:V,showStereotypeBands:T,...c!==void 0?{selectedNodeIds:c}:{},...u!==void 0?{glowNodeIds:u}:{},...p!==void 0?{onSelectNode:p}:{},...f!==void 0?{onOpenSubFile:f}:{},...y!==void 0?{onCrossFileNavigate:y}:{},...w!==void 0?{crossFileByNode:w}:{}},ce.id))]})}var h6=li(ec(),1),Wm="archik-arrow-filled",Yz="archik-arrow-open",YOe="archik-arrow-selected",dne="archik-arrow-triangle",QOe="archik-arrow-diamond";function Nln({id:o}){return(0,h6.jsx)("marker",{id:o,viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:(0,h6.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"context-stroke"})})}function Rln({id:o}){return(0,h6.jsx)("marker",{id:o,viewBox:"0 0 12 12",refX:"11",refY:"6",markerWidth:"9",markerHeight:"9",orient:"auto-start-reverse",children:(0,h6.jsx)("path",{d:"M 1 1 L 11 6 L 1 11",fill:"none",stroke:"context-stroke",strokeWidth:"1.8",strokeLinejoin:"round",strokeLinecap:"round"})})}function Dln({id:o}){return(0,h6.jsx)("marker",{id:o,viewBox:"0 0 10 10",refX:"10",refY:"5",markerWidth:"8",markerHeight:"8",orient:"auto-start-reverse",children:(0,h6.jsx)("path",{d:"M 0 0 L 10 5 L 0 10 z",fill:"var(--archik-selected)"})})}function Oln({id:o}){return(0,h6.jsx)("marker",{id:o,viewBox:"0 0 14 14",refX:"13",refY:"7",markerWidth:"12",markerHeight:"12",orient:"auto-start-reverse",children:(0,h6.jsx)("path",{d:"M 1 1 L 13 7 L 1 13 z",fill:"var(--archik-panel)",stroke:"context-stroke",strokeWidth:"2",strokeLinejoin:"round"})})}function Fln({id:o}){return(0,h6.jsx)("marker",{id:o,viewBox:"0 0 14 10",refX:"1",refY:"5",markerWidth:"12",markerHeight:"9",orient:"auto",children:(0,h6.jsx)("path",{d:"M 1 5 L 7 1 L 13 5 L 7 9 z",fill:"context-stroke"})})}var Qz=li(ec(),1),f6="var(--archik-edge-filled)",hne="var(--archik-edge-dim)",d8r={http_call:{stroke:f6,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Wm},grpc:{stroke:f6,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Wm},invokes:{stroke:f6,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Wm},routes_to:{stroke:f6,strokeWidth:1.4,markerId:Wm},websocket:{stroke:f6,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Wm,markerStartId:Wm},webhook:{stroke:f6,strokeWidth:1.4,strokeDasharray:"2 6",animated:!0,markerId:Wm},reads:{stroke:f6,strokeWidth:1.4,markerId:Yz},writes:{stroke:f6,strokeWidth:1.4,markerId:Wm},publishes:{stroke:f6,strokeWidth:1.4,markerId:Wm},subscribes:{stroke:f6,strokeWidth:1.4,markerId:Wm},streams_to:{stroke:f6,strokeWidth:1.4,markerId:Wm},implements:{stroke:hne,strokeWidth:1.2,strokeDasharray:"7 5",markerId:dne},extends:{stroke:hne,strokeWidth:1.2,markerId:dne},depends_on:{stroke:hne,strokeWidth:1.2,strokeDasharray:"7 5",markerId:Yz},has_a:{stroke:hne,strokeWidth:1.2,markerId:Yz,markerStartId:QOe},uses:{stroke:hne,strokeWidth:1.2,markerId:Yz}};function zln(o){return o.map(c=>`${c.x},${c.y}`).join(" ")}function h8r(o){if(o.length===0)return;let c=Math.floor(o.length/2);if(o.length%2===1)return o[c];let u=o[c-1],p=o[c];return{x:(u.x+p.x)/2,y:(u.y+p.y)/2}}function $ln({edge:o,selectedEdgeIds:c,onSelectEdge:u}){let p=o.sections[0];if(!p)return null;let f=[p.startPoint,...p.bendPoints,p.endPoint],y=d8r[o.relationship],w=o.labels[0],v=w?{x:w.x+w.width/2,y:w.y+w.height/2}:h8r(f),_=c?.has(o.id)??!1,T=o.status==="proposed"?"var(--archik-status-proposed)":o.status==="deprecated"?"var(--archik-status-deprecated)":void 0,R=_?"var(--archik-selected)":T??o.color??y.stroke,F=_?y.strokeWidth+.5:y.strokeWidth,B=_?YOe:y.markerId,V=!_&&y.markerStartId!==void 0?y.markerStartId:void 0,se=!_&&y.animated?"archik-edge-flowing":void 0,ee=y.strokeDasharray!==void 0?y.strokeDasharray.trim().split(/\s+/).reduce((Oe,ut)=>Oe+Number(ut),0):0,ce=se!==void 0&&ee>0?{"--archik-dash-period":String(ee)}:void 0,ge=u?Oe=>{Oe.stopPropagation(),u(o.id,Oe)}:void 0;return(0,Qz.jsxs)("g",{"data-archik-edge-id":o.id,"data-archik-edge-relationship":o.relationship,..._?{"data-archik-selected":"true"}:{},...o.status!==void 0&&o.status!=="active"?{"data-archik-status":o.status}:{},className:`archik-edge archik-edge--${o.relationship}`,...ge!==void 0?{onClick:ge}:{},style:u?{cursor:"pointer"}:void 0,children:[u&&(0,Qz.jsx)("polyline",{"data-archik-edge-hitarea":"",points:zln(f),fill:"none",stroke:"transparent",strokeWidth:14,strokeLinecap:"round",strokeLinejoin:"round"}),(0,Qz.jsx)("polyline",{className:se,points:zln(f),fill:"none",stroke:R,strokeWidth:F,strokeLinecap:"round",strokeLinejoin:"round",markerEnd:`url(#${B})`,...V!==void 0?{markerStart:`url(#${V})`}:{},...y.strokeDasharray!==void 0?{strokeDasharray:y.strokeDasharray}:{},...ce!==void 0?{style:ce}:{}}),o.label!==void 0&&v!==void 0&&(0,Qz.jsx)("g",{transform:`translate(${v.x}, ${w?v.y+4:v.y-6})`,children:(0,Qz.jsx)("text",{textAnchor:"middle",fontSize:11,fontWeight:_?700:500,fill:_?"var(--archik-selected)":"var(--archik-fg-dim)",stroke:"var(--archik-panel)",strokeWidth:_?4:3,paintOrder:"stroke",children:o.label})})]})}var pb=li(ec(),1);var v2t={added:"var(--archik-success)",removed:"var(--archik-danger)",changed:"var(--archik-warning)"};function f8r(o){let c=[],u=(p,f,y)=>{for(let w of p){let v=f+w.x,_=y+w.y;c.push({...w,absX:v,absY:_}),w.children.length>0&&u(w.children,v,_)}};return u(o,0,0),c}function p8r(o){return o.replace(/[^a-z0-9-]/g,c=>`\\${c}`)}function Hln({statuses:o,scopeClass:c}){let u=[];for(let[f,y]of o.nodes)y==="removed"&&u.push(f);if(u.length===0)return null;let p=u.map(f=>`.${c} [data-archik-node-id="${p8r(f)}"] { opacity: 0.35; }`).join(`
522
522
  `);return(0,pb.jsx)("style",{children:p})}function Uln({positioned:o,statuses:c}){return(0,pb.jsx)("g",{className:"archik-diff-nodes",pointerEvents:"none",children:f8r(o.roots).map(u=>{let p=c.nodes.get(u.id);return p===void 0||p==="unchanged"?null:(0,pb.jsx)(g8r,{node:u,status:p},u.id)})})}function g8r({node:o,status:c}){let u=v2t[c],p=o.absX+-3,f=o.absY+-3,y=o.width- -6,w=o.height- -6,v=c==="removed"?"5 4":void 0,_=jln(o.kind,p-1,f-1,y+2,w+2),T=jln(o.kind,p,f,y,w);return(0,pb.jsxs)("g",{children:[(0,pb.jsx)("path",{d:_,fill:"none",stroke:u,strokeOpacity:.25,strokeWidth:6,strokeLinejoin:"round"}),(0,pb.jsx)("path",{d:T,fill:"none",stroke:u,strokeWidth:2.2,strokeLinejoin:"round",...v!==void 0?{strokeDasharray:v}:{},opacity:.95}),(0,pb.jsx)(m8r,{x:p+y-6,y:f-6,status:c})]})}function jln(o,c,u,p,f){switch(o){case"queue":{let y=Math.min(f/2,28);return Bln(c,u,p,f,y)}case"database":return y8r(c,u,p,f,12);case"cloud":return b8r(c,u,p,f);default:return Bln(c,u,p,f,10)}}function Bln(o,c,u,p,f){let y=Math.min(f,u/2),w=Math.min(f,p/2);return[`M ${o+y} ${c}`,`H ${o+u-y}`,`A ${y} ${w} 0 0 1 ${o+u} ${c+w}`,`V ${c+p-w}`,`A ${y} ${w} 0 0 1 ${o+u-y} ${c+p}`,`H ${o+y}`,`A ${y} ${w} 0 0 1 ${o} ${c+p-w}`,`V ${c+w}`,`A ${y} ${w} 0 0 1 ${o+y} ${c}`,"Z"].join(" ")}function y8r(o,c,u,p,f){return[`M ${o} ${c+f}`,`L ${o} ${c+p-10}`,`A 10 10 0 0 0 ${o+10} ${c+p}`,`L ${o+u-10} ${c+p}`,`A 10 10 0 0 0 ${o+u} ${c+p-10}`,`L ${o+u} ${c+f}`,`A ${u/2} ${f} 0 0 0 ${o} ${c+f}`,"Z"].join(" ")}function b8r(o,c,u,p){let y=p-2,w=p*.62,v=Math.min(p*.18,14),_=u-4,T=p*.5,R=Math.min(_*.15,T*.85),F=Math.min(_*.18,T),B=Math.min(_*.15,T*.85),V=2*(R+F+B),se=Math.max(0,_-V)/4,ee=2,ce=u-2,ge=ee+se,Oe=ge+2*R,ut=Oe+se,Se=ut+2*F,Be=Se+se,Ue=Be+2*B;return[`M ${o+ee} ${c+y-v}`,`Q ${o+ee} ${c+y} ${o+ee+v} ${c+y}`,`L ${o+ce-v} ${c+y}`,`Q ${o+ce} ${c+y} ${o+ce} ${c+y-v}`,`L ${o+ce} ${c+w}`,`L ${o+Ue} ${c+w}`,`A ${B} ${B} 0 0 0 ${o+Be} ${c+w}`,`L ${o+Se} ${c+w}`,`A ${F} ${F} 0 0 0 ${o+ut} ${c+w}`,`L ${o+Oe} ${c+w}`,`A ${R} ${R} 0 0 0 ${o+ge} ${c+w}`,`L ${o+ee} ${c+w}`,"Z"].join(" ")}function m8r({x:o,y:c,status:u}){let p=u==="added"?"+":u==="removed"?"\u2212":"~";return(0,pb.jsxs)("g",{transform:`translate(${o}, ${c})`,children:[(0,pb.jsx)("circle",{r:9,fill:v2t[u],stroke:"var(--archik-canvas)",strokeWidth:1.5}),(0,pb.jsx)("text",{textAnchor:"middle",y:4,fontSize:12,fontWeight:700,fill:"white",children:p})]})}function qln({positioned:o,statuses:c}){return(0,pb.jsx)("g",{className:"archik-diff-edges",pointerEvents:"none",children:o.edges.map(u=>{let p=c.edges.get(u.id);return p===void 0||p==="unchanged"?null:(0,pb.jsx)(w8r,{edge:u,status:p},u.id)})})}function w8r({edge:o,status:c}){let u=o.sections[0];if(!u)return null;let p=[u.startPoint,...u.bendPoints,u.endPoint];return(0,pb.jsx)("polyline",{points:p.map(f=>`${f.x},${f.y}`).join(" "),fill:"none",stroke:v2t[c],strokeWidth:3,strokeOpacity:.55,strokeLinecap:"round",strokeLinejoin:"round",strokeDasharray:c==="removed"?"8 4":void 0})}var td=li(ec(),1),eFe=24;function k2t({positioned:o,viewMode:c="detailed",selectedNodeIds:u,selectedEdgeIds:p,glowNodeIds:f,onSelectNode:y,onSelectEdge:w,onOpenSubFile:v,onCrossFileNavigate:_,showStereotypeBands:T=!0}){let R=new Map;for(let F of o.edges){if(F.toFile!==void 0){let B=R.get(F.from)??new Set;B.add(F.toFile),R.set(F.from,B)}if(F.fromFile!==void 0){let B=R.get(F.to)??new Set;B.add(F.fromFile),R.set(F.to,B)}}return(0,td.jsxs)(td.Fragment,{children:[(0,td.jsxs)("defs",{children:[(0,td.jsx)(Nln,{id:Wm}),(0,td.jsx)(Rln,{id:Yz}),(0,td.jsx)(Dln,{id:YOe}),(0,td.jsx)(Oln,{id:dne}),(0,td.jsx)(Fln,{id:QOe})]}),(0,td.jsx)("g",{className:"archik-edges",children:o.edges.map(F=>(0,td.jsx)($ln,{edge:F,...p!==void 0?{selectedEdgeIds:p}:{},...w!==void 0?{onSelectEdge:w}:{}},F.id))}),(0,td.jsx)("g",{className:"archik-nodes",children:o.roots.map(F=>(0,td.jsx)(w2t,{node:F,viewMode:c,showStereotypeBands:T,crossFileByNode:R,...u!==void 0?{selectedNodeIds:u}:{},...f!==void 0?{glowNodeIds:f}:{},...y!==void 0?{onSelectNode:y}:{},...v!==void 0?{onOpenSubFile:v}:{},..._!==void 0?{onCrossFileNavigate:_}:{}},F.id))})]})}function v8r(o,c){let u=(p,f,y)=>{for(let w of p){if(w.id===c)return{x:f+w.x+w.width/2,y:y+w.y+w.height/2};let v=u(w.children,f+w.x,y+w.y);if(v)return v}return null};return u(o.roots,0,0)}function Gln({positioned:o,className:c,zoom:u=1,viewMode:p="detailed",svgRef:f,dragGhost:y,selectedNodeIds:w,selectedEdgeIds:v,glowNodeIds:_,onSelectNode:T,onSelectEdge:R,onSelectNothing:F,onOpenSubFile:B,onCrossFileNavigate:V,diffStatuses:se,showStereotypeBands:ee=!0}){let ce=Math.max(o.width,1),ge=Math.max(o.height,1),Oe=-eFe,ut=-eFe,Se=ce+eFe*2,Be=ge+eFe*2,Ue=y?v8r(o,y.fromId):null;return(0,td.jsxs)("svg",{ref:f,className:c,xmlns:"http://www.w3.org/2000/svg",width:Se*u,height:Be*u,viewBox:`${Oe} ${ut} ${Se} ${Be}`,preserveAspectRatio:"xMidYMid meet",style:{display:"block",flexShrink:0},onClick:F,children:[se&&(0,td.jsx)(Hln,{statuses:se,scopeClass:"archik-diff-base"}),(0,td.jsx)("g",{className:se?"archik-diff-base":void 0,children:(0,td.jsx)(k2t,{positioned:o,viewMode:p,showStereotypeBands:ee,...w!==void 0?{selectedNodeIds:w}:{},...v!==void 0?{selectedEdgeIds:v}:{},..._!==void 0?{glowNodeIds:_}:{},...T!==void 0?{onSelectNode:T}:{},...R!==void 0?{onSelectEdge:R}:{},...B!==void 0?{onOpenSubFile:B}:{},...V!==void 0?{onCrossFileNavigate:V}:{}})}),se&&(0,td.jsxs)(td.Fragment,{children:[(0,td.jsx)(qln,{positioned:o,statuses:se}),(0,td.jsx)(Uln,{positioned:o,statuses:se})]}),y&&Ue&&(0,td.jsxs)("g",{className:"archik-drag-ghost",pointerEvents:"none",children:[(0,td.jsx)("line",{x1:Ue.x,y1:Ue.y,x2:y.pointerX,y2:y.pointerY,stroke:"var(--archik-selected)",strokeWidth:1.6,strokeDasharray:"6 4",strokeLinecap:"round",opacity:.85}),(0,td.jsx)("circle",{cx:y.pointerX,cy:y.pointerY,r:4,fill:"var(--archik-selected)",opacity:.9})]})]})}var Vln={"--archik-canvas":"#000000","--archik-panel":"#0a0a0a","--archik-surface":"#161616","--archik-surface-hover":"#222222","--archik-fg":"#ffffff","--archik-fg-dim":"#c8c8c8","--archik-fg-muted":"#9a9a9a","--archik-border":"#262626","--archik-border-strong":"#3d3d3d","--archik-accent":"#22d3ee","--archik-accent-bright":"#67e8f9","--archik-magenta":"#f472b6","--archik-success":"#34d399","--archik-warning":"#fbbf24","--archik-danger":"#fb7185","--archik-node-fill":"#0c0c0c","--archik-node-fill-tinted":"#181818","--archik-node-fill-frame":"#101010","--archik-node-stroke":"#3d3d3d","--archik-node-stroke-soft":"#2a2a2a","--archik-node-text":"#ffffff","--archik-node-text-dim":"#d6d6d6","--archik-node-caption":"#67e8f9","--archik-node-chrome-dot":"#3a3a3a","--archik-edge-filled":"#ededed","--archik-edge-open":"#b0b0b0","--archik-edge-dim":"#7a7a7a","--archik-edge-async":"#67e8f9","--archik-grid-minor":"#0f0f0f","--archik-grid-major":"#1c1c1c","--archik-selected":"#22d3ee","--archik-selected-glow":"rgba(34, 211, 238, 0.28)"},Wln={"--archik-canvas":"#f8fafc","--archik-panel":"#ffffff","--archik-surface":"#f1f5f9","--archik-surface-hover":"#e2e8f0","--archik-fg":"#0f172a","--archik-fg-dim":"#475569","--archik-fg-muted":"#94a3b8","--archik-border":"#e2e8f0","--archik-border-strong":"#cbd5e1","--archik-accent":"#2563eb","--archik-accent-bright":"#3b82f6","--archik-magenta":"#db2777","--archik-success":"#10b981","--archik-warning":"#d97706","--archik-danger":"#e11d48","--archik-node-fill":"#ffffff","--archik-node-fill-tinted":"#f1f5f9","--archik-node-fill-frame":"#ffffff","--archik-node-stroke":"#0f172a","--archik-node-stroke-soft":"#475569","--archik-node-text":"#0f172a","--archik-node-text-dim":"#475569","--archik-node-caption":"#64748b","--archik-node-chrome-dot":"#cbd5f5","--archik-edge-filled":"#0f172a","--archik-edge-open":"#334155","--archik-edge-dim":"#64748b","--archik-edge-async":"#2563eb","--archik-grid-minor":"#e2e8f0","--archik-grid-major":"#cbd5e1","--archik-selected":"#2563eb","--archik-selected-glow":"rgba(37, 99, 235, 0.18)"};function fne(o,c="dark"){let u=c==="light"?Wln:Vln;return o.replace(/var\(--archik-([a-z0-9-]+)\)/g,(p,f)=>u[`--archik-${f}`]??p)}function pne(o,c="dark"){let p=(c==="light"?Wln:Vln)["--archik-canvas"]??"#000000",f=o.match(/<svg\b[^>]*viewBox="([^"]+)"/),[y,w,v,_]=(f?.[1]??"0 0 0 0").split(/\s+/),T=`<rect x="${y}" y="${w}" width="${v}" height="${_}" fill="${p}"/>`;return o.replace(/(<svg\b[^>]*>)/,`$1${T}`)}async function k8r(o,c){let u=dn(c,"out")??"sequence.svg",p=dn(c,"theme")??"dark";if(p!=="dark"&&p!=="light")return console.error(`\u2717 --theme must be "dark" or "light" (got "${p}")`),1;let f=p,y;try{y=await Zln(o,"utf-8")}catch{return console.error(`\u2717 Cannot read ${o}`),1}let w=Kln.default.parse(y),v=pte.safeParse(w);if(!v.success)return console.error(`\u2717 ${o}: ${v.error.issues.map(ce=>ce.message).join("; ")}`),1;let _=FG.resolve(o),T=Ba(_),R;try{let ce=await ac(void 0,T),ge=await ul(ce,T),Oe=new Map;for(let{doc:ut}of ge.docs)for(let Se of ut.nodes)Oe.set(Se.id,Se.kind);R=Oe}catch{}let F=Gsn(v.data,R),B=(0,x2t.renderToStaticMarkup)((0,M2t.createElement)(gln,{laid:F})),se=`<?xml version="1.0" encoding="UTF-8"?>
523
523
  ${pne(fne(B,f),f)}
524
524
  `,ee=FG.resolve(u);return await Jln(FG.dirname(ee),{recursive:!0}),await Xln(ee,se,"utf-8"),console.log(`\u2713 Rendered sequence "${v.data.name}" \u2192 ${u}`),0}async function gne(o){let c=dn(o,"seq");if(c!==void 0)return k8r(c,o);let u;try{u=await ac(o._[0])}catch(Be){return console.error(`\u2717 ${Be instanceof Error?Be.message:String(Be)}`),1}let p=FG.relative(process.cwd(),u)||u,f=dn(o,"out")??"diagram.svg",y=dn(o,"theme")??"dark";if(y!=="dark"&&y!=="light")return console.error(`\u2717 --theme must be "dark" or "light" (got "${y}")`),1;let w=y,v;try{v=await Zln(u,"utf-8")}catch(Be){return console.error(`\u2717 Cannot read ${p}`),console.error(Be instanceof Error?Be.message:String(Be)),1}try{Xu(v)}catch(Be){return console.error(`\u2717 ${p}`),console.error(Be instanceof Error?Be.message:String(Be)),1}let _=Ba(u),T=await ul(u,_);for(let Be of T.errors)console.error(`warn: ${Be.relPath}: ${Be.message}`);let F={version:"1.0",name:"merged",nodes:T.docs.flatMap(Be=>Be.doc.nodes),edges:T.docs.flatMap(Be=>Be.doc.edges)},B=dn(o,"focus");if(B!==void 0){let Be=dn(o,"depth"),Ue=Be!==void 0?Math.max(0,Number.parseInt(Be,10)||0):1;F=Bsn(F,B,Ue)}let V=dn(o,"hide-rel"),se=dn(o,"only-rel"),ee=dn(o,"hide-structural")==="true";(V!==void 0||se!==void 0||ee)&&(F=Hsn(F,{...V!==void 0?{hideRel:V.split(",").map(Be=>Be.trim())}:{},...se!==void 0?{onlyRel:se.split(",").map(Be=>Be.trim())}:{},...ee?{hideStructural:!0}:{}}));let ce=await NG(F),ge=(0,x2t.renderToStaticMarkup)((0,M2t.createElement)(Gln,{positioned:ce})),ut=`<?xml version="1.0" encoding="UTF-8"?>