package cdp

// Code generated by cdproto-gen. DO NOT EDIT.

import (
	
	
	
	
	
	

	
	
	
	
)

// Executor is the common interface for executing a command.
type Executor interface {
	// Execute executes the command.
	Execute(context.Context, string, easyjson.Marshaler, easyjson.Unmarshaler) error
}

// contextKey is the context key type.
type contextKey int

// context keys.
const (
	executorKey contextKey = iota
)

// WithExecutor sets the message executor for the context.
func ( context.Context,  Executor) context.Context {
	return context.WithValue(, executorKey, )
}

// ExecutorFromContext returns the message executor for the context.
func ( context.Context) Executor {
	return .Value(executorKey).(Executor)
}

// Execute uses the context's message executor to send a command or event
// method marshaling the provided parameters, and unmarshaling to res.
func ( context.Context,  string,  easyjson.Marshaler,  easyjson.Unmarshaler) error {
	if  := .Value(executorKey);  != nil {
		return .(Executor).Execute(, , , )
	}
	return ErrInvalidContext
}

// Error is a error.
type Error string

// Error values.
const (
	// ErrInvalidContext is the invalid context error.
	ErrInvalidContext Error = "invalid context"

	// ErrMsgMissingParamsOrResult is the msg missing params or result error.
	ErrMsgMissingParamsOrResult Error = "msg missing params or result"
)

// Error satisfies the error interface.
func ( Error) () string {
	return string()
}

// ErrUnknownCommandOrEvent is an unknown command or event error.
type ErrUnknownCommandOrEvent string

// Error satisfies the error interface.
func ( ErrUnknownCommandOrEvent) () string {
	return fmt.Sprintf("unknown command or event %q", string())
}

// BrowserContextID [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Browser#type-BrowserContextID
type BrowserContextID string

// String returns the BrowserContextID as string value.
func ( BrowserContextID) () string {
	return string()
}

// NodeID unique DOM node identifier.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-NodeId
type NodeID int64

// Int64 returns the NodeID as int64 value.
func ( NodeID) () int64 {
	return int64()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *NodeID) ( *jlexer.Lexer) {
	 := .Raw()
	if  := len();  > 2 && [0] == '"' && [-1] == '"' {
		 = [1 : -1]
	}

	,  := strconv.ParseInt(string(), 10, 64)
	if  != nil {
		.AddError()
	}

	* = NodeID()
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *NodeID) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// BackendNodeID unique DOM node identifier used to reference a node that may
// not have been pushed to the front-end.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-BackendNodeId
type BackendNodeID int64

// Int64 returns the BackendNodeID as int64 value.
func ( BackendNodeID) () int64 {
	return int64()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *BackendNodeID) ( *jlexer.Lexer) {
	 := .Raw()
	if  := len();  > 2 && [0] == '"' && [-1] == '"' {
		 = [1 : -1]
	}

	,  := strconv.ParseInt(string(), 10, 64)
	if  != nil {
		.AddError()
	}

	* = BackendNodeID()
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *BackendNodeID) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// BackendNode backend node with a friendly name.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-BackendNode
type BackendNode struct {
	NodeType      NodeType      `json:"nodeType"` // Node's nodeType.
	NodeName      string        `json:"nodeName"` // Node's nodeName.
	BackendNodeID BackendNodeID `json:"backendNodeId"`
}

// PseudoType pseudo element type.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-PseudoType
type PseudoType string

// String returns the PseudoType as string value.
func ( PseudoType) () string {
	return string()
}

// PseudoType values.
const (
	PseudoTypeFirstLine               PseudoType = "first-line"
	PseudoTypeFirstLetter             PseudoType = "first-letter"
	PseudoTypeBefore                  PseudoType = "before"
	PseudoTypeAfter                   PseudoType = "after"
	PseudoTypeMarker                  PseudoType = "marker"
	PseudoTypeBackdrop                PseudoType = "backdrop"
	PseudoTypeSelection               PseudoType = "selection"
	PseudoTypeTargetText              PseudoType = "target-text"
	PseudoTypeSpellingError           PseudoType = "spelling-error"
	PseudoTypeGrammarError            PseudoType = "grammar-error"
	PseudoTypeHighlight               PseudoType = "highlight"
	PseudoTypeFirstLineInherited      PseudoType = "first-line-inherited"
	PseudoTypeScrollbar               PseudoType = "scrollbar"
	PseudoTypeScrollbarThumb          PseudoType = "scrollbar-thumb"
	PseudoTypeScrollbarButton         PseudoType = "scrollbar-button"
	PseudoTypeScrollbarTrack          PseudoType = "scrollbar-track"
	PseudoTypeScrollbarTrackPiece     PseudoType = "scrollbar-track-piece"
	PseudoTypeScrollbarCorner         PseudoType = "scrollbar-corner"
	PseudoTypeResizer                 PseudoType = "resizer"
	PseudoTypeInputListButton         PseudoType = "input-list-button"
	PseudoTypeViewTransition          PseudoType = "view-transition"
	PseudoTypeViewTransitionGroup     PseudoType = "view-transition-group"
	PseudoTypeViewTransitionImagePair PseudoType = "view-transition-image-pair"
	PseudoTypeViewTransitionOld       PseudoType = "view-transition-old"
	PseudoTypeViewTransitionNew       PseudoType = "view-transition-new"
)

// MarshalEasyJSON satisfies easyjson.Marshaler.
func ( PseudoType) ( *jwriter.Writer) {
	.String(string())
}

