// Clone sets the language func for the new language.
322930
func (tp *TranslationProvider) Clone(d *deps.Deps) error {
	d.Translate = tp.t.Func(d.Language.Lang)

	return nil
}
285996
func (l Labels) Clone() Labels {
	if l == nil {
		return nil
	}
	out := make(Labels, len(l))
	for key, vals := range l {
		cvals := make([]string, len(vals))
		copy(cvals, vals)
		out[key] = cvals
	}
	return out
}
425068
func (w *ResponseRecorder) Clone() ResponseWriter {
	wc := &ResponseRecorder{}
	wc.headers = w.headers
	wc.chunks = w.chunks[0:]
	if resW, ok := w.ResponseWriter.(*responseWriter); ok {
		wc.ResponseWriter = &(*resW) // clone it
	} else { // else just copy, may pointer, developer can change its behavior
		wc.ResponseWriter = w.ResponseWriter
	}

	return wc
}
117478
func (c *Config) Clone() *Config {
	c.lock.Lock()
	defer c.lock.Unlock()

	return &Config{
		KeyParser: c.KeyParser,

		values: c.values.Clone(),

		lock:    &sync.Mutex{},
		loaders: c.loaders,
	}
}
553492
func (s *Layer) Clone() Middleware {
	mw := New()
	mw.parent = s.parent
	s.mtx.Lock()
	mw.stack = append([]plugin.Plugin(nil), s.stack...)
	s.mtx.Unlock()
	return mw
}
1233965
func (b *Builder) Clone() *Builder {
	newB := &Builder{
		WriteKey:   b.WriteKey,
		Dataset:    b.Dataset,
		SampleRate: b.SampleRate,
		APIHost:    b.APIHost,
		dynFields:  make([]dynamicField, 0, len(b.dynFields)),
		client:     b.client,
	}
	newB.data = make(map[string]interface{})
	b.lock.RLock()
	defer b.lock.RUnlock()
	for k, v := range b.data {
		newB.data[k] = v
	}
	// copy dynamic metric generators
	b.dynFieldsLock.RLock()
	defer b.dynFieldsLock.RUnlock()
	for _, dynFd := range b.dynFields {
		newB.dynFields = append(newB.dynFields, dynFd)
	}
	return newB
}
1163131
func (h *HAConfig) Clone() *HAConfig {
	var c HAConfig
	c.Copy(h)
	return &c
}
1224300
func (p *plugins) clone() *plugins {
	np := &plugins{
		plugins:  make(map[Kind][]Plugin, len(p.plugins)),
		versions: make(map[string]uint16, len(p.versions)),
	}
	for key, value := range p.plugins {
		np.plugins[key] = append([]Plugin(nil), value...)
	}
	for key, value := range p.versions {
		np.versions[key] = value
	}
	for key, value := range p.dyingPlugins {
		np.dyingPlugins[key] = value
	}
	return np
}
102934
func (t *Template) Clone() *Template {
	hm, _ := NewHelperMap()
	hm.AddMany(t.Helpers.Helpers())
	t2 := &Template{
		Helpers: hm,
		Input:   t.Input,
		program: t.program,
	}
	return t2
}
168008
func (ds *DelayedSource) Clone() Source {
	return &DelayedSource{
		Source:  ds.Source.Clone(),
		Latency: ds.Latency,
	}
}
872465
func (s *Set) Clone() *Set {
	items := make([]string, len(s.items))
	copy(items, s.items)
	return &Set{items}
}
216539
func (u *User) clone() *User {
	if u == nil {
		return nil
	}
	clone := &User{}
	*clone = *u
	clone.Permissions = u.Permissions.clone()
	return clone
}
143671
func (c *Call) Clone() *Call {
	if c == nil {
		return nil
	}

	other := &Call{
		Name: c.Name,
		Args: CopyArgs(c.Args),
	}
	if c.Children != nil {
		other.Children = make([]*Call, len(c.Children))
		for i := range c.Children {
			other.Children[i] = c.Children[i].Clone()
		}
	}
	return other
}
101435
func (w *responseWriter) Clone() ResponseWriter {
	wc := &responseWriter{}
	wc.ResponseWriter = w.ResponseWriter
	wc.statusCode = w.statusCode
	wc.beforeFlush = w.beforeFlush
	wc.written = w.written
	return wc
}
110177
func (c *Constant) Clone() Expression {
	if c.DeferredExpr != nil {
		con := *c
		return &con
	}
	return c
}
1360837
func (t *Table) clone() *Table {
	tt := &Table{outputMode: t.outputMode, Style: t.Style, title: t.title}
	if t.headers != nil {
		tt.headers = make([]interface{}, len(t.headers))
		copy(tt.headers, t.headers)
	}
	if t.elements != nil {
		tt.elements = make([]Element, len(t.elements))
		copy(tt.elements, t.elements)
	}
	return tt
}
1185536
func (t *Record) Clone() interface{} {
	retVal := new(Record)
	ts := BorrowTypes(len(t.ts))
	for i, tt := range t.ts {
		if c, ok := tt.(Cloner); ok {
			ts[i] = c.Clone().(Type)
		} else {
			ts[i] = tt
		}
	}
	retVal.ts = ts
	retVal.name = t.name

	return retVal
}