import type { Fn } from "@thi.ng/api" ; import { equiv } from "@thi.ng/equiv" ; import type { Attribs , IHiccupShape } from "@thi.ng/geom-api" ; import { __copyAttribs } from "../internal/copy.js" ; export class Group implements IHiccupShape { constructor ( public attribs , public children = [ ] ) { } get type ( ) { return "group" ; } * [ Symbol . iterator ] ( ) { yield * this . children ; } copy ( ) { return this . copyTransformed ( ( c ) => < IHiccupShape > c . copy ( ) ) ; } copyTransformed ( fn ) { return new Group ( __copyAttribs ( this ) , this . children . map ( fn ) ) ; } equiv ( o ) { return o instanceof Group && equiv ( this . children , o . children ) ; } toHiccup ( ) { return [ "g" , this . attribs , ... this . children . map ( ( x ) => x . toHiccup ( ) ) ] ; } }