import '../../globals.js';
// Copyright 2022-2024, University of Colorado Boulder
import axon from './axon.js';
import ReadOnlyProperty from './ReadOnlyProperty.js';
/**
 * Adds initial value and reset, and a mutable interface.
 *
 * @author Sam Reid (PhET Interactive Simulations)
 */
export default class Property extends ReadOnlyProperty {
    constructor(value, providedOptions) {
        super(value, providedOptions);
        this._initialValue = value;
    }
    /**
     * Returns the initial value of this Property.
     */
    getInitialValue() {
        return this._initialValue;
    }
    get initialValue() {
        return this.getInitialValue();
    }
    /**
     * Stores the specified value as the initial value, which will be taken on reset. Sims should use this sparingly,
     * typically only in situations where the initial value is unknowable at instantiation.
     */
    setInitialValue(initialValue) {
        this._initialValue = initialValue;
    }
    /**
     * Overridden to make public
     */
    get value() {
        return super.value;
    }
    /**
     * Overridden to make public
     * We ran performance tests on Chrome, and determined that calling super.value = newValue is statistically significantly
     * slower at the p = 0.10 level( looping over 10,000 value calls). Therefore, we prefer this optimization.
     */
    set value(newValue) {
        super.set(newValue);
    }
    reset() {
        this.set(this._initialValue);
    }
    /**
     * Overridden to make public
     */
    set(value) {
        super.set(value);
    }
    isSettable() {
        return true;
    }
}
axon.register('Property', Property);
//# sourceMappingURL=Property.js.map