// MarshalJSON satisfies json.Marshaler.
func ( PseudoType) () ([]byte, error) {
	return easyjson.Marshal()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *PseudoType) ( *jlexer.Lexer) {
	 := .String()
	switch PseudoType() {
	case PseudoTypeFirstLine:
		* = PseudoTypeFirstLine
	case PseudoTypeFirstLetter:
		* = PseudoTypeFirstLetter
	case PseudoTypeBefore:
		* = PseudoTypeBefore
	case PseudoTypeAfter:
		* = PseudoTypeAfter
	case PseudoTypeMarker:
		* = PseudoTypeMarker
	case PseudoTypeBackdrop:
		* = PseudoTypeBackdrop
	case PseudoTypeSelection:
		* = PseudoTypeSelection
	case PseudoTypeTargetText:
		* = PseudoTypeTargetText
	case PseudoTypeSpellingError:
		* = PseudoTypeSpellingError
	case PseudoTypeGrammarError:
		* = PseudoTypeGrammarError
	case PseudoTypeHighlight:
		* = PseudoTypeHighlight
	case PseudoTypeFirstLineInherited:
		* = PseudoTypeFirstLineInherited
	case PseudoTypeScrollbar:
		* = PseudoTypeScrollbar
	case PseudoTypeScrollbarThumb:
		* = PseudoTypeScrollbarThumb
	case PseudoTypeScrollbarButton:
		* = PseudoTypeScrollbarButton
	case PseudoTypeScrollbarTrack:
		* = PseudoTypeScrollbarTrack
	case PseudoTypeScrollbarTrackPiece:
		* = PseudoTypeScrollbarTrackPiece
	case PseudoTypeScrollbarCorner:
		* = PseudoTypeScrollbarCorner
	case PseudoTypeResizer:
		* = PseudoTypeResizer
	case PseudoTypeInputListButton:
		* = PseudoTypeInputListButton
	case PseudoTypeViewTransition:
		* = PseudoTypeViewTransition
	case PseudoTypeViewTransitionGroup:
		* = PseudoTypeViewTransitionGroup
	case PseudoTypeViewTransitionImagePair:
		* = PseudoTypeViewTransitionImagePair
	case PseudoTypeViewTransitionOld:
		* = PseudoTypeViewTransitionOld
	case PseudoTypeViewTransitionNew:
		* = PseudoTypeViewTransitionNew

	default:
		.AddError(fmt.Errorf("unknown PseudoType value: %v", ))
	}
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *PseudoType) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// ShadowRootType shadow root type.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-ShadowRootType
type ShadowRootType string

// String returns the ShadowRootType as string value.
func ( ShadowRootType) () string {
	return string()
}

// ShadowRootType values.
const (
	ShadowRootTypeUserAgent ShadowRootType = "user-agent"
	ShadowRootTypeOpen      ShadowRootType = "open"
	ShadowRootTypeClosed    ShadowRootType = "closed"
)

// MarshalEasyJSON satisfies easyjson.Marshaler.
func ( ShadowRootType) ( *jwriter.Writer) {
	.String(string())
}

// MarshalJSON satisfies json.Marshaler.
func ( ShadowRootType) () ([]byte, error) {
	return easyjson.Marshal()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *ShadowRootType) ( *jlexer.Lexer) {
	 := .String()
	switch ShadowRootType() {
	case ShadowRootTypeUserAgent:
		* = ShadowRootTypeUserAgent
	case ShadowRootTypeOpen:
		* = ShadowRootTypeOpen
	case ShadowRootTypeClosed:
		* = ShadowRootTypeClosed

	default:
		.AddError(fmt.Errorf("unknown ShadowRootType value: %v", ))
	}
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *ShadowRootType) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// CompatibilityMode document compatibility mode.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-CompatibilityMode
type CompatibilityMode string

// String returns the CompatibilityMode as string value.
func ( CompatibilityMode) () string {
	return string()
}

// CompatibilityMode values.
const (
	CompatibilityModeQuirksMode        CompatibilityMode = "QuirksMode"
	CompatibilityModeLimitedQuirksMode CompatibilityMode = "LimitedQuirksMode"
	CompatibilityModeNoQuirksMode      CompatibilityMode = "NoQuirksMode"
)

// MarshalEasyJSON satisfies easyjson.Marshaler.
func ( CompatibilityMode) ( *jwriter.Writer) {
	.String(string())
}

