"use strict";
/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Widget
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.createStableWidgetDef = void 0;
function isGenerated(value) {
    return value.startsWith("Widget-");
}
/** Proxy will return `stableId` if target [[WidgetDef]] id is auto-generated.
 * @internal
 */
function createStableWidgetDef(widgetDef, stableId) {
    return new Proxy(widgetDef, {
        get(target, name, receiver) {
            const idName = "id";
            const value = Reflect.get(target, name, receiver);
            if (name === idName && isGenerated(value)) {
                return stableId;
            }
            return value;
        },
    });
}
exports.createStableWidgetDef = createStableWidgetDef;
//# sourceMappingURL=StableWidgetDef.js.map