"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var FieldSemantics_exports = {};
__export(FieldSemantics_exports, {
  FieldSemantics: () => FieldSemantics
});
module.exports = __toCommonJS(FieldSemantics_exports);
var import_errors = require("#decoration/errors.js");
var import_FieldModel = require("#models/FieldModel.js");
var import_general = require("@matter/general");
var import_Semantics = require("./Semantics.js");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
class FieldSemantics extends import_Semantics.Semantics {
  #owner;
  constructor(owner, name) {
    super();
    this.#owner = owner;
    this.mutableModel = new import_FieldModel.FieldModel({ name, parent: owner.mutableModel });
  }
  get owner() {
    return this.#owner;
  }
  get semanticModel() {
    return this.localModel;
  }
  createModel() {
    throw new import_general.InternalError("Unexpected FieldSemantics.createModel");
  }
  integrateModel(model) {
    if (this.localModel === void 0) {
      return model;
    }
    this.mutableModel.operationalBase = model;
    return this.mutableModel;
  }
  static of(source) {
    if (source.kind === "class") {
      throw new import_errors.InvalidMetadataError(
        `Cannot retrieve field semantics for class decorator ${source.name ?? "of anonymous class"}`
      );
    }
    return import_Semantics.Semantics.classOf(source).fieldFor(source.name);
  }
}
//# sourceMappingURL=FieldSemantics.js.map