// MarshalJSON satisfies json.Marshaler.
func ( CompatibilityMode) () ([]byte, error) {
	return easyjson.Marshal()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *CompatibilityMode) ( *jlexer.Lexer) {
	 := .String()
	switch CompatibilityMode() {
	case CompatibilityModeQuirksMode:
		* = CompatibilityModeQuirksMode
	case CompatibilityModeLimitedQuirksMode:
		* = CompatibilityModeLimitedQuirksMode
	case CompatibilityModeNoQuirksMode:
		* = CompatibilityModeNoQuirksMode

	default:
		.AddError(fmt.Errorf("unknown CompatibilityMode value: %v", ))
	}
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *CompatibilityMode) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// Node DOM interaction is implemented in terms of mirror objects that
// represent the actual DOM nodes. DOMNode is a base node mirror type.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-Node
type Node struct {
	NodeID            NodeID            `json:"nodeId"`                     // Node identifier that is passed into the rest of the DOM messages as the nodeId. Backend will only push node with given id once. It is aware of all requested nodes and will only fire DOM events for nodes known to the client.
	ParentID          NodeID            `json:"parentId,omitempty"`         // The id of the parent node if any.
	BackendNodeID     BackendNodeID     `json:"backendNodeId"`              // The BackendNodeId for this node.
	NodeType          NodeType          `json:"nodeType"`                   // Node's nodeType.
	NodeName          string            `json:"nodeName"`                   // Node's nodeName.
	LocalName         string            `json:"localName"`                  // Node's localName.
	NodeValue         string            `json:"nodeValue"`                  // Node's nodeValue.
	ChildNodeCount    int64             `json:"childNodeCount,omitempty"`   // Child count for Container nodes.
	Children          []*Node           `json:"children,omitempty"`         // Child nodes of this node when requested with children.
	Attributes        []string          `json:"attributes,omitempty"`       // Attributes of the Element node in the form of flat array [name1, value1, name2, value2].
	DocumentURL       string            `json:"documentURL,omitempty"`      // Document URL that Document or FrameOwner node points to.
	BaseURL           string            `json:"baseURL,omitempty"`          // Base URL that Document or FrameOwner node uses for URL completion.
	PublicID          string            `json:"publicId,omitempty"`         // DocumentType's publicId.
	SystemID          string            `json:"systemId,omitempty"`         // DocumentType's systemId.
	InternalSubset    string            `json:"internalSubset,omitempty"`   // DocumentType's internalSubset.
	XMLVersion        string            `json:"xmlVersion,omitempty"`       // Document's XML version in case of XML documents.
	Name              string            `json:"name,omitempty"`             // Attr's name.
	Value             string            `json:"value,omitempty"`            // Attr's value.
	PseudoType        PseudoType        `json:"pseudoType,omitempty"`       // Pseudo element type for this node.
	PseudoIdentifier  string            `json:"pseudoIdentifier,omitempty"` // Pseudo element identifier for this node. Only present if there is a valid pseudoType.
	ShadowRootType    ShadowRootType    `json:"shadowRootType,omitempty"`   // Shadow root type.
	FrameID           FrameID           `json:"frameId,omitempty"`          // Frame ID for frame owner elements.
	ContentDocument   *Node             `json:"contentDocument,omitempty"`  // Content document for frame owner elements.
	ShadowRoots       []*Node           `json:"shadowRoots,omitempty"`      // Shadow root list for given element host.
	TemplateContent   *Node             `json:"templateContent,omitempty"`  // Content document fragment for template elements.
	PseudoElements    []*Node           `json:"pseudoElements,omitempty"`   // Pseudo elements associated with this node.
	DistributedNodes  []*BackendNode    `json:"distributedNodes,omitempty"` // Distributed nodes for given insertion point.
	IsSVG             bool              `json:"isSVG,omitempty"`            // Whether the node is SVG.
	CompatibilityMode CompatibilityMode `json:"compatibilityMode,omitempty"`
	AssignedSlot      *BackendNode      `json:"assignedSlot,omitempty"`
	Parent            *Node             `json:"-"` // Parent node.
	Invalidated       chan struct{}     `json:"-"` // Invalidated channel.
	State             NodeState         `json:"-"` // Node state.
	sync.RWMutex      `json:"-"`        // Read write mutex.
}

// AttributeValue returns the named attribute for the node.
func ( *Node) ( string) string {
	,  := .Attribute()
	return 
}

// Attribute returns the named attribute for the node and if it exists.
func ( *Node) ( string) (string, bool) {
	.RLock()
	defer .RUnlock()

	for  := 0;  < len(.Attributes);  += 2 {
		if .Attributes[] ==  {
			return .Attributes[+1], true
		}
	}

	return "", false
}

// xpath builds the xpath string.
func ( *Node) (,  bool) string {
	.RLock()
	defer .RUnlock()

	, ,  := "", "", .AttributeValue("id")
	switch {
	case .Parent == nil:
		return .LocalName

	case  && .NodeType == NodeTypeDocument:
		return ""

	case  &&  != "":
		 = "/"
		 = `[@id='` +  + `']`

	case .Parent != nil:
		var  int
		var  bool

		.Parent.RLock()
		for  := 0;  < len(.Parent.Children); ++ {
			if .Parent.Children[].LocalName == .LocalName {
				++
			}
			if .Parent.Children[].NodeID == .NodeID {
				 = true
				break
			}
		}
		.Parent.RUnlock()

		if  {
			 = "[" + strconv.Itoa() + "]"
		}

		 = .Parent.(, )
	}

	 := .LocalName
	if .IsSVG {
		 = `*[local-name()='` +  + `']`
	}
	return  + "/" +  + 
}

// PartialXPathByID returns the partial XPath for the node, stopping at the
// first parent with an id attribute or at nearest parent document node.
func ( *Node) () string {
	return .xpath(true, true)
}

// PartialXPath returns the partial XPath for the node, stopping at the nearest
// parent document node.
func ( *Node) () string {
	return .xpath(true, false)
}

// FullXPathByID returns the full XPath for the node, stopping at the top most
// document root or at the closest parent node with an id attribute.
func ( *Node) () string {
	return .xpath(false, true)
}

// FullXPath returns the full XPath for the node, stopping only at the top most
// document root.
func ( *Node) () string {
	return .xpath(false, false)
}

