import type { IToHiccup } from "@thi.ng/api" ; import { deref } from "@thi.ng/api/deref" ; import { isFunction } from "@thi.ng/checks/is-function" ; import type { ANode } from "./anode.js" ; param node param ctx internal export const toHiccup = < T extends ANode < T > & IToHiccup > ( node , ctx ? ) => { const body = isFunction ( node . body ) ? node . body ( ctx ) : deref ( node . body ) ; return node . enabled && node . display ? node . children . length ? [ "g" , { } , node . body ? [ "g" , { transform : node . mat } , body ] : undefined , ... node . children . map ( ( c ) => c . toHiccup ( ctx ) ) , ] : body ? [ "g" , { transform : node . mat } , body ] : undefined : undefined ; } ;