// Copyright 2017-2022 The MathJax Consortium
// SPDX-License-Identifier: Apache-2.0
// This file is a Go translation and modification of MathJax 3.2.2.

package mml

import 

// Definition describes behavior shared by all nodes of one kind.
type Definition struct {
	Defaults *ordered.Map[Property]
	Flags    Flags
}

// Factory constructs nodes with registered kind definitions and shared global
// math attributes. It is intentionally small so parser and layout packages can
// evolve independently.
type Factory struct {
	definitions map[string]Definition
	global      *ordered.Map[Property]
}

// NewFactory returns an empty factory.
func () *Factory {
	return &Factory{
		definitions: make(map[string]Definition),
		global:      ordered.New[Property](),
	}
}

// Globals returns the shared global math-attribute map.
func ( *Factory) () *ordered.Map[Property] { return .global }

// Register registers or replaces a node definition.
func ( *Factory) ( string,  Definition) {
	.Defaults = .Defaults.Clone()
	.definitions[] = 
}

// Definition returns a registered definition.
func ( *Factory) ( string) (Definition, bool) {
	,  := .definitions[]
	return , 
}

// Create constructs kind and links children.
func ( *Factory) ( string,  ...*Node) *Node {
	 := .definitions[]
	 := NewNode(, .Defaults, .global, ...)
	.Flags = .Flags
	return 
}

// Text constructs an internal text node.
func ( *Factory) ( string) *Node { return NewText() }