// Dump builds a printable string representation of the node and its children.
func ( *Node) (,  string,  bool) string {
	if  == nil {
		return  + "<nil>"
	}

	.RLock()
	defer .RUnlock()

	 := .LocalName
	if  == "" {
		 = .NodeName
	}

	for  := 0;  < len(.Attributes);  += 2 {
		if strings.ToLower(.Attributes[]) == "id" {
			 += "#" + .Attributes[+1]
			break
		}
	}

	if .NodeType != NodeTypeElement && .NodeType != NodeTypeText {
		 += fmt.Sprintf(" <%s>", .NodeType)
	}

	if .NodeType == NodeTypeText {
		 := .NodeValue
		if len() > 15 {
			 = [:15] + "..."
		}
		 += fmt.Sprintf(" %q", )
	}

	if .NodeType == NodeTypeElement && len(.Attributes) > 0 {
		 := ""
		for  := 0;  < len(.Attributes);  += 2 {
			if strings.ToLower(.Attributes[]) == "id" {
				continue
			}
			if  != "" {
				 += " "
			}
			 += fmt.Sprintf("%s=%q", .Attributes[], .Attributes[+1])
		}
		if  != "" {
			 += " [" +  + "]"
		}
	}

	if  {
		 += fmt.Sprintf(" (%d)", .NodeID)
	}

	for  := 0;  < len(.Children); ++ {
		 += "\n" + .Children[].(+, , )
	}

	return  + 
}

// NodeState is the state of a DOM node.
type NodeState uint8

// NodeState enum values.
const (
	NodeReady NodeState = 1 << (7 - iota)
	NodeVisible
	NodeHighlighted
)

// nodeStateNames are the names of the node states.
var nodeStateNames = map[NodeState]string{
	NodeReady:       "Ready",
	NodeVisible:     "Visible",
	NodeHighlighted: "Highlighted",
}

// String satisfies stringer interface.
func ( NodeState) () string {
	var  []string
	for ,  := range nodeStateNames {
		if & != 0 {
			 = append(, )
		}
	}
	return "[" + strings.Join(, " ") + "]"
}

// EmptyNodeID is the "non-existent" node id.
const EmptyNodeID = NodeID(0)

// RGBA a structure holding an RGBA color.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/DOM#type-RGBA
type RGBA struct {
	R int64   `json:"r"` // The red component, in the [0-255] range.
	G int64   `json:"g"` // The green component, in the [0-255] range.
	B int64   `json:"b"` // The blue component, in the [0-255] range.
	A float64 `json:"a"` // The alpha component, in the [0-1] range (default: 1).
}

// NodeType node type.
//
// See: https://developer.mozilla.org/en/docs/Web/API/Node/nodeType
type NodeType int64

// Int64 returns the NodeType as int64 value.
func ( NodeType) () int64 {
	return int64()
}

// NodeType values.
const (
	NodeTypeElement               NodeType = 1
	NodeTypeAttribute             NodeType = 2
	NodeTypeText                  NodeType = 3
	NodeTypeCDATA                 NodeType = 4
	NodeTypeEntityReference       NodeType = 5
	NodeTypeEntity                NodeType = 6
	NodeTypeProcessingInstruction NodeType = 7
	NodeTypeComment               NodeType = 8
	NodeTypeDocument              NodeType = 9
	NodeTypeDocumentType          NodeType = 10
	NodeTypeDocumentFragment      NodeType = 11
	NodeTypeNotation              NodeType = 12
)

// String returns the NodeType as string value.
func ( NodeType) () string {
	switch  {
	case NodeTypeElement:
		return "Element"
	case NodeTypeAttribute:
		return "Attribute"
	case NodeTypeText:
		return "Text"
	case NodeTypeCDATA:
		return "CDATA"
	case NodeTypeEntityReference:
		return "EntityReference"
	case NodeTypeEntity:
		return "Entity"
	case NodeTypeProcessingInstruction:
		return "ProcessingInstruction"
	case NodeTypeComment:
		return "Comment"
	case NodeTypeDocument:
		return "Document"
	case NodeTypeDocumentType:
		return "DocumentType"
	case NodeTypeDocumentFragment:
		return "DocumentFragment"
	case NodeTypeNotation:
		return "Notation"
	}

	return fmt.Sprintf("NodeType(%d)", )
}

// MarshalEasyJSON satisfies easyjson.Marshaler.
func ( NodeType) ( *jwriter.Writer) {
	.Int64(int64())
}

// MarshalJSON satisfies json.Marshaler.
func ( NodeType) () ([]byte, error) {
	return easyjson.Marshal()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *NodeType) ( *jlexer.Lexer) {
	 := .Int64()
	switch NodeType() {
	case NodeTypeElement:
		* = NodeTypeElement
	case NodeTypeAttribute:
		* = NodeTypeAttribute
	case NodeTypeText:
		* = NodeTypeText
	case NodeTypeCDATA:
		* = NodeTypeCDATA
	case NodeTypeEntityReference:
		* = NodeTypeEntityReference
	case NodeTypeEntity:
		* = NodeTypeEntity
	case NodeTypeProcessingInstruction:
		* = NodeTypeProcessingInstruction
	case NodeTypeComment:
		* = NodeTypeComment
	case NodeTypeDocument:
		* = NodeTypeDocument
	case NodeTypeDocumentType:
		* = NodeTypeDocumentType
	case NodeTypeDocumentFragment:
		* = NodeTypeDocumentFragment
	case NodeTypeNotation:
		* = NodeTypeNotation

	default:
		.AddError(fmt.Errorf("unknown NodeType value: %v", ))
	}
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *NodeType) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// LoaderID unique loader identifier.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#type-LoaderId
type LoaderID string

// String returns the LoaderID as string value.
func ( LoaderID) () string {
	return string()
}

// TimeSinceEpoch UTC time in seconds, counted from January 1, 1970.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#type-TimeSinceEpoch
type TimeSinceEpoch time.Time

// Time returns the TimeSinceEpoch as time.Time value.
func ( TimeSinceEpoch) () time.Time {
	return time.Time()
}

