import { cf as r } from "./chunk-CrnJfeNw.js";
class i {
  // Properties
  /**
   * Gets the perf counter used to capture render time
   */
  get renderTimeCounter() {
    return this._renderTime;
  }
  /**
   * Gets the perf counter used to capture layout time
   */
  get layoutTimeCounter() {
    return this._layoutTime;
  }
  /**
   * Enable or disable the render time capture
   */
  get captureRenderTime() {
    return this._captureRenderTime;
  }
  set captureRenderTime(e) {
    e !== this._captureRenderTime && (this._captureRenderTime = e, e ? (this._onBeginRenderObserver = this.texture.onBeginRenderObservable.add(() => {
      this._renderTime.beginMonitoring();
    }), this._onEndRenderObserver = this.texture.onEndRenderObservable.add(() => {
      this._renderTime.endMonitoring(!0);
    })) : (this.texture.onBeginRenderObservable.remove(this._onBeginRenderObserver), this._onBeginRenderObserver = null, this.texture.onEndRenderObservable.remove(this._onEndRenderObserver), this._onEndRenderObserver = null));
  }
  /**
   * Enable or disable the layout time capture
   */
  get captureLayoutTime() {
    return this._captureLayoutTime;
  }
  set captureLayoutTime(e) {
    e !== this._captureLayoutTime && (this._captureLayoutTime = e, e ? (this._onBeginLayoutObserver = this.texture.onBeginLayoutObservable.add(() => {
      this._layoutTime.beginMonitoring();
    }), this._onEndLayoutObserver = this.texture.onEndLayoutObservable.add(() => {
      this._layoutTime.endMonitoring(!0);
    })) : (this.texture.onBeginLayoutObservable.remove(this._onBeginLayoutObserver), this._onBeginLayoutObserver = null, this.texture.onEndLayoutObservable.remove(this._onEndLayoutObserver), this._onEndLayoutObserver = null));
  }
  /**
   * Instantiates a new advanced dynamic texture instrumentation.
   * This class can be used to get instrumentation data from an AdvancedDynamicTexture object
   * @param texture Defines the AdvancedDynamicTexture to instrument
   */
  constructor(e) {
    this.texture = e, this._captureRenderTime = !1, this._renderTime = new r(), this._captureLayoutTime = !1, this._layoutTime = new r(), this._onBeginRenderObserver = null, this._onEndRenderObserver = null, this._onBeginLayoutObserver = null, this._onEndLayoutObserver = null;
  }
  /**
   * Dispose and release associated resources.
   */
  dispose() {
    this.texture.onBeginRenderObservable.remove(this._onBeginRenderObserver), this._onBeginRenderObserver = null, this.texture.onEndRenderObservable.remove(this._onEndRenderObserver), this._onEndRenderObserver = null, this.texture.onBeginLayoutObservable.remove(this._onBeginLayoutObserver), this._onBeginLayoutObserver = null, this.texture.onEndLayoutObservable.remove(this._onEndLayoutObserver), this._onEndLayoutObserver = null, this.texture = null;
  }
}
export {
  i as AdvancedDynamicTextureInstrumentation
};