"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 DataModelPath_exports = {};
__export(DataModelPath_exports, {
  DataModelPath: () => DataModelPath
});
module.exports = __toCommonJS(DataModelPath_exports);
var import_general = require("#general");
/**
 * @license
 * Copyright 2022-2026 Matter.js Authors
 * SPDX-License-Identifier: Apache-2.0
 */
function DataModelPath(id, type) {
  function identity(includeType) {
    if (this.type && includeType) {
      return `${this.type}#${this.id}`;
    }
    return this.id;
  }
  function toString(includeType) {
    if (this.parent) {
      return `${this.parent}.${identity.call(this, includeType)}`;
    }
    return identity.call(this, includeType).toString();
  }
  function toArray() {
    if (this.parent) {
      return [...this.parent.toArray(), this.id];
    }
    return [this.id];
  }
  function asDiagnostic() {
    const result = Array();
    for (const segment of this.toArray()) {
      if (result.length) {
        result.push(".");
      }
      result.push(import_general.Diagnostic.strong(segment));
    }
    return import_general.Diagnostic.squash(result);
  }
  function at(id2, type2) {
    return {
      parent: this,
      id: id2,
      type: type2,
      at,
      toString,
      toArray,
      get [import_general.Diagnostic.value]() {
        return asDiagnostic.apply(this);
      }
    };
  }
  return {
    id,
    type,
    at,
    toString,
    toArray,
    get [import_general.Diagnostic.value]() {
      return asDiagnostic.apply(this);
    }
  };
}
((DataModelPath2) => {
  DataModelPath2.none = DataModelPath2("none");
})(DataModelPath || (DataModelPath = {}));
//# sourceMappingURL=DataModelPath.js.map