// MarshalEasyJSON satisfies easyjson.Marshaler.
func ( TimeSinceEpoch) ( *jwriter.Writer) {
	 := float64(time.Time().UnixNano() / int64(time.Second))

	.Buffer.EnsureSpace(20)
	.Buffer.Buf = strconv.AppendFloat(.Buffer.Buf, , 'f', -1, 64)
}

// MarshalJSON satisfies json.Marshaler.
func ( TimeSinceEpoch) () ([]byte, error) {
	return easyjson.Marshal()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *TimeSinceEpoch) ( *jlexer.Lexer) {
	* = TimeSinceEpoch(time.Unix(0, int64(.Float64()*float64(time.Second))))
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *TimeSinceEpoch) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// MonotonicTime monotonically increasing time in seconds since an arbitrary
// point in the past.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#type-MonotonicTime
type MonotonicTime time.Time

// Time returns the MonotonicTime as time.Time value.
func ( MonotonicTime) () time.Time {
	return time.Time()
}

// MonotonicTimeEpoch is the MonotonicTime time epoch.
var MonotonicTimeEpoch *time.Time

func init() {
	// initialize epoch
	 := sysutil.BootTime()
	MonotonicTimeEpoch = &
}

// MarshalEasyJSON satisfies easyjson.Marshaler.
func ( MonotonicTime) ( *jwriter.Writer) {
	 := float64(time.Time().Sub(*MonotonicTimeEpoch)) / float64(time.Second)

	.Buffer.EnsureSpace(20)
	.Buffer.Buf = strconv.AppendFloat(.Buffer.Buf, , 'f', -1, 64)
}

// MarshalJSON satisfies json.Marshaler.
func ( MonotonicTime) () ([]byte, error) {
	return easyjson.Marshal()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *MonotonicTime) ( *jlexer.Lexer) {
	* = MonotonicTime(MonotonicTimeEpoch.Add(time.Duration(.Float64() * float64(time.Second))))
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *MonotonicTime) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// TimeSinceEpochMilli special timestamp type for Response's responseTime
// field.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Network#type-TimeSinceEpochMilli
type TimeSinceEpochMilli time.Time

// Time returns the TimeSinceEpochMilli as time.Time value.
func ( TimeSinceEpochMilli) () time.Time {
	return time.Time()
}

// MarshalEasyJSON satisfies easyjson.Marshaler.
func ( TimeSinceEpochMilli) ( *jwriter.Writer) {
	 := float64(time.Time().UnixNano() / int64(time.Millisecond))

	.Buffer.EnsureSpace(20)
	.Buffer.Buf = strconv.AppendFloat(.Buffer.Buf, , 'f', -1, 64)
}

// MarshalJSON satisfies json.Marshaler.
func ( TimeSinceEpochMilli) () ([]byte, error) {
	return easyjson.Marshal()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *TimeSinceEpochMilli) ( *jlexer.Lexer) {
	* = TimeSinceEpochMilli(time.Unix(0, int64(.Float64()*float64(time.Millisecond))))
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *TimeSinceEpochMilli) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// FrameID unique frame identifier.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-FrameId
type FrameID string

// String returns the FrameID as string value.
func ( FrameID) () string {
	return string()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *FrameID) ( *jlexer.Lexer) {
	 := .Raw()
	if  := len();  > 2 && [0] == '"' && [-1] == '"' {
		 = [1 : -1]
	}

	* = FrameID()
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *FrameID) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// AdFrameType indicates whether a frame has been identified as an ad.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-AdFrameType
type AdFrameType string

// String returns the AdFrameType as string value.
func ( AdFrameType) () string {
	return string()
}

// AdFrameType values.
const (
	AdFrameTypeNone  AdFrameType = "none"
	AdFrameTypeChild AdFrameType = "child"
	AdFrameTypeRoot  AdFrameType = "root"
)

// MarshalEasyJSON satisfies easyjson.Marshaler.
func ( AdFrameType) ( *jwriter.Writer) {
	.String(string())
}

// MarshalJSON satisfies json.Marshaler.
func ( AdFrameType) () ([]byte, error) {
	return easyjson.Marshal()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *AdFrameType) ( *jlexer.Lexer) {
	 := .String()
	switch AdFrameType() {
	case AdFrameTypeNone:
		* = AdFrameTypeNone
	case AdFrameTypeChild:
		* = AdFrameTypeChild
	case AdFrameTypeRoot:
		* = AdFrameTypeRoot

	default:
		.AddError(fmt.Errorf("unknown AdFrameType value: %v", ))
	}
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *AdFrameType) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// AdFrameExplanation [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-AdFrameExplanation
type AdFrameExplanation string

// String returns the AdFrameExplanation as string value.
func ( AdFrameExplanation) () string {
	return string()
}

// AdFrameExplanation values.
const (
	AdFrameExplanationParentIsAd          AdFrameExplanation = "ParentIsAd"
	AdFrameExplanationCreatedByAdScript   AdFrameExplanation = "CreatedByAdScript"
	AdFrameExplanationMatchedBlockingRule AdFrameExplanation = "MatchedBlockingRule"
)

// MarshalEasyJSON satisfies easyjson.Marshaler.
func ( AdFrameExplanation) ( *jwriter.Writer) {
	.String(string())
}

// MarshalJSON satisfies json.Marshaler.
func ( AdFrameExplanation) () ([]byte, error) {
	return easyjson.Marshal()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *AdFrameExplanation) ( *jlexer.Lexer) {
	 := .String()
	switch AdFrameExplanation() {
	case AdFrameExplanationParentIsAd:
		* = AdFrameExplanationParentIsAd
	case AdFrameExplanationCreatedByAdScript:
		* = AdFrameExplanationCreatedByAdScript
	case AdFrameExplanationMatchedBlockingRule:
		* = AdFrameExplanationMatchedBlockingRule

	default:
		.AddError(fmt.Errorf("unknown AdFrameExplanation value: %v", ))
	}
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *AdFrameExplanation) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// AdFrameStatus indicates whether a frame has been identified as an ad and
// why.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-AdFrameStatus
type AdFrameStatus struct {
	AdFrameType  AdFrameType          `json:"adFrameType"`
	Explanations []AdFrameExplanation `json:"explanations,omitempty"`
}

// SecureContextType indicates whether the frame is a secure context and why
// it is the case.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-SecureContextType
type SecureContextType string

// String returns the SecureContextType as string value.
func ( SecureContextType) () string {
	return string()
}

// SecureContextType values.
const (
	SecureContextTypeSecure           SecureContextType = "Secure"
	SecureContextTypeSecureLocalhost  SecureContextType = "SecureLocalhost"
	SecureContextTypeInsecureScheme   SecureContextType = "InsecureScheme"
	SecureContextTypeInsecureAncestor SecureContextType = "InsecureAncestor"
)

// MarshalEasyJSON satisfies easyjson.Marshaler.
func ( SecureContextType) ( *jwriter.Writer) {
	.String(string())
}

// MarshalJSON satisfies json.Marshaler.
func ( SecureContextType) () ([]byte, error) {
	return easyjson.Marshal()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *SecureContextType) ( *jlexer.Lexer) {
	 := .String()
	switch SecureContextType() {
	case SecureContextTypeSecure:
		* = SecureContextTypeSecure
	case SecureContextTypeSecureLocalhost:
		* = SecureContextTypeSecureLocalhost
	case SecureContextTypeInsecureScheme:
		* = SecureContextTypeInsecureScheme
	case SecureContextTypeInsecureAncestor:
		* = SecureContextTypeInsecureAncestor

	default:
		.AddError(fmt.Errorf("unknown SecureContextType value: %v", ))
	}
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *SecureContextType) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// CrossOriginIsolatedContextType indicates whether the frame is cross-origin
// isolated and why it is the case.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-CrossOriginIsolatedContextType
type CrossOriginIsolatedContextType string

// String returns the CrossOriginIsolatedContextType as string value.
func ( CrossOriginIsolatedContextType) () string {
	return string()
}

// CrossOriginIsolatedContextType values.
const (
	CrossOriginIsolatedContextTypeIsolated                   CrossOriginIsolatedContextType = "Isolated"
	CrossOriginIsolatedContextTypeNotIsolated                CrossOriginIsolatedContextType = "NotIsolated"
	CrossOriginIsolatedContextTypeNotIsolatedFeatureDisabled CrossOriginIsolatedContextType = "NotIsolatedFeatureDisabled"
)

// MarshalEasyJSON satisfies easyjson.Marshaler.
func ( CrossOriginIsolatedContextType) ( *jwriter.Writer) {
	.String(string())
}

// MarshalJSON satisfies json.Marshaler.
func ( CrossOriginIsolatedContextType) () ([]byte, error) {
	return easyjson.Marshal()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *CrossOriginIsolatedContextType) ( *jlexer.Lexer) {
	 := .String()
	switch CrossOriginIsolatedContextType() {
	case CrossOriginIsolatedContextTypeIsolated:
		* = CrossOriginIsolatedContextTypeIsolated
	case CrossOriginIsolatedContextTypeNotIsolated:
		* = CrossOriginIsolatedContextTypeNotIsolated
	case CrossOriginIsolatedContextTypeNotIsolatedFeatureDisabled:
		* = CrossOriginIsolatedContextTypeNotIsolatedFeatureDisabled

	default:
		.AddError(fmt.Errorf("unknown CrossOriginIsolatedContextType value: %v", ))
	}
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *CrossOriginIsolatedContextType) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// GatedAPIFeatures [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-GatedAPIFeatures
type GatedAPIFeatures string

// String returns the GatedAPIFeatures as string value.
func ( GatedAPIFeatures) () string {
	return string()
}

// GatedAPIFeatures values.
const (
	GatedAPIFeaturesSharedArrayBuffers                GatedAPIFeatures = "SharedArrayBuffers"
	GatedAPIFeaturesSharedArrayBuffersTransferAllowed GatedAPIFeatures = "SharedArrayBuffersTransferAllowed"
	GatedAPIFeaturesPerformanceMeasureMemory          GatedAPIFeatures = "PerformanceMeasureMemory"
	GatedAPIFeaturesPerformanceProfile                GatedAPIFeatures = "PerformanceProfile"
)

// MarshalEasyJSON satisfies easyjson.Marshaler.
func ( GatedAPIFeatures) ( *jwriter.Writer) {
	.String(string())
}

// MarshalJSON satisfies json.Marshaler.
func ( GatedAPIFeatures) () ([]byte, error) {
	return easyjson.Marshal()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *GatedAPIFeatures) ( *jlexer.Lexer) {
	 := .String()
	switch GatedAPIFeatures() {
	case GatedAPIFeaturesSharedArrayBuffers:
		* = GatedAPIFeaturesSharedArrayBuffers
	case GatedAPIFeaturesSharedArrayBuffersTransferAllowed:
		* = GatedAPIFeaturesSharedArrayBuffersTransferAllowed
	case GatedAPIFeaturesPerformanceMeasureMemory:
		* = GatedAPIFeaturesPerformanceMeasureMemory
	case GatedAPIFeaturesPerformanceProfile:
		* = GatedAPIFeaturesPerformanceProfile

	default:
		.AddError(fmt.Errorf("unknown GatedAPIFeatures value: %v", ))
	}
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *GatedAPIFeatures) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// OriginTrialTokenStatus origin
// Trial(https://www.chromium.org/blink/origin-trials) support. Status for an
// Origin Trial token.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-OriginTrialTokenStatus
type OriginTrialTokenStatus string

// String returns the OriginTrialTokenStatus as string value.
func ( OriginTrialTokenStatus) () string {
	return string()
}

// OriginTrialTokenStatus values.
const (
	OriginTrialTokenStatusSuccess                OriginTrialTokenStatus = "Success"
	OriginTrialTokenStatusNotSupported           OriginTrialTokenStatus = "NotSupported"
	OriginTrialTokenStatusInsecure               OriginTrialTokenStatus = "Insecure"
	OriginTrialTokenStatusExpired                OriginTrialTokenStatus = "Expired"
	OriginTrialTokenStatusWrongOrigin            OriginTrialTokenStatus = "WrongOrigin"
	OriginTrialTokenStatusInvalidSignature       OriginTrialTokenStatus = "InvalidSignature"
	OriginTrialTokenStatusMalformed              OriginTrialTokenStatus = "Malformed"
	OriginTrialTokenStatusWrongVersion           OriginTrialTokenStatus = "WrongVersion"
	OriginTrialTokenStatusFeatureDisabled        OriginTrialTokenStatus = "FeatureDisabled"
	OriginTrialTokenStatusTokenDisabled          OriginTrialTokenStatus = "TokenDisabled"
	OriginTrialTokenStatusFeatureDisabledForUser OriginTrialTokenStatus = "FeatureDisabledForUser"
	OriginTrialTokenStatusUnknownTrial           OriginTrialTokenStatus = "UnknownTrial"
)

// MarshalEasyJSON satisfies easyjson.Marshaler.
func ( OriginTrialTokenStatus) ( *jwriter.Writer) {
	.String(string())
}

// MarshalJSON satisfies json.Marshaler.
func ( OriginTrialTokenStatus) () ([]byte, error) {
	return easyjson.Marshal()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *OriginTrialTokenStatus) ( *jlexer.Lexer) {
	 := .String()
	switch OriginTrialTokenStatus() {
	case OriginTrialTokenStatusSuccess:
		* = OriginTrialTokenStatusSuccess
	case OriginTrialTokenStatusNotSupported:
		* = OriginTrialTokenStatusNotSupported
	case OriginTrialTokenStatusInsecure:
		* = OriginTrialTokenStatusInsecure
	case OriginTrialTokenStatusExpired:
		* = OriginTrialTokenStatusExpired
	case OriginTrialTokenStatusWrongOrigin:
		* = OriginTrialTokenStatusWrongOrigin
	case OriginTrialTokenStatusInvalidSignature:
		* = OriginTrialTokenStatusInvalidSignature
	case OriginTrialTokenStatusMalformed:
		* = OriginTrialTokenStatusMalformed
	case OriginTrialTokenStatusWrongVersion:
		* = OriginTrialTokenStatusWrongVersion
	case OriginTrialTokenStatusFeatureDisabled:
		* = OriginTrialTokenStatusFeatureDisabled
	case OriginTrialTokenStatusTokenDisabled:
		* = OriginTrialTokenStatusTokenDisabled
	case OriginTrialTokenStatusFeatureDisabledForUser:
		* = OriginTrialTokenStatusFeatureDisabledForUser
	case OriginTrialTokenStatusUnknownTrial:
		* = OriginTrialTokenStatusUnknownTrial

	default:
		.AddError(fmt.Errorf("unknown OriginTrialTokenStatus value: %v", ))
	}
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *OriginTrialTokenStatus) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// OriginTrialStatus status for an Origin Trial.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-OriginTrialStatus
type OriginTrialStatus string

// String returns the OriginTrialStatus as string value.
func ( OriginTrialStatus) () string {
	return string()
}

// OriginTrialStatus values.
const (
	OriginTrialStatusEnabled               OriginTrialStatus = "Enabled"
	OriginTrialStatusValidTokenNotProvided OriginTrialStatus = "ValidTokenNotProvided"
	OriginTrialStatusOSNotSupported        OriginTrialStatus = "OSNotSupported"
	OriginTrialStatusTrialNotAllowed       OriginTrialStatus = "TrialNotAllowed"
)

// MarshalEasyJSON satisfies easyjson.Marshaler.
func ( OriginTrialStatus) ( *jwriter.Writer) {
	.String(string())
}

// MarshalJSON satisfies json.Marshaler.
func ( OriginTrialStatus) () ([]byte, error) {
	return easyjson.Marshal()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *OriginTrialStatus) ( *jlexer.Lexer) {
	 := .String()
	switch OriginTrialStatus() {
	case OriginTrialStatusEnabled:
		* = OriginTrialStatusEnabled
	case OriginTrialStatusValidTokenNotProvided:
		* = OriginTrialStatusValidTokenNotProvided
	case OriginTrialStatusOSNotSupported:
		* = OriginTrialStatusOSNotSupported
	case OriginTrialStatusTrialNotAllowed:
		* = OriginTrialStatusTrialNotAllowed

	default:
		.AddError(fmt.Errorf("unknown OriginTrialStatus value: %v", ))
	}
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *OriginTrialStatus) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// OriginTrialUsageRestriction [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-OriginTrialUsageRestriction
type OriginTrialUsageRestriction string

// String returns the OriginTrialUsageRestriction as string value.
func ( OriginTrialUsageRestriction) () string {
	return string()
}

// OriginTrialUsageRestriction values.
const (
	OriginTrialUsageRestrictionNone   OriginTrialUsageRestriction = "None"
	OriginTrialUsageRestrictionSubset OriginTrialUsageRestriction = "Subset"
)

// MarshalEasyJSON satisfies easyjson.Marshaler.
func ( OriginTrialUsageRestriction) ( *jwriter.Writer) {
	.String(string())
}

// MarshalJSON satisfies json.Marshaler.
func ( OriginTrialUsageRestriction) () ([]byte, error) {
	return easyjson.Marshal()
}

// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func ( *OriginTrialUsageRestriction) ( *jlexer.Lexer) {
	 := .String()
	switch OriginTrialUsageRestriction() {
	case OriginTrialUsageRestrictionNone:
		* = OriginTrialUsageRestrictionNone
	case OriginTrialUsageRestrictionSubset:
		* = OriginTrialUsageRestrictionSubset

	default:
		.AddError(fmt.Errorf("unknown OriginTrialUsageRestriction value: %v", ))
	}
}

// UnmarshalJSON satisfies json.Unmarshaler.
func ( *OriginTrialUsageRestriction) ( []byte) error {
	return easyjson.Unmarshal(, )
}

// OriginTrialToken [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-OriginTrialToken
type OriginTrialToken struct {
	Origin           string                      `json:"origin"`
	MatchSubDomains  bool                        `json:"matchSubDomains"`
	TrialName        string                      `json:"trialName"`
	ExpiryTime       *TimeSinceEpoch             `json:"expiryTime"`
	IsThirdParty     bool                        `json:"isThirdParty"`
	UsageRestriction OriginTrialUsageRestriction `json:"usageRestriction"`
}

// OriginTrialTokenWithStatus [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-OriginTrialTokenWithStatus
type OriginTrialTokenWithStatus struct {
	RawTokenText string                 `json:"rawTokenText"`
	ParsedToken  *OriginTrialToken      `json:"parsedToken,omitempty"` // parsedToken is present only when the token is extractable and parsable.
	Status       OriginTrialTokenStatus `json:"status"`
}

// OriginTrial [no description].
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-OriginTrial
type OriginTrial struct {
	TrialName        string                        `json:"trialName"`
	Status           OriginTrialStatus             `json:"status"`
	TokensWithStatus []*OriginTrialTokenWithStatus `json:"tokensWithStatus"`
}

// Frame information about the Frame on the page.
//
// See: https://chromedevtools.github.io/devtools-protocol/tot/Page#type-Frame
type Frame struct {
	ID                             FrameID                        `json:"id"`                             // Frame unique identifier.
	ParentID                       FrameID                        `json:"parentId,omitempty"`             // Parent frame identifier.
	LoaderID                       LoaderID                       `json:"loaderId"`                       // Identifier of the loader associated with this frame.
	Name                           string                         `json:"name,omitempty"`                 // Frame's name as specified in the tag.
	URL                            string                         `json:"url"`                            // Frame document's URL without fragment.
	URLFragment                    string                         `json:"urlFragment,omitempty"`          // Frame document's URL fragment including the '#'.
	DomainAndRegistry              string                         `json:"domainAndRegistry"`              // Frame document's registered domain, taking the public suffixes list into account. Extracted from the Frame's url. Example URLs: http://www.google.com/file.html -> "google.com" http://a.b.co.uk/file.html      -> "b.co.uk"
	SecurityOrigin                 string                         `json:"securityOrigin"`                 // Frame document's security origin.
	MimeType                       string                         `json:"mimeType"`                       // Frame document's mimeType as determined by the browser.
	UnreachableURL                 string                         `json:"unreachableUrl,omitempty"`       // If the frame failed to load, this contains the URL that could not be loaded. Note that unlike url above, this URL may contain a fragment.
	AdFrameStatus                  *AdFrameStatus                 `json:"adFrameStatus,omitempty"`        // Indicates whether this frame was tagged as an ad and why.
	SecureContextType              SecureContextType              `json:"secureContextType"`              // Indicates whether the main document is a secure context and explains why that is the case.
	CrossOriginIsolatedContextType CrossOriginIsolatedContextType `json:"crossOriginIsolatedContextType"` // Indicates whether this is a cross origin isolated context.
	GatedAPIFeatures               []GatedAPIFeatures             `json:"gatedAPIFeatures"`               // Indicated which gated APIs / features are available.
	State                          FrameState                     `json:"-"`                              // Frame state.
	Root                           *Node                          `json:"-"`                              // Frame document root.
	Nodes                          map[NodeID]*Node               `json:"-"`                              // Frame nodes.
	sync.RWMutex                   `json:"-"`                     // Read write mutex.
}

// FrameState is the state of a Frame.
type FrameState uint16

// FrameState enum values.
const (
	FrameDOMContentEventFired FrameState = 1 << (15 - iota)
	FrameLoadEventFired
	FrameAttached
	FrameNavigated
	FrameLoading
	FrameScheduledNavigation
)

// frameStateNames are the names of the frame states.
var frameStateNames = map[FrameState]string{
	FrameDOMContentEventFired: "DOMContentEventFired",
	FrameLoadEventFired:       "LoadEventFired",
	FrameAttached:             "Attached",
	FrameNavigated:            "Navigated",
	FrameLoading:              "Loading",
	FrameScheduledNavigation:  "ScheduledNavigation",
}

// String satisfies stringer interface.
func ( FrameState) () string {
	var  []string
	for ,  := range frameStateNames {
		if & != 0 {
			 = append(, )
		}
	}
	return "[" + strings.Join(, " ") + "]"
}

// EmptyFrameID is the "non-existent" frame id.
const EmptyFrameID = FrameID